]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '0.9.x' into testing
authorBrion Vibber <brion@pobox.com>
Wed, 5 Jan 2011 17:41:29 +0000 (09:41 -0800)
committerBrion Vibber <brion@pobox.com>
Wed, 5 Jan 2011 17:41:29 +0000 (09:41 -0800)
classes/Design.php
index.php
js/Makefile
js/json2.js
js/json2.min.js
lib/common.php
lib/nickname.php
locale/fr/LC_MESSAGES/statusnet.po
tests/ActivityGenerationTests.php
tests/NicknameTest.php

index a8fdb72191e861055bf527dda81c4dc7247f40c7..f4834c714e80038e928ab01c2067bf1f6e4c93e9 100644 (file)
@@ -107,7 +107,7 @@ class Design extends Memcached_DataObject
 
     static function toWebColor($color)
     {
-        if ($color == null) {
+        if ($color === null || $color === '') {
             return null;
         }
 
index 049d46afceea1ff567956e7bdaaed50d76427da8..6f011e7e5bba37bcf7a0dce17765a75625c9ca6d 100644 (file)
--- a/index.php
+++ b/index.php
@@ -204,7 +204,7 @@ function main()
 {
     // fake HTTP redirects using lighttpd's 404 redirects
     if (strpos($_SERVER['SERVER_SOFTWARE'], 'lighttpd') !== false) {
-        $_lighty_url = $base_url.$_SERVER['REQUEST_URI'];
+        $_lighty_url = $_SERVER['REQUEST_URI'];
         $_lighty_url = @parse_url($_lighty_url);
 
         if ($_lighty_url['path'] != '/index.php' && $_lighty_url['path'] != '/') {
index e7ae44e4214b6c556dc5655d46fa2cc8c140cfee..2f3dfcdf70ff253a3e294105028c6e95d72a0267 100644 (file)
@@ -1,12 +1,15 @@
 .fake: all clean
 
-TARGETS=util.min.js
-SOURCES=util.js xbImportNode.js geometa.js
+TARGETS=util.min.js json2.min.js
+UTIL_SOURCES=util.js xbImportNode.js geometa.js
 
 all: $(TARGETS)
 
 clean:
        rm -f $(TARGETS)
 
-util.min.js: $(SOURCES)
+util.min.js: $(UTIL_SOURCES)
        cat $+ | yui-compressor --type js > $@
+
+json2.min.js: json2.js
+       yui-compressor $+ > $@
index e9ccc0d376a7a51db4aed6875a41c9ea6340c0db..6bdea10e51ff2a00a271af3a1492fa7436f7463e 100644 (file)
@@ -1,4 +1,3 @@
-alert('IMPORTANT: Remove this line from json2.js before deployment.');
 /*
     http://www.JSON.org/json2.js
     2010-08-25
index e84c5f70fca0c806d58b09437311cc0ed012b80f..08977b590c3e20550367ea0300799919c6fef9e5 100644 (file)
@@ -1 +1 @@
-alert("IMPORTANT: Remove this line from json2.js before deployment.");if(!this.JSON){this.JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());
\ No newline at end of file
+if(!this.JSON){this.JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());
\ No newline at end of file
index 22890b5cb751d8e0336953e10f4d0e72e7e00546..6138200e49880f2da1688049613ac9d366025df5 100644 (file)
@@ -22,13 +22,13 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
 //exit with 200 response, if this is checking fancy from the installer
 if (isset($_REQUEST['p']) && $_REQUEST['p'] == 'check-fancy') {  exit; }
 
-define('STATUSNET_BASE_VERSION', '0.9.7');
-define('STATUSNET_LIFECYCLE', 'alpha1'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release'
+define('STATUSNET_BASE_VERSION', '0.9.8');
+define('STATUSNET_LIFECYCLE', 'dev'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release'
 define('STATUSNET_VERSION', STATUSNET_BASE_VERSION . STATUSNET_LIFECYCLE);
 
 define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility
 
-define('STATUSNET_CODENAME', 'World Leader Pretend');
+define('STATUSNET_CODENAME', 'Letter Never Sent');
 
 define('AVATAR_PROFILE_SIZE', 96);
 define('AVATAR_STREAM_SIZE', 48);
index 562f1e2052897252558a309998ccb801e0a4d48a..4d3795e392231fe5a8bd9966f8f28f504dd847c7 100644 (file)
@@ -103,15 +103,17 @@ class Nickname
      */
     public static function normalize($str)
     {
+        if (mb_strlen($str) > self::MAX_LEN) {
+            // Display forms must also fit!
+            throw new NicknameTooLongException();
+        }
+
         $str = trim($str);
         $str = str_replace('_', '', $str);
         $str = mb_strtolower($str);
 
-        $len = mb_strlen($str);
-        if ($len < 1) {
+        if (mb_strlen($str) < 1) {
             throw new NicknameEmptyException();
-        } else if ($len > self::MAX_LEN) {
-            throw new NicknameTooLongException();
         }
         if (!self::isCanonical($str)) {
             throw new NicknameInvalidException();
index ee415abb4ff873d7d94876419a8634a706e81223..32c774597d95155feb1614ce3711eeedde593651 100644 (file)
@@ -8247,7 +8247,7 @@ msgstr ""
 #: lib/mail.php:680
 #, php-format
 msgid "%1$s (@%2$s) sent a notice to your attention"
-msgstr "%1$s (@%2$s) a envoyé un avis à vote attention"
+msgstr "%1$s (@%2$s) a envoyé un avis à votre attention"
 
 #. TRANS: Body of @-reply notification e-mail.
 #. TRANS: %1$s is the sending user's long name, $2$s is the StatusNet sitename,
index b9e74a570ae141f7b3337683223a2c8be449a556..8cf1b009ed6ed5379e98d68c6d0e50f5b6d20a52 100644 (file)
@@ -194,7 +194,7 @@ class ActivityGenerationTests extends PHPUnit_Framework_TestCase
         $actor  = ActivityUtils::child($element, 'actor', Activity::SPEC);
 
         $this->assertFalse(is_null($author));
-        $this->assertFalse(is_null($actor));
+        $this->assertTrue(is_null($actor)); // <activity:actor> is obsolete, no longer added
     }
 
     public function testAuthorContent()
@@ -213,6 +213,9 @@ class ActivityGenerationTests extends PHPUnit_Framework_TestCase
         $this->assertEquals($this->author1->uri, ActivityUtils::childContent($author, 'uri'));
     }
 
+    /**
+     * We no longer create <activity:actor> entries, they have merged to <atom:author>
+     */
     public function testActorContent()
     {
         $notice = $this->_fakeNotice();
@@ -225,8 +228,7 @@ class ActivityGenerationTests extends PHPUnit_Framework_TestCase
 
         $actor = ActivityUtils::child($element, 'actor', Activity::SPEC);
 
-        $this->assertEquals($this->author1->uri, ActivityUtils::childContent($actor, 'id'));
-        $this->assertEquals($this->author1->nickname, ActivityUtils::childContent($actor, 'title'));
+        $this->assertEquals($actor, null);
     }
 
     public function testReplyLink()
index f49aeba602421957dae8e6e20e7656a520a46bf9..66e883c049f9cd40116e3f3971dd804a3c64e715 100644 (file)
@@ -33,9 +33,14 @@ class NicknameTest extends PHPUnit_Framework_TestCase
 
         if ($expected === false) {
             if ($expectedException) {
+                if ($exception) {
+                    $stuff = get_class($exception) . ': ' . $exception->getMessage();
+                } else {
+                    $stuff = var_export($exception, true);
+                }
                 $this->assertTrue($exception && $exception instanceof $expectedException,
                         "invalid input '$input' expected to fail with $expectedException, " .
-                        "got " . get_class($exception) . ': ' . $exception->getMessage());
+                        "got $stuff");
             } else {
                 $this->assertTrue($normalized == false,
                         "invalid input '$input' expected to fail");
@@ -104,7 +109,7 @@ class NicknameTest extends PHPUnit_Framework_TestCase
                      array('', false, 'NicknameEmptyException'),
                      array('___', false, 'NicknameEmptyException'),
                      array('eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'), // 64 chars
-                     array('eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee_', 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'), // the _ will be trimmed off, remaining valid
+                     array('eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee_', false, 'NicknameTooLongException'), // the _ is too long...
                      array('eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', false, 'NicknameTooLongException'), // 65 chars -- too long
                      );
     }