aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/category_cats.inc.php5
-rw-r--r--include/common.inc.php6
-rw-r--r--include/functions_category.inc.php10
-rw-r--r--include/functions_html.inc.php34
-rw-r--r--include/section_init.inc.php17
-rw-r--r--index.php3
-rw-r--r--plugins/admin_multi_view/is_admin.inc.php1
7 files changed, 47 insertions, 29 deletions
diff --git a/include/category_cats.inc.php b/include/category_cats.inc.php
index 82d1eb11d..716377c29 100644
--- a/include/category_cats.inc.php
+++ b/include/category_cats.inc.php
@@ -178,11 +178,6 @@ if (count($categories) > 0)
update_cats_with_filtered_data($categories);
}
- // add default event handler for rendering category literal description
- add_event_handler('render_category_literal_description',
- create_function('$d',
- 'return strip_tags($d, \'<a><br><p><b><i><small><strong><font>\');'));
-
trigger_action('loc_begin_index_category_thumbnails', $categories);
if ($conf['subcatify'])
{
diff --git a/include/common.inc.php b/include/common.inc.php
index 8a136bc4f..00e68e646 100644
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -172,9 +172,9 @@ if ($user['is_the_guest'])
}
// template instance
-if
+if
(
- defined('IN_ADMIN') and IN_ADMIN and
+ defined('IN_ADMIN') and IN_ADMIN and
isset($user['admin_template']) and
isset($user['admin_theme'])
)
@@ -261,6 +261,8 @@ if (isset($conf['header_notes']))
}
// default event handlers
+add_event_handler('render_category_literal_description', 'render_category_literal_description');
+add_event_handler('render_category_description', 'render_category_description');
add_event_handler('render_comment_content', 'htmlspecialchars');
add_event_handler('render_comment_content', 'parse_comment_content');
add_event_handler('render_comment_author', 'strip_tags');
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index 113af6dd9..c598c30f5 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -156,12 +156,6 @@ SELECT *
$cat[$k] = get_boolean( $cat[$k] );
}
}
- global $conf;
- if ( !( $conf['allow_html_descriptions'] and
- preg_match('/<(div|br|img|script).*>/i', $cat['comment']) ) )
- {
- $cat['comment'] = nl2br(@$cat['comment']);
- }
$upper_ids = explode(',', $cat['uppercats']);
if ( count($upper_ids)==1 )
@@ -445,7 +439,7 @@ function get_display_images_count($cat_nb_images, $cat_count_images, $cat_count_
$cat_count_images-= $cat_nb_images;
$cat_nb_images = 0;
}
-
+
//at least one image direct or indirect
$display_text.= l10n_dec('image_available', 'images_available', $cat_count_images);
@@ -466,4 +460,4 @@ function get_display_images_count($cat_nb_images, $cat_count_images, $cat_count_
return $display_text;
}
-?>
+?> \ No newline at end of file
diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php
index cae82be2e..c875cfb7a 100644
--- a/include/functions_html.inc.php
+++ b/include/functions_html.inc.php
@@ -58,7 +58,7 @@ function get_icon($date, $is_child_date = false)
if (!isset($page['get_icon_cache']['unix_timestamp']))
{
// Use MySql date in order to standardize all recent "actions/queries"
- list($page['get_icon_cache']['unix_timestamp']) =
+ list($page['get_icon_cache']['unix_timestamp']) =
mysql_fetch_array(pwg_query('select UNIX_TIMESTAMP(CURRENT_DATE)'));
}
@@ -455,7 +455,7 @@ function get_html_menu_category($categories, $selected_category)
{// at least one direct or indirect image
$menu.= "\n".'<span class="';
// at least one image in this category -> class menuInfoCat
- $menu.= ($category['nb_images'] > 0 ? "menuInfoCat"
+ $menu.= ($category['nb_images'] > 0 ? "menuInfoCat"
: "menuInfoCatByChild").'"';
$menu.= ' title=" '.$title.'">';
// show total number of images
@@ -735,10 +735,32 @@ function set_status_header($code, $text='')
*/
function set_span_class($count)
{
- if ($count > 1)
- {
+ if ($count > 1)
+ {
return 'plural';
}
- return ( $count == 0 ) ? 'zero':'one';
+ return ( $count == 0 ) ? 'zero':'one';
+}
+
+/** returns the category comment for rendering in html.
+ * this is an event handler. don't call directly
+ */
+function render_category_description($desc)
+{
+ global $conf;
+ if ( !( $conf['allow_html_descriptions'] and
+ preg_match('/<(div|br|img|script).*>/i', $desc) ) )
+ {
+ $desc = nl2br($desc);
+ }
+ return $desc;
+}
+
+/** returns the category comment for rendering in html textual mode (subcatify)
+ * this is an event handler. don't call directly
+ */
+function render_category_literal_description($desc)
+{
+ return strip_tags($desc, '<span><p><a><br><b><i><small><big><strong><em>');
}
-?>
+?> \ No newline at end of file
diff --git a/include/section_init.inc.php b/include/section_init.inc.php
index b0baec3bb..05bc60f29 100644
--- a/include/section_init.inc.php
+++ b/include/section_init.inc.php
@@ -204,7 +204,11 @@ if ('categories' == $page['section'])
$page = array_merge(
$page,
array(
- 'comment' => $page['category']['comment'],
+ 'comment' =>
+ trigger_event(
+ 'render_category_description',
+ $page['category']['comment']
+ ),
'title' =>
get_cat_display_name($page['category']['upper_names'], '', false),
)
@@ -331,7 +335,8 @@ SELECT DISTINCT(id)
$page = array_merge(
$page,
array(
- 'title' => $lang['search_result'],
+ 'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
+ .$lang['search_result'].'</a>',
)
);
}
@@ -385,7 +390,7 @@ SELECT DISTINCT(id)
$page = array_merge(
$page,
array(
- 'title' => '<a href="'.duplicate_index_url().'">'
+ 'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
.$lang['recent_pics_cat'].'</a>',
'items' => array_from_query($query, 'id'),
)
@@ -423,7 +428,7 @@ SELECT DISTINCT(id)
$page = array_merge(
$page,
array(
- 'title' => '<a href="'.duplicate_index_url().'">'
+ 'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
.$conf['top_number'].' '.$lang['most_visited_cat'].'</a>',
'items' => array_from_query($query, 'id'),
)
@@ -449,7 +454,7 @@ SELECT DISTINCT(id)
$page = array_merge(
$page,
array(
- 'title' => '<a href="'.duplicate_index_url().'">'
+ 'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
.$conf['top_number'].' '.$lang['best_rated_cat'].'</a>',
'items' => array_from_query($query, 'id'),
)
@@ -472,7 +477,7 @@ SELECT DISTINCT(id)
$page = array_merge(
$page,
array(
- 'title' => '<a href="'.duplicate_index_url().'">'
+ 'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
.$lang['random_cat'].'</a>',
'items' => array_from_query($query, 'id'),
)
diff --git a/index.php b/index.php
index 52dd517b0..ab21a7e5a 100644
--- a/index.php
+++ b/index.php
@@ -296,8 +296,7 @@ if (isset($page['comment']) and $page['comment'] != '')
$template->assign_block_vars(
'cat_infos.comment',
array(
- 'COMMENTS' =>
- trigger_event('render_category_description', $page['comment'])
+ 'COMMENTS' => $page['comment']
)
);
$header_infos['COMMENT'] = strip_tags($page['comment']);
diff --git a/plugins/admin_multi_view/is_admin.inc.php b/plugins/admin_multi_view/is_admin.inc.php
index 0f85c5e0d..b0f1172f9 100644
--- a/plugins/admin_multi_view/is_admin.inc.php
+++ b/plugins/admin_multi_view/is_admin.inc.php
@@ -11,6 +11,7 @@ if (! defined('MULTIVIEW_CONTROLLER') )
if ( !empty($theme) )
{
list($user['template'], $user['theme']) = explode('/', $theme);
+ unset( $user['admin_template'], $user['admin_theme']);
}
$lang = pwg_get_session_var( 'multiview_lang', '' );
if ( !empty($lang) )