mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-07 09:13:02 +02:00
- index.tpl, menubar.tpl, mainpage_categories.tpl and month_calendar.tpl go smarty
- better template debugging tweak (the smarty console is shown only once at the end) git-svn-id: http://piwigo.org/svn/trunk@2231 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
@@ -35,8 +35,6 @@ class CalendarBase
|
||||
//
|
||||
var $calendar_levels;
|
||||
|
||||
var $has_nav_bar;
|
||||
|
||||
/**
|
||||
* Initialize the calendar
|
||||
* @param string inner_sql used for queries (INNER JOIN or normal)
|
||||
@@ -53,7 +51,6 @@ class CalendarBase
|
||||
$this->date_field = 'date_creation';
|
||||
}
|
||||
$this->inner_sql = $inner_sql;
|
||||
$this->has_nav_bar = false;
|
||||
}
|
||||
|
||||
function get_display_name()
|
||||
@@ -262,13 +259,12 @@ SELECT DISTINCT('.$this->calendar_levels[$level]['sql']
|
||||
isset($labels) ? $labels : $this->calendar_levels[$level]['labels']
|
||||
);
|
||||
|
||||
$template->assign_block_vars(
|
||||
'calendar.navbar',
|
||||
$template->append(
|
||||
'chronology_navigation_bars',
|
||||
array(
|
||||
'BAR' => $nav_bar,
|
||||
'CONTENT' => $nav_bar,
|
||||
)
|
||||
);
|
||||
$this->has_nav_bar = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -311,40 +307,47 @@ GROUP BY period';
|
||||
}
|
||||
$current_rank = $upper_items_rank[$current];
|
||||
|
||||
if (!$this->has_nav_bar and
|
||||
($current_rank>0 or $current_rank < count($upper_items)-1 ) )
|
||||
{
|
||||
$template->assign_block_vars( 'calendar.navbar', array() );
|
||||
}
|
||||
|
||||
$tpl_var = array();
|
||||
|
||||
if ( $current_rank>0 )
|
||||
{ // has previous
|
||||
$prev = $upper_items[$current_rank-1];
|
||||
$chronology_date = explode('-', $prev);
|
||||
$template->assign_block_vars(
|
||||
'calendar.navbar.prev',
|
||||
$tpl_var['previous'] =
|
||||
array(
|
||||
'LABEL' => $this->get_date_nice_name($prev),
|
||||
'URL' => duplicate_index_url(
|
||||
array('chronology_date'=>$chronology_date), array('start')
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ( $current_rank < count($upper_items)-1 )
|
||||
{ // has next
|
||||
$next = $upper_items[$current_rank+1];
|
||||
$chronology_date = explode('-', $next);
|
||||
$template->assign_block_vars(
|
||||
'calendar.navbar.next',
|
||||
$tpl_var['next'] =
|
||||
array(
|
||||
'LABEL' => $this->get_date_nice_name($next),
|
||||
'URL' => duplicate_index_url(
|
||||
array('chronology_date'=>$chronology_date), array('start')
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ( !empty($tpl_var) )
|
||||
{
|
||||
$existing = & $template->get_template_vars('chronology_navigation_bars');
|
||||
if ( !empty($existing) )
|
||||
{
|
||||
$existing[ sizeof($existing)-1 ] =
|
||||
array_merge( $existing[ sizeof($existing)-1 ], $tpl_var);
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->append( 'chronology_navigation_bars', $tpl_var );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -71,16 +71,22 @@ function generate_category_content()
|
||||
$view_type = $page['chronology_view'];
|
||||
if ($view_type==CAL_VIEW_CALENDAR)
|
||||
{
|
||||
global $template;
|
||||
$tpl_var = array();
|
||||
if ( count($page['chronology_date'])==0 )
|
||||
{//case A: no year given - display all years+months
|
||||
if ($this->build_global_calendar())
|
||||
if ($this->build_global_calendar($tpl_var))
|
||||
{
|
||||
$template->assign('chronology_calendar', $tpl_var);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( count($page['chronology_date'])==1 )
|
||||
{//case B: year given - display all days in given year
|
||||
if ($this->build_year_calendar())
|
||||
if ($this->build_year_calendar($tpl_var))
|
||||
{
|
||||
$template->assign('chronology_calendar', $tpl_var);
|
||||
$this->build_nav_bar(CYEAR); // years
|
||||
return true;
|
||||
}
|
||||
@@ -88,9 +94,10 @@ function generate_category_content()
|
||||
|
||||
if ( count($page['chronology_date'])==2 )
|
||||
{//case C: year+month given - display a nice month calendar
|
||||
$this->build_month_calendar();
|
||||
//$this->build_nav_bar(CYEAR); // years
|
||||
//$this->build_nav_bar(CMONTH); // month
|
||||
if ( $this->build_month_calendar($tpl_var) )
|
||||
{
|
||||
$template->assign('chronology_calendar', $tpl_var);
|
||||
}
|
||||
$this->build_next_prev();
|
||||
return true;
|
||||
}
|
||||
@@ -98,7 +105,6 @@ function generate_category_content()
|
||||
|
||||
if ($view_type==CAL_VIEW_LIST or count($page['chronology_date'])==3)
|
||||
{
|
||||
$has_nav_bar = false;
|
||||
if ( count($page['chronology_date'])==0 )
|
||||
{
|
||||
$this->build_nav_bar(CYEAR); // years
|
||||
@@ -213,7 +219,7 @@ function get_all_days_in_month($year, $month)
|
||||
return $nb_days;
|
||||
}
|
||||
|
||||
function build_global_calendar()
|
||||
function build_global_calendar(&$tpl_var)
|
||||
{
|
||||
global $page;
|
||||
assert( count($page['chronology_date']) == 0 );
|
||||
@@ -246,27 +252,27 @@ function build_global_calendar()
|
||||
return false;
|
||||
}
|
||||
|
||||
global $lang, $template;
|
||||
global $lang;
|
||||
foreach ( $items as $year=>$year_data)
|
||||
{
|
||||
$chronology_date = array( $year );
|
||||
$url = duplicate_index_url( array('chronology_date'=>$chronology_date) );
|
||||
|
||||
$nav_bar = '<span class="calCalHead"><a href="'.$url.'">'.$year.'</a>';
|
||||
$nav_bar .= ' ('.$year_data['nb_images'].')';
|
||||
$nav_bar .= '</span><br>';
|
||||
|
||||
$nav_bar .= $this->get_nav_bar_from_items( $chronology_date,
|
||||
$nav_bar = $this->get_nav_bar_from_items( $chronology_date,
|
||||
$year_data['children'], 'calCal', false, false, $lang['month'] );
|
||||
|
||||
$template->assign_block_vars( 'calendar.calbar',
|
||||
array( 'BAR' => $nav_bar)
|
||||
);
|
||||
$tpl_var['calendar_bars'][] =
|
||||
array(
|
||||
'U_HEAD' => $url,
|
||||
'NB_IMAGES' => $year_data['nb_images'],
|
||||
'HEAD_LABEL' => $year,
|
||||
'NAV_BAR' => $nav_bar,
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function build_year_calendar()
|
||||
function build_year_calendar(&$tpl_var)
|
||||
{
|
||||
global $page;
|
||||
assert( count($page['chronology_date']) == 1 );
|
||||
@@ -296,29 +302,28 @@ function build_year_calendar()
|
||||
$page['chronology_date'][CMONTH] = $m;
|
||||
return false;
|
||||
}
|
||||
global $lang, $template;
|
||||
global $lang;
|
||||
foreach ( $items as $month=>$month_data)
|
||||
{
|
||||
$chronology_date = array( $page['chronology_date'][CYEAR], $month );
|
||||
$url = duplicate_index_url( array('chronology_date'=>$chronology_date) );
|
||||
|
||||
$nav_bar = '<span class="calCalHead"><a href="'.$url.'">';
|
||||
$nav_bar .= $lang['month'][$month].'</a>';
|
||||
$nav_bar .= ' ('.$month_data['nb_images'].')';
|
||||
$nav_bar .= '</span><br>';
|
||||
|
||||
$nav_bar .= $this->get_nav_bar_from_items( $chronology_date,
|
||||
$nav_bar = $this->get_nav_bar_from_items( $chronology_date,
|
||||
$month_data['children'], 'calCal', false );
|
||||
|
||||
$template->assign_block_vars( 'calendar.calbar',
|
||||
array( 'BAR' => $nav_bar)
|
||||
);
|
||||
$tpl_var['calendar_bars'][] =
|
||||
array(
|
||||
'U_HEAD' => $url,
|
||||
'NB_IMAGES' => $month_data['nb_images'],
|
||||
'HEAD_LABEL' => $lang['month'][$month],
|
||||
'NAV_BAR' => $nav_bar,
|
||||
);
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
function build_month_calendar()
|
||||
function build_month_calendar(&$tpl_var)
|
||||
{
|
||||
global $page;
|
||||
$query='SELECT DISTINCT(DAYOFMONTH('.$this->date_field.')) as period,
|
||||
@@ -358,7 +363,7 @@ SELECT id, file,tn_ext,path, width, height, DAYOFWEEK('.$this->date_field.')-1 a
|
||||
$items[$day]['dow'] = $row['dow'];
|
||||
}
|
||||
|
||||
global $lang, $template, $conf;
|
||||
global $lang, $conf;
|
||||
|
||||
if ( !empty($items)
|
||||
and $conf['calendar_month_cell_width']>0
|
||||
@@ -389,36 +394,15 @@ SELECT id, file,tn_ext,path, width, height, DAYOFWEEK('.$this->date_field.')-1 a
|
||||
$cell_width = $conf['calendar_month_cell_width'];
|
||||
$cell_height = $conf['calendar_month_cell_height'];
|
||||
|
||||
$template->set_filenames(
|
||||
array(
|
||||
'month_calendar'=>'month_calendar.tpl',
|
||||
)
|
||||
);
|
||||
|
||||
$template->assign_block_vars('calendar.thumbnails',
|
||||
array(
|
||||
'WIDTH'=>$cell_width,
|
||||
'HEIGHT'=>$cell_height,
|
||||
)
|
||||
);
|
||||
|
||||
//fill the heading with day names
|
||||
$template->assign_block_vars('calendar.thumbnails.head', array());
|
||||
foreach( $wday_labels as $d => $label)
|
||||
{
|
||||
$template->assign_block_vars('calendar.thumbnails.head.col',
|
||||
array('LABEL'=>$label)
|
||||
);
|
||||
}
|
||||
|
||||
$template->assign_block_vars('calendar.thumbnails.row', array());
|
||||
$tpl_weeks = array();
|
||||
$tpl_crt_week = array();
|
||||
|
||||
//fill the empty days in the week before first day of this month
|
||||
for ($i=0; $i<$first_day_dow; $i++)
|
||||
{
|
||||
$template->assign_block_vars('calendar.thumbnails.row.col', array());
|
||||
$template->assign_block_vars('calendar.thumbnails.row.col.blank', array());
|
||||
$tpl_crt_week[] = array();
|
||||
}
|
||||
|
||||
for ( $day = 1;
|
||||
$day <= $this->get_all_days_in_month(
|
||||
$page['chronology_date'][CYEAR], $page['chronology_date'][CMONTH]
|
||||
@@ -428,28 +412,22 @@ SELECT id, file,tn_ext,path, width, height, DAYOFWEEK('.$this->date_field.')-1 a
|
||||
$dow = ($first_day_dow + $day-1)%7;
|
||||
if ($dow==0 and $day!=1)
|
||||
{
|
||||
$template->assign_block_vars('calendar.thumbnails.row', array());
|
||||
$tpl_weeks[] = $tpl_crt_week; // add finished week to week list
|
||||
$tpl_crt_week = array(); // start new week
|
||||
}
|
||||
$template->assign_block_vars('calendar.thumbnails.row.col', array());
|
||||
|
||||
if ( !isset($items[$day]) )
|
||||
{
|
||||
$template->assign_block_vars('calendar.thumbnails.row.col.empty',
|
||||
array('LABEL'=>$day));
|
||||
{// empty day
|
||||
$tpl_crt_week[] =
|
||||
array(
|
||||
'DAY' => $day
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* // first try to guess thumbnail size
|
||||
if ( !empty($items[$day]['width']) )
|
||||
{
|
||||
$tn_size = get_picture_size(
|
||||
$items[$day]['width'], $items[$day]['height'],
|
||||
$conf['tn_width'], $conf['tn_height'] );
|
||||
}
|
||||
else*/
|
||||
{// item not an image (tn is either mime type or an image)
|
||||
$thumb = get_thumbnail_path($items[$day]);
|
||||
$tn_size = @getimagesize($thumb);
|
||||
}
|
||||
$thumb = get_thumbnail_path($items[$day]);
|
||||
$tn_size = @getimagesize($thumb);
|
||||
|
||||
$tn_width = $tn_size[0];
|
||||
$tn_height = $tn_size[1];
|
||||
|
||||
@@ -459,21 +437,21 @@ SELECT id, file,tn_ext,path, width, height, DAYOFWEEK('.$this->date_field.')-1 a
|
||||
$ratio_w = $tn_width/$cell_width;
|
||||
$ratio_h = $tn_height/$cell_height;
|
||||
|
||||
|
||||
$pos_top=$pos_left=0;
|
||||
$img_width=$img_height='';
|
||||
$css_style = '';
|
||||
|
||||
if ( $ratio_w>1 and $ratio_h>1)
|
||||
{// cell completely smaller than the thumbnail so we will let the browser
|
||||
// resize the thumbnail
|
||||
if ($ratio_w > $ratio_h )
|
||||
{// thumbnail ratio compared to cell -> wide format
|
||||
$img_height = 'height="'.$cell_height.'"';
|
||||
$css_style = 'height:'.$cell_height.'px;';
|
||||
$browser_img_width = $cell_height*$tn_width/$tn_height;
|
||||
$pos_left = ($browser_img_width-$cell_width)/2;
|
||||
}
|
||||
else
|
||||
{
|
||||
$img_width = 'width="'.$cell_width.'"';
|
||||
$css_style = 'width:'.$cell_width.'px;';
|
||||
$browser_img_height = $cell_width*$tn_height/$tn_width;
|
||||
$pos_top = ($browser_img_height-$cell_height)/2;
|
||||
}
|
||||
@@ -484,7 +462,6 @@ SELECT id, file,tn_ext,path, width, height, DAYOFWEEK('.$this->date_field.')-1 a
|
||||
$pos_top = ($tn_height-$cell_height)/2;
|
||||
}
|
||||
|
||||
$css_style = '';
|
||||
if ( round($pos_left)!=0)
|
||||
{
|
||||
$css_style.='left:'.round(-$pos_left).'px;';
|
||||
@@ -505,64 +482,32 @@ SELECT id, file,tn_ext,path, width, height, DAYOFWEEK('.$this->date_field.')-1 a
|
||||
);
|
||||
$alt = $wday_labels[$dow] . ' ' . $day.
|
||||
' ('.sprintf("%d ".l10n('pictures'), $items[$day]['nb_images']).')';
|
||||
$template->assign_block_vars('calendar.thumbnails.row.col.full',
|
||||
array(
|
||||
'LABEL' => $day,
|
||||
'IMAGE' => $items[$day]['tn_url'],
|
||||
'U_IMG_LINK'=> $url,
|
||||
'STYLE' => $css_style,
|
||||
'IMG_WIDTH' => $img_width,
|
||||
'IMG_HEIGHT'=> $img_height,
|
||||
'IMAGE_ALT' => $alt,
|
||||
)
|
||||
|
||||
$tpl_crt_week[] =
|
||||
array(
|
||||
'DAY' => $day,
|
||||
'IMAGE' => $items[$day]['tn_url'],
|
||||
'U_IMG_LINK'=> $url,
|
||||
'IMAGE_STYLE' => $css_style,
|
||||
'IMAGE_ALT' => $alt,
|
||||
);
|
||||
}
|
||||
}
|
||||
//fill the empty days in the week after the last day of this month
|
||||
while ( $dow<6 )
|
||||
{
|
||||
$template->assign_block_vars('calendar.thumbnails.row.col', array());
|
||||
$template->assign_block_vars('calendar.thumbnails.row.col.blank', array());
|
||||
$tpl_crt_week[] = array();
|
||||
$dow++;
|
||||
}
|
||||
$template->assign_var_from_handle('MONTH_CALENDAR', 'month_calendar');
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_block_vars('thumbnails', array());
|
||||
$template->assign_block_vars('thumbnails.line', array());
|
||||
foreach ( $items as $day=>$data)
|
||||
{
|
||||
$url = duplicate_index_url(
|
||||
array(
|
||||
'chronology_date' =>
|
||||
array(
|
||||
$page['chronology_date'][CYEAR],
|
||||
$page['chronology_date'][CMONTH],
|
||||
$day
|
||||
)
|
||||
)
|
||||
);
|
||||
$tpl_weeks[] = $tpl_crt_week;
|
||||
|
||||
$thumbnail_title = $lang['day'][$data['dow']] . ' ' . $day;
|
||||
$name = $thumbnail_title .' ('.$data['nb_images'].')';
|
||||
|
||||
$template->assign_block_vars(
|
||||
'thumbnails.line.thumbnail',
|
||||
array(
|
||||
'IMAGE'=>$data['tn_url'],
|
||||
'IMAGE_ALT'=>$data['file'],
|
||||
'IMAGE_TITLE'=>$thumbnail_title,
|
||||
'U_IMG_LINK'=>$url
|
||||
)
|
||||
$tpl_var['month_view'] =
|
||||
array(
|
||||
'CELL_WIDTH' => $cell_width,
|
||||
'CELL_HEIGHT' => $cell_height,
|
||||
'wday_labels' => $wday_labels,
|
||||
'weeks' => $tpl_weeks,
|
||||
);
|
||||
$template->assign_block_vars(
|
||||
'thumbnails.line.thumbnail.category_name',
|
||||
array(
|
||||
'NAME' => $name
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
@@ -233,12 +233,11 @@ if (count($categories) > 0)
|
||||
|
||||
$icon_ts = get_icon($category['max_date_last'], $category['is_child_date_last']);
|
||||
|
||||
$template->assign_block_vars(
|
||||
'categories.category',
|
||||
$tpl_var =
|
||||
array(
|
||||
'SRC' => $thumbnail_src_of[$category['representative_picture_id']],
|
||||
'ID' => $category['id'],
|
||||
'TN_SRC' => $thumbnail_src_of[$category['representative_picture_id']],
|
||||
'ALT' => $category['name'],
|
||||
'TITLE' => l10n('hint_category'),
|
||||
'ICON' => $icon_ts,
|
||||
|
||||
'URL' => make_index_url(
|
||||
@@ -260,8 +259,7 @@ if (count($categories) > 0)
|
||||
@$category['comment'],
|
||||
'subcatify_category_description')),
|
||||
'NAME' => $name,
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
if ($conf['display_fromto'])
|
||||
{
|
||||
@@ -286,16 +284,13 @@ if (count($categories) > 0)
|
||||
format_date($to)
|
||||
);
|
||||
}
|
||||
|
||||
$template->assign_block_vars(
|
||||
'categories.category.dates',
|
||||
array(
|
||||
'INFO' => $info,
|
||||
)
|
||||
);
|
||||
$tpl_var['INFO_DATES'] = $info;
|
||||
}
|
||||
}
|
||||
}
|
||||
}//fromto
|
||||
|
||||
$template->append( 'category_thumbnails', $tpl_var);
|
||||
|
||||
|
||||
//plugins need to add/modify sth in this loop ?
|
||||
trigger_action('loc_index_category_thumbnail',
|
||||
|
||||
@@ -200,6 +200,9 @@ WHERE id IN (' . implode(',',$page['items']) .')';
|
||||
$page['items'] = array();
|
||||
$must_show_list = false;
|
||||
}
|
||||
|
||||
$page['comment'] = '';
|
||||
$template->assign('FILE_CHRONOLOGY_VIEW', 'month_calendar.tpl');
|
||||
|
||||
foreach ($styles as $style => $style_data)
|
||||
{
|
||||
@@ -207,7 +210,7 @@ WHERE id IN (' . implode(',',$page['items']) .')';
|
||||
{
|
||||
if ( $style_data['view_calendar'] or $view != CAL_VIEW_CALENDAR)
|
||||
{
|
||||
$selected = '';
|
||||
$selected = false;
|
||||
|
||||
if ($style!=$cal_style)
|
||||
{
|
||||
@@ -231,11 +234,11 @@ WHERE id IN (' . implode(',',$page['items']) .')';
|
||||
|
||||
if ($style==$cal_style and $view==$page['chronology_view'] )
|
||||
{
|
||||
$selected = 'SELECTED';
|
||||
$selected = true;
|
||||
}
|
||||
|
||||
$template->assign_block_vars(
|
||||
'calendar.views.view',
|
||||
$template->append(
|
||||
'chronology_views',
|
||||
array(
|
||||
'VALUE' => $url,
|
||||
'CONTENT' => l10n('chronology_'.$style.'_'.$view),
|
||||
@@ -251,7 +254,7 @@ WHERE id IN (' . implode(',',$page['items']) .')';
|
||||
$calendar_title = '<a href="'.$url.'">'
|
||||
.$fields[$page['chronology_field']]['label'].'</a>';
|
||||
$calendar_title.= $calendar->get_display_name();
|
||||
$template->merge_block_vars('calendar',
|
||||
$template->assign('chronology',
|
||||
array(
|
||||
'TITLE' => $calendar_title
|
||||
)
|
||||
|
||||
+66
-96
@@ -2,7 +2,7 @@
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | PhpWebGallery - a PHP based picture gallery |
|
||||
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | file : $Id$
|
||||
// | last update : $Date$
|
||||
@@ -36,18 +36,12 @@ $template->set_filenames(
|
||||
|
||||
trigger_action('loc_begin_menubar');
|
||||
|
||||
$template->assign_vars(
|
||||
$template->assign(
|
||||
array(
|
||||
'NB_PICTURE' => $user['nb_total_images'],
|
||||
'USERNAME' => $user['username'],
|
||||
'MENU_CATEGORIES_CONTENT' => get_categories_menu(),
|
||||
'F_IDENTIFY' => get_root_url().'identification.php',
|
||||
'U_CATEGORIES' => make_index_url(array('section' => 'categories')),
|
||||
'U_REGISTER' => get_root_url().'register.php',
|
||||
'U_LOST_PASSWORD' => get_root_url().'password.php',
|
||||
'U_LOGOUT' => get_root_url().'?act=logout',
|
||||
'U_ADMIN'=> get_root_url().'admin.php',
|
||||
'U_PROFILE'=> get_root_url().'profile.php',
|
||||
)
|
||||
);
|
||||
|
||||
@@ -59,30 +53,27 @@ foreach ($conf['links'] as $url => $url_data)
|
||||
$url_data = array('label' => $url_data);
|
||||
}
|
||||
|
||||
if
|
||||
if
|
||||
(
|
||||
(!isset($url_data['eval_visible']))
|
||||
or
|
||||
(eval($url_data['eval_visible']))
|
||||
)
|
||||
{
|
||||
$template->assign_block_vars(
|
||||
'links.link',
|
||||
array(
|
||||
$tpl_var = array(
|
||||
'URL' => $url,
|
||||
'LABEL' => $url_data['label']
|
||||
)
|
||||
);
|
||||
|
||||
if (!isset($url_data['new_window']) or $url_data['new_window'])
|
||||
{
|
||||
$template->assign_block_vars(
|
||||
'links.link.new_window',
|
||||
$tpl_var['new_window'] =
|
||||
array(
|
||||
'name' => (isset($url_data['nw_name']) ? $url_data['nw_name'] : ''),
|
||||
'features' => (isset($url_data['nw_features']) ? $url_data['nw_features'] : '')
|
||||
)
|
||||
'NAME' => (isset($url_data['nw_name']) ? $url_data['nw_name'] : ''),
|
||||
'FEATURES' => (isset($url_data['nw_features']) ? $url_data['nw_features'] : '')
|
||||
);
|
||||
}
|
||||
$template->append('links', $tpl_var);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,26 +82,22 @@ if (!empty($conf['filter_pages']) and get_filter_page_value('used'))
|
||||
{
|
||||
if ($filter['enabled'])
|
||||
{
|
||||
$template->assign_block_vars(
|
||||
'stop_filter',
|
||||
array(
|
||||
'URL' => add_url_params(make_index_url(array()), array('filter' => 'stop'))
|
||||
)
|
||||
$template->assign(
|
||||
'U_STOP_FILTER',
|
||||
add_url_params(make_index_url(array()), array('filter' => 'stop'))
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_block_vars(
|
||||
'start_filter',
|
||||
array(
|
||||
'URL' => add_url_params(make_index_url(array()), array('filter' => 'start-recent-'.$user['recent_period']))
|
||||
)
|
||||
$template->assign(
|
||||
'U_START_FILTER',
|
||||
add_url_params(make_index_url(array()), array('filter' => 'start-recent-'.$user['recent_period']))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------ tags
|
||||
if ('tags' == $page['section'])
|
||||
if ('tags' == @$page['section'])
|
||||
{
|
||||
// display tags associated to currently tagged items, less current tags
|
||||
$tags = array();
|
||||
@@ -124,10 +111,10 @@ if ('tags' == $page['section'])
|
||||
|
||||
foreach ($tags as $tag)
|
||||
{
|
||||
$template->assign_block_vars(
|
||||
'tags.tag',
|
||||
$template->append(
|
||||
'related_tags',
|
||||
array(
|
||||
'URL' => make_index_url(
|
||||
'U_TAG' => make_index_url(
|
||||
array(
|
||||
'tags' => array($tag)
|
||||
)
|
||||
@@ -135,40 +122,30 @@ if ('tags' == $page['section'])
|
||||
|
||||
'NAME' => $tag['name'],
|
||||
|
||||
'TITLE' => l10n('See pictures linked to this tag only'),
|
||||
'CLASS' => 'tagLevel'.$tag['level'],
|
||||
|
||||
'CLASS' => 'tagLevel'.$tag['level']
|
||||
)
|
||||
);
|
||||
'add' => array(
|
||||
|
||||
$template->assign_block_vars(
|
||||
'tags.tag.add',
|
||||
array(
|
||||
'URL' => make_index_url(
|
||||
array(
|
||||
'tags' => array_merge(
|
||||
$page['tags'],
|
||||
array($tag)
|
||||
)
|
||||
'URL' => make_index_url(
|
||||
array(
|
||||
'tags' => array_merge(
|
||||
$page['tags'],
|
||||
array($tag)
|
||||
)
|
||||
)
|
||||
),
|
||||
'COUNTER' => $tag['counter'],
|
||||
)
|
||||
),
|
||||
'TITLE' => l10n_dec(
|
||||
'%d picture are also linked to current tags',
|
||||
'%d pictures are also linked to current tags',
|
||||
$tag['counter']),
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------- special categories
|
||||
// favorites categories
|
||||
if ( !is_a_guest() )
|
||||
{
|
||||
$template->assign_block_vars('username', array());
|
||||
|
||||
$template->assign_block_vars(
|
||||
'special_cat',
|
||||
$template->append(
|
||||
'special_categories',
|
||||
array(
|
||||
'URL' => make_index_url(array('section' => 'favorites')),
|
||||
'TITLE' => l10n('favorite_cat_hint'),
|
||||
@@ -176,8 +153,8 @@ if ( !is_a_guest() )
|
||||
));
|
||||
}
|
||||
// most visited
|
||||
$template->assign_block_vars(
|
||||
'special_cat',
|
||||
$template->append(
|
||||
'special_categories',
|
||||
array(
|
||||
'URL' => make_index_url(array('section' => 'most_visited')),
|
||||
'TITLE' => l10n('most_visited_cat_hint'),
|
||||
@@ -186,8 +163,8 @@ $template->assign_block_vars(
|
||||
// best rated
|
||||
if ($conf['rate'])
|
||||
{
|
||||
$template->assign_block_vars(
|
||||
'special_cat',
|
||||
$template->append(
|
||||
'special_categories',
|
||||
array(
|
||||
'URL' => make_index_url(array('section' => 'best_rated')),
|
||||
'TITLE' => l10n('best_rated_cat_hint'),
|
||||
@@ -196,8 +173,8 @@ if ($conf['rate'])
|
||||
);
|
||||
}
|
||||
// random
|
||||
$template->assign_block_vars(
|
||||
'special_cat',
|
||||
$template->append(
|
||||
'special_categories',
|
||||
array(
|
||||
'URL' => get_root_url().'random.php',
|
||||
'TITLE' => l10n('random_cat_hint'),
|
||||
@@ -206,16 +183,16 @@ $template->assign_block_vars(
|
||||
));
|
||||
|
||||
// recent pics
|
||||
$template->assign_block_vars(
|
||||
'special_cat',
|
||||
$template->append(
|
||||
'special_categories',
|
||||
array(
|
||||
'URL' => make_index_url(array('section' => 'recent_pics')),
|
||||
'TITLE' => l10n('recent_pics_cat_hint'),
|
||||
'NAME' => l10n('recent_pics_cat'),
|
||||
));
|
||||
// recent cats
|
||||
$template->assign_block_vars(
|
||||
'special_cat',
|
||||
$template->append(
|
||||
'special_categories',
|
||||
array(
|
||||
'URL' => make_index_url(array('section' => 'recent_cats')),
|
||||
'TITLE' => l10n('recent_cats_cat_hint'),
|
||||
@@ -223,8 +200,8 @@ $template->assign_block_vars(
|
||||
));
|
||||
|
||||
// calendar
|
||||
$template->assign_block_vars(
|
||||
'special_cat',
|
||||
$template->append(
|
||||
'special_categories',
|
||||
array(
|
||||
'URL' =>
|
||||
make_index_url(
|
||||
@@ -244,44 +221,43 @@ $template->assign_block_vars(
|
||||
|
||||
if (is_a_guest())
|
||||
{
|
||||
$template->assign_block_vars('login', array());
|
||||
$template->assign(
|
||||
array(
|
||||
'U_IDENTIFY' => get_root_url().'identification.php',
|
||||
'AUTHORIZE_REMEMBERING' => $conf['authorize_remembering']
|
||||
)
|
||||
);
|
||||
|
||||
$template->assign_block_vars('quickconnect', array());
|
||||
if ($conf['authorize_remembering'])
|
||||
{
|
||||
$template->assign_block_vars('quickconnect.remember_me', array());
|
||||
}
|
||||
if ($conf['allow_user_registration'])
|
||||
{
|
||||
$template->assign_block_vars('register', array());
|
||||
$template->assign_block_vars('quickconnect.register', array());
|
||||
$template->assign( 'U_REGISTER', get_root_url().'register.php');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_block_vars('hello', array());
|
||||
$template->assign('USERNAME', $user['username']);
|
||||
|
||||
if (is_autorize_status(ACCESS_CLASSIC))
|
||||
{
|
||||
$template->assign_block_vars('profile', array());
|
||||
$template->assign('U_PROFILE', get_root_url().'profile.php');
|
||||
}
|
||||
|
||||
// the logout link has no meaning with Apache authentication : it is not
|
||||
// possible to logout with this kind of authentication.
|
||||
if (!$conf['apache_authentication'])
|
||||
{
|
||||
$template->assign_block_vars('logout', array());
|
||||
$template->assign('U_LOGOUT', get_root_url().'?act=logout');
|
||||
}
|
||||
|
||||
if (is_admin())
|
||||
{
|
||||
$template->assign_block_vars('admin', array());
|
||||
$template->assign('U_ADMIN', get_root_url().'admin.php');
|
||||
}
|
||||
}
|
||||
|
||||
// tags link
|
||||
$template->assign_block_vars(
|
||||
'summary',
|
||||
$template->append(
|
||||
'summaries',
|
||||
array(
|
||||
'TITLE' => l10n('See available tags'),
|
||||
'NAME' => l10n('Tags'),
|
||||
@@ -290,8 +266,8 @@ $template->assign_block_vars(
|
||||
);
|
||||
|
||||
// search link
|
||||
$template->assign_block_vars(
|
||||
'summary',
|
||||
$template->append(
|
||||
'summaries',
|
||||
array(
|
||||
'TITLE'=>l10n('hint_search'),
|
||||
'NAME'=>l10n('search'),
|
||||
@@ -299,11 +275,10 @@ $template->assign_block_vars(
|
||||
'REL'=> 'rel="search"'
|
||||
)
|
||||
);
|
||||
$template->assign_block_vars( 'summary.quick_search', array() );
|
||||
|
||||
// comments link
|
||||
$template->assign_block_vars(
|
||||
'summary',
|
||||
$template->append(
|
||||
'summaries',
|
||||
array(
|
||||
'TITLE'=>l10n('hint_comments'),
|
||||
'NAME'=>l10n('comments'),
|
||||
@@ -312,8 +287,8 @@ $template->assign_block_vars(
|
||||
);
|
||||
|
||||
// about link
|
||||
$template->assign_block_vars(
|
||||
'summary',
|
||||
$template->append(
|
||||
'summaries',
|
||||
array(
|
||||
'TITLE' => l10n('about_page_title'),
|
||||
'NAME' => l10n('About'),
|
||||
@@ -322,8 +297,8 @@ $template->assign_block_vars(
|
||||
);
|
||||
|
||||
// notification
|
||||
$template->assign_block_vars(
|
||||
'summary',
|
||||
$template->append(
|
||||
'summaries',
|
||||
array(
|
||||
'TITLE'=>l10n('RSS feed'),
|
||||
'NAME'=>l10n('Notification'),
|
||||
@@ -335,12 +310,7 @@ $template->assign_block_vars(
|
||||
if (isset($page['category']) and $page['category']['uploadable'] )
|
||||
{ // upload a picture in the category
|
||||
$url = get_root_url().'upload.php?cat='.$page['category']['id'];
|
||||
$template->assign_block_vars(
|
||||
'upload',
|
||||
array(
|
||||
'U_UPLOAD'=> $url
|
||||
)
|
||||
);
|
||||
$template->assign('U_UPLOAD', $url);
|
||||
}
|
||||
|
||||
trigger_action('loc_end_menubar');
|
||||
|
||||
+10
-9
@@ -44,15 +44,20 @@ if (!is_a_guest())
|
||||
|
||||
//------------------------------------------------------------- generation time
|
||||
$debug_vars = array();
|
||||
|
||||
if ($conf['show_queries'])
|
||||
{
|
||||
$debug_vars = array_merge($debug_vars, array('QUERIES_LIST' => $debug) );
|
||||
}
|
||||
|
||||
if ($conf['show_gt'])
|
||||
{
|
||||
$time = get_elapsed_time($t2, get_moment());
|
||||
|
||||
if (!isset($page['count_queries']))
|
||||
{
|
||||
$page['count_queries'] = 0;
|
||||
$page['queries_time'] = 0;
|
||||
}
|
||||
$time = get_elapsed_time($t2, get_moment());
|
||||
|
||||
$debug_vars = array_merge($debug_vars,
|
||||
array('TIME' => $time,
|
||||
@@ -61,16 +66,12 @@ if ($conf['show_gt'])
|
||||
);
|
||||
}
|
||||
|
||||
if ($conf['show_queries'])
|
||||
{
|
||||
$debug_vars = array_merge($debug_vars, array('QUERIES_LIST' => $debug) );
|
||||
}
|
||||
|
||||
$template->assign('debug', $debug_vars );
|
||||
|
||||
trigger_action('loc_end_page_tail');
|
||||
//
|
||||
// Generate the page
|
||||
//
|
||||
$template->pparse('tail');
|
||||
?>
|
||||
$template->parse('tail');
|
||||
$template->p();
|
||||
?>
|
||||
@@ -1057,7 +1057,7 @@ class Smarty
|
||||
} else {
|
||||
// var non-existant, return valid reference
|
||||
$_tmp = null;
|
||||
return $_tmp;
|
||||
return $_tmp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1116,7 +1116,7 @@ class Smarty
|
||||
function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
|
||||
{
|
||||
static $_cache_info = array();
|
||||
|
||||
|
||||
$_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting)
|
||||
? $this->error_reporting : error_reporting() & ~E_NOTICE);
|
||||
|
||||
@@ -1292,11 +1292,19 @@ class Smarty
|
||||
|
||||
if ($display) {
|
||||
if (isset($_smarty_results)) { echo $_smarty_results; }
|
||||
}
|
||||
|
||||
if ($this->debugging) {
|
||||
// capture time for debugging info
|
||||
$_params = array();
|
||||
require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
|
||||
$this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = (smarty_core_get_microtime($_params, $this) - $_debug_start_time);
|
||||
}
|
||||
|
||||
if ($display) {
|
||||
if ($this->debugging) {
|
||||
// capture time for debugging info
|
||||
$_params = array();
|
||||
require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
|
||||
$this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = (smarty_core_get_microtime($_params, $this) - $_debug_start_time);
|
||||
require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');
|
||||
echo smarty_core_display_debug_console($_params, $this);
|
||||
}
|
||||
@@ -1932,10 +1940,10 @@ class Smarty
|
||||
{
|
||||
return eval($code);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extracts the filter name from the given callback
|
||||
*
|
||||
*
|
||||
* @param callback $function
|
||||
* @return string
|
||||
*/
|
||||
@@ -1950,7 +1958,7 @@ class Smarty
|
||||
return $function;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**#@-*/
|
||||
|
||||
}
|
||||
|
||||
+40
-26
@@ -222,21 +222,6 @@ class Template {
|
||||
* is true.
|
||||
*/
|
||||
function parse($handle, $return=false)
|
||||
{
|
||||
return $this->_pparse_or_parse($handle, $return, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the file for the handle, eventually compile the file and run the compiled
|
||||
* code. This will print out the results of executing the template.
|
||||
*/
|
||||
function pparse($handle)
|
||||
{
|
||||
$this->_pparse_or_parse($handle, false, true);
|
||||
}
|
||||
|
||||
|
||||
/*private*/ function _pparse_or_parse($handle, $return, $immediate_display)
|
||||
{
|
||||
if ( !isset($this->files[$handle]) )
|
||||
{
|
||||
@@ -253,31 +238,54 @@ class Template {
|
||||
|
||||
if ($is_new)
|
||||
{
|
||||
$this->smarty->assign( 'pwg_root', get_root_url() ); //deprecated
|
||||
$this->smarty->assign( 'ROOT_URL', get_root_url() );
|
||||
if ($immediate_display)
|
||||
$this->p();
|
||||
$v = $this->smarty->fetch($this->files[$handle], null, null, $immediate_display ? true : false);
|
||||
if ($immediate_display)
|
||||
return;
|
||||
$v = $this->smarty->fetch($this->files[$handle], null, null, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_old->set_filename( $handle, $this->files[$handle] );
|
||||
$v = $this->_old->parse($handle, true);
|
||||
}
|
||||
if ($return==false)
|
||||
if ($return)
|
||||
{
|
||||
$this->output .= $v;
|
||||
return $v;
|
||||
}
|
||||
return $v;
|
||||
$this->output .= $v;
|
||||
}
|
||||
|
||||
/** flushes current output */
|
||||
function p()
|
||||
/**
|
||||
* Load the file for the handle, eventually compile the file and run the compiled
|
||||
* code. This will print out the results of executing the template.
|
||||
*/
|
||||
function pparse($handle)
|
||||
{
|
||||
$this->parse($handle, false);
|
||||
echo $this->output;
|
||||
$this->output='';
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** flushes the output */
|
||||
function p()
|
||||
{
|
||||
$start = get_moment();
|
||||
|
||||
echo $this->output;
|
||||
$this->output='';
|
||||
|
||||
if ($this->smarty->debugging)
|
||||
{
|
||||
global $t2;
|
||||
$this->smarty->assign(
|
||||
array(
|
||||
'AAAA_DEBUG_OUTPUT_TIME__' => get_elapsed_time($start, get_moment()),
|
||||
'AAAA_DEBUG_TOTAL_TIME__' => get_elapsed_time($t2, get_moment())
|
||||
)
|
||||
);
|
||||
require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');
|
||||
echo smarty_core_display_debug_console(null, $this->smarty);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -315,6 +323,12 @@ class Template {
|
||||
$this->smarty->append( $tpl_var, $value, $merge );
|
||||
}
|
||||
|
||||
/** see smarty get_template_vars http://www.smarty.net/manual/en/api.get_template_vars.php */
|
||||
function &get_template_vars($name=null)
|
||||
{
|
||||
return $this->smarty->get_template_vars( $name );
|
||||
}
|
||||
|
||||
/** see smarty append http://www.smarty.net/manual/en/api.clear_assign.php */
|
||||
function clear_assign($tpl_var)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user