diff options
author | plegall <plg@piwigo.org> | 2005-09-03 16:36:05 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2005-09-03 16:36:05 +0000 |
commit | 7eae7595909a49d4355453c73638151097a53f20 (patch) | |
tree | ec20fce221086be1ece0f292a953264d90ec5360 /admin | |
parent | 857eec2218afe027b9d87f91aa7de144fc4e3111 (diff) |
- modification : less configuration parameters in administration
screen. These parameters are move to include/config_default.inc.php.
- new : ability to add a single picture to caddie from picture.php
- new : contextual help, only a few pages are available.
- new : ability to delete users from admin/user_list
- modification : reorganization of configuration file
- new : configuration parameter use_exif_mapping
- improvement : MOD hidemail added to standard
git-svn-id: http://piwigo.org/svn/trunk@858 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin.php | 3 | ||||
-rw-r--r-- | admin/configuration.php | 210 | ||||
-rw-r--r-- | admin/include/functions.php | 2 | ||||
-rw-r--r-- | admin/include/functions_metadata.php | 43 | ||||
-rw-r--r-- | admin/infos_images.php | 351 | ||||
-rw-r--r-- | admin/maintenance.php | 1 | ||||
-rw-r--r-- | admin/remote_site.php | 3 | ||||
-rw-r--r-- | admin/update.php | 6 | ||||
-rw-r--r-- | admin/user_list.php | 208 |
9 files changed, 222 insertions, 605 deletions
@@ -72,9 +72,6 @@ $template->assign_vars( 'U_CONFIG_GENERAL'=>add_session_id($conf_link.'general' ), 'U_CONFIG_COMMENTS'=>add_session_id($conf_link.'comments' ), 'U_CONFIG_DISPLAY'=>add_session_id($conf_link.'default' ), - 'U_CONFIG_UPLOAD'=>add_session_id($conf_link.'upload' ), - 'U_CONFIG_SESSION'=>add_session_id($conf_link.'session' ), - 'U_CONFIG_METADATA'=>add_session_id($conf_link.'metadata' ), 'U_CATEGORIES'=>add_session_id($link_start.'cat_list' ), 'U_CAT_UPLOAD'=>add_session_id($opt_link.'upload'), 'U_CAT_COMMENTS'=>add_session_id($opt_link.'comments'), diff --git a/admin/configuration.php b/admin/configuration.php index 8829c0822..9da9c56d3 100644 --- a/admin/configuration.php +++ b/admin/configuration.php @@ -60,17 +60,6 @@ if (isset($_POST['submit'])) { case 'general' : { - // thumbnail prefix must only contain simple ASCII characters - if (!preg_match('/^[\w-]*$/', $_POST['prefix_thumbnail'])) - { - array_push($page['errors'], $lang['conf_prefix_thumbnail_error']); - } - // mail must be formatted as follows : name@server.com - $pattern = '/^[\w-]+(\.[\w-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/'; - if (!preg_match($pattern, $_POST['mail_webmaster'])) - { - array_push($page['errors'], $lang['conf_mail_webmaster_error']); - } break; } case 'comments' : @@ -95,30 +84,6 @@ if (isset($_POST['submit'])) } break; } - case 'upload' : - { - // the maximum upload filesize must be an integer between 10 and 1000 - if (!preg_match($int_pattern, $_POST['upload_maxfilesize']) - or $_POST['upload_maxfilesize'] < 10 - or $_POST['upload_maxfilesize'] > 1000) - { - array_push($page['errors'], $lang['conf_upload_maxfilesize_error']); - } - - foreach (array('upload_maxwidth', - 'upload_maxheight', - 'upload_maxwidth_thumbnail', - 'upload_maxheight_thumbnail') - as $field) - { - if (!preg_match($int_pattern, $_POST[$field]) - or $_POST[$field] < 10) - { - array_push($page['errors'], $lang['conf_'.$field.'_error']); - } - } - break; - } } // updating configuration if no error found @@ -154,6 +119,8 @@ $template->assign_vars( 'L_NO'=>$lang['no'], 'L_SUBMIT'=>$lang['submit'], 'L_RESET'=>$lang['reset'], + + 'U_HELP' => PHPWG_ROOT_PATH.'/popuphelp.php?page=configuration', 'F_ACTION'=>add_session_id($action) )); @@ -170,18 +137,6 @@ switch ($page['section']) $template->assign_block_vars( 'general', array( - 'L_CONF_TITLE'=>$lang['conf_general_title'], - 'L_CONF_MAIL'=>$lang['conf_mail_webmaster'], - 'L_CONF_MAIL_INFO'=>$lang['conf_mail_webmaster_info'], - 'L_CONF_TN_PREFIX'=>$lang['conf_prefix'], - 'L_CONF_TN_PREFIX_INFO'=>$lang['conf_prefix_info'], - 'L_CONF_HISTORY'=>$lang['history'], - 'L_CONF_HISTORY_INFO'=>$lang['conf_log_info'], - 'L_CONF_GALLERY_LOCKED'=>$lang['conf_gallery_locked'], - 'L_CONF_GALLERY_LOCKED_INFO'=>$lang['conf_gallery_locked_info'], - - 'ADMIN_MAIL'=>$conf['mail_webmaster'], - 'THUMBNAIL_PREFIX'=>$conf['prefix_thumbnail'], 'HISTORY_YES'=>$history_yes, 'HISTORY_NO'=>$history_no, 'GALLERY_LOCKED_YES'=>$lock_yes, @@ -199,14 +154,6 @@ switch ($page['section']) $template->assign_block_vars( 'comments', array( - 'L_CONF_TITLE'=>$lang['conf_comments_title'], - 'L_CONF_COMMENTS_ALL'=>$lang['conf_comments_forall'], - 'L_CONF_COMMENTS_ALL_INFO'=>$lang['conf_comments_forall_info'], - 'L_CONF_NB_COMMENTS_PAGE'=>$lang['conf_nb_comment_page'], - 'L_CONF_NB_COMMENTS_PAGE_INFO'=>$lang['conf_nb_comment_page'], - 'L_CONF_VALIDATE'=>$lang['conf_comments_validation'], - 'L_CONF_VALIDATE_INFO'=>$lang['conf_comments_validation_info'], - 'NB_COMMENTS_PAGE'=>$conf['nb_comment_page'], 'COMMENTS_ALL_YES'=>$all_yes, 'COMMENTS_ALL_NO'=>$all_no, @@ -225,28 +172,8 @@ switch ($page['section']) $template->assign_block_vars( 'default', array( - 'L_CONF_TITLE'=>$lang['conf_default_title'], - 'L_CONF_LANG'=>$lang['language'], - 'L_CONF_LANG_INFO'=>$lang['conf_default_language_info'], - 'L_NB_IMAGE_LINE'=>$lang['nb_image_per_row'], - 'L_NB_IMAGE_LINE_INFO'=>$lang['conf_nb_image_line_info'], - 'L_NB_ROW_PAGE'=>$lang['nb_row_per_page'], - 'L_NB_ROW_PAGE_INFO'=>$lang['conf_nb_line_page_info'], - 'L_CONF_STYLE'=>$lang['theme'], - 'L_CONF_STYLE_INFO'=>$lang['conf_default_theme_info'], - 'L_CONF_RECENT'=>$lang['recent_period'], - 'L_CONF_RECENT_INFO'=>$lang['conf_recent_period_info'], - 'L_CONF_EXPAND'=>$lang['auto_expand'], - 'L_CONF_EXPAND_INFO'=>$lang['conf_default_expand_info'], - 'L_NB_COMMENTS'=>$lang['show_nb_comments'], - 'L_NB_COMMENTS_INFO'=>$lang['conf_show_nb_comments_info'], - 'L_MAXWIDTH'=>$lang['maxwidth'], - 'L_MAXHEIGHT'=>$lang['maxheight'], - - 'CONF_LANG_SELECT'=>language_select($conf['default_language'], 'default_language'), 'NB_IMAGE_LINE'=>$conf['nb_image_line'], 'NB_ROW_PAGE'=>$conf['nb_line_page'], - 'CONF_STYLE_SELECT'=>style_select($conf['default_template'], 'default_template'), 'CONF_RECENT'=>$conf['recent_period'], 'NB_COMMENTS_PAGE'=>$conf['nb_comment_page'], 'EXPAND_YES'=>$expand_yes, @@ -254,86 +181,65 @@ switch ($page['section']) 'SHOW_COMMENTS_YES'=>$show_yes, 'SHOW_COMMENTS_NO'=>$show_no )); - break; - } - case 'upload' : - { - $template->assign_block_vars( - 'upload', - array( - 'L_CONF_TITLE'=>$lang['conf_upload_title'], - 'L_CONF_MAXSIZE'=>$lang['conf_upload_maxfilesize'], - 'L_CONF_MAXSIZE_INFO'=>$lang['conf_upload_maxfilesize_info'], - 'L_CONF_MAXWIDTH'=>$lang['conf_upload_maxwidth'], - 'L_CONF_MAXWIDTH_INFO'=>$lang['conf_upload_maxwidth_info'], - 'L_CONF_MAXHEIGHT'=>$lang['conf_upload_maxheight'], - 'L_CONF_MAXHEIGHT_INFO'=>$lang['conf_upload_maxheight_info'], - 'L_CONF_TN_MAXWIDTH'=>$lang['conf_upload_tn_maxwidth'], - 'L_CONF_TN_MAXWIDTH_INFO'=>$lang['conf_upload_tn_maxwidth_info'], - 'L_CONF_TN_MAXHEIGHT'=>$lang['conf_upload_tn_maxheight'], - 'L_CONF_TN_MAXHEIGHT_INFO'=>$lang['conf_upload_tn_maxheight_info'], - - 'UPLOAD_MAXSIZE'=>$conf['upload_maxfilesize'], - 'UPLOAD_MAXWIDTH'=>$conf['upload_maxwidth'], - 'UPLOAD_MAXHEIGHT'=>$conf['upload_maxheight'], - 'TN_UPLOAD_MAXWIDTH'=>$conf['upload_maxwidth_thumbnail'], - 'TN_UPLOAD_MAXHEIGHT'=>$conf['upload_maxheight_thumbnail'], - )); - break; - } - case 'session' : - { - $authorize_remembering_yes = - ($conf['authorize_remembering']=='true')?'checked="checked"':''; - $authorize_remembering_no = - ($conf['authorize_remembering']=='false')?'checked="checked"':''; + + $blockname = 'default.language_option'; + + foreach (get_languages() as $language_code => $language_name) + { + if (isset($_POST['submit'])) + { + $selected = + $_POST['default_language'] == $language_code + ? 'selected="selected"' : ''; + } + else if ($conf['default_language'] == $language_code) + { + $selected = 'selected="selected"'; + } + else + { + $selected = ''; + } - $template->assign_block_vars( - 'session', - array( - 'L_CONF_TITLE'=>$lang['conf_session_title'], - 'L_CONF_AUTHORIZE_REMEMBERING'=>$lang['conf_authorize_remembering'], - 'L_CONF_AUTHORIZE_REMEMBERING_INFO' => - $lang['conf_authorize_remembering_info'], + $template->assign_block_vars( + $blockname, + array( + 'VALUE'=> $language_code, + 'CONTENT' => $language_name, + 'SELECTED' => $selected + )); + } - 'AUTHORIZE_REMEMBERING_YES'=>$authorize_remembering_yes, - 'AUTHORIZE_REMEMBERING_NO'=>$authorize_remembering_no - )); - break; - } - case 'metadata' : - { - $exif_yes = ($conf['use_exif']=='true')?'checked="checked"':''; - $exif_no = ($conf['use_exif']=='false')?'checked="checked"':''; - $iptc_yes = ($conf['use_iptc']=='true')?'checked="checked"':''; - $iptc_no = ($conf['use_iptc']=='false')?'checked="checked"':''; - $show_exif_yes = ($conf['show_exif']=='true')?'checked="checked"':''; - $show_exif_no = ($conf['show_exif']=='false')?'checked="checked"':''; - $show_iptc_yes = ($conf['show_iptc']=='true')?'checked="checked"':''; - $show_iptc_no = ($conf['show_iptc']=='false')?'checked="checked"':''; + $blockname = 'default.template_option'; + + foreach (get_templates() as $pwg_template) + { + if (isset($_POST['submit'])) + { + $selected = + $_POST['default_template'] == $pwg_template + ? 'selected="selected"' : ''; + } + else if ($conf['default_template'] == $pwg_template) + { + $selected = 'selected="selected"'; + } + else + { + $selected = ''; + } - $template->assign_block_vars( - 'metadata', - array( - 'L_CONF_TITLE'=>$lang['conf_metadata_title'], - 'L_CONF_EXIF'=>$lang['conf_use_exif'], - 'L_CONF_EXIF_INFO'=>$lang['conf_use_exif_info'], - 'L_CONF_IPTC'=>$lang['conf_use_iptc'], - 'L_CONF_IPTC_INFO'=>$lang['conf_use_iptc_info'], - 'L_CONF_SHOW_EXIF'=>$lang['conf_show_exif'], - 'L_CONF_SHOW_EXIF_INFO'=>$lang['conf_show_exif_info'], - 'L_CONF_SHOW_IPTC'=>$lang['conf_show_iptc'], - 'L_CONF_SHOW_IPTC_INFO'=>$lang['conf_show_iptc_info'], - - 'USE_EXIF_YES'=>$exif_yes, - 'USE_EXIF_NO'=>$exif_no, - 'USE_IPTC_YES'=>$iptc_yes, - 'USE_IPTC_NO'=>$iptc_no, - 'SHOW_EXIF_YES'=>$show_exif_yes, - 'SHOW_EXIF_NO'=>$show_exif_no, - 'SHOW_IPTC_YES'=>$show_iptc_yes, - 'SHOW_IPTC_NO'=>$show_iptc_no - )); + $template->assign_block_vars( + $blockname, + array( + 'VALUE'=> $pwg_template, + 'CONTENT' => $pwg_template, + 'SELECTED' => $selected + ) + ); + } + + break; } } diff --git a/admin/include/functions.php b/admin/include/functions.php index 2b7a9a5cc..78ec15a09 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -364,7 +364,7 @@ DELETE FROM '.SESSIONS_TABLE.' // deletion of calculated permissions linked to the user $query = ' -DELETE FROM '.USER_FORBIDDEN_TABLE.' +DELETE FROM '.USER_CACHE_TABLE.' WHERE user_id = '.$user_id.' ;'; pwg_query($query); diff --git a/admin/include/functions_metadata.php b/admin/include/functions_metadata.php index 23b04833c..4836f85a3 100644 --- a/admin/include/functions_metadata.php +++ b/admin/include/functions_metadata.php @@ -27,18 +27,19 @@ include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php'); +$page['datefields'] = array('date_creation', 'date_available'); + function get_sync_iptc_data($file) { - global $conf; + global $conf, $page; $map = $conf['use_iptc_mapping']; - $datefields = array('date_creation', 'date_available'); $iptc = get_iptc_data($file, $map); foreach ($iptc as $pwg_key => $value) { - if (in_array($pwg_key, $datefields)) + if (in_array($pwg_key, $page['datefields'])) { if (preg_match('/(\d{4})(\d{2})(\d{2})/', $value, $matches)) { @@ -59,6 +60,26 @@ function get_sync_iptc_data($file) return $iptc; } +function get_sync_exif_data($file) +{ + global $conf, $page; + + $exif = get_exif_data($file, $conf['use_exif_mapping']); + + foreach ($exif as $pwg_key => $value) + { + if (in_array($pwg_key, $page['datefields'])) + { + if (preg_match('/^(\d{4}).(\d{2}).(\d{2})/', $value, $matches)) + { + $exif[$pwg_key] = $matches[1].'-'.$matches[2].'-'.$matches[3]; + } + } + } + + return $exif; +} + function update_metadata($files) { global $conf; @@ -84,17 +105,13 @@ function update_metadata($files) if ($conf['use_exif']) { - if (!function_exists('read_exif_data')) - { - die('Exif extension not available, admin should disable exif use'); - } - - if ($exif = @read_exif_data($file)) + $exif = get_sync_exif_data($file); + + if (count($exif) > 0) { - if (isset($exif['DateTime'])) + foreach (array_keys($exif) as $key) { - preg_match('/^(\d{4}).(\d{2}).(\d{2})/',$exif['DateTime'],$matches); - $data['date_creation'] = $matches[1].'-'.$matches[2].'-'.$matches[3]; + $data[$key] = addslashes($exif[$key]); } } } @@ -128,7 +145,7 @@ function update_metadata($files) $update_fields = array_merge($update_fields, array_keys($conf['use_iptc_mapping'])); } - + $fields = array('primary' => array('id'), 'update' => array_unique($update_fields)); mass_updates(IMAGES_TABLE, $fields, $datas); diff --git a/admin/infos_images.php b/admin/infos_images.php deleted file mode 100644 index b8db86ec9..000000000 --- a/admin/infos_images.php +++ /dev/null @@ -1,351 +0,0 @@ -<?php -// +-----------------------------------------------------------------------+ -// | 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 | -// +-----------------------------------------------------------------------+ -// | branch : BSF (Best So Far) -// | file : $RCSfile$ -// | last update : $Date$ -// | last modifier : $Author$ -// | revision : $Revision$ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if(!defined("PHPWG_ROOT_PATH")) -{ - die ("Hacking attempt!"); -} -include_once(PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php'); -// +-----------------------------------------------------------------------+ -// | initialization | -// +-----------------------------------------------------------------------+ -check_cat_id($_GET['cat_id']); -$errors = array(); - -if (isset($page['cat'])) -{ -// +-----------------------------------------------------------------------+ -// | update individual options | -// +-----------------------------------------------------------------------+ - if (isset($_POST['submit'])) - { - if (isset($_POST['associate']) and $_POST['associate'] != '') - { - // does the uppercat id exists in the database ? - if (!is_numeric($_POST['associate'])) - { - array_push($errors, $lang['cat_unknown_id']); - } - else - { - $query = 'SELECT id FROM '.CATEGORIES_TABLE; - $query.= ' WHERE id = '.$_POST['associate']; - $query.= ';'; - if (mysql_num_rows(pwg_query($query)) == 0) - array_push($errors, $lang['cat_unknown_id']); - } - } - - $query = 'SELECT id,file FROM '.IMAGES_TABLE; - $query.= ' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id'; - $query.= ' WHERE category_id = '.$page['cat']; - $query.= ';'; - $result = pwg_query($query); - while ($row = mysql_fetch_array($result)) - { - $name = 'name-'.$row['id']; - $author = 'author-'.$row['id']; - $comment = 'comment-'.$row['id']; - $date_creation = 'date_creation-'.$row['id']; - $keywords = 'keywords-'.$row['id']; - if (isset($_POST[$name])) - { - $query = 'UPDATE '.IMAGES_TABLE.' SET name = '; - if ($_POST[$name] == '') - $query.= 'NULL'; - else - $query.= "'".htmlentities($_POST[$name], ENT_QUOTES)."'"; - - $query.= ', author = '; - if ($_POST[$author] == '') - $query.= 'NULL'; - else - $query.= "'".htmlentities($_POST[$author],ENT_QUOTES)."'"; - - $query.= ', comment = '; - if ($_POST[$comment] == '') - $query.= 'NULL'; - else - $query.= "'".htmlentities($_POST[$comment],ENT_QUOTES)."'"; - - $query.= ', date_creation = '; - if (check_date_format($_POST[$date_creation])) - $query.= "'".date_convert($_POST[$date_creation])."'"; - else if ($_POST[$date_creation] == '') - $query.= 'NULL'; - - $query.= ', keywords = '; - - $keywords_array = get_keywords($_POST[$keywords]); - if (count($keywords_array) == 0) $query.= 'NULL'; - else $query.= "'".implode(',', $keywords_array)."'"; - - $query.= ' WHERE id = '.$row['id']; - $query.= ';'; - pwg_query($query); - } - // add link to another category - if (isset($_POST['check-'.$row['id']]) - and isset($_POST['associate']) - and $_POST['associate'] != '') - { - $query = 'INSERT INTO '.IMAGE_CATEGORY_TABLE; - $query.= ' (image_id,category_id) VALUES'; - $query.= ' ('.$row['id'].','.$_POST['associate'].')'; - $query.= ';'; - pwg_query($query); - } - } - if (isset($_POST['associate']) and $_POST['associate'] != '') - { - update_category(array($_POST['associate'])); - } -// +-----------------------------------------------------------------------+ -// | update general options | -// +-----------------------------------------------------------------------+ - if (isset($_POST['use_common_author'])) - { - $query = 'SELECT image_id FROM '.IMAGE_CATEGORY_TABLE; - $query.= ' WHERE category_id = '.$page['cat']; - $result = pwg_query($query); - while ($row = mysql_fetch_array($result)) - { - $query = 'UPDATE '.IMAGES_TABLE; - if ($_POST['author_cat'] == '') - { - $query.= ' SET author = NULL'; - } - else - { - $query.= ' SET author = '; - $query.= "'".htmlentities($_POST['author_cat'], ENT_QUOTES)."'"; - } - $query.= ' WHERE id = '.$row['image_id']; - $query.= ';'; - pwg_query($query); - } - } - if (isset($_POST['use_common_date_creation'])) - { - if (check_date_format($_POST['date_creation_cat'])) - { - $date = date_convert($_POST['date_creation_cat']); - $query = 'SELECT image_id FROM '.IMAGE_CATEGORY_TABLE; - $query.= ' WHERE category_id = '.$page['cat']; - $result = pwg_query($query); - while ($row = mysql_fetch_array($result)) - { - $query = 'UPDATE '.IMAGES_TABLE; - if ($_POST['date_creation_cat'] == '') - { - $query.= ' SET date_creation = NULL'; - } - else - { - $query.= " SET date_creation = '".$date."'"; - } - $query.= ' WHERE id = '.$row['image_id']; - $query.= ';'; - pwg_query($query); - } - } - else - { - array_push($errors, $lang['err_date']); - } - } - if (isset($_POST['common_keywords']) and $_POST['keywords_cat'] != '') - { - $query = 'SELECT id,keywords FROM '.IMAGES_TABLE; - $query.= ' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id'; - $query.= ' WHERE category_id = '.$page['cat']; - $query.= ';'; - $result = pwg_query($query); - while ($row = mysql_fetch_array($result)) - { - if (!isset($row['keywords'])) $specific_keywords = array(); - else $specific_keywords = explode(',', $row['keywords']); - - $common_keywords = get_keywords($_POST['keywords_cat']); - // first possiblity : adding the given keywords to all the pictures - if ($_POST['common_keywords'] == 'add') - { - $keywords = array_merge($specific_keywords, $common_keywords); - $keywords = array_unique($keywords); - } - // second possiblity : removing the given keywords from all pictures - // (without deleting the other specific keywords - if ($_POST['common_keywords'] == 'remove') - { - $keywords = array_diff($specific_keywords, $common_keywords); - } - // cleaning the keywords array, sometimes, an empty value still remain - $keywords = array_remove($keywords, ''); - // updating the picture with new keywords array - $query = 'UPDATE '.IMAGES_TABLE.' SET keywords = '; - if (count($keywords) == 0) - { - $query.= 'NULL'; - } - else - { - $query.= '"'; - $i = 0; - foreach ($keywords as $keyword) { - if ($i++ > 0) $query.= ','; - $query.= $keyword; - } - $query.= '"'; - } - $query.= ' WHERE id = '.$row['id']; - $query.= ';'; - pwg_query($query); - } - } - } -// +-----------------------------------------------------------------------+ -// | form initialization | -// +-----------------------------------------------------------------------+ - if (!isset($_GET['start']) - or !is_numeric($_GET['start']) - or (is_numeric($_GET['start']) and $_GET['start'] < 0)) - { - $page['start'] = 0; - } - else - { - $page['start'] = $_GET['start']; - } - - if (isset($_GET['num']) and is_numeric($_GET['num']) and $_GET['num'] >= 0) - { - $max = $conf['info_nb_elements_page']; - $page['start'] = floor($_GET['num'] / $max) * $max; - } - // Navigation path - $current_category = get_cat_info($_GET['cat_id']); - $url = PHPWG_ROOT_PATH.'admin.php?page=infos_images&cat_id='; - $category_path = get_cat_display_name($current_category['name'], $url); - - $form_action = PHPWG_ROOT_PATH.'admin.php'; - $form_action.= '?page=infos_images&cat_id='.$_GET['cat_id']; - if($page['start']) - { - $form_action.= '&start='.$_GET['start']; - } - - $nav_bar = create_navigation_bar($form_action, - $current_category['nb_images'], - $page['start'], - $conf['info_nb_elements_page'], - ''); -// +-----------------------------------------------------------------------+ -// | template initialization | -// +-----------------------------------------------------------------------+ - $template->set_filenames(array('infos_images'=>'admin/infos_images.tpl')); - $template->assign_vars( - array( - 'CATEGORY'=>$category_path, - 'NAV_BAR'=>$nav_bar, - - 'L_INFOS_TITLE'=>$lang['infoimage_general'], - 'L_AUTHOR'=>$lang['author'], - 'L_INFOS_OVERALL_USE'=>$lang['infoimage_useforall'], - 'L_INFOS_CREATION_DATE'=>$lang['infoimage_creation_date'], - 'L_KEYWORD'=>$lang['keywords'], - 'L_KEYWORD_SEPARATION'=>$lang['infoimage_keyword_separation'], - 'L_INFOS_ADDTOALL'=>$lang['infoimage_addtoall'], - 'L_INFOS_REMOVEFROMALL'=>$lang['infoimage_removefromall'], - 'L_INFOS_DETAIL'=>$lang['infoimage_detailed'], - 'L_THUMBNAIL'=>$lang['thumbnail'], - 'L_INFOS_IMG'=>$lang['infoimage_title'], - 'L_INFOS_COMMENT'=>$lang['description'], - 'L_INFOS_ASSOCIATE'=>$lang['infoimage_associate'], - 'L_SUBMIT'=>$lang['submit'], - - 'F_ACTION'=>add_session_id($form_action) - )); -// +-----------------------------------------------------------------------+ -// | errors display | -// +-----------------------------------------------------------------------+ - if (count($errors) != 0) - { - $template->assign_block_vars('errors',array()); - foreach ($errors as $error) - { - $template->assign_block_vars('errors.error',array('ERROR'=>$error)); - } - } -// +-----------------------------------------------------------------------+ -// | form | -// +-----------------------------------------------------------------------+ - $array_cat_directories = array(); - - $pic_mod_base_url = PHPWG_ROOT_PATH.'admin.php'; - $pic_mod_base_url = '?page=picture_modify&image_id='; - - $query = ' -SELECT * - FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id - WHERE category_id = '.$page['cat'].' - '.$conf['order_by'].' - LIMIT '.$page['start'].','.$conf['info_nb_elements_page'].' -;'; - $result = pwg_query($query); - while ($row = mysql_fetch_array($result)) - { - $thumbnail_url = get_thumbnail_src($row['path'], @$row['tn_ext']); - - $template->assign_block_vars( - 'picture', - array( - 'ID_IMG'=>$row['id'], - 'URL_IMG'=>add_session_id($pic_mod_base_url.$row['id']), - 'TN_URL_IMG'=>$thumbnail_url, - 'FILENAME_IMG'=>$row['file'], - 'DEFAULTNAME_IMG'=>get_filename_wo_extension($row['file']), - 'NAME_IMG'=>@$row['name'], - 'DATE_IMG'=>date_convert_back(@$row['date_creation']), - 'AUTHOR_IMG'=>@$row['author'], - 'KEYWORDS_IMG'=>@$row['keywords'], - 'COMMENT_IMG'=>@$row['comment'] - )); - } - - // Virtualy associate a picture to a category - $query = ' -SELECT id,name,uppercats,global_rank - FROM '.CATEGORIES_TABLE.' -;'; - display_select_cat_wrapper($query, - array(), - 'associate_option', - true); -} -//----------------------------------------------------------- sending html code -$template->assign_var_from_handle('ADMIN_CONTENT', 'infos_images'); -?> diff --git a/admin/maintenance.php b/admin/maintenance.php index 935e42f0a..ec45196db 100644 --- a/admin/maintenance.php +++ b/admin/maintenance.php @@ -103,6 +103,7 @@ $template->assign_vars( 'U_MAINT_HISTORY' => add_session_id($start_url.'history'), 'U_MAINT_SESSIONS' => add_session_id($start_url.'sessions'), 'U_MAINT_FEEDS' => add_session_id($start_url.'feeds'), + 'U_HELP' => PHPWG_ROOT_PATH.'/popuphelp.php?page=maintenance', ) ); diff --git a/admin/remote_site.php b/admin/remote_site.php index 774358ddf..5044bd45a 100644 --- a/admin/remote_site.php +++ b/admin/remote_site.php @@ -512,10 +512,13 @@ $template->assign_vars( 'L_REMOTE_SITE_LOCAL_FOUND'=>$lang['remote_site_local_found'], 'L_REMOTE_SITE_LOCAL_NEW'=>$lang['remote_site_local_new'], 'L_REMOTE_SITE_LOCAL_UPDATE'=>$lang['remote_site_local_update'], + + 'U_HELP' => PHPWG_ROOT_PATH.'/popuphelp.php?page=remote_site', 'F_ACTION'=>add_session_id(PHPWG_ROOT_PATH.'admin.php?page=remote_site') ) ); + // +-----------------------------------------------------------------------+ // | new site creation form | // +-----------------------------------------------------------------------+ diff --git a/admin/update.php b/admin/update.php index b0e26a3f7..e4283a824 100644 --- a/admin/update.php +++ b/admin/update.php @@ -573,6 +573,12 @@ $template->assign_vars( 'L_USED_METADATA'=>$lang['update_used_metadata'], 'METADATA_LIST' => $used_metadata )); + +$template->assign_vars( + array( + 'U_HELP' => PHPWG_ROOT_PATH.'/popuphelp.php?page=synchronize' + ) + ); // +-----------------------------------------------------------------------+ // | introduction : choices | // +-----------------------------------------------------------------------+ diff --git a/admin/user_list.php b/admin/user_list.php index e4a4c6d7e..0671dabc3 100644 --- a/admin/user_list.php +++ b/admin/user_list.php @@ -49,10 +49,10 @@ if (isset($_POST['submit_add'])) } // +-----------------------------------------------------------------------+ -// | preferences form submission | +// | selected users | // +-----------------------------------------------------------------------+ -if (isset($_POST['pref_submit'])) +if (isset($_POST['delete']) or isset($_POST['pref_submit'])) { $collection = array(); @@ -78,116 +78,154 @@ SELECT id } } - if (count($collection) > 0) + if (count($collection) == 0) + { + array_push($page['errors'], l10n('Select at least one user')); + } +} + +// +-----------------------------------------------------------------------+ +// | delete users | +// +-----------------------------------------------------------------------+ + +if (isset($_POST['delete']) and count($collection) > 0) +{ + if (in_array($conf['webmaster_id'], $collection)) + { + array_push($page['errors'], l10n('Webmaster cannot be deleted')); + } + else { - if (-1 != $_POST['associate']) + if (isset($_POST['confirm_deletion']) and 1 == $_POST['confirm_deletion']) + { + foreach ($collection as $user_id) + { + delete_user($user_id); + } + array_push( + $page['infos'], + sprintf( + l10n('%d users deleted'), + count($collection) + ) + ); + } + else { - $datas = array(); + array_push($page['errors'], l10n('You need to confirm deletion')); + } + } +} - $query = ' +// +-----------------------------------------------------------------------+ +// | preferences form submission | +// +-----------------------------------------------------------------------+ + +if (isset($_POST['pref_submit']) and count($collection) > 0) +{ + if (-1 != $_POST['associate']) + { + $datas = array(); + + $query = ' SELECT user_id FROM '.USER_GROUP_TABLE.' WHERE group_id = '.$_POST['associate'].' ;'; - $associated = array_from_query($query, 'user_id'); - - $associable = array_diff($collection, $associated); - - if (count($associable) > 0) + $associated = array_from_query($query, 'user_id'); + + $associable = array_diff($collection, $associated); + + if (count($associable) > 0) + { + foreach ($associable as $item) { - foreach ($associable as $item) - { - array_push($datas, - array('group_id'=>$_POST['associate'], - 'user_id'=>$item)); - } - - mass_inserts(USER_GROUP_TABLE, - array('group_id', 'user_id'), - $datas); + array_push($datas, + array('group_id'=>$_POST['associate'], + 'user_id'=>$item)); } + + mass_inserts(USER_GROUP_TABLE, + array('group_id', 'user_id'), + $datas); } - - if (-1 != $_POST['dissociate']) - { - $query = ' + } + + if (-1 != $_POST['dissociate']) + { + $query = ' DELETE FROM '.USER_GROUP_TABLE.' WHERE group_id = '.$_POST['dissociate'].' AND user_id IN ('.implode(',', $collection).') '; - pwg_query($query); + pwg_query($query); + } + + // properties to set for the collection (a user list) + $datas = array(); + $dbfields = array('primary' => array('user_id'), 'update' => array()); + + $formfields = + array('nb_image_line', 'nb_line_page', 'template', 'language', + 'recent_period', 'maxwidth', 'expand', 'show_nb_comments', + 'maxheight', 'status'); + + $true_false_fields = array('expand', 'show_nb_comments'); + + foreach ($formfields as $formfield) + { + // special for true/false fields + if (in_array($formfield, $true_false_fields)) + { + $test = $formfield; + } + else + { + $test = $formfield.'_action'; } - - // properties to set for the collection (a user list) - $datas = array(); - $dbfields = array('primary' => array('user_id'), 'update' => array()); - - $formfields = - array('nb_image_line', 'nb_line_page', 'template', 'language', - 'recent_period', 'maxwidth', 'expand', 'show_nb_comments', - 'maxheight', 'status'); - - $true_false_fields = array('expand', 'show_nb_comments'); - foreach ($formfields as $formfield) + if ($_POST[$test] != 'leave') { - // special for true/false fields - if (in_array($formfield, $true_false_fields)) - { - $test = $formfield; - } - else - { - $test = $formfield.'_action'; - } - - if ($_POST[$test] != 'leave') - { - array_push($dbfields['update'], $formfield); - } + array_push($dbfields['update'], $formfield); } - - // updating elements is useful only if needed... - if (count($dbfields['update']) > 0) + } + + // updating elements is useful only if needed... + if (count($dbfields['update']) > 0) + { + $datas = array(); + + foreach ($collection as $user_id) { - $datas = array(); + $data = array(); + $data['user_id'] = $user_id; - foreach ($collection as $user_id) + // TODO : verify if submited values are semanticaly correct + foreach ($dbfields['update'] as $dbfield) { - $data = array(); - $data['user_id'] = $user_id; - - // TODO : verify if submited values are semanticaly correct - foreach ($dbfields['update'] as $dbfield) - { - // if the action is 'unset', the key won't be in row and - // mass_updates function will set this field to NULL - if (in_array($dbfield, $true_false_fields) - or 'set' == $_POST[$dbfield.'_action']) - { - $data[$dbfield] = $_POST[$dbfield]; - } - } - - // Webmaster (user_id = 1) status must not be changed - if (1 == $user_id and isset($data['status'])) + // if the action is 'unset', the key won't be in row and + // mass_updates function will set this field to NULL + if (in_array($dbfield, $true_false_fields) + or 'set' == $_POST[$dbfield.'_action']) { - $data['status'] = 'admin'; + $data[$dbfield] = $_POST[$dbfield]; } - - array_push($datas, $data); } - + + // Webmaster status must not be changed + if ($conf['webmaster_id'] == $user_id and isset($data['status'])) + { + $data['status'] = 'admin'; + } + + array_push($datas, $data); + } + // echo '<pre>'; // print_r($datas); // echo '</pre>'; - - mass_updates(USER_INFOS_TABLE, $dbfields, $datas); - } - } - else - { - array_push($page['errors'], l10n('Select at least one user')); + + mass_updates(USER_INFOS_TABLE, $dbfields, $datas); } } |