[476] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
[2297] | 3 | // | Piwigo - a PHP based picture gallery | |
---|
| 4 | // +-----------------------------------------------------------------------+ |
---|
[5196] | 5 | // | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org | |
---|
[2297] | 6 | // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | |
---|
| 7 | // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | |
---|
| 8 | // +-----------------------------------------------------------------------+ |
---|
| 9 | // | This program is free software; you can redistribute it and/or modify | |
---|
| 10 | // | it under the terms of the GNU General Public License as published by | |
---|
| 11 | // | the Free Software Foundation | |
---|
| 12 | // | | |
---|
| 13 | // | This program is distributed in the hope that it will be useful, but | |
---|
| 14 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
| 15 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
| 16 | // | General Public License for more details. | |
---|
| 17 | // | | |
---|
| 18 | // | You should have received a copy of the GNU General Public License | |
---|
| 19 | // | along with this program; if not, write to the Free Software | |
---|
| 20 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
| 21 | // | USA. | |
---|
| 22 | // +-----------------------------------------------------------------------+ |
---|
[476] | 23 | |
---|
[572] | 24 | /** |
---|
| 25 | * returns the list of categories as a HTML string |
---|
| 26 | * |
---|
| 27 | * categories string returned contains categories as given in the input |
---|
[1866] | 28 | * array $cat_informations. $cat_informations array must be an array |
---|
| 29 | * of array( id=>?, name=>?, permalink=>?). If url input parameter is null, |
---|
[572] | 30 | * returns only the categories name without links. |
---|
| 31 | * |
---|
| 32 | * @param array cat_informations |
---|
| 33 | * @param string url |
---|
| 34 | * @param boolean replace_space |
---|
| 35 | * @return string |
---|
| 36 | */ |
---|
[569] | 37 | function get_cat_display_name($cat_informations, |
---|
[1092] | 38 | $url = '', |
---|
[569] | 39 | $replace_space = true) |
---|
[476] | 40 | { |
---|
[642] | 41 | global $conf; |
---|
[1090] | 42 | |
---|
[5917] | 43 | //$output = '<a href="'.get_absolute_root_url().$conf['home_page'].'">'.l10n('Home').'</a>'; |
---|
| 44 | $output = ''; |
---|
[5924] | 45 | $is_first=true; |
---|
[8247] | 46 | |
---|
[1866] | 47 | foreach ($cat_informations as $cat) |
---|
[476] | 48 | { |
---|
[1861] | 49 | is_array($cat) or trigger_error( |
---|
[1866] | 50 | 'get_cat_display_name wrong type for category ', E_USER_WARNING |
---|
[1861] | 51 | ); |
---|
[2433] | 52 | |
---|
| 53 | $cat['name'] = trigger_event( |
---|
| 54 | 'render_category_name', |
---|
| 55 | $cat['name'], |
---|
| 56 | 'get_cat_display_name' |
---|
| 57 | ); |
---|
[5924] | 58 | |
---|
| 59 | if ($is_first) |
---|
[5917] | 60 | { |
---|
[5924] | 61 | $is_first=false; |
---|
| 62 | } |
---|
| 63 | else |
---|
| 64 | { |
---|
[5917] | 65 | $output.= $conf['level_separator']; |
---|
| 66 | } |
---|
[2433] | 67 | |
---|
[1092] | 68 | if ( !isset($url) ) |
---|
[569] | 69 | { |
---|
[1861] | 70 | $output.= $cat['name']; |
---|
[569] | 71 | } |
---|
[1092] | 72 | elseif ($url == '') |
---|
| 73 | { |
---|
[1789] | 74 | $output.= '<a href="' |
---|
[1748] | 75 | .make_index_url( |
---|
[1131] | 76 | array( |
---|
[1861] | 77 | 'category' => $cat, |
---|
[1748] | 78 | ) |
---|
[1131] | 79 | ) |
---|
| 80 | .'">'; |
---|
[1861] | 81 | $output.= $cat['name'].'</a>'; |
---|
[1092] | 82 | } |
---|
[569] | 83 | else |
---|
| 84 | { |
---|
[1866] | 85 | $output.= '<a href="'.PHPWG_ROOT_PATH.$url.$cat['id'].'">'; |
---|
[1861] | 86 | $output.= $cat['name'].'</a>'; |
---|
[569] | 87 | } |
---|
[476] | 88 | } |
---|
[569] | 89 | if ($replace_space) |
---|
| 90 | { |
---|
| 91 | return replace_space($output); |
---|
| 92 | } |
---|
| 93 | else |
---|
| 94 | { |
---|
| 95 | return $output; |
---|
| 96 | } |
---|
[476] | 97 | } |
---|
| 98 | |
---|
| 99 | /** |
---|
[610] | 100 | * returns the list of categories as a HTML string, with cache of names |
---|
| 101 | * |
---|
| 102 | * categories string returned contains categories as given in the input |
---|
| 103 | * array $cat_informations. $uppercats is the list of category ids to |
---|
| 104 | * display in the right order. If url input parameter is empty, returns only |
---|
| 105 | * the categories name without links. |
---|
| 106 | * |
---|
| 107 | * @param string uppercats |
---|
| 108 | * @param string url |
---|
| 109 | * @param boolean replace_space |
---|
| 110 | * @return string |
---|
| 111 | */ |
---|
| 112 | function get_cat_display_name_cache($uppercats, |
---|
[1092] | 113 | $url = '', |
---|
[610] | 114 | $replace_space = true) |
---|
| 115 | { |
---|
[1861] | 116 | global $cache, $conf; |
---|
[610] | 117 | |
---|
[1861] | 118 | if (!isset($cache['cat_names'])) |
---|
[610] | 119 | { |
---|
| 120 | $query = ' |
---|
[1866] | 121 | SELECT id, name, permalink |
---|
[610] | 122 | FROM '.CATEGORIES_TABLE.' |
---|
| 123 | ;'; |
---|
[1866] | 124 | $cache['cat_names'] = hash_from_query($query, 'id'); |
---|
[610] | 125 | } |
---|
[1090] | 126 | |
---|
[610] | 127 | $output = ''; |
---|
| 128 | $is_first = true; |
---|
| 129 | foreach (explode(',', $uppercats) as $category_id) |
---|
| 130 | { |
---|
[1861] | 131 | $cat = $cache['cat_names'][$category_id]; |
---|
[1090] | 132 | |
---|
[2433] | 133 | $cat['name'] = trigger_event( |
---|
| 134 | 'render_category_name', |
---|
| 135 | $cat['name'], |
---|
| 136 | 'get_cat_display_name_cache' |
---|
| 137 | ); |
---|
| 138 | |
---|
[610] | 139 | if ($is_first) |
---|
| 140 | { |
---|
| 141 | $is_first = false; |
---|
| 142 | } |
---|
| 143 | else |
---|
| 144 | { |
---|
[642] | 145 | $output.= $conf['level_separator']; |
---|
[610] | 146 | } |
---|
| 147 | |
---|
[1092] | 148 | if ( !isset($url) ) |
---|
[610] | 149 | { |
---|
[1861] | 150 | $output.= $cat['name']; |
---|
[610] | 151 | } |
---|
[1092] | 152 | elseif ($url == '') |
---|
| 153 | { |
---|
| 154 | $output.= ' |
---|
[1789] | 155 | <a href="' |
---|
[1131] | 156 | .make_index_url( |
---|
| 157 | array( |
---|
[1861] | 158 | 'category' => $cat, |
---|
[1131] | 159 | ) |
---|
| 160 | ) |
---|
[1861] | 161 | .'">'.$cat['name'].'</a>'; |
---|
[1092] | 162 | } |
---|
[610] | 163 | else |
---|
| 164 | { |
---|
| 165 | $output.= ' |
---|
[1861] | 166 | <a href="'.PHPWG_ROOT_PATH.$url.$category_id.'">'.$cat['name'].'</a>'; |
---|
[610] | 167 | } |
---|
| 168 | } |
---|
| 169 | if ($replace_space) |
---|
| 170 | { |
---|
| 171 | return replace_space($output); |
---|
| 172 | } |
---|
| 173 | else |
---|
| 174 | { |
---|
| 175 | return $output; |
---|
| 176 | } |
---|
| 177 | } |
---|
| 178 | |
---|
| 179 | /** |
---|
[579] | 180 | * returns HTMLized comment contents retrieved from database |
---|
| 181 | * |
---|
| 182 | * newlines becomes br tags, _word_ becomes underline, /word/ becomes |
---|
| 183 | * italic, *word* becomes bolded |
---|
| 184 | * |
---|
| 185 | * @param string content |
---|
| 186 | * @return string |
---|
| 187 | */ |
---|
[8247] | 188 | function render_comment_content($content) |
---|
[579] | 189 | { |
---|
[8247] | 190 | $content = htmlspecialchars($content); |
---|
[1031] | 191 | $pattern = '/(https?:\/\/\S*)/'; |
---|
| 192 | $replacement = '<a href="$1" rel="nofollow">$1</a>'; |
---|
| 193 | $content = preg_replace($pattern, $replacement, $content); |
---|
| 194 | |
---|
[579] | 195 | $content = nl2br($content); |
---|
[1090] | 196 | |
---|
[579] | 197 | // replace _word_ by an underlined word |
---|
[1030] | 198 | $pattern = '/\b_(\S*)_\b/'; |
---|
| 199 | $replacement = '<span style="text-decoration:underline;">$1</span>'; |
---|
[579] | 200 | $content = preg_replace($pattern, $replacement, $content); |
---|
[1090] | 201 | |
---|
[579] | 202 | // replace *word* by a bolded word |
---|
[1030] | 203 | $pattern = '/\b\*(\S*)\*\b/'; |
---|
| 204 | $replacement = '<span style="font-weight:bold;">$1</span>'; |
---|
[579] | 205 | $content = preg_replace($pattern, $replacement, $content); |
---|
[1090] | 206 | |
---|
[579] | 207 | // replace /word/ by an italic word |
---|
[1031] | 208 | $pattern = "/\/(\S*)\/(\s)/"; |
---|
| 209 | $replacement = '<span style="font-style:italic;">$1$2</span>'; |
---|
| 210 | $content = preg_replace($pattern, $replacement, $content); |
---|
[579] | 211 | |
---|
| 212 | return $content; |
---|
| 213 | } |
---|
[817] | 214 | |
---|
| 215 | function get_cat_display_name_from_id($cat_id, |
---|
[1092] | 216 | $url = '', |
---|
[817] | 217 | $replace_space = true) |
---|
| 218 | { |
---|
| 219 | $cat_info = get_cat_info($cat_id); |
---|
[1861] | 220 | return get_cat_display_name($cat_info['upper_names'], $url, $replace_space); |
---|
[817] | 221 | } |
---|
[1113] | 222 | |
---|
| 223 | /** |
---|
[1119] | 224 | * Returns an HTML list of tags. It can be a multi select field or a list of |
---|
| 225 | * checkboxes. |
---|
| 226 | * |
---|
| 227 | * @param string HTML field name |
---|
| 228 | * @param array selected tag ids |
---|
| 229 | * @return array |
---|
| 230 | */ |
---|
| 231 | function get_html_tag_selection( |
---|
| 232 | $tags, |
---|
| 233 | $fieldname, |
---|
| 234 | $selecteds = array(), |
---|
| 235 | $forbidden_categories = null |
---|
| 236 | ) |
---|
| 237 | { |
---|
| 238 | global $conf; |
---|
[1131] | 239 | |
---|
[1201] | 240 | if (count ($tags) == 0 ) |
---|
| 241 | { |
---|
| 242 | return ''; |
---|
| 243 | } |
---|
[1119] | 244 | $output = '<ul class="tagSelection">'; |
---|
| 245 | foreach ($tags as $tag) |
---|
| 246 | { |
---|
| 247 | $output.= |
---|
| 248 | '<li>' |
---|
| 249 | .'<label>' |
---|
| 250 | .'<input type="checkbox" name="'.$fieldname.'[]"' |
---|
[1815] | 251 | .' value="'.$tag['id'].'"' |
---|
[1119] | 252 | ; |
---|
| 253 | |
---|
[1815] | 254 | if (in_array($tag['id'], $selecteds)) |
---|
[1119] | 255 | { |
---|
| 256 | $output.= ' checked="checked"'; |
---|
| 257 | } |
---|
[1131] | 258 | |
---|
[1119] | 259 | $output.= |
---|
[3185] | 260 | '>' |
---|
[1290] | 261 | .' '. $tag['name'] |
---|
[1119] | 262 | .'</label>' |
---|
| 263 | .'</li>' |
---|
| 264 | ."\n" |
---|
| 265 | ; |
---|
| 266 | } |
---|
| 267 | $output.= '</ul>'; |
---|
| 268 | |
---|
| 269 | return $output; |
---|
| 270 | } |
---|
| 271 | |
---|
| 272 | function name_compare($a, $b) |
---|
| 273 | { |
---|
[1310] | 274 | return strcmp(strtolower($a['name']), strtolower($b['name'])); |
---|
[1119] | 275 | } |
---|
| 276 | |
---|
[2409] | 277 | function tag_alpha_compare($a, $b) |
---|
| 278 | { |
---|
| 279 | return strcmp(strtolower($a['url_name']), strtolower($b['url_name'])); |
---|
| 280 | } |
---|
| 281 | |
---|
[1119] | 282 | /** |
---|
[1113] | 283 | * exits the current script (either exit or redirect) |
---|
| 284 | */ |
---|
| 285 | function access_denied() |
---|
| 286 | { |
---|
[2265] | 287 | global $user; |
---|
[1113] | 288 | |
---|
| 289 | $login_url = |
---|
| 290 | get_root_url().'identification.php?redirect=' |
---|
| 291 | .urlencode(urlencode($_SERVER['REQUEST_URI'])); |
---|
| 292 | |
---|
[2543] | 293 | set_status_header(401); |
---|
[2029] | 294 | if ( isset($user) and !is_a_guest() ) |
---|
[1113] | 295 | { |
---|
[2884] | 296 | echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'; |
---|
[5021] | 297 | echo '<div style="text-align:center;">'.l10n('You are not authorized to access the requested page').'<br>'; |
---|
[6316] | 298 | echo '<a href="'.get_root_url().'identification.php">'.l10n('Identification').'</a> '; |
---|
[5021] | 299 | echo '<a href="'.make_index_url().'">'.l10n('Home').'</a></div>'; |
---|
[2543] | 300 | echo str_repeat( ' ', 512); //IE6 doesn't error output if below a size |
---|
[1113] | 301 | exit(); |
---|
| 302 | } |
---|
| 303 | else |
---|
| 304 | { |
---|
[1649] | 305 | redirect_html($login_url); |
---|
[1113] | 306 | } |
---|
| 307 | } |
---|
[1288] | 308 | |
---|
| 309 | /** |
---|
[1652] | 310 | * exits the current script with 403 code |
---|
| 311 | * @param string msg a message to display |
---|
| 312 | * @param string alternate_url redirect to this url |
---|
| 313 | */ |
---|
| 314 | function page_forbidden($msg, $alternate_url=null) |
---|
| 315 | { |
---|
| 316 | set_status_header(403); |
---|
| 317 | if ($alternate_url==null) |
---|
| 318 | $alternate_url = make_index_url(); |
---|
| 319 | redirect_html( $alternate_url, |
---|
| 320 | '<div style="text-align:left; margin-left:5em;margin-bottom:5em;"> |
---|
[3185] | 321 | <h1 style="text-align:left; font-size:36px;">Forbidden</h1><br>' |
---|
[1652] | 322 | .$msg.'</div>', |
---|
| 323 | 5 ); |
---|
| 324 | } |
---|
| 325 | |
---|
| 326 | /** |
---|
[1852] | 327 | * exits the current script with 400 code |
---|
| 328 | * @param string msg a message to display |
---|
| 329 | * @param string alternate_url redirect to this url |
---|
| 330 | */ |
---|
| 331 | function bad_request($msg, $alternate_url=null) |
---|
| 332 | { |
---|
| 333 | set_status_header(400); |
---|
| 334 | if ($alternate_url==null) |
---|
| 335 | $alternate_url = make_index_url(); |
---|
| 336 | redirect_html( $alternate_url, |
---|
| 337 | '<div style="text-align:left; margin-left:5em;margin-bottom:5em;"> |
---|
[3185] | 338 | <h1 style="text-align:left; font-size:36px;">Bad request</h1><br>' |
---|
[1852] | 339 | .$msg.'</div>', |
---|
| 340 | 5 ); |
---|
| 341 | } |
---|
| 342 | |
---|
| 343 | /** |
---|
[1288] | 344 | * exits the current script with 404 code when a page cannot be found |
---|
| 345 | * @param string msg a message to display |
---|
| 346 | * @param string alternate_url redirect to this url |
---|
| 347 | */ |
---|
| 348 | function page_not_found($msg, $alternate_url=null) |
---|
| 349 | { |
---|
[1643] | 350 | set_status_header(404); |
---|
[1288] | 351 | if ($alternate_url==null) |
---|
| 352 | $alternate_url = make_index_url(); |
---|
[1649] | 353 | redirect_html( $alternate_url, |
---|
[1288] | 354 | '<div style="text-align:left; margin-left:5em;margin-bottom:5em;"> |
---|
[3185] | 355 | <h1 style="text-align:left; font-size:36px;">Page not found</h1><br>' |
---|
[1288] | 356 | .$msg.'</div>', |
---|
| 357 | 5 ); |
---|
| 358 | } |
---|
[1606] | 359 | |
---|
[2502] | 360 | /** |
---|
| 361 | * exits the current script with 500 http code |
---|
| 362 | * this method can be called at any time (does not use template/language/user etc...) |
---|
| 363 | * @param string msg a message to display |
---|
| 364 | */ |
---|
[5985] | 365 | function fatal_error($msg, $title=null, $show_trace=true) |
---|
[2502] | 366 | { |
---|
[5985] | 367 | if (empty($title)) |
---|
| 368 | { |
---|
| 369 | $title = 'Piwigo encountered a non recoverable error'; |
---|
| 370 | } |
---|
[8247] | 371 | |
---|
[2502] | 372 | $btrace_msg = ''; |
---|
[5985] | 373 | if ($show_trace and function_exists('debug_backtrace')) |
---|
[2502] | 374 | { |
---|
| 375 | $bt = debug_backtrace(); |
---|
| 376 | for ($i=1; $i<count($bt); $i++) |
---|
| 377 | { |
---|
| 378 | $class = isset($bt[$i]['class']) ? (@$bt[$i]['class'].'::') : ''; |
---|
| 379 | $btrace_msg .= "#$i\t".$class.@$bt[$i]['function'].' '.@$bt[$i]['file']."(".@$bt[$i]['line'].")\n"; |
---|
| 380 | } |
---|
| 381 | $btrace_msg = trim($btrace_msg); |
---|
| 382 | $msg .= "\n"; |
---|
| 383 | } |
---|
| 384 | |
---|
[2747] | 385 | $display = "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'> |
---|
[5985] | 386 | <h1>$title</h1> |
---|
[2502] | 387 | <pre style='font-size:larger;background:white;color:red;padding:1em;margin:0;clear:both;display:block;width:auto;height:auto;overflow:auto'> |
---|
| 388 | <b>$msg</b> |
---|
| 389 | $btrace_msg |
---|
| 390 | </pre>\n"; |
---|
| 391 | |
---|
| 392 | @set_status_header(500); |
---|
[2543] | 393 | echo $display.str_repeat( ' ', 300); //IE6 doesn't error output if below a size |
---|
[2502] | 394 | |
---|
| 395 | if ( function_exists('ini_set') ) |
---|
| 396 | {// if possible turn off error display (we display it) |
---|
| 397 | ini_set('display_errors', false); |
---|
| 398 | } |
---|
| 399 | error_reporting( E_ALL ); |
---|
| 400 | trigger_error( strip_tags($msg).$btrace_msg, E_USER_ERROR ); |
---|
| 401 | die(0); // just in case |
---|
| 402 | } |
---|
| 403 | |
---|
[1606] | 404 | /* returns the title to be displayed above thumbnails on tag page |
---|
| 405 | */ |
---|
| 406 | function get_tags_content_title() |
---|
| 407 | { |
---|
| 408 | global $page; |
---|
[5021] | 409 | $title = count($page['tags']) > 1 ? l10n('Tag') : l10n('Tag'); |
---|
[1606] | 410 | $title.= ' '; |
---|
| 411 | |
---|
| 412 | for ($i=0; $i<count($page['tags']); $i++) |
---|
| 413 | { |
---|
| 414 | $title.= $i>0 ? ' + ' : ''; |
---|
| 415 | |
---|
| 416 | $title.= |
---|
| 417 | '<a href="' |
---|
| 418 | .make_index_url( |
---|
| 419 | array( |
---|
| 420 | 'tags' => array( $page['tags'][$i] ) |
---|
| 421 | ) |
---|
| 422 | ) |
---|
| 423 | .'" title="' |
---|
[5021] | 424 | .l10n('See images linked to this tag only') |
---|
[1606] | 425 | .'">' |
---|
| 426 | .$page['tags'][$i]['name'] |
---|
| 427 | .'</a>'; |
---|
| 428 | |
---|
[5706] | 429 | $remove_url = null; |
---|
| 430 | if (count($page['tags']) == 1) |
---|
[1606] | 431 | { |
---|
[5706] | 432 | $remove_url = get_root_url().'tags.php'; |
---|
| 433 | } |
---|
| 434 | else |
---|
| 435 | { |
---|
[1606] | 436 | $other_tags = $page['tags']; |
---|
[5706] | 437 | unset($other_tags[$i]); |
---|
| 438 | $remove_url = make_index_url( |
---|
| 439 | array( |
---|
| 440 | 'tags' => $other_tags |
---|
[1606] | 441 | ) |
---|
[5706] | 442 | ); |
---|
| 443 | } |
---|
[8247] | 444 | |
---|
[5706] | 445 | $title.= |
---|
| 446 | '<a href="'.$remove_url.'" style="border:none;" title="' |
---|
| 447 | .l10n('remove this tag from the list') |
---|
| 448 | .'"><img src="' |
---|
[1606] | 449 | .get_root_url().get_themeconf('icon_dir').'/remove_s.png' |
---|
[5706] | 450 | .'" alt="x" style="vertical-align:bottom;" class="button">' |
---|
| 451 | .'</a>'; |
---|
[1606] | 452 | } |
---|
| 453 | return $title; |
---|
| 454 | } |
---|
[1643] | 455 | |
---|
| 456 | /** |
---|
| 457 | Sets the http status header (200,401,...) |
---|
| 458 | */ |
---|
| 459 | function set_status_header($code, $text='') |
---|
| 460 | { |
---|
| 461 | if (empty($text)) |
---|
| 462 | { |
---|
| 463 | switch ($code) |
---|
| 464 | { |
---|
| 465 | case 200: $text='OK';break; |
---|
| 466 | case 301: $text='Moved permanently';break; |
---|
| 467 | case 302: $text='Moved temporarily';break; |
---|
| 468 | case 304: $text='Not modified';break; |
---|
| 469 | case 400: $text='Bad request';break; |
---|
| 470 | case 401: $text='Authorization required';break; |
---|
| 471 | case 403: $text='Forbidden';break; |
---|
| 472 | case 404: $text='Not found';break; |
---|
[2053] | 473 | case 500: $text='Server error';break; |
---|
[2543] | 474 | case 501: $text='Not implemented';break; |
---|
[2053] | 475 | case 503: $text='Service unavailable';break; |
---|
[1643] | 476 | } |
---|
| 477 | } |
---|
[5682] | 478 | $protocol = $_SERVER["SERVER_PROTOCOL"]; |
---|
| 479 | if ( ('HTTP/1.1' != $protocol) && ('HTTP/1.0' != $protocol) ) |
---|
| 480 | $protocol = 'HTTP/1.0'; |
---|
[2053] | 481 | |
---|
[8247] | 482 | header( "$protocol $code $text", true, $code ); |
---|
[1744] | 483 | trigger_action('set_status_header', $code, $text); |
---|
[1643] | 484 | } |
---|
[1769] | 485 | |
---|
[2117] | 486 | /** returns the category comment for rendering in html textual mode (subcatify) |
---|
| 487 | * this is an event handler. don't call directly |
---|
| 488 | */ |
---|
| 489 | function render_category_literal_description($desc) |
---|
| 490 | { |
---|
| 491 | return strip_tags($desc, '<span><p><a><br><b><i><small><big><strong><em>'); |
---|
| 492 | } |
---|
[2349] | 493 | |
---|
[2488] | 494 | /*event handler for menu*/ |
---|
| 495 | function register_default_menubar_blocks( $menu_ref_arr ) |
---|
| 496 | { |
---|
| 497 | $menu = & $menu_ref_arr[0]; |
---|
| 498 | if ($menu->get_id() != 'menubar') |
---|
| 499 | return; |
---|
| 500 | $menu->register_block( new RegisteredBlock( 'mbLinks', 'Links', 'piwigo')); |
---|
[6993] | 501 | $menu->register_block( new RegisteredBlock( 'mbCategories', 'Albums', 'piwigo')); |
---|
[2488] | 502 | $menu->register_block( new RegisteredBlock( 'mbTags', 'Related tags', 'piwigo')); |
---|
[5178] | 503 | $menu->register_block( new RegisteredBlock( 'mbSpecials', 'Specials', 'piwigo')); |
---|
| 504 | $menu->register_block( new RegisteredBlock( 'mbMenu', 'Menu', 'piwigo')); |
---|
| 505 | $menu->register_block( new RegisteredBlock( 'mbIdentification', 'Identification', 'piwigo') ); |
---|
[2488] | 506 | } |
---|
| 507 | |
---|
[6993] | 508 | ?> |
---|