Ignore:
Timestamp:
Dec 8, 2006, 1:12:44 AM (17 years ago)
Author:
rvelices
Message:
  • new function set_status_header (set http status code)
  • correction on recent/recent_by_child icons
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_html.inc.php

    r1641 r1643  
    482482      $menu.= '</span>';
    483483    }
    484     $child_date_last = isset($category['date_last'])
    485         and $category['max_date_last']>$category['date_last'] ;
     484    $child_date_last = @$category['max_date_last']> @$category['date_last'];
    486485    $menu.= get_icon($category['max_date_last'], $child_date_last);
    487486  }
     
    610609  else
    611610  {
    612     header('HTTP/1.1 401 Authorization required');
    613     header('Status: 401 Authorization required');
     611    set_status_header(401);
    614612    redirect($login_url);
    615613  }
     
    623621function page_not_found($msg, $alternate_url=null)
    624622{
    625   header('HTTP/1.1 404 Not found');
    626   header('Status: 404 Not found');
     623  set_status_header(404);
    627624  if ($alternate_url==null)
    628625    $alternate_url = make_index_url();
     
    681678  return $title;
    682679}
     680
     681/**
     682  Sets the http status header (200,401,...)
     683 */
     684function set_status_header($code, $text='')
     685{
     686  if (empty($text))
     687  {
     688    switch ($code)
     689    {
     690      case 200: $text='OK';break;
     691      case 301: $text='Moved permanently';break;
     692      case 302: $text='Moved temporarily';break;
     693      case 304: $text='Not modified';break;
     694      case 400: $text='Bad request';break;
     695      case 401: $text='Authorization required';break;
     696      case 403: $text='Forbidden';break;
     697      case 404: $text='Not found';break;
     698    }
     699  }
     700  header("HTTP/1.1 $code $text");
     701  header("Status: $code $text");
     702}
    683703?>
Note: See TracChangeset for help on using the changeset viewer.