From bdceff32bcdd7a6ed72697384148577da4bc71d1 Mon Sep 17 00:00:00 2001 From: rvelices Date: Wed, 5 Apr 2006 02:01:36 +0000 Subject: image sort order for tags very minor code and language simplifications and corrections git-svn-id: http://piwigo.org/svn/trunk@1125 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions_calendar.inc.php | 5 +-- include/section_init.inc.php | 16 +++---- install/db/19-database.php | 4 +- language/en_UK.iso-8859-1/common.lang.php | 1 - .../help/notification_by_mail.html | 4 +- language/fr_FR.iso-8859-1/common.lang.php | 1 - search.php | 43 +++++-------------- template/yoga/search.tpl | 50 +++++++++++----------- 8 files changed, 48 insertions(+), 76 deletions(-) diff --git a/include/functions_calendar.inc.php b/include/functions_calendar.inc.php index f8bec93e0..1c86c679e 100644 --- a/include/functions_calendar.inc.php +++ b/include/functions_calendar.inc.php @@ -37,7 +37,6 @@ function initialize_calendar() if ($page['section']=='categories' or ( isset($page['category']) and is_numeric($page['category']) ) ) { // 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'; @@ -186,8 +185,7 @@ WHERE id IN (' . implode(',',$page['items']) .')'; { unset( $page['thumbnails_include'], - $page['items'], - $page['cat_nb_images'] + $page['items'] ); $must_show_list = false; @@ -270,7 +268,6 @@ WHERE id IN (' . implode(',',$page['items']) .')'; } $page['items'] = array_from_query($query, 'id'); - $page['cat_nb_images'] = count($page['items']); $page['thumbnails_include'] = 'include/category_default.inc.php'; } pwg_debug('end initialize_calendar'); diff --git a/include/section_init.inc.php b/include/section_init.inc.php index 176ebf0f0..e22979e69 100644 --- a/include/section_init.inc.php +++ b/include/section_init.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-2006 PhpWebGallery Team - http://phpwebgallery.net | // +-----------------------------------------------------------------------+ // | branch : BSF (Best So Far) // | file : $Id$ @@ -298,7 +298,6 @@ if ('categories' == $page['section']) 'comment' => $result['comment'], 'cat_dir' => $result['dir'], 'cat_name' => $result['name'], - 'cat_nb_images' => $result['nb_images'], 'cat_site_id' => $result['site_id'], 'cat_uploadable' => $result['uploadable'], 'cat_commentable' => $result['commentable'], @@ -364,9 +363,10 @@ else { $query = ' SELECT image_id - FROM '.IMAGE_CATEGORY_TABLE.' + FROM '.IMAGE_CATEGORY_TABLE.' INNER JOIN '.IMAGES_TABLE.' ON image_id=id WHERE image_id IN ('.implode(',', $items).') - AND '.$forbidden.' + AND '.$forbidden. + $conf['order_by'].' ;'; $items = array_unique( array_from_query($query, 'image_id') @@ -511,7 +511,6 @@ SELECT DISTINCT(id) $page, array( 'title' => $lang['recent_cats_cat'], - 'cat_nb_images' => 0, 'thumbnails_include' => 'include/category_recent_cats.inc.php', ) ); @@ -591,11 +590,6 @@ SELECT DISTINCT(id) ) ); } - - if (!isset($page['cat_nb_images'])) - { - $page['cat_nb_images'] = count($page['items']); - } } // +-----------------------------------------------------------------------+ @@ -608,6 +602,8 @@ if (isset($page['chronology_field'])) initialize_calendar(); } +$page['cat_nb_images'] = isset($page['items']) ? count($page['items']) : 0; + if (basename($_SERVER['SCRIPT_FILENAME']) == 'picture.php' and !isset($page['image_id']) ) { diff --git a/install/db/19-database.php b/install/db/19-database.php index 035aff95a..d1fdb4a74 100644 --- a/install/db/19-database.php +++ b/install/db/19-database.php @@ -80,7 +80,7 @@ while ($row = mysql_fetch_array($result)) { $tag_id[$keyword] = $current_id++; } - + if (!isset($tag_images[ $tag_id[$keyword] ])) { $tag_images[ $tag_id[$keyword] ] = array(); @@ -102,6 +102,7 @@ foreach ($tag_id as $tag_name => $tag_id) ) ); } +if (!empty($datas)) mass_inserts( PREFIX_TABLE.'tags', array_keys($datas[0]), @@ -123,6 +124,7 @@ foreach ($tag_images as $tag_id => $images) } } +if (!empty($datas)) mass_inserts( PREFIX_TABLE.'image_tag', array_keys($datas[0]), diff --git a/language/en_UK.iso-8859-1/common.lang.php b/language/en_UK.iso-8859-1/common.lang.php index 5fffbff9a..d11d4d945 100644 --- a/language/en_UK.iso-8859-1/common.lang.php +++ b/language/en_UK.iso-8859-1/common.lang.php @@ -294,7 +294,6 @@ $lang['search_date_from'] = 'Date'; $lang['search_date_to'] = 'End-Date'; $lang['search_date_type'] = 'Kind of date'; $lang['search_descending'] = 'Descending'; -$lang['search_explain'] = 'Use * as a wildcard for partial matches'; $lang['search_keywords'] = 'Search for words'; $lang['search_mode_and'] = 'Search for all terms '; $lang['search_mode_or'] = 'Search for any terms'; diff --git a/language/en_UK.iso-8859-1/help/notification_by_mail.html b/language/en_UK.iso-8859-1/help/notification_by_mail.html index 106c5a736..076bb7b34 100644 --- a/language/en_UK.iso-8859-1/help/notification_by_mail.html +++ b/language/en_UK.iso-8859-1/help/notification_by_mail.html @@ -1,6 +1,6 @@

Notification by mail

-

This screen allows to configure, to manage the notification to users of news sendinf mail.

+

This screen allows to configure and manage email notifications to users of news on your site.

This screen is composed of 3 tabs:

@@ -8,7 +8,7 @@

Available only for webmasters, this tab sets parameters of the notification by mail.

Subscribe

-

Available only for webmasters, this tab manages subscribe/unsubscribe of notification by mail.

+

Available only for webmasters, this tab manages subscription/unsubscription of users to email notifications.

Envoi

Available only for webmasters and administrators, this tab allows to send mails to notify news.

diff --git a/language/fr_FR.iso-8859-1/common.lang.php b/language/fr_FR.iso-8859-1/common.lang.php index 45e00ad2c..df9e3be66 100644 --- a/language/fr_FR.iso-8859-1/common.lang.php +++ b/language/fr_FR.iso-8859-1/common.lang.php @@ -294,7 +294,6 @@ $lang['search_date_from'] = 'Date'; $lang['search_date_to'] = 'Date de fin'; $lang['search_date_type'] = 'Type de date'; $lang['search_descending'] = 'Décroissant'; -$lang['search_explain'] = 'Utiliser * comme un joker pour une recherche partielle'; $lang['search_keywords'] = 'Recherche de mot'; $lang['search_mode_and'] = 'Rechercher tous les mots'; $lang['search_mode_or'] = 'Rechercher un des mots'; diff --git a/search.php b/search.php index 2d6ce0c8f..cc461f6df 100644 --- a/search.php +++ b/search.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-2006 PhpWebGallery Team - http://phpwebgallery.net | // +-----------------------------------------------------------------------+ // | branch : BSF (Best So Far) // | file : $RCSfile$ @@ -72,7 +72,7 @@ if (isset($_POST['submit'])) 'mode' => $_POST['tag_mode'], ); } - + if ($_POST['search_author']) { $search['fields']['author'] = array( @@ -176,32 +176,15 @@ $page['body_id'] = 'theSearchPage'; include(PHPWG_ROOT_PATH.'include/page_header.php'); $template->set_filenames( array('search'=>'search.tpl') ); -$template->assign_vars(array( - 'L_SEARCH_TITLE' => $lang['search_title'], - 'L_SEARCH_OPTIONS' => $lang['search_options'], - 'L_RETURN' => $lang['home'], - 'L_SUBMIT' => $lang['submit'], - 'L_RESET' => $lang['reset'], - 'L_SEARCH_KEYWORDS'=>$lang['search_keywords'], - 'L_SEARCH_ANY_TERMS'=>$lang['search_mode_or'], - 'L_SEARCH_ALL_TERMS'=>$lang['search_mode_and'], - 'L_SEARCH_AUTHOR'=>$lang['search_author'], - 'L_SEARCH_AUTHOR_HINT'=>$lang['search_explain'], - 'L_SEARCH_CATEGORIES'=>$lang['search_categories'], - 'L_SEARCH_SUBFORUMS'=>$lang['search_subcats_included'], - 'L_YES' => $lang['yes'], - 'L_NO' => $lang['no'], - 'L_SEARCH_DATE' => $lang['search_date'], - 'L_TODAY' => $lang['today'], - 'L_SEARCH_DATE_FROM'=>$lang['search_date_from'], - 'L_SEARCH_DATE_TO'=>$lang['search_date_to'], - 'L_DAYS'=>$lang['days'], - 'L_MONTH'=>$lang['w_month'], - 'L_SEARCH_DATE_TYPE'=>$lang['search_date_type'], - 'L_RESULT_SORT'=>$lang['search_sort'], - 'L_SORT_ASCENDING'=>$lang['search_ascending'], - 'L_SORT_DESCENDING'=>$lang['search_descending'], +$available_tags = get_available_tags( + isset($user['forbidden_categories']) + ? explode(',', $user['forbidden_categories']) + : null + ); +usort( $available_tags, 'name_compare'); + +$template->assign_vars(array( 'TODAY_DAY' => date('d', time()), 'TODAY_MONTH' => date('m', time()), 'TODAY_YEAR' => date('Y', time()), @@ -210,11 +193,7 @@ $template->assign_vars(array( 'U_HOME' => make_index_url(), 'TAG_SELECTION' => get_html_tag_selection( - get_available_tags( - isset($user['forbidden_categories']) - ? explode(',', $user['forbidden_categories']) - : null - ), + $available_tags, 'tags', isset($_POST['tags']) ? $_POST['tags'] : array() ), diff --git a/template/yoga/search.tpl b/template/yoga/search.tpl index 6a3fb9f1e..433a2d4f0 100644 --- a/template/yoga/search.tpl +++ b/template/yoga/search.tpl @@ -21,21 +21,21 @@ - - - + - + - - + - - + - + - +
{L_SEARCH_KEYWORDS} : + {lang:search_keywords} :
- {L_SEARCH_ALL_TERMS}
- {L_SEARCH_ANY_TERMS} + {lang:search_mode_and}
+ {lang:search_mode_or}
{L_SEARCH_AUTHOR} : + {lang:search_author} :
{lang:Search tags} : @@ -44,13 +44,13 @@
{L_SEARCH_DATE} : + {lang:search_date} : - + - +
{L_SEARCH_DATE_FROM} :{lang:search_date_from} :   - {L_TODAY} + {lang:today}
{L_SEARCH_DATE_TO} :{lang:search_date_to} :   - {L_TODAY} + {lang:today}
{L_SEARCH_OPTIONS}{lang:search_options}
{L_SEARCH_CATEGORIES} : + {lang:search_categories} : {L_SEARCH_SUBFORUMS} : {lang:search_subcats_included} : - {L_YES}   - {L_NO} + {lang:yes}   + {lang:no}
{L_SEARCH_DATE_TYPE} : {lang:search_date_type} : {lang:Creation date}
{lang:Post date}
{L_RESULT_SORT} : {lang:search_sort} : - {L_SORT_ASCENDING}
- {L_SORT_DESCENDING} + {lang:search_ascending}
+ {lang:search_descending}
-   - +   +
-- cgit v1.2.3