diff options
33 files changed, 240 insertions, 100 deletions
diff --git a/action.php b/action.php index 2b4d419782..e4443b4738 100644 --- a/action.php +++ b/action.php @@ -48,7 +48,7 @@ header('Content-type: text/html; charset=UTF-8'); if (!WT_Filter::checkCsrf()) { Zend_Session::writeClose(); - header('HTTP/1.0 406 Not Acceptable'); + http_response_code(406); return; } @@ -61,7 +61,7 @@ case 'accept-changes': WT_FlashMessages::addMessage(/* I18N: %s is the name of an individual, source or other record */ WT_I18N::translate('The changes to “%s” have been accepted.', $record->getFullName())); accept_all_changes($record->getXref(), $record->getGedcomId()); } else { - header('HTTP/1.0 406 Not Acceptable'); + http_response_code(406); } break; @@ -134,7 +134,7 @@ case 'delete-fact': } // Can’t find the record/fact, or don’t have permission to delete it. - header('HTTP/1.0 406 Not Acceptable'); + http_response_code(406); break; case 'delete-family': @@ -178,7 +178,7 @@ case 'delete-source': // Delete the record itself $record->deleteRecord(); } else { - header('HTTP/1.0 406 Not Acceptable'); + http_response_code(406); } break; @@ -198,7 +198,7 @@ case 'masquerade': Log::addAuthenticationLog('Masquerade as user: ' . $user->getUserName()); Auth::login($user); } else { - header('HTTP/1.0 406 Not Acceptable'); + http_response_code(406); } break; @@ -226,7 +226,7 @@ case 'unlink-media': } } } else { - header('HTTP/1.0 406 Not Acceptable'); + http_response_code(406); } break; @@ -237,7 +237,7 @@ case 'reject-changes': WT_FlashMessages::addMessage(/* I18N: %s is the name of an individual, source or other record */ WT_I18N::translate('The changes to “%s” have been rejected.', $record->getFullName())); reject_all_changes($record->getXref(), $record->getGedcomId()); } else { - header('HTTP/1.0 406 Not Acceptable'); + http_response_code(406); } break; @@ -250,7 +250,7 @@ case 'theme': Auth::user()->setPreference('theme', $theme); } else { // Request for a non-existant theme. - header('HTTP/1.0 406 Not Acceptable'); + http_response_code(406); } break; } diff --git a/family.php b/family.php index 6a2477cd0d..40c300967c 100644 --- a/family.php +++ b/family.php @@ -72,7 +72,7 @@ if ($controller->record && $controller->record->canShow()) { // Continue - to display the children/parents/grandparents. // We'll check for showing the details again later } else { - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); + http_response_code(404); $controller->pageHeader(); echo '<p class="ui-state-error">', WT_I18N::translate('This family does not exist or you do not have permission to view it.'), '</p>'; diff --git a/import.php b/import.php index a82ab5f82f..9f8ecd4503 100644 --- a/import.php +++ b/import.php @@ -30,7 +30,7 @@ define('WT_SCRIPT_NAME', 'import.php'); require './includes/session.php'; if (!WT_USER_GEDCOM_ADMIN) { - header('HTTP/1.1 403 Access Denied'); + http_response_code(403); return; } diff --git a/includes/hitcount.php b/includes/hitcount.php index 597f6aaa24..81eee433ca 100644 --- a/includes/hitcount.php +++ b/includes/hitcount.php @@ -24,7 +24,7 @@ use WT\Auth; if (!defined('WT_WEBTREES')) { - header('HTTP/1.0 403 Forbidden'); + http_response_code(403); exit; } diff --git a/includes/php_53_compatibility.php b/includes/php_53_compatibility.php new file mode 100644 index 0000000000..b4abc6ebea --- /dev/null +++ b/includes/php_53_compatibility.php @@ -0,0 +1,193 @@ +<?php + +// http://php.net/manual/en/security.magicquotes.disabling.php +if (get_magic_quotes_gpc()) { + $_process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); + while (list($key, $val) = each($_process)) { + foreach ($val as $k => $v) { + unset($_process[$key][$k]); + if (is_array($v)) { + $_process[$key][stripslashes($k)] = $v; + $_process[] = &$_process[$key][stripslashes($k)]; + } else { + $_process[$key][stripslashes($k)] = stripslashes($v); + } + } + } + unset($_process); +} + +//////////////////////////////////////////////////////////////////////////////// +// The ircmaxell/password-compat library does not support unpatched versions of +// PHP older than PHP5.3.6. These versions of PHP have no secure crypt library. +//////////////////////////////////////////////////////////////////////////////// +$hash = '$2y$04$usesomesillystringfore7hnbRJHxXVLeakoG8K30oukPsA.ztMG'; +if (!defined('PASSWORD_BCRYPT') && crypt("password", $hash) !== $hash) { + define('PASSWORD_BCRYPT', 1); + define('PASSWORD_DEFAULT', 1); + /** + * @param string $password + * @param integer $algo + * + * @return string + */ + function password_hash($password, $algo) { + return crypt($password); + } + + /** + * @param string $hash + * @param integer $algo + * + * @return boolean + */ + function password_needs_rehash($hash, $algo) { + return false; + } + + /** + * @param string $password + * @param integer $hash + * + * @return boolean + */ + function password_verify($password, $hash) { + return crypt($password, $hash) === $hash; + } +} + +/** + * This function was added to PHP in 5.4 + * + * @param string|null $code + * + * @link https://php.net/http_response_code + * @return int|null + */ +function http_response_code($code = null) { + if ($code !== null) { + switch ($code) { + case 100: + $text = 'Continue'; + break; + case 101: + $text = 'Switching Protocols'; + break; + case 200: + $text = 'OK'; + break; + case 201: + $text = 'Created'; + break; + case 202: + $text = 'Accepted'; + break; + case 203: + $text = 'Non-Authoritative Information'; + break; + case 204: + $text = 'No Content'; + break; + case 205: + $text = 'Reset Content'; + break; + case 206: + $text = 'Partial Content'; + break; + case 300: + $text = 'Multiple Choices'; + break; + case 301: + $text = 'Moved Permanently'; + break; + case 302: + $text = 'Moved Temporarily'; + break; + case 303: + $text = 'See Other'; + break; + case 304: + $text = 'Not Modified'; + break; + case 305: + $text = 'Use Proxy'; + break; + case 400: + $text = 'Bad Request'; + break; + case 401: + $text = 'Unauthorized'; + break; + case 402: + $text = 'Payment Required'; + break; + case 403: + $text = 'Forbidden'; + break; + case 404: + $text = 'Not Found'; + break; + case 405: + $text = 'Method Not Allowed'; + break; + case 406: + $text = 'Not Acceptable'; + break; + case 407: + $text = 'Proxy Authentication Required'; + break; + case 408: + $text = 'Request Time-out'; + break; + case 409: + $text = 'Conflict'; + break; + case 410: + $text = 'Gone'; + break; + case 411: + $text = 'Length Required'; + break; + case 412: + $text = 'Precondition Failed'; + break; + case 413: + $text = 'Request Entity Too Large'; + break; + case 414: + $text = 'Request-URI Too Large'; + break; + case 415: + $text = 'Unsupported Media Type'; + break; + case 500: + $text = 'Internal Server Error'; + break; + case 501: + $text = 'Not Implemented'; + break; + case 502: + $text = 'Bad Gateway'; + break; + case 503: + $text = 'Service Unavailable'; + break; + case 504: + $text = 'Gateway Time-out'; + break; + case 505: + $text = 'HTTP Version not supported'; + break; + default: + exit('Unknown http status code "' . htmlentities($code) . '"'); + break; + } + $protocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0'); + header($protocol . ' ' . $code . ' ' . $text); + $GLOBALS['http_response_code'] = $code; + } else { + $code = (isset($GLOBALS['http_response_code']) ? $GLOBALS['http_response_code'] : 200); + } + + return $code; +} diff --git a/includes/reportheader.php b/includes/reportheader.php index 761d36364e..8cea77e55e 100644 --- a/includes/reportheader.php +++ b/includes/reportheader.php @@ -23,7 +23,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES')) { - header('HTTP/1.0 403 Forbidden'); + http_response_code(403); exit; } diff --git a/includes/session.php b/includes/session.php index 008cc14533..29a3f56c11 100644 --- a/includes/session.php +++ b/includes/session.php @@ -27,7 +27,7 @@ use WT\Theme; // WT_SCRIPT_NAME is defined in each script that the user is permitted to load. if (!defined('WT_SCRIPT_NAME')) { - header('HTTP/1.0 403 Forbidden'); + http_response_code(403); exit; } @@ -161,61 +161,9 @@ if (strpos(ini_get('disable_functions'), 'ini_set') === false) { ini_set('display_errors', 'on'); } -// PHP5.3 may be using magic-quotes :-( -if (version_compare(PHP_VERSION, '5.4', '<') && get_magic_quotes_gpc()) { - // http://php.net/manual/en/security.magicquotes.disabling.php - $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); - while (list($key, $val) = each($process)) { - foreach ($val as $k => $v) { - unset($process[$key][$k]); - if (is_array($v)) { - $process[$key][stripslashes($k)] = $v; - $process[] = &$process[$key][stripslashes($k)]; - } else { - $process[$key][stripslashes($k)] = stripslashes($v); - } - } - } - unset($process); -} - -//////////////////////////////////////////////////////////////////////////////// -// The ircmaxell/password-compat library does not support unpatched versions of -// PHP older than PHP5.3.6. These versions of PHP have no secure crypt library. -//////////////////////////////////////////////////////////////////////////////// -$hash = '$2y$04$usesomesillystringfore7hnbRJHxXVLeakoG8K30oukPsA.ztMG'; -if (!defined('PASSWORD_BCRYPT') && crypt("password", $hash) !== $hash) { - define('PASSWORD_BCRYPT', 1); - define('PASSWORD_DEFAULT', 1); - /** - * @param string $password - * @param integer $algo - * - * @return string - */ - function password_hash($password, $algo) { - return crypt($password); - } - - /** - * @param string $hash - * @param integer $algo - * - * @return boolean - */ - function password_needs_rehash($hash, $algo) { - return false; - } - - /** - * @param string $password - * @param integer $hash - * - * @return boolean - */ - function password_verify($password, $hash) { - return crypt($password, $hash) === $hash; - } +// We use some PHP5.5 features, but need to run on older servers +if (version_compare(PHP_VERSION, '5.4', '<')) { + require WT_ROOT . 'includes/php_53_compatibility.php'; } require WT_ROOT . 'library/autoload.php'; @@ -401,7 +349,7 @@ case 'allow': $SEARCH_SPIDER = false; break; case 'deny': - header('HTTP/1.1 403 Access Denied'); + http_response_code(403); exit; case 'robot': case 'unknown': @@ -663,7 +611,7 @@ if ($SEARCH_SPIDER && !in_array(WT_SCRIPT_NAME, array( 'index.php', 'indilist.php', 'module.php', 'mediafirewall.php', 'individual.php', 'family.php', 'mediaviewer.php', 'note.php', 'repo.php', 'source.php', ))) { - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); + http_response_code(403); $controller = new WT_Controller_Page; $controller->setPageTitle(WT_I18N::translate('Search engine')); $controller->pageHeader(); diff --git a/includes/specialchars.php b/includes/specialchars.php index 8c80e6aa09..6ab78e6e78 100644 --- a/includes/specialchars.php +++ b/includes/specialchars.php @@ -23,7 +23,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES')) { - header('HTTP/1.0 403 Forbidden'); + http_response_code(403); exit; } diff --git a/individual.php b/individual.php index 1cae5b20fa..62e829f612 100644 --- a/individual.php +++ b/individual.php @@ -87,7 +87,7 @@ if ($controller->record && $controller->record->canShow()) { return; } else { - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); + http_response_code(404); $controller->pageHeader(); echo '<p class="ui-state-error">', WT_I18N::translate('This individual does not exist or you do not have permission to view it.'), '</p>'; diff --git a/library/WT/Controller/Ajax.php b/library/WT/Controller/Ajax.php index ab2387c001..b11f0d8128 100644 --- a/library/WT/Controller/Ajax.php +++ b/library/WT/Controller/Ajax.php @@ -50,7 +50,7 @@ class WT_Controller_Ajax extends WT_Controller_Base { */ public function restrictAccess($condition) { if ($condition !== true) { - header('HTTP/1.0 403 Access Denied'); + http_response_code(403); exit; } diff --git a/library/WT/Controller/Chart.php b/library/WT/Controller/Chart.php index 1205aa37d8..7e12ec7a0f 100644 --- a/library/WT/Controller/Chart.php +++ b/library/WT/Controller/Chart.php @@ -40,7 +40,7 @@ class WT_Controller_Chart extends WT_Controller_Page { } if (!$this->root || !$this->root->canShowName()) { - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); + http_response_code(404); $this->error_message = WT_I18N::translate('This individual does not exist or you do not have permission to view it.'); } } diff --git a/library/WT/Controller/Individual.php b/library/WT/Controller/Individual.php index 41ff7c9891..7e4bb17cbd 100644 --- a/library/WT/Controller/Individual.php +++ b/library/WT/Controller/Individual.php @@ -96,7 +96,7 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord { // Search engines should not make AJAX requests if ($SEARCH_SPIDER) { - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); + http_response_code(403); exit; } @@ -107,7 +107,7 @@ class WT_Controller_Individual extends WT_Controller_GedcomRecord { if (array_key_exists($tab, $this->tabs)) { $mod = $this->tabs[$tab]; } else { - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); + http_response_code(404); exit; } diff --git a/mediafirewall.php b/mediafirewall.php index eedba589ba..187aedf0ca 100644 --- a/mediafirewall.php +++ b/mediafirewall.php @@ -46,8 +46,7 @@ function send404AsImage() { embedText($im, $error, 100, '255, 0, 0', '', 'top', 'left'); - header('HTTP/1.0 404 Not Found'); - header('Status: 404 Not Found'); + http_response_code(404); header('Content-Type: image/png'); imagepng($im); imagedestroy($im); @@ -372,7 +371,7 @@ header('Cache-Control: max-age=' . $expireOffset . ', s-maxage=0, proxy-revalida if ($if_modified_since === $filetimeHeader) { // then check if the etag matches if ($if_none_match === $etag) { - header($protocol . ' 304 Not Modified'); + http_response_code(304); return; } diff --git a/mediaviewer.php b/mediaviewer.php index 6d68757cbb..a21a0242bc 100644 --- a/mediaviewer.php +++ b/mediaviewer.php @@ -69,7 +69,7 @@ if ($controller->record && $controller->record->canShow()) { } } } else { - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); + http_response_code(404); $controller->pageHeader(); echo '<p class="ui-state-error">', WT_I18N::translate('This media object does not exist or you do not have permission to view it.'), '</p>'; diff --git a/modules_v3/GEDFact_assistant/_CENS/census_1_ctrl.php b/modules_v3/GEDFact_assistant/_CENS/census_1_ctrl.php index b28d9a34af..b1b5abd1a0 100644 --- a/modules_v3/GEDFact_assistant/_CENS/census_1_ctrl.php +++ b/modules_v3/GEDFact_assistant/_CENS/census_1_ctrl.php @@ -24,7 +24,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES')) { - header('HTTP/1.0 403 Forbidden'); + http_response_code(403); exit; } diff --git a/modules_v3/GEDFact_assistant/_CENS/census_2_source_input.php b/modules_v3/GEDFact_assistant/_CENS/census_2_source_input.php index 78ffb18e96..9cd4653d60 100644 --- a/modules_v3/GEDFact_assistant/_CENS/census_2_source_input.php +++ b/modules_v3/GEDFact_assistant/_CENS/census_2_source_input.php @@ -24,7 +24,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES')) { - header('HTTP/1.0 403 Forbidden'); + http_response_code(403); exit; } diff --git a/modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php b/modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php index 8697e31870..44c7a4e72b 100644 --- a/modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php +++ b/modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php @@ -24,7 +24,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES')) { - header('HTTP/1.0 403 Forbidden'); + http_response_code(403); exit; } ?> diff --git a/modules_v3/GEDFact_assistant/_CENS/census_4_text.php b/modules_v3/GEDFact_assistant/_CENS/census_4_text.php index aae10424c7..957fc42db9 100644 --- a/modules_v3/GEDFact_assistant/_CENS/census_4_text.php +++ b/modules_v3/GEDFact_assistant/_CENS/census_4_text.php @@ -24,7 +24,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES')) { - header('HTTP/1.0 403 Forbidden'); + http_response_code(403); exit; } ?> diff --git a/modules_v3/GEDFact_assistant/_MEDIA/media_1_ctrl.php b/modules_v3/GEDFact_assistant/_MEDIA/media_1_ctrl.php index b0c63f7030..519d71229f 100644 --- a/modules_v3/GEDFact_assistant/_MEDIA/media_1_ctrl.php +++ b/modules_v3/GEDFact_assistant/_MEDIA/media_1_ctrl.php @@ -24,7 +24,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES')) { - header('HTTP/1.0 403 Forbidden'); + http_response_code(403); exit; } diff --git a/modules_v3/GEDFact_assistant/module.php b/modules_v3/GEDFact_assistant/module.php index 933e59a61b..4a4cbcc433 100644 --- a/modules_v3/GEDFact_assistant/module.php +++ b/modules_v3/GEDFact_assistant/module.php @@ -48,7 +48,7 @@ class GEDFact_assistant_WT_Module extends WT_Module { break; default: echo $mod_action; - header('HTTP/1.0 404 Not Found'); + http_response_code(404); } } diff --git a/modules_v3/batch_update/module.php b/modules_v3/batch_update/module.php index b2715ae39e..6f763b751a 100644 --- a/modules_v3/batch_update/module.php +++ b/modules_v3/batch_update/module.php @@ -48,7 +48,7 @@ class batch_update_WT_Module extends WT_Module implements WT_Module_Config { echo $mod->main(); break; default: - header('HTTP/1.0 404 Not Found'); + http_response_code(404); } } diff --git a/modules_v3/clippings/module.php b/modules_v3/clippings/module.php index f4fb498f19..311db82f50 100644 --- a/modules_v3/clippings/module.php +++ b/modules_v3/clippings/module.php @@ -290,7 +290,7 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module } break; default: - header('HTTP/1.0 404 Not Found'); + http_response_code(404); break; } } diff --git a/modules_v3/descendancy/module.php b/modules_v3/descendancy/module.php index 0e625b56e3..0d7b591a6a 100644 --- a/modules_v3/descendancy/module.php +++ b/modules_v3/descendancy/module.php @@ -52,7 +52,7 @@ class descendancy_WT_Module extends WT_Module implements WT_Module_Sidebar { } break; default: - header('HTTP/1.0 404 Not Found'); + http_response_code(404); break; } } diff --git a/modules_v3/families/module.php b/modules_v3/families/module.php index 1903cb8c76..e2be3ac71e 100644 --- a/modules_v3/families/module.php +++ b/modules_v3/families/module.php @@ -44,7 +44,7 @@ class families_WT_Module extends WT_Module implements WT_Module_Sidebar { echo $this->getSidebarAjaxContent(); break; default: - header('HTTP/1.0 404 Not Found'); + http_response_code(404); break; } } diff --git a/modules_v3/faq/module.php b/modules_v3/faq/module.php index 69230219a9..3b21eab755 100644 --- a/modules_v3/faq/module.php +++ b/modules_v3/faq/module.php @@ -58,7 +58,7 @@ class faq_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module_Confi $this->show(); break; default: - header('HTTP/1.0 404 Not Found'); + http_response_code(404); } } diff --git a/modules_v3/googlemap/module.php b/modules_v3/googlemap/module.php index 2a5137af9b..c23ecf5b6c 100644 --- a/modules_v3/googlemap/module.php +++ b/modules_v3/googlemap/module.php @@ -113,7 +113,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu $this->wtStreetView(); break; default: - header('HTTP/1.0 404 Not Found'); + http_response_code(404); break; } } diff --git a/modules_v3/individuals/module.php b/modules_v3/individuals/module.php index dd79ec3580..fbca1f1271 100644 --- a/modules_v3/individuals/module.php +++ b/modules_v3/individuals/module.php @@ -42,7 +42,7 @@ class individuals_WT_Module extends WT_Module implements WT_Module_Sidebar { echo $this->getSidebarAjaxContent(); break; default: - header('HTTP/1.0 404 Not Found'); + http_response_code(404); break; } } diff --git a/modules_v3/sitemap/module.php b/modules_v3/sitemap/module.php index f1bdb68fe5..d3be3270d2 100644 --- a/modules_v3/sitemap/module.php +++ b/modules_v3/sitemap/module.php @@ -46,7 +46,7 @@ class sitemap_WT_Module extends WT_Module implements WT_Module_Config { $this->generate(WT_Filter::get('file')); break; default: - header('HTTP/1.0 404 Not Found'); + http_response_code(404); } } @@ -59,7 +59,7 @@ class sitemap_WT_Module extends WT_Module implements WT_Module_Config { } elseif (preg_match('/^sitemap-(\d+)-([isrmn])-(\d+).xml$/', $file, $match)) { $this->generateFile($match[1], $match[2], $match[3]); } else { - header('HTTP/1.0 404 Not Found'); + http_response_code(404); } } diff --git a/modules_v3/stories/module.php b/modules_v3/stories/module.php index 407b41b85e..7502dd7d85 100644 --- a/modules_v3/stories/module.php +++ b/modules_v3/stories/module.php @@ -50,7 +50,7 @@ class stories_WT_Module extends WT_Module implements WT_Module_Tab, WT_Module_Co $this->showList(); break; default: - header('HTTP/1.0 404 Not Found'); + http_response_code(404); } } diff --git a/modules_v3/tree/module.php b/modules_v3/tree/module.php index 0b27516a59..5e435e083e 100644 --- a/modules_v3/tree/module.php +++ b/modules_v3/tree/module.php @@ -136,7 +136,7 @@ class tree_WT_Module extends WT_Module implements WT_Module_Tab { break; default: - header('HTTP/1.0 404 Not Found'); + http_response_code(404); break; } } @@ -68,7 +68,7 @@ if ($controller->record && $controller->record->canShow()) { } } } else { - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); + http_response_code(404); $controller->pageHeader(); echo '<p class="ui-state-error">', WT_I18N::translate('This note does not exist or you do not have permission to view it.'), '</p>'; @@ -68,7 +68,7 @@ if ($controller->record && $controller->record->canShow()) { } } } else { - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); + http_response_code(404); $controller->pageHeader(); echo '<p class="ui-state-error">', WT_I18N::translate('This repository does not exist or you do not have permission to view it.'), '</p>'; diff --git a/source.php b/source.php index 3acfa79492..1e56a57c50 100644 --- a/source.php +++ b/source.php @@ -68,7 +68,7 @@ if ($controller->record && $controller->record->canShow()) { } } } else { - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); + http_response_code(404); $controller->pageHeader(); echo '<p class="ui-state-error">', WT_I18N::translate('This source does not exist or you do not have permission to view it.'), '</p>'; |
