From b15c91743dcf2ee0ad1717f8bd0fce6aa1969c81 Mon Sep 17 00:00:00 2001 From: plegall Date: Sat, 14 May 2005 13:39:00 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'release-1_4_1'. git-svn-id: http://piwigo.org/svn/tags/release-1_4_1@790 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/cat_list.php | 2 +- admin/configuration.php | 26 ++++++++++++++---- admin/picture_modify.php | 28 ++++++++++++++++++- admin/update.php | 56 ++++++++++++++++++++++++++++++++++++++ category.php | 17 +++++++----- include/category_calendar.inc.php | 2 +- include/config.inc.php | 4 +++ include/constants.php | 2 +- include/functions.inc.php | 8 +++--- include/functions_category.inc.php | 2 +- include/page_tail.php | 2 +- search.php | 3 +- tools/create_listing_file.php | 2 +- 13 files changed, 129 insertions(+), 25 deletions(-) diff --git a/admin/cat_list.php b/admin/cat_list.php index b5b4a6852..55d34ff18 100644 --- a/admin/cat_list.php +++ b/admin/cat_list.php @@ -329,7 +329,7 @@ else $template->assign_vars(array( 'CATEGORIES_NAV'=>$navigation, 'NEXT_RANK'=>$next_rank, - 'F_ACTION'=>$form_action, + 'F_ACTION'=>add_session_id($form_action), 'L_ADD_VIRTUAL'=>$lang['cat_add'], 'L_SUBMIT'=>$lang['submit'], diff --git a/admin/configuration.php b/admin/configuration.php index 9b3ca801a..35e92c5b9 100644 --- a/admin/configuration.php +++ b/admin/configuration.php @@ -66,12 +66,8 @@ if (isset($_POST['submit'])) { array_push($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($errors, $lang['conf_mail_webmaster_error']); - } + // as webmaster mail address shown on the website, it can be obfuscated + // and no comply with normal mail address pattern break; } case 'comments' : @@ -94,6 +90,22 @@ if (isset($_POST['submit'])) { array_push($errors, $lang['periods_error']); } + // maxwidth + if (isset($_POST['default_maxwidth']) + and !empty($_POST['default_maxwidth']) + and (!preg_match($int_pattern, $_POST['default_maxwidth']) + or $_POST['default_maxwidth'] < 50)) + { + array_push($errors, $lang['maxwidth_error']); + } + // maxheight + if (isset($_POST['default_maxheight']) + and !empty($_POST['default_maxheight']) + and (!preg_match($int_pattern, $_POST['default_maxheight']) + or $_POST['default_maxheight'] < 50)) + { + array_push($errors, $lang['maxheight_error']); + } break; } case 'upload' : @@ -255,6 +267,8 @@ switch ($page['section']) 'CONF_STYLE_SELECT'=>style_select($conf['default_template'], 'default_template'), 'CONF_RECENT'=>$conf['recent_period'], 'NB_COMMENTS_PAGE'=>$conf['nb_comment_page'], + 'MAXWIDTH'=>$conf['default_maxwidth'], + 'MAXHEIGHT'=>$conf['default_maxheight'], 'EXPAND_YES'=>$expand_yes, 'EXPAND_NO'=>$expand_no, 'SHOW_COMMENTS_YES'=>$show_yes, diff --git a/admin/picture_modify.php b/admin/picture_modify.php index fc2e2eb51..fffb6ff5c 100644 --- a/admin/picture_modify.php +++ b/admin/picture_modify.php @@ -159,7 +159,33 @@ else $thumbnail_url = get_thumbnail_src($row['path'], @$row['tn_ext']); $url_img = PHPWG_ROOT_PATH.'picture.php?image_id='.$_GET['image_id']; -$url_img .= '&cat='.$row['storage_category_id']; + +$query = ' +SELECT category_id + FROM '.IMAGE_CATEGORY_TABLE.' + WHERE image_id = '.$_GET['image_id']; + +if (isset($user['forbidden_categories']) + and !empty($user['forbidden_categories'])) +{ + $query.= ' + AND category_id NOT IN ('.$user['forbidden_categories'].')'; +} +$query.= ' + ORDER BY RAND() +;'; +$result = pwg_query($query); + +if (mysql_num_rows($result) > 0) +{ + list($category_id) = mysql_fetch_array($result); + $url_img .= '&cat='.$category_id; +} +else +{ + $url_img .= '&cat='.$row['storage_category_id']; +} + $date = isset($_POST['date_creation']) && empty($errors) ?$_POST['date_creation']:date_convert_back(@$row['date_creation']); diff --git a/admin/update.php b/admin/update.php index 56843d21a..59e748198 100644 --- a/admin/update.php +++ b/admin/update.php @@ -453,6 +453,62 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id echo ''."\n"; + + // retrieving informations given by uploaders + if (!$simulate) + { + $query = ' +SELECT id,file,storage_category_id,infos + FROM '.WAITING_TABLE.' + WHERE storage_category_id IN ( +'.wordwrap(implode(', ', $cat_ids), 80, "\n").') + AND validated = \'true\' +;'; + $result = pwg_query($query); + + $datas = array(); + $fields = + array( + 'primary' => array('id'), + 'update' => array('date_creation', 'author', 'name', 'comment') + ); + + $waiting_to_delete = array(); + + while ($row = mysql_fetch_array($result)) + { + $data = array(); + + $query = ' +SELECT id + FROM '.IMAGES_TABLE.' + WHERE storage_category_id = \''.$row['storage_category_id'].'\' + AND file = \''.$row['file'].'\' +;'; + list($data['id']) = mysql_fetch_array(pwg_query($query)); + + foreach ($fields['update'] as $field) + { + $data[$field] = getAttribute($row['infos'], $field); + } + + array_push($datas, $data); + array_push($waiting_to_delete, $row['id']); + } + + if (count($datas) > 0) + { + mass_updates(IMAGES_TABLE, $fields, $datas); + + // delete now useless waiting elements + $query = ' +DELETE + FROM '.WAITING_TABLE.' + WHERE id IN ('.implode(',', $waiting_to_delete).') +;'; + pwg_query($query); + } + } } // +-----------------------------------------------------------------------+ // | template initialization | diff --git a/category.php b/category.php index 09decc08a..ebb485db7 100644 --- a/category.php +++ b/category.php @@ -183,13 +183,16 @@ $template->assign_block_vars( 'NAME' => $lang['most_visited_cat'] )); // best rated -$template->assign_block_vars( - 'special_cat', - array( - 'URL' => add_session_id(PHPWG_ROOT_PATH.'category.php?cat=best_rated'), - 'TITLE' => $lang['best_rated_cat_hint'], - 'NAME' => $lang['best_rated_cat'] - )); +if ($conf['rate']) +{ + $template->assign_block_vars( + 'special_cat', + array( + 'URL' => add_session_id(PHPWG_ROOT_PATH.'category.php?cat=best_rated'), + 'TITLE' => $lang['best_rated_cat_hint'], + 'NAME' => $lang['best_rated_cat'] + )); +} // random $template->assign_block_vars( 'special_cat', diff --git a/include/category_calendar.inc.php b/include/category_calendar.inc.php index fd6c11861..2f57edaab 100644 --- a/include/category_calendar.inc.php +++ b/include/category_calendar.inc.php @@ -406,7 +406,7 @@ SELECT file,tn_ext,'.$conf['calendar_datefield'].',path $url_link.= '&search='.$conf['calendar_datefield'].':'.$_GET['day']; if ($calendar_category != 0) { - $url_link.= ';cat:'.$calendar_category.'|AND'; + $url_link.= '--cat:'.$calendar_category.'|AND'; } $template->assign_block_vars( diff --git a/include/config.inc.php b/include/config.inc.php index c9c23b0e5..b13f1d6c7 100644 --- a/include/config.inc.php +++ b/include/config.inc.php @@ -191,4 +191,8 @@ $conf['tn_width'] = 128; // tn_height : default height for thumbnails creation $conf['tn_height'] = 96; + +// show_version : shall the version of PhpWebGallery be displayed at the +// bottom of each page ? +$conf['show_version'] = false; ?> diff --git a/include/constants.php b/include/constants.php index 944bacca6..65a1dd91c 100644 --- a/include/constants.php +++ b/include/constants.php @@ -26,7 +26,7 @@ // +-----------------------------------------------------------------------+ // Default settings -define('PHPWG_VERSION', '1.4.0RC3'); +define('PHPWG_VERSION', '1.4.1'); define('PHPWG_URL', 'http://www.phpwebgallery.net'); define('PHPWG_FORUM_URL', 'http://forum.phpwebgallery.net'); diff --git a/include/functions.inc.php b/include/functions.inc.php index edc9f2062..80399ce87 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -340,11 +340,11 @@ INSERT INTO '.HISTORY_TABLE.' (date,login,IP,file,category,picture) VALUES (NOW(), - \''.(($user['id'] == 2) ? 'guest' : $user['username']).'\', + \''.(($user['id'] == 2) ? 'guest' : addslashes($user['username'])).'\', \''.$_SERVER['REMOTE_ADDR'].'\', - \''.$file.'\', - \''.$category.'\', - \''.$picture.'\') + \''.addslashes($file).'\', + \''.addslashes($category).'\', + \''.addslashes($picture).'\') ;'; pwg_query($query); } diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php index 9c4e1ebab..9d946df4f 100644 --- a/include/functions_category.inc.php +++ b/include/functions_category.inc.php @@ -389,7 +389,7 @@ function initialize_category( $calling_page = 'category' ) $search['mode'] = 'OR'; } - $search_tokens = explode(';', $tokens[0]); + $search_tokens = explode('--', $tokens[0]); foreach ($search_tokens as $search_token) { $tokens = explode(':', $search_token); diff --git a/include/page_tail.php b/include/page_tail.php index 910516dcc..5e4a977e6 100644 --- a/include/page_tail.php +++ b/include/page_tail.php @@ -28,7 +28,7 @@ $template->set_filenames(array('tail'=>'footer.tpl')); $template->assign_vars( array( - 'VERSION' => PHPWG_VERSION, + 'VERSION' => $conf['show_version'] ? PHPWG_VERSION : '', 'MAIL'=>$conf['mail_webmaster'], 'L_GEN_TIME' => $lang['generation_time'], diff --git a/search.php b/search.php index 4bf65c5be..3126b8462 100644 --- a/search.php +++ b/search.php @@ -114,7 +114,7 @@ if (isset($_POST['submit'])) } array_push($tokens, $token); } - $search_string.= implode(';', $tokens); + $search_string.= implode('--', $tokens); if (count($tokens) > 1) { $search_string.= '|AND'; @@ -204,6 +204,7 @@ include(PHPWG_ROOT_PATH.'include/page_header.php'); $template->set_filenames( array('search'=>'search.tpl') ); $template->assign_vars(array( + 'L_RETURN_HINT' => $lang['home_hint'], 'L_SEARCH_TITLE' => $lang['search_title'], 'L_SEARCH_OPTIONS' => $lang['search_options'], 'L_RETURN' => $lang['home'], diff --git a/tools/create_listing_file.php b/tools/create_listing_file.php index 81f55ef29..ce71dd65f 100644 --- a/tools/create_listing_file.php +++ b/tools/create_listing_file.php @@ -42,7 +42,7 @@ $conf['picture_ext'] = array('jpg','JPG','png','PNG','gif','GIF'); // $conf['version'] is used to verify the compatibility of the generated // listing.xml file and the PhpWebGallery version you're running -$conf['version'] = '1.4.0RC3'; +$conf['version'] = '1.4.1'; // $conf['use_exif'] set to true if you want to use Exif Date as "creation // date" for the element, otherwise, set to false -- cgit v1.2.3