calendar improvements: week on weekly list starts on Monday,

ability to show grayed months/weeks/days (without any picture in it),
added icons for created/posted fields
language uniformization

calendar fixes: correct number of pictures in calendar view,
code simplification (I hope so)

git-svn-id: http://piwigo.org/svn/trunk@1059 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rvelices 2006-02-28 04:28:06 +00:00
parent 4cd5b05d40
commit 97898b3685
19 changed files with 476 additions and 342 deletions

View file

@ -114,7 +114,7 @@ while ($row = mysql_fetch_array($result))
}
$query = 'SELECT COUNT(DISTINCT(i.id))
$query = 'SELECT COUNT(DISTINCT(i.id))
FROM '.RATE_TABLE.' AS r, '.IMAGES_TABLE.' AS i
WHERE r.element_id=i.id'. $display_filter .
';';
@ -146,13 +146,13 @@ $template->assign_vars(
$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('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'),
array(l10n('Post date'), 'date_available DESC'),
);
@ -168,9 +168,9 @@ for ($i=0; $i<count($available_order_by); $i++)
);
}
$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
$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 . '
@ -195,7 +195,7 @@ foreach ($images as $image)
$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'] . '
@ -203,7 +203,7 @@ ORDER BY date DESC;';
$result = pwg_query($query);
$nb_rates = mysql_num_rows($result);
$template->assign_block_vars('image',
$template->assign_block_vars('image',
array(
'U_THUMB' => $thumbnail_src,
'U_URL' => $image_url,
@ -222,11 +222,11 @@ ORDER BY date DESC;';
$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']]) )
@ -241,8 +241,8 @@ ORDER BY date DESC;';
{
$user .= '('.$row['anonymous_id'].')';
}
$template->assign_block_vars('image.rate',
$template->assign_block_vars('image.rate',
array(
'DATE' => format_date($row['date']),
'RATE' => $row['rate'],

View file

@ -41,15 +41,15 @@ if ( isset( $_GET['act'] )
$url = 'category.php';
redirect( $url );
}
//---------------------------------------------- change of image display order
//---------------------------------------------- change of image display order
if (isset($_GET['image_order']))
{
setcookie(
'pwg_image_order',
'pwg_image_order',
$_GET['image_order'] > 0 ? $_GET['image_order'] : '',
0
);
redirect(
PHPWG_ROOT_PATH
.'category.php'
@ -109,7 +109,7 @@ if ( isset($page['cat_nb_images'])
{
$nav_url = preg_replace('/&amp;$/', '', $nav_url);
}
$page['navigation_bar'] = create_navigation_bar(
$nav_url,
$page['cat_nb_images'],
@ -163,16 +163,45 @@ if ( ! isset($_GET['calendar']) )
{
$calendar_view_link .= (empty($_GET)? '?':'&' ) . 'calendar=';
$template->assign_block_vars(
'calendar_view',
array( 'URL' => $calendar_view_link )
'mode_created',
array( 'URL' => $calendar_view_link.'created' )
);
$template->assign_block_vars(
'mode_posted',
array( 'URL' => $calendar_view_link.'posted' )
);
}
else
{
$template->assign_block_vars(
'normal_view',
'mode_normal',
array( 'URL' => $calendar_view_link )
);
if (get_query_string_diff( array('start','calendar') )=='')
{
$calendar_view_link .= '?';
}
else
{
$calendar_view_link .= '&';
}
$calendar_view_link .= 'calendar=';
if ( strpos($_GET['calendar'], 'posted') === false)
{
$template->assign_block_vars(
'mode_posted',
array( 'URL' => $calendar_view_link.'posted' )
);
}
else
{
$template->assign_block_vars(
'mode_created',
array( 'URL' => $calendar_view_link.'created' )
);
}
}
$template->assign_vars(
@ -202,7 +231,7 @@ $template->assign_vars(
'L_PROFILE' => $lang['customize'],
'L_PROFILE_HINT' => $lang['hint_customize'],
'L_REMEMBER_ME' => $lang['remember_me'],
'F_IDENTIFY' => PHPWG_ROOT_PATH.'identification.php',
'T_RECENT' => $icon_recent,
@ -298,10 +327,19 @@ $template->assign_block_vars(
'NAME' => $lang['recent_cats_cat']
));
// calendar
if ( $conf['calendar_datefield'] == 'date_available' )
{
$calendar_link = 'posted';
}
else
{
$calendar_link = 'created';
}
$calendar_link .= '-monthly-c';
$template->assign_block_vars(
'special_cat',
array(
'URL' => PHPWG_ROOT_PATH.'category.php?calendar=monthly-c',
'URL' => PHPWG_ROOT_PATH.'category.php?calendar='.$calendar_link,
'TITLE' => $lang['calendar_hint'],
'NAME' => $lang['calendar']
));
@ -311,7 +349,7 @@ if ($user['is_the_guest'])
{
$template->assign_block_vars('register', array());
$template->assign_block_vars('login', array());
$template->assign_block_vars('quickconnect', array());
if ($conf['authorize_remembering'])
{
@ -355,7 +393,7 @@ $template->assign_block_vars('summary', array(
$template->assign_block_vars('summary', array(
'TITLE'=>$lang['about_page_title'],
'NAME'=>$lang['About'],
'U_SUMMARY'=> 'about.php?'.str_replace( '&', '&amp;', $_SERVER['QUERY_STRING'] )
'U_SUMMARY'=> 'about.php?'.str_replace( '&', '&amp;', $_SERVER['QUERY_STRING'] )
));
// notification
@ -395,23 +433,23 @@ if ( $page['navigation_bar'] != ''
}
// navigation bar
if ( $page['navigation_bar'] != '' )
{
{
$template->assign_block_vars(
'cat_infos.navigation',
array('NAV_BAR' => $page['navigation_bar'])
);
}
if ( ( isset($page['cat_nb_images']) and $page['cat_nb_images']>0 )
and
( !isset($page['cat'])
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') )
)
{
// image order
$template->assign_block_vars( 'preferred_image_order', array() );
$order_idx = isset($_COOKIE['pwg_image_order']) ?
$order_idx = isset($_COOKIE['pwg_image_order']) ?
$_COOKIE['pwg_image_order'] : 0;
$orders = get_category_preferred_image_orders();

View file

@ -37,7 +37,8 @@ class CalendarBase
var $url_base;
// array of date components e.g. (2005,10,12) ...
var $date_components;
//
var $calendar_levels;
/**
* Initialize the calendar
@ -52,16 +53,45 @@ class CalendarBase
$this->date_components = $date_components;
}
function get_display_name()
{
global $conf;
$res = '';
$url = $this->url_base;
for ($i=0; $i<count($this->date_components); $i++)
{
$res .= $conf['level_separator'];
$url .= $this->date_components[$i].'-';
if ( isset($this->date_components[$i+1]) )
{
$res .=
'<a href="'.$url.'">'
.$this->get_date_component_label($i, $this->date_components[$i])
.'</a>';
}
else
{
$res .=
'<span class="calInHere">'
.$this->get_date_component_label($i, $this->date_components[$i])
.'</span>';
}
}
return $res;
}
//--------------------------------------------------------- private members ---
/**
* Returns a display name for a date component optionally using labels
*/
function get_date_component_label($date_component, $labels=null)
function get_date_component_label($level, $date_component)
{
$label = $date_component;
if (isset($labels[$date_component]))
if (isset($this->calendar_levels[$level]['labels'][$date_component]))
{
$label = $labels[$date_component];
$label = $this->calendar_levels[$level]['labels'][$date_component];
}
elseif ($date_component == 'any' )
{
@ -69,7 +99,7 @@ class CalendarBase
}
return $label;
}
/**
* Creates a calendar navigation bar.
*
@ -77,15 +107,31 @@ class CalendarBase
* @param array items - hash of items to put in the bar (e.g. 2005,2006)
* @param array selected_item - item currently selected (e.g. 2005)
* @param string class_prefix - html class attribute prefix for span elements
* @param bool allow_any - adds any to the end of the bar
* @param bool show_any - adds any link to the end of the bar
* @param bool show_empty - shows all labels even those without items
* @param array labels - optional labels for items (e.g. Jan,Feb,...)
* @return string the navigation bar
*/
function get_nav_bar_from_items($url_base, $items, $selected_item,
$class_prefix, $allow_any, $labels=null)
$class_prefix, $show_any,
$show_empty=false, $labels=null)
{
global $conf;
$nav_bar = '';
if ($conf['calendar_show_empty'] and $show_empty and !empty($labels) )
{
foreach ($labels as $item => $label)
{
if ( ! isset($items[$item]) )
{
$items[$item] = -1;
}
}
ksort($items);
}
foreach ($items as $item => $nb_images)
{
$label = $item;
@ -98,6 +144,11 @@ class CalendarBase
$nav_bar .= '<span class="'.$class_prefix.'Sel">';
$nav_bar .= $label;
}
elseif ($nb_images==-1)
{
$nav_bar .= '<span class="'.$class_prefix.'Empty">';
$nav_bar .= $label;
}
else
{
$nav_bar .= '<span class="'.$class_prefix.'">';
@ -112,8 +163,8 @@ class CalendarBase
}
$nav_bar.= '</span>';
}
global $conf;
if ($conf['calendar_show_any'] and $allow_any and count($items) > 1)
if ($conf['calendar_show_any'] and $show_any and count($items) > 1)
{
$label = l10n('calendar_any');
if (isset($selected_item) and 'any' == $selected_item)
@ -137,18 +188,15 @@ class CalendarBase
/**
* Creates a calendar navigation bar for a given level.
*
* @param string sql_func - YEAR/MONTH/DAY/WEEK/DAYOFWEEK ...
* @param string sql_offset - (e.g. +1 for WEEK - first in year is 1)
* @param array labels - optional labels to show in the navigation bar
* @param int level - the level (0-year,1-month/week,2-day)
* @return void
*/
function build_nav_bar($level, $sql_func,
$sql_offset='', $labels=null)
function build_nav_bar($level, $labels=null)
{
global $template;
global $template, $conf;
$query = '
SELECT DISTINCT('.$sql_func.'('.$this->date_field.')'.$sql_offset
SELECT DISTINCT('.$this->calendar_levels[$level]['sql']
.') as period';
$query.= $this->inner_sql;
$query.= $this->get_date_where($level);
@ -163,6 +211,24 @@ SELECT DISTINCT('.$sql_func.'('.$this->date_field.')'.$sql_offset
$level_items[$row['period']] = 0;
}
if ( count($level_items)==1 )
{
if ( ! isset($this->date_components[$level]) )
{
list($key) = array_keys($level_items);
$this->date_components[$level] = (int)$key;
}
}
if ( $conf['calendar_multi_bar']==false )
{
if ( $level<count($this->date_components) and
$level!=count($this->calendar_levels)-1 )
{
return;
}
}
$url_base = $this->url_base;
for ($i=0; $i<$level; $i++)
{
@ -180,9 +246,10 @@ SELECT DISTINCT('.$sql_func.'('.$this->date_field.')'.$sql_offset
$url_base,
$level_items,
$selected,
'cal',
'calItem',
true,
$labels
true,
isset($labels) ? $labels : $this->calendar_levels[$level]['labels']
);
$template->assign_block_vars(

View file

@ -36,6 +36,32 @@ define ('CDAY', 2);
class Calendar extends CalendarBase
{
/**
* Initialize the calendar
* @param string date_field db column on which this calendar works
* @param string inner_sql used for queries (INNER JOIN or normal)
* @param array date_components
*/
function initialize($date_field, $inner_sql, $date_components)
{
parent::initialize($date_field, $inner_sql, $date_components);
global $lang;
$this->calendar_levels = array(
array(
'sql'=> 'YEAR('.$this->date_field.')',
'labels' => null
),
array(
'sql'=> 'MONTH('.$this->date_field.')',
'labels' => $lang['month']
),
array(
'sql'=> 'DAYOFMONTH('.$this->date_field.')',
'labels' => null
),
);
}
/**
* Generate navigation bars for category page
* @return boolean false to indicate that thumbnails
@ -43,7 +69,7 @@ class Calendar extends CalendarBase
*/
function generate_category_content($url_base, $view_type)
{
global $lang, $conf;
global $conf;
$this->url_base = $url_base;
@ -59,8 +85,7 @@ function generate_category_content($url_base, $view_type)
{//case B: year given - display all days in given year
if ($this->build_year_calendar())
{
if ( $conf['calendar_multi_bar'] )
$this->build_nav_bar2(CYEAR, 'YEAR'); // years
$this->build_nav_bar(CYEAR); // years
return true;
}
}
@ -68,34 +93,30 @@ function generate_category_content($url_base, $view_type)
if ( count($this->date_components)==2 )
{//case C: year+month given - display a nice month calendar
$this->build_month_calendar();
if ( $conf['calendar_multi_bar'] )
{
$this->build_nav_bar2(CYEAR, 'YEAR'); // years
}
if (count($this->date_components)>=1 and
( $conf['calendar_multi_bar'] or count($this->date_components)==1 ) )
{
$this->build_nav_bar2(CMONTH, 'MONTH', $lang['month']); // month
}
$this->build_nav_bar(CYEAR); // years
$this->build_nav_bar(CMONTH); // month
return true;
}
}
if ($view_type==CAL_VIEW_LIST or count($this->date_components)==3)
{
if ( $conf['calendar_multi_bar'] or count($this->date_components)==0 )
if ( count($this->date_components)>=0 )
{
$this->build_nav_bar2(CYEAR, 'YEAR'); // years
$this->build_nav_bar(CYEAR); // years
}
if ( count($this->date_components)>=1 and
( $conf['calendar_multi_bar'] or count($this->date_components)==1 )
)
if ( count($this->date_components)>=1)
{
$this->build_nav_bar2(CMONTH, 'MONTH', $lang['month']); // month
$this->build_nav_bar(CMONTH); // month
}
if ( count($this->date_components)>=2 )
{
$this->build_nav_bar2(CDAY, 'DAYOFMONTH' ); // days
$this->build_nav_bar(
CDAY,
$this->get_all_days_in_month(
$this->date_components[CYEAR] ,$this->date_components[CMONTH]
)
); // days
}
}
return false;
@ -141,11 +162,11 @@ function get_date_where($max_levels=3)
$e .= '12-31';
if (isset($date[CMONTH]) and $date[CMONTH]!='any')
{
$res .= ' AND MONTH('.$this->date_field.')='.$date[CMONTH];
$res .= ' AND '.$this->calendar_levels[CMONTH]['sql'].'='.$date[CMONTH];
}
if (isset($date[2]) and $date[2]!='any')
if (isset($date[CDAY]) and $date[CDAY]!='any')
{
$res .= ' AND DAYOFMONTH('.$this->date_field.')='.$date[CDAY];
$res .= ' AND '.$this->calendar_levels[CDAY]['sql'].'='.$date[CDAY];
}
}
$res = " AND $this->date_field BETWEEN '$b' AND '$e 23:59:59'" . $res;
@ -155,74 +176,56 @@ function get_date_where($max_levels=3)
$res = ' AND '.$this->date_field.' IS NOT NULL';
if (isset($date[CMONTH]) and $date[CMONTH]!='any')
{
$res .= ' AND MONTH('.$this->date_field.')='.$date[CMONTH];
$res .= ' AND '.$this->calendar_levels[CMONTH]['sql'].'='.$date[CMONTH];
}
if (isset($date[CDAY]) and $date[CDAY]!='any')
{
$res .= ' AND DAYOFMONTH('.$this->date_field.')='.$date[CDAY];
$res .= ' AND '.$this->calendar_levels[CDAY]['sql'].'='.$date[CDAY];
}
}
return $res;
}
function get_display_name()
{
global $conf, $lang;
$res = '';
$url = $this->url_base;
if ( isset($this->date_components[CYEAR]) )
{
$res .= $conf['level_separator'];
$url .= $this->date_components[CYEAR].'-';
$res .=
'<a href="'.$url.'">'
.$this->get_date_component_label($this->date_components[CYEAR])
.'</a>';
}
if ( isset($this->date_components[CMONTH]) )
{
$res .= $conf['level_separator'];
$url .= $this->date_components[CMONTH].'-';
$res .=
'<a href="'.$url.'">'
.$this->get_date_component_label(
$this->date_components[CMONTH],
$lang['month']
)
.'</a>';
}
if ( isset($this->date_components[CDAY]) )
{
$res .= $conf['level_separator'];
$url .= $this->date_components[CDAY].'-';
$res .=
'<a href="'.$url.'">'
.$this->get_date_component_label($this->date_components[CDAY])
.'</a>';
}
return $res;
}
//--------------------------------------------------------- private members ---
function build_nav_bar2($level, $sql_func, $labels=null)
// returns an array with alll the days in a given month
function get_all_days_in_month($year, $month)
{
parent::build_nav_bar($level, $sql_func, '', $labels);
$md= array(1=>31,28,31,30,31,30,31,31,30,31,30,31);
if ( is_numeric($year) and $month==2)
{
$nb_days = $md[2];
if ( ($year%4==0) and ( ($year%100!=0) or ($year%400!=0) ) )
{
$nb_days++;
}
}
elseif ( is_numeric($month) )
{
$nb_days = $md[ $month ];
}
else
{
$nb_days = 31;
}
return range(1, $nb_days);
}
function build_global_calendar()
{
assert( count($this->date_components) == 0 );
$query='SELECT DISTINCT(DATE_FORMAT('.$this->date_field.',"%Y%m")) as period,
COUNT(id) as count';
COUNT( DISTINCT(id) ) as count';
$query.= $this->inner_sql;
$query.= $this->get_date_where();
$query.= '
GROUP BY period';
$result = pwg_query($query);
$items=array();
while ($row = mysql_fetch_array($result))
{
$y = substr($row['period'], 0, 4);
@ -252,8 +255,8 @@ function build_global_calendar()
$nav_bar .= '</span><br>';
$url_base .= '-';
$nav_bar .= $this->get_nav_bar_from_items( $url_base,
$year_data['children'], null, 'calCal', false, $lang['month'] );
$nav_bar .= $this->get_nav_bar_from_items( $url_base,
$year_data['children'], null, 'calCal', false, false, $lang['month'] );
$template->assign_block_vars( 'calendar.calbar',
array( 'BAR' => $nav_bar)
@ -266,13 +269,14 @@ function build_year_calendar()
{
assert( count($this->date_components) == 1 );
$query='SELECT DISTINCT(DATE_FORMAT('.$this->date_field.',"%m%d")) as period,
COUNT(id) as count';
COUNT( DISTINCT(id) ) as count';
$query.= $this->inner_sql;
$query.= $this->get_date_where();
$query.= '
GROUP BY period';
$result = pwg_query($query);
$items=array();
while ($row = mysql_fetch_array($result))
{
$m = (int)substr($row['period'], 0, 2);
@ -307,7 +311,7 @@ function build_year_calendar()
$nav_bar .= '</span><br>';
$url_base .= '-';
$nav_bar .= $this->get_nav_bar_from_items( $url_base,
$nav_bar .= $this->get_nav_bar_from_items( $url_base,
$month_data['children'], null, 'calCal', false );
$template->assign_block_vars( 'calendar.calbar',
@ -331,18 +335,11 @@ function build_month_calendar()
while ($row = mysql_fetch_array($result))
{
$d = $row['period'];
$items[$d] = $row['count'];
$items[$d] = array('nb_images'=>$row['count']);
}
global $lang, $template;
$template->assign_block_vars('thumbnails', array());
$template->assign_block_vars('thumbnails.line', array());
foreach ( $items as $day=>$nb_images)
foreach ( $items as $day=>$data)
{
$url_base = $this->url_base.
$this->date_components[CYEAR].'-'.
$this->date_components[CMONTH].'-'.$day;
$this->date_components[CDAY]=$day;
$query = '
SELECT file,tn_ext,path, DAYOFWEEK('.$this->date_field.')-1 as dw';
@ -354,16 +351,28 @@ SELECT file,tn_ext,path, DAYOFWEEK('.$this->date_field.')-1 as dw';
unset ( $this->date_components[CDAY] );
$row = mysql_fetch_array(pwg_query($query));
$items[$day]['tn_path'] = get_thumbnail_src($row['path'], @$row['tn_ext']);
$items[$day]['tn_file'] = $row['file'];
$items[$day]['tn_dw'] = $row['dw'];
}
$thumbnail_src = get_thumbnail_src($row['path'], @$row['tn_ext']);
$thumbnail_title = $lang['day'][$row['dw']] . ' ' . $day;
$name = $thumbnail_title .' ('.$nb_images.')';
global $lang, $template;
$template->assign_block_vars('thumbnails', array());
$template->assign_block_vars('thumbnails.line', array());
foreach ( $items as $day=>$data)
{
$url_base = $this->url_base.
$this->date_components[CYEAR].'-'.
$this->date_components[CMONTH].'-'.$day;
$thumbnail_title = $lang['day'][$data['tn_dw']] . ' ' . $day;
$name = $thumbnail_title .' ('.$data['nb_images'].')';
$template->assign_block_vars(
'thumbnails.line.thumbnail',
array(
'IMAGE'=>$thumbnail_src,
'IMAGE_ALT'=>$row['file'],
'IMAGE'=>$data['tn_path'],
'IMAGE_ALT'=>$data['tn_file'],
'IMAGE_TITLE'=>$thumbnail_title,
'U_IMG_LINK'=>$url_base
)
@ -375,6 +384,7 @@ SELECT file,tn_ext,path, DAYOFWEEK('.$this->date_field.')-1 as dw';
)
);
}
return true;
}

View file

@ -36,32 +36,58 @@ define ('CDAY', 2);
class Calendar extends CalendarBase
{
/**
* Initialize the calendar
* @param string date_field db column on which this calendar works
* @param string inner_sql used for queries (INNER JOIN or normal)
* @param array date_components
*/
function initialize($date_field, $inner_sql, $date_components)
{
parent::initialize($date_field, $inner_sql, $date_components);
global $lang;
$this->calendar_levels = array(
array(
'sql'=> 'YEAR('.$this->date_field.')',
'labels' => null
),
array(
'sql'=> 'WEEK('.$this->date_field.')+1',
'labels' => null
),
array(
'sql'=> 'DAYOFWEEK('.$this->date_field.')-1',
'labels' => $lang['day']
),
);
//Comment next lines for week starting on Sunday or if MySQL version<4.0.17
//WEEK(date,5) = "0-53 - Week 1=the first week with a Monday in this year"
$this->calendar_levels[CWEEK]['sql'] = 'WEEK('.$this->date_field.',5)+1';
$this->calendar_levels[CDAY]['sql'] = 'WEEKDAY('.$this->date_field.')';
array_push( $this->calendar_levels[CDAY]['labels'],
array_shift( $this->calendar_levels[CDAY]['labels'] ) );
}
/**
* Generate navigation bars for category page
* @return boolean false to indicate that thumbnails where not included here
*/
function generate_category_content($url_base, $view_type)
{
global $lang, $conf;
global $conf;
$this->url_base = $url_base;
assert($view_type==CAL_VIEW_LIST);
if ( $conf['calendar_multi_bar'] or count($this->date_components)==0 )
$this->build_nav_bar(CYEAR); // years
if ( count($this->date_components)>=1 )
{
$this->build_nav_bar(CYEAR, 'YEAR'); // years
}
if ( count($this->date_components)>=1 and
( $conf['calendar_multi_bar'] or count($this->date_components)==1 )
)
{
$this->build_nav_bar(CWEEK, 'WEEK', '+1' ); // month
$this->build_nav_bar(CWEEK); // week nav bar 1-53
}
if ( count($this->date_components)>=2 )
{
$this->build_nav_bar(CDAY, 'DAYOFWEEK', '-1',
$lang['day'] ); // days
$this->build_nav_bar(CDAY); // days nav bar Mon-Sun
}
return false;
}
@ -75,26 +101,25 @@ function generate_category_content($url_base, $view_type)
*/
function get_date_where($max_levels=3)
{
$date_components = $this->date_components;
while (count($date_components)>$max_levels)
$date = $this->date_components;
while (count($date)>$max_levels)
{
array_pop($date_components);
array_pop($date);
}
$res = '';
if (isset($date_components[CYEAR]) and $date_components[CYEAR]!='any')
if (isset($date[CYEAR]) and $date[CYEAR]!='any')
{
$y = $date_components[CYEAR];
$y = $date[CYEAR];
$res = " AND $this->date_field BETWEEN '$y-01-01' AND '$y-12-31 23:59:59'";
}
if (isset($date_components[CWEEK]) and $date_components[CWEEK]!='any')
if (isset($date[CWEEK]) and $date[CWEEK]!='any')
{
$res .= ' AND WEEK('.$this->date_field.')+1='.$date_components[CWEEK];
$res .= ' AND '.$this->calendar_levels[CWEEK]['sql'].'='.$date[CWEEK];
}
if (isset($date_components[CDAY]) and $date_components[CDAY]!='any')
if (isset($date[CDAY]) and $date[CDAY]!='any')
{
$res .= ' AND DAYOFWEEK('.$this->date_field.')-1='
.$date_components[CDAY];
$res .= ' AND '.$this->calendar_levels[CDAY]['sql'].'='.$date[CDAY];
}
if (empty($res))
{
@ -103,44 +128,6 @@ function get_date_where($max_levels=3)
return $res;
}
function get_display_name()
{
global $conf,$lang;
$res = '';
$url = $this->url_base;
if ( isset($this->date_components[CYEAR]) )
{
$res .= $conf['level_separator'];
$url .= $this->date_components[CYEAR].'-';
$res .=
'<a href="'.$url.'">'
.$this->get_date_component_label($this->date_components[CYEAR])
.'</a>';
}
if ( isset($this->date_components[CWEEK]) )
{
$res .= $conf['level_separator'];
$url .= $this->date_components[CWEEK].'-';
$res .=
'<a href="'.$url.'">'
.$this->get_date_component_label($this->date_components[CWEEK])
.'</a>';
}
if ( isset($this->date_components[CDAY]) )
{
$res .= $conf['level_separator'];
$url .= $this->date_components[CDAY].'-';
$res .=
'<a href="'.$url.'">'
.$this->get_date_component_label(
$this->date_components[CDAY],
$lang['day']
)
.'</a>';
}
return $res;
}
}
?>

View file

@ -90,7 +90,7 @@ $conf['anti-flood_time'] = 60;
// catgory
$conf['calendar_datefield'] = 'date_creation';
// calendar_multi_bar : the calendar shows a maximum number of
// calendar_multi_bar : the calendar shows a maximum number of
// year/month/week/day navigation bars
$conf['calendar_multi_bar'] = true;
@ -98,6 +98,10 @@ $conf['calendar_multi_bar'] = true;
// year/month/week/day navigation bars
$conf['calendar_show_any'] = true;
// calendar_show_empty : the calendar shows month/weeks/days even if there are
//no elements for these
$conf['calendar_show_empty'] = true;
// newcat_default_commentable : at creation, must a category be commentable
// or not ?
$conf['newcat_default_commentable'] = 'true';
@ -249,7 +253,7 @@ $conf['show_exif'] = true;
//
// for PHP version newer than 4.1.2 :
// $conf['show_exif_fields'] = array('CameraMake','CameraModel','DateTime');
//
//
$conf['show_exif_fields'] = array(
'Make',
'Model',
@ -270,11 +274,11 @@ $conf['use_exif_mapping'] = array(
// | sessions |
// +-----------------------------------------------------------------------+
// session_use_cookies: specifies to use cookie to store
// session_use_cookies: specifies to use cookie to store
// the session id on client side
$conf['session_use_cookies'] = true;
// session_use_only_cookies: specifies to only use cookie to store
// session_use_only_cookies: specifies to only use cookie to store
// the session id on client side
$conf['session_use_only_cookies'] = true;
@ -284,7 +288,7 @@ $conf['session_use_trans_sid'] = false;
// session_name: specifies the name of the session which is used as cookie name
$conf['session_name'] = 'pwg_id';
// session_save_handler: comment the line below
// session_save_handler: comment the line below
// to use file handler for sessions.
$conf['session_save_handler'] = 'db';

View file

@ -52,21 +52,21 @@ function initialize_calendar()
//------------------ initialize the condition on items to take into account ---
$inner_sql = ' FROM ' . IMAGES_TABLE;
if (!isset($page['cat']) or is_numeric($page['cat']))
{ // we will regenerate the items by including subcats elements
$page['cat_nb_images'] = 0;
$page['items'] = array();
$inner_sql .= '
INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id';
if (isset($page['cat']) and is_numeric($page['cat']))
{
$sub_ids = array_diff(
get_subcat_ids(array($page['cat'])),
explode(',', $user['forbidden_categories'])
);
if (empty($sub_ids))
{
return; // nothing to do
@ -101,16 +101,14 @@ WHERE id IN (' . implode(',',$page['items']) .')';
$fields = array(
// Created
'created' => array(
// TODO change next line when calendar_datefield disapears
'default_link' => ( $conf['calendar_datefield']=='date_creation' ? '' : 'created-' ),
'default_link' => 'created-',
'label' => l10n('Creation date'),
'db_field' => 'date_creation',
),
// Posted
'posted' => array(
// TODO change next line when calendar_datefield disapears
'default_link' => ( $conf['calendar_datefield']=='date_available' ? '' : 'posted-' ),
'label' => l10n('Availability date'),
'default_link' => 'posted-',
'label' => l10n('Post date'),
'db_field' => 'date_available',
),
);
@ -119,14 +117,12 @@ WHERE id IN (' . implode(',',$page['items']) .')';
// Monthly style
'monthly' => array(
'default_link' => '',
'label' => l10n('Monthly'),
'include' => 'calendar_monthly.class.php',
'view_calendar' => true,
),
// Weekly style
// Weekly style
'weekly' => array(
'default_link' => 'weekly-',
'label' => l10n('Weekly'),
'include' => 'calendar_weekly.class.php',
'view_calendar' => false,
),
@ -136,20 +132,18 @@ WHERE id IN (' . implode(',',$page['items']) .')';
// list view
CAL_VIEW_LIST => array(
'default_link' => '',
'label' => l10n('List')
),
// calendar view
CAL_VIEW_CALENDAR => array(
'default_link' => CAL_VIEW_CALENDAR.'-',
'label' => l10n('calendar')
),
);
$requested = explode('-', $_GET['calendar']);
// Retrieve calendar field
$cal_field = get_calendar_parameter($fields, $requested);
// Retrieve style
$cal_style = get_calendar_parameter($styles, $requested);
include(PHPWG_ROOT_PATH.'include/'. $styles[$cal_style]['include']);
@ -190,23 +184,27 @@ WHERE id IN (' . implode(',',$page['items']) .')';
array_pop($requested);
}
}
else
{
$requested[$i] = (int)$requested[$i];
}
}
if ($any_count == 3)
{
array_pop($requested);
}
$calendar->initialize($fields[$cal_field]['db_field'], $inner_sql, $requested);
//echo ('<pre>'. var_export($fields, true) . '</pre>');
$calendar->initialize($fields[$cal_field]['db_field'], $inner_sql, $requested);
//echo ('<pre>'. var_export($calendar, true) . '</pre>');
$url_base = get_query_string_diff(array('start', 'calendar'));
$url_base =
PHPWG_ROOT_PATH.'category.php'
.get_query_string_diff(array('start', 'calendar'))
.$url_base
.(empty($url_base) ? '?' : '&')
.'calendar='.$cal_field.'-'
;
$must_show_list = true; // true until calendar generates its own display
if (basename($_SERVER["PHP_SELF"]) == 'category.php')
{
@ -223,10 +221,10 @@ WHERE id IN (' . implode(',',$page['items']) .')';
$page['items'],
$page['cat_nb_images']
);
$must_show_list = false;
}
$template->assign_block_vars( 'calendar.views', array() );
foreach ($styles as $style => $style_data)
{
@ -255,7 +253,7 @@ WHERE id IN (' . implode(',',$page['items']) .')';
'calendar.views.view',
array(
'VALUE' => $url,
'CONTENT' => $style_data['label'].' ('.$view_data['label'].')',
'CONTENT' => l10n('calendar_'.$style.'_'.$view),
'SELECTED' => $selected,
)
);
@ -264,17 +262,17 @@ WHERE id IN (' . implode(',',$page['items']) .')';
}
} // end category calling
$calendar_title =
$calendar_title =
'<a href="'.$url_base.$cal_style.'-'.$cal_view.'">'
.$fields[$cal_field]['label'].'</a>';
$calendar_title.= $calendar->get_display_name();
$template->assign_block_vars(
'calendar',
array(
'TITLE' => $calendar_title,
'TITLE' => '<br/>'.$calendar_title,
)
);
if ($must_show_list)
{
$query = 'SELECT DISTINCT(id)';
@ -289,7 +287,7 @@ WHERE id IN (' . implode(',',$page['items']) .')';
{
$order_by = str_replace(
'ORDER BY ',
'ORDER BY '.$calendar->date_field.',', $conf['order_by']
'ORDER BY '.$calendar->date_field.' DESC,', $conf['order_by']
);
$query .= $order_by;
}

View file

@ -28,7 +28,7 @@
/**
* Provides functions to handle categories.
*
*
*
*/
/**
@ -67,9 +67,9 @@ function check_restrictions($category_id)
function get_categories_menu()
{
global $page,$user;
$infos = array('');
$query = '
SELECT name,id,date_last,nb_images,global_rank
FROM '.CATEGORIES_TABLE.'
@ -119,7 +119,7 @@ SELECT COUNT(DISTINCT(image_id)) as total
WHERE category_id NOT IN ('.$user['forbidden_categories'].')
;';
list($total) = mysql_fetch_array(pwg_query($query));
return $total;
}
@ -135,7 +135,7 @@ SELECT COUNT(DISTINCT(image_id)) as total
* - nb_images
* - id_uppercat
* - site_id
* -
* -
*
* @param int category id
* @return array
@ -145,7 +145,7 @@ function get_cat_info( $id )
$infos = array('nb_images','id_uppercat','comment','site_id'
,'dir','date_last','uploadable','status','visible'
,'representative_picture_id','uppercats','commentable');
$query = '
SELECT '.implode(',', $infos).'
FROM '.CATEGORIES_TABLE.'
@ -196,7 +196,7 @@ SELECT name,id
{
$cat['name'][$cat_id] = $names[$cat_id];
}
return $cat;
}
@ -274,11 +274,11 @@ function get_category_preferred_image_orders()
{
global $conf;
return array(
array('Default', '', true),
array(l10n('default_sort'), '', true),
array(l10n('Average rate'), 'average_rate DESC', $conf['rate']),
array(l10n('most_visited_cat'), 'hit DESC', true),
array(l10n('Creation date'), 'date_creation DESC', true),
array(l10n('Availability date'), 'date_available DESC', true),
array(l10n('Post date'), 'date_available DESC', true),
array(l10n('File name'), 'file ASC', true)
);
}
@ -310,7 +310,7 @@ function display_select_categories($categories,
(3 * substr_count($category['global_rank'], '.')));
$option.= '- '.$category['name'];
}
$template->assign_block_vars(
$blockname,
array('SELECTED'=>$selected,

View file

@ -43,7 +43,6 @@ $lang['%d waiting elements'] = '%d waiting elements';
$lang['About'] = 'About';
$lang['At least one listed rule must be satisfied.'] = 'At least one listed rule must be satisfied.';
$lang['Author'] = 'Author';
$lang['Availability date'] = 'Availability date';
$lang['Average rate'] = 'Average rate';
$lang['Categories'] = 'Categories';
$lang['Category'] = 'Category';
@ -75,9 +74,7 @@ $lang['Identification'] = 'Identification';
$lang['Keyword'] = 'Keyword';
$lang['Keywords'] = 'Keywords';
$lang['Links'] = 'Links';
$lang['List'] = 'List';
$lang['Mail address'] = 'Mail address';
$lang['Monthly'] = 'Monthly';
$lang['N/A'] = 'N/A';
$lang['New on %s'] = 'New on %s';
$lang['New password confirmation does not correspond'] = 'New password confirmation does not correspond';
@ -90,12 +87,13 @@ $lang['Original dimensions'] = 'Original dimensions';
$lang['Password forgotten'] = 'Password forgotten';
$lang['Password'] = 'Password';
$lang['PhpWebGallery Help'] = 'PhpWebGallery Help';
$lang['Post date'] = 'Post date';
$lang['Posted on'] = 'Posted on';
$lang['Profile'] = 'Profile';
$lang['Quick connect'] = 'Quick connect';
$lang['Rate'] = 'Rate';
$lang['RSS feed'] = 'RSS feed';
$lang['Register'] = 'Register';
$lang['Registered on'] = 'Registered on';
$lang['Registration'] = 'Registration';
$lang['Reset'] = 'Reset';
$lang['Retrieve password'] = 'Retrieve password';
@ -111,7 +109,6 @@ $lang['User comments'] = 'User comments';
$lang['Username'] = 'Username';
$lang['Visits'] = 'Visits';
$lang['Webmaster'] = 'Webmaster';
$lang['Weekly'] = 'Weekly';
$lang['about_page_title'] = 'About PhpWebGallery';
$lang['access_forbiden'] = 'You are not authorized to access the requested page';
$lang['add to caddie'] = 'add to caddie';
@ -124,17 +121,21 @@ $lang['already_rated'] = 'You\'ve already rated this item';
$lang['ascending'] = 'ascending';
$lang['author(s) : %s'] = 'author(s) : %s';
$lang['auto_expand'] = 'Expand all categories';
$lang['became available after %s (%s)'] = 'became available after %s (%s)';
$lang['became available before %s (%s)'] = 'became available before %s (%s)';
$lang['became available between %s (%s) and %s (%s)'] = 'became available between %s (%s) and %s (%s)';
$lang['became available on %s'] = 'became available on %s';
$lang['became available after %s (%s)'] = 'posted after %s (%s)';
$lang['became available before %s (%s)'] = 'posted before %s (%s)';
$lang['became available between %s (%s) and %s (%s)'] = 'posted between %s (%s) and %s (%s)';
$lang['became available on %s'] = 'posted on %s';
$lang['best_rated_cat'] = 'Best rated';
$lang['best_rated_cat_hint'] = 'displays best rated items';
$lang['caddie'] = 'caddie';
$lang['calendar'] = 'Calendar';
$lang['calendar_any'] = 'All';
$lang['calendar_hint'] = 'displays each day with pictures, month per month';
$lang['calendar_monthly_l'] = 'Monthly list';
$lang['calendar_monthly_c'] = 'Monthly calendar';
$lang['calendar_picture_hint'] = 'displays pictures added on ';
$lang['calendar_view'] = 'View';
$lang['calendar_weekly_l'] = 'Weekly list';
$lang['categories'] = 'Categories';
$lang['click_to_redirect'] = 'Click here if your browser does not automatically forward you';
$lang['comment date'] = 'comment date';
@ -163,6 +164,7 @@ $lang['day'][4] = 'Thursday';
$lang['day'][5] = 'Friday';
$lang['day'][6] = 'Saturday';
$lang['days'] = 'days';
$lang['default_sort'] = 'Default';
$lang['del_favorites_alt'] = 'Delete from favorites';
$lang['del_favorites_hint'] = 'Delete this picture from your favorites';
$lang['delete'] = 'Delete';
@ -208,6 +210,9 @@ $lang['maxheight'] = 'Maximum height of the pictures';
$lang['maxheight_error'] = 'Maximum height must be a number superior to 50';
$lang['maxwidth'] = 'Maximum width of the pictures';
$lang['maxwidth_error'] = 'Maximum width must be a number superior to 50';
$lang['mode_normal_hint'] = 'return to normal view mode';
$lang['mode_created_hint'] = 'displays a calendar by creation date';
$lang['mode_posted_hint'] = 'displays a calendar by date posted';
$lang['month'][10] = 'October';
$lang['month'][11] = 'November';
$lang['month'][12] = 'December';
@ -272,8 +277,6 @@ $lang['search_ascending'] = 'Ascending';
$lang['search_author'] = 'Search for Author';
$lang['search_categories'] = 'Search in Categories';
$lang['search_date'] = 'Search by Date';
$lang['search_date_available'] = 'Availability';
$lang['search_date_creation'] = 'Creation';
$lang['search_date_from'] = 'Date';
$lang['search_date_to'] = 'End-Date';
$lang['search_date_type'] = 'Kind of date';

View file

@ -42,7 +42,6 @@ $lang['%d new users'] = '%d nouveaux utilisateurs';
$lang['About'] = 'À propos';
$lang['At least one listed rule must be satisfied.'] = 'Au moins un des critères doit être satisfait.';
$lang['Author'] = 'Auteur';
$lang['Availability date'] = 'Date de disponibilité';
$lang['Average rate'] = 'Note moyenne';
$lang['Categories'] = 'Catégories';
$lang['Category'] = 'Catégorie';
@ -74,9 +73,7 @@ $lang['Identification'] = 'Identification';
$lang['Keyword'] = 'Mot-clef';
$lang['Keywords'] = 'Mots-clef';
$lang['Links'] = 'Liens';
$lang['List'] = 'Liste';
$lang['Mail address'] = $lang['Email address'];
$lang['Monthly'] = 'Mensuel';
$lang['N/A'] = 'non disponible';
$lang['New on %s'] = 'Nouveau le %s';
$lang['New password confirmation does not correspond'] = 'Erreur de confirmation de mot de passe';
@ -89,12 +86,13 @@ $lang['Original dimensions'] = 'Dimensions d\'origine';
$lang['Password forgotten'] = 'Mot de passe oublié';
$lang['Password'] = 'Mot de passe';
$lang['PhpWebGallery Help'] = 'Aide de PhpWebGallery';
$lang['Post date'] = 'Date d\'ajout';
$lang['Posted on'] = 'Ajoutée le';
$lang['Profile'] = 'Profil';
$lang['Quick connect'] = 'Connexion rapide';
$lang['Rate'] = 'Note';
$lang['RSS feed'] = 'flux RSS';
$lang['Register'] = 'S\'enregistrer';
$lang['Registered on'] = 'Enregistrée le';
$lang['Registration'] = 'Enregistrement';
$lang['Reset'] = 'Annuler';
$lang['Retrieve password'] = 'Récupérer un mot de passe';
@ -110,7 +108,6 @@ $lang['User comments'] = 'Commentaires utilisateur';
$lang['Username'] = 'Nom d\'utilisateur';
$lang['Visits'] = 'Visites';
$lang['Webmaster'] = 'Webmestre';
$lang['Weekly'] = 'Hebdomadaire';
$lang['about_page_title'] = 'À propos de PhpWebGallery';
$lang['access_forbiden'] = 'Vous n\'êtes pas autorisé sur la page demandée';
$lang['add to caddie'] = 'ajouter au panier';
@ -133,7 +130,11 @@ $lang['caddie'] = 'Panier';
$lang['calendar'] = 'Calendrier';
$lang['calendar_any'] = 'Tout';
$lang['calendar_hint'] = 'affichage année par année, mois par mois, jour par jour';
$lang['calendar_monthly_l'] = 'Liste mensuelle';
$lang['calendar_monthly_c'] = 'Calendrier mensuel';
$lang['calendar_picture_hint'] = 'affiche les images du ';
$lang['calendar_view'] = 'View';
$lang['calendar_weekly_l'] = 'Liste hebdomadaire';
$lang['categories'] = 'Catégories';
$lang['click_to_redirect'] = 'Cliquez ici si votre navigateur ne vous redirige pas.';
$lang['comment date'] = 'date du commentaire';
@ -162,6 +163,7 @@ $lang['day'][4] = 'Jeudi';
$lang['day'][5] = 'Vendredi';
$lang['day'][6] = 'Samedi';
$lang['days'] = 'jours';
$lang['default_sort'] = 'Par défaut';
$lang['del_favorites_alt'] = 'Supprimer des favoris';
$lang['del_favorites_hint'] = 'Supprimer cette image de vos favoris';
$lang['delete'] = 'Supprimer';
@ -207,6 +209,9 @@ $lang['maxheight'] = 'Hauteur maximum des images';
$lang['maxheight_error'] = 'La hauteur maximum des images doit être supérieure à 50';
$lang['maxwidth'] = 'Largeur maximum des images';
$lang['maxwidth_error'] = 'La largeur des images doit être supérieure à 50';
$lang['mode_normal_hint'] = 'retourne à la vue normale';
$lang['mode_created_hint'] = 'affiche un calendrier par date de création';
$lang['mode_posted_hint'] = 'affiche un calendrier par date d\'ajout';
$lang['month'][10] = 'Octobre';
$lang['month'][11] = 'Novembre';
$lang['month'][12] = 'Decembre';
@ -271,7 +276,6 @@ $lang['search_ascending'] = 'Croissant';
$lang['search_author'] = 'Rechercher un auteur';
$lang['search_categories'] = 'Rechercher dans les catégories';
$lang['search_date'] = 'Recherche par date';
$lang['search_date_available'] = 'Disponibilité';
$lang['search_date_creation'] = 'Création';
$lang['search_date_from'] = 'Date';
$lang['search_date_to'] = 'Date de fin';

View file

@ -173,7 +173,7 @@ SELECT element_id FROM '. RATE_TABLE . '
{
array_push( $already_there, $row['element_id'] );
}
if ( count($already_there)>0 )
{
$query = '
@ -183,7 +183,7 @@ DELETE FROM '. RATE_TABLE . '
AND element_id NOT IN (' . implode(',',$already_there) . ')';
pwg_query($query);
}
$query = '
UPDATE '. RATE_TABLE . '
SET anonymous_id=\'' . $anonymous_id . '\'
@ -191,13 +191,13 @@ UPDATE '. RATE_TABLE . '
AND anonymous_id=\'' . $_COOKIE['pwg_anonymous_rater'] . '\'';
pwg_query($query);
setcookie('pwg_anonymous_rater', $anonymous_id,
setcookie('pwg_anonymous_rater', $anonymous_id,
strtotime('+10 years'), cookie_path() );
}
}
else
{
setcookie('pwg_anonymous_rater', $anonymous_id,
setcookie('pwg_anonymous_rater', $anonymous_id,
strtotime('+10 years'), cookie_path() );
}
}
@ -292,7 +292,7 @@ while ($row = mysql_fetch_array($result))
{
$i = 'current';
}
foreach (array_keys($row) as $key)
{
if (!is_numeric($key))
@ -306,7 +306,7 @@ while ($row = mysql_fetch_array($result))
{
$picture[$i]['is_picture'] = true;
}
$cat_directory = dirname($row['path']);
$file_wo_ext = get_filename_wo_extension($row['file']);
@ -346,7 +346,7 @@ while ($row = mysql_fetch_array($result))
}
$picture[$i]['thumbnail'] = get_thumbnail_src($row['path'], @$row['tn_ext']);
if ( !empty( $row['name'] ) )
{
$picture[$i]['name'] = $row['name'];
@ -376,7 +376,7 @@ $url_up_start = floor( $page['current_rank'] / $user['nb_image_page'] );
$url_up_start *= $user['nb_image_page'];
if ($url_up_start>0)
{
$url_up .= '&amp;start='.$url_up_start;
$url_up .= '&amp;start='.$url_up_start;
}
if ( isset($page['cat']) )
@ -407,7 +407,7 @@ if ( isset( $_GET['add_fav'] ) )
$query.= ' AND image_id = '.$picture['current']['id'];
$query.= ';';
$result = pwg_query( $query );
if ( $_GET['add_fav'] == 1 )
{
$query = 'INSERT INTO '.FAVORITES_TABLE;
@ -460,7 +460,7 @@ if ( isset( $_POST['content'] ) && !empty($_POST['content']) )
$register_comment = false;
}
}
if ( $register_comment )
{
// anti-flood system
@ -479,7 +479,7 @@ if ( isset( $_POST['content'] ) && !empty($_POST['content']) )
$data{'date'} = $dbnow;
$data{'image_id'} = $_GET['image_id'];
$data{'content'} = htmlspecialchars( $_POST['content'], ENT_QUOTES);
if (!$conf['comments_validation'] or $user['status'] == 'admin')
{
$data{'validated'} = 'true';
@ -489,17 +489,17 @@ if ( isset( $_POST['content'] ) && !empty($_POST['content']) )
{
$data{'validated'} = 'false';
}
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
$fields = array('author', 'date', 'image_id', 'content', 'validated',
'validation_date');
mass_inserts(COMMENTS_TABLE, $fields, array($data));
// information message
$message = $lang['comment_added'];
if (!$conf['comments_validation'] or $user['status'] == 'admin')
if ( $conf['comments_validation'] and $user['status'] != 'admin' )
{
$message.= '<br />'.$lang['comment_to_validate'];
@ -540,9 +540,9 @@ if ( isset( $_GET['slideshow'] ) and isset($page['next_item']) )
}
$title_img = $picture['current']['name'];
if ( isset( $page['cat'] ) )
if ( isset( $page['cat'] ) )
{
if (is_numeric( $page['cat'] ))
if (is_numeric( $page['cat'] ))
{
$title_img = replace_space(get_cat_display_name($page['cat_name']));
}
@ -647,7 +647,7 @@ $template->assign_vars(array(
'L_PICTURE_HIGH' => $lang['picture_high'],
'L_UP_HINT' => $lang['home_hint'],
'L_UP_ALT' => $lang['home'],
'U_HOME' => (PHPWG_ROOT_PATH.'category.php'),
'U_UP' => $url_up,
'U_METADATA' => $url_metadata,
@ -686,7 +686,7 @@ if (isset($picture['current']['high']))
);
}
// button to set the current picture as representative
if ('admin' == $user['status'] and
if ('admin' == $user['status'] and
isset($page['cat']) and is_numeric($page['cat']))
{
$template->assign_block_vars(
@ -740,7 +740,7 @@ if ( !$user['is_the_guest'] )
$url = PHPWG_ROOT_PATH.'picture.php';
$url.= get_query_string_diff(array('add_fav'));
$url.= '&amp;add_fav=0';
$template->assign_block_vars(
'favorite',
array(
@ -804,7 +804,7 @@ else
// date of availability
$val = format_date($picture['current']['date_available'], 'mysql_datetime');
$infos['INFO_AVAILABILITY_DATE'] = '<a href="'.
$infos['INFO_POSTED_DATE'] = '<a href="'.
PHPWG_ROOT_PATH.'category.php?calendar=posted-c-'.
substr($picture['current']['date_available'],0,10).'">'.$val.'</a>';
@ -893,7 +893,7 @@ if ($metadata_showable and isset($_GET['show_metadata']))
{
die('Exif extension not available, admin should disable exif display');
}
if ($exif = @read_exif_data($picture['current']['src']))
{
$template->assign_block_vars(
@ -912,7 +912,7 @@ if ($metadata_showable and isset($_GET['show_metadata']))
{
$key = $lang['exif_field_'.$field];
}
$template->assign_block_vars(
'metadata.line',
array(
@ -932,7 +932,7 @@ if ($metadata_showable and isset($_GET['show_metadata']))
{
$key = $lang['exif_field_'.$tokens[1]];
}
$template->assign_block_vars(
'metadata.line',
array(
@ -957,7 +957,7 @@ if ($metadata_showable and isset($_GET['show_metadata']))
array('TITLE' => 'IPTC Metadata')
);
}
foreach ($iptc as $field => $value)
{
$key = $field;
@ -965,7 +965,7 @@ if ($metadata_showable and isset($_GET['show_metadata']))
{
$key = $lang[$field];
}
$template->assign_block_vars(
'metadata.line',
array(
@ -980,7 +980,7 @@ if ($metadata_showable and isset($_GET['show_metadata']))
if ( isset( $_GET['slideshow'] ) )
{
if ( !is_numeric( $_GET['slideshow'] ) ) $_GET['slideshow'] = $conf['slideshow_period'];
$template->assign_block_vars('stop_slideshow', array(
'U_SLIDESHOW'=>$picture['current']['url']
));
@ -1019,7 +1019,7 @@ SELECT COUNT(rate) AS count
FROM '.RATE_TABLE.'
WHERE element_id = '.$_GET['image_id'] . '
AND user_id = '.$user['id'] ;
if ($user['is_the_guest'])
{
$ip_components = explode('.', $_SERVER['REMOTE_ADDR']);
@ -1030,7 +1030,7 @@ SELECT COUNT(rate) AS count
$anonymous_id = implode ('.', $ip_components);
$query .= ' AND anonymous_id = \''.$anonymous_id . '\'';
}
$result = pwg_query($query);
if (mysql_num_rows($result) > 0)
{
@ -1044,7 +1044,7 @@ SELECT COUNT(rate) AS count
$sentence = $lang['never_rated'].'. '.$lang['Rate'];
}
}
else
else
{
$sentence = $lang['never_rated'].'. '.$lang['Rate'];
}
@ -1110,7 +1110,7 @@ if ($page['show_comments'])
$query.= " AND validated = 'true'";
$query.= ';';
$row = mysql_fetch_array( pwg_query( $query ) );
// navigation bar creation
$url = PHPWG_ROOT_PATH.'picture.php';
$url.= get_query_string_diff(array('add_fav','start'));
@ -1161,7 +1161,7 @@ if ($page['show_comments'])
}
}
}
if (!$user['is_the_guest']
or ($user['is_the_guest'] and $conf['comments_forall']))
{

View file

@ -35,14 +35,14 @@ if (isset($_POST['submit']))
{
if (isset($_POST['search_allwords'])
and !preg_match('/^\s*$/', $_POST['search_allwords']))
{
{
$drop_char_match = array(
'-','^','$',';','#','&','(',')','<','>','`','\'','"','|',',','@','_',
'?','%','~','.','[',']','{','}',':','\\','/','=','\'','!','*');
$drop_char_replace = array(
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','','',' ',' ',' ',' ','',' ',
' ',' ',' ',' ',' ',' ',' ',' ','' ,' ',' ',' ',' ',' ');
// Split words
$search['fields']['allwords'] = array(
'words' => array_unique(
@ -58,7 +58,7 @@ if (isset($_POST['submit']))
'mode' => $_POST['mode'],
);
}
if ($_POST['search_author'])
{
$search['fields']['author'] = array(
@ -69,7 +69,7 @@ if (isset($_POST['submit']))
'mode' => 'OR',
);
}
if (isset($_POST['cat']))
{
$search['fields']['cat'] = array(
@ -80,7 +80,7 @@ if (isset($_POST['submit']))
// dates
$type_date = $_POST['date_type'];
if (!empty($_POST['start_year']))
{
$search['fields'][$type_date.'-after'] = array(
@ -110,7 +110,7 @@ if (isset($_POST['submit']))
'inc' => true,
);
}
if (!empty($search))
{
// default search mode : each clause must be respected
@ -178,12 +178,10 @@ $template->assign_vars(array(
'L_DAYS'=>$lang['days'],
'L_MONTH'=>$lang['w_month'],
'L_SEARCH_DATE_TYPE'=>$lang['search_date_type'],
'L_SEARCH_CREATION'=>$lang['search_date_creation'],
'L_SEARCH_AVAILABILITY'=>$lang['search_date_available'],
'L_RESULT_SORT'=>$lang['search_sort'],
'L_SORT_ASCENDING'=>$lang['search_ascending'],
'L_SORT_DESCENDING'=>$lang['search_descending'],
'TODAY_DAY' => date('d', time()),
'TODAY_MONTH' => date('m', time()),
'TODAY_YEAR' => date('Y', time()),

View file

@ -69,24 +69,24 @@
<form method="post" action="{F_IDENTIFY}" class="filter" id="quickconnect">
<fieldset>
<legend>{lang:Quick connect}</legend>
<label>
{lang:Username}
<input type="text" name="username" size="15" value="">
</label>
<label>
{L_PASSWORD}
<input type="password" name="password" size="15">
</label>
<!-- BEGIN remember_me -->
<label>
{L_REMEMBER_ME}
<input type="checkbox" name="remember_me" value="1">
</label>
<!-- END remember_me -->
<p>
<input type="submit" name="login" value="{lang:submit}">
</p>
@ -95,7 +95,7 @@
<li><a href="{U_REGISTER}" title="{lang:Create a new account}"><img src="{themeconf:icon_dir}/register.png" class="button" alt="{lang:register}"/></a></li>
</ul>
</fieldset>
</fieldset>
</form>
<!-- END quickconnect -->
@ -117,11 +117,11 @@
</select>
</li>
<!-- END preferred_image_order -->
<!-- BEGIN caddie -->
<li><a href="{caddie.URL}" title="{lang:add to caddie}"><img src="{themeconf:icon_dir}/caddie_add.png" class="button" alt="{lang:caddie}"/></a></li>
<!-- END caddie -->
<!-- BEGIN edit -->
<li><a href="{edit.URL}" title="{lang:edit category informations}"><img src="{themeconf:icon_dir}/category_edit.png" class="button" alt="{lang:edit}"/></a></li>
<!-- END edit -->
@ -129,38 +129,42 @@
<!-- BEGIN search_rules -->
<li><a href="{search_rules.URL}" style="border:none;" onclick="popuphelp(this.href); return false;" title="{lang:Search rules}"><img src="{themeconf:icon_dir}/search_rules.png" class="button" alt="(?)"></a></li>
<!-- END search_rules -->
<!-- BEGIN calendar_view -->
<li><a href="{calendar_view.URL}" title="{lang:calendar_hint}"><img src="{themeconf:icon_dir}/calendar.png" class="button" alt="{lang:calendar}"></a></li>
<!-- END calendar_view -->
<!-- BEGIN normal_view -->
<li><a href="{normal_view.URL}" title="{lang:calendar}"><img src="{themeconf:icon_dir}/calendar.png" class="button" alt="{lang:calendar}"></a></li>
<!-- END normal_view -->
<!-- BEGIN mode_normal -->
<li><a href="{mode_normal.URL}" title="{lang:mode_normal_hint}"><img src="{themeconf:icon_dir}/normal_mode.png" class="button" alt="{lang:mode_normal_hint}"></a></li>
<!-- END mode_normal -->
<!-- BEGIN mode_posted -->
<li><a href="{mode_posted.URL}" title="{lang:mode_posted_hint}"><img src="{themeconf:icon_dir}/calendar.png" class="button" alt="{lang:mode_posted_hint}"></a></li>
<!-- END mode_posted -->
<!-- BEGIN mode_created -->
<li><a href="{mode_created.URL}" title="{lang:mode_created_hint}"><img src="{themeconf:icon_dir}/calendar_created.png" class="button" alt="{lang:mode_created_hint}"></a></li>
<!-- END mode_created -->
</ul>
<h2>{TITLE}
<!-- BEGIN calendar -->
<br/>{calendar.TITLE}
<!-- END calendar --></h2>
{calendar.TITLE}
<!-- END calendar -->
</h2>
</div> <!-- content -->
<!-- BEGIN calendar -->
<!-- BEGIN views -->
<div class="calendarViews">
<select onchange="document.location = this.options[this.selectedIndex].value;">
{lang:calendar_view}: <select onchange="document.location = this.options[this.selectedIndex].value;">
<!-- BEGIN view -->
<option value="{calendar.views.view.VALUE}" {calendar.views.view.SELECTED}>{calendar.views.view.CONTENT}</option>
<!-- END view -->
</select>
</div><br/>
</div>
<!-- END views -->
<!-- BEGIN navbar -->
<div class="navigationBar">{calendar.navbar.BAR}</div>
<div class="calendarBar">{calendar.navbar.BAR}</div>
<!-- END navbar -->
<!-- BEGIN calbar -->
<div class="calendarBar">{calendar.calbar.BAR}</div>
<div class="calendarCalBar">{calendar.calbar.BAR}</div>
<!-- END calbar -->
<!-- END calendar -->

View file

@ -159,8 +159,8 @@ UL.categoryActions {
#content DIV.comment BLOCKQUOTE {
margin-top: 1em;
margin-right: 0.5em;
margin-bottom: 150px;
margin-right: 0.5em;
margin-bottom: 150px;
padding: 0.5em;
}
@ -180,24 +180,37 @@ SPAN.filename:after {
#content DIV.calendarViews {
float: left;
display: block;
text-align: left;
margin: 5px 0;
}
SPAN.cal {
#content DIV.calendarBar {
margin: 8px 4px;
}
SPAN.calItem {
font-weight: bold;
border: 1px solid gray;
margin: 0 2px;
border: 1px solid gray;
}
SPAN.calSel {
SPAN.calItemSel {
font-weight: bold;
margin: 0 2px;
border: 1px solid gray;
color: dark-gray;
border: 1px solid gray;
margin: 0 2px;
}
#content .calendarBar {
margin: 8px 5px;
SPAN.calItemEmpty {
font-weight: bold;
margin: 0 2px;
border: 1px solid gray;
color: lightgray;
}
#content DIV.calendarCalBar {
margin: 10px 10px;
text-align: left;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

View file

@ -91,8 +91,8 @@
<td class="value">{INFO_CREATION_DATE}</td>
</tr>
<tr>
<td class="label">{lang:Registered on}</td>
<td class="value">{INFO_AVAILABILITY_DATE}</td>
<td class="label">{lang:Posted on}</td>
<td class="value">{INFO_POSTED_DATE}</td>
</tr>
<tr>
<td class="label">{lang:Dimensions}</td>

View file

@ -20,7 +20,7 @@
</div>
<!-- END errors -->
<table width="100%" align="center" cellpadding="2">
<tr>
<tr>
<td width="50%" colspan="2"><b>{L_SEARCH_KEYWORDS} : </b>
<td colspan="2" valign="top">
<input type="text" style="width: 300px" name="search_allwords" size="30" />
@ -29,13 +29,13 @@
<input type="radio" name="mode" value="OR" /> {L_SEARCH_ANY_TERMS}
</td>
</tr>
<tr>
<tr>
<td colspan="2"><b>{L_SEARCH_AUTHOR} :</b>
<td colspan="2" valign="middle">
<input type="text" style="width: 300px" name="search_author" size="30" />
</td>
</tr>
<tr>
<tr>
<td colspan="2"><b>{L_SEARCH_DATE} :</b>
<td colspan="2" valign="middle">
<table>
@ -76,10 +76,10 @@
</table>
</td>
</tr>
<tr class="admin">
<tr class="admin">
<th colspan="4">{L_SEARCH_OPTIONS}</th>
</tr>
<tr>
<tr>
<td width="25%" ><b>{L_SEARCH_CATEGORIES} : </b>
<td width="25%" nowrap="nowrap">
<select style="width:200px" name="cat[]" multiple="multiple" size="8">
@ -94,11 +94,11 @@
<input type="radio" name="subcats-included" value="0" />{L_NO}
</td>
</tr>
<tr>
<tr>
<td width="25%" nowrap="nowrap"><b>{L_SEARCH_DATE_TYPE} : </b></td>
<td width="25%" nowrap="nowrap">
<input type="radio" name="date_type" value="date_creation" checked="checked" />{L_SEARCH_CREATION}<br />
<input type="radio" name="date_type" value="date_available" />{L_SEARCH_AVAILABILITY}
<input type="radio" name="date_type" value="date_creation" checked="checked" />{lang:Creation date}<br />
<input type="radio" name="date_type" value="date_available" />{lang:Post date}
</td>
<td><b>{L_RESULT_SORT} : </b></td>
<td nowrap="nowrap">
@ -106,7 +106,7 @@
<input type="radio" name="sd" value="d" checked="checked" />{L_SORT_DESCENDING}
</td>
</tr>
<!-- <tr>
<!-- <tr>
<td width="25%" nowrap="nowrap"><b>{L_SEARCH_WITHIN} : </b></td>
<td width="25%" nowrap="nowrap">
<input type="radio" name="search_fields" value="all" checked="checked" />{L_SEARCH_ALL}<br />
@ -126,9 +126,9 @@
<input type="radio" name="show_results" value="images" checked="checked" />{L_IMAGES}&nbsp;&nbsp;
<input type="radio" name="show_results" value="comments" /> {L_COMMENTS}
</td>
</tr>
</tr>
-->
<tr>
<tr>
<td align="center" valign="bottom" colspan="4" height="38">
<input type="submit" name="submit" value="{L_SUBMIT}" class="bouton" />&nbsp;&nbsp;
<input type="reset" value="{L_RESET}" class="bouton" />

View file

@ -38,7 +38,7 @@ H2, #menubar DT, .throw {
background-color: transparent;
border: none;
}
#imageHeaderBar {
background-image: url(images/tableh2_bg.png);
background-repeat: repeat-x;
@ -107,9 +107,17 @@ A.navThumb, A.navThumb:hover {
}
#the_page {
border: 1px solid #e0e0e0;
padding-top: 5px;
padding-top: 5px;
padding-bottom:30px;
text-align:center;
display:block;
background:#3f3f3f;
}
SPAN.calItemSel {
color: #fff48e;
}
SPAN.calItemEmpty {
color: darkgray;
}