1<?php 2/* 3 4 This script handles all 401, 403 and 404 error redirects, 5 and some directory requests (like /images). Uses the 6 preferred language setting and the REQUEST_URI to guess what 7 page should be displayed. In case there is no page that can 8 be displayed, the user is redirected to a search page. 9 10*/ 11 12// Ensure that our environment is set up 13include_once __DIR__ . '/include/prepend.inc'; 14include_once __DIR__ . '/include/languages.inc'; 15include_once __DIR__ . '/include/errors.inc'; 16 17// Get URI for this request, strip leading slash 18// See langchooser.inc for more info on STRIPPED_URI 19$URI = substr($_SERVER['STRIPPED_URI'], 1); 20 21// ============================================================================ 22// Mozilla Search Sidebar plugin resource file handling (need to be mirror 23// dependent, so the search results will show up in the sidebar) 24if ($URI == 'phpnetsearch.src') { 25 status_header(200); 26 include_once __DIR__ . '/include/mozsearch.inc'; 27 exit; 28} 29// FIXME: Nuke the old firefox search plugin 30if ($URI == 'phpnetimprovedsearch.src') { 31 status_header(200); 32 include_once __DIR__ . '/include/mozopensearch.inc'; 33 exit; 34} 35 36// ============================================================================ 37// BC: handle bugs.php moved completely to bugs.php.net 38if (preg_match("!^bugs.php\\?(.+)$!", $URI, $array)) { 39 mirror_redirect("https://bugs.php.net/?$array[1]"); 40} 41 42// ============================================================================ 43// FC: handle advisories 44if (preg_match("!^security/advisories/PHPSA-(\\d+)\\.php$!", $URI, $array)) { 45 status_header(200); 46 $_GET["id"] = $array[1]; 47 include_once __DIR__ . '/security/index.php'; 48 exit; 49} 50 51// ============================================================================ 52// Omit query string from URL and urldecode special chars 53$URI = urldecode(preg_replace("!(\\?.*$)!", "", $URI)); 54 55// ============================================================================ 56// An empty URI is useless at this point, so let's give them the search page 57if (empty($URI)) { 58 mirror_redirect("/search.php"); 59} 60 61// ============================================================================ 62// Perform a redirect for manual figures, other images display a 404 automatically 63if (preg_match("!^manual/(\\w+)/(print|printwn)/figures/(.+)$!", $URI, $parts)) { 64 mirror_redirect("/manual/$parts[1]/figures/$parts[3]"); 65} elseif (preg_match("!\\.(pdf|gif|jpg|png)$!i", $URI)) { 66 error_404(); 67} 68 69// ============================================================================ 70// BC: handle .php3 files that were renamed to .php 71if (preg_match("!(.*\\.php)3$!", $URI, $array)) { 72 mirror_redirect("/$array[1]"); 73} 74 75// ============================================================================ 76// BC: handle moving english manual down into its own directory (also supports 77// default language manual accessibility on mirror sites through /manual/filename) 78// @todo do we rely on this? how about removing it... 79if (preg_match("!^manual/([^/]*)$!", $URI, $array)) { 80 if (!isset($INACTIVE_ONLINE_LANGUAGES[$array[1]])) { 81 mirror_redirect("/manual/$LANG/$array[1]"); 82 } 83} elseif (preg_match("!^manual/html/([^/]+)$!", $URI, $array)) { 84 $array[1] = preg_replace("!.html$!", ".php", $array[1]); 85 mirror_redirect("/manual/$LANG/$array[1]"); 86} 87 88// ============================================================================ 89// BC: News archive moved to subfolder 90if (preg_match("!^news-(\\d+)(\\.|$)!", $URI, $array)) { 91 mirror_redirect("/archive/$array[1].php"); 92} 93 94// ============================================================================ 95// BC: Release files moved to subfolder 96if (preg_match("!^release_([^\\.]+)(\\.php$|$)!", $URI, $array)) { 97 mirror_redirect("/releases/$array[1].php"); 98} 99 100// ============================================================================ 101// BC: Printer friendly manual page handling was separate previously, but we 102// only need to redirect the old URLs now. Our pages are now printer friendly 103// by design. 104if (preg_match("!^manual/(\\w+)/(print|printwn|html)((/.+)|$)!", $URI, $array)) { 105 $array[3] = preg_replace("!.html$!", ".php", $array[3]); 106 mirror_redirect("/manual/$array[1]$array[3]"); 107} 108 109// ============================================================================ 110// If someone is looking for something in distributions/* and it isn't there, 111// send them to the /releases page since that is likely to be most helpful. 112if (preg_match("!^distributions/.*!", $URI, $array)) { 113 status_header(404); 114 include_once __DIR__ . "/releases/index.php"; 115} 116 117// ============================================================================ 118// The trailing slash only causes problems from now on 119$URI = rtrim($URI, '/'); 120 121// ============================================================================ 122// Some nice URLs for getting something for download 123if (preg_match("!^get/([^/]+)$!", $URI, $what)) { 124 switch ($what[1]) { 125 case "php": 126 $URI = "downloads"; 127 break; 128 case "docs": // intentional 129 case "documentation": 130 $URI = "download-docs"; 131 break; 132 } 133} 134 135// ============================================================================ 136// Nice URLs for download files, so wget works completely well with download links 137if (preg_match("!^get/([^/]+)/from/([^/]+)(/mirror)?$!", $URI, $dlinfo)) { 138 139 $df = $dlinfo[1]; 140 if (strpos($df, "7-LATEST") !== false) { 141 include_once __DIR__ . "/include/version.inc"; 142 [$latest] = release_get_latest(); 143 $df = str_replace("7-LATEST", $latest, $df); 144 } 145 146 $mr = "https://www.php.net/"; 147 148 // Check if that mirror really exists if not, bail out 149 if (!isset($MIRRORS[$mr])) { 150 error_nomirror($mr); 151 exit; 152 } 153 154 // Start the download process 155 include __DIR__ . "/include/do-download.inc"; 156 $filename = get_actual_download_file($df); 157 if ($filename) { 158 status_header(200); 159 download_file($mr, $filename); 160 } else { 161 status_header(404); 162 /* The file didn't exist on this server.. ask the user to pick another mirror */ 163 include __DIR__ . "/include/get-download.inc"; 164 } 165 exit; 166} 167 168// php.net/42 --> likely a bug number 169if (is_numeric($URI)) { 170 mirror_redirect("http://bugs.php.net/bug.php?id=$URI"); 171} 172 173// php.net/GH-123 -> php-src GH issue #123 174if (preg_match('/^GH-(\d+)$/', $URI, $matches)) { 175 mirror_redirect("https://github.com/php/php-src/issues/" . $matches[1]); 176} 177 178// ============================================================================ 179// Redirect if the entered URI was a PHP page name (except some pages, 180// which we display in the mirror's language or the explicitly specified 181// language [see below]) 182if (!in_array($URI, ['mirror-info', 'error', 'mod'], true) && 183 file_exists($_SERVER['DOCUMENT_ROOT'] . "/$URI.php")) { 184 mirror_redirect("/$URI.php"); 185} 186 187// Work with lowercased URI from now 188$URI = strtolower($URI); 189 190// Redirection hack, see error.inc for detailed description 191// These expect -foo not _foo 192$term = str_replace('_', '-', $URI); 193 194if ($path = is_known_ini($term)) { 195 status_header(301); 196 mirror_redirect("/manual/$LANG/$path"); 197 exit; 198} 199if ($path = is_known_variable($term)) { 200 status_header(301); 201 mirror_redirect("/manual/$LANG/$path"); 202 exit; 203} 204if ($path = is_known_term($term)) { 205 status_header(301); 206 mirror_redirect("/manual/$LANG/$path"); 207 exit; 208} 209 210// ============================================================================ 211// Major manual page modifications (need to handle shortcuts and pages in all languages) 212// Used permanent HTTP redirects, so search engines will be able to pick up the correct 213// new URLs for these pages. 214$manual_page_moves = [ 215 // entry point changed 216 'installation' => 'install', 217 218 // was split among platforms (don't know where to redirect) 219 'install.apache' => 'install', 220 'install.apache2' => 'install', 221 'install.netscape-enterprise' => 'install', 222 'install.otherhttpd' => 'install', 223 224 // moved to platform sections 225 'install.caudium' => 'install.unix.caudium', 226 'install.commandline' => 'install.unix.commandline', 227 'install.fhttpd' => 'install.unix.fhttpd', 228 'install.hpux' => 'install.unix.hpux', 229 'install.iis' => 'install.windows.iis', 230 'install.linux' => 'install.unix', 231 'install.omnihttpd' => 'install.windows.omnihttpd', 232 'install.openbsd' => 'install.unix.openbsd', 233 'install.sambar' => 'install.windows.sambar', 234 'install.solaris' => 'install.unix.solaris', 235 'install.xitami' => 'install.windows.xitami', 236 'install.windows.installer.msi' => 'install.windows', 237 'install.windows.installer' => 'install.windows', 238 239 // Internals docs where moved 240 'zend' => 'internals2.ze1.zendapi', 241 'zend-api' => 'internals2.ze1.zendapi', 242 'internals.pdo' => 'internals2.pdo', 243 'phpdevel' => 'internals2.ze1.php3devel', 244 'tsrm' => 'internals2.ze1.tsrm', 245 246 // Replaced extensions 247 'aspell' => 'pspell', 248 249 // Refactored 250 'regexp.reference' => 'regexp.introduction', 251 "security" => "manual/security", 252]; 253 254if (isset($manual_page_moves[$URI])) { 255 status_header(301); 256 mirror_redirect("/" . $manual_page_moves[$URI]); 257} elseif (preg_match("!^manual/([^/]+)/([^/]+).php$!", $URI, $match) && 258 isset($manual_page_moves[$match[2]])) { 259 status_header(301); 260 mirror_redirect("/manual/$match[1]/" . $manual_page_moves[$match[2]] . ".php"); 261} 262 263$manual_redirections = [ 264 'class.oci-lob' => 'class.ocilob', 265 'oci-lob.append' => 'ocilob.append', 266 'oci-lob.close' => 'ocilob.close', 267 'oci-lob.eof' => 'ocilob.eof', 268 'oci-lob.erase' => 'ocilob.erase', 269 'oci-lob.export' => 'ocilob.export', 270 'oci-lob.flush' => 'ocilob.flush', 271 'oci-lob.free' => 'ocilob.free', 272 'oci-lob.getbuffering' => 'ocilob.getbuffering', 273 'oci-lob.import' => 'ocilob.import', 274 'oci-lob.load' => 'ocilob.load', 275 'oci-lob.read' => 'ocilob.read', 276 'oci-lob.rewind' => 'ocilob.rewind', 277 'oci-lob.save' => 'ocilob.save', 278 'oci-lob.seek' => 'ocilob.seek', 279 'oci-lob.setbuffering' => 'ocilob.setbuffering', 280 'oci-lob.size' => 'ocilob.size', 281 'oci-lob.tell' => 'ocilob.tell', 282 'oci-lob.truncate' => 'ocilob.truncate', 283 'oci-lob.write' => 'ocilob.write', 284 'oci-lob.writetemporary' => 'ocilob.writetemporary', 285 'class.oci-collection' => 'class.ocicollection', 286 'oci-collection.append' => 'ocicollection.append', 287 'oci-collection.assign' => 'ocicollection.assign', 288 'oci-collection.assignelem' => 'ocicollection.assignelem', 289 'oci-collection.free' => 'ocicollection.free', 290 'oci-collection.getelem' => 'ocicollection.getelem', 291 'oci-collection.max' => 'ocicollection.max', 292 'oci-collection.size' => 'ocicollection.size', 293 'oci-collection.trim' => 'ocicollection.trim', 294 'splstack.setiteratormode' => 'spldoublylinkedlist.setiteratormode', 295 'splqueue.setiteratormode' => 'spldoublylinkedlist.setiteratormode', 296 'class.allow-dynamic-properties' => 'class.allowdynamicproperties', 297 'class.return-type-will-change' => 'class.returntypewillchange', 298 'class.sensitive-parameter' => 'class.sensitiveparameter', 299 'function.curl-file-create' => 'curlfile.construct', 300 'simplexmliterator.current' => 'simplexmlelement.current', 301 'simplexmliterator.getchildren' => 'simplexmlelement.getchildren', 302 'simplexmliterator.haschildren' => 'simplexmlelement.haschildren', 303 'simplexmliterator.key' => 'simplexmlelement.key', 304 'simplexmliterator.next' => 'simplexmlelement.next', 305 'simplexmliterator.rewind' => 'simplexmlelement.rewind', 306 'simplexmliterator.valid' => 'simplexmlelement.valid', 307]; 308 309if (preg_match("!^manual/([^/]+)/([^/]+?)(?:\.php)?$!", $URI, $match) && isset($manual_redirections[$match[2]])) { 310 status_header(301); 311 mirror_redirect("/manual/$match[1]/" . $manual_redirections[$match[2]]); 312} 313 314// ============================================================================ 315// Define shortcuts for PHP files, manual pages and external redirects 316$uri_aliases = [ 317 318 # PHP page shortcuts 319 "download" => "downloads", 320 "getphp" => "downloads", 321 "getdocs" => "download-docs", 322 "documentation" => "docs", 323 "mailinglists" => "mailing-lists", 324 "mailinglist" => "mailing-lists", 325 "changelog" => "ChangeLog-8", 326 "gethelp" => "support", 327 "help" => "support", 328 "unsubscribe" => "unsub", 329 "subscribe" => "mailing-lists", 330 "logos" => "download-logos", 331 332 # manual shortcuts 333 "intro" => "introduction", 334 "whatis" => "introduction", 335 "whatisphp" => "introduction", 336 "what_is_php" => "introduction", 337 338 "windows" => "install.windows", 339 "win32" => "install.windows", 340 341 "globals" => "language.variables.predefined", 342 "register_globals" => "security.globals", 343 "registerglobals" => "security.globals", 344 "manual/en/security.registerglobals.php" => "security.globals", // fix for 4.3.8 configure 345 "magic_quotes" => "security.magicquotes", 346 "magicquotes" => "security.magicquotes", 347 "gd" => "image", 348 "bcmath" => "bc", 349 'streams' => 'book.stream', 350 "mongodb" => "set.mongodb", 351 "hrtime" => "function.hrtime", // Prefer function over PECL ext 352 353 "callback" => "language.pseudo-types", 354 "number" => "language.pseudo-types", 355 "mixed" => "language.pseudo-types", 356 "bool" => "language.types.boolean", 357 "boolean" => "language.types.boolean", 358 "int" => "language.types.integer", 359 "integer" => "language.types.integer", 360 "float" => "language.types.float", 361 "string" => "language.types.string", 362 "heredoc" => "language.types.string", 363 "<<<" => "language.types.string", 364 "object" => "language.types.object", 365 "null" => "language.types.null", 366 'callable' => 'language.types.callable', 367 368 "htaccess" => "configuration.changes", 369 "php_value" => "configuration.changes", 370 371 "ternary" => "language.operators.comparison", 372 "instanceof" => "language.operators.type", 373 "if" => "language.control-structures", 374 "static" => "language.variables.scope", 375 "global" => "language.variables.scope", 376 "@" => "language.operators.errorcontrol", 377 "&" => "language.references", 378 "**" => "language.operators.arithmetic", 379 "..." => "functions.arguments", 380 "splat" => "functions.arguments", 381 "arrow" => "functions.arrow", 382 "fn" => "functions.arrow", 383 // ?:, ??, ??= 384 // These shortcuts can not be captured here since they 385 // don't actually produce a 404 error. 386 // Instead, we have a small check in index.php directly. 387 388 "dowhile" => "control-structures.do.while", 389 390 "tut" => "tutorial", 391 "tut.php" => "tutorial", // BC 392 393 "faq.php" => "faq", // BC 394 "bugs.php" => "bugs", // BC 395 "bugstats.php" => "bugstats", // BC 396 "docs-echm.php" => "download-docs", // BC 397 398 "odbc" => "uodbc", // BC 399 400 "links" => "support", // BC 401 "links.php" => "support", // BC 402 "oracle" => "oci8", 403 "_" => "function.gettext", 404 "cli" => "features.commandline", 405 406 "oop" => "language.oop5", 407 "enum" => "language.enumerations", 408 "enums" => "language.enumerations", 409 410 "const" => "language.constants.syntax", 411 "class" => "language.oop5.basic", 412 "new" => "language.oop5.basic", 413 "extends" => "language.oop5.basic", 414 "clone" => "language.oop5.cloning", 415 "construct" => "language.oop5.decon", 416 "destruct" => "language.oop5.decon", 417 "public" => "language.oop5.visibility", 418 "private" => "language.oop5.visibility", 419 "protected" => "language.oop5.visibility", 420 "var" => "language.oop5.visibility", 421 "abstract" => "language.oop5.abstract", 422 "interface" => "language.oop5.interfaces", 423 "interfaces" => "language.oop5.interfaces", 424 "autoload" => "language.oop5.autoload", 425 "__autoload" => "language.oop5.autoload", 426 "language.oop5.reflection" => "book.reflection", // BC 427 "::" => "language.oop5.paamayim-nekudotayim", 428 429 "__construct" => "language.oop5.decon", 430 "__destruct" => "language.oop5.decon", 431 "__call" => "language.oop5.overloading", 432 "__callstatic" => "language.oop5.overloading", 433 "__get" => "language.oop5.overloading", 434 "__set" => "language.oop5.overloading", 435 "__isset" => "language.oop5.overloading", 436 "__unset" => "language.oop5.overloading", 437 "__sleep" => "language.oop5.magic", 438 "__wakeup" => "language.oop5.magic", 439 "__tostring" => "language.oop5.magic", 440 "__invoke" => "language.oop5.magic", 441 "__set_state" => "language.oop5.magic", 442 "__debuginfo" => "language.oop5.magic", 443 "__clone" => "language.oop5.cloning", 444 445 "throw" => "language.exceptions", 446 "try" => "language.exceptions", 447 "catch" => "language.exceptions", 448 "lsb" => "language.oop5.late-static-bindings", 449 "namespace" => "language.namespaces", 450 "use" => "language.namespaces.using", 451 452 "factory" => "language.oop5.patterns", 453 "singleton" => "language.oop5.patterns", 454 455 "trait" => "language.oop5.traits", 456 "traits" => "language.oop5.traits", 457 458 "news.php" => "archive/index", // BC 459 "readme.mirror" => "mirroring", // BC 460 461 "php5" => "language.oop5", 462 "zend_changes.txt" => "language.oop5", // BC 463 "zend2_example.phps" => "language.oop5", // BC 464 "zend_changes_php_5_0_0b2.txt" => "language.oop5", // BC 465 "zend-engine-2" => "language.oop5", // BC 466 "zend-engine-2.php" => "language.oop5", // BC 467 468 "news_php_5_0_0b2.txt" => "ChangeLog-5", // BC 469 "news_php_5_0_0b3.txt" => "ChangeLog-5", // BC 470 471 "manual/about-notes.php" => "manual/add-note", // BC 472 "software/index.php" => "software", // BC 473 "releases.php" => "releases/index", // BC 474 475 "migration7" => "migration70", // Consistent with migration5 476 "update_5_2.txt" => "migration52", // BC 477 "readme_upgrade_51.php" => "migration51", // BC 478 "internals" => "internals2", // BC 479 "configuration.directives" => "ini.core", // BC 480 481 # regexp. BC 482 "regexp.reference.backslash" => "regexp.reference.escape", 483 "regexp.reference.circudollar" => "regexp.reference.anchors", 484 "regexp.reference.squarebrackets" => "regexp.reference.character-classes", 485 "regexp.reference.verticalbar" => "regexp.reference.alternation", 486 487 # external shortcut aliases ;) 488 "dochowto" => "phpdochowto", 489 490 # CVS -> SVN 491 "anoncvs.php" => "git", 492 "cvs-php.php" => "git-php", 493 494 # SVN -> Git 495 "svn" => "git", 496 "svn.php" => "git", 497 "svn-php" => "git-php", 498 "svn-php.php" => "git-php", 499 500 # CVSUp -> Nada 501 "cvsup" => "mirroring", 502 503 # Other items 504 "security/crypt" => "security/crypt_blowfish", 505 506 # Bugfixes 507 "array_sort" => "sort", // #64743 508 "array-sort" => "sort", // #64743 509 510 # Removed pages 511 "tips.php" => "urlhowto", 512 "tips" => "urlhowto", 513]; 514 515$external_redirects = [ 516 "php4news" => "https://github.com/php/php-src/raw/PHP-4.4/NEWS", 517 "php5news" => "https://github.com/php/php-src/raw/PHP-5.6/NEWS", 518 "php53news" => "https://github.com/php/php-src/raw/PHP-5.3/NEWS", 519 "php54news" => "https://github.com/php/php-src/raw/PHP-5.4/NEWS", 520 "php55news" => "https://github.com/php/php-src/raw/PHP-5.5/NEWS", 521 "php56news" => "https://github.com/php/php-src/raw/PHP-5.6/NEWS", 522 "php70news" => "https://github.com/php/php-src/raw/PHP-7.0/NEWS", 523 "php71news" => "https://github.com/php/php-src/raw/PHP-7.1/NEWS", 524 "php72news" => "https://github.com/php/php-src/raw/PHP-7.2/NEWS", 525 "php73news" => "https://github.com/php/php-src/raw/PHP-7.3/NEWS", 526 "php74news" => "https://github.com/php/php-src/raw/PHP-7.4/NEWS", 527 "php80news" => "https://github.com/php/php-src/raw/PHP-8.0/NEWS", 528 "phptrunknews" => "https://github.com/php/php-src/raw/master/NEWS", 529 "pear" => "http://pear.php.net/", 530 "bugs" => "https://bugs.php.net/", 531 "bugstats" => "https://bugs.php.net/stats.php", 532 "phpdochowto" => "http://doc.php.net/tutorial/", 533 "rev" => "http://doc.php.net/revcheck.php?p=graph&lang=$LANG", 534 "release/5_3_0.php" => "/releases/5_3_0.php", // PHP 5.3.0 release announcement had a typo 535 "ideas.php" => "http://wiki.php.net/ideas", // BC 536 "releases.atom" => "/releases/feed.php", // BC, No need to pre-generate it 537 "spec" => "https://github.com/php/php-langspec", 538 "sunglasses" => "https://www.youtube.com/watch?v=dQw4w9WgXcQ", // Temporary easter egg for bug#66144 539]; 540 541// Temporary hack to fix bug #49956 for mysqli -- Please don't hate me for this. Data taken from mysqli/summary.xml 542$mysqli_redirects = [ 543 "mysqli_affected_rows" => "mysqli.affected-rows", 544 "mysqli_get_client_version" => "mysqli.client-version", 545 "mysqli_connect_errno" => "mysqli.connect-errno", 546 "mysqli_connect_error" => "mysqli.connect-error", 547 "mysqli_errno" => "mysqli.errno", 548 "mysqli_error" => "mysqli.error", 549 "mysqli_field_count" => "mysqli.field-count", 550 "mysqli_get_host_info" => "mysqli.host-info", 551 "mysqli_get_proto_info" => "mysqli.protocol-version", 552 "mysqli_get_server_version" => "mysqli.server-version", 553 "mysqli_info" => "mysqli.info", 554 "mysqli_insert_id" => "mysqli.insert-id", 555 "mysqli_sqlstate" => "mysqli.sqlstate", 556 "mysqli_warning_count" => "mysqli.warning-count", 557 "mysqli_autocommit" => "mysqli.autocommit", 558 "mysqli_change_user" => "mysqli.change-user", 559 "mysqli_character_set_name" => "mysqli.character-set-name", 560 "mysqli_close" => "mysqli.close", 561 "mysqli_commit" => "mysqli.commit", 562 "mysqli_connect" => "mysqli.construct", 563 "mysqli_debug" => "mysqli.debug", 564 "mysqli_dump_debug_info" => "mysqli.dump-debug-info", 565 "mysqli_get_charset" => "mysqli.get-charset", 566 "mysqli_get_connection_stats" => "mysqli.get-connection-stats", 567 "mysqli_get_client_info" => "mysqli.get-client-info", 568 "mysqli_get_client_stats" => "mysqli.get-client-stats", 569 "mysqli_get_cache_stats" => "mysqli.get-cache-stats", 570 "mysqli_get_server_info" => "mysqli.get-server-info", 571 "mysqli_get_warnings" => "mysqli.get-warnings", 572 "mysqli_init" => "mysqli.init", 573 "mysqli_kill" => "mysqli.kill", 574 "mysqli_more_results" => "mysqli.more-results", 575 "mysqli_multi_query" => "mysqli.multi-query", 576 "mysqli_next_result" => "mysqli.next-result", 577 "mysqli_options" => "mysqli.options", 578 "mysqli_ping" => "mysqli.ping", 579 "mysqli_prepare" => "mysqli.prepare", 580 "mysqli_query" => "mysqli.query", 581 "mysqli_real_connect" => "mysqli.real-connect", 582 "mysqli_real_escape_string" => "mysqli.real-escape-string", 583 "mysqli_real_query" => "mysqli.real-query", 584 "mysqli_refresh" => "mysqli.refresh", 585 "mysqli_rollback" => "mysqli.rollback", 586 "mysqli_select_db" => "mysqli.select-db", 587 "mysqli_set_charset" => "mysqli.set-charset", 588 "mysqli_set_local_infile_default" => "mysqli.set-local-infile-default", 589 "mysqli_set_local_infile_handler" => "mysqli.set-local-infile-handler", 590 "mysqli_ssl_set" => "mysqli.ssl-set", 591 "mysqli_stat" => "mysqli.stat", 592 "mysqli_stmt_init" => "mysqli.stmt-init", 593 "mysqli_store_result" => "mysqli.store-result", 594 "mysqli_thread_id" => "mysqli.thread-id", 595 "mysqli_thread_safe" => "mysqli.thread-safe", 596 "mysqli_use_result" => "mysqli.use-result", 597 "mysqli_stmt_affected_rows" => "mysqli-stmt.affected-rows", 598 "mysqli_stmt_errno" => "mysqli-stmt.errno", 599 "mysqli_stmt_error" => "mysqli-stmt.error", 600 "mysqli_stmt_field_count" => "mysqli-stmt.field-count", 601 "mysqli_stmt_insert_id" => "mysqli-stmt.insert-id", 602 "mysqli_stmt_param_count" => "mysqli-stmt.param-count", 603 "mysqli_stmt_sqlstate" => "mysqli-stmt.sqlstate", 604 "mysqli_stmt_attr_get" => "mysqli-stmt.attr-get", 605 "mysqli_stmt_attr_set" => "mysqli-stmt.attr-set", 606 "mysqli_stmt_bind_param" => "mysqli-stmt.bind-param", 607 "mysqli_stmt_bind_result" => "mysqli-stmt.bind-result", 608 "mysqli_stmt_close" => "mysqli-stmt.close", 609 "mysqli_stmt_data_seek" => "mysqli-stmt.data-seek", 610 "mysqli_stmt_execute" => "mysqli-stmt.execute", 611 "mysqli_stmt_fetch" => "mysqli-stmt.fetch", 612 "mysqli_stmt_free_result" => "mysqli-stmt.free-result", 613 "mysqli_stmt_get_result" => "mysqli-stmt.get-result", 614 "mysqli_stmt_get_warnings" => "mysqli-stmt.get-warnings", 615 "mysqli_stmt_more_results" => "mysqli-stmt.more-results", 616 "mysqli_stmt_next_result" => "mysqli-stmt.next-result", 617 "mysqli_stmt_num_rows" => "mysqli-stmt.num-rows", 618 "mysqli_stmt_prepare" => "mysqli-stmt.prepare", 619 "mysqli_stmt_reset" => "mysqli-stmt.reset", 620 "mysqli_stmt_result_metadata" => "mysqli-stmt.result-metadata", 621 "mysqli_stmt_send_long_data" => "mysqli-stmt.send-long-data", 622 "mysqli_stmt_store_result" => "mysqli-stmt.store-result", 623 "mysqli_field_tell" => "mysqli-result.current-field", 624 "mysqli_num_fields" => "mysqli-result.field-count", 625 "mysqli_fetch_lengths" => "mysqli-result.lengths", 626 "mysqli_num_rows" => "mysqli-result.num-rows", 627 "mysqli_data_seek" => "mysqli-result.data-seek", 628 "mysqli_fetch_all" => "mysqli-result.fetch-all", 629 "mysqli_fetch_array" => "mysqli-result.fetch-array", 630 "mysqli_fetch_assoc" => "mysqli-result.fetch-assoc", 631 "mysqli_fetch_field_direct" => "mysqli-result.fetch-field-direct", 632 "mysqli_fetch_field" => "mysqli-result.fetch-field", 633 "mysqli_fetch_fields" => "mysqli-result.fetch-fields", 634 "mysqli_fetch_object" => "mysqli-result.fetch-object", 635 "mysqli_fetch_row" => "mysqli-result.fetch-row", 636 "mysqli_field_seek" => "mysqli-result.field-seek", 637 "mysqli_free_result" => "mysqli-result.free", 638 "mysqli_embedded_server_end" => "mysqli-driver.embedded-server-end", 639 "mysqli_embedded_server_start" => "mysqli-driver.embedded-server-start", 640]; 641 642// Merge this temporary hack with $uri_aliases so it'll be treated as such 643$uri_aliases = array_merge($uri_aliases, $mysqli_redirects); 644 645// ============================================================================ 646// "Rewrite" the URL, if it was a shortcut 647 648if (isset($uri_aliases[$URI])) { 649 $URI = $uri_aliases[$URI]; 650 /* If it was a page alias, redirect right away */ 651 if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/$URI.php")) { 652 mirror_redirect("/$URI.php"); 653 } 654} 655 656// ============================================================================ 657// Execute external redirect if a rule exists for the URI 658if (isset($external_redirects[$URI])) { 659 mirror_redirect($external_redirects[$URI]); 660} 661 662// Temporary hack for mirror-info, until all the pages 663// will be capable of being included from anywhere 664if ($URI == 'mirror-info') { 665 status_header(200); 666 include_once __DIR__ . "/$URI.php"; 667 exit; 668} 669 670// ============================================================================ 671// Try to find the page using the preferred language as a manual page 672include_once __DIR__ . "/include/manual-lookup.inc"; 673$try = find_manual_page($LANG, $URI); 674if ($try) { 675 status_header(200); 676 include_once __DIR__ . $try; 677 exit; 678} 679// BC. The class methods are now classname.methodname 680if (preg_match("!^manual/(.+)/function\.(.+)-(.+).php$!", $URI, $array)) { 681 $try = find_manual_page($array[1], $array[2] . "." . $array[3]); 682 if ($try) { 683 status_header(301); 684 mirror_redirect($try); 685 exit; 686 } 687} 688 689// ============================================================================ 690// For manual pages for inactive languages, point visitors to the English page 691if (preg_match("!^manual/([^/]+)/([^/]+).php$!", $URI, $match) && 692 isset($INACTIVE_ONLINE_LANGUAGES[$match[1]])) { 693 $try = find_manual_page("en", $match[2]); 694 if ($try) { 695 error_inactive_manual_page($INACTIVE_ONLINE_LANGUAGES[$match[1]], $try); 696 } 697} 698 699// ============================================================================ 700// 404 page for manual pages (eg. not built language) 701if (strpos($URI, "manual/") === 0) { 702 $legacy_manual_urls = get_legacy_manual_urls($URI); 703 if (count($legacy_manual_urls) > 0) { 704 fallback_to_legacy_manuals($legacy_manual_urls); 705 } 706 error_404_manual(); 707} 708 709// ============================================================================ 710// If no match was found till this point, the last action is to start a 711// search with the URI the user typed in 712$fallback = (myphpnet_urlsearch() === MYPHPNET_URL_MANUAL ? "404manual" : "404quickref"); 713mirror_redirect( 714 '/search.php?show=' . $fallback . '&lang=' . urlencode($LANG) . 715 '&pattern=' . substr($_SERVER['REQUEST_URI'], 1), 716); 717