Exemple #1
0
 /**
  *
  * @param Exception $error
  * @param integer $code
  */
 public static function errorPage($code = 500)
 {
     http_response_code($code);
     $error_text = get_status_text($code);
     $default = PHPWS_SOURCE_DIR . 'Global/Error/Pages/' . ERROR_PAGE_TEMPLATE;
     $error_template = PHPWS_SOURCE_DIR . "Global/Error/Pages/{$code}.html";
     $source_http = PHPWS_SOURCE_HTTP;
     if (is_file($error_template)) {
         include $error_template;
     } else {
         include $default;
     }
     exit;
 }
Exemple #2
0
 function http_response_code($code = NULL)
 {
     if ($code !== NULL) {
         $text = get_status_text($code);
         $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;
 }
Exemple #3
0
 public function getPhrase()
 {
     return get_status_text($this->getCode());
 }
 public function view($id)
 {
     $this->setViewData('panel_heading', "Labour info");
     $labour = $this->Model_labour->get_labour($id);
     if (!$id || !$labour) {
         show_error('Invalid labour ID.');
     }
     $labour['status'] = get_status_text($labour['status']);
     $labour['created_on'] = date('Y-m-d', strtotime($labour['created_on']));
     $this->setViewData('view_keys', $this->get_view_fields());
     $this->setViewData('view_data', $labour);
     $this->render_view('view', 'labour');
 }
function update_test($function, $input, $output, $expected, $status)
{
    echo "<tr class='detail'><td>" . $function . "</td><td>" . $input . "</td><td>" . $output . "</td>";
    echo "<td>" . $expected . "</td><td>" . get_status_text($status) . "</td></tr>";
    if (!isset($GLOBALS['unique_tests'][$function])) {
        // if the unique_tests is unset, so is unique_good
        $GLOBALS['unique_tests'][$function] = 0;
        $GLOBALS['unique_good'][$function] = 0;
    }
    $GLOBALS['unique_tests'][$function]++;
    if ($status) {
        $GLOBALS['unique_good'][$function]++;
    }
}
 public function view($id)
 {
     $this->setViewData('panel_heading', "Agency info");
     $agency = $this->Model_agency->get_agency($id);
     if (!$id || !$agency) {
         show_error('Invalid agency ID.');
     }
     $agency['status'] = get_status_text($agency['status']);
     $agency['created_on'] = date('Y-m-d', strtotime($agency['created_on']));
     $this->setViewData('view_keys', $this->get_view_fields());
     $this->setViewData('agency', $agency);
     $this->render_view('view', 'agency');
 }