Index: trunk/phase3/skins/common/wikibits.js |
— | — | @@ -461,53 +461,6 @@ |
462 | 462 | } |
463 | 463 | } |
464 | 464 | |
465 | | -function setupRightClickEdit() { |
466 | | - if (document.getElementsByTagName) { |
467 | | - var spans = document.getElementsByTagName('span'); |
468 | | - for (var i = 0; i < spans.length; i++) { |
469 | | - var el = spans[i]; |
470 | | - if(el.className == 'editsection') { |
471 | | - addRightClickEditHandler(el); |
472 | | - } |
473 | | - } |
474 | | - } |
475 | | -} |
476 | | - |
477 | | -function addRightClickEditHandler(el) { |
478 | | - for (var i = 0; i < el.childNodes.length; i++) { |
479 | | - var link = el.childNodes[i]; |
480 | | - if (link.nodeType == 1 && link.nodeName.toLowerCase() == 'a') { |
481 | | - var editHref = link.getAttribute('href'); |
482 | | - // find the enclosing (parent) header |
483 | | - var prev = el.parentNode; |
484 | | - if (prev && prev.nodeType == 1 && |
485 | | - prev.nodeName.match(/^[Hh][1-6]$/)) { |
486 | | - prev.oncontextmenu = function(e) { |
487 | | - if (!e) { e = window.event; } |
488 | | - // e is now the event in all browsers |
489 | | - var targ; |
490 | | - if (e.target) { targ = e.target; } |
491 | | - else if (e.srcElement) { targ = e.srcElement; } |
492 | | - if (targ.nodeType == 3) { // defeat Safari bug |
493 | | - targ = targ.parentNode; |
494 | | - } |
495 | | - // targ is now the target element |
496 | | - |
497 | | - // We don't want to deprive the noble reader of a context menu |
498 | | - // for the section edit link, do we? (Might want to extend this |
499 | | - // to all <a>'s?) |
500 | | - if (targ.nodeName.toLowerCase() != 'a' |
501 | | - || targ.parentNode.className != 'editsection') { |
502 | | - document.location = editHref; |
503 | | - return false; |
504 | | - } |
505 | | - return true; |
506 | | - }; |
507 | | - } |
508 | | - } |
509 | | - } |
510 | | -} |
511 | | - |
512 | 465 | var checkboxes; |
513 | 466 | var lastCheckbox; |
514 | 467 | |
Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -983,40 +983,25 @@ |
984 | 984 | } |
985 | 985 | |
986 | 986 | /** |
987 | | - * This function takes one or two arrays, objects, or strings as input, and returns a CGI-style string, e.g. |
| 987 | + * This function takes two arrays as input, and returns a CGI-style string, e.g. |
988 | 988 | * "days=7&limit=100". Options in the first array override options in the second. |
989 | 989 | * Options set to "" will not be output. |
990 | | - * @depreciated |
991 | 990 | */ |
992 | | -function wfArrayToCGI( $query1, $query2 = null ) { |
993 | | - if( is_null($query2) ) wfBuildQuery( $query1 ); |
994 | | - else wfBuildQuery( $query2, $query1 ); |
995 | | -} |
996 | | -/** |
997 | | - * wfBuildQuery is a improved wrapper for http_build_query. |
998 | | - * We support a defaults array which the query may be merged with. As well we also support |
999 | | - * arrays, objects, and strings as input. |
1000 | | - */ |
1001 | | -function wfBuildQuery( $query, $defaults = null ) { |
1002 | | - if( !is_null($defaults) ) { |
1003 | | - ## If either array is a string, then parse it and make sure to fix magic quotes. |
1004 | | - foreach( array( 'query', 'defaults' ) as $var ) { |
1005 | | - if( is_string($$var) ) { |
1006 | | - $arr = array(); |
1007 | | - parse_str($$var, &$arr); |
1008 | | - if( function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc() ) { |
1009 | | - global $wgRequest; |
1010 | | - $wgRequest->fix_magic_quotes( $arr ); |
1011 | | - } |
1012 | | - $$var = $arr; |
| 991 | +function wfArrayToCGI( $array1, $array2 = NULL ) |
| 992 | +{ |
| 993 | + if ( !is_null( $array2 ) ) { |
| 994 | + $array1 = $array1 + $array2; |
| 995 | + } |
| 996 | + |
| 997 | + $cgi = ''; |
| 998 | + foreach ( $array1 as $key => $value ) { |
| 999 | + if ( '' !== $value ) { |
| 1000 | + if ( '' != $cgi ) { |
| 1001 | + $cgi .= '&'; |
1013 | 1002 | } |
| 1003 | + $cgi .= urlencode( $key ) . '=' . urlencode( $value ); |
1014 | 1004 | } |
1015 | | - # Merge, make sure they are arrays, not objects. |
1016 | | - $query = ((array)$defaults) + ((array)$query); |
1017 | 1005 | } |
1018 | | - |
1019 | | - # Note that we must specify & because the default is sometimes & |
1020 | | - $cgi = is_string($query) ? $query : http_build_query( $query, null, '&' ); |
1021 | 1006 | return $cgi; |
1022 | 1007 | } |
1023 | 1008 | |
— | — | @@ -2352,8 +2337,13 @@ |
2353 | 2338 | * Get a cache key |
2354 | 2339 | */ |
2355 | 2340 | function wfMemcKey( /*... */ ) { |
| 2341 | + global $wgDBprefix, $wgDBname; |
2356 | 2342 | $args = func_get_args(); |
2357 | | - $key = wfWikiID() . ':' . implode( ':', $args ); |
| 2343 | + if ( $wgDBprefix ) { |
| 2344 | + $key = "$wgDBname-$wgDBprefix:" . implode( ':', $args ); |
| 2345 | + } else { |
| 2346 | + $key = $wgDBname . ':' . implode( ':', $args ); |
| 2347 | + } |
2358 | 2348 | return $key; |
2359 | 2349 | } |
2360 | 2350 | |
— | — | @@ -2362,7 +2352,11 @@ |
2363 | 2353 | */ |
2364 | 2354 | function wfForeignMemcKey( $db, $prefix /*, ... */ ) { |
2365 | 2355 | $args = array_slice( func_get_args(), 2 ); |
2366 | | - wfForeignWikiID($db,$prefix) . ':' . implode( ':', $args ); |
| 2356 | + if ( $prefix ) { |
| 2357 | + $key = "$db-$prefix:" . implode( ':', $args ); |
| 2358 | + } else { |
| 2359 | + $key = $db . ':' . implode( ':', $args ); |
| 2360 | + } |
2367 | 2361 | return $key; |
2368 | 2362 | } |
2369 | 2363 | |
— | — | @@ -2371,7 +2365,7 @@ |
2372 | 2366 | * This is used as a prefix in memcached keys |
2373 | 2367 | */ |
2374 | 2368 | function wfWikiID() { |
2375 | | - global $wgDBname, wgDBprefix; |
| 2369 | + global $wgDBprefix, $wgDBname; |
2376 | 2370 | if ( $wgDBprefix ) { |
2377 | 2371 | return "$wgDBname-$wgDBprefix"; |
2378 | 2372 | } else { |
— | — | @@ -2380,22 +2374,6 @@ |
2381 | 2375 | } |
2382 | 2376 | |
2383 | 2377 | /** |
2384 | | - * Get an ASCII string identifying a foreign wiki or shared db |
2385 | | - * This is used as a prefix in foreign memcached keys |
2386 | | - */ |
2387 | | -function wfForeignWikiID( $db = null, $prefix = null ) { |
2388 | | - global $wgSharedDB, $wgSharedPrefix, $wgDBname, $wgDBprefix; |
2389 | | - if( !isset($db) ) $db = (isset($wgSharedDB) ? $wgSharedDB, $wgDBname); |
2390 | | - if( !isset($prefix) ) $prefix = ($wgSharedPrefix ? $wgSharedPrefix, $wgDBprefix); |
2391 | | - |
2392 | | - if ( $prefix ) { |
2393 | | - return "$db-$prefix"; |
2394 | | - } else { |
2395 | | - return $db; |
2396 | | - } |
2397 | | -} |
2398 | | - |
2399 | | -/** |
2400 | 2378 | * Split a wiki ID into DB name and table prefix |
2401 | 2379 | */ |
2402 | 2380 | function wfSplitWikiID( $wiki ) { |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -761,12 +761,10 @@ |
762 | 762 | */ |
763 | 763 | public function getFullURL( $query = '', $variant = false ) { |
764 | 764 | global $wgContLang, $wgServer, $wgRequest; |
765 | | - |
766 | | - $query = wfBuildQuery( $query ); # Support query input other than strings. |
767 | | - |
| 765 | + |
768 | 766 | if ( '' == $this->mInterwiki ) { |
769 | 767 | $url = $this->getLocalUrl( $query, $variant ); |
770 | | - |
| 768 | + |
771 | 769 | // Ugly quick hack to avoid duplicate prefixes (bug 4571 etc) |
772 | 770 | // Correct fix would be to move the prepending elsewhere. |
773 | 771 | if ($wgRequest->getVal('action') != 'render') { |
— | — | @@ -774,7 +772,7 @@ |
775 | 773 | } |
776 | 774 | } else { |
777 | 775 | $baseUrl = $this->getInterwikiLink( $this->mInterwiki ); |
778 | | - |
| 776 | + |
779 | 777 | $namespace = wfUrlencode( $this->getNsText() ); |
780 | 778 | if ( '' != $namespace ) { |
781 | 779 | # Can this actually happen? Interwikis shouldn't be parsed. |
— | — | @@ -803,16 +801,14 @@ |
804 | 802 | public function getLocalURL( $query = '', $variant = false ) { |
805 | 803 | global $wgArticlePath, $wgScript, $wgServer, $wgRequest; |
806 | 804 | global $wgVariantArticlePath, $wgContLang, $wgUser; |
807 | | - |
808 | | - $query = wfBuildQuery( $query ); # Support query input other than strings. |
809 | | - |
| 805 | + |
810 | 806 | // internal links should point to same variant as current page (only anonymous users) |
811 | 807 | if($variant == false && $wgContLang->hasVariants() && !$wgUser->isLoggedIn()){ |
812 | 808 | $pref = $wgContLang->getPreferredVariant(false); |
813 | 809 | if($pref != $wgContLang->getCode()) |
814 | 810 | $variant = $pref; |
815 | 811 | } |
816 | | - |
| 812 | + |
817 | 813 | if ( $this->isExternal() ) { |
818 | 814 | $url = $this->getFullURL(); |
819 | 815 | if ( $query ) { |
— | — | @@ -848,7 +844,7 @@ |
849 | 845 | $query = $matches[1]; |
850 | 846 | if( isset( $matches[4] ) ) $query .= $matches[4]; |
851 | 847 | $url = str_replace( '$1', $dbkey, $wgActionPaths[$action] ); |
852 | | - $url = wfAppendQuery( $url, $query ); |
| 848 | + if( $query != '' ) $url .= '?' . $query; |
853 | 849 | } |
854 | 850 | } |
855 | 851 | if ( $url === false ) { |
— | — | @@ -858,7 +854,7 @@ |
859 | 855 | $url = "{$wgScript}?title={$dbkey}&{$query}"; |
860 | 856 | } |
861 | 857 | } |
862 | | - |
| 858 | + |
863 | 859 | // FIXME: this causes breakage in various places when we |
864 | 860 | // actually expected a local URL and end up with dupe prefixes. |
865 | 861 | if ($wgRequest->getVal('action') == 'render') { |