diff --git a/classes/Design.php b/classes/Design.php index a8fdb72191..f4834c714e 100644 --- a/classes/Design.php +++ b/classes/Design.php @@ -107,7 +107,7 @@ class Design extends Memcached_DataObject static function toWebColor($color) { - if ($color == null) { + if ($color === null || $color === '') { return null; } diff --git a/index.php b/index.php index 049d46afce..6f011e7e5b 100644 --- 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'] != '/') { diff --git a/js/Makefile b/js/Makefile index e7ae44e421..2f3dfcdf70 100644 --- a/js/Makefile +++ b/js/Makefile @@ -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 $+ > $@ diff --git a/js/json2.js b/js/json2.js index e9ccc0d376..6bdea10e51 100644 --- a/js/json2.js +++ b/js/json2.js @@ -1,4 +1,3 @@ -alert('IMPORTANT: Remove this line from json2.js before deployment.'); /* http://www.JSON.org/json2.js 2010-08-25 diff --git a/js/json2.min.js b/js/json2.min.js index e84c5f70fc..08977b590c 100644 --- a/js/json2.min.js +++ b/js/json2.min.js @@ -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 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(); diff --git a/locale/fr/LC_MESSAGES/statusnet.po b/locale/fr/LC_MESSAGES/statusnet.po index ee415abb4f..32c774597d 100644 --- a/locale/fr/LC_MESSAGES/statusnet.po +++ b/locale/fr/LC_MESSAGES/statusnet.po @@ -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, diff --git a/tests/ActivityGenerationTests.php b/tests/ActivityGenerationTests.php index b9e74a570a..8cf1b009ed 100644 --- a/tests/ActivityGenerationTests.php +++ b/tests/ActivityGenerationTests.php @@ -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)); // 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 entries, they have merged to + */ 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() diff --git a/tests/NicknameTest.php b/tests/NicknameTest.php index f49aeba602..66e883c049 100644 --- a/tests/NicknameTest.php +++ b/tests/NicknameTest.php @@ -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 ); }