aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to '')
-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
4 files changed, 27 insertions, 21 deletions
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,
),
);