replacement of short_period and long_period by recent_period
git-svn-id: http://piwigo.org/svn/trunk@452 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
2cf37f308e
commit
f007a28bf6
12 changed files with 41 additions and 86 deletions
|
|
@ -90,20 +90,11 @@ if ( isset( $_POST['submit'] ) )
|
|||
array_push( $error, $lang['conf_err_mail'] );
|
||||
}
|
||||
// periods must be integer values, they represents number of days
|
||||
if ( !preg_match( $int_pattern, $_POST['short_period'] )
|
||||
or !preg_match( $int_pattern, $_POST['long_period'] ) )
|
||||
if (!preg_match($int_pattern, $_POST['recent_period'])
|
||||
or $_POST['recent_period'] <= 0)
|
||||
{
|
||||
array_push( $error, $lang['err_periods'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// long period must be longer than short period
|
||||
if ( $_POST['long_period'] <= $_POST['short_period']
|
||||
or $_POST['short_period'] <= 0 )
|
||||
{
|
||||
array_push( $error, $lang['err_periods_2'] );
|
||||
}
|
||||
}
|
||||
// session_id size must be an integer between 4 and 50
|
||||
if ( !preg_match( $int_pattern, $_POST['session_id_size'] )
|
||||
or $_POST['session_id_size'] < 4
|
||||
|
|
@ -216,8 +207,7 @@ $template->assign_vars(array(
|
|||
'NB_IMAGE_LINE'=>$conf['nb_image_line'],
|
||||
'NB_ROW_PAGE'=>$conf['nb_line_page'],
|
||||
'STYLE_SELECT'=>style_select($conf['default_style'], 'default_style'),
|
||||
'SHORT_PERIOD'=>$conf['short_period'],
|
||||
'LONG_PERIOD'=>$conf['long_period'],
|
||||
'RECENT_PERIOD'=>$conf['recent_period'],
|
||||
'UPLOAD_MAXSIZE'=>$conf['upload_maxfilesize'],
|
||||
'UPLOAD_MAXWIDTH'=>$conf['upload_maxwidth'],
|
||||
'UPLOAD_MAXHEIGHT'=>$conf['upload_maxheight'],
|
||||
|
|
@ -271,10 +261,8 @@ $template->assign_vars(array(
|
|||
'L_NB_ROW_PAGE_INFO'=>$lang['conf_default_nb_row_per_page_info'],
|
||||
'L_STYLE_SELECT'=>$lang['customize_theme'],
|
||||
'L_STYLE_SELECT_INFO'=>$lang['conf_default_theme_info'],
|
||||
'L_SHORT_PERIOD'=>$lang['customize_short_period'],
|
||||
'L_SHORT_PERIOD_INFO'=>$lang['conf_default_short_period_info'],
|
||||
'L_LONG_PERIOD'=>$lang['customize_long_period'],
|
||||
'L_LONG_PERIOD_INFO'=>$lang['conf_default_long_period_info'],
|
||||
'L_RECENT_PERIOD'=>$lang['customize_recent_period'],
|
||||
'L_RECENT_PERIOD_INFO'=>$lang['conf_default_recent_period_info'],
|
||||
'L_EXPAND_TREE'=>$lang['customize_expand'],
|
||||
'L_EXPAND_TREE_INFO'=>$lang['conf_default_expand_info'],
|
||||
'L_NB_COMMENTS'=>$lang['customize_show_nb_comments'],
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ if ( isset( $page['cat_nb_images'] ) and $page['cat_nb_images'] > 0 )
|
|||
$template_title.= ' ['.$page['cat_nb_images'].']';
|
||||
}
|
||||
|
||||
$icon_short = get_icon( date( 'Y-m-d' ) );
|
||||
$icon_recent = get_icon(date('Y-m-d'));
|
||||
|
||||
$template->assign_vars(array(
|
||||
'NB_PICTURE' => count_user_total_images(),
|
||||
|
|
@ -201,8 +201,7 @@ $template->assign_vars(array(
|
|||
'F_IDENTIFY' => add_session_id( PHPWG_ROOT_PATH.'identification.php' ),
|
||||
|
||||
'T_COLLAPSED' => $user['lien_collapsed'],
|
||||
'T_SHORT' => $icon_short,
|
||||
'T_LONG'=>get_icon(date( 'Y-m-d',time()-($user['short_period']*24*60*60+1))),
|
||||
'T_RECENT' => $icon_recent,
|
||||
|
||||
'U_HOME' => add_session_id( PHPWG_ROOT_PATH.'category.php' ),
|
||||
'U_FAVORITE' => add_session_id( PHPWG_ROOT_PATH.'category.php?cat=fav' ),
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ $query = '
|
|||
SELECT id AS category_id
|
||||
FROM '.CATEGORIES_TABLE.'
|
||||
WHERE date_last > SUBDATE(CURRENT_DATE
|
||||
,INTERVAL '.$user['short_period'].' DAY)';
|
||||
,INTERVAL '.$user['recent_period'].' DAY)';
|
||||
if ( $user['forbidden_categories'] != '' )
|
||||
{
|
||||
$query.= '
|
||||
|
|
@ -70,7 +70,7 @@ SELECT id,file,tn_ext,storage_category_id
|
|||
FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
|
||||
WHERE category_id = '.$row['category_id'].'
|
||||
AND date_available > SUBDATE(CURRENT_DATE
|
||||
,INTERVAL '.$user['short_period'].' DAY)
|
||||
,INTERVAL '.$user['recent_period'].' DAY)
|
||||
AND id = image_id
|
||||
ORDER BY RAND()
|
||||
LIMIT 0,1
|
||||
|
|
|
|||
|
|
@ -84,8 +84,7 @@ function register_user( $login, $password, $password_conf,
|
|||
// 1. retrieving default values, the ones of the user "guest"
|
||||
$infos = array( 'nb_image_line', 'nb_line_page', 'language',
|
||||
'maxwidth', 'maxheight', 'expand', 'show_nb_comments',
|
||||
'short_period', 'long_period', 'template',
|
||||
'forbidden_categories' );
|
||||
'recent_period', 'template', 'forbidden_categories' );
|
||||
$query = 'SELECT ';
|
||||
for ( $i = 0; $i < sizeof( $infos ); $i++ )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,19 +36,11 @@ function get_icon( $date )
|
|||
$day_in_seconds = 24*60*60;
|
||||
$output = '';
|
||||
$title = $lang['recent_image'].' ';
|
||||
if ( $diff < $user['long_period'] * $day_in_seconds )
|
||||
if ( $diff < $user['recent_period'] * $day_in_seconds )
|
||||
{
|
||||
$icon_url = './template/'.$user['template'].'/theme/';
|
||||
if ( $diff < $user['short_period'] * $day_in_seconds )
|
||||
{
|
||||
$icon_url.= 'new_short.gif';
|
||||
$title .= $user['short_period'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$icon_url.= 'new_long.gif';
|
||||
$title .= $user['long_period'];
|
||||
}
|
||||
$icon_url.= 'recent.gif';
|
||||
$title .= $user['recent_period'];
|
||||
$title .= ' '.$lang['days'];
|
||||
$size = getimagesize( $icon_url );
|
||||
$output = '<img title="'.$title.'" src="'.$icon_url.'" style="border:0;';
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@
|
|||
// status --> $user['status']
|
||||
$infos = array( 'id', 'username', 'mail_address', 'nb_image_line',
|
||||
'nb_line_page', 'status', 'language', 'maxwidth',
|
||||
'maxheight', 'expand', 'show_nb_comments', 'short_period',
|
||||
'long_period', 'template', 'forbidden_categories' );
|
||||
'maxheight', 'expand', 'show_nb_comments', 'recent_period',
|
||||
'template', 'forbidden_categories' );
|
||||
|
||||
$query_user = 'SELECT '.implode( ',', $infos );
|
||||
$query_user.= ' FROM '.USERS_TABLE;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('authorize_cookie
|
|||
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('mail_notification','false','automated mail notification for adminsitrators');
|
||||
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('nb_image_line','5','Number of images displayed per row');
|
||||
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('nb_line_page','3','Number of rows displayed per page');
|
||||
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('short_period','7','Period within which pictures are displayed as new (in days)');
|
||||
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('long_period','14','Long period within which pictures are displayed as new (in days)');
|
||||
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('recent_period','7','Period within which pictures are displayed as new (in days)');
|
||||
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('auto_expand','false','Auto expand of the category tree');
|
||||
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('show_nb_comments','true','Show the number of comments under the thumbnails');
|
||||
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('show_nb_comments','true','Show the number of comments under the thumbnails');
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ $lang['conf_err_comment_number'] = 'The number of comments a page must be betwee
|
|||
$lang['conf_remote_site_delete_info'] = 'Deleting a remote server will delete all the image and the categories in relation with this server.';
|
||||
$lang['conf_upload_title'] = 'Configuration of the users upload';
|
||||
$lang['conf_upload_available'] = 'authorized the upload of pictures';
|
||||
$lang['conf_upload_available_info'] = '';
|
||||
$lang['conf_upload_maxfilesize'] = 'maximum filesize';
|
||||
$lang['conf_upload_maxfilesize_info'] = 'Maximum filesize for the uploaded pictures. Must be a number between 10 and 1000 KB.';
|
||||
$lang['conf_err_upload_maxfilesize'] = 'Maximum filesize for the uploaded pictures must be a number between 10 and 1000 KB.';
|
||||
|
|
@ -146,8 +147,7 @@ $lang['conf_comments_forall'] = 'for all ?';
|
|||
$lang['conf_comments_forall_info'] = 'Even guest not registered can post comments';
|
||||
$lang['conf_default_nb_image_per_row_info'] = 'number of pictures for each row by default';
|
||||
$lang['conf_default_nb_row_per_page_info'] = 'number of rows by page by default';
|
||||
$lang['conf_default_short_period_info'] = 'By days. Period within a picture is shown with a red mark. The short period must be superior to 1 day.';
|
||||
$lang['conf_default_long_period_info'] = 'By days. Period within a picture is shown with a green mark. The long period must be superior to the short period.';
|
||||
$lang['conf_default_recent_period_info'] = 'By days. Period within a picture is shown as new. The short period must be superior to 1 day.';
|
||||
$lang['conf_default_expand_info'] = 'expand all categories by default in the menu ?';
|
||||
$lang['conf_default_show_nb_comments_info'] = 'show the number of comments for each picture on the thumbnails page';
|
||||
$lang['conf_default_maxwidth_info'] = 'Maximum width for display pictures : picture will have a new width only for display, picture files won\'t be changed. Let empty if you don\'t wish to have a limit.';
|
||||
|
|
|
|||
|
|
@ -219,11 +219,9 @@ $lang['times'] = 'times';
|
|||
$lang['customize_theme'] = 'interface theme';
|
||||
$lang['customize_expand'] = 'expand all categories';
|
||||
$lang['customize_show_nb_comments'] = 'show number of comments';
|
||||
$lang['customize_short_period'] = 'short period';
|
||||
$lang['customize_long_period'] = 'long period';
|
||||
$lang['customize_recent_period'] = 'recent period';
|
||||
$lang['customize_template'] = 'template';
|
||||
$lang['err_periods'] = 'periods must be integer values';
|
||||
$lang['err_periods_2'] = 'periods must be superior to 0. The long period must be grater than the short period.';
|
||||
$lang['err_periods'] = 'recent period must be a positive integer value';
|
||||
$lang['create_cookie'] = 'create a cookie';
|
||||
$lang['customize_day'] = 'day';
|
||||
$lang['customize_week'] = 'week';
|
||||
|
|
|
|||
28
profile.php
28
profile.php
|
|
@ -40,7 +40,7 @@ if ( $user['is_the_guest'] )
|
|||
//------------------------------------------------------ update & customization
|
||||
$infos = array( 'nb_image_line', 'nb_line_page', 'language',
|
||||
'maxwidth', 'maxheight', 'expand', 'show_nb_comments',
|
||||
'short_period', 'long_period', 'template', 'mail_address' );
|
||||
'recent_period', 'template', 'mail_address' );
|
||||
// mise à jour dans la base de données des valeurs
|
||||
// des paramètres pour l'utilisateur courant
|
||||
// - on teste si chacune des variables est passée en argument à la page
|
||||
|
|
@ -62,20 +62,11 @@ if ( isset( $_POST['submit'] ) )
|
|||
array_push( $errors, $lang['err_maxheight'] );
|
||||
}
|
||||
// periods must be integer values, they represents number of days
|
||||
if ( !preg_match( $int_pattern, $_POST['short_period'] )
|
||||
or !preg_match( $int_pattern, $_POST['long_period'] ) )
|
||||
if (!preg_match($int_pattern, $_POST['recent_period'])
|
||||
or $_POST['recent_period'] <= 0)
|
||||
{
|
||||
array_push( $errors, $lang['err_periods'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// long period must be longer than short period
|
||||
if ( $_POST['long_period'] <= $_POST['short_period']
|
||||
or $_POST['short_period'] <= 0 )
|
||||
{
|
||||
array_push( $errors, $lang['err_periods_2'] );
|
||||
}
|
||||
}
|
||||
$mail_error = validate_mail_address( $_POST['mail_address'] );
|
||||
if ( $mail_error != '' ) array_push( $errors, $mail_error );
|
||||
// password must be the same as its confirmation
|
||||
|
|
@ -137,24 +128,21 @@ $template->assign_vars(array(
|
|||
'NB_IMAGE_LINE'=>$user['nb_image_line'],
|
||||
'NB_ROW_PAGE'=>$user['nb_line_page'],
|
||||
'STYLE_SELECT'=>style_select($user['template'], 'template'),
|
||||
'SHORT_PERIOD'=>$user['short_period'],
|
||||
'LONG_PERIOD'=>$user['long_period'],
|
||||
'RECENT_PERIOD'=>$user['recent_period'],
|
||||
|
||||
$expand=>'checked="checked"',
|
||||
$nb_comments=>'checked="checked"',
|
||||
|
||||
'L_TITLE' => $lang['customize_title'],
|
||||
'L_TITLE' => $lang['customize_title'],
|
||||
'L_PASSWORD' => $lang['password'],
|
||||
'L_NEW' => $lang['new'],
|
||||
'L_CONFIRM' => $lang['reg_confirm'],
|
||||
'L_NEW' => $lang['new'],
|
||||
'L_CONFIRM' => $lang['reg_confirm'],
|
||||
'L_COOKIE' => $lang['create_cookie'],
|
||||
'L_CONFIRM'=>$lang['conf_confirmation'],
|
||||
'L_LANG_SELECT'=>$lang['customize_language'],
|
||||
'L_NB_IMAGE_LINE'=>$lang['customize_nb_image_per_row'],
|
||||
'L_NB_ROW_PAGE'=>$lang['customize_nb_row_per_page'],
|
||||
'L_STYLE_SELECT'=>$lang['customize_theme'],
|
||||
'L_SHORT_PERIOD'=>$lang['customize_short_period'],
|
||||
'L_LONG_PERIOD'=>$lang['customize_long_period'],
|
||||
'L_RECENT_PERIOD'=>$lang['customize_recent_period'],
|
||||
'L_EXPAND_TREE'=>$lang['customize_expand'],
|
||||
'L_NB_COMMENTS'=>$lang['customize_show_nb_comments'],
|
||||
'L_YES'=>$lang['yes'],
|
||||
|
|
|
|||
|
|
@ -99,12 +99,8 @@
|
|||
<td class="row1">{STYLE_SELECT}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>{L_SHORT_PERIOD} :</strong><br /><span class="small">{L_SHORT_PERIOD_INFO}</span></td>
|
||||
<td class="row1"><input type="text" size="3" maxlength="2" name="short_period" value="{SHORT_PERIOD}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>{L_LONG_PERIOD} :</strong><br /><span class="small">{L_LONG_PERIOD_INFO}</span></td>
|
||||
<td class="row1"><input type="text" size="3" maxlength="2" name="long_period" value="{LONG_PERIOD}" /></td>
|
||||
<td><strong>{L_RECENT_PERIOD} :</strong><br /><span class="small">{L_RECENT_PERIOD_INFO}</span></td>
|
||||
<td class="row1"><input type="text" size="3" maxlength="2" name="recent_period" value="{RECENT_PERIOD}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>{L_EXPAND_TREE} :</strong><br /><span class="small">{L_EXPAND_TREE_INFO}</span></td>
|
||||
|
|
@ -203,4 +199,4 @@
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -27,12 +27,8 @@
|
|||
<td>{LANG_SELECT}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{L_SHORT_PERIOD}</td>
|
||||
<td><input type="text" size="3" maxlength="2" name="short_period" value="{SHORT_PERIOD}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{L_LONG_PERIOD}</td>
|
||||
<td><input type="text" size="3" maxlength="2" name="long_period" value="{LONG_PERIOD}" /></td>
|
||||
<td>{L_RECENT_PERIOD}</td>
|
||||
<td><input type="text" size="3" maxlength="2" name="recent_period" value="{RECENT_PERIOD}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{L_EXPAND_TREE}</td>
|
||||
|
|
@ -46,8 +42,8 @@
|
|||
</tr>
|
||||
<!-- BEGIN text -->
|
||||
<tr>
|
||||
<td class="menu">{text.F_LABEL}</td>
|
||||
<td class="menu">
|
||||
<td>{text.F_LABEL}</td>
|
||||
<td>
|
||||
<input type="text" name="{text.F_NAME}" value="{text.F_VALUE}" />
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -56,12 +52,12 @@
|
|||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu">{L_NEW} {L_PASSWORD} <input type="checkbox" name="use_new_pwd" value="1" /></td>
|
||||
<td class="menu"><input type="password" name="password" value="" /></td>
|
||||
<td>{L_NEW} {L_PASSWORD} <input type="checkbox" name="use_new_pwd" value="1" /></td>
|
||||
<td><input type="password" name="password" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu">{L_CONFIRM}</td>
|
||||
<td class="menu"><input type="password" name="passwordConf" value="" /></td>
|
||||
<td>{L_CONFIRM}</td>
|
||||
<td><input type="password" name="passwordConf" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
|
|
@ -72,4 +68,4 @@
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue