X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Futil.php;h=def3a57506f9037c4d85fea46bd23ae15cb6f2ab;hb=9f39fd31afe198fc78c669088710af64a9976c3d;hp=298c5c5de13442b9f23d5139e3e9bb13efff50f7;hpb=56021d95721c06b618dac6272e58d22a3e87037f;p=quix0rs-gnu-social.git diff --git a/lib/util.php b/lib/util.php index 298c5c5de1..def3a57506 100644 --- a/lib/util.php +++ b/lib/util.php @@ -21,8 +21,21 @@ # Show a server error -function common_server_error($msg) { - header('HTTP/1.1 500 Server Error'); +function common_server_error($msg, $code=500) { + static $status = array(500 => 'Internal Server Error', + 501 => 'Not Implemented', + 502 => 'Bad Gateway', + 503 => 'Service Unavailable', + 504 => 'Gateway Timeout', + 505 => 'HTTP Version Not Supported'); + + if (!array_key_exists($code, $status)) { + $code = 500; + } + + $status_string = $status[$code]; + + header('HTTP/1.1 '.$code.' '.$status_string); header('Content-type: text/plain'); print $msg; @@ -31,7 +44,34 @@ function common_server_error($msg) { } # Show a user error -function common_user_error($msg, $code=200) { +function common_user_error($msg, $code=400) { + static $status = array(400 => 'Bad Request', + 401 => 'Unauthorized', + 402 => 'Payment Required', + 403 => 'Forbidden', + 404 => 'Not Found', + 405 => 'Method Not Allowed', + 406 => 'Not Acceptable', + 407 => 'Proxy Authentication Required', + 408 => 'Request Timeout', + 409 => 'Conflict', + 410 => 'Gone', + 411 => 'Length Required', + 412 => 'Precondition Failed', + 413 => 'Request Entity Too Large', + 414 => 'Request-URI Too Long', + 415 => 'Unsupported Media Type', + 416 => 'Requested Range Not Satisfiable', + 417 => 'Expectation Failed'); + + if (!array_key_exists($code, $status)) { + $code = 400; + } + + $status_string = $status[$code]; + + header('HTTP/1.1 '.$code.' '.$status_string); + common_show_header('Error'); common_element('div', array('class' => 'error'), $msg); common_show_footer(); @@ -83,7 +123,7 @@ function common_end_xml() { $xw->flush(); } -function common_show_header($pagetitle, $callable=NULL, $data=NULL) { +function common_show_header($pagetitle, $callable=NULL, $data=NULL, $notice=NULL) { global $config, $xw; header('Content-Type: application/xhtml+xml'); @@ -103,16 +143,15 @@ function common_show_header($pagetitle, $callable=NULL, $data=NULL) { $pagetitle . " - " . $config['site']['name']); common_element('link', array('rel' => 'stylesheet', 'type' => 'text/css', - 'href' => common_path('theme/default/style/html.css'), - 'media' => 'screen, projection, tv')); - common_element('link', array('rel' => 'stylesheet', - 'type' => 'text/css', - 'href' => common_path('theme/default/style/layout.css'), + 'href' => theme_path('display.css'), 'media' => 'screen, projection, tv')); - common_element('link', array('rel' => 'stylesheet', - 'type' => 'text/css', - 'href' => common_path('theme/default/style/print.css'), - 'media' => 'print')); + foreach (array(6,7) as $ver) { + if (file_exists(theme_file('ie'.$ver.'.css'))) { + # Yes, IE people should be put in jail. + $xw->writeComment('[if lte IE '.$ver.']>