diff options
Diffstat (limited to '')
-rw-r--r-- | admin/configuration.php | 32 | ||||
-rw-r--r-- | admin/notification_by_mail.php | 40 | ||||
-rw-r--r-- | include/functions.inc.php | 11 | ||||
-rw-r--r-- | include/functions_html.inc.php | 7 |
4 files changed, 35 insertions, 55 deletions
diff --git a/admin/configuration.php b/admin/configuration.php index 71c0e6f35..1d295e7cd 100644 --- a/admin/configuration.php +++ b/admin/configuration.php @@ -2,7 +2,7 @@ // +-----------------------------------------------------------------------+ // | PhpWebGallery - a PHP based picture gallery | // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | -// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net | +// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net | // +-----------------------------------------------------------------------+ // | branch : BSF (Best So Far) // | file : $RCSfile$ @@ -128,7 +128,7 @@ if (isset($_POST['submit']) and !is_adviser()) if (count($page['errors']) == 0) { //echo '<pre>'; print_r($_POST); echo '</pre>'; - $result = pwg_query('SELECT * FROM '.CONFIG_TABLE); + $result = pwg_query('SELECT param FROM '.CONFIG_TABLE); while ($row = mysql_fetch_array($result)) { if (isset($_POST[$row['param']])) @@ -153,13 +153,9 @@ UPDATE '.CONFIG_TABLE.' } array_push($page['infos'], $lang['conf_confirmation']); } -} -//------------------------------------------------------ $conf reinitialization -$result = pwg_query('SELECT param,value FROM '.CONFIG_TABLE); -while ($row = mysql_fetch_array($result)) -{ - $conf[$row['param']] = $row['value']; + //------------------------------------------------------ $conf reinitialization + load_conf_from_db(); } //----------------------------------------------------- template initialization @@ -186,16 +182,16 @@ switch ($page['section']) { case 'general' : { - $lock_yes = ($conf['gallery_locked']=='true')?'checked="checked"':''; - $lock_no = ($conf['gallery_locked']=='false')?'checked="checked"':''; + $lock_yes = ($conf['gallery_locked']==true)?'checked="checked"':''; + $lock_no = ($conf['gallery_locked']==false)?'checked="checked"':''; $template->assign_block_vars( 'general', array( 'GALLERY_LOCKED_YES'=>$lock_yes, 'GALLERY_LOCKED_NO'=>$lock_no, - ($conf['rate']=='true'?'RATE_YES':'RATE_NO')=>$html_check, - ($conf['rate_anonymous']=='true' + ($conf['rate']==true?'RATE_YES':'RATE_NO')=>$html_check, + ($conf['rate_anonymous']==true ? 'RATE_ANONYMOUS_YES' : 'RATE_ANONYMOUS_NO')=>$html_check, 'CONF_GALLERY_TITLE' => $conf['gallery_title'], 'CONF_PAGE_BANNER' => $conf['page_banner'], @@ -207,7 +203,7 @@ switch ($page['section']) $template->merge_block_vars( 'general', array( - strtoupper($checkbox) => ($conf[$checkbox]=='true')?$html_check:'' + strtoupper($checkbox) => ($conf[$checkbox]==true)?$html_check:'' ) ); } @@ -226,7 +222,7 @@ switch ($page['section']) $template->merge_block_vars( 'comments', array( - strtoupper($checkbox) => ($conf[$checkbox]=='true')?$html_check:'' + strtoupper($checkbox) => ($conf[$checkbox]==true)?$html_check:'' ) ); } @@ -234,10 +230,10 @@ switch ($page['section']) } case 'default' : { - $show_yes = ($conf['show_nb_comments']=='true')?'checked="checked"':''; - $show_no = ($conf['show_nb_comments']=='false')?'checked="checked"':''; - $expand_yes = ($conf['auto_expand']=='true')?'checked="checked"':''; - $expand_no = ($conf['auto_expand']=='false')?'checked="checked"':''; + $show_yes = ($conf['show_nb_comments']==true)?'checked="checked"':''; + $show_no = ($conf['show_nb_comments']==false)?'checked="checked"':''; + $expand_yes = ($conf['auto_expand']==true)?'checked="checked"':''; + $expand_no = ($conf['auto_expand']==false)?'checked="checked"':''; $template->assign_block_vars( 'default', diff --git a/admin/notification_by_mail.php b/admin/notification_by_mail.php index 073f78b34..58badbe05 100644 --- a/admin/notification_by_mail.php +++ b/admin/notification_by_mail.php @@ -2,8 +2,8 @@ // +-----------------------------------------------------------------------+ // | PhpWebGallery - a PHP based picture gallery | // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | -// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net | -// | Copyright (C) 2006 Ruben ARNAUD - team@phpwebgallery.net | +// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net | +// | Copyright (C) 2006-2007 Ruben ARNAUD - team@phpwebgallery.net | // +-----------------------------------------------------------------------+ // | branch : BSF (Best So Far) // | file : $RCSfile$ @@ -414,12 +414,12 @@ switch ($page['mode']) { case 'param' : { - $updated_param_count = 0; - // Update param - $result = pwg_query('select param, value from '.CONFIG_TABLE.' where param like \'nbm\\_%\''); - while ($nbm_user = mysql_fetch_array($result)) + if (isset($_POST['param_submit']) and !is_adviser()) { - if (isset($_POST['param_submit']) and !is_adviser()) + $updated_param_count = 0; + // Update param + $result = pwg_query('select param, value from '.CONFIG_TABLE.' where param like \'nbm\\_%\''); + while ($nbm_user = mysql_fetch_array($result)) { if (isset($_POST[$nbm_user['param']])) { @@ -427,8 +427,8 @@ switch ($page['mode']) $query = ' update - '.CONFIG_TABLE.' -set +'.CONFIG_TABLE.' +set value = \''. str_replace("\'", "''", $value).'\' where param = \''.$nbm_user['param'].'\';'; @@ -436,27 +436,11 @@ where $updated_param_count += 1; } } - - $conf[$nbm_user['param']] = $nbm_user['value']; - - // if the parameter is present in $_POST array (if a form is submited), we - // override it with the submited value - if (isset($_POST[$nbm_user['param']]) and !is_adviser()) - { - $conf[$nbm_user['param']] = stripslashes($_POST[$nbm_user['param']]); - } - - // If the field is true or false, the variable is transformed into a - // boolean value. - if ($conf[$nbm_user['param']] == 'true' or $conf[$nbm_user['param']] == 'false') - { - $conf[$nbm_user['param']] = get_boolean($conf[$nbm_user['param']]); - } - } - if ($updated_param_count != 0) - { array_push($page['infos'], sprintf(l10n('nbm_updated_param_count'), $updated_param_count)); + + // Reload conf with new values + load_conf_from_db('param like \'nbm\\_%\''); } } case 'subscribe' : diff --git a/include/functions.inc.php b/include/functions.inc.php index f6fc85871..9a791b21d 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -2,7 +2,7 @@ // +-----------------------------------------------------------------------+ // | PhpWebGallery - a PHP based picture gallery | // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | -// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net | +// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net | // +-----------------------------------------------------------------------+ // | branch : BSF (Best So Far) // | file : $Id$ @@ -1007,7 +1007,7 @@ function l10n($key) */ function l10n_dec($singular_fmt_key, $plural_fmt_key, $decimal) { - return sprintf(l10n(($decimal > 1 ? $plural_fmt_key : + return sprintf(l10n(($decimal > 1 ? $plural_fmt_key : $singular_fmt_key)), $decimal); } @@ -1094,17 +1094,18 @@ function get_available_upgrade_ids() * * @return void */ -function load_conf_from_db() +function load_conf_from_db($condition = '') { global $conf; $query = ' -SELECT param,value +SELECT param, value FROM '.CONFIG_TABLE.' + '.(!empty($condition) ? 'WHERE '.$condition : '').' ;'; $result = pwg_query($query); - if (mysql_num_rows($result) == 0) + if ((mysql_num_rows($result) == 0) and !empty($condition)) { die('No configuration data'); } diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php index bb8861ba4..48c05ea06 100644 --- a/include/functions_html.inc.php +++ b/include/functions_html.inc.php @@ -2,7 +2,7 @@ // +-----------------------------------------------------------------------+ // | PhpWebGallery - a PHP based picture gallery | // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | -// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | +// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net | // +-----------------------------------------------------------------------+ // | branch : BSF (Best So Far) // | last update : $Date$ @@ -288,12 +288,11 @@ function get_cat_display_name($cat_informations, { $output.= '<a class=""'; $output.= ' href="' - .duplicate_index_url( + .make_index_url( array( 'category'=>$id, 'cat_name'=>$name - ), - array('start') + ) ) .'">'; $output.= $name.'</a>'; |