diff options
Diffstat (limited to '')
-rw-r--r-- | admin/include/functions.php | 47 | ||||
-rw-r--r-- | include/functions_html.inc.php | 12 | ||||
-rw-r--r-- | include/functions_notification.inc.php | 222 | ||||
-rw-r--r-- | include/functions_url.inc.php | 6 | ||||
-rw-r--r-- | include/section_init.inc.php | 40 | ||||
-rw-r--r-- | template/yoga/mainpage_categories.tpl | 6 | ||||
-rw-r--r-- | template/yoga/picture.tpl | 2 |
7 files changed, 158 insertions, 177 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php index 2e3b428f8..c3494d266 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -527,67 +527,54 @@ function mass_inserts($table_name, $dbfields, $datas) { // inserts all found categories $query_begin = ' - INSERT INTO '.$table_name.' - ('.implode(',', $dbfields).') - VALUES'; +INSERT INTO '.$table_name.' + ('.implode(',', $dbfields).') + VALUES'; $first = true; - $query_value = array(); - $query_value_index = 0; + $query_value = ''; foreach ($datas as $insert) { - $query_value[$query_value_index] .= ' - '; if ($first) { $first = false; - if (strlen($query_value[$query_value_index]) > 6) - { - $query_value[$query_value_index] .= ','; - } } else { - if (strlen($query_value[$query_value_index]) >= $conf['max_allowed_packet']) + if (strlen($query_value) >= $conf['max_allowed_packet']) { - $query_value_index ++; - $query_value[$query_value_index] .= ' - '; - $first = true; + pwg_query( $query_begin.$query_value ); + $query_value = ''; } else { - $query_value[$query_value_index] .= ','; + $query_value .= ','; } } - $query_value[$query_value_index] .= '('; + + $query_value .= ' + ('; + foreach ($dbfields as $field_id => $dbfield) { if ($field_id > 0) { - $query_value[$query_value_index] .= ','; + $query_value .= ','; } if (!isset($insert[$dbfield]) or $insert[$dbfield] === '') { - $query_value[$query_value_index] .= 'NULL'; + $query_value .= 'NULL'; } else { - $query_value[$query_value_index] .= "'".$insert[$dbfield]."'"; + $query_value .= "'".$insert[$dbfield]."'"; } } - $query_value[$query_value_index] .= ')'; - } - - $query_end .= ' -;'; - foreach ($query_value as $value) - { - $final_query = $query_begin.$value.$query_end; - pwg_query($final_query); + $query_value .= ')'; } + pwg_query($query_begin.$query_value); } } diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php index 53690211b..490def9ed 100644 --- a/include/functions_html.inc.php +++ b/include/functions_html.inc.php @@ -286,8 +286,7 @@ function get_cat_display_name($cat_informations, } elseif ($url == '') { - $output.= '<a class=""'; - $output.= ' href="' + $output.= '<a href="' .make_index_url( array( 'category'=>$id, @@ -299,8 +298,7 @@ function get_cat_display_name($cat_informations, } else { - $output.= '<a class=""'; - $output.= ' href="'.PHPWG_ROOT_PATH.$url.$id.'">'; + $output.= '<a href="'.PHPWG_ROOT_PATH.$url.$id.'">'; $output.= $name.'</a>'; } } @@ -368,8 +366,7 @@ SELECT id,name elseif ($url == '') { $output.= ' -<a class="" - href="' +<a href="' .make_index_url( array( 'category'=>$category_id, @@ -381,8 +378,7 @@ SELECT id,name else { $output.= ' -<a class="" - href="'.PHPWG_ROOT_PATH.$url.$category_id.'">'.$name.'</a>'; +<a href="'.PHPWG_ROOT_PATH.$url.$category_id.'">'.$name.'</a>'; } } if ($replace_space) diff --git a/include/functions_notification.inc.php b/include/functions_notification.inc.php index 78c561475..a69bd4211 100644 --- a/include/functions_notification.inc.php +++ b/include/functions_notification.inc.php @@ -2,13 +2,13 @@ // +-----------------------------------------------------------------------+ // | 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$ -// | last update : $Date: 2005-11-26 21:15:50 +0100 (sam., 26 nov. 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 958 $ +// | file : $Id$ +// | 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 | @@ -28,18 +28,18 @@ // +-----------------------------------------------------------------------+ // | functions | // +-----------------------------------------------------------------------+ -
-/*
- * get standard sql where in order to
- * restict an filter caregories and images
- *
- * IMAGE_CATEGORY_TABLE muste named ic in the query
- *
- * @param none
- *
- * @return string sql where
- */
-function get_std_sql_where_restrict_filter($prefix_condition, $force_one_condition = false)
+ +/* + * get standard sql where in order to + * restict an filter caregories and images + * + * IMAGE_CATEGORY_TABLE muste named ic in the query + * + * @param none + * + * @return string sql where + */ +function get_std_sql_where_restrict_filter($prefix_condition, $force_one_condition = false) { return get_sql_condition_FandF ( @@ -52,7 +52,7 @@ function get_std_sql_where_restrict_filter($prefix_condition, $force_one_conditi $prefix_condition, $force_one_condition ); -}
+} /* * Execute custom notification query @@ -68,7 +68,7 @@ function get_std_sql_where_restrict_filter($prefix_condition, $force_one_conditi function custom_notification_query($action, $type, $start, $end) { global $user; -
+ switch($type) { case 'new_comments': @@ -407,15 +407,15 @@ function news($start, $end, $exclude_img_cats=false, $add_url=false) if (!$exclude_img_cats) { add_news_line( $news, - nb_new_elements($start, $end), '%d new element', '%d new elements',
- get_root_url().'index.php?/recent_pics', $add_url ); + nb_new_elements($start, $end), '%d new element', '%d new elements', + make_index_url(array('section'=>'recent_pics')), $add_url ); } if (!$exclude_img_cats) { add_news_line( $news, - nb_updated_categories($start, $end), '%d category updated', '%d categories updated',
- get_root_url().'/index.php?/recent_cats', $add_url ); + nb_updated_categories($start, $end), '%d category updated', '%d categories updated', + make_index_url(array('section'=>'recent_cats')), $add_url ); } add_news_line( $news, @@ -448,7 +448,7 @@ function news($start, $end, $exclude_img_cats=false, $add_url=false) */ function get_recent_post_dates($max_dates, $max_elements, $max_cats) { - global $conf, $user;
+ global $conf, $user; $where_sql = get_std_sql_where_restrict_filter('WHERE', true); @@ -510,92 +510,92 @@ SELECT DISTINCT c.uppercats, COUNT(DISTINCT i.id) img_count } } return $dates; -}
-
-/**
- * returns html description about recently published elements grouped by post date
- * @param $date_detail: selected date computed by get_recent_post_dates function
- */
-function get_html_description_recent_post_date($date_detail)
-{
- global $conf;
-
- $description = '';
-
- $description .=
- '<li>'
- .l10n_dec('%d new element', '%d new elements', $date_detail['nb_elements'])
- .' ('
- .'<a href="'.make_index_url(array('section'=>'recent_pics')).'">'
- .l10n('recent_pics_cat').'</a>'
- .')'
- .'</li><br/>';
-
- foreach($date_detail['elements'] as $element)
- {
- $tn_src = get_thumbnail_url($element);
- $description .= '<img src="'.$tn_src.'"/>';
- }
- $description .= '...<br/>';
-
- $description .=
- '<li>'
- .l10n_dec('%d category updated', '%d categories updated',
- $date_detail['nb_cats'])
- .'</li>';
-
- $description .= '<ul>';
- foreach($date_detail['categories'] as $cat)
- {
- $description .=
- '<li>'
- .get_cat_display_name_cache($cat['uppercats'])
- .' ('.
- l10n_dec('%d new element',
- '%d new elements', $cat['img_count']).')'
- .'</li>';
- }
- $description .= '</ul>';
-
- return $description;
-}
-
-/**
- * explodes a MySQL datetime format (2005-07-14 23:01:37) in fields "year",
- * "month", "day", "hour", "minute", "second".
- *
- * @param string mysql datetime format
- * @return array
- */
-function explode_mysqldt($mysqldt)
-{
- $date = array();
- list($date['year'],
- $date['month'],
- $date['day'],
- $date['hour'],
- $date['minute'],
- $date['second'])
- = preg_split('/[-: ]/', $mysqldt);
-
- return $date;
-}
-
-/**
- * returns title about recently published elements grouped by post date
- * @param $date_detail: selected date computed by get_recent_post_dates function
- */
-function get_title_recent_post_date($date_detail)
-{
- global $lang;
-
- $date = $date_detail['date_available'];
- $exploded_date = explode_mysqldt($date);
-
- $title = l10n_dec('%d new element', '%d new elements', $date_detail['nb_elements']);
- $title .= ' ('.$lang['month'][(int)$exploded_date['month']].' '.$exploded_date['day'].')';
-
- return $title;
-}
+} + +/** + * returns html description about recently published elements grouped by post date + * @param $date_detail: selected date computed by get_recent_post_dates function + */ +function get_html_description_recent_post_date($date_detail) +{ + global $conf; + + $description = ''; + + $description .= + '<li>' + .l10n_dec('%d new element', '%d new elements', $date_detail['nb_elements']) + .' (' + .'<a href="'.make_index_url(array('section'=>'recent_pics')).'">' + .l10n('recent_pics_cat').'</a>' + .')' + .'</li><br/>'; + + foreach($date_detail['elements'] as $element) + { + $tn_src = get_thumbnail_url($element); + $description .= '<img src="'.$tn_src.'"/>'; + } + $description .= '...<br/>'; + + $description .= + '<li>' + .l10n_dec('%d category updated', '%d categories updated', + $date_detail['nb_cats']) + .'</li>'; + + $description .= '<ul>'; + foreach($date_detail['categories'] as $cat) + { + $description .= + '<li>' + .get_cat_display_name_cache($cat['uppercats']) + .' ('. + l10n_dec('%d new element', + '%d new elements', $cat['img_count']).')' + .'</li>'; + } + $description .= '</ul>'; + + return $description; +} + +/** + * explodes a MySQL datetime format (2005-07-14 23:01:37) in fields "year", + * "month", "day", "hour", "minute", "second". + * + * @param string mysql datetime format + * @return array + */ +function explode_mysqldt($mysqldt) +{ + $date = array(); + list($date['year'], + $date['month'], + $date['day'], + $date['hour'], + $date['minute'], + $date['second']) + = preg_split('/[-: ]/', $mysqldt); + + return $date; +} + +/** + * returns title about recently published elements grouped by post date + * @param $date_detail: selected date computed by get_recent_post_dates function + */ +function get_title_recent_post_date($date_detail) +{ + global $lang; + + $date = $date_detail['date_available']; + $exploded_date = explode_mysqldt($date); + + $title = l10n_dec('%d new element', '%d new elements', $date_detail['nb_elements']); + $title .= ' ('.$lang['month'][(int)$exploded_date['month']].' '.$exploded_date['day'].')'; + + return $title; +} ?>
\ No newline at end of file diff --git a/include/functions_url.inc.php b/include/functions_url.inc.php index 2a567e8c5..b95284746 100644 --- a/include/functions_url.inc.php +++ b/include/functions_url.inc.php @@ -1,10 +1,10 @@ <?php // +-----------------------------------------------------------------------+ // | PhpWebGallery - a PHP based picture gallery | -// | 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$ +// | file : $Id$ // | last update : $Date$ // | last modifier : $Author$ // | revision : $Revision$ @@ -271,7 +271,7 @@ function add_well_known_params_in_url($url, $params) if (isset($params['flat_cat'])) { - $url.= '/flat_cat'; + $url.= '/flat'; } if (isset($params['start']) and $params['start'] > 0) diff --git a/include/section_init.inc.php b/include/section_init.inc.php index 78ec73fa0..378fd539b 100644 --- a/include/section_init.inc.php +++ b/include/section_init.inc.php @@ -128,7 +128,7 @@ if (script_basename() == 'picture') // basename without file extention } } -if (0 === strpos($tokens[$next_token], 'categor')) +if (0 === strpos(@$tokens[$next_token], 'categor')) { $page['section'] = 'categories'; $next_token++; @@ -140,7 +140,7 @@ if (0 === strpos($tokens[$next_token], 'categor')) $next_token++; } } -else if (0 === strpos($tokens[$next_token], 'tag')) +else if (0 === strpos(@$tokens[$next_token], 'tag')) { $page['section'] = 'tags'; $page['tags'] = array(); @@ -201,32 +201,32 @@ SELECT name, url_name, id page_not_found('Requested tag does not exist', get_root_url().'tags.php' ); } } -else if (0 === strpos($tokens[$next_token], 'fav')) +else if (0 === strpos(@$tokens[$next_token], 'fav')) { $page['section'] = 'favorites'; $next_token++; } -else if ('most_visited' == $tokens[$next_token]) +else if ('most_visited' == @$tokens[$next_token]) { $page['section'] = 'most_visited'; $next_token++; } -else if ('best_rated' == $tokens[$next_token]) +else if ('best_rated' == @$tokens[$next_token]) { $page['section'] = 'best_rated'; $next_token++; } -else if ('recent_pics' == $tokens[$next_token]) +else if ('recent_pics' == @$tokens[$next_token]) { $page['section'] = 'recent_pics'; $next_token++; } -else if ('recent_cats' == $tokens[$next_token]) +else if ('recent_cats' == @$tokens[$next_token]) { $page['section'] = 'recent_cats'; $next_token++; } -else if ('search' == $tokens[$next_token]) +else if ('search' == @$tokens[$next_token]) { $page['section'] = 'search'; $next_token++; @@ -239,7 +239,7 @@ else if ('search' == $tokens[$next_token]) $page['search'] = $matches[1]; $next_token++; } -else if ('list' == $tokens[$next_token]) +else if ('list' == @$tokens[$next_token]) { $page['section'] = 'list'; $next_token++; @@ -268,7 +268,12 @@ else if ('list' == $tokens[$next_token]) } else { - if (!empty($conf['random_index_redirect'])) + $page['section'] = 'categories'; + if (script_basename() == 'picture') + {//access a picture only by id, file or id-file without given section + $page['flat_cat'] = true; + } + elseif (!empty($conf['random_index_redirect']) and empty($tokens[$next_token]) ) { $random_index_redirect = array(); foreach ($conf['random_index_redirect'] as $random_url => $random_url_condition) @@ -278,15 +283,10 @@ else $random_index_redirect[] = $random_url; } } - } - - if (!empty($random_index_redirect)) - { - redirect($random_index_redirect[mt_rand(0, count($random_index_redirect)-1)]); - } - else - { - $page['section'] = 'categories'; + if (!empty($random_index_redirect)) + { + redirect($random_index_redirect[mt_rand(0, count($random_index_redirect)-1)]); + } } } @@ -300,7 +300,7 @@ while (isset($tokens[$i])) } if ('categories' == $page['section'] and - 'flat_cat' == $tokens[$i]) + 'flat' == $tokens[$i]) { // indicate a special list of images $page['flat_cat'] = true; diff --git a/template/yoga/mainpage_categories.tpl b/template/yoga/mainpage_categories.tpl index ab61b52e3..4d8efdd93 100644 --- a/template/yoga/mainpage_categories.tpl +++ b/template/yoga/mainpage_categories.tpl @@ -6,9 +6,7 @@ <div class="thumbnailCategory"> <div class="illustration"> <a href="{categories.category.URL}"> - <img src="{categories.category.SRC}" - alt="{categories.category.ALT}" - title="{categories.category.TITLE}"> + <img src="{categories.category.SRC}" alt="{categories.category.ALT}" title="{categories.category.TITLE}"> </a> </div> <div class="description"> @@ -17,7 +15,7 @@ {categories.category.ICON} </h3> <p>{categories.category.CAPTION_NB_IMAGES}</p> - <p>{categories.category.DESCRIPTION} </p> <!-- to avoid a HTML warning --> + <p>{categories.category.DESCRIPTION} </p> </div> </div> </li> diff --git a/template/yoga/picture.tpl b/template/yoga/picture.tpl index c90271b07..c82571830 100644 --- a/template/yoga/picture.tpl +++ b/template/yoga/picture.tpl @@ -204,7 +204,7 @@ <!-- END author_field --> <label>{lang:comment}<textarea name="content" rows="5" cols="80">{comments.add_comment.CONTENT}</textarea></label> <input type="hidden" name="key" value="{comments.add_comment.KEY}" /> - <input class="submit" type="submit" class="submit" value="{lang:submit}"> + <input class="submit" type="submit" value="{lang:submit}"> </fieldset> </form> <!-- END add_comment --> |