aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2006-12-08 00:12:44 +0000
committerrvelices <rv-github@modusoptimus.com>2006-12-08 00:12:44 +0000
commit7325369bf5f7ea3f3f50d0f716b9ddf417767623 (patch)
treefd7c74180da16d17da705ecd02835258fbf52e21 /include
parent92fc9abb14a2186806ed50322730caae54909f0f (diff)
- new function set_status_header (set http status code)
- correction on recent/recent_by_child icons git-svn-id: http://piwigo.org/svn/trunk@1643 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/category_cats.inc.php3
-rw-r--r--include/functions_html.inc.php32
2 files changed, 27 insertions, 8 deletions
diff --git a/include/category_cats.inc.php b/include/category_cats.inc.php
index eaa01b80b..83f4b7209 100644
--- a/include/category_cats.inc.php
+++ b/include/category_cats.inc.php
@@ -65,8 +65,7 @@ $image_ids = array();
while ($row = mysql_fetch_assoc($result))
{
- $row['is_child_date_last'] = isset($row['date_last'])
- and $row['max_date_last']>$row['date_last'];
+ $row['is_child_date_last'] = @$row['max_date_last']>@$row['date_last'];
if (isset($row['representative_picture_id'])
and is_numeric($row['representative_picture_id']))
diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php
index ef0ee026c..d39a4cf09 100644
--- a/include/functions_html.inc.php
+++ b/include/functions_html.inc.php
@@ -481,8 +481,7 @@ function get_html_menu_category($categories)
: $category['count_images']).']';
$menu.= '</span>';
}
- $child_date_last = isset($category['date_last'])
- and $category['max_date_last']>$category['date_last'] ;
+ $child_date_last = @$category['max_date_last']> @$category['date_last'];
$menu.= get_icon($category['max_date_last'], $child_date_last);
}
@@ -609,8 +608,7 @@ function access_denied()
}
else
{
- header('HTTP/1.1 401 Authorization required');
- header('Status: 401 Authorization required');
+ set_status_header(401);
redirect($login_url);
}
}
@@ -622,8 +620,7 @@ function access_denied()
*/
function page_not_found($msg, $alternate_url=null)
{
- header('HTTP/1.1 404 Not found');
- header('Status: 404 Not found');
+ set_status_header(404);
if ($alternate_url==null)
$alternate_url = make_index_url();
redirect( $alternate_url,
@@ -680,4 +677,27 @@ function get_tags_content_title()
}
return $title;
}
+
+/**
+ Sets the http status header (200,401,...)
+ */
+function set_status_header($code, $text='')
+{
+ if (empty($text))
+ {
+ switch ($code)
+ {
+ case 200: $text='OK';break;
+ case 301: $text='Moved permanently';break;
+ case 302: $text='Moved temporarily';break;
+ case 304: $text='Not modified';break;
+ case 400: $text='Bad request';break;
+ case 401: $text='Authorization required';break;
+ case 403: $text='Forbidden';break;
+ case 404: $text='Not found';break;
+ }
+ }
+ header("HTTP/1.1 $code $text");
+ header("Status: $code $text");
+}
?>