2004-08-06 11:35:07 +02:00
|
|
|
<?php
|
|
|
|
// +-----------------------------------------------------------------------+
|
2004-11-06 22:12:59 +01:00
|
|
|
// | PhpWebGallery - a PHP based picture gallery |
|
|
|
|
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
|
|
|
|
// | Copyright (C) 2003-2004 PhpWebGallery Team - http://phpwebgallery.net |
|
2004-08-06 11:35:07 +02:00
|
|
|
// +-----------------------------------------------------------------------+
|
2004-11-06 22:12:59 +01:00
|
|
|
// | branch : BSF (Best So Far)
|
2004-08-06 11:35:07 +02:00
|
|
|
// | 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. |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
|
|
|
function get_icon( $date )
|
|
|
|
{
|
|
|
|
global $user, $conf, $lang;
|
|
|
|
|
2004-08-21 15:50:54 +02:00
|
|
|
if (!preg_match('/\d{4}-\d{2}-\d{2}/', $date))
|
|
|
|
{
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
2004-08-06 11:35:07 +02:00
|
|
|
list( $year,$month,$day ) = explode( '-', $date );
|
|
|
|
$unixtime = mktime( 0, 0, 0, $month, $day, $year );
|
|
|
|
|
|
|
|
$diff = time() - $unixtime;
|
|
|
|
$day_in_seconds = 24*60*60;
|
|
|
|
$output = '';
|
|
|
|
$title = $lang['recent_image'].' ';
|
|
|
|
if ( $diff < $user['recent_period'] * $day_in_seconds )
|
|
|
|
{
|
|
|
|
$icon_url = './template/'.$user['template'].'/theme/';
|
|
|
|
$icon_url.= 'recent.gif';
|
|
|
|
$title .= $user['recent_period'];
|
|
|
|
$title .= ' '.$lang['days'];
|
|
|
|
$size = getimagesize( $icon_url );
|
|
|
|
$output = '<img title="'.$title.'" src="'.$icon_url.'" style="border:0;';
|
|
|
|
$output.= 'height:'.$size[1].'px;width:'.$size[0].'px" alt="" />';
|
|
|
|
}
|
|
|
|
return $output;
|
|
|
|
}
|
|
|
|
|
2004-12-13 23:54:44 +01:00
|
|
|
function create_navigation_bar($url, $nb_element, $start,
|
|
|
|
$nb_element_page, $link_class)
|
2004-08-06 11:35:07 +02:00
|
|
|
{
|
2004-12-13 23:54:44 +01:00
|
|
|
global $lang, $conf;
|
|
|
|
|
|
|
|
$pages_around = $conf['paginate_pages_around'];
|
|
|
|
|
2004-12-13 23:59:25 +01:00
|
|
|
$navbar = '';
|
2004-12-13 23:54:44 +01:00
|
|
|
|
|
|
|
// current page detection
|
|
|
|
if (!isset($start)
|
|
|
|
or !is_numeric($start)
|
|
|
|
or (is_numeric($start) and $start < 0))
|
2004-08-06 11:35:07 +02:00
|
|
|
{
|
|
|
|
$start = 0;
|
|
|
|
}
|
2004-12-13 23:54:44 +01:00
|
|
|
|
|
|
|
// navigation bar useful only if more than one page to display !
|
|
|
|
if ($nb_element > $nb_element_page)
|
2004-08-06 11:35:07 +02:00
|
|
|
{
|
2004-12-13 23:59:25 +01:00
|
|
|
// current page and last page
|
2004-12-13 23:54:44 +01:00
|
|
|
$cur_page = ceil($start / $nb_element_page) + 1;
|
|
|
|
$maximum = ceil($nb_element / $nb_element_page);
|
|
|
|
|
|
|
|
// link to first page ?
|
|
|
|
if ($cur_page != 1)
|
|
|
|
{
|
2004-12-13 23:59:25 +01:00
|
|
|
$navbar.= '<a href="';
|
|
|
|
$navbar.= add_session_id($url.'&start=0');
|
|
|
|
$navbar.= '" class="'.$link_class.'">'.$lang['first_page'];
|
|
|
|
$navbar.= '</a>';
|
2004-12-13 23:54:44 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-12-13 23:59:25 +01:00
|
|
|
$navbar.= $lang['first_page'];
|
2004-12-13 23:54:44 +01:00
|
|
|
}
|
2004-12-13 23:59:25 +01:00
|
|
|
$navbar.= ' | ';
|
2004-12-13 23:54:44 +01:00
|
|
|
// link on previous page ?
|
2004-08-06 11:35:07 +02:00
|
|
|
if ( $start != 0 )
|
|
|
|
{
|
|
|
|
$previous = $start - $nb_element_page;
|
2004-12-13 23:59:25 +01:00
|
|
|
$navbar.= '<a href="';
|
|
|
|
$navbar.= add_session_id( $url.'&start='.$previous );
|
|
|
|
$navbar.= '" class="'.$link_class.'">'.$lang['previous_page'];
|
|
|
|
$navbar.= '</a>';
|
2004-08-06 11:35:07 +02:00
|
|
|
}
|
2004-12-13 23:54:44 +01:00
|
|
|
else
|
|
|
|
{
|
2004-12-13 23:59:25 +01:00
|
|
|
$navbar.= $lang['previous_page'];
|
2004-12-13 23:54:44 +01:00
|
|
|
}
|
2004-12-13 23:59:25 +01:00
|
|
|
$navbar.= ' | ';
|
2004-12-13 23:54:44 +01:00
|
|
|
|
|
|
|
if ($cur_page > $pages_around + 1)
|
|
|
|
{
|
2004-12-13 23:59:25 +01:00
|
|
|
$navbar.= ' <a href="';
|
|
|
|
$navbar.= add_session_id($url.'&start=0');
|
|
|
|
$navbar.= '" class="'.$link_class.'">1</a> ...';
|
2004-12-13 23:54:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// inspired from punbb source code
|
|
|
|
for ($i = $cur_page - $pages_around, $stop = $cur_page + $pages_around + 1;
|
|
|
|
$i < $stop;
|
|
|
|
$i++)
|
2004-08-06 11:35:07 +02:00
|
|
|
{
|
2004-12-13 23:54:44 +01:00
|
|
|
if ($i < 1 or $i > $maximum)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if ($i != $cur_page)
|
2004-08-06 11:35:07 +02:00
|
|
|
{
|
2004-12-13 23:54:44 +01:00
|
|
|
$temp_start = ($i - 1) * $nb_element_page;
|
2004-12-13 23:59:25 +01:00
|
|
|
$navbar.= ' <a href="';
|
|
|
|
$navbar.= add_session_id($url.'&start='.$temp_start);
|
|
|
|
$navbar.= '" class="'.$link_class.'">'.$i.'</a>';
|
2004-08-06 11:35:07 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-12-13 23:59:25 +01:00
|
|
|
$navbar.= ' <span class="pageNumberSelected">';
|
|
|
|
$navbar.= $i.'</span>';
|
2004-08-06 11:35:07 +02:00
|
|
|
}
|
|
|
|
}
|
2004-12-13 23:54:44 +01:00
|
|
|
|
|
|
|
if ($cur_page < ($maximum - $pages_around))
|
|
|
|
{
|
|
|
|
$temp_start = ($maximum - 1) * $nb_element_page;
|
2004-12-13 23:59:25 +01:00
|
|
|
$navbar.= ' ... <a href="';
|
|
|
|
$navbar.= add_session_id($url.'&start='.$temp_start);
|
|
|
|
$navbar.= '" class="'.$link_class.'">'.$maximum.'</a>';
|
2004-12-13 23:54:44 +01:00
|
|
|
}
|
|
|
|
|
2004-12-13 23:59:25 +01:00
|
|
|
$navbar.= ' | ';
|
2004-12-13 23:54:44 +01:00
|
|
|
// link on next page ?
|
2004-08-06 11:35:07 +02:00
|
|
|
if ( $nb_element > $nb_element_page
|
|
|
|
&& $start + $nb_element_page < $nb_element )
|
|
|
|
{
|
|
|
|
$next = $start + $nb_element_page;
|
2004-12-13 23:59:25 +01:00
|
|
|
$navbar.= '<a href="';
|
|
|
|
$navbar.= add_session_id( $url.'&start='.$next );
|
|
|
|
$navbar.= '" class="'.$link_class.'">'.$lang['next_page'].'</a>';
|
2004-08-06 11:35:07 +02:00
|
|
|
}
|
2004-12-13 23:54:44 +01:00
|
|
|
else
|
|
|
|
{
|
2004-12-13 23:59:25 +01:00
|
|
|
$navbar.= $lang['next_page'];
|
2004-12-13 23:54:44 +01:00
|
|
|
}
|
|
|
|
// link to last page ?
|
|
|
|
if ($cur_page != $maximum)
|
|
|
|
{
|
|
|
|
$temp_start = ($maximum - 1) * $nb_element_page;
|
2004-12-13 23:59:25 +01:00
|
|
|
$navbar.= ' | ';
|
|
|
|
$navbar.= '<a href="';
|
|
|
|
$navbar.= add_session_id($url.'&start='.$temp_start);
|
|
|
|
$navbar.= '" class="'.$link_class.'">'.$lang['last_page'];
|
|
|
|
$navbar.= '</a>';
|
2004-12-13 23:54:44 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-12-13 23:59:25 +01:00
|
|
|
$navbar.= $lang['last_page'];
|
2004-12-13 23:54:44 +01:00
|
|
|
}
|
2004-08-06 11:35:07 +02:00
|
|
|
}
|
2004-12-13 23:59:25 +01:00
|
|
|
return $navbar;
|
2004-08-06 11:35:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Pick a language, any language ...
|
|
|
|
//
|
|
|
|
function language_select($default, $select_name = "language")
|
|
|
|
{
|
- in admin/configuration, add new step with "sections" (general, comments,
default, upload, metadata, sessions)
- admin/configuration.php and its template have been higly simplificated by
making things more generic : for example, for each configuration
parameter, its name must correspond to the name we find in the config
table and belongs to a section, in the lang array we find :
- $lang['conf_<section>_<param>']
- $lang['conf_<section>_<param>_info']
- $lang['conf_<section>_<param>_error'] optionnaly
- more described message when connection to database server is impossible
- redefinitions of get_languages and get_templates functions
- deletion of configuration parameters : webmaster, session_keyword
- rename of configuration parameters :
- default_lang => default_language
- default_style => default_template
git-svn-id: http://piwigo.org/svn/trunk@512 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-09-03 17:01:05 +02:00
|
|
|
$available_lang = get_languages();
|
2004-08-06 11:35:07 +02:00
|
|
|
|
|
|
|
$lang_select = '<select name="' . $select_name . '" onchange="this.form.submit()">';
|
2004-09-20 22:08:15 +02:00
|
|
|
foreach ($available_lang as $code => $displayname)
|
2004-08-06 11:35:07 +02:00
|
|
|
{
|
|
|
|
$selected = ( strtolower($default) == strtolower($code) ) ? ' selected="selected"' : '';
|
|
|
|
$lang_select .= '<option value="' . $code . '"' . $selected . '>' . ucwords($displayname) . '</option>';
|
|
|
|
}
|
|
|
|
$lang_select .= '</select>';
|
|
|
|
|
|
|
|
return $lang_select;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Pick a template/theme combo,
|
|
|
|
//
|
|
|
|
function style_select($default_style, $select_name = "style")
|
|
|
|
{
|
- in admin/configuration, add new step with "sections" (general, comments,
default, upload, metadata, sessions)
- admin/configuration.php and its template have been higly simplificated by
making things more generic : for example, for each configuration
parameter, its name must correspond to the name we find in the config
table and belongs to a section, in the lang array we find :
- $lang['conf_<section>_<param>']
- $lang['conf_<section>_<param>_info']
- $lang['conf_<section>_<param>_error'] optionnaly
- more described message when connection to database server is impossible
- redefinitions of get_languages and get_templates functions
- deletion of configuration parameters : webmaster, session_keyword
- rename of configuration parameters :
- default_lang => default_language
- default_style => default_template
git-svn-id: http://piwigo.org/svn/trunk@512 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-09-03 17:01:05 +02:00
|
|
|
$templates = get_templates();
|
|
|
|
|
2004-09-07 22:10:36 +02:00
|
|
|
$style_selected = '<select name="' . $select_name . '" >';
|
- in admin/configuration, add new step with "sections" (general, comments,
default, upload, metadata, sessions)
- admin/configuration.php and its template have been higly simplificated by
making things more generic : for example, for each configuration
parameter, its name must correspond to the name we find in the config
table and belongs to a section, in the lang array we find :
- $lang['conf_<section>_<param>']
- $lang['conf_<section>_<param>_info']
- $lang['conf_<section>_<param>_error'] optionnaly
- more described message when connection to database server is impossible
- redefinitions of get_languages and get_templates functions
- deletion of configuration parameters : webmaster, session_keyword
- rename of configuration parameters :
- default_lang => default_language
- default_style => default_template
git-svn-id: http://piwigo.org/svn/trunk@512 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-09-03 17:01:05 +02:00
|
|
|
foreach ($templates as $template)
|
2004-08-06 11:35:07 +02:00
|
|
|
{
|
- in admin/configuration, add new step with "sections" (general, comments,
default, upload, metadata, sessions)
- admin/configuration.php and its template have been higly simplificated by
making things more generic : for example, for each configuration
parameter, its name must correspond to the name we find in the config
table and belongs to a section, in the lang array we find :
- $lang['conf_<section>_<param>']
- $lang['conf_<section>_<param>_info']
- $lang['conf_<section>_<param>_error'] optionnaly
- more described message when connection to database server is impossible
- redefinitions of get_languages and get_templates functions
- deletion of configuration parameters : webmaster, session_keyword
- rename of configuration parameters :
- default_lang => default_language
- default_style => default_template
git-svn-id: http://piwigo.org/svn/trunk@512 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-09-03 17:01:05 +02:00
|
|
|
$selected = ( $template == $default_style ) ? ' selected="selected"' : '';
|
2004-09-07 22:10:36 +02:00
|
|
|
$style_selected.= '<option value="'.$template.'"'.$selected.'>';
|
|
|
|
$style_selected.= $template.'</option>';
|
2004-08-06 11:35:07 +02:00
|
|
|
}
|
2004-09-07 22:10:36 +02:00
|
|
|
$style_selected .= '</select>';
|
|
|
|
return $style_selected;
|
2004-08-06 11:35:07 +02:00
|
|
|
}
|
|
|
|
|
2004-10-23 11:00:26 +02:00
|
|
|
/**
|
|
|
|
* returns the list of categories as a HTML string
|
|
|
|
*
|
|
|
|
* categories string returned contains categories as given in the input
|
|
|
|
* array $cat_informations. $cat_informations array must be an association
|
|
|
|
* of {category_id => category_name}. If url input parameter is empty,
|
|
|
|
* returns only the categories name without links.
|
|
|
|
*
|
|
|
|
* @param array cat_informations
|
|
|
|
* @param string separator
|
|
|
|
* @param string url
|
|
|
|
* @param boolean replace_space
|
|
|
|
* @return string
|
|
|
|
*/
|
2004-10-21 23:17:46 +02:00
|
|
|
function get_cat_display_name($cat_informations,
|
|
|
|
$url = 'category.php?cat=',
|
|
|
|
$replace_space = true)
|
2004-08-06 11:35:07 +02:00
|
|
|
{
|
2004-12-12 22:06:39 +01:00
|
|
|
global $conf;
|
|
|
|
|
2004-08-06 11:35:07 +02:00
|
|
|
$output = '';
|
2004-10-21 23:17:46 +02:00
|
|
|
$is_first = true;
|
|
|
|
foreach ($cat_informations as $id => $name)
|
2004-08-06 11:35:07 +02:00
|
|
|
{
|
2004-10-21 23:17:46 +02:00
|
|
|
if ($is_first)
|
|
|
|
{
|
|
|
|
$is_first = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-12-12 22:06:39 +01:00
|
|
|
$output.= $conf['level_separator'];
|
2004-10-21 23:17:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($url == '')
|
|
|
|
{
|
|
|
|
$output.= $name;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$output.= '
|
|
|
|
<a class="" href="'.add_session_id(PHPWG_ROOT_PATH.$url.$id).'">'.$name.'</a>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($replace_space)
|
|
|
|
{
|
|
|
|
return replace_space($output);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $output;
|
2004-08-06 11:35:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-11-20 18:23:42 +01:00
|
|
|
/**
|
|
|
|
* returns the list of categories as a HTML string, with cache of names
|
|
|
|
*
|
|
|
|
* categories string returned contains categories as given in the input
|
|
|
|
* array $cat_informations. $uppercats is the list of category ids to
|
|
|
|
* display in the right order. If url input parameter is empty, returns only
|
|
|
|
* the categories name without links.
|
|
|
|
*
|
|
|
|
* @param string uppercats
|
|
|
|
* @param string url
|
|
|
|
* @param boolean replace_space
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function get_cat_display_name_cache($uppercats,
|
|
|
|
$url = 'category.php?cat=',
|
|
|
|
$replace_space = true)
|
|
|
|
{
|
2004-12-12 22:06:39 +01:00
|
|
|
global $cat_names, $conf;
|
2004-11-20 18:23:42 +01:00
|
|
|
|
|
|
|
if (!isset($cat_names))
|
|
|
|
{
|
|
|
|
$query = '
|
|
|
|
SELECT id,name
|
|
|
|
FROM '.CATEGORIES_TABLE.'
|
|
|
|
;';
|
|
|
|
$result = pwg_query($query);
|
|
|
|
while ($row = mysql_fetch_array($result))
|
|
|
|
{
|
|
|
|
$cat_names[$row['id']] = $row['name'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$output = '';
|
|
|
|
$is_first = true;
|
|
|
|
foreach (explode(',', $uppercats) as $category_id)
|
|
|
|
{
|
|
|
|
$name = $cat_names[$category_id];
|
|
|
|
|
|
|
|
if ($is_first)
|
|
|
|
{
|
|
|
|
$is_first = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-12-12 22:06:39 +01:00
|
|
|
$output.= $conf['level_separator'];
|
2004-11-20 18:23:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($url == '')
|
|
|
|
{
|
|
|
|
$output.= $name;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$output.= '
|
|
|
|
<a class=""
|
|
|
|
href="'.add_session_id(PHPWG_ROOT_PATH.$url.$category_id).'">'.$name.'</a>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($replace_space)
|
|
|
|
{
|
|
|
|
return replace_space($output);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $output;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-06 11:35:07 +02:00
|
|
|
/**
|
|
|
|
* returns the HTML code for a category item in the menu (for category.php)
|
|
|
|
*
|
|
|
|
* HTML code generated uses logical list tags ul and each category is an
|
|
|
|
* item li. The paramter given is the category informations as an array,
|
2004-11-23 23:31:24 +01:00
|
|
|
* used keys are : id, name, nb_images, date_last
|
2004-08-06 11:35:07 +02:00
|
|
|
*
|
2004-11-23 23:31:24 +01:00
|
|
|
* @param array categories
|
2004-08-06 11:35:07 +02:00
|
|
|
* @return string
|
|
|
|
*/
|
2004-11-23 23:31:24 +01:00
|
|
|
function get_html_menu_category($categories)
|
2004-08-06 11:35:07 +02:00
|
|
|
{
|
|
|
|
global $page, $lang;
|
|
|
|
|
2004-11-23 23:31:24 +01:00
|
|
|
$ref_level = 0;
|
2004-08-06 11:35:07 +02:00
|
|
|
$menu = '
|
2004-11-23 23:31:24 +01:00
|
|
|
<ul class="menu">';
|
|
|
|
|
|
|
|
foreach ($categories as $category)
|
|
|
|
{
|
|
|
|
$level = substr_count($category['global_rank'], '.');
|
|
|
|
if ($level > $ref_level)
|
|
|
|
{
|
|
|
|
$menu.= '
|
|
|
|
<ul class="menu">';
|
|
|
|
}
|
|
|
|
else if ($level < $ref_level)
|
|
|
|
{
|
|
|
|
$menu.= '
|
|
|
|
</ul>';
|
|
|
|
}
|
|
|
|
$ref_level = $level;
|
|
|
|
|
|
|
|
$menu.= '
|
2004-08-06 11:35:07 +02:00
|
|
|
|
|
|
|
<li>';
|
|
|
|
|
2004-11-23 23:31:24 +01:00
|
|
|
$url = add_session_id(PHPWG_ROOT_PATH.'category.php?cat='.$category['id']);
|
2004-08-06 11:35:07 +02:00
|
|
|
|
2004-11-23 23:31:24 +01:00
|
|
|
$class = '';
|
|
|
|
if (isset($page['cat'])
|
|
|
|
and is_numeric($page['cat'])
|
|
|
|
and $category['id'] == $page['cat'])
|
|
|
|
{
|
|
|
|
$class = 'menuCategorySelected';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$class = 'menuCategoryNotSelected';
|
|
|
|
}
|
2004-08-06 11:35:07 +02:00
|
|
|
|
2004-11-23 23:31:24 +01:00
|
|
|
$menu.= '
|
2004-08-06 11:35:07 +02:00
|
|
|
<a href="'.$url.'"
|
|
|
|
title="'.$lang['hint_category'].'"
|
|
|
|
class="'.$class.'">
|
2004-11-23 23:31:24 +01:00
|
|
|
'.$category['name'].'
|
2004-08-06 11:35:07 +02:00
|
|
|
</a>';
|
|
|
|
|
2004-11-23 23:31:24 +01:00
|
|
|
if ($category['nb_images'] > 0)
|
|
|
|
{
|
|
|
|
$menu.= '
|
2004-08-06 11:35:07 +02:00
|
|
|
<span class="menuInfoCat"
|
|
|
|
title="'.$category['nb_images'].'
|
|
|
|
'.$lang['images_available'].'">
|
|
|
|
['.$category['nb_images'].']
|
|
|
|
</span>
|
|
|
|
'.get_icon($category['date_last']);
|
2004-11-23 23:31:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$menu.= '</li>';
|
2004-08-06 11:35:07 +02:00
|
|
|
}
|
|
|
|
|
2004-11-23 23:31:24 +01:00
|
|
|
$menu.= '
|
2004-08-06 11:35:07 +02:00
|
|
|
</ul>';
|
2004-11-23 23:31:24 +01:00
|
|
|
|
2004-08-06 11:35:07 +02:00
|
|
|
return $menu;
|
|
|
|
}
|
2004-10-23 19:56:46 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* returns HTMLized comment contents retrieved from database
|
|
|
|
*
|
|
|
|
* newlines becomes br tags, _word_ becomes underline, /word/ becomes
|
|
|
|
* italic, *word* becomes bolded
|
|
|
|
*
|
|
|
|
* @param string content
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function parse_comment_content($content)
|
|
|
|
{
|
|
|
|
$content = nl2br($content);
|
|
|
|
|
|
|
|
// replace _word_ by an underlined word
|
|
|
|
$pattern = '/_([^\s]*)_/';
|
|
|
|
$replacement = '<span style="text-decoration:underline;">\1</span>';
|
|
|
|
$content = preg_replace($pattern, $replacement, $content);
|
|
|
|
|
|
|
|
// replace *word* by a bolded word
|
|
|
|
$pattern = '/\*([^\s]*)\*/';
|
|
|
|
$replacement = '<span style="font-weight:bold;">\1</span>';
|
|
|
|
$content = preg_replace($pattern, $replacement, $content);
|
|
|
|
|
|
|
|
// replace /word/ by an italic word
|
|
|
|
$pattern = '/\/([^\s]*)\//';
|
|
|
|
$replacement = '<span style="font-style:italic;">\1</span>';
|
|
|
|
$content = preg_replace($pattern, $replacement, $content);
|
|
|
|
|
|
|
|
return $content;
|
|
|
|
}
|
2004-08-06 11:35:07 +02:00
|
|
|
?>
|