aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2006-02-24 01:16:30 +0000
committerrvelices <rv-github@modusoptimus.com>2006-02-24 01:16:30 +0000
commit3aff4f0bfec650d7a080b919b299ddcf6fc6ee59 (patch)
tree6bebc39a9de733910e32b117d82944bde033c214
parent5fa3664567ad8240154566cce1f8479c4fd93909 (diff)
fix: remove all php warnings and notices
git-svn-id: http://piwigo.org/svn/trunk@1056 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/rating.php518
-rw-r--r--category.php26
-rw-r--r--identification.php2
-rw-r--r--include/calendar_base.class.php2
-rw-r--r--include/calendar_monthly.class.php13
-rw-r--r--include/category_default.inc.php28
-rw-r--r--include/functions_calendar.inc.php5
-rw-r--r--picture.php37
8 files changed, 323 insertions, 308 deletions
diff --git a/admin/rating.php b/admin/rating.php
index a28eaba50..3c30e07b8 100644
--- a/admin/rating.php
+++ b/admin/rating.php
@@ -1,260 +1,260 @@
-<?php
-// +-----------------------------------------------------------------------+
-// | PhpWebGallery - a PHP based picture gallery |
-// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
-// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
-// +-----------------------------------------------------------------------+
-// | branch : BSF (Best So Far)
-// | file : $RCSfile$
-// | last update : $Date: 2006-01-15 08:45:42 -0500 (Sun, 15 Jan 2006) $
-// | last modifier : $Author: nikrou $
-// | revision : $Revision: 1004 $
-// +-----------------------------------------------------------------------+
-// | This program is free software; you can redistribute it and/or modify |
-// | it under the terms of the GNU General Public License as published by |
-// | the Free Software Foundation |
-// | |
-// | This program is distributed in the hope that it will be useful, but |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
-// | General Public License for more details. |
-// | |
-// | You should have received a copy of the GNU General Public License |
-// | along with this program; if not, write to the Free Software |
-// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
-// | USA. |
-// +-----------------------------------------------------------------------+
-
-if (!defined('PHPWG_ROOT_PATH'))
-{
- die ("Hacking attempt!");
-}
-include_once(PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
-
-
-// +-----------------------------------------------------------------------+
-// | initialization |
-// +-----------------------------------------------------------------------+
-if (isset($_GET['start']) and is_numeric($_GET['start']))
-{
- $start = $_GET['start'];
-}
-else
-{
- $start = 0;
-}
-
-$elements_per_page=10;
-if (isset($_GET['display']) and is_numeric($_GET['display']))
-{
- $elements_per_page = $_GET['display'];
-}
-
-$order_by_index=0;
-if (isset($_GET['order_by']) and is_numeric($_GET['order_by']))
-{
- $order_by_index = $_GET['order_by'];
-}
-
-$display_filter= '';
-if (isset($_GET['display_filter']))
-{
- if ( $_GET['display_filter']=='user' )
- {
- $display_filter= ' AND r.user_id <> ' . $conf['guest_id'];
- $template->assign_vars( array(
- 'DISPLAY_FILTER_USER_CHECKED'=>'checked="checked"'
- )
- );
- }
- elseif ( $_GET['display_filter']=='guest' )
- {
- $display_filter= ' AND r.user_id =' . $conf['guest_id'];
- $template->assign_vars( array(
- 'DISPLAY_FILTER_GUEST_CHECKED'=>'checked="checked"'
- )
- );
- }
-}
-if ($display_filter=='')
-{
- $template->assign_vars( array(
- 'DISPLAY_FILTER_ALL_CHECKED'=>'checked="checked"'
- )
- );
-}
-
-if (isset($_GET['del']))
-{
- $del_params = urldecode( $_GET['del'] );
- parse_str($del_params, $vars);
- if ( !is_numeric($vars['e']) or !is_numeric($vars['u']) )
- {
- die('Hacking attempt');
- }
- $query = '
-DELETE FROM '. RATE_TABLE .'
-WHERE element_id=' . $vars['e'] . '
-AND user_id=' . $vars['u'] . '
-AND anonymous_id=\'' . $vars['a'] . '\'
-;';
- pwg_query($query);
- update_average_rate( $vars['e'] );
-}
-
-$users = array();
-$query = '
-SELECT '.$conf['user_fields']['username'].' as username, '.$conf['user_fields']['id'].' as id
- FROM '.USERS_TABLE.'
-;';
-$result = pwg_query($query);
-while ($row = mysql_fetch_array($result))
-{
- $users[$row['id']]=$row['username'];
-}
-
-
-$query = 'SELECT COUNT(DISTINCT(i.id))
-FROM '.RATE_TABLE.' AS r, '.IMAGES_TABLE.' AS i
-WHERE r.element_id=i.id'. $display_filter .
-';';
-list($nb_images) = mysql_fetch_row(pwg_query($query));
-
-
-// +-----------------------------------------------------------------------+
-// | template init |
-// +-----------------------------------------------------------------------+
-
-$template->set_filenames(array('rating'=>'admin/rating.tpl'));
-
-$navbar = create_navigation_bar(
- PHPWG_ROOT_PATH.'admin.php'.get_query_string_diff(array('start','del')),
- $nb_images,
- $start,
- $elements_per_page,
- '');
-$template->assign_vars(array('NAVBAR' => $navbar));
-
-
-$template->assign_vars(
- array(
- 'F_ACTION' => PHPWG_ROOT_PATH.'admin.php',
- 'DISPLAY' => $elements_per_page,
- 'NB_ELEMENTS' => $nb_images
- )
- );
-
-$available_order_by= array(
- array(l10n('Rate date'), 'recently_rated DESC'),
- array(l10n('Average rate'), 'average_rate DESC'),
- array(l10n('Number of rates'), 'nb_rates DESC'),
- array(l10n('Sum of rates'), 'sum_rates DESC'),
- array(l10n('Controversy'), 'std_rates DESC'),
- array(l10n('File name'), 'file DESC'),
- array(l10n('Creation date'), 'date_creation DESC'),
- array(l10n('Availability date'), 'date_available DESC'),
-
- );
-
-for ($i=0; $i<count($available_order_by); $i++)
-{
- $template->assign_block_vars(
- 'order_by',
- array(
- 'VALUE' => $i,
- 'CONTENT' => $available_order_by[$i][0],
- 'SELECTED' => $i==$order_by_index ? 'SELECTED' : ''
- )
- );
-}
-
-$query = 'SELECT i.id, i.path, i.file, i.tn_ext, i.average_rate, i.storage_category_id,
- MAX(r.date) as recently_rated, COUNT(r.rate) as nb_rates,
- SUM(r.rate) as sum_rates, ROUND(STD(r.rate),2) as std_rates
-FROM '.RATE_TABLE.' AS r LEFT JOIN '.IMAGES_TABLE.' AS i
-ON r.element_id=i.id
-WHERE 1=1 ' . $display_filter . '
-GROUP BY r.element_id
-ORDER BY ' . $available_order_by[$order_by_index][1] .'
-LIMIT '.$start.','.$elements_per_page .
-';';
-
-$images = array();
-$result = pwg_query($query);
-while ($row = mysql_fetch_array($result))
-{
- array_push($images, $row);
-}
-
-foreach ($images as $image)
-{
- $thumbnail_src = get_thumbnail_src(
- $image['path'], $image['tn_ext']
- );
-
- $image_url = PHPWG_ROOT_PATH.'picture.php?'.
- 'cat=' . $image['storage_category_id'].
- '&amp;image_id=' . $image['id'];
-
- $query = 'SELECT *
-FROM '.RATE_TABLE.' AS r
-WHERE r.element_id='.$image['id'] . '
-ORDER BY date DESC;';
- $result = pwg_query($query);
- $nb_rates = mysql_num_rows($result);
-
- $template->assign_block_vars('image',
- array(
- 'U_THUMB' => $thumbnail_src,
- 'U_URL' => $image_url,
- 'AVG_RATE' => $image['average_rate'],
- 'STD_RATE' => $image['std_rates'],
- 'SUM_RATE' => $image['sum_rates'],
- 'NB_RATES' => $image['nb_rates'],
- 'NB_RATES_TOTAL' => $nb_rates,
- 'FILE' => $image['file'],
- 'NB_RATES_PLUS1' => $nb_rates+1,
- )
- );
-
- while ($row = mysql_fetch_array($result))
- {
-
- $url_del = PHPWG_ROOT_PATH.'admin.php'.
- get_query_string_diff(array('del'));
-
- $del_param = 'e='.$image[id].
- '&u='.$row['user_id'].
- '&a='.$row['anonymous_id'];
-
- $url_del .= '&amp;del='.urlencode(urlencode($del_param));
-
- if ( isset($users[$row['user_id']]) )
- {
- $user = $users[$row['user_id']];
- }
- else
- {
- $user = '? '. $row['user_id'];
- }
- if ( strlen($row['anonymous_id'])>0 )
- {
- $user .= '('.$row['anonymous_id'].')';
- }
-
- $template->assign_block_vars('image.rate',
- array(
- 'DATE' => format_date($row['date']),
- 'RATE' => $row['rate'],
- 'USER' => $user,
- 'U_DELETE' => $url_del
- )
- );
- }
-}
-//print_r($template->_tpldata);
-// +-----------------------------------------------------------------------+
-// | sending html code |
-// +-----------------------------------------------------------------------+
-$template->assign_var_from_handle('ADMIN_CONTENT', 'rating');
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | branch : BSF (Best So Far)
+// | file : $RCSfile$
+// | last update : $Date: 2006-01-15 08:45:42 -0500 (Sun, 15 Jan 2006) $
+// | last modifier : $Author: nikrou $
+// | revision : $Revision: 1004 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die ("Hacking attempt!");
+}
+include_once(PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
+
+
+// +-----------------------------------------------------------------------+
+// | initialization |
+// +-----------------------------------------------------------------------+
+if (isset($_GET['start']) and is_numeric($_GET['start']))
+{
+ $start = $_GET['start'];
+}
+else
+{
+ $start = 0;
+}
+
+$elements_per_page=10;
+if (isset($_GET['display']) and is_numeric($_GET['display']))
+{
+ $elements_per_page = $_GET['display'];
+}
+
+$order_by_index=0;
+if (isset($_GET['order_by']) and is_numeric($_GET['order_by']))
+{
+ $order_by_index = $_GET['order_by'];
+}
+
+$display_filter= '';
+if (isset($_GET['display_filter']))
+{
+ if ( $_GET['display_filter']=='user' )
+ {
+ $display_filter= ' AND r.user_id <> ' . $conf['guest_id'];
+ $template->assign_vars( array(
+ 'DISPLAY_FILTER_USER_CHECKED'=>'checked="checked"'
+ )
+ );
+ }
+ elseif ( $_GET['display_filter']=='guest' )
+ {
+ $display_filter= ' AND r.user_id =' . $conf['guest_id'];
+ $template->assign_vars( array(
+ 'DISPLAY_FILTER_GUEST_CHECKED'=>'checked="checked"'
+ )
+ );
+ }
+}
+if ($display_filter=='')
+{
+ $template->assign_vars( array(
+ 'DISPLAY_FILTER_ALL_CHECKED'=>'checked="checked"'
+ )
+ );
+}
+
+if (isset($_GET['del']))
+{
+ $del_params = urldecode( $_GET['del'] );
+ parse_str($del_params, $vars);
+ if ( !is_numeric($vars['e']) or !is_numeric($vars['u']) )
+ {
+ die('Hacking attempt');
+ }
+ $query = '
+DELETE FROM '. RATE_TABLE .'
+WHERE element_id=' . $vars['e'] . '
+AND user_id=' . $vars['u'] . '
+AND anonymous_id=\'' . $vars['a'] . '\'
+;';
+ pwg_query($query);
+ update_average_rate( $vars['e'] );
+}
+
+$users = array();
+$query = '
+SELECT '.$conf['user_fields']['username'].' as username, '.$conf['user_fields']['id'].' as id
+ FROM '.USERS_TABLE.'
+;';
+$result = pwg_query($query);
+while ($row = mysql_fetch_array($result))
+{
+ $users[$row['id']]=$row['username'];
+}
+
+
+$query = 'SELECT COUNT(DISTINCT(i.id))
+FROM '.RATE_TABLE.' AS r, '.IMAGES_TABLE.' AS i
+WHERE r.element_id=i.id'. $display_filter .
+';';
+list($nb_images) = mysql_fetch_row(pwg_query($query));
+
+
+// +-----------------------------------------------------------------------+
+// | template init |
+// +-----------------------------------------------------------------------+
+
+$template->set_filenames(array('rating'=>'admin/rating.tpl'));
+
+$navbar = create_navigation_bar(
+ PHPWG_ROOT_PATH.'admin.php'.get_query_string_diff(array('start','del')),
+ $nb_images,
+ $start,
+ $elements_per_page,
+ '');
+$template->assign_vars(array('NAVBAR' => $navbar));
+
+
+$template->assign_vars(
+ array(
+ 'F_ACTION' => PHPWG_ROOT_PATH.'admin.php',
+ 'DISPLAY' => $elements_per_page,
+ 'NB_ELEMENTS' => $nb_images
+ )
+ );
+
+$available_order_by= array(
+ array(l10n('Rate date'), 'recently_rated DESC'),
+ array(l10n('Average rate'), 'average_rate DESC'),
+ array(l10n('Number of rates'), 'nb_rates DESC'),
+ array(l10n('Sum of rates'), 'sum_rates DESC'),
+ array(l10n('Controversy'), 'std_rates DESC'),
+ array(l10n('File name'), 'file DESC'),
+ array(l10n('Creation date'), 'date_creation DESC'),
+ array(l10n('Availability date'), 'date_available DESC'),
+
+ );
+
+for ($i=0; $i<count($available_order_by); $i++)
+{
+ $template->assign_block_vars(
+ 'order_by',
+ array(
+ 'VALUE' => $i,
+ 'CONTENT' => $available_order_by[$i][0],
+ 'SELECTED' => $i==$order_by_index ? 'SELECTED' : ''
+ )
+ );
+}
+
+$query = 'SELECT i.id, i.path, i.file, i.tn_ext, i.average_rate, i.storage_category_id,
+ MAX(r.date) as recently_rated, COUNT(r.rate) as nb_rates,
+ SUM(r.rate) as sum_rates, ROUND(STD(r.rate),2) as std_rates
+FROM '.RATE_TABLE.' AS r LEFT JOIN '.IMAGES_TABLE.' AS i
+ON r.element_id=i.id
+WHERE 1=1 ' . $display_filter . '
+GROUP BY r.element_id
+ORDER BY ' . $available_order_by[$order_by_index][1] .'
+LIMIT '.$start.','.$elements_per_page .
+';';
+
+$images = array();
+$result = pwg_query($query);
+while ($row = mysql_fetch_array($result))
+{
+ array_push($images, $row);
+}
+
+foreach ($images as $image)
+{
+ $thumbnail_src = get_thumbnail_src(
+ $image['path'], $image['tn_ext']
+ );
+
+ $image_url = PHPWG_ROOT_PATH.'picture.php?'.
+ 'cat=' . $image['storage_category_id'].
+ '&amp;image_id=' . $image['id'];
+
+ $query = 'SELECT *
+FROM '.RATE_TABLE.' AS r
+WHERE r.element_id='.$image['id'] . '
+ORDER BY date DESC;';
+ $result = pwg_query($query);
+ $nb_rates = mysql_num_rows($result);
+
+ $template->assign_block_vars('image',
+ array(
+ 'U_THUMB' => $thumbnail_src,
+ 'U_URL' => $image_url,
+ 'AVG_RATE' => $image['average_rate'],
+ 'STD_RATE' => $image['std_rates'],
+ 'SUM_RATE' => $image['sum_rates'],
+ 'NB_RATES' => $image['nb_rates'],
+ 'NB_RATES_TOTAL' => $nb_rates,
+ 'FILE' => $image['file'],
+ 'NB_RATES_PLUS1' => $nb_rates+1,
+ )
+ );
+
+ while ($row = mysql_fetch_array($result))
+ {
+
+ $url_del = PHPWG_ROOT_PATH.'admin.php'.
+ get_query_string_diff(array('del'));
+
+ $del_param = 'e='.$image['id'].
+ '&u='.$row['user_id'].
+ '&a='.$row['anonymous_id'];
+
+ $url_del .= '&amp;del='.urlencode(urlencode($del_param));
+
+ if ( isset($users[$row['user_id']]) )
+ {
+ $user = $users[$row['user_id']];
+ }
+ else
+ {
+ $user = '? '. $row['user_id'];
+ }
+ if ( strlen($row['anonymous_id'])>0 )
+ {
+ $user .= '('.$row['anonymous_id'].')';
+ }
+
+ $template->assign_block_vars('image.rate',
+ array(
+ 'DATE' => format_date($row['date']),
+ 'RATE' => $row['rate'],
+ 'USER' => $user,
+ 'U_DELETE' => $url_del
+ )
+ );
+ }
+}
+//print_r($template->_tpldata);
+// +-----------------------------------------------------------------------+
+// | sending html code |
+// +-----------------------------------------------------------------------+
+$template->assign_var_from_handle('ADMIN_CONTENT', 'rating');
?> \ No newline at end of file
diff --git a/category.php b/category.php
index 07d15a95c..e466a5bb2 100644
--- a/category.php
+++ b/category.php
@@ -85,21 +85,22 @@ if ( isset($page['cat_nb_images'])
if ( isset($page['cat']) )
{
$nav_url .= 'cat='.$page['cat'].'&amp;';
- }
- switch ($page['cat'])
- {
- case 'search':
+ switch ($page['cat'])
{
- $nav_url.= 'search='.$_GET['search'].'&amp;';
- break;
- }
- case 'list':
- {
- $nav_url.= 'list='.$_GET['list'].'&amp;';
- break;
+ case 'search':
+ {
+ $nav_url.= 'search='.$_GET['search'].'&amp;';
+ break;
+ }
+ case 'list':
+ {
+ $nav_url.= 'list='.$_GET['list'].'&amp;';
+ break;
+ }
}
}
+
if ( isset($_GET['calendar']) )
{
$nav_url.= 'calendar='.$_GET['calendar'];
@@ -401,7 +402,8 @@ if ( $page['navigation_bar'] != '' )
);
}
-if ($page['cat_nb_images']>0 and
+if ( ( isset($page['cat_nb_images']) and $page['cat_nb_images']>0 )
+ and
( !isset($page['cat'])
or ($page['cat'] != 'most_visited' and $page['cat'] != 'best_rated') )
)
diff --git a/identification.php b/identification.php
index 5cf65b5a2..b53e76a2d 100644
--- a/identification.php
+++ b/identification.php
@@ -44,7 +44,7 @@ if ( !empty($_GET['redirect']) )
if (isset($_POST['login']))
{
- $redirect_to = $_POST['redirect'];
+ $redirect_to = isset($_POST['redirect']) ? $_POST['redirect'] : '';
$username = mysql_escape_string($_POST['username']);
// retrieving the encrypted password of the login submitted
$query = '
diff --git a/include/calendar_base.class.php b/include/calendar_base.class.php
index 26472bf1b..e9194eb90 100644
--- a/include/calendar_base.class.php
+++ b/include/calendar_base.class.php
@@ -162,7 +162,7 @@ SELECT DISTINCT('.$sql_func.'('.$this->date_field.')'.$sql_offset
$nav_bar = $this->get_nav_bar_from_items(
$url_base,
$level_items,
- $requested[$level],
+ isset($requested[$level]) ? $requested[$level] : null,
'cal',
true,
$labels
diff --git a/include/calendar_monthly.class.php b/include/calendar_monthly.class.php
index fe78f624e..8d6b60393 100644
--- a/include/calendar_monthly.class.php
+++ b/include/calendar_monthly.class.php
@@ -73,7 +73,7 @@ function generate_category_content($url_base, $view_type, &$requested)
if (count($requested)>0)
$this->build_nav_bar2($view_type, $requested, 1, 'MONTH', $lang['month']); // month
if (count($requested)>1)
- $this->build_nav_bar2($view_type, $requested, 2, 'DAYOFWEEK' ); // days
+ $this->build_nav_bar2($view_type, $requested, 2, 'DAYOFMONTH' ); // days
}
return false;
}
@@ -151,10 +151,11 @@ function build_nav_bar2($view_type, $requested, $level, $sql_func, $labels=null)
function build_global_calendar(&$requested)
{
+ assert( count($requested) == 0 );
$query='SELECT DISTINCT(DATE_FORMAT('.$this->date_field.',"%Y%m")) as period,
COUNT(id) as count';
$query.= $this->inner_sql;
- $query.= $this->get_date_where($requested, 0);
+ $query.= $this->get_date_where($requested);
$query.= '
GROUP BY period';
@@ -188,7 +189,8 @@ function build_global_calendar(&$requested)
$nav_bar .= '</span><br>';
$url_base .= '-';
- $nav_bar .= $this->get_nav_bar_from_items( $url_base, $year_data['children'], $requested[0], 'calCal', false, $lang['month'] );
+ $nav_bar .= $this->get_nav_bar_from_items( $url_base,
+ $year_data['children'], null, 'calCal', false, $lang['month'] );
$template->assign_block_vars( 'calendar.calbar',
array( 'BAR' => $nav_bar)
@@ -199,10 +201,11 @@ function build_global_calendar(&$requested)
function build_year_calendar(&$requested)
{
+ assert( count($requested) == 1 );
$query='SELECT DISTINCT(DATE_FORMAT('.$this->date_field.',"%m%d")) as period,
COUNT(id) as count';
$query.= $this->inner_sql;
- $query.= $this->get_date_where($requested, 1);
+ $query.= $this->get_date_where($requested);
$query.= '
GROUP BY period';
@@ -242,7 +245,7 @@ function build_year_calendar(&$requested)
$url_base .= '-';
$nav_bar .= $this->get_nav_bar_from_items( $url_base,
- $month_data['children'], $requested[1], 'calCal', false );
+ $month_data['children'], null, 'calCal', false );
$template->assign_block_vars( 'calendar.calbar',
array( 'BAR' => $nav_bar)
diff --git a/include/category_default.inc.php b/include/category_default.inc.php
index 5c31e4a18..e401aec9b 100644
--- a/include/category_default.inc.php
+++ b/include/category_default.inc.php
@@ -85,7 +85,7 @@ foreach ($pictures as $row)
if (isset($page['cat']))
{
- $url_link.= 'cat='.$page['cat'].'&amp;';
+ $url_link.= '&amp;cat='.$page['cat'];
if ($page['cat'] == 'search')
{
@@ -125,19 +125,21 @@ foreach ($pictures as $row)
{
$name = str_replace('_', ' ', get_filename_wo_extension($row['file']));
}
- if ($page['cat'] == 'best_rated')
+ if ( isset($page['cat']) )
{
- $name = '('.$row['average_rate'].') '.$name;
- }
- else
- if ($page['cat'] == 'most_visited')
- {
- $name = '('.$row['hit'].') '.$name;
- }
-
- if ($page['cat'] == 'search')
- {
- $name = replace_search($name, $_GET['search']);
+ if ($page['cat'] == 'best_rated')
+ {
+ $name = '('.$row['average_rate'].') '.$name;
+ }
+ elseif ($page['cat'] == 'most_visited')
+ {
+ $name = '('.$row['hit'].') '.$name;
+ }
+
+ if ($page['cat'] == 'search')
+ {
+ $name = replace_search($name, $_GET['search']);
+ }
}
$template->assign_block_vars(
diff --git a/include/functions_calendar.inc.php b/include/functions_calendar.inc.php
index acc8b15b0..43ca188ef 100644
--- a/include/functions_calendar.inc.php
+++ b/include/functions_calendar.inc.php
@@ -75,7 +75,7 @@ WHERE id IN (' . implode(',',$page['items']) .')';
pwg_debug('start initialize_calendar');
$cal_styles = array(
- // Weekly style
+ // Monthly style
array(
'link' => 'm',
'default_link' => '',
@@ -83,12 +83,13 @@ WHERE id IN (' . implode(',',$page['items']) .')';
'include' => 'calendar_monthly.class.php',
'view_calendar' => true,
),
- // Monthly style
+ // Weekly style
array(
'link' => 'w',
'default_link' => 'w-',
'name' => l10n('Weekly'),
'include' => 'calendar_weekly.class.php',
+ 'view_calendar' => false,
),
);
diff --git a/picture.php b/picture.php
index d9b633f18..000af4caf 100644
--- a/picture.php
+++ b/picture.php
@@ -379,18 +379,21 @@ if ($url_up_start>0)
$url_up .= '&amp;start='.$url_up_start;
}
-if ( $page['cat'] == 'search' )
-{
- $url_up.= '&amp;search='.$_GET['search'];
-}
-if ( $page['cat'] == 'list' )
+if ( isset($page['cat']) )
{
- $url_up.= '&amp;list='.$_GET['list'];
+ if ( $page['cat'] == 'search' )
+ {
+ $url_up.= '&amp;search='.$_GET['search'];
+ }
+ if ( $page['cat'] == 'list' )
+ {
+ $url_up.= '&amp;list='.$_GET['list'];
+ }
}
$url_admin =
PHPWG_ROOT_PATH.'admin.php?page=picture_modify'
- .'&amp;cat_id='.$page['cat']
+ .'&amp;cat_id='. ( isset($page['cat']) ? $page['cat'] : '' )
.'&amp;image_id='.$_GET['image_id'];
$url_slide =
@@ -413,7 +416,7 @@ if ( isset( $_GET['add_fav'] ) )
$query.= ';';
$result = pwg_query( $query );
}
- if ( !$_GET['add_fav'] and $page['cat'] == 'fav' )
+ if ( !$_GET['add_fav'] and isset($page['cat']) and 'fav'==$page['cat'] )
{
if (!isset($page['previous_item']) and !isset($page['next_item']))
{
@@ -537,13 +540,16 @@ if ( isset( $_GET['slideshow'] ) and isset($page['next_item']) )
}
$title_img = $picture['current']['name'];
-if (is_numeric( $page['cat'] ))
+if ( isset( $page['cat'] ) )
{
- $title_img = replace_space(get_cat_display_name($page['cat_name']));
-}
-else if ( $page['cat'] == 'search' )
-{
- $title_img = replace_search( $title_img, $_GET['search'] );
+ if (is_numeric( $page['cat'] ))
+ {
+ $title_img = replace_space(get_cat_display_name($page['cat_name']));
+ }
+ else if ( $page['cat'] == 'search' )
+ {
+ $title_img = replace_search( $title_img, $_GET['search'] );
+ }
}
$title_nb = ($page['current_rank'] + 1).'/'.$page['cat_nb_images'];
@@ -680,7 +686,8 @@ if (isset($picture['current']['high']))
);
}
// button to set the current picture as representative
-if ('admin' == $user['status'] and is_numeric($page['cat']))
+if ('admin' == $user['status'] and
+ isset($page['cat']) and is_numeric($page['cat']))
{
$template->assign_block_vars(
'representative',