1<?php
2/**
3 * Coppermine Photo Gallery
4 *
5 * v1.0 originally written by Gregory Demar
6 *
7 * @copyright  Copyright (c) 2003-2021 Coppermine Dev Team
8 * @license    GNU General Public License version 3 or later; see LICENSE
9 *
10 * include/themes.inc.php
11 * @since  1.6.10
12 */
13
14/////////////////////////////////////////////////////////////////
15//                                                             //
16// Do not edit this file.                                      //
17// If you need to customize your theme,                        //
18// edit themes/yourtheme/theme.php instead !!!                 //
19// Take a look at the sample theme (themes/sample/theme.php)   //
20// to get an idea what to copy into your custom theme.         //
21// Really, don't edit this file! We mean it!                   //
22//                                                             //
23/////////////////////////////////////////////////////////////////
24
25// ----------------------------------------------------------------------------- //
26// All lines that should NOT be IN themes/sample/theme.php             //{THEMES}//
27// should end in "//{THEMES}" so that they can be easily stripped      //{THEMES}//
28// The individual sections are marked accordingly with                       //
29      /***********************************
30      ** Section <<<SECTIONNAME>>> - START
31      ***********************************/
32      // actual code here
33      /***********************************
34      ** Section <<<SECTIONNAME>>> - END
35      ***********************************/
36// ----------------------------------------------------------------------------- //
37
38defined('IN_COPPERMINE') or die('Not in Coppermine...');         //{THEMES}//
39
40if (!function_exists('assemble_template_buttons')) {  //{THEMES}
41/******************************************************************************
42** Section <<<assemble_template_buttons>>> - START
43******************************************************************************/
44// Creates buttons from a template using an array of tokens
45// this function is used in this file it needs to be declared before being called.
46function assemble_template_buttons($template_buttons,$buttons)
47{
48    $counter=0;
49    $output='';
50
51    foreach ($buttons as $button)  {
52        if (isset($button[4])) {
53            $spacer=$button[4];
54        } else {
55            $spacer='';
56        }
57
58        $params = array(
59            '{SPACER}'     => $spacer,
60            '{BLOCK_ID}'   => $button[3],
61            '{HREF_TGT}'   => $button[2],
62            '{HREF_TITLE}' => $button[1],
63            '{HREF_LNK}'   => $button[0],
64            '{HREF_ATTRIBUTES}'   => $button[5]
65            );
66        $output.=template_eval($template_buttons, $params);
67    }
68    return $output;
69}
70/******************************************************************************
71** Section <<<assemble_template_buttons>>> - END
72******************************************************************************/
73}  //{THEMES}
74
75
76if (!function_exists('addbutton')) {  //{THEMES}
77/******************************************************************************
78** Section <<<addbutton>>> - START
79******************************************************************************/
80// Creates an array of tokens to be used with function assemble_template_buttons
81// this function is used in this file it needs to be declared before being called.
82function addbutton(&$menu,$href_lnk,$href_title,$href_tgt,$block_id,$spacer,$href_attrib='')
83{
84    $menu[]=array($href_lnk,$href_title,$href_tgt,$block_id,$spacer,$href_attrib);
85}
86/******************************************************************************
87** Section <<<addbutton>>> - END
88******************************************************************************/
89}  //{THEMES}
90
91
92if (!isset($template_sys_menu)) { //{THEMES}
93/******************************************************************************
94** Section <<<$template_sys_menu>>> - START
95******************************************************************************/
96// HTML template for sys_menu
97$template_sys_menu = <<<EOT
98          {BUTTONS}
99EOT;
100/******************************************************************************
101** Section <<<$template_sys_menu>>> - END
102******************************************************************************/
103} //{THEMES}
104
105if (!isset($template_sub_menu)) { //{THEMES}
106/******************************************************************************
107** Section <<<$template_sub_menu>>> - START
108******************************************************************************/
109// HTML template for sub_menu
110$template_sub_menu = $template_sys_menu;
111}  //{THEMES}
112
113if (!defined('THEME_HAS_NO_SYS_MENU_BUTTONS')) {
114
115  // HTML template for template sys_menu spacer
116  if (!isset($template_sys_menu_spacer))  //{THEMES}
117  $template_sys_menu_spacer ="::";
118
119  // HTML template for template sys_menu buttons
120  if (!isset($template_sys_menu_button))  //{THEMES}
121  $template_sys_menu_button = <<<EOT
122  <!-- BEGIN {BLOCK_ID} -->
123        <a href="{HREF_TGT}" title="{HREF_TITLE}" {HREF_ATTRIBUTES}>{HREF_LNK}</a> {SPACER}
124  <!-- END {BLOCK_ID} -->
125EOT;
126
127  // HTML template for template sys_menu buttons
128  if (!isset($sys_menu_buttons)) { //{THEMES}
129    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}{HREF_ATTRIBUTES}
130    addbutton($sys_menu_buttons,'{HOME_LNK}','{HOME_TITLE}','{HOME_TGT}','home',$template_sys_menu_spacer);
131    addbutton($sys_menu_buttons,'{CONTACT_LNK}','{CONTACT_TITLE}','{CONTACT_TGT}','contact',$template_sys_menu_spacer);
132    addbutton($sys_menu_buttons,'{MY_GAL_LNK}','{MY_GAL_TITLE}','{MY_GAL_TGT}','my_gallery',$template_sys_menu_spacer);
133    addbutton($sys_menu_buttons,'{MEMBERLIST_LNK}','{MEMBERLIST_TITLE}','{MEMBERLIST_TGT}','allow_memberlist',$template_sys_menu_spacer);
134    if (array_key_exists('allowed_albums', $USER_DATA) && is_array($USER_DATA['allowed_albums']) && count($USER_DATA['allowed_albums'])) {
135      addbutton($sys_menu_buttons,'{UPL_APP_LNK}','{UPL_APP_TITLE}','{UPL_APP_TGT}','upload_approval',$template_sys_menu_spacer);
136    }
137    addbutton($sys_menu_buttons,'{MY_PROF_LNK}','{MY_PROF_TITLE}','{MY_PROF_TGT}','my_profile',$template_sys_menu_spacer);
138    addbutton($sys_menu_buttons,'{ADM_MODE_LNK}','{ADM_MODE_TITLE}','{ADM_MODE_TGT}','enter_admin_mode',$template_sys_menu_spacer);
139    addbutton($sys_menu_buttons,'{USR_MODE_LNK}','{USR_MODE_TITLE}','{USR_MODE_TGT}','leave_admin_mode',$template_sys_menu_spacer);
140    addbutton($sys_menu_buttons,'{SIDEBAR_LNK}','{SIDEBAR_TITLE}','{SIDEBAR_TGT}','sidebar',$template_sys_menu_spacer);
141    addbutton($sys_menu_buttons,'{UPL_PIC_LNK}','{UPL_PIC_TITLE}','{UPL_PIC_TGT}','upload_pic',$template_sys_menu_spacer);
142    addbutton($sys_menu_buttons,'{REGISTER_LNK}','{REGISTER_TITLE}','{REGISTER_TGT}','register',$template_sys_menu_spacer);
143    addbutton($sys_menu_buttons,'{LOGIN_LNK}','{LOGIN_TITLE}','{LOGIN_TGT}','login','');
144    addbutton($sys_menu_buttons,'{LOGOUT_LNK}','{LOGOUT_TITLE}','{LOGOUT_TGT}','logout','');
145    // Login and Logout don't have a spacer as only one is shown, and either would be the last option.
146  } //{THEMES}
147
148
149  $sys_menu_buttons = CPGPluginAPI::filter('sys_menu',$sys_menu_buttons);
150  $params = array('{BUTTONS}' => assemble_template_buttons($template_sys_menu_button,$sys_menu_buttons));
151  $template_sys_menu = template_eval($template_sys_menu,$params);
152}
153/******************************************************************************
154** Section <<<$template_sub_menu>>> - END
155******************************************************************************/
156
157/******************************************************************************
158** Section <<<THEME_HAS_NO_SUB_MENU_BUTTONS>>> - START
159******************************************************************************/
160if (!defined('THEME_HAS_NO_SUB_MENU_BUTTONS')) {
161
162    // HTML template for template sub_menu spacer
163    if (!isset($template_sub_menu_spacer))  //{THEMES}
164    $template_sub_menu_spacer = $template_sys_menu_spacer;
165
166    // HTML template for template sub_menu buttons
167    if (!isset($template_sub_menu_button))  //{THEMES}
168    $template_sub_menu_button = $template_sys_menu_button;
169
170    // HTML template for template sub_menu buttons
171    if (!isset($sub_menu_buttons)) { //{THEMES}
172    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}{HREF_ATTRIBUTES}
173    addbutton($sub_menu_buttons,'{CUSTOM_LNK_LNK}','{CUSTOM_LNK_TITLE}','{CUSTOM_LNK_TGT}','custom_link',$template_sub_menu_spacer);
174    addbutton($sub_menu_buttons,'{ALB_LIST_LNK}','{ALB_LIST_TITLE}','{ALB_LIST_TGT}','album_list',$template_sub_menu_spacer);
175    addbutton($sub_menu_buttons,'{LASTUP_LNK}','{LASTUP_TITLE}','{LASTUP_TGT}','lastup',$template_sub_menu_spacer,'rel="nofollow"');
176    addbutton($sub_menu_buttons,'{LASTCOM_LNK}','{LASTCOM_TITLE}','{LASTCOM_TGT}','lastcom',$template_sub_menu_spacer,'rel="nofollow"');
177    addbutton($sub_menu_buttons,'{TOPN_LNK}','{TOPN_TITLE}','{TOPN_TGT}','topn',$template_sub_menu_spacer,'rel="nofollow"');
178    addbutton($sub_menu_buttons,'{TOPRATED_LNK}','{TOPRATED_TITLE}','{TOPRATED_TGT}','toprated',$template_sub_menu_spacer,'rel="nofollow"');
179    addbutton($sub_menu_buttons,'{FAV_LNK}','{FAV_TITLE}','{FAV_TGT}','favpics',$template_sub_menu_spacer,'rel="nofollow"');
180    if ($CONFIG['browse_by_date'] != 0) {
181        addbutton($sub_menu_buttons, '{BROWSEBYDATE_LNK}', '{BROWSEBYDATE_TITLE}', '{BROWSEBYDATE_TGT}', 'browse_by_date', $template_sub_menu_spacer, 'rel="nofollow" class="greybox"');
182    }
183    addbutton($sub_menu_buttons,'{SEARCH_LNK}','{SEARCH_TITLE}','{SEARCH_TGT}','search','');
184    } //{THEMES}
185
186    $sub_menu_buttons = CPGPluginAPI::filter('sub_menu',$sub_menu_buttons);
187    $params = array('{BUTTONS}' => assemble_template_buttons($template_sub_menu_button,$sub_menu_buttons));
188    $template_sub_menu = template_eval($template_sub_menu,$params);
189}
190/******************************************************************************
191** Section <<<THEME_HAS_NO_SUB_MENU_BUTTONS>>> - END
192******************************************************************************/
193
194if (!isset($template_gallery_admin_menu)) { //{THEMES}
195/******************************************************************************
196** Section <<<$template_gallery_admin_menu>>> - START
197******************************************************************************/
198// HTML template for gallery admin menu
199$template_gallery_admin_menu = <<<EOT
200
201        <div class="admin_menu_wrapper">
202            <!-- BEGIN admin_approval -->
203                <div class="admin_menu admin_float" id="admin_menu_anim"><a href="editpics.php?mode=upload_approval" title="{UPL_APP_TITLE}">{UPL_APP_ICO}{UPL_APP_LNK}</a></div>
204            <!-- END admin_approval -->
205            <!-- BEGIN config -->
206                <div class="admin_menu admin_float"><a href="admin.php" title="{ADMIN_TITLE}">{ADMIN_ICO}{ADMIN_LNK}</a></div>
207            <!-- END config -->
208            <!-- BEGIN catmgr -->
209                <div class="admin_menu admin_float"><a href="catmgr.php" title="{CATEGORIES_TITLE}">{CATEGORIES_ICO}{CATEGORIES_LNK}</a></div>
210            <!-- END catmgr -->
211            <!-- BEGIN albmgr -->
212                <div class="admin_menu admin_float"><a href="albmgr.php{CATL}" title="{ALBUMS_TITLE}">{ALBUMS_ICO}{ALBUMS_LNK}</a></div>
213            <!-- END albmgr -->
214            <!-- BEGIN picmgr -->
215                <div class="admin_menu admin_float"><a href="picmgr.php" title="{PICTURES_TITLE}">{PICTURES_ICO}{PICTURES_LNK}</a></div>
216            <!-- end picmgr -->
217            <!-- BEGIN groupmgr -->
218                <div class="admin_menu admin_float"><a href="groupmgr.php" title="{GROUPS_TITLE}">{GROUPS_ICO}{GROUPS_LNK}</a></div>
219            <!-- END groupmgr -->
220            <!-- BEGIN usermgr -->
221                <div class="admin_menu admin_float"><a href="usermgr.php" title="{USERS_TITLE}">{USERS_ICO}{USERS_LNK}</a></div>
222            <!-- END usermgr -->
223            <!-- BEGIN banmgr -->
224                <div class="admin_menu admin_float"><a href="banning.php" title="{BAN_TITLE}">{BAN_ICO}{BAN_LNK}</a></div>
225            <!-- END banmgr -->
226            <!-- BEGIN admin_profile -->
227                <div class="admin_menu admin_float"><a href="profile.php?op=edit_profile" title="{MY_PROF_TITLE}">{MY_PROF_ICO}{MY_PROF_LNK}</a></div>
228            <!-- END admin_profile -->
229            <!-- BEGIN review_comments -->
230                <div class="admin_menu admin_float"><a href="reviewcom.php" title="{COMMENTS_TITLE}">{COMMENTS_ICO}{COMMENTS_LNK}</a></div>
231            <!-- END review_comments -->
232            <!-- BEGIN log_ecards -->
233                <div class="admin_menu admin_float"><a href="db_ecard.php" title="{DB_ECARD_TITLE}">{DB_ECARD_ICO}{DB_ECARD_LNK}</a></div>
234            <!-- END log_ecards -->
235            <!-- BEGIN batch_add -->
236                <div class="admin_menu admin_float"><a href="searchnew.php" title="{SEARCHNEW_TITLE}">{SEARCHNEW_ICO}{SEARCHNEW_LNK}</a></div>
237            <!-- END batch_add -->
238            <!-- BEGIN admin_tools -->
239                <div class="admin_menu admin_float"><a href="util.php?t={TIME_STAMP}#admin_tools" title="{UTIL_TITLE}">{UTIL_ICO}{UTIL_LNK}</a></div>
240            <!-- END admin_tools -->
241            <!-- BEGIN keyword_manager -->
242                <div class="admin_menu admin_float"><a href="keywordmgr.php" title="{KEYWORDMGR_TITLE}">{KEYWORDMGR_ICO}{KEYWORDMGR_LNK}</a></div>
243            <!-- END keyword_manager -->
244            <!-- BEGIN exif_manager -->
245                <div class="admin_menu admin_float"><a href="exifmgr.php" title="{EXIFMGR_TITLE}">{EXIFMGR_ICO}{EXIFMGR_LNK}</a></div>
246            <!-- END exif_manager -->
247            <!-- BEGIN plugin_manager -->
248                <div class="admin_menu admin_float"><a href="pluginmgr.php" title="{PLUGINMGR_TITLE}">{PLUGINMGR_ICO}{PLUGINMGR_LNK}</a></div>
249            <!-- END plugin_manager -->
250            <!-- BEGIN bridge_manager -->
251                <div class="admin_menu admin_float"><a href="bridgemgr.php" title="{BRIDGEMGR_TITLE}">{BRIDGEMGR_ICO}{BRIDGEMGR_LNK}</a></div>
252            <!-- END bridge_manager -->
253            <!-- BEGIN view_log_files -->
254                <div class="admin_menu admin_float"><a href="viewlog.php" title="{VIEW_LOG_FILES_TITLE}">{VIEW_LOG_FILES_ICO}{VIEW_LOG_FILES_LNK}</a></div>
255            <!-- END view_log_files -->
256            <!-- BEGIN overall_stats -->
257                <div class="admin_menu admin_float"><a href="stat_details.php?type=hits&amp;sort=sdate&amp;dir=&amp;sdate=1&amp;ip=1&amp;search_phrase=0&amp;referer=0&amp;browser=1&amp;os=1&amp;mode=fullscreen&amp;page=1&amp;amount=50" title="{OVERALL_STATS_TITLE}">{OVERALL_STATS_ICO}{OVERALL_STATS_LNK}</a></div>
258            <!-- END overall_stats -->
259            <!-- BEGIN check_versions -->
260                <div class="admin_menu admin_float"><a href="versioncheck.php" title="{CHECK_VERSIONS_TITLE}">{CHECK_VERSIONS_ICO}{CHECK_VERSIONS_LNK}</a></div>
261            <!-- END check_versions -->
262            <!-- BEGIN update_database -->
263                <div class="admin_menu admin_float"><a href="update.php" title="{UPDATE_DATABASE_TITLE}">{UPDATE_DATABASE_ICO}{UPDATE_DATABASE_LNK}</a></div>
264            <!-- END update_database -->
265            <!-- BEGIN php_info -->
266                <div class="admin_menu admin_float"><a href="phpinfo.php" title="{PHPINFO_TITLE}">{PHPINFO_ICO}{PHPINFO_LNK}</a></div>
267            <!-- END php_info -->
268            <!-- BEGIN show_news -->
269                <div class="admin_menu admin_float"><a href="mode.php?what=news&amp;referer=$REFERER" title="{SHOWNEWS_TITLE}">{SHOWNEWS_ICO}{SHOWNEWS_LNK}</a></div>
270            <!-- END show_news -->
271            <!-- BEGIN documentation -->
272                <div class="admin_menu admin_float"><a href="{DOCUMENTATION_HREF}" title="{DOCUMENTATION_TITLE}">{DOCUMENTATION_ICO}{DOCUMENTATION_LNK}</a></div>
273            <!-- END documentation -->
274            <div style="clear:left;">
275            </div>
276        </div>
277
278EOT;
279/******************************************************************************
280** Section <<<$template_gallery_admin_menu>>> - END
281******************************************************************************/
282} //{THEMES}
283
284if (!isset($template_user_admin_menu)) { //{THEMES}
285/******************************************************************************
286** Section <<<$template_user_admin_menu>>> - START
287******************************************************************************/
288// HTML template for user admin menu
289$template_user_admin_menu = <<<EOT
290
291                <div align="center">
292                <table cellpadding="0" cellspacing="1">
293                        <tr>
294                                <td class="admin_menu"><a href="albmgr.php" title="{ALBMGR_TITLE}">{ALBUMS_ICO}{ALBMGR_LNK}</a></td>
295                                <td class="admin_menu"><a href="modifyalb.php" title="{MODIFYALB_TITLE}">{MODIFYALB_ICO}{MODIFYALB_LNK}</a></td>
296                                <td class="admin_menu"><a href="profile.php?op=edit_profile" title="{MY_PROF_TITLE}">{MY_PROF_ICO}{MY_PROF_LNK}</a></td>
297                                <td class="admin_menu"><a href="picmgr.php" title="{PICTURES_TITLE}">{PICTURES_ICO}{PICTURES_LNK}</a></td>
298                        </tr>
299                </table>
300                </div>
301
302EOT;
303/******************************************************************************
304** Section <<<$template_user_admin_menu>>> - END
305******************************************************************************/
306} //{THEMES}
307
308if (!isset($template_cat_list)) { //{THEMES}
309/******************************************************************************
310** Section <<<$template_cat_list>>> - START
311******************************************************************************/
312// HTML template for the category list
313$template_cat_list = <<<EOT
314<!-- BEGIN header -->
315        <tr>
316                <td class="tableh1" width="80%" align="left">{CATEGORY}</td>
317                <td class="tableh1" width="10%" align="center">{ALBUMS}</td>
318                <td class="tableh1" width="10%" align="center">{PICTURES}</td>
319        </tr>
320<!-- END header -->
321<!-- BEGIN catrow_noalb -->
322        <tr>
323                <td class="catrow_noalb" colspan="3"><table border="0"><tr><td align="left">{CAT_THUMB}</td><td align="left"><span class="catlink">{CAT_TITLE}</span>{CAT_DESC}</td></tr></table></td>
324        </tr>
325<!-- END catrow_noalb -->
326<!-- BEGIN catrow -->
327        <tr>
328                <td class="catrow" align="left"><table border="0"><tr><td>{CAT_THUMB}</td><td><span class="catlink">{CAT_TITLE}</span>{CAT_DESC}</td></tr></table></td>
329                <td class="catrow" align="center">{ALB_COUNT}</td>
330                <td class="catrow" align="center">{PIC_COUNT}</td>
331        </tr>
332        <tr>
333            <td class="tableb tableb_alternate" colspan="3">{CAT_ALBUMS}</td>
334        </tr>
335<!-- END catrow -->
336<!-- BEGIN footer -->
337        <tr>
338                <td colspan="3" class="tableh1" align="center"><span class="statlink">{STATISTICS}</span></td>
339        </tr>
340<!-- END footer -->
341<!-- BEGIN spacer -->
342        <img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
343<!-- END spacer -->
344
345EOT;
346/******************************************************************************
347** Section <<<$template_cat_list>>> - END
348******************************************************************************/
349} //{THEMES}
350
351if (!isset($template_breadcrumb)) { //{THEMES}
352/******************************************************************************
353** Section <<<$template_breadcrumb>>> - START
354******************************************************************************/
355// HTML template for the breadcrumb
356$template_breadcrumb = <<<EOT
357<!-- BEGIN breadcrumb -->
358        <tr>
359            <td colspan="3" align="left" class="tableh1">
360                <span class="statlink">{BREADCRUMB}</span>
361            </td>
362        </tr>
363<!-- END breadcrumb -->
364<!-- BEGIN breadcrumb_user_gal -->
365        <tr>
366            <td colspan="3" class="tableh1">
367                <table width="100%" cellpadding="0" cellspacing="0" border="0">
368                    <tr>
369                        <td align="left"><span class="statlink">{BREADCRUMB}</span></td>
370                        <td align="right"><span class="statlink">{STATISTICS}</span></td>
371                    </tr>
372                </table>
373            </td>
374        </tr>
375<!-- END breadcrumb_user_gal -->
376
377EOT;
378/******************************************************************************
379** Section <<<$template_breadcrumb>>> - END
380******************************************************************************/
381} //{THEMES}
382
383if (!isset($template_album_list)) { //{THEMES}
384/******************************************************************************
385** Section <<<$template_album_list>>> - START
386******************************************************************************/
387// HTML template for the album list
388$template_album_list = <<<EOT
389
390<!-- BEGIN stat_row -->
391        <tr>
392                <td colspan="{COLUMNS}" class="tableh1" align="center"><span class="statlink">{STATISTICS}</span></td>
393        </tr>
394<!-- END stat_row -->
395<!-- BEGIN header -->
396        <tr class="tableb tableb_alternate">
397<!-- END header -->
398<!-- BEGIN album_cell -->
399        <td width="{COL_WIDTH}%" valign="top">
400        <table width="100%" cellspacing="0" cellpadding="0">
401        <tr>
402                <td colspan="3" height="1" align="left" valign="top" class="tableh2">
403                        <span class="alblink"><a href="{ALB_LINK_TGT}">{ALBUM_TITLE}</a></span>
404                </td>
405        </tr>
406        <tr>
407                <td colspan="3">
408                        <img src="images/spacer.gif" width="1" height="1" border="0" alt="" /><br />
409                </td>
410        </tr>
411        <tr>
412                <td align="center" valign="middle" class="thumbnails">
413                        <img src="images/spacer.gif" width="{THUMB_CELL_WIDTH}" height="1" style="margin-top: 0px; margin-bottom: 0px; border: none;" alt="" /><br />
414                        <a href="{ALB_LINK_TGT}" class="albums">{ALB_LINK_PIC}<br /></a>
415                </td>
416                <td>
417                        <img src="images/spacer.gif" width="1" height="1" border="0" alt="" />
418                </td>
419                <td width="100%" valign="top" align="left" class="tableb tableb_alternate">
420                        {ADMIN_MENU}
421                        <p>{ALB_DESC}</p>
422                        <p class="album_stat">{ALB_INFOS}<br />{ALB_HITS}</p>
423                </td>
424        </tr>
425        </table>
426        </td>
427<!-- END album_cell -->
428<!-- BEGIN empty_cell -->
429        <td width="{COL_WIDTH}%" valign="top">
430        <table width="100%" cellspacing="0" cellpadding="0">
431        <tr>
432                <td height="1" valign="top" class="tableh2">
433                        &nbsp;
434                </td>
435        </tr>
436        <tr>
437                <td>
438                        <img src="images/spacer.gif" width="1" height="1" border="0" alt="" /><br />
439                </td>
440        </tr>
441        <tr>
442                <td width="100%" valign="top" class="tableb tableb_alternate">
443                    <div class="thumbnails" style="background-color:transparent"><img src="images/spacer.gif" width="1" height="1" border="0" class="image" style="border:0;margin-top:1px;margin-bottom:0" alt="" /></div>
444                </td>
445        </tr>
446        </table>
447        </td>
448<!-- END empty_cell -->
449<!-- BEGIN row_separator -->
450        </tr>
451        <tr class="tableb tableb_alternate">
452<!-- END row_separator -->
453<!-- BEGIN footer -->
454        </tr>
455<!-- END footer -->
456<!-- BEGIN tabs -->
457        <tr>
458                <td colspan="{COLUMNS}" style="padding: 0px;">
459                        <table width="100%" cellspacing="0" cellpadding="0">
460                                <tr>
461                                       {TABS}
462                                </tr>
463                        </table>
464                </td>
465        </tr>
466<!-- END tabs -->
467<!-- BEGIN spacer -->
468        <img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
469<!-- END spacer -->
470
471EOT;
472/******************************************************************************
473** Section <<<$template_album_list>>> - END
474******************************************************************************/
475} //{THEMES}
476
477if (!isset($template_film_strip)) { //{THEMES}
478/******************************************************************************
479** Section <<<$template_film_strip>>> - START
480******************************************************************************/
481// HTML template for filmstrip display
482$template_film_strip = <<<EOT
483
484        <tr>
485          <td valign="top" class="filmstrip_background" style="background-image: url({TILE1});"><img src="{TILE1}" alt="" border="0" /></td>
486        </tr>
487        <tr>
488          <td valign="bottom" class="thumbnails filmstrip_background" align="center" style="{THUMB_TD_STYLE}">
489            <table width="100%" cellspacing="0" cellpadding="3" border="0">
490                <tr>
491                   <td width="50%" class="prev_strip"></td>
492                     <td valign="bottom"  style="{THUMB_TD_STYLE}">
493                       <div id="film" style="{SET_WIDTH}"><table class="tape" ><tr>{THUMB_STRIP}</tr></table></div>
494                     </td>
495                   <td width="50%" align="right" class="next_strip"></td>
496                </tr>
497            </table>
498          </td>
499        </tr>
500        <tr>
501         <td valign="top" class="filmstrip_background" style="background-image: url({TILE2});"><img src="{TILE2}" alt="" border="0" /></td>
502        </tr>
503<!-- BEGIN thumb_cell -->
504                <td class="thumb" >
505                  <a href="{LINK_TGT}" class="thumbLink" style="{ONE_WIDTH}">{THUMB}</a>
506                </td>
507<!-- END thumb_cell -->
508<!-- BEGIN empty_cell -->
509                <td valign="top" align="center" >&nbsp;</td>
510<!-- END empty_cell -->
511
512EOT;
513/******************************************************************************
514** Section <<<$template_film_strip>>> - END
515******************************************************************************/
516} //{THEMES}
517
518if (!isset($template_album_list_cat)) { //{THEMES}
519/******************************************************************************
520** Section <<<$template_album_list_cat>>> - START
521******************************************************************************/
522// HTML template for the album list
523$template_album_list_cat = <<<EOT
524
525<!-- BEGIN c_stat_row -->
526        <tr>
527                <td colspan="{COLUMNS}" class="tableh1" align="center"><span class="statlink">{STATISTICS}</span></td>
528        </tr>
529<!-- END c_stat_row -->
530<!-- BEGIN c_header -->
531        <tr class="tableb tableb_alternate">
532<!-- END c_header -->
533<!-- BEGIN c_album_cell -->
534        <td width="{COL_WIDTH}%" valign="top">
535        <table width="100%" cellspacing="0" cellpadding="0">
536        <tr>
537                <td colspan="3" height="1" valign="top" class="tableh2">
538                        <span class="alblink"><a href="{ALB_LINK_TGT}">{ALBUM_TITLE}</a></span>
539                </td>
540        </tr>
541        <tr>
542                <td colspan="3">
543                        <img src="images/spacer.gif" width="1" height="1" border="0" alt="" /><br />
544                </td>
545        </tr>
546        <tr>
547                <td align="center" valign="middle" class="thumbnails">
548                        <img src="images/spacer.gif" width="{THUMB_CELL_WIDTH}" height="1" style="margin-top: 0px; margin-bottom: 0px; border: none;" alt="" /><br />
549                        <a href="{ALB_LINK_TGT}" class="albums">{ALB_LINK_PIC}<br /></a>
550                </td>
551                <td>
552                        <img src="images/spacer.gif" width="1" height="1" border="0" alt="" />
553                </td>
554                <td width="100%" valign="top" class="tableb tableb_alternate">
555                        {ADMIN_MENU}
556                        <p>{ALB_DESC}</p>
557                        <p class="album_stat">{ALB_INFOS}<br />{ALB_HITS}</p>
558                </td>
559        </tr>
560        </table>
561        </td>
562<!-- END c_album_cell -->
563<!-- BEGIN c_empty_cell -->
564        <td width="{COL_WIDTH}%" valign="top">
565        <table width="100%" cellspacing="0" cellpadding="0" >
566        <tr>
567                <td height="1" valign="top" class="tableh2">
568                        &nbsp;
569                </td>
570        </tr>
571        <tr>
572                <td>
573                        <img src="images/spacer.gif" width="1" height="1" border="0" alt="" /><br />
574                </td>
575        </tr>
576        <tr>
577                <td width="100%" valign="top" class="tableb tableb_alternate" >
578                      <div class="thumbnails" style="background-color:transparent"><img src="images/spacer.gif" width="1" height="1" border="0" class="image" style="border:0;margin-top:1px;margin-bottom:0" alt="" /></div>
579                </td>
580        </tr>
581        </table>
582        </td>
583<!-- END c_empty_cell -->
584<!-- BEGIN c_row_separator -->
585        </tr>
586        <tr class="tableb tableb_alternate">
587<!-- END c_row_separator -->
588<!-- BEGIN c_footer -->
589        </tr>
590<!-- END c_footer -->
591<!-- BEGIN c_tabs -->
592        <tr>
593                <td colspan="{COLUMNS}" style="padding: 0px;">
594                        <table width="100%" cellspacing="0" cellpadding="0">
595                                <tr>
596                                       {TABS}
597                                </tr>
598                        </table>
599                </td>
600        </tr>
601<!-- END c_tabs -->
602<!-- BEGIN c_spacer -->
603        <img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
604<!-- END c_spacer -->
605
606EOT;
607/******************************************************************************
608** Section <<<$template_album_list_cat>>> - END
609******************************************************************************/
610} //{THEMES}
611
612if (!isset($template_album_admin_menu)) { //{THEMES}
613/******************************************************************************
614** Section <<<$template_album_admin_menu>>> - START
615******************************************************************************/
616// HTML template for the ALBUM admin menu displayed in the album list
617$template_album_admin_menu = <<<EOT
618        <div class="buttonlist align_right">
619                <ul>
620                        <li>
621                                <a href="delete.php?id={ALBUM_ID}&amp;what=album&amp;form_token={FORM_TOKEN}&amp;timestamp={TIMESTAMP}" onclick="return confirm('{CONFIRM_DELETE}');"><span>{DELETE}</span></a>
622                        </li>
623                        <li>
624                                <a href="modifyalb.php?album={ALBUM_ID}"><span>{MODIFY}</span></a>
625                        </li>
626                        <li>
627                                <a href="editpics.php?album={ALBUM_ID}"><span class="last">{EDIT_PICS}</span></a>
628                        </li>
629                </ul>
630        </div>
631        <div class="clearer"></div>
632
633EOT;
634/******************************************************************************
635** Section <<<$template_album_admin_menu>>> - END
636******************************************************************************/
637} //{THEMES}
638
639if (!isset($template_thumb_view_title_row)) { //{THEMES}
640/******************************************************************************
641** Section <<<$template_thumb_view_title_row>>> - START
642******************************************************************************/
643// HTML template for title row of the thumbnail view (album title + sort options)
644$template_thumb_view_title_row = <<<EOT
645
646        <table width="100%" cellpadding="0" cellspacing="0" border="0">
647            <tr>
648                <td style="vertical-align:top" class="statlink">
649                    <h2>{ALBUM_NAME}</h2>
650                </td>
651                <td style="text-align:right;" class="sortorder_cell" id="sortorder_cell">
652<!-- BEGIN admin_buttons -->
653                    <div class="buttonlist">
654                        <ul>
655                            <li><a href="modifyalb.php?album={ALBUM_ID}" title="{MODIFY_LNK}"><span>{MODIFY_ICO}</span></a></li>
656                            <li><a href="index.php?cat={CAT_ID}" title="{PARENT_CAT_LNK}"><span>{PARENT_CAT_ICO}</span></a></li>
657                            <li><a href="editpics.php?album={ALBUM_ID}" title="{EDIT_PICS_LNK}"><span>{EDIT_PICS_ICO}</span></a></li>
658                            <li><a href="albmgr.php?cat={CAT_ID}" title="{ALBUM_MGR_LNK}"><span class="last">{ALBUM_MGR_ICO}</span></a></li>
659                        </ul>
660                    </div>
661<!-- END admin_buttons -->
662                    <!-- Use JavaScript to display the sorting options only to humans, but hide them from search engines to avoid double-content indexing (js/thumbnails.js) -->
663                </td>
664            </tr>
665        </table>
666
667EOT;
668/******************************************************************************
669** Section <<<$template_thumb_view_title_row>>> - END
670******************************************************************************/
671} //{THEMES}
672
673
674if (!isset($template_fav_thumb_view_title_row)) { //{THEMES}
675/******************************************************************************
676** Section <<<$template_fav_thumb_view_title_row>>> - START
677******************************************************************************/
678// HTML template for title row of the fav thumbnail view (album title + download)
679$template_fav_thumb_view_title_row = <<<EOT
680
681                        <table width="100%" cellpadding="0" cellspacing="0">
682                        <tr>
683                                <td width="100%" class="statlink"><h2>{ALBUM_NAME}</h2></td>
684                                <td><img src="images/spacer.gif" width="1" border="0" alt="" /></td>
685                                <td class="sortorder_cell">
686                                        <table cellpadding="0" cellspacing="0">
687                                                <tr>
688                                                        <td class="sortorder_options"><span class="statlink"><a href="zipdownload.php">{DOWNLOAD_ZIP}</a></span></td>
689                                                </tr>
690                                                </table>
691                                </td>
692                        </tr>
693                        </table>
694
695EOT;
696/******************************************************************************
697** Section <<<$template_fav_thumb_view_title_row>>> - END
698******************************************************************************/
699} //{THEMES}
700
701
702if (!isset($template_thumbnail_view)) { //{THEMES}
703/******************************************************************************
704** Section <<<$template_thumbnail_view>>> - START
705******************************************************************************/
706
707// HTML template for thumbnails display
708$template_thumbnail_view = <<<EOT
709
710<!-- BEGIN header -->
711        <tr>
712<!-- END header -->
713<!-- BEGIN thumb_cell -->
714        <td valign="top" class="thumbnails" width ="{CELL_WIDTH}" align="center">
715                <table width="100%" cellpadding="0" cellspacing="0">
716                        <tr>
717                                <td align="center">
718                                        <a href="{LINK_TGT}">{THUMB}<br /></a>
719                                        {CAPTION}
720                                        {ADMIN_MENU}
721                                </td>
722                        </tr>
723                </table>
724        </td>
725<!-- END thumb_cell -->
726
727<!-- BEGIN empty_cell -->
728                <td valign="top" class="thumbnails" align="center">&nbsp;</td>
729<!-- END empty_cell -->
730<!-- BEGIN row_separator -->
731        </tr>
732        <tr>
733<!-- END row_separator -->
734<!-- BEGIN footer -->
735        </tr>
736<!-- END footer -->
737<!-- BEGIN tabs -->
738        <tr>
739                <td colspan="{THUMB_COLS}" style="padding: 0px;">
740                        <table width="100%" cellspacing="0" cellpadding="0">
741                                <tr>
742                                       {TABS}
743                                </tr>
744                        </table>
745                </td>
746        </tr>
747<!-- END tabs -->
748<!-- BEGIN spacer -->
749        <img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
750<!-- END spacer -->
751
752EOT;
753/******************************************************************************
754** Section <<<$template_thumbnail_view>>> - END
755******************************************************************************/
756} //{THEMES}
757
758if (!isset($template_no_img_to_display)) { //{THEMES}
759/******************************************************************************
760** Section <<<$template_no_img_to_display>>> - START
761******************************************************************************/
762// HTML template for the thumbnail view when there is no picture to show
763$template_no_img_to_display = <<<EOT
764        <tr>
765                <td class="tableb tableb_alternate" height="200" align="center">
766                        <span class="cpg_user_message">{TEXT}</span>
767                </td>
768        </tr>
769<!-- BEGIN spacer -->
770        <img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
771<!-- END spacer -->
772
773EOT;
774/******************************************************************************
775** Section <<<$template_no_img_to_display>>> - END
776******************************************************************************/
777} //{THEMES}
778
779if (!isset($template_user_list_info_box)) { //{THEMES}
780/******************************************************************************
781** Section <<<$template_user_list_info_box>>> - START
782******************************************************************************/
783// HTML template for the USER info box in the user list view
784$template_user_list_info_box = <<<EOT
785
786        <table cellspacing="1" cellpadding="0" border="0" width="100%" class="user_thumb_infobox">
787                <tr>
788                        <th><a href="profile.php?uid={USER_ID}">{USER_NAME}</a></th>
789                </tr>
790                <tr>
791                        <td>{ALBUMS}</td>
792                </tr>
793                <tr>
794                        <td>{PICTURES}</td>
795                </tr>
796        </table>
797
798EOT;
799/******************************************************************************
800** Section <<<$template_user_list_info_box>>> - END
801******************************************************************************/
802} //{THEMES}
803
804if (!isset($template_img_navbar)) { //{THEMES}
805/******************************************************************************
806** Section <<<$template_img_navbar>>> - START
807******************************************************************************/
808// HTML template for the image navigation bar
809$template_img_navbar = <<<EOT
810
811        <tr>
812                <td align="center" valign="middle" class="navmenu" width="48"><a href="{THUMB_TGT}" class="navmenu_pic" title="{THUMB_TITLE}"><img src="{LOCATION}images/navbar/thumbnails.png" align="middle" border="0" alt="{THUMB_TITLE}" /></a></td>
813<!-- BEGIN pic_info_button -->
814                <!-- button will be added by displayimage.js -->
815                <td id="pic_info_button" align="center" valign="middle" class="navmenu" width="48"></td>
816<!-- END pic_info_button -->
817<!-- BEGIN slideshow_button -->
818                <!-- button will be added by displayimage.js -->
819                <td id="slideshow_button" align="center" valign="middle" class="navmenu" width="48"></td>
820<!-- END slideshow_button -->
821                <td align="center" valign="middle" class="navmenu" width="100%">{PIC_POS}</td>
822<!-- BEGIN report_file_button -->
823                <td align="center" valign="middle" class="navmenu" width="48"><a href="{REPORT_TGT}" class="navmenu_pic" title="{REPORT_TITLE}" rel="nofollow"><img src="{LOCATION}images/navbar/report.png" border="0" align="middle" alt="{REPORT_TITLE}" /></a></td>
824<!-- END report_file_button -->
825<!-- BEGIN ecard_button -->
826                <td align="center" valign="middle" class="navmenu" width="48"><a href="{ECARD_TGT}" class="navmenu_pic" title="{ECARD_TITLE}" rel="nofollow"><img src="{LOCATION}images/navbar/ecard.png"  border="0" align="middle" alt="{ECARD_TITLE}" /></a></td>
827<!-- END ecard_button -->
828<!-- BEGIN nav_start -->
829                <td align="center" valign="middle" class="navmenu" width="48"><a href="{START_TGT}" class="navmenu_pic" title="{START_TITLE}"><img src="{LOCATION}images/navbar/{START_IMAGE}" border="0" align="middle" alt="{START_TITLE}" /></a></td>
830<!-- END nav_start -->
831<!-- BEGIN nav_prev -->
832                <td align="center" valign="middle" class="navmenu" width="48"><a href="{PREV_TGT}" class="navmenu_pic" title="{PREV_TITLE}"><img src="{LOCATION}images/navbar/{PREV_IMAGE}" border="0" align="middle" alt="{PREV_TITLE}" /></a></td>
833<!-- END nav_prev -->
834<!-- BEGIN nav_next -->
835                <td align="center" valign="middle" class="navmenu" width="48"><a href="{NEXT_TGT}" class="navmenu_pic" title="{NEXT_TITLE}"><img src="{LOCATION}images/navbar/{NEXT_IMAGE}" border="0" align="middle" alt="{NEXT_TITLE}" /></a></td>
836<!-- END nav_next -->
837<!-- BEGIN nav_end -->
838                <td align="center" valign="middle" class="navmenu" width="48"><a href="{END_TGT}" class="navmenu_pic" title="{END_TITLE}"><img src="{LOCATION}images/navbar/{END_IMAGE}" border="0" align="middle" alt="{END_TITLE}" /></a></td>
839<!-- END nav_end -->
840
841        </tr>
842
843EOT;
844/******************************************************************************
845** Section <<<$template_img_navbar>>> - END
846******************************************************************************/
847} //{THEMES}
848
849if (!isset($template_display_media)) { //{THEMES}
850/******************************************************************************
851** Section <<<$template_display_media>>> - START
852******************************************************************************/
853// HTML template for intermediate image display
854$template_display_media = <<<EOT
855        <tr>
856                <td align="center" class="display_media" nowrap="nowrap">
857                        <table width="100%" cellspacing="2" cellpadding="0">
858                                <tr>
859                                        <td align="center" style="{SLIDESHOW_STYLE}">
860                                                {IMAGE}
861                                        </td>
862                                </tr>
863                        </table>
864                </td>
865            </tr>
866            <tr>
867                <td>
868                        <table width="100%" cellspacing="2" cellpadding="0" class="tableb tableb_alternate">
869                                        <tr>
870                                                <td align="center">
871                                                        {ADMIN_MENU}
872                                                </td>
873                                        </tr>
874                        </table>
875
876
877<!-- BEGIN img_desc -->
878                        <table cellpadding="0" cellspacing="0" class="tableb tableb_alternate" width="100%">
879<!-- BEGIN title -->
880                                <tr>
881                                        <td class="tableb tableb_alternate"><h1 class="pic_title">
882                                                {TITLE}
883                                        </h1></td>
884                                </tr>
885<!-- END title -->
886<!-- BEGIN caption -->
887                                <tr>
888                                        <td class="tableb tableb_alternate"><h2 class="pic_caption">
889                                                {CAPTION}
890                                        </h2></td>
891                                </tr>
892<!-- END caption -->
893                        </table>
894<!-- END img_desc -->
895                </td>
896        </tr>
897
898EOT;
899/******************************************************************************
900** Section <<<$template_display_media>>> - END
901******************************************************************************/
902} //{THEMES}
903
904if (!isset($template_image_rating)) { //{THEMES}
905/******************************************************************************
906** Section <<<$template_image_rating>>> - START
907******************************************************************************/
908// HTML template for the image rating box
909$template_image_rating = <<<EOT
910<table align="center" width="{WIDTH}" cellspacing="1" cellpadding="0" class="maintable">
911    <tr>
912        <td colspan="6" class="tableh2" id="voting_title"><strong>{TITLE}</strong> {VOTES}</td>
913    </tr>
914    <tr id="rating_stars">
915        <td class="tableb" id="star_rating"></td>
916    </tr>
917    <tr class="noscript">
918      <td class="tableb" colspan="6" align="center">
919        <noscript>
920           {JS_WARNING}
921        </noscript>
922      </td>
923    </tr>
924</table>
925EOT;
926/******************************************************************************
927** Section <<<$template_image_rating>>> - END
928******************************************************************************/
929} //{THEMES}
930
931if (!isset($template_image_rating_oldstyle)) { //{THEMES}
932/******************************************************************************
933** Section <<<$template_image_rating_oldstyle>>> - START
934******************************************************************************/
935// HTML template for the image rating box (old-style)
936$template_image_rating_oldstyle = <<<EOT
937<table align="center" width="{WIDTH}" cellspacing="1" cellpadding="0" class="maintable">
938    <tr>
939        <td colspan="6" class="tableh2" id="voting_title"><strong>{TITLE}</strong> {VOTES}</td>
940    </tr>
941    <tr id="rating_stars">
942        <td class="tableb" id="star_rating">
943            <table width="100%">
944                <tr>
945                    {RATING_IMAGES}
946                </tr>
947            </table>
948        </td>
949    </tr>
950</table>
951EOT;
952/******************************************************************************
953** Section <<<$template_image_rating_oldstyle>>> - END
954******************************************************************************/
955} //{THEMES}
956
957if (!isset($template_image_comments)) { //{THEMES}
958/******************************************************************************
959** Section <<<$template_image_comments>>> - START
960******************************************************************************/
961// HTML template for the display of comments
962$template_image_comments = <<<EOT
963<table align="center" width="{WIDTH}" cellspacing="1" cellpadding="0" class="maintable" border="0">
964    <tr>
965        <td>
966            <table width="100%" cellpadding="0" cellspacing="0">
967                <tr>
968                    <td class="tableh2" nowrap="nowrap">
969                        <strong>{MSG_AUTHOR_LNK}</strong>
970                        <a name="comment{MSG_ID}"></a>&nbsp;
971<!-- BEGIN ipinfo -->
972                        ({IP})
973<!-- END ipinfo -->
974                    </td>
975                    <td class="tableh2" align="right" width="100%">
976<!-- BEGIN report_comment_button -->
977                        <a href="report_file.php?pid={PID}&amp;msg_id={MSG_ID}&amp;what=comment" title="{REPORT_COMMENT_TITLE}">{REPORT_COMMENT_ICON}</a>
978<!-- END report_comment_button -->
979<!-- BEGIN pending approval -->
980                        {PENDING_APPROVAL}
981<!-- END pending approval -->
982<!-- BEGIN buttons -->
983                        <script type="text/javascript">
984                            document.write('<a href="javascript:;" onclick="blocking(\'cbody{MSG_ID}\',\'\', \'block\'); blocking(\'cedit{MSG_ID}\',\'\', \'block\'); return false;" title="{EDIT_TITLE}">{EDIT_ICON}</a>');
985                        </script>
986                        <a href="delete.php?msg_id={MSG_ID}&amp;what=comment&amp;form_token={FORM_TOKEN}&amp;timestamp={TIMESTAMP}" onclick="return confirm('{CONFIRM_DELETE}');" title="{DELETE_TITLE}">{DELETE_ICON}</a>
987<!-- END buttons -->
988                    </td>
989                    <td class="tableh2" align="right" nowrap="nowrap">
990                        <span class="comment_date">[{MSG_DATE}]</span>
991                    </td>
992                </tr>
993            </table>
994        </td>
995    </tr>
996    <tr>
997        <td class="tableb tableb_alternate">
998            <div id="cbody{MSG_ID}" style="display:block">
999                {MSG_BODY}
1000            </div>
1001            <div id="cedit{MSG_ID}" style="display:none">
1002<!-- BEGIN edit_box_smilies -->
1003                <form name="f{MSG_ID}" id="f{MSG_ID}" method="post" action="db_input.php">
1004                    <table width="100%" cellpadding="0" cellspacing="0">
1005                        <tr>
1006                            <td valign="top">
1007                                <input type="hidden" name="event" value="comment_update" />
1008                                <input type="hidden" name="msg_id" value="{MSG_ID}" />
1009                            </td>
1010                        </tr>
1011                        <tr>
1012                            <td width="80%">
1013                                <textarea cols="40" rows="2" class="textinput" name="msg_body" onselect="storeCaret_f{MSG_ID}(this);" onclick="storeCaret_f{MSG_ID}(this);" onkeyup="storeCaret_f{MSG_ID}(this);" style="width: 100%;">{MSG_BODY_RAW}</textarea>
1014                            </td>
1015                            <td class="tableb tableb_alternate"></td>
1016                            <td>
1017                                <input type="submit" class="button" name="submit" value="{OK}" />
1018                                <input type="hidden" name="form_token" value="{FORM_TOKEN}" />
1019                                <input type="hidden" name="timestamp" value="{TIMESTAMP}" />
1020                            </td>
1021                        </tr>
1022                        <tr>
1023                            <td colspan="3">
1024                                <img src="images/spacer.gif" width="1" height="2" border="0" alt="" />
1025                                <br />
1026                            </td>
1027                        </tr>
1028                    </table>
1029                </form>
1030                {SMILIES}
1031<!-- END edit_box_smilies -->
1032<!-- BEGIN edit_box_no_smilies -->
1033                <form name="f{MSG_ID}" id="f{MSG_ID}" method="POST" action="db_input.php">
1034                    <table width="100%" cellpadding="0" cellspacing="0">
1035                        <tr>
1036                            <td>
1037                                <input type="hidden" name="event" value="comment_update" />
1038                                <input type="hidden" name="msg_id" value="{MSG_ID}" />
1039                            </td>
1040                        </tr>
1041                        <tr>
1042                            <td width="100%">
1043                                <textarea cols="40" rows="2" class="textinput" name="msg_body" style="width: 100%;">{MSG_BODY_RAW}</textarea>
1044                            </td>
1045                            <td class="tableb tableb_alternate"></td>
1046                            <td>
1047                                <input type="submit" class="button" name="submit" value="{OK}" />
1048                                <input type="hidden" name="form_token" value="{FORM_TOKEN}" />
1049                                <input type="hidden" name="timestamp" value="{TIMESTAMP}" />
1050                            </td>
1051                        </tr>
1052                        <tr>
1053                            <td colspan="3">
1054                                <img src="images/spacer.gif" width="1" height="2" border="0" alt="" />
1055                                <br />
1056                            </td>
1057                        </tr>
1058                    </table>
1059                </form>
1060<!-- END edit_box_no_smilies -->
1061            </div>
1062        </td>
1063    </tr>
1064</table>
1065EOT;
1066/******************************************************************************
1067** Section <<<$template_image_comments>>> - END
1068******************************************************************************/
1069} //{THEMES}
1070
1071if (!isset($template_add_your_comment)) { //{THEMES}
1072/******************************************************************************
1073** Section <<<$template_add_your_comment>>> - START
1074******************************************************************************/
1075$template_add_your_comment = <<<EOT
1076        <form method="post" name="post" id="post" onsubmit="return notDefaultUsername(this, '{DEFAULT_USERNAME}', '{DEFAULT_USERNAME_MESSAGE}');" action="db_input.php">
1077                <table align="center" width="{WIDTH}" cellspacing="1" cellpadding="0" class="maintable">
1078                        <tr>
1079                                        <td width="100%" class="tableh2">{ADD_YOUR_COMMENT}{HELP_ICON}</td>
1080                        </tr>
1081                        <tr>
1082                <td colspan="1">
1083                        <table width="100%" cellpadding="0" cellspacing="0">
1084
1085<!-- BEGIN user_name_input -->
1086                                                        <tr>
1087                                <td class="tableb tableb_alternate">
1088                                        {NAME}
1089                                </td>
1090                                <td class="tableb tableb_alternate">
1091                                        <input type="text" class="textinput" name="msg_author" size="10" maxlength="20" value="{USER_NAME}" onclick="if (this.value == '{DEFAULT_USERNAME}') this.value = '';" onkeyup="if (this.value == '{DEFAULT_USERNAME}') this.value = '';" />
1092                                </td>
1093<!-- END user_name_input -->
1094<!-- BEGIN input_box_smilies -->
1095                                <td class="tableb tableb_alternate">
1096                                {COMMENT}
1097                                </td>
1098                                <td width="100%" class="tableb tableb_alternate">
1099                                <input type="text" class="textinput" id="message" name="msg_body" onselect="storeCaret_post(this);" onclick="storeCaret_post(this);" onkeyup="storeCaret_post(this);" maxlength="{MAX_COM_LENGTH}" style="width: 100%;" />
1100                                </td>
1101<!-- END input_box_smilies -->
1102<!-- BEGIN input_box_no_smilies -->
1103                                <td class="tableb tableb_alternate">
1104                                {COMMENT}
1105                                </td>
1106                                <td width="100%" class="tableb tableb_alternate">
1107                                <input type="text" class="textinput" id="message" name="msg_body"  maxlength="{MAX_COM_LENGTH}" style="width: 100%;" />
1108                                </td>
1109<!-- END input_box_no_smilies -->
1110<!-- BEGIN submit -->
1111                                <td class="tableb tableb_alternate">
1112                                <input type="hidden" name="event" value="comment" />
1113                                <input type="hidden" name="pid" value="{PIC_ID}" />
1114                                <button type="submit" class="button" name="submit" value="{OK}">{OK_ICON}{OK}</button>
1115                                <input type="hidden" name="form_token" value="{FORM_TOKEN}" />
1116                                <input type="hidden" name="timestamp" value="{TIMESTAMP}" />
1117                                </td>
1118<!-- END submit -->
1119                                                        </tr>
1120<!-- BEGIN comment_captcha -->
1121                                                        <tr>
1122                                <td class="tableb tableb_alternate" colspan="3">
1123                                  {CONFIRM}
1124                                </td>
1125                                <td class="tableb tableb_alternate" colspan="2">
1126                                  <input type="text" name="confirmCode" size="5" maxlength="5" class="textinput" />
1127                                  <img src="captcha.php" align="middle" border="0" alt="" />
1128                                </td>
1129                                                        </tr>
1130<!-- END comment_captcha -->
1131                        </table>
1132                </td>
1133        </tr>
1134<!-- BEGIN smilies -->
1135        <tr>
1136                <td width="100%" class="tableb tableb_alternate">
1137                        {SMILIES}
1138                </td>
1139        </tr>
1140<!-- END smilies -->
1141<!-- BEGIN login_to_comment -->
1142        <tr>
1143                                <td class="tableb tableb_alternate" colspan="2">
1144                                  {LOGIN_TO_COMMENT}
1145                                </td>
1146        </tr>
1147<!-- END login_to_comment -->
1148                </table>
1149        </form>
1150EOT;
1151/******************************************************************************
1152** Section <<<$template_add_your_comment>>> - END
1153******************************************************************************/
1154} //{THEMES}
1155
1156if (!isset($template_cpg_die)) { //{THEMES}
1157/******************************************************************************
1158** Section <<<$template_cpg_die>>> - START
1159******************************************************************************/
1160// HTML template used by the cpg_die function
1161$template_cpg_die = <<<EOT
1162                    <div class="{CSS_CLASS}">
1163                        <h2>{HEADER_TXT}</h2>
1164                        <span class="cpg_user_message">{MESSAGE}</span>
1165<!-- BEGIN file_line -->
1166                        <br />
1167                        <br />
1168                        {FILE_TXT}{FILE} - {LINE_TXT}{LINE}
1169<!-- END file_line -->
1170<!-- BEGIN output_buffer -->
1171                        <br />
1172                        <br />
1173                        <div align="left">
1174                                {OUTPUT_BUFFER}
1175                        </div>
1176<!-- END output_buffer -->
1177                        <br /><br />
1178                    </div>
1179
1180EOT;
1181/******************************************************************************
1182** Section <<<$template_cpg_die>>> - END
1183******************************************************************************/
1184} //{THEMES}
1185
1186if (!isset($template_msg_box)) { //{THEMES}
1187/******************************************************************************
1188** Section <<<$template_msg_box>>> - START
1189******************************************************************************/
1190// HTML template used by the msg_box function
1191$template_msg_box = <<<EOT
1192
1193        <div class="{CLASS}">
1194            <span class="cpg_user_message">{MESSAGE}</span>
1195<!-- BEGIN button -->
1196            <br />&nbsp;
1197            <br />
1198            <span class="admin_menu">
1199                    <a href="{LINK}">{TEXT}</a>
1200            </span>
1201<!-- END button -->
1202        </div>
1203EOT;
1204/******************************************************************************
1205** Section <<<$template_msg_box>>> - END
1206******************************************************************************/
1207} //{THEMES}
1208
1209if (!isset($template_ecard)) { //{THEMES}
1210/******************************************************************************
1211** Section <<<$template_ecard>>> - START
1212******************************************************************************/
1213// HTML template for e-cards
1214$template_ecard = <<<EOT
1215<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1216<html dir="{LANG_DIR}">
1217<head>
1218<meta http-equiv="content-type" content="text/html; charset={CHARSET}" />
1219<title>{TITLE}</title>
1220</head>
1221<body bgcolor="#FFFFFF" text="#0F5475" link="#0F5475" vlink="#0F5475" alink="#0F5475">
1222<br />
1223<p align="center"><a href="{VIEW_ECARD_TGT}">{VIEW_ECARD_LNK}</a></p>
1224<table border="0" cellspacing="0" cellpadding="1" align="center">
1225  <tr>
1226    <td bgcolor="#000000">
1227      <table border="0" cellspacing="0" cellpadding="10" bgcolor="#ffffff">
1228        <tr>
1229          <td valign="top">
1230           <a href="{VIEW_MORE_TGT}displayimage.php?pid={PID}">{PIC_MARKUP}</a>
1231                                         <br />
1232                                         <div align="center">
1233                                                 <h2>{PIC_TITLE}</h2>
1234                                         </div>
1235
1236          </td>
1237          <td valign="top" width="300">
1238            <div align="right"><img src="{URL_PREFIX}images/stamp.gif" border="0" alt="" /></div>
1239            <br />
1240            <span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-size:2.0em;font-weight:bold;">{GREETINGS}</span>
1241            <br />
1242            <br />
1243            <span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-size:1.6em;font-weight:bold;">{MESSAGE}</span>
1244            <br />
1245            <br />
1246            <span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-size:1.6em;font-weight:bold;">{SENDER_NAME}</span>
1247            (<a href="mailto:{SENDER_EMAIL}"><span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-weight:bold;">{SENDER_EMAIL}</span></a>)
1248          </td>
1249        </tr>
1250                <tr>
1251                        <td colspan="2">
1252                                {PIC_CAPTION}
1253                        </td>
1254                </tr>
1255      </table>
1256    </td>
1257  </tr>
1258</table>
1259<p align="center"><a href="{VIEW_MORE_TGT}">{VIEW_MORE_LNK}</a></p>
1260</body>
1261</html>
1262EOT;
1263/******************************************************************************
1264** Section <<<$template_ecard>>> - END
1265******************************************************************************/
1266} //{THEMES}
1267
1268
1269if (!isset($template_ecard_plaintext)) { //{THEMES}
1270/******************************************************************************
1271** Section <<<$template_ecard_plaintext>>> - START
1272******************************************************************************/
1273// plain-text template for e-cards (as fallback for clients that can't display html-formatted mails)
1274$template_ecard_plaintext = <<<EOT
1275{TITLE}
1276=========================================
1277
1278{VIEW_ECARD_LNK_PLAINTEXT}:
1279{VIEW_ECARD_TGT}
1280
1281{GREETINGS}
1282
1283
1284{PLAINTEXT_MESSAGE}
1285
1286{SENDER_NAME} ({SENDER_EMAIL})
1287
1288-----------------------------------------
1289{VIEW_MORE_LNK}:
1290{VIEW_MORE_TGT}
1291EOT;
1292/******************************************************************************
1293** Section <<<$template_ecard_plaintext>>> - END
1294******************************************************************************/
1295} //{THEMES}
1296
1297if (!isset($template_report)) { //{THEMES}
1298/******************************************************************************
1299** Section <<<$template_report>>> - START
1300******************************************************************************/
1301// HTML template for report
1302$template_report = <<<EOT
1303<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1304<html dir="{LANG_DIR}">
1305<head>
1306<meta http-equiv="content-type" content="text/html; charset={CHARSET}" />
1307<title>{TITLE}</title>
1308</head>
1309<body bgcolor="#FFFFFF" text="#0F5475" link="#0F5475" vlink="#0F5475" alink="#0F5475">
1310<br />
1311<p align="center"><a href="{VIEW_REPORT_TGT}">{VIEW_REPORT_LNK}</a></p>
1312<table border="0" cellspacing="0" cellpadding="1" align="center">
1313  <tr>
1314    <td bgcolor="#000000">
1315      <table border="0" cellspacing="0" cellpadding="10" bgcolor="#ffffff">
1316        <tr>
1317          <td valign="top">
1318           <a href="{PIC_TGT}"><img src="{PIC_URL}" border="1" alt="" /></a><br />
1319          </td>
1320          <td valign="top" width="200">
1321            <span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-size:2.0em;font-weight:bold;">{SUBJECT}</span>
1322            <br />
1323                                                <br />
1324                                                {REASON}
1325            <p>
1326            <span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-size:1.6em;">{MESSAGE}</span>
1327            </p>
1328            <span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-size:1.6em;">{SENDER_NAME}</span>
1329            (<a href="mailto:{SENDER_EMAIL}"><span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-size:1.6em;">{SENDER_EMAIL}</span></a>)
1330          </td>
1331        </tr>
1332      </table>
1333    </td>
1334  </tr>
1335</table>
1336<p align="center"><a href="{VIEW_MORE_TGT}">{VIEW_MORE_LNK}</a></p>
1337</body>
1338</html>
1339EOT;
1340/******************************************************************************
1341** Section <<<$template_report>>> - END
1342******************************************************************************/
1343} //{THEMES}
1344
1345if (!isset($template_report_plaintext)) { //{THEMES}
1346/******************************************************************************
1347** Section <<<$template_report_plaintext>>> - START
1348******************************************************************************/
1349// plain-text template for reports (as fallback for clients that can't display html-formatted mails)
1350$template_report_plaintext = <<<EOT
1351{TITLE}
1352=========================================
1353
1354{VIEW_REPORT_LNK_PLAINTEXT}:
1355{VIEW_REPORT_TGT}
1356
1357
1358{SUBJECT}
1359
1360{REASON}
1361
1362{PLAINTEXT_MESSAGE}
1363
1364{SENDER_NAME} ({SENDER_EMAIL})
1365
1366-----------------------------------------
1367{VIEW_MORE_LNK}:
1368{VIEW_MORE_TGT}
1369EOT;
1370/******************************************************************************
1371** Section <<<$template_report_plaintext>>> - END
1372******************************************************************************/
1373} //{THEMES}
1374
1375if (!isset($template_report_comment)) { //{THEMES}
1376/******************************************************************************
1377** Section <<<$template_report_comment>>> - START
1378******************************************************************************/
1379// HTML template for displaying a reported comment
1380$template_report_comment = <<<EOT
1381<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1382<html dir="{LANG_DIR}">
1383<head>
1384<meta http-equiv="content-type" content="text/html; charset={CHARSET}" />
1385<title>{TITLE}</title>
1386</head>
1387<body bgcolor="#FFFFFF" text="#0F5475" link="#0F5475" vlink="#0F5475" alink="#0F5475">
1388<br />
1389<p align="center"><a href="{VIEW_REPORT_TGT}">{VIEW_REPORT_LNK}</a></p>
1390<table border="0" cellspacing="0" cellpadding="1" align="center">
1391  <tr>
1392    <td bgcolor="#000000">
1393      <table border="0" cellspacing="0" cellpadding="10" bgcolor="#FFFFFF">
1394        <tr>
1395          <td valign="top">
1396           {COMMENT}
1397           <p align="center"><a href="{COMMENT_TGT}">{COMMENT_LNK}</a></p>
1398          </td>
1399        </tr>
1400        <tr>
1401          <td valign="top">
1402            <span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-size:2.0em;font-weight:bold;">{SUBJECT}</span></strong>
1403                                                <br />
1404              {REASON}
1405            <br />
1406            <span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-size:1.6em;">{MESSAGE}</span>
1407            <br />
1408            <span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-size:1.6em;">{SENDER_NAME}</span>
1409            (<a href="mailto:{SENDER_EMAIL}"><span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-size:1.6em;">{SENDER_EMAIL}</span></a>)
1410          </td>
1411        </tr>
1412      </table>
1413    </td>
1414  </tr>
1415</table>
1416<p align="center"><a href="{VIEW_MORE_TGT}">{VIEW_MORE_LNK}</a></p>
1417</body>
1418</html>
1419EOT;
1420/******************************************************************************
1421** Section <<<$template_report_comment>>> - END
1422******************************************************************************/
1423} //{THEMES}
1424
1425if (!isset($template_report_comment_email)) { //{THEMES}
1426/******************************************************************************
1427** Section <<<$template_report_comment_email>>> - START
1428******************************************************************************/
1429// plain-text template for reports (as fallback for clients that can't display html-formatted mails)
1430$template_report_comment_email = <<<EOT
1431<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1432<html dir="{LANG_DIR}">
1433<head>
1434<meta http-equiv="content-type" content="text/html; charset={CHARSET}" />
1435<title>{TITLE}</title>
1436</head>
1437<body bgcolor="#FFFFFF" text="#0F5475" link="#0F5475" vlink="#0F5475" alink="#0F5475">
1438<p><a href="{VIEW_REPORT_TGT}">{VIEW_COMMENT_LNK}</a></p>
1439                <span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-size:2.0em;font-weight:bold;">{SUBJECT}</span>
1440                <br />
1441                        {REASON}
1442                <br />
1443                <span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-size:1.6em;">{MESSAGE}</span>
1444                <br />
1445                <span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-size:1.6em;">{SENDER_NAME}</span>
1446                (<a href="mailto:{SENDER_EMAIL}"><span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-size:1.6em;">{SENDER_EMAIL}</span></a>)
1447<p><a href="{VIEW_MORE_TGT}">{VIEW_MORE_LNK}</a></p>
1448</body>
1449</html>
1450EOT;
1451/******************************************************************************
1452** Section <<<$template_report_comment_email>>> - END
1453******************************************************************************/
1454} //{THEMES}
1455
1456if (!isset($template_zipfile_plaintext)) { //{THEMES}
1457/******************************************************************************
1458** Section <<<$template_zipfile_plaintext>>> - START
1459******************************************************************************/
1460// plain-text template for readme file that is being added to zipdownload
1461$template_zipfile_plaintext = <<<EOT
1462{USERNAME}:
1463=========================================
1464{GAL_NAME} - {GAL_DESCRIPTION}
1465{GAL_URL}
1466=========================================
1467{DATE}
1468=========================================
1469{COPYRIGHTS}
1470
1471EOT;
1472/******************************************************************************
1473** Section <<<template_zipfile_plaintext>>> - END
1474******************************************************************************/
1475} //{THEMES}
1476
1477if (!isset($template_tab_display)) { //{THEMES}
1478/******************************************************************************
1479** Section <<<$template_tab_display>>> - START
1480******************************************************************************/
1481// Template used for tabbed display
1482$template_tab_display = array(
1483    'left_text'         => '<td width="100%%" align="left" valign="middle" class="tableh1" style="white-space: nowrap">{LEFT_TEXT}</td>' . $LINEBREAK,
1484    'tab_header'        => '',
1485    'tab_trailer'       => '',
1486    'active_tab'        => '<td align="center" valign="middle" class="tableb tableb_alternate">%d</td>',
1487    'inactive_tab'      => '<td align="center" valign="middle" class="navmenu"><a href="{LINK}">%d</a></td>' . $LINEBREAK,
1488    'nav_tab'           => '<td align="center" valign="middle" class="navmenu"><a href="{LINK}">%s</a></td>' . $LINEBREAK,
1489    'nav_tab_nolink'    => '<td align="center" valign="middle" class="navmenu">%s</td>' . $LINEBREAK,
1490    'allpages_dropdown' => '<td align="center" valign="middle" style="white-space: nowrap; padding-right: 10px;" class="navmenu">%s</td>' . $LINEBREAK,
1491    'page_gap'          => '<td align="center" valign="middle" class="navmenu">-</td>' . $LINEBREAK,
1492    'tab_spacer'        => '<td><img src="images/spacer.gif" width="1" height="1" border="0" alt="" /></td>' . $LINEBREAK,
1493    'page_link'         => '{LINK}',
1494);
1495/******************************************************************************
1496** Section <<<$template_tab_display>>> - END
1497******************************************************************************/
1498} //{THEMES}
1499
1500if (!isset($template_vanity)) { //{THEMES}
1501/******************************************************************************
1502** Section <<<$template_vanity>>> - START
1503******************************************************************************/
1504// Template used for Vanity Footer
1505$template_vanity = <<<EOT
1506<div id="vanity">
1507      <a id="v_php" href="http://www.php.net/" rel="external"></a>
1508      <a id="v_mysql" href="http://www.mysql.com/" rel="external"></a>
1509      <a id="v_xhtml" href="http://validator.w3.org/check/referer" rel="external"></a>
1510      <a id="v_css" href="http://jigsaw.w3.org/css-validator/check/referer" rel="external"></a>
1511</div>
1512EOT;
1513/******************************************************************************
1514** Section <<<$template_vanity>>> - END
1515******************************************************************************/
1516} //{THEMES}
1517
1518if (!function_exists('pageheader')) {  //{THEMES}
1519/******************************************************************************
1520** Section <<<pageheader>>> - START
1521******************************************************************************/
1522function pageheader($section, $meta = '')
1523{
1524    global $CONFIG, $THEME_DIR, $CPG_PHP_SELF;
1525    global $template_header, $lang_charset, $lang_text_dir;
1526
1527    $custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);
1528
1529    $charset = ($CONFIG['charset'] == 'language file') ? $lang_charset : $CONFIG['charset'];
1530
1531    header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
1532    header("Content-Type: text/html; charset=$charset");
1533    user_save_profile();
1534
1535    $template_vars = array(
1536        '{LANG_DIR}' => $lang_text_dir,
1537        '{TITLE}' => theme_page_title($section),
1538        '{CHARSET}' => $charset,
1539        '{META}' => $meta,
1540        '{GAL_NAME}' => $CONFIG['gallery_name'],
1541        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
1542        '{SYS_MENU}' => theme_main_menu('sys_menu'),
1543        '{SUB_MENU}' => theme_main_menu('sub_menu'),
1544        '{ADMIN_MENU}' => theme_admin_mode_menu(),
1545        '{CUSTOM_HEADER}' => $custom_header,
1546        '{JAVASCRIPT}' => theme_javascript_head(),
1547        '{MESSAGE_BLOCK}' => theme_display_message_block(),
1548    );
1549
1550	if (defined('THEME_WANTS_BODY_CLASS')) {
1551		$template_vars['{BODY_CLASS}'] = 'BC-'.basename($CPG_PHP_SELF,'.php');
1552	}
1553
1554    $template_vars = CPGPluginAPI::filter('theme_pageheader_params', $template_vars);
1555    echo template_eval($template_header, $template_vars);
1556
1557    // Show various admin messages
1558    adminmessages();
1559}
1560/******************************************************************************
1561** Section <<<pageheader>>> - END
1562******************************************************************************/
1563}  //{THEMES}
1564
1565if (!function_exists('pageheader_mini')) {  //{THEMES}
1566/******************************************************************************
1567** Section <<<pageheader_mini>>> - START
1568******************************************************************************/
1569function pageheader_mini($section, $javascript=false)
1570{
1571    global $CONFIG;
1572    global $lang_charset, $lang_text_dir;
1573
1574    $custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);
1575
1576    $charset = ($CONFIG['charset'] == 'language file') ? $lang_charset : $CONFIG['charset'];
1577
1578    header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
1579    header("Content-Type: text/html; charset=$charset");
1580    user_save_profile();
1581
1582    if ($javascript) {
1583        $js = theme_javascript_head();
1584    } else {
1585        $js = '';
1586    }
1587
1588    echo <<< EOT
1589<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
1590    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1591<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="$lang_text_dir">
1592    <head>
1593        <meta http-equiv="Content-Type" content="text/html; charset=$charset" />
1594        <meta http-equiv="Pragma" content="no-cache" />
1595        <title>$section</title>
1596        <link rel="stylesheet" href="css/coppermine.css" type="text/css" />
1597        <link rel="stylesheet" href="themes/{$CONFIG['theme']}/style.css" type="text/css" />
1598        <link rel="shortcut icon" href="favicon.ico" />
1599        $js
1600    </head>
1601    <body>
1602
1603EOT;
1604}
1605/******************************************************************************
1606** Section <<<pageheader_mini>>> - END
1607******************************************************************************/
1608}  //{THEMES}
1609
1610if (!function_exists('pagefooter')) {  //{THEMES}
1611/******************************************************************************
1612** Section <<<pagefooter>>> - START
1613******************************************************************************/
1614// Function for writing a pagefooter
1615function pagefooter()
1616{
1617    //global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SERVER_VARS;
1618    global $USER, $USER_DATA, $CONFIG, $time_start, $query_stats, $queries;
1619    global $template_footer;
1620
1621    $custom_footer = cpg_get_custom_include($CONFIG['custom_footer_path']);
1622
1623    if ($CONFIG['debug_mode']==1 || ($CONFIG['debug_mode']==2 && GALLERY_ADMIN_MODE)) {
1624        cpg_debug_output();
1625    }
1626
1627    $template_vars = array(
1628        '{GAL_NAME}' => $CONFIG['gallery_name'],
1629        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
1630        '{SYS_MENU}' => theme_main_menu('sys_menu'),
1631        '{SUB_MENU}' => theme_main_menu('sub_menu'),
1632        '{ADMIN_MENU}' => theme_admin_mode_menu(),
1633//        '{CUSTOM_HEADER}' => $custom_header,
1634//        '{JAVASCRIPT}' => theme_javascript_head(),
1635        '{CUSTOM_FOOTER}' => $custom_footer,
1636        '{VANITY}' => theme_vanity(),
1637        '{CREDITS}' => theme_credits(),
1638    );
1639
1640    echo template_eval($template_footer, $template_vars);
1641}
1642/******************************************************************************
1643** Section <<<pagefooter>>> - END
1644******************************************************************************/
1645}  //{THEMES}
1646
1647if (!function_exists('pagefooter_mini')) {  //{THEMES}
1648/******************************************************************************
1649** Section <<<pagefooter_mini>>> - START
1650******************************************************************************/
1651function pagefooter_mini()
1652{
1653    echo <<< EOT
1654
1655    </body>
1656</html>
1657
1658EOT;
1659}
1660/******************************************************************************
1661** Section <<<pagefooter_mini>>> - END
1662******************************************************************************/
1663}  //{THEMES}
1664
1665if (!function_exists('theme_javascript_head')) {  //{THEMES}
1666/******************************************************************************
1667** Section <<<theme_javascript_head>>> - START
1668******************************************************************************/
1669// Function for the JavaScript inside the <head>-section
1670function theme_javascript_head()
1671{
1672    global $JS, $LINEBREAK;
1673
1674    $return = '';
1675
1676    // Check if we have any variables being set using set_js_vars function
1677    if (!empty($JS['vars'])) {
1678        // Convert the $JS['vars'] array to json object string
1679        $json_vars = json_encode($JS['vars']);
1680        // Output the json object
1681        $return = <<< EOT
1682<script type="text/javascript">
1683/* <![CDATA[ */
1684    var js_vars = $json_vars;
1685/* ]]> */
1686</script>
1687
1688EOT;
1689    }
1690
1691    // Check if we have any js includes
1692    if (!empty($JS['includes'])) {
1693        // Bring the jquery core library to the very top of the list
1694        if (in_array(CPG_JQUERY_VERSION, $JS['includes']) == TRUE) {
1695            $key = array_search(CPG_JQUERY_VERSION, $JS['includes']);
1696            unset($JS['includes'][$key]);
1697            array_unshift($JS['includes'], CPG_JQUERY_VERSION);
1698        }
1699        $JS['includes'] = CPGPluginAPI::filter('javascript_includes',$JS['includes']);
1700        // Include all the files which were set using js_include() function
1701        foreach ($JS['includes'] as $js_file) {
1702            $return .= js_include($js_file, true) . $LINEBREAK;
1703        }
1704    }
1705
1706    return $return;
1707}
1708/******************************************************************************
1709** Section <<<theme_javascript_head>>> - END
1710******************************************************************************/
1711}  //{THEMES}
1712
1713
1714if (!function_exists('theme_cpg_die')) {  //{THEMES}
1715/******************************************************************************
1716** Section <<<theme_cpg_die>>> - START
1717******************************************************************************/
1718// Function for showing error messages
1719function theme_cpg_die($msg_code, $msg_text, $msg_string, $css_class, $error_file, $error_line, $output_buffer, $ob)
1720{
1721    global $CONFIG, $lang_cpg_die, $template_cpg_die;
1722
1723    $params = array(
1724            '{MESSAGE}' => $msg_text,
1725            '{FILE_TXT}' => $lang_cpg_die['file'],
1726            '{FILE}' => $error_file,
1727            '{LINE_TXT}' => $lang_cpg_die['line'],
1728            '{LINE}' => $error_line,
1729            '{OUTPUT_BUFFER}' => $ob,
1730            '{HEADER_TXT}' => $msg_string,
1731            '{CSS_CLASS}' => $css_class,
1732    );
1733
1734    if (!($CONFIG['debug_mode'] == 1 || ($CONFIG['debug_mode'] == 2 && GALLERY_ADMIN_MODE))) {
1735        template_extract_block($template_cpg_die, 'file_line');
1736    }
1737    template_extract_block($template_cpg_die, 'output_buffer');
1738
1739    pageheader($msg_string);
1740    echo "<!-- cpg_die -->";
1741    echo template_eval($template_cpg_die, $params);
1742    pagefooter();
1743}
1744/******************************************************************************
1745** Section <<<theme_cpg_die>>> - END
1746******************************************************************************/
1747}  //{THEMES}
1748
1749
1750if (!function_exists('theme_breadcrumb')) {  //{THEMES}
1751/******************************************************************************
1752** Section <<<theme_breadcrumb>>> - START
1753******************************************************************************/
1754// Function for building the breadcrumb
1755// Inputs:  $breadcrumb_links, $BREADCRUMB_TEXTS
1756// Outputs: $breadcrumb, $BREADCRUMB_TEXT
1757function theme_breadcrumb($breadcrumb_links, $BREADCRUMB_TEXTS, &$breadcrumb, &$BREADCRUMB_TEXT)
1758{
1759    $breadcrumb = '';
1760    $BREADCRUMB_TEXT = '';
1761    foreach ($breadcrumb_links as $breadcrumb_link) {
1762        $breadcrumb .= ' > ' . $breadcrumb_link;
1763    }
1764    foreach ($BREADCRUMB_TEXTS as $BREADCRUMB_TEXT_elt) {
1765        $BREADCRUMB_TEXT .= ' > ' . $BREADCRUMB_TEXT_elt;
1766    }
1767    // We remove the first ' > '
1768    $breadcrumb = substr_replace($breadcrumb,'', 0, 3);
1769    $BREADCRUMB_TEXT = substr_replace($BREADCRUMB_TEXT,'', 0, 3);
1770}
1771/******************************************************************************
1772** Section <<<theme_breadcrumb>>> - END
1773******************************************************************************/
1774}  //{THEMES}
1775
1776
1777if (!function_exists('theme_msg_box')) {  //{THEMES}
1778/******************************************************************************
1779** Section <<<theme_msg_box>>> - START
1780******************************************************************************/
1781// Function for displaying a message-box-like table
1782function theme_msg_box($title, $msg_text, $css_class, $button_text, $button_link)
1783{
1784    global $template_msg_box;
1785
1786    if (!$button_text && stripos($template_msg_box, 'button') != false) {
1787        template_extract_block($template_msg_box, 'button');
1788    }
1789    $params = array(
1790            '{MESSAGE}' => $msg_text,
1791            '{LINK}' => $button_link,
1792            '{TEXT}' => $button_text,
1793            '{CLASS}' => $css_class
1794    );
1795
1796    echo template_eval($template_msg_box, $params);
1797}
1798/******************************************************************************
1799** Section <<<theme_msg_box>>> - END
1800******************************************************************************/
1801}  //{THEMES}
1802
1803
1804if (!function_exists('theme_create_tabs')) {  //{THEMES}
1805/******************************************************************************
1806** Section <<<theme_create_tabs>>> - START
1807******************************************************************************/
1808// Function for creating tabs showing multiple pages
1809function theme_create_tabs($items, $curr_page, $total_pages, $template)
1810{
1811    // Tabs do not take into account $lang_text_dir for RTL languages
1812    global $CONFIG, $lang_create_tabs;
1813
1814    // Gallery Configuration setting for maximum number of tabs to display
1815    $maxTab = $CONFIG['max_tabs'];
1816
1817    if ($total_pages == '') {
1818        $total_pages = $curr_page;
1819    }
1820
1821    if (array_key_exists('page_link',$template)) {
1822        // Pass through links to tabs with links
1823        $template['nav_tab']      = strtr($template['nav_tab'], array('{LINK}' => $template['page_link']));
1824        $template['inactive_tab'] = strtr($template['inactive_tab'], array('{LINK}' => $template['page_link']));
1825    }
1826
1827    // Left text, usually shows statistics
1828    $tabs = sprintf($template['left_text'], $items, $total_pages);
1829    if (($total_pages == 1)) {
1830        return $tabs;
1831    }
1832
1833    // Header for tabs
1834    $tabs .= $template['tab_header'];
1835
1836    if ($CONFIG['tabs_dropdown']) {
1837        // Dropdown list for all pages
1838        preg_match('/cat=([\d]+)/', $template['page_link'], $matches);
1839        $catn = isset($matches[1]) ? $matches[1] : '';
1840        $tabs_dropdown_js = <<< EOT
1841            <span id="tabs_dropdown_span{$catn}"></span>
1842            <script type="text/javascript"><!--
1843                $('#tabs_dropdown_span{$catn}').html('{$lang_create_tabs['jump_to_page']} <select id="tabs_dropdown_select{$catn}" onchange="if (this.options[this.selectedIndex].value != -1) { window.location.href = this.options[this.selectedIndex].value; }"><\/select>');
1844                for (page = 1; page <= $total_pages; page++) {
1845                    var page_link = '{$template['page_link']}';
1846                    var selected = '';
1847                    if (page == $curr_page) {
1848                        selected = ' selected="selected"';
1849                    }
1850                    $('#tabs_dropdown_select{$catn}').append('<option value="' + page_link.replace( /%d/, page ) + '"' + selected + '>' + page + '<\/option>');
1851                }
1852         --></script>
1853EOT;
1854        $tabs .= sprintf($template['allpages_dropdown'], $tabs_dropdown_js);
1855    }
1856
1857    // Calculate which pages to show on tabs, limited by the maximum number of tabs (set on Gallery Configuration panel)
1858    if ($total_pages > $maxTab) {
1859        $start = max(2, $curr_page - floor(($maxTab - 2) / 2));
1860        $start = min($start, $total_pages - $maxTab + 2);
1861        $end = $start + $maxTab - 3;
1862    } else {
1863        $start = 2;
1864        $end = $total_pages - 1;
1865    }
1866
1867    // Previous page tab
1868    if ($curr_page != ($start - 1)) {
1869        $tabs .= sprintf($template['nav_tab'], $curr_page-1, cpg_fetch_icon('tab_left',0,$lang_create_tabs['previous']));
1870    } else {
1871        // A previous tab with link is not needed.
1872        // If you want to show a disabled previous tab,
1873        //   create an image 'left_inactive.png', put it into themes/YOUR_THEME/images/icons/,
1874        //   then uncomment the line below.
1875        // $tabs .= sprintf($template['nav_tab_nolink'], cpg_fetch_icon('left_inactive',0,$lang_create_tabs['previous']));
1876    }
1877
1878    // Page 1 tab
1879    if ($curr_page == 1) {
1880        $tabs .= sprintf($template['active_tab'], 1);
1881    } else {
1882        $tabs .= sprintf($template['inactive_tab'], 1, 1);
1883    }
1884
1885    // Gap between page 1 and middle block of tabs
1886    if ($start > 2) {
1887        $tabs .= $template['page_gap'];
1888    }
1889    $page_gap = ($template['page_gap'] != '');
1890
1891    // Middle block of tabs
1892    for ($page = $start ; $page <= $end; $page++) {
1893        if (!$page_gap || ($page_gap && ($page != $start))) {
1894            $tabs .= $template['tab_spacer'];
1895        }
1896        if ($page == $curr_page) {
1897            $tabs .= sprintf($template['active_tab'], $page);
1898        } else {
1899            $tabs .= sprintf($template['inactive_tab'], $page, $page);
1900        }
1901    }
1902
1903    // Gap between middle block of tabs and last page
1904    if ($end < $total_pages - 1) {
1905        $tabs .= $template['page_gap'];
1906    }
1907
1908    // Last page tab
1909    if (!$page_gap) {
1910        $tabs .= $template['tab_spacer'];
1911    }
1912    if ($total_pages > 1) {
1913        if ($curr_page == $total_pages) {
1914            $tabs .= sprintf($template['active_tab'], $total_pages);
1915        } else {
1916            $tabs .= sprintf($template['inactive_tab'], $total_pages, $total_pages);
1917        }
1918    }
1919
1920    // Next page tab
1921    if ($curr_page != $total_pages) {
1922        $tabs .= sprintf($template['nav_tab'], $curr_page + 1, cpg_fetch_icon('tab_right',0,$lang_create_tabs['next']));
1923    } else {
1924        // A next tab with link is not needed.
1925        // If you want to show a disabled next tab,
1926        //   create an image 'right_inactive.png', put it into themes/YOUR_THEME/images/icons/,
1927        //   then uncomment the line below.
1928        // $tabs .= sprintf($template['nav_tab_nolink'], cpg_fetch_icon('right_inactive',0,$lang_create_tabs['next']));
1929    }
1930
1931    // Trailer for tabs
1932    $tabs .= $template['tab_trailer'];
1933
1934    return $tabs;
1935}
1936/******************************************************************************
1937** Section <<<theme_create_tabs>>> - END
1938******************************************************************************/
1939}  //{THEMES}
1940
1941if (!function_exists('theme_credits')) {  //{THEMES}
1942/******************************************************************************
1943** Section <<<theme_credits>>> - START
1944******************************************************************************/
1945
1946/******************************************************************************
1947// Function for the credits-section
1948In previous versions of Coppermine the "Powered by Coppermine" used to be
1949obfuscated to make it hard for non-coders to remove the tag. The reason behind
1950this was an additional license add-on that disallowed users to change the line.
1951The dev team has reviewed this policy for cpg1.5.x and decided that end users
1952ARE allowed to change or remove the line in legal terms.
1953HOWEVER: We have a forum policy for the support board instead: support will
1954only be given for galleries that show the "Powered by Coppermine" tag
1955unobfuscated.
1956Before removing the credits, please consider this as well:
1957Coppermine is free software, the dev team ASKS you to keep the footer intact.
1958We're convinced that you should give credit where credit is due. So please think
1959twice before you decide to remove the tag.
1960******************************************************************************/
1961function theme_credits() {
1962    $return = <<< EOT
1963
1964<div class="footer" align="center" style="padding:10px;display:block;visibility:visible; font-family: Verdana,Arial,sans-serif;">Powered by <a href="http://coppermine-gallery.net/" title="Coppermine Photo Gallery" rel="external">Coppermine Photo Gallery</a></div>
1965EOT;
1966    return $return;
1967}
1968/******************************************************************************
1969** Section <<<theme_credits>>> - END
1970******************************************************************************/
1971}  //{THEMES}
1972
1973if (!function_exists('starttable')) {  //{THEMES}
1974/******************************************************************************
1975** Section <<<starttable>>> - START
1976******************************************************************************/
1977// Function to start a 'standard' table
1978function starttable($width = '-1', $title = '', $title_colspan = '1', $zebra_class = '', $return = false)
1979{
1980    global $CONFIG;
1981
1982    if ($width == '-1') $width = $CONFIG['picture_table_width'];
1983    if ($width == '100%') $width = $CONFIG['main_table_width'];
1984    $text = <<<EOT
1985
1986<!-- Start standard table -->
1987<table align="center" width="$width" cellspacing="1" cellpadding="0" class="maintable $zebra_class">
1988
1989EOT;
1990    if ($title) {
1991        $text .= <<<EOT
1992        <tr>
1993                <td class="tableh1" colspan="$title_colspan">$title</td>
1994        </tr>
1995
1996EOT;
1997    }
1998    if (!$return) {
1999        echo $text;
2000    } else {
2001        return $text;
2002    }
2003}
2004/******************************************************************************
2005** Section <<<starttable>>> - END
2006******************************************************************************/
2007}  //{THEMES}
2008
2009if (!function_exists('endtable')) {  //{THEMES}
2010/******************************************************************************
2011** Section <<<endtable>>> - START
2012******************************************************************************/
2013function endtable($return = false)
2014{
2015    $text = <<<EOT
2016</table>
2017<!-- End standard table -->
2018
2019EOT;
2020    if (!$return) {
2021        echo $text;
2022    } else {
2023        return $text;
2024    }
2025}
2026/******************************************************************************
2027** Section <<<endtable>>> - END
2028******************************************************************************/
2029}  //{THEMES}
2030
2031if (!function_exists('theme_main_menu')) {  //{THEMES}
2032/******************************************************************************
2033** Section <<<theme_main_menu>>> - START
2034******************************************************************************/
2035function theme_main_menu($which)
2036{
2037    global $AUTHORIZED, $CONFIG, $album, $actual_cat, $cat, $REFERER, $CPG_PHP_SELF;
2038    global $lang_main_menu, $template_sys_menu, $template_sub_menu, $lang_gallery_admin_menu;
2039
2040    static $sys_menu = '', $sub_menu = '';
2041    if ($$which != '') {
2042        return $$which;
2043    }
2044
2045    //Check whether user has permission to upload file to the current album if any
2046    $upload_allowed = false;
2047    if (isset($album) && is_numeric($album)) {
2048        if (GALLERY_ADMIN_MODE) {
2049            $upload_allowed = true;
2050        } else {
2051            if (USER_ID) {
2052                $query = "SELECT null FROM {$CONFIG['TABLE_ALBUMS']} WHERE category='" . (FIRST_USER_CAT + USER_ID) . "' AND aid = '$album'";
2053                $user_albums = cpg_db_query($query);
2054                if ($user_albums->numRows()) {
2055                    $upload_allowed = true;
2056                } else {
2057                    $upload_allowed = false;
2058                }
2059            }
2060
2061            if (!$upload_allowed) {
2062                $query = "SELECT null FROM {$CONFIG['TABLE_ALBUMS']} WHERE category < " . FIRST_USER_CAT . " AND uploads='YES' AND (visibility = '0' OR visibility IN ".USER_GROUP_SET.") AND aid = '$album'";
2063                $public_albums = cpg_db_query($query);
2064
2065                if ($public_albums->numRows()) {
2066                    $upload_allowed = true;
2067                } else {
2068                    $upload_allowed = false;
2069                }
2070            }
2071        }
2072    }
2073
2074    $album_l = isset($album) ? "?album=$album" : '';
2075    $album_12 = ($upload_allowed) ? "?album=$album" : '';
2076    $cat_l = (isset($actual_cat))? "?cat=$actual_cat" : (isset($cat) ? "?cat=$cat" : '?cat=0');
2077    $cat_l2 = isset($cat) ? "&amp;cat=$cat" : '';
2078    $my_gallery_id = FIRST_USER_CAT + USER_ID;
2079
2080  if ($which == 'sys_menu' ) {
2081    if (USER_ID) { // visitor is logged in
2082        template_extract_block($template_sys_menu, 'login');
2083        if ($CONFIG['contact_form_registered_enable'] == 0) {
2084          template_extract_block($template_sys_menu, 'contact');
2085        }
2086        if ($CONFIG['display_sidebar_user'] != 2) {
2087          template_extract_block($template_sys_menu, 'sidebar');
2088        }
2089
2090        list($timestamp, $form_token) = getFormToken();
2091
2092    } else { // visitor is not logged in
2093        if ($CONFIG['contact_form_guest_enable'] == 0) {
2094          template_extract_block($template_sys_menu, 'contact');
2095        }
2096        if ($CONFIG['display_sidebar_guest'] != 2) {
2097          template_extract_block($template_sys_menu, 'sidebar');
2098        }
2099        template_extract_block($template_sys_menu, 'logout');
2100        template_extract_block($template_sys_menu, 'my_profile');
2101
2102        $timestamp = $form_token = '';
2103    }
2104
2105    if (!USER_IS_ADMIN) {
2106        template_extract_block($template_sys_menu, 'enter_admin_mode');
2107        template_extract_block($template_sys_menu, 'leave_admin_mode');
2108    } else {
2109        if (GALLERY_ADMIN_MODE) {
2110            template_extract_block($template_sys_menu, 'enter_admin_mode');
2111        } else {
2112            template_extract_block($template_sys_menu, 'leave_admin_mode');
2113        }
2114    }
2115
2116    if (!USER_CAN_CREATE_ALBUMS || !USER_ID) {
2117        template_extract_block($template_sys_menu, 'my_gallery');
2118    }
2119
2120    if (USER_CAN_CREATE_ALBUMS && USER_ID) { // block 'my_profile' has already been removed for guests
2121        template_extract_block($template_sys_menu, 'my_profile');
2122    }
2123
2124    if (!USER_CAN_UPLOAD_PICTURES && (!USER_CAN_CREATE_ALBUMS || !USER_ID)) {
2125        template_extract_block($template_sys_menu, 'upload_pic');
2126    }
2127
2128    if (USER_ID || !$CONFIG['allow_user_registration']) {
2129        template_extract_block($template_sys_menu, 'register');
2130    }
2131
2132    if (!USER_ID || !$CONFIG['allow_memberlist']) {
2133        template_extract_block($template_sys_menu, 'allow_memberlist');
2134    }
2135
2136    $param = array(
2137        '{HOME_TGT}' => $CONFIG['home_target'],
2138        '{HOME_ICO}' => cpg_fetch_icon('home', 1),
2139        '{HOME_TITLE}' => $lang_main_menu['home_title'],
2140        '{HOME_LNK}' => $lang_main_menu['home_lnk'],
2141        '{CONTACT_TGT}' => "contact.php",
2142        '{CONTACT_ICO}' => cpg_fetch_icon('contact', 1),
2143        '{CONTACT_TITLE}' => sprintf($lang_main_menu['contact_title'], $CONFIG['gallery_name']),
2144        '{CONTACT_LNK}' => $lang_main_menu['contact_lnk'],
2145        '{MY_GAL_TGT}' => "index.php?cat=$my_gallery_id",
2146        '{MY_GAL_ICO}' => cpg_fetch_icon('my_gallery', 1),
2147        '{MY_GAL_TITLE}' => $lang_main_menu['my_gal_title'],
2148        '{MY_GAL_LNK}' => $lang_main_menu['my_gal_lnk'],
2149        '{MEMBERLIST_TGT}' => "usermgr.php",
2150        '{MEMBERLIST_ICO}' => cpg_fetch_icon('memberlist', 1),
2151        '{MEMBERLIST_TITLE}' => $lang_main_menu['memberlist_title'],
2152        '{MEMBERLIST_LNK}' => $lang_main_menu['memberlist_lnk'],
2153        '{MY_PROF_TGT}' => "profile.php?op=edit_profile",
2154        '{MY_PROF_ICO}' => cpg_fetch_icon('my_profile', 1),
2155        '{MY_PROF_TITLE}' => $lang_main_menu['my_prof_title'],
2156        '{MY_PROF_LNK}' => $lang_main_menu['my_prof_lnk'],
2157        '{ADM_MODE_TGT}' => "mode.php?admin_mode=1&amp;referer=$REFERER",
2158        '{ADM_MODE_ICO}' => cpg_fetch_icon('admin_mode_on', 1),
2159        '{ADM_MODE_TITLE}' => $lang_main_menu['adm_mode_title'],
2160        '{ADM_MODE_LNK}' => $lang_main_menu['adm_mode_lnk'],
2161        '{USR_MODE_TGT}' => "mode.php?admin_mode=0&amp;referer=$REFERER",
2162        '{USR_MODE_ICO}' => cpg_fetch_icon('admin_mode_off', 1),
2163        '{USR_MODE_TITLE}' => $lang_main_menu['usr_mode_title'],
2164        '{USR_MODE_LNK}' => $lang_main_menu['usr_mode_lnk'],
2165        '{SIDEBAR_TGT}' => "sidebar.php?action=install",
2166        '{SIDEBAR_TITLE}' => $lang_main_menu['sidebar_title'],
2167        '{SIDEBAR_LNK}' => $lang_main_menu['sidebar_lnk'],
2168        '{SIDEBAR_ICO}' => cpg_fetch_icon('sidebar', 1),
2169        '{UPL_PIC_TGT}' => "upload.php$album_12",
2170        '{UPL_PIC_TITLE}' => $lang_main_menu['upload_pic_title'],
2171        '{UPL_PIC_LNK}' => $lang_main_menu['upload_pic_lnk'],
2172        '{UPL_PIC_ICO}' => cpg_fetch_icon('upload', 1),
2173        '{REGISTER_TGT}' => "register.php",
2174        '{REGISTER_TITLE}' => $lang_main_menu['register_title'],
2175        '{REGISTER_LNK}' => $lang_main_menu['register_lnk'],
2176        '{REGISTER_ICO}' => cpg_fetch_icon('add_user', 1),
2177        '{LOGIN_TGT}' => "login.php",
2178        '{LOGIN_TITLE}' => $lang_main_menu['login_title'],
2179        '{LOGIN_LNK}' => $lang_main_menu['login_lnk'],
2180        '{LOGIN_ICO}' => cpg_fetch_icon('login', 1),
2181        '{LOGOUT_TGT}' => "logout.php?form_token=$form_token&amp;timestamp=$timestamp&amp;referer=$REFERER",
2182        '{LOGOUT_TITLE}' => $lang_main_menu['logout_title'],
2183        '{LOGOUT_LNK}' => $lang_main_menu['logout_lnk'] . " [" . stripslashes(USER_NAME) . "]",
2184        '{LOGOUT_ICO}' => cpg_fetch_icon('logout', 1),
2185        '{UPL_APP_LNK}' => $lang_gallery_admin_menu['upl_app_lnk'],
2186        '{UPL_APP_TGT}' => "editpics.php?mode=upload_approval",
2187        '{UPL_APP_TITLE}' => $lang_gallery_admin_menu['upl_app_lnk'],
2188        '{UPL_APP_ICO}' => cpg_fetch_icon('file_approval', 1),
2189        );
2190
2191        if ($CPG_PHP_SELF != 'login.php' && strpos($REFERER, 'login.php') === FALSE) {
2192            $param['{LOGIN_TGT}'] .= "?referer=$REFERER";
2193        }
2194
2195        if ($CPG_PHP_SELF != 'contact.php' && strpos($REFERER, 'contact.php') === FALSE) {
2196            $param['{CONTACT_TGT}'] .= "?referer=$REFERER";
2197        }
2198
2199        $sys_menu = template_eval($template_sys_menu, $param);
2200  } else {
2201
2202    if (!$CONFIG['custom_lnk_url']) {
2203        template_extract_block($template_sub_menu, 'custom_link');
2204    }
2205
2206    $param = array(
2207        '{ALB_LIST_TGT}' => "index.php$cat_l",
2208        '{ALB_LIST_TITLE}' => $lang_main_menu['alb_list_title'],
2209        '{ALB_LIST_LNK}' => $lang_main_menu['alb_list_lnk'],
2210        '{ALB_LIST_ICO}' => cpg_fetch_icon('alb_mgr', 1),
2211        '{CUSTOM_LNK_TGT}' => $CONFIG['custom_lnk_url'],
2212        '{CUSTOM_LNK_TITLE}' => $CONFIG['custom_lnk_name'],
2213        '{CUSTOM_LNK_LNK}' => $CONFIG['custom_lnk_name'],
2214        '{CUSTOM_LNK_ICO}' => cpg_fetch_icon('online', 1),
2215        '{LASTUP_TGT}' => "thumbnails.php?album=lastup$cat_l2",
2216        '{LASTUP_TITLE}' => $lang_main_menu['lastup_title'],
2217        '{LASTUP_LNK}' => $lang_main_menu['lastup_lnk'],
2218        '{LASTUP_ICO}' => cpg_fetch_icon('last_uploads', 1),
2219        '{LASTCOM_TGT}' => "thumbnails.php?album=lastcom$cat_l2",
2220        '{LASTCOM_TITLE}' => $lang_main_menu['lastcom_title'],
2221        '{LASTCOM_LNK}' => $lang_main_menu['lastcom_lnk'],
2222        '{LASTCOM_ICO}' => cpg_fetch_icon('comment', 1),
2223        '{TOPN_TGT}' => "thumbnails.php?album=topn$cat_l2",
2224        '{TOPN_TITLE}' => $lang_main_menu['topn_title'],
2225        '{TOPN_LNK}' => $lang_main_menu['topn_lnk'],
2226        '{TOPN_ICO}' => cpg_fetch_icon('most_viewed', 1),
2227        '{TOPRATED_TGT}' => "thumbnails.php?album=toprated$cat_l2",
2228        '{TOPRATED_TITLE}' => $lang_main_menu['toprated_title'],
2229        '{TOPRATED_LNK}' => $lang_main_menu['toprated_lnk'],
2230        '{TOPRATED_ICO}' => cpg_fetch_icon('top_rated', 1),
2231        '{FAV_TGT}' => "thumbnails.php?album=favpics",
2232        '{FAV_TITLE}' => $lang_main_menu['fav_title'],
2233        '{FAV_LNK}' => $lang_main_menu['fav_lnk'],
2234        '{FAV_ICO}' => cpg_fetch_icon('favorites', 1),
2235        '{BROWSEBYDATE_TGT}' => 'calendar.php',
2236        '{BROWSEBYDATE_LNK}' => $lang_main_menu['browse_by_date_lnk'],
2237        '{BROWSEBYDATE_TITLE}' => $lang_main_menu['browse_by_date_title'],
2238        '{BROWSEBYDATE_ICO}' => cpg_fetch_icon('calendar', 1),
2239        '{SEARCH_TGT}' => "search.php",
2240        '{SEARCH_TITLE}' => $lang_main_menu['search_title'],
2241        '{SEARCH_LNK}' => $lang_main_menu['search_lnk'],
2242        '{SEARCH_ICO}' => cpg_fetch_icon('search', 1),
2243        '{UPL_APP_LNK}' => $lang_gallery_admin_menu['upl_app_lnk'],
2244        '{UPL_APP_TGT}' => "editpics.php?mode=upload_approval",
2245        '{UPL_APP_TITLE}' => $lang_gallery_admin_menu['upl_app_lnk'],
2246        '{UPL_APP_ICO}' => cpg_fetch_icon('file_approval', 1),
2247        );
2248    $sub_menu = template_eval($template_sub_menu, $param);
2249  }
2250
2251    return $$which;
2252}
2253/******************************************************************************
2254** Section <<<theme_main_menu>>> - END
2255******************************************************************************/
2256}  //{THEMES}
2257
2258if (!function_exists('theme_admin_mode_menu')) {  //{THEMES}
2259/******************************************************************************
2260** Section <<<theme_admin_mode_menu>>> - START
2261******************************************************************************/
2262function theme_admin_mode_menu()
2263{
2264    global $cat;
2265    global $lang_gallery_admin_menu, $lang_user_admin_menu, $lang_cat_list, $lang_common;
2266    global $template_gallery_admin_menu, $template_user_admin_menu;
2267    global $CONFIG;
2268    global $THEME_DIR;
2269
2270    $cat_l = isset($cat) ? "?cat=$cat" : '';
2271
2272    static $admin_menu = '';
2273
2274    // Populate the admin menu only if empty to avoid template errors
2275    if ($admin_menu == '') {
2276
2277        $admin_menu = '<!-- -->';  // set in case an error occurs here; otherwise, theme_cpg_die will call this function and crash
2278
2279        if (GALLERY_ADMIN_MODE) {
2280
2281            if ($CONFIG['log_ecards'] == 0) {
2282                template_extract_block($template_gallery_admin_menu, 'log_ecards');
2283            }
2284
2285            if (cpg_get_pending_approvals() == 0) {
2286                 template_extract_block($template_gallery_admin_menu, 'admin_approval');
2287            }
2288
2289            // Query the languages table
2290            $help_lang = '';
2291            $results = cpg_db_query("SELECT lang_id, abbr FROM {$CONFIG['TABLE_LANGUAGE']} WHERE available='YES' AND enabled='YES'");
2292            while ($row = $results->fetchArray()) {
2293                if ($CONFIG['lang'] == $row['lang_id']) {
2294                    $help_lang = $row['abbr'];
2295                }
2296            } // while
2297            $results->free();
2298            unset($row);
2299            if ($help_lang == '') {
2300                $help_lang = 'en';
2301            }
2302
2303            // do the docs exist on the webserver?
2304            if ((file_exists('docs/README.md') == true) && (file_exists('docs/'.$help_lang.'/index.htm') == true)) {
2305                $documentation_href = 'docs/'.$help_lang.'/index.htm';
2306            } else {
2307                $documentation_href = 'http://coppermine-gallery.net/docs';
2308            }
2309
2310            if (!$CONFIG['enable_plugins']) {
2311                template_extract_block($template_gallery_admin_menu, 'plugin_manager');
2312            }
2313            if (!$CONFIG['log_mode']) {
2314                template_extract_block($template_gallery_admin_menu, 'view_log_files');
2315            }
2316            if (!$CONFIG['hit_details']) {
2317                template_extract_block($template_gallery_admin_menu, 'overall_stats');
2318            }
2319            if (!$CONFIG['clickable_keyword_search']) {
2320                template_extract_block($template_gallery_admin_menu, 'keyword_manager');
2321            }
2322            if (!$CONFIG['read_exif_data']) {
2323                template_extract_block($template_gallery_admin_menu, 'exif_manager');
2324            }
2325            if ($CONFIG['display_coppermine_news'] != 0) {
2326                template_extract_block($template_gallery_admin_menu, 'show_news');
2327            }
2328            if ($CONFIG['bridge_enable'] != 0) {
2329                template_extract_block($template_gallery_admin_menu, 'banmgr');
2330                template_extract_block($template_gallery_admin_menu, 'admin_profile');
2331            }
2332
2333            $param = array('{CATL}' => $cat_l,
2334                '{UPL_APP_TITLE}' => $lang_gallery_admin_menu['upl_app_title'],
2335                '{UPL_APP_LNK}' => $lang_gallery_admin_menu['upl_app_lnk'],
2336                '{UPL_APP_ICO}' => cpg_fetch_icon('file_approval', 1),
2337                '{ADMIN_TITLE}' => $lang_gallery_admin_menu['admin_title'],
2338                '{ADMIN_LNK}' => $lang_gallery_admin_menu['admin_lnk'],
2339                '{ADMIN_ICO}' => cpg_fetch_icon('config', 1),
2340                '{ALBUMS_TITLE}' => $lang_gallery_admin_menu['albums_title'],
2341                '{ALBUMS_LNK}' => $lang_gallery_admin_menu['albums_lnk'],
2342                '{ALBUMS_ICO}' => cpg_fetch_icon('alb_mgr', 1),
2343                '{CATEGORIES_TITLE}' => $lang_gallery_admin_menu['categories_title'],
2344                '{CATEGORIES_LNK}' => $lang_gallery_admin_menu['categories_lnk'],
2345                '{CATEGORIES_ICO}' => cpg_fetch_icon('cat_mgr', 1),
2346                '{USERS_TITLE}' => $lang_gallery_admin_menu['users_title'],
2347                '{USERS_LNK}' => $lang_gallery_admin_menu['users_lnk'],
2348                '{USERS_ICO}' => cpg_fetch_icon('user_mgr', 1),
2349                '{GROUPS_TITLE}' => $lang_gallery_admin_menu['groups_title'],
2350                '{GROUPS_LNK}' => $lang_gallery_admin_menu['groups_lnk'],
2351                '{GROUPS_ICO}' => cpg_fetch_icon('groups_mgr', 1),
2352                '{COMMENTS_TITLE}' => $lang_gallery_admin_menu['comments_title'],
2353                '{COMMENTS_LNK}' => $lang_gallery_admin_menu['comments_lnk'],
2354                '{COMMENTS_ICO}' => cpg_fetch_icon('comment_approval', 1),
2355                '{SEARCHNEW_TITLE}' => $lang_gallery_admin_menu['searchnew_title'],
2356                '{SEARCHNEW_LNK}' => $lang_gallery_admin_menu['searchnew_lnk'],
2357                '{SEARCHNEW_ICO}' => cpg_fetch_icon('searchnew', 1),
2358                '{FILES_TITLE}' => $lang_cat_list['pictures'],
2359                '{FILES_LNK}' => $lang_cat_list['pictures'],
2360                '{FILES_ICO}' => cpg_fetch_icon('searchnew', 1),
2361                '{INFO_TITLE}' => $lang_common['information'],
2362                '{INFO_LNK}' => $lang_common['information'],
2363                '{INFO_ICO}' => cpg_fetch_icon('info', 1),
2364                '{MY_PROF_TITLE}' => $lang_user_admin_menu['my_prof_title'],
2365                '{MY_PROF_LNK}' => $lang_user_admin_menu['my_prof_lnk'],
2366                '{MY_PROF_ICO}' => cpg_fetch_icon('my_profile', 1),
2367                '{UTIL_TITLE}' => $lang_gallery_admin_menu['util_title'],
2368                '{UTIL_LNK}' => $lang_gallery_admin_menu['util_lnk'],
2369                '{UTIL_ICO}' => cpg_fetch_icon('util', 1),
2370                '{BAN_TITLE}' => $lang_gallery_admin_menu['ban_title'],
2371                '{BAN_LNK}' => $lang_gallery_admin_menu['ban_lnk'],
2372                '{BAN_ICO}' => cpg_fetch_icon('ban_user', 1),
2373                '{DB_ECARD_TITLE}' => $lang_gallery_admin_menu['db_ecard_title'],
2374                '{DB_ECARD_LNK}' => $lang_gallery_admin_menu['db_ecard_lnk'],
2375                '{DB_ECARD_ICO}' => cpg_fetch_icon('ecard_review', 1),
2376                '{PICTURES_TITLE}' => $lang_gallery_admin_menu['pictures_title'],
2377                '{PICTURES_LNK}' => $lang_gallery_admin_menu['pictures_lnk'],
2378                '{PICTURES_ICO}' => cpg_fetch_icon('picture_sort', 1),
2379                '{DOCUMENTATION_HREF}' => $documentation_href,
2380                '{DOCUMENTATION_TITLE}' => $lang_gallery_admin_menu['documentation_title'],
2381                '{DOCUMENTATION_LNK}' => $lang_gallery_admin_menu['documentation_lnk'],
2382                '{DOCUMENTATION_ICO}' => cpg_fetch_icon('documentation', 1),
2383                '{PLUGINMGR_TITLE}' => $lang_gallery_admin_menu['pluginmgr_title'],
2384                '{PLUGINMGR_LNK}' => $lang_gallery_admin_menu['pluginmgr_lnk'],
2385                '{PLUGINMGR_ICO}' => cpg_fetch_icon('plugin_mgr', 1),
2386                '{BRIDGEMGR_TITLE}' => $lang_gallery_admin_menu['bridgemgr_title'],
2387                '{BRIDGEMGR_LNK}' => $lang_gallery_admin_menu['bridgemgr_lnk'],
2388                '{BRIDGEMGR_ICO}' => cpg_fetch_icon('bridge_mgr', 1),
2389                '{PHPINFO_TITLE}' => $lang_gallery_admin_menu['phpinfo_title'],
2390                '{PHPINFO_LNK}' => $lang_gallery_admin_menu['phpinfo_lnk'],
2391                '{PHPINFO_ICO}' => cpg_fetch_icon('phpinfo', 1),
2392                '{UPDATE_DATABASE_TITLE}' => $lang_gallery_admin_menu['update_database_title'],
2393                '{UPDATE_DATABASE_LNK}' => $lang_gallery_admin_menu['update_database_lnk'],
2394                '{UPDATE_DATABASE_ICO}' => cpg_fetch_icon('update_database', 1),
2395                '{VIEW_LOG_FILES_TITLE}' => $lang_gallery_admin_menu['view_log_files_title'],
2396                '{VIEW_LOG_FILES_LNK}' => $lang_gallery_admin_menu['view_log_files_lnk'],
2397                '{VIEW_LOG_FILES_ICO}' => cpg_fetch_icon('view_logs', 1),
2398                '{CHECK_VERSIONS_TITLE}' => $lang_gallery_admin_menu['check_versions_title'],
2399                '{CHECK_VERSIONS_LNK}' => $lang_gallery_admin_menu['check_versions_lnk'],
2400                '{CHECK_VERSIONS_ICO}' => cpg_fetch_icon('check_versions', 1),
2401                '{OVERALL_STATS_TITLE}' => $lang_gallery_admin_menu['overall_stats_title'],
2402                '{OVERALL_STATS_LNK}' => $lang_gallery_admin_menu['overall_stats_lnk'],
2403                '{OVERALL_STATS_ICO}' => cpg_fetch_icon('stats', 1),
2404                '{KEYWORDMGR_TITLE}' => $lang_gallery_admin_menu['keywordmgr_title'],
2405                '{KEYWORDMGR_LNK}' => $lang_gallery_admin_menu['keywordmgr_lnk'],
2406                '{KEYWORDMGR_ICO}' => cpg_fetch_icon('keyword_mgr', 1),
2407                '{EXIFMGR_TITLE}' => $lang_gallery_admin_menu['exifmgr_title'],
2408                '{EXIFMGR_LNK}' => $lang_gallery_admin_menu['exifmgr_lnk'],
2409                '{EXIFMGR_ICO}' => cpg_fetch_icon('exif_mgr', 1),
2410                '{SHOWNEWS_TITLE}' => $lang_gallery_admin_menu['shownews_title'],
2411                '{SHOWNEWS_LNK}' => $lang_gallery_admin_menu['shownews_lnk'],
2412                '{SHOWNEWS_ICO}' => cpg_fetch_icon('news_show', 1),
2413                '{TIME_STAMP}' => date('His').trim(floor(rand(0, 1000))),
2414                );
2415
2416            $html = template_eval($template_gallery_admin_menu, $param);
2417            // $html.= cpg_alert_dev_version();
2418        } elseif (USER_ADMIN_MODE) {
2419            $param = array('{ALBMGR_TITLE}' => $lang_user_admin_menu['albmgr_title'],
2420                '{ALBMGR_LNK}' => $lang_user_admin_menu['albmgr_lnk'],
2421                '{ALBUMS_ICO}' => cpg_fetch_icon('alb_mgr', 1),
2422                '{MODIFYALB_TITLE}' => $lang_user_admin_menu['modifyalb_title'],
2423                '{MODIFYALB_LNK}' => $lang_user_admin_menu['modifyalb_lnk'],
2424                '{MODIFYALB_ICO}' => cpg_fetch_icon('modifyalb', 1),
2425                '{MY_PROF_TITLE}' => $lang_user_admin_menu['my_prof_title'],
2426                '{MY_PROF_LNK}' => $lang_user_admin_menu['my_prof_lnk'],
2427                '{MY_PROF_ICO}' => cpg_fetch_icon('my_profile', 1),
2428                '{PICTURES_TITLE}' => $lang_gallery_admin_menu['pictures_title'],
2429                '{PICTURES_LNK}' => $lang_gallery_admin_menu['pictures_lnk'],
2430                '{PICTURES_ICO}' => cpg_fetch_icon('picture_sort', 1),
2431                );
2432
2433            $html = template_eval($template_user_admin_menu, $param);
2434        } else {
2435            $html = '';
2436        }
2437
2438        $admin_menu = CPGPluginAPI::filter('admin_menu',$html);
2439    }
2440
2441    return $admin_menu;
2442}
2443/******************************************************************************
2444** Section <<<theme_admin_mode_menu>>> - END
2445******************************************************************************/
2446}  //{THEMES}
2447
2448if (!function_exists('theme_display_message_block')) {  //{THEMES}
2449/******************************************************************************
2450** Section <<<theme_display_message_block>>> - START
2451******************************************************************************/
2452/******************************************************************************
2453// Function for the theme_display_message_block
2454The message block (not to be confused with the admin menu) will display message carried over from one page to the other.
2455It's advisable not to change it unless you really know what you're doing.
2456This function composes the individual sections of the block.
2457******************************************************************************/
2458function theme_display_message_block() {
2459    global $lang_gallery_admin_menu, $lang_common, $CONFIG, $message_id;
2460
2461    $superCage = Inspekt::makeSuperCage();
2462    $return = '';
2463    $message_id = '';
2464    $message_icon = '';
2465    $message_style = '';
2466
2467    if ($superCage->get->keyExists('message_id')) {
2468      $message_id = $superCage->get->getEscaped('message_id');
2469    }
2470
2471    if ($superCage->get->keyExists('message_icon')) {
2472        $message_icon = $superCage->get->getAlpha('message_icon');
2473    }
2474
2475    if ($message_icon == 'error') {
2476        $message_style = 'cpg_message_error';
2477    } elseif ($message_icon == 'warning') {
2478        $message_style = 'cpg_message_warning';
2479    } elseif ($message_icon == 'validation') {
2480        $message_style = 'cpg_message_validation';
2481    } elseif ($message_icon == 'success') {
2482        $message_style = 'cpg_message_success';
2483    } else {
2484        $message_style = 'cpg_message_info';
2485    }
2486
2487    if ($message_id != '') {
2488        $tempMessage = cpgFetchTempMessage($message_id);
2489        if ($tempMessage != '') {
2490            $return .= '<a name="cpgMessageBlock"></a>';
2491            $return .= <<< EOT
2492            <div id="cpgMessage" class="cpg_user_message {$message_style}">
2493              {$tempMessage}
2494            </div>
2495EOT;
2496        }
2497    }
2498    if (GALLERY_ADMIN_MODE) {
2499        $return .= cpg_alert_dev_version();
2500        // $return .= cpg_display_rss(); //add RSS feed from coppermine-gallery.net later
2501    } else { // not in admin mode
2502        //$return = '';
2503    }
2504    return $return;
2505}
2506/******************************************************************************
2507** Section <<<theme_display_message_block>>> - END
2508******************************************************************************/
2509}  //{THEMES}
2510
2511if (!function_exists('theme_display_cat_list')) {  //{THEMES}
2512/******************************************************************************
2513** Section <<<theme_display_cat_list>>> - START
2514******************************************************************************/
2515function theme_display_cat_list($breadcrumb, &$cat_data, $statistics)
2516{
2517    global $template_cat_list, $lang_cat_list;
2518    if (count($cat_data) > 0) {
2519        starttable('100%');
2520        $template = template_extract_block($template_cat_list, 'header');
2521        $params = array(
2522                '{CATEGORY}' => $lang_cat_list['category'],
2523                '{ALBUMS}' => $lang_cat_list['albums'],
2524                '{PICTURES}' => $lang_cat_list['pictures'],
2525        );
2526        echo template_eval($template, $params);
2527    }
2528
2529    $template_noalb = template_extract_block($template_cat_list, 'catrow_noalb');
2530    $template = template_extract_block($template_cat_list, 'catrow');
2531    foreach($cat_data as $category) {
2532        if (!isset($category['cat_thumb'])) { $category['cat_thumb'] = ''; }
2533        if (count($category) == 3) {
2534            $params = array(
2535                    '{CAT_TITLE}' => $category[0],
2536                    '{CAT_THUMB}' => $category['cat_thumb'],
2537                    '{CAT_DESC}' => $category[1],
2538            );
2539            echo template_eval($template_noalb, $params);
2540        } elseif (isset($category['cat_albums']) && ($category['cat_albums'] != '')) {
2541            $params = array(
2542                    '{CAT_TITLE}' => $category[0],
2543                    '{CAT_THUMB}' => $category['cat_thumb'],
2544                    '{CAT_DESC}' => $category[1],
2545                    '{CAT_ALBUMS}' => $category['cat_albums'],
2546                    '{ALB_COUNT}' => cpg_float2decimal($category[2]),
2547                    '{PIC_COUNT}' => cpg_float2decimal($category[3]),
2548            );
2549            echo template_eval($template, $params);
2550        } else {
2551            $params = array(
2552                    '{CAT_TITLE}' => $category[0],
2553                    '{CAT_THUMB}' => $category['cat_thumb'],
2554                    '{CAT_DESC}' => $category[1],
2555                    '{CAT_ALBUMS}' => '',
2556                    '{ALB_COUNT}' => cpg_float2decimal($category[2]),
2557                    '{PIC_COUNT}' => cpg_float2decimal($category[3]),
2558            );
2559            echo template_eval($template, $params);
2560        }
2561    }
2562
2563    if ($statistics && count($cat_data) > 0) {
2564        $template = template_extract_block($template_cat_list, 'footer');
2565        $params = array('{STATISTICS}' => $statistics);
2566        echo template_eval($template, $params);
2567    }
2568
2569
2570    if (count($cat_data) > 0)
2571          endtable();
2572        echo template_extract_block($template_cat_list, 'spacer');
2573}
2574/******************************************************************************
2575** Section <<<theme_display_cat_list>>> - END
2576******************************************************************************/
2577}  //{THEMES}
2578
2579if (!function_exists('theme_display_breadcrumb')) {  //{THEMES}
2580/******************************************************************************
2581** Section <<<theme_display_breadcrumb>>> - START
2582******************************************************************************/
2583function theme_display_breadcrumb($breadcrumb, &$cat_data)
2584{
2585    /**
2586     * ** added breadcrumb as a seperate element
2587     */
2588    global $template_breadcrumb, $lang_breadcrumb;
2589
2590    starttable('100%');
2591    if ($breadcrumb) {
2592        $template = template_extract_block($template_breadcrumb, 'breadcrumb');
2593        $params = array(
2594                '{BREADCRUMB}' => $breadcrumb,
2595        );
2596        echo template_eval($template, $params);
2597    }
2598        endtable();
2599}
2600/******************************************************************************
2601** Section <<<theme_display_breadcrumb>>> - END
2602******************************************************************************/
2603}  //{THEMES}
2604
2605if (!function_exists('theme_display_album_list'))  {  //{THEMES}
2606/******************************************************************************
2607** Section <<<theme_display_album_list>>> - START
2608******************************************************************************/
2609function theme_display_album_list(&$alb_list, $nbAlb, $cat, $page, $total_pages)
2610{
2611
2612    global $CONFIG, $STATS_IN_ALB_LIST, $statistics, $template_tab_display, $template_album_list, $lang_album_list;
2613
2614    $theme_alb_list_tab_tmpl = $template_tab_display;
2615
2616    $theme_alb_list_tab_tmpl['left_text'] = strtr($theme_alb_list_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_album_list['album_on_page']));
2617    $theme_alb_list_tab_tmpl['page_link'] = strtr($theme_alb_list_tab_tmpl['page_link'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));
2618
2619    $tabs = create_tabs($nbAlb, $page, $total_pages, $theme_alb_list_tab_tmpl);
2620
2621    $album_cell = template_extract_block($template_album_list, 'album_cell');
2622    $empty_cell = template_extract_block($template_album_list, 'empty_cell');
2623    $tabs_row = template_extract_block($template_album_list, 'tabs');
2624    $stat_row = template_extract_block($template_album_list, 'stat_row');
2625    $spacer = template_extract_block($template_album_list, 'spacer');
2626    $header = template_extract_block($template_album_list, 'header');
2627    $footer = template_extract_block($template_album_list, 'footer');
2628    $rows_separator = template_extract_block($template_album_list, 'row_separator');
2629
2630    $count = 0;
2631
2632    $columns = $CONFIG['album_list_cols'];
2633    $column_width = ceil(100 / $columns);
2634    $thumb_cell_width = $CONFIG['alb_list_thumb_size'] + 2;
2635
2636    starttable('100%');
2637
2638    if ($STATS_IN_ALB_LIST) {
2639        $params = array('{STATISTICS}' => $statistics,
2640            '{COLUMNS}' => $columns,
2641            );
2642        echo template_eval($stat_row, $params);
2643    }
2644
2645    echo $header;
2646
2647    if (is_array($alb_list)) {
2648        foreach($alb_list as $album) {
2649            $count ++;
2650
2651            $params = array('{COL_WIDTH}' => $column_width,
2652                '{ALBUM_TITLE}' => $album['album_title'],
2653                '{THUMB_CELL_WIDTH}' => $thumb_cell_width,
2654                '{ALB_LINK_TGT}' => "thumbnails.php?album={$album['aid']}",
2655                '{ALB_LINK_PIC}' => $album['thumb_pic'],
2656                '{ADMIN_MENU}' => $album['album_adm_menu'],
2657                '{ALB_DESC}' => $album['album_desc'],
2658                '{ALB_INFOS}' => $album['album_info'],
2659                '{ALB_HITS}' => $album['alb_hits'],
2660                );
2661            $params = CPGPluginAPI::filter('theme_album_params', $params);
2662
2663            echo template_eval($album_cell, $params);
2664
2665            if ($count % $columns == 0 && $count < count($alb_list)) {
2666                echo $rows_separator;
2667            }
2668        }
2669    }
2670
2671    $params = array('{COL_WIDTH}' => $column_width,
2672          '{SPACER}' => $thumb_cell_width
2673          );
2674    $empty_cell = template_eval($empty_cell, $params);
2675
2676    while ($count++ % $columns != 0) {
2677        echo $empty_cell;
2678    }
2679
2680    echo $footer;
2681    // Tab display
2682    $params = array('{COLUMNS}' => $columns,
2683        '{TABS}' => $tabs,
2684        );
2685    echo template_eval($tabs_row, $params);
2686
2687    endtable();
2688
2689    echo $spacer;
2690}
2691/******************************************************************************
2692** Section <<<theme_display_album_list>>> - END
2693******************************************************************************/
2694}  //{THEMES}
2695
2696if (!function_exists('theme_display_album_list_cat')) {  //{THEMES}
2697/******************************************************************************
2698** Section <<<theme_display_album_list_cat>>> - START
2699******************************************************************************/
2700// Function to display first level Albums of a category
2701function theme_display_album_list_cat(&$alb_list, $nbAlb, $cat, $page, $total_pages)
2702{
2703    global $CONFIG, $STATS_IN_ALB_LIST, $statistics, $template_tab_display, $template_album_list_cat, $lang_album_list;
2704    if (!$CONFIG['first_level']) {
2705        return;
2706    }
2707
2708    $theme_alb_list_tab_tmpl = $template_tab_display;
2709
2710    $theme_alb_list_tab_tmpl['left_text'] = strtr($theme_alb_list_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_album_list['album_on_page']));
2711    $theme_alb_list_tab_tmpl['page_link'] = strtr($theme_alb_list_tab_tmpl['page_link'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));
2712
2713    $tabs = create_tabs($nbAlb, $page, $total_pages, $theme_alb_list_tab_tmpl);
2714    // echo $template_album_list_cat;
2715    $template_album_list_cat1 = $template_album_list_cat;
2716    $album_cell = template_extract_block($template_album_list_cat1, 'c_album_cell');
2717    $empty_cell = template_extract_block($template_album_list_cat1, 'c_empty_cell');
2718    $tabs_row = template_extract_block($template_album_list_cat1, 'c_tabs');
2719    $stat_row = template_extract_block($template_album_list_cat1, 'c_stat_row');
2720    $spacer = template_extract_block($template_album_list_cat1, 'c_spacer');
2721    $header = template_extract_block($template_album_list_cat1, 'c_header');
2722    $footer = template_extract_block($template_album_list_cat1, 'c_footer');
2723    $rows_separator = template_extract_block($template_album_list_cat1, 'c_row_separator');
2724
2725    $count = 0;
2726
2727    $columns = $CONFIG['album_list_cols'];
2728    $column_width = ceil(100 / $columns);
2729    $thumb_cell_width = $CONFIG['alb_list_thumb_size'] + 2;
2730
2731    starttable('99%'); // '100%' destroys the layout if $CONFIG['main_table_width'] is a pixel value
2732
2733    if ($STATS_IN_ALB_LIST) {
2734        $params = array('{STATISTICS}' => $statistics,
2735            '{COLUMNS}' => $columns,
2736            );
2737        echo template_eval($stat_row, $params);
2738    }
2739
2740    echo $header;
2741
2742    if (is_array($alb_list)) {
2743        foreach($alb_list as $album) {
2744            $count ++;
2745
2746            $params = array('{COL_WIDTH}' => $column_width,
2747                '{ALBUM_TITLE}' => $album['album_title'],
2748                '{THUMB_CELL_WIDTH}' => $thumb_cell_width,
2749                '{ALB_LINK_TGT}' => "thumbnails.php?album={$album['aid']}",
2750                '{ALB_LINK_PIC}' => $album['thumb_pic'],
2751                '{ADMIN_MENU}' => $album['album_adm_menu'],
2752                '{ALB_DESC}' => $album['album_desc'],
2753                '{ALB_INFOS}' => $album['album_info'],
2754                '{ALB_HITS}' => $album['alb_hits'],
2755                );
2756
2757            echo template_eval($album_cell, $params);
2758
2759            if ($count % $columns == 0 && $count < count($alb_list)) {
2760                echo $rows_separator;
2761            }
2762        }
2763    }
2764
2765    $params = array('{COL_WIDTH}' => $column_width,
2766          '{SPACER}' => $thumb_cell_width
2767          );
2768    $empty_cell = template_eval($empty_cell, $params);
2769
2770    while ($count++ % $columns != 0) {
2771        echo $empty_cell;
2772    }
2773
2774    echo $footer;
2775    // Tab display
2776    $params = array('{COLUMNS}' => $columns,
2777        '{TABS}' => $tabs,
2778        );
2779    echo template_eval($tabs_row, $params);
2780
2781    endtable();
2782
2783    echo $spacer;
2784}
2785/******************************************************************************
2786** Section <<<theme_display_album_list_cat>>> - END
2787******************************************************************************/
2788}  //{THEMES}
2789
2790if (!function_exists('theme_display_thumbnails')) {  //{THEMES}
2791/******************************************************************************
2792** Section <<<theme_display_thumbnails>>> - START
2793******************************************************************************/
2794function theme_display_thumbnails(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $page, $total_pages, $sort_options, $display_tabs, $mode = 'thumb', $date='')
2795{
2796    global $CONFIG, $CURRENT_ALBUM_DATA;
2797    global $template_thumb_view_title_row,$template_fav_thumb_view_title_row, $lang_thumb_view, $lang_common, $template_tab_display, $template_thumbnail_view, $lang_album_list, $lang_errors;
2798
2799    $superCage = Inspekt::makeSuperCage();
2800
2801    static $header = '';
2802    static $thumb_cell = '';
2803    static $empty_cell = '';
2804    static $row_separator = '';
2805    static $footer = '';
2806    static $tabs = '';
2807    static $spacer = '';
2808
2809    if ($header == '') {
2810        $thumb_cell = template_extract_block($template_thumbnail_view, 'thumb_cell');
2811        $tabs = template_extract_block($template_thumbnail_view, 'tabs');
2812        $header = template_extract_block($template_thumbnail_view, 'header');
2813        $empty_cell = template_extract_block($template_thumbnail_view, 'empty_cell');
2814        $row_separator = template_extract_block($template_thumbnail_view, 'row_separator');
2815        $footer = template_extract_block($template_thumbnail_view, 'footer');
2816        $spacer = template_extract_block($template_thumbnail_view, 'spacer');
2817    }
2818
2819    $cat_link = is_numeric($aid) ? '' : '&amp;cat=' . $cat;
2820    $date_link = $date=='' ? '' : '&amp;date=' . $date;
2821    if ($superCage->get->getInt('uid')) {
2822      $uid_link = '&amp;uid=' . $superCage->get->getInt('uid');
2823    } else {
2824      $uid_link = '';
2825    }
2826
2827    $album_types = array(
2828        'albums' => array('lastalb')
2829    );
2830    $album_types = CPGPluginAPI::filter('theme_thumbnails_album_types', $album_types);
2831
2832    $theme_thumb_tab_tmpl = $template_tab_display;
2833
2834    if ($mode == 'thumb') {
2835        $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => in_array($aid, $album_types['albums']) ? $lang_album_list['album_on_page'] : $lang_thumb_view['pic_on_page']));
2836        $theme_thumb_tab_tmpl['page_link'] = strtr($theme_thumb_tab_tmpl['page_link'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . $date_link . $uid_link . '&amp;page=%d'));
2837    } else {
2838        $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_thumb_view['user_on_page']));
2839        $theme_thumb_tab_tmpl['page_link'] = strtr($theme_thumb_tab_tmpl['page_link'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));
2840    }
2841
2842    $thumbcols = $CONFIG['thumbcols'];
2843    $cell_width = floor((100 / $CONFIG['thumbcols']) * 100) / 100 . '%';
2844
2845    $tabs_html = $display_tabs ? create_tabs($nbThumb, $page, $total_pages, $theme_thumb_tab_tmpl) : '';
2846
2847    if (!GALLERY_ADMIN_MODE && stripos($template_thumb_view_title_row, 'admin_buttons') !== false) {
2848        template_extract_block($template_thumb_view_title_row, 'admin_buttons');
2849    }
2850    // The sort order options are not available for meta albums
2851    if ($sort_options) {
2852        if (GALLERY_ADMIN_MODE) {
2853            $param = array(
2854                '{ALBUM_ID}'   => $aid,
2855                '{CAT_ID}'     => ($cat > 0 ? $cat : $CURRENT_ALBUM_DATA['category']),
2856                '{MODIFY_LNK}'     => $lang_common['album_properties'],
2857                '{MODIFY_ICO}'     => cpg_fetch_icon('modifyalb', 0),
2858                '{PARENT_CAT_LNK}' => $lang_common['parent_category'],
2859                '{PARENT_CAT_ICO}' => cpg_fetch_icon('category', 0),
2860                '{EDIT_PICS_LNK}'  => $lang_common['edit_files'],
2861                '{EDIT_PICS_ICO}'  => cpg_fetch_icon('edit', 0),
2862                '{ALBUM_MGR_LNK}'  => $lang_common['album_manager'],
2863                '{ALBUM_MGR_ICO}'  => cpg_fetch_icon('alb_mgr', 0),
2864            );
2865        } else {
2866            $param = array();
2867        }
2868        $param['{ALBUM_NAME}'] = $album_name;
2869        // Plugin Filter: allow plugin to modify or add tags to process
2870        $param = CPGPluginAPI::filter('theme_thumbnails_title', $param);
2871        $title = template_eval($template_thumb_view_title_row, $param);
2872    } elseif ($aid == 'favpics' && $CONFIG['enable_zipdownload'] > 0) { //Lots of stuff can be added here later
2873        $param = array(
2874            '{ALBUM_ID}'   => $aid,
2875            '{ALBUM_NAME}' => $album_name,
2876            '{DOWNLOAD_ZIP}' => cpg_fetch_icon ('zip', 2) . $lang_thumb_view['download_zip'],
2877        );
2878        // Plugin Filter: allow plugin to modify or add tags to process
2879        $param = CPGPluginAPI::filter('theme_thumbnails_title', $param);
2880        $title = template_eval($template_fav_thumb_view_title_row, $param);
2881    } else {
2882        $title = $album_name;
2883    }
2884
2885    CPGPluginAPI::action('theme_thumbnails_wrapper_start', null);
2886
2887    if ($mode == 'thumb') {
2888        starttable('100%', $title, $thumbcols);
2889    } else {
2890        starttable('100%');
2891    }
2892
2893    $header = CPGPluginAPI::filter('theme_thumbnails_header', $header);
2894    echo $header;
2895
2896    $i = 0;
2897    global $thumb;  // make $thumb accessible to plugins
2898    foreach($thumb_list as $thumb) {
2899        $i++;
2900        if ($mode == 'thumb') {
2901            if (in_array($aid, $album_types['albums'])) {
2902                $params = array(
2903                    '{CELL_WIDTH}' => $cell_width,
2904                    '{LINK_TGT}'   => "thumbnails.php?album={$thumb['aid']}",
2905                    '{THUMB}'      => $thumb['image'],
2906                    '{CAPTION}'    => $thumb['caption'],
2907                    '{ADMIN_MENU}' => $thumb['admin_menu'],
2908                );
2909            } else {
2910                // determine if thumbnail link targets should open in a pop-up
2911                if ($CONFIG['thumbnail_to_fullsize'] == 1) { // code for full-size pop-up
2912                    if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
2913                       $target = 'javascript:;" onclick="alert(\''.sprintf($lang_errors['login_needed'],'','','','').'\');';
2914                    } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) {
2915                        $target = 'javascript:;" onclick="alert(\''.sprintf($lang_errors['access_intermediate_only'],'','','','').'\');';
2916                    } else {
2917                       $target = 'javascript:;" onclick="MM_openBrWindow(\'displayimage.php?pid=' . $thumb['pid'] . '&fullsize=1\',\'' . uniqid(rand()) . '\',\'scrollbars=yes,toolbar=no,status=no,resizable=yes,width=' . ((int)$thumb['pwidth']+(int)$CONFIG['fullsize_padding_x']) .  ',height=' .   ((int)$thumb['pheight']+(int)$CONFIG['fullsize_padding_y']). '\');';
2918                    }
2919                } elseif ($aid == 'random') {
2920                    $target = "displayimage.php?pid={$thumb['pid']}$uid_link#top_display_media";
2921                } elseif ($aid == 'lastcom' || $aid == 'lastcomby') {
2922                    $page = cpg_get_comment_page_number($thumb['msg_id']);
2923                    $page = (is_numeric($page)) ? "&amp;page=$page" : '';
2924                    $target = "displayimage.php?album=$aid$cat_link$date_link&amp;pid={$thumb['pid']}$uid_link&amp;msg_id={$thumb['msg_id']}$page#comment{$thumb['msg_id']}";
2925                } else {
2926                    $target = "displayimage.php?album=$aid$cat_link$date_link&amp;pid={$thumb['pid']}$uid_link#top_display_media";
2927                }
2928                $params = array(
2929                    '{CELL_WIDTH}' => $cell_width,
2930                    '{LINK_TGT}'   => $target,
2931                    '{THUMB}'      => $thumb['image'],
2932                    '{CAPTION}'    => $thumb['caption'],
2933                    '{ADMIN_MENU}' => $thumb['admin_menu'],
2934                );
2935            }
2936
2937        } else {  // mode != 'thumb'
2938
2939            // Used for mode = 'user' from list_users() in index.php
2940            $params = array(
2941                '{CELL_WIDTH}' => $cell_width,
2942                '{LINK_TGT}'   => "index.php?cat={$thumb['cat']}",
2943                '{THUMB}'      => $thumb['image'],
2944                '{CAPTION}'    => $thumb['caption'],
2945                '{ADMIN_MENU}' => '',
2946            );
2947
2948        }
2949
2950        // Plugin Filter: allow plugin to modify or add tags to process
2951        $params = CPGPluginAPI::filter('theme_display_thumbnails_params', $params);
2952        echo template_eval($thumb_cell, $params);
2953
2954        if ((($i % $thumbcols) == 0) && ($i < count($thumb_list))) {
2955            echo $row_separator;
2956        }
2957    } // foreach $thumb
2958
2959    unset($thumb);  // unset $thumb to avoid conflicting with global
2960
2961    for (;($i % $thumbcols); $i++) {
2962        echo $empty_cell;
2963    }
2964    $footer = CPGPluginAPI::filter('theme_thumbnails_footer', $footer);
2965    echo $footer;
2966
2967    if ($display_tabs) {
2968        $params = array(
2969            '{THUMB_COLS}' => $thumbcols,
2970            '{TABS}'       => $tabs_html,
2971        );
2972        echo template_eval($tabs, $params);
2973    }
2974
2975    endtable();
2976    CPGPluginAPI::action('theme_thumbnails_wrapper_end', null);
2977    echo $spacer;
2978}
2979/******************************************************************************
2980** Section <<<theme_display_thumbnails>>> - END
2981******************************************************************************/
2982}  //{THEMES}
2983
2984if (!function_exists('theme_display_film_strip')) {  //{THEMES}
2985/******************************************************************************
2986** Section <<<theme_display_film_strip>>> - START
2987******************************************************************************/
2988// Function to display the film strip
2989function theme_display_film_strip(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $pos, $sort_options, $mode, $date, $filmstrip_prev_pos, $filmstrip_next_pos, $max_block_items, $thumb_width)
2990{
2991    global $CONFIG, $THEME_DIR;
2992    global $template_film_strip, $lang_film_strip, $lang_common, $pic_count,$mar_pic;
2993
2994    $superCage = Inspekt::makeSuperCage();
2995
2996    static $template = '';
2997    static $thumb_cell = '';
2998    static $empty_cell = '';
2999    static $spacer = '';
3000
3001    if ((!$template)) {
3002        $template = $template_film_strip;
3003        $thumb_cell = str_replace('<td', '<td align="center"', template_extract_block($template, 'thumb_cell')); // center thumbnails
3004        $empty_cell = template_extract_block($template, 'empty_cell');
3005    }
3006
3007    $cat_link = is_numeric($aid) ? '' : '&amp;cat=' . $cat;
3008    $date_link = $date=='' ? '' : '&amp;date=' . $date;
3009
3010    if ($superCage->get->getInt('uid')) {
3011        $uid_link = '&amp;uid=' . $superCage->get->getInt('uid');
3012    } else {
3013        $uid_link = '';
3014    }
3015
3016    $i = 0;
3017    $thumb_strip = '';
3018    foreach($thumb_list as $thumb) {
3019        $i++;
3020        if ($mode == 'thumb') {
3021            if ($thumb['pos'] == $pos && !$superCage->get->keyExists('film_strip')) {
3022                $thumb['image'] = str_replace('class="strip_image"', 'class="strip_image middlethumb"', $thumb['image']);
3023            }
3024            // determine if thumbnail link targets should open in a pop-up
3025            if ($CONFIG['thumbnail_to_fullsize'] == 1) { // code for full-size pop-up
3026                if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
3027                    $target = 'javascript:;" onclick="alert(\''.sprintf($lang_errors['login_needed'],'','','','').'\');';
3028                } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) {
3029                    $target = 'javascript:;" onclick="alert(\''.sprintf($lang_errors['access_intermediate_only'],'','','','').'\');';
3030                } else {
3031                    $target = 'javascript:;" onclick="MM_openBrWindow(\'displayimage.php?pid=' . $thumb['pid'] . '&fullsize=1\',\'' . uniqid(rand()) . '\',\'scrollbars=yes,toolbar=no,status=no,resizable=yes,width=' . ((int)$thumb['pwidth']+(int)$CONFIG['fullsize_padding_x']) .  ',height=' .   ((int)$thumb['pheight']+(int)$CONFIG['fullsize_padding_y']). '\');';
3032                }
3033            } elseif ($aid == 'lastcom' || $aid == 'lastcomby') {
3034                $page = cpg_get_comment_page_number($thumb['msg_id']);
3035                $page = (is_numeric($page)) ? "&amp;page=$page" : '';
3036                $target = "displayimage.php?album=$aid$cat_link$date_link&amp;pid={$thumb['pid']}$uid_link&amp;msg_id={$thumb['msg_id']}$page#comment{$thumb['msg_id']}";
3037            } else {
3038                $target = "displayimage.php?album=$aid$cat_link$date_link&amp;pid={$thumb['pid']}$uid_link#top_display_media";
3039            }
3040            $params = array(
3041                '{LINK_TGT}' => $target,
3042                '{THUMB}' => $thumb['image'],
3043                '{ONE_WIDTH}'  => "width:".$thumb_width."px; float: left" ,
3044                );
3045        } else {
3046            $params = array(
3047                '{LINK_TGT}' => "index.php?cat={$thumb['cat']}",
3048                '{THUMB}' => $thumb['image'],
3049                '{ONE_WIDTH}'  => "width:".$thumb_width."px; float: left" ,
3050                );
3051        }
3052        $thumb_strip .= template_eval($thumb_cell, $params);
3053    }
3054
3055    if (defined('THEME_HAS_FILM_STRIP_GRAPHICS')) {
3056        $tile1 = $THEME_DIR . 'images/tile1.gif';
3057        $tile2 = $THEME_DIR . 'images/tile2.gif';
3058    } elseif (defined('THEME_HAS_FILM_STRIP_GRAPHIC')) {
3059        $tile1=$tile2=$THEME_DIR . 'images/tile.gif';
3060    } else {
3061        $tile1=$tile2= 'images/tile.gif';
3062    }
3063
3064    if (defined('THEME_HAS_NAVBAR_GRAPHICS')) {
3065        $location = $THEME_DIR;
3066    } else {
3067        $location= '';
3068    }
3069    $max_itme_width_ul = $max_block_items;
3070    if(($max_block_items%2)==0){
3071        $max_itme_width_ul = $max_block_items +1;
3072    }
3073    $set_width_to_film = "width:".($max_block_items*($thumb_width+4))."px; position:relative;";
3074
3075    $params = array('{THUMB_STRIP}' => $thumb_strip,
3076        '{COLS}' => $i,
3077        '{TILE1}' => $tile1,
3078        '{TILE2}' => $tile2,
3079        '{SET_WIDTH}'  => $set_width_to_film,
3080        );
3081
3082    ob_start();
3083    echo '<div id="filmstrip">';
3084    starttable($CONFIG['picture_table_width']);
3085    echo template_eval($template, $params);
3086    endtable();
3087    echo '</div>';
3088    $film_strip = ob_get_contents();
3089    ob_end_clean();
3090
3091    return $film_strip;
3092}
3093/******************************************************************************
3094** Section <<<theme_display_film_strip>>> - END
3095******************************************************************************/
3096}  //{THEMES}
3097
3098if (!function_exists('theme_no_img_to_display')) {  //{THEMES}
3099/******************************************************************************
3100** Section <<<theme_no_img_to_display>>> - START
3101******************************************************************************/
3102function theme_no_img_to_display($album_name)
3103{
3104    global $lang_errors, $template_no_img_to_display;
3105
3106    static $template = '';
3107    static $spacer;
3108
3109    if ((!$template)) {
3110        $template = $template_no_img_to_display;
3111        $spacer = template_extract_block($template, 'spacer');
3112    }
3113
3114    $params = array('{TEXT}' => $lang_errors['no_img_to_display']);
3115    starttable('100%', $album_name);
3116    echo template_eval($template, $params);
3117    endtable();
3118}
3119/******************************************************************************
3120** Section <<<theme_no_img_to_display>>> - END
3121******************************************************************************/
3122}  //{THEMES}
3123
3124if (!function_exists('theme_display_image')) {  //{THEMES}
3125/******************************************************************************
3126** Section <<<theme_display_image>>> - START
3127******************************************************************************/
3128function theme_display_image($nav_menu, $picture, $votes, $pic_info, $comments, $film_strip)
3129{
3130    global $CONFIG, $LINEBREAK;
3131
3132    $superCage = Inspekt::makeSuperCage();
3133
3134    $width = $CONFIG['picture_table_width'];
3135
3136    echo '<a name="top_display_media"></a>'; // set the navbar-anchor
3137    starttable();
3138    echo $nav_menu;
3139    endtable();
3140
3141    starttable();
3142    echo $picture;
3143    endtable();
3144    if ($CONFIG['display_film_strip'] == 1) {
3145        echo $film_strip;
3146    }
3147
3148
3149    echo $votes;
3150
3151    $picinfo = $superCage->cookie->keyExists('picinfo') ? $superCage->cookie->getAlpha('picinfo') : ($CONFIG['display_pic_info'] ? 'block' : 'none');
3152    echo $LINEBREAK . '<div id="picinfo" style="display: '.str_replace('.gif','.png',$picinfo).';">' . $LINEBREAK;
3153    starttable();
3154    echo $pic_info;
3155    endtable();
3156    echo '</div>' . $LINEBREAK;
3157
3158    echo '<a name="comments_top"></a>';
3159    echo '<div id="comments">' . $LINEBREAK;
3160        echo $comments;
3161        echo '</div>' . $LINEBREAK;
3162
3163}
3164/******************************************************************************
3165** Section <<<theme_display_image>>> - END
3166******************************************************************************/
3167}  //{THEMES}
3168
3169if (!function_exists('theme_html_picinfo')) {  //{THEMES}
3170/******************************************************************************
3171** Section <<<theme_html_picinfo>>> - START
3172******************************************************************************/
3173function theme_html_picinfo(&$info)
3174{
3175    global $lang_picinfo, $CONFIG, $CURRENT_PIC_DATA, $LINEBREAK;
3176
3177    if ($CONFIG['picinfo_movie_download_link']) {
3178        $path_to_pic = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];
3179        $mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);
3180        if ($mime_content['content']=='movie') {
3181            $info[$lang_picinfo['download_URL']] = '<a href="' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $path_to_pic.'">'. $lang_picinfo['movie_player'] .'</a>';
3182        }
3183    }
3184
3185    $html = '';
3186    $html .= '        <tr><td colspan="2" class="tableh2">'.$lang_picinfo['title'].'</td></tr>' . $LINEBREAK;
3187    $template = '        <tr><td class="tableb tableb_alternate" valign="top" >%s:</td><td class="tableb tableb_alternate">%s</td></tr>' . $LINEBREAK;
3188    foreach ($info as $key => $value) {
3189        $html .= sprintf($template, $key, $value);
3190    }
3191
3192    return $html;
3193}
3194/******************************************************************************
3195** Section <<<theme_html_picinfo>>> - END
3196******************************************************************************/
3197}  //{THEMES}
3198
3199if (!function_exists('theme_html_picture')) {  //{THEMES}
3200/******************************************************************************
3201** Section <<<theme_html_picture>>> - START
3202******************************************************************************/
3203// Displays a picture
3204function theme_html_picture()
3205{
3206    global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER, $LINEBREAK;
3207    global $album, $lang_date, $template_display_media;
3208    global $lang_display_image_php, $lang_picinfo, $lang_common, $lang_errors;
3209
3210    $superCage = Inspekt::makeSuperCage();
3211
3212    $pid = $CURRENT_PIC_DATA['pid'];
3213    $pic_title = '';
3214
3215    if (!isset($USER['liv']) || !is_array($USER['liv'])) {
3216        $USER['liv'] = array();
3217    }
3218    // Add 1 to hit counter
3219    if ((!USER_IS_ADMIN && $CONFIG['count_admin_hits'] == 0 || $CONFIG['count_admin_hits'] == 1) && !in_array($pid, $USER['liv']) && $superCage->cookie->keyExists($CONFIG['cookie_name'] . '_data')) {
3220        add_hit($pid);
3221        if (count($USER['liv']) > 4) array_shift($USER['liv']);
3222        array_push($USER['liv'], $pid);
3223    }
3224
3225    if ($CURRENT_PIC_DATA['title'] != '') {
3226        $pic_title .= $CURRENT_PIC_DATA['title'] . $LINEBREAK;
3227    }
3228    if ($CURRENT_PIC_DATA['caption'] != '') {
3229        $pic_title .= $CURRENT_PIC_DATA['caption'] . $LINEBREAK;
3230    }
3231    if ($CURRENT_PIC_DATA['keywords'] != '') {
3232        $pic_title .= $lang_common['keywords'] . ": " . $CURRENT_PIC_DATA['keywords'];
3233    }
3234
3235    if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) {
3236        template_extract_block($template_display_media, 'img_desc');
3237    } else {
3238        if (!$CURRENT_PIC_DATA['title']) {
3239            template_extract_block($template_display_media, 'title');
3240        }
3241        if (!$CURRENT_PIC_DATA['caption']) {
3242            template_extract_block($template_display_media, 'caption');
3243        }
3244    }
3245
3246    $CURRENT_PIC_DATA['menu'] = html_picture_menu(); //((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : '';
3247
3248    $image_size = array();
3249
3250    if ($CONFIG['make_intermediate'] && cpg_picture_dimension_exceeds_intermediate_limit($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'])) {
3251        $picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
3252    } else {
3253        $picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
3254    }
3255
3256    if (!$pic_title) {
3257        $pic_title = $CURRENT_PIC_DATA['filename'];
3258    }
3259    $mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);
3260
3261    if ($mime_content['content']=='movie' || $mime_content['content']=='audio') {
3262
3263        if ($CURRENT_PIC_DATA['pwidth']==0 || $CURRENT_PIC_DATA['pheight']==0) {
3264            $resize_method = $CONFIG['picture_use'] == "thumb" ? ($CONFIG['thumb_use'] == "ex" ? "any" : $CONFIG['thumb_use']) : $CONFIG['picture_use'];
3265            if ($resize_method == 'ht') {
3266                $pwidth = $CONFIG['picture_width']*4/3;
3267                $pheight = $CONFIG['picture_width'];
3268            } else {
3269                $pwidth = $CONFIG['picture_width'];
3270                $pheight = $CONFIG['picture_width']*3/4;
3271            }
3272
3273            $CURRENT_PIC_DATA['pwidth']  = $pwidth; // Default width
3274
3275            // Set default height; if file is a movie
3276            if ($mime_content['content']=='movie') {
3277                $CURRENT_PIC_DATA['pheight'] = $pheight; // Default height
3278            }
3279        }
3280
3281        $ctrl_offset['mov']=15;
3282        $ctrl_offset['wmv']=45;
3283        $ctrl_offset['swf']=0;
3284        $ctrl_offset['rm']=0;
3285        $ctrl_offset_default=45;
3286        $ctrl_height = (isset($ctrl_offset[$mime_content['extension']]))?($ctrl_offset[$mime_content['extension']]):$ctrl_offset_default;
3287        $image_size['whole']='width="'.$CURRENT_PIC_DATA['pwidth'].'" height="'.($CURRENT_PIC_DATA['pheight']+$ctrl_height).'"';
3288    }
3289
3290    if ($mime_content['content']=='image') {
3291        list($image_size['width'], $image_size['height'], , $image_size['geom']) = cpg_getimagesize($picture_url);
3292
3293        if ($CURRENT_PIC_DATA['mode'] != 'fullsize') {
3294            $winsizeX = $CURRENT_PIC_DATA['pwidth'] + $CONFIG['fullsize_padding_x'];  //the +'s are the mysterious FF and IE paddings
3295            $winsizeY = $CURRENT_PIC_DATA['pheight'] + $CONFIG['fullsize_padding_y']; //the +'s are the mysterious FF and IE paddings
3296            if ($CONFIG['transparent_overlay'] == 1) {
3297                $pic_html = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td background=\"" . $picture_url . "\" width=\"{$image_size['width']}\" height=\"{$image_size['height']}\" class=\"image\">";
3298                $pic_html_href_close = '</a>' . $LINEBREAK;
3299                if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
3300                    if ($CONFIG['allow_user_registration'] == 0) {
3301                        $pic_html_href_close = '';
3302                    } else {
3303                        $pic_html .= '<a href="javascript:;" onclick="alert(\''.sprintf($lang_errors['login_needed'],'','','','').'\');">';
3304                    }
3305                } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) {
3306                    $pic_html .= '<a href="javascript:;" onclick="alert(\''.sprintf($lang_errors['access_intermediate_only'],'','','','').'\');">';
3307                } else {
3308                    $pic_html .= "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&amp;fullsize=1','" . uniqid(rand()) . "','scrollbars=no,toolbar=no,status=no,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
3309                }
3310                $pic_title_fs = $lang_display_image_php['view_fs'] . $LINEBREAK . '==============' . $LINEBREAK . $pic_title;
3311                $pic_html .= "<img src=\"images/image.gif?id=".floor(rand()*1000+rand())."\" width=\"{$image_size['width']}\" height=\"{$image_size['height']}\"  border=\"0\" alt=\"{$pic_title}\" title=\"{$pic_title_fs}\" /><br />";
3312                $pic_html .= $pic_html_href_close . '</td></tr></table>';
3313                //PLUGIN FILTER
3314                $pic_html = CPGPluginAPI::filter('html_image_reduced_overlay', $pic_html);
3315            } else {
3316                $pic_html_href_close = '</a>' . $LINEBREAK;
3317                if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
3318                    if ($CONFIG['allow_user_registration'] == 0) {
3319                        $pic_html = $pic_html_href_close = '';
3320                    } else {
3321                        $pic_html = '<a href="javascript:;" onclick="alert(\''.sprintf($lang_errors['login_needed'],'','','','').'\');">';
3322                    }
3323                } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) {
3324                    $pic_html = '<a href="javascript:;" onclick="alert(\''.sprintf($lang_errors['access_intermediate_only'],'','','','').'\');">';
3325                } else {
3326                    $pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&amp;fullsize=1','" . uniqid(rand()) . "','scrollbars=no,toolbar=no,status=no,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
3327                }
3328                $pic_title_fs = $lang_display_image_php['view_fs'] . $LINEBREAK . '==============' . $LINEBREAK . $pic_title;
3329                $pic_html .= "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"{$pic_title}\" title=\"{$pic_title_fs}\" /><br />";
3330                $pic_html .= $pic_html_href_close;
3331                //PLUGIN FILTER
3332                $pic_html = CPGPluginAPI::filter('html_image_reduced', $pic_html);
3333            }
3334        } else {
3335            if ($CONFIG['transparent_overlay'] == 1) {
3336                $pic_html = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td background=\"" . $picture_url . "\" width=\"{$CURRENT_PIC_DATA['pwidth']}\" height=\"{$CURRENT_PIC_DATA['pheight']}\" class=\"image\">";
3337                $pic_html .= "<img src=\"images/image.gif?id=".floor(rand()*1000+rand())."\" width={$CURRENT_PIC_DATA['pwidth']} height={$CURRENT_PIC_DATA['pheight']} border=\"0\" alt=\"{$pic_title}\" title=\"{$pic_title}\" /><br />" . $LINEBREAK;
3338                $pic_html .= "</td></tr></table>";
3339                //PLUGIN FILTER
3340                $pic_html = CPGPluginAPI::filter('html_image_overlay', $pic_html);
3341            } else {
3342                $pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"{$pic_title}\" title=\"{$pic_title}\" /><br />" . $LINEBREAK;
3343                //PLUGIN FILTER
3344                $pic_html = CPGPluginAPI::filter('html_image', $pic_html);
3345            }
3346        }
3347    } elseif ($mime_content['content']=='document') {
3348        $pic_thumb_url = get_pic_url($CURRENT_PIC_DATA,'thumb');
3349        $pic_html = "<a href=\"{$picture_url}\" target=\"_blank\" class=\"document_link\"><img src=\"".$pic_thumb_url."\" border=\"0\" class=\"image\" /></a><br />" . $LINEBREAK;
3350        //PLUGIN FILTER
3351        $pic_html = CPGPluginAPI::filter('html_document', $pic_html);
3352    } else {
3353        $autostart = ($CONFIG['media_autostart']) ? ('true'):('false');
3354        $autoplay = '" autostart="'.$autostart.'" autoplay="'.$autostart.'" ';
3355
3356        if ($mime_content['player'] == 'HTMLA') {
3357            $pic_html  = '<audio controls="true" src="' . $picture_url . $autoplay . '></audio>';
3358        } elseif ($mime_content['player'] == 'HTMLV') {
3359            $pic_html  = '<div class="video"><video controls="true" src="' . $picture_url . $autoplay . 'style="max-width:100%"></video></div>';
3360        } else {
3361
3362            $players['WMP'] = array('id' => 'MediaPlayer',
3363                                    //'clsid' => 'classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" ',
3364                                    'clsid' => '',
3365                                    'codebase' => 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ',
3366                                    'mime' => 'type="application/x-mplayer2" ',
3367                                   );
3368            $players['DIVX'] = array('id' => 'DivX',
3369                                    'clsid' => 'classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616"',
3370                                    'codebase' => 'codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab"',
3371                                    'mime' => 'type="video/divx"'
3372                                   );
3373            $players['RMP'] = array('id' => 'RealPlayer',
3374                                    'clsid' => 'classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" ',
3375                                    'codebase' => '',
3376                                    'mime' => 'type="audio/x-pn-realaudio-plugin" '
3377                                   );
3378            $players['QT']  = array('id' => 'QuickTime',
3379                                    'clsid' => 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ',
3380                                    'codebase' => 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ',
3381                                    'mime' => 'type="video/x-quicktime" '
3382                                   );
3383            $players['SWF'] = array('id' => 'SWFlash',
3384                                    //'clsid' => ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ',
3385                                    'clsid' => '',
3386                                    'codebase' => '',
3387                                    'mime' => 'type="application/x-shockwave-flash" ',
3388                                    'data' => 'data="'.$picture_url.'" '
3389                                   );
3390            $players['UNK'] = array('id' => 'DefaultPlayer',
3391                                    'clsid' => '',
3392                                    'codebase' => '',
3393                                    'mime' => ''
3394                                   );
3395
3396            $player = $players[$mime_content['player']];
3397
3398            if (!$player) {
3399                $player = 'UNK';
3400            }
3401
3402            $pic_html  = '<object id="'.$player['id'].'" '.$player['data'].$player['clsid'].$player['codebase'].$player['mime'].$image_size['whole'].'>';
3403            $pic_html .= "<param name=\"autostart\" value=\"$autostart\" /><param name=\"src\" value=\"". $picture_url . "\" />";
3404            $pic_html .= '</object><br />' . $LINEBREAK;
3405        }
3406
3407        //PLUGIN FILTER
3408        $pic_html = CPGPluginAPI::filter('html_other_media', $pic_html);
3409    }
3410
3411    $CURRENT_PIC_DATA['html'] = $pic_html;
3412    $CURRENT_PIC_DATA['header'] = '';
3413    $CURRENT_PIC_DATA['footer'] = '';
3414
3415    $CURRENT_PIC_DATA = CPGPluginAPI::filter('file_data',$CURRENT_PIC_DATA);
3416
3417    $params = array('{CELL_HEIGHT}' => '100',
3418        '{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
3419        '{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
3420        '{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']),
3421        '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
3422        );
3423
3424    return template_eval($template_display_media, $params);
3425}
3426/******************************************************************************
3427** Section <<<theme_html_picture>>> - END
3428******************************************************************************/
3429}  //{THEMES}
3430
3431if (!function_exists('theme_html_img_nav_menu')) {  //{THEMES}
3432/******************************************************************************
3433** Section <<<theme_html_img_nav_menu>>> - START
3434******************************************************************************/
3435function theme_html_img_nav_menu() {
3436    global $CONFIG, $CURRENT_PIC_DATA, $meta_nav, $THEME_DIR, $CPG_PHP_SELF, $LINEBREAK; //$PHP_SELF,
3437    global $album, $cat, $pos, $pic_count, $pic_data, $lang_img_nav_bar, $lang_text_dir, $template_img_navbar;
3438
3439    $superCage = Inspekt::makeSuperCage();
3440
3441    $template_img_navbar = CPGPluginAPI::filter('theme_img_navbar', $template_img_navbar);
3442
3443    $cat_link = is_numeric($album) ? '' : '&amp;cat=' . $cat;
3444    //$date_link = $_GET['date']=='' ? '' : '&date=' . cpgValidateDate($_GET['date']);
3445
3446    if ($superCage->get->keyExists('date')) {
3447      //date will be validated
3448      $date_link = '&date=' . cpgValidateDate($superCage->get->getRaw('date'));
3449    } else {
3450      $date_link = '';
3451    }
3452
3453    //$uid_link = is_numeric($_GET['uid']) ? '&amp;uid=' . $_GET['uid'] : '';
3454    if ($superCage->get->getInt('uid')) {
3455        $uid_link = '&amp;uid=' . $superCage->get->getInt('uid');
3456    } else {
3457        $uid_link = '';
3458    }
3459
3460    $human_pos = $pos + 1;
3461    $page = ceil(($pos + 1) / ($CONFIG['thumbrows'] * $CONFIG['thumbcols']));
3462    $pid = $CURRENT_PIC_DATA['pid'];
3463
3464    if ($pos > 0) {
3465        $start = 0;
3466        //$start_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pos=$start"; // Abbas - added pid in URL instead of pos
3467        $start_tgt = "$CPG_PHP_SELF?album=$album$cat_link$date_link&amp;pid={$pic_data[$start]['pid']}";
3468        $start_title = $lang_img_nav_bar['go_album_start'];
3469        $meta_nav .= "<link rel=\"start\" href=\"$start_tgt\" title=\"$start_title\" />" . $LINEBREAK;
3470        $start_image = (($lang_text_dir == 'ltr') ? 'start.png' : 'end.png');
3471
3472        $prev = $pos - 1;
3473        //$prev_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pos=$prev$uid_link";// Abbas - added pid in URL instead of pos
3474        if ($album == 'lastcom' || $album == 'lastcomby') {
3475            $page = cpg_get_comment_page_number($pic_data[$prev]['msg_id']);
3476            $page = (is_numeric($page)) ? "&amp;page=$page" : '';
3477            $prev_tgt = "$CPG_PHP_SELF?album=$album$cat_link$date_link&amp;pid={$pic_data[$prev]['pid']}$uid_link&amp;msg_id={$pic_data[$prev]['msg_id']}$page#comment{$pic_data[$prev]['msg_id']}";
3478            $start_tgt .= "$uid_link&amp;msg_id={$pic_data[$start]['msg_id']}$page#comment{$pic_data[$start]['msg_id']}";
3479        } else {
3480            $prev_tgt = "$CPG_PHP_SELF?album=$album$cat_link$date_link&amp;pid={$pic_data[$prev]['pid']}$uid_link#top_display_media";
3481            $start_tgt .= "$uid_link#top_display_media";
3482        }
3483        $prev_title = $lang_img_nav_bar['prev_title'];
3484        $meta_nav .= "<link rel=\"prev\" href=\"$prev_tgt\" title=\"$prev_title\" />" . $LINEBREAK;
3485        $prev_image = (($lang_text_dir == 'ltr') ? 'prev.png' : 'next.png');
3486    } else {
3487        // on first image, so no previous button/link
3488        $prev_tgt = "javascript:;";
3489        $prev_title = "";
3490        $prev_image = (($lang_text_dir == 'ltr') ? 'prev_inactive.png' : 'next_inactive.png');
3491        $start_tgt = "javascript:;";
3492        $start_title = "";
3493        $start_image = (($lang_text_dir == 'ltr') ? 'start_inactive.png' : 'end_inactive.png');
3494    }
3495
3496    if ($pos < ($pic_count -1)) {
3497        $end = $pic_count - 1;
3498        //$end_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pos=$end";// Abbas - added pid in URL instead of pos
3499        $end_tgt = "$CPG_PHP_SELF?album=$album$cat_link$date_link&amp;pid={$pic_data[$end]['pid']}";
3500        $end_title = $lang_img_nav_bar['go_album_end'];
3501        $meta_nav .= "<link rel=\"last\" href=\"$end_tgt\" title=\"$end_title\" />" . $LINEBREAK;
3502        $end_image = (($lang_text_dir == 'ltr') ? 'end.png' : 'start.png');
3503
3504        $next = $pos + 1;
3505        //$next_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pos=$next$uid_link";// Abbas - added pid in URL instead of pos
3506        if ($album == 'lastcom' || $album == 'lastcomby') {
3507            $page = cpg_get_comment_page_number($pic_data[$next]['msg_id']);
3508            $page = (is_numeric($page)) ? "&amp;page=$page" : '';
3509            $next_tgt = "$CPG_PHP_SELF?album=$album$cat_link$date_link&amp;pid={$pic_data[$next]['pid']}$uid_link&amp;msg_id={$pic_data[$next]['msg_id']}$page#comment{$pic_data[$next]['msg_id']}";
3510            $end_tgt .= "$uid_link&amp;msg_id={$pic_data[$end]['msg_id']}$page#comment{$pic_data[$end]['msg_id']}";
3511        } else {
3512            $next_tgt = "$CPG_PHP_SELF?album=$album$cat_link$date_link&amp;pid={$pic_data[$next]['pid']}$uid_link#top_display_media";
3513            $end_tgt .= "$uid_link#top_display_media";
3514        }
3515        $next_title = $lang_img_nav_bar['next_title'];
3516        $meta_nav .= "<link rel=\"next\" href=\"$next_tgt\" title=\"$next_title\"/>" . $LINEBREAK;
3517        $next_image = (($lang_text_dir == 'ltr') ? 'next.png' : 'prev.png');
3518    } else {
3519        // on last image, so no next button/link
3520        $next_tgt = "javascript:;";
3521        $next_title = "";
3522        $next_image = (($lang_text_dir == 'ltr') ? 'next_inactive.png' : 'prev_inactive.png');
3523        $end_tgt = "javascript:;";
3524        $end_title = "";
3525        $end_image = (($lang_text_dir == 'ltr') ? 'end_inactive.png' : 'start_inactive.png');
3526    }
3527
3528    if (USER_CAN_SEND_ECARDS) {
3529        $ecard_tgt = "ecard.php?album=$album$cat_link$date_link&amp;pid=$pid&amp;pos=$pos";
3530        $ecard_title = $lang_img_nav_bar['ecard_title'];
3531    } else {
3532        template_extract_block($template_img_navbar, 'ecard_button'); // added to remove button if cannot send ecard
3533        $ecard_tgt = $ecard_title = '';
3534        /*
3535        $ecard_tgt = "javascript:alert('" . addslashes($lang_img_nav_bar['ecard_disabled_msg']) . "');";
3536        $ecard_title = $lang_img_nav_bar['ecard_disabled'];
3537        */
3538    }
3539
3540    // report to moderator buttons
3541    $report_tgt = '';
3542    if (($CONFIG['report_post']==1) && (USER_CAN_SEND_ECARDS)) {
3543        $report_tgt = "report_file.php?album=$album$cat_link$date_link&amp;pid=$pid&amp;pos=$pos";
3544    } else {
3545        // remove button if report toggle is off
3546        template_extract_block($template_img_navbar, 'report_file_button');
3547    }
3548
3549    $thumb_tgt = "thumbnails.php?album=$album$cat_link$date_link&amp;page=$page$uid_link";
3550    $meta_nav .= "<link rel=\"up\" href=\"$thumb_tgt\" title=\"".$lang_img_nav_bar['thumb_title']."\"/>" . $LINEBREAK;
3551
3552    // needed when viewing slideshow of meta albums lastcom/lastcomby
3553    $msg_id = ($album == 'lastcom' || $album == 'lastcomby') ? "&amp;msg_id={$pic_data[$pos]['msg_id']}&amp;page=$page" : '';
3554
3555    $slideshow_tgt = "$CPG_PHP_SELF?album=$album$cat_link$date_link$uid_link&amp;pid=$pid$msg_id&amp;slideshow=".$CONFIG['slideshow_interval'].'#top_display_media';
3556
3557    // if set, this will override the default slideshow button to be inserted by displayimage.js
3558    $slideshow_btn = '';
3559    // if set, this will override the default pic_info button to be inserted by displayimage.js
3560    $pic_info_btn = '';
3561
3562    $pic_pos = sprintf($lang_img_nav_bar['pic_pos'], $human_pos, $pic_count);
3563
3564    if (defined('THEME_HAS_NAVBAR_GRAPHICS')) {
3565        $location = $THEME_DIR;
3566    } else {
3567        $location = '';
3568    }
3569    // add javascript vars
3570    $js_buttons = array(
3571        'pic_info_title'  => $lang_img_nav_bar['pic_info_title'],
3572        'pic_info_btn'    => $pic_info_btn,
3573        'slideshow_tgt'   => $slideshow_tgt,
3574        'slideshow_title' => $lang_img_nav_bar['slideshow_title'],
3575        'slideshow_btn'   => $slideshow_btn,
3576        'loc' => $location,
3577    );
3578    set_js_var('buttons', $js_buttons);
3579
3580    $params = array(
3581        '{THUMB_TGT}' => $thumb_tgt,
3582        '{THUMB_TITLE}' => $lang_img_nav_bar['thumb_title'],
3583        '{PIC_POS}' => $pic_pos,
3584        '{ECARD_TGT}' => $ecard_tgt,
3585        '{ECARD_TITLE}' => $ecard_title,
3586        '{START_TGT}' => $start_tgt,
3587        '{START_TITLE}' => $start_title,
3588        '{START_IMAGE}' => $start_image,
3589        '{PREV_TGT}' => $prev_tgt,
3590        '{PREV_TITLE}' => $prev_title,
3591        '{PREV_IMAGE}' => $prev_image,
3592        '{NEXT_TGT}' => $next_tgt,
3593        '{NEXT_TITLE}' => $next_title,
3594        '{NEXT_IMAGE}' => $next_image,
3595        '{END_TGT}' => $end_tgt,
3596        '{END_TITLE}' => $end_title,
3597        '{END_IMAGE}' => $end_image,
3598        '{REPORT_TGT}' => $report_tgt,
3599        '{REPORT_TITLE}' => $lang_img_nav_bar['report_title'],
3600        '{LOCATION}' => $location,
3601    );
3602
3603    return template_eval($template_img_navbar, $params);
3604}
3605/******************************************************************************
3606** Section <<<theme_html_img_nav_menu>>> - END
3607******************************************************************************/
3608}  //{THEMES}
3609
3610if (!function_exists('theme_html_rating_box')) {  //{THEMES}
3611/******************************************************************************
3612** Section <<<theme_html_rating_box>>> - START
3613******************************************************************************/
3614function theme_html_rating_box()
3615{
3616    global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $THEME_DIR, $USER_DATA, $USER, $LINEBREAK;
3617    global $template_image_rating, $template_image_rating_oldstyle, $lang_rate_pic, $raw_ip;
3618
3619    if (!(USER_CAN_RATE_PICTURES && $CURRENT_ALBUM_DATA['votes'] == 'YES')) {
3620        return '';
3621    } else {
3622        //check if the users already voted or if this user is the owner
3623        $user_md5_id = USER_ID ? md5(USER_ID) : $USER['ID'];
3624        $result_votes = cpg_db_query("SELECT null FROM {$CONFIG['TABLE_VOTES']} WHERE pic_id= {$CURRENT_PIC_DATA['pid']} AND user_md5_id='$user_md5_id'");
3625        $result_vote_stats = cpg_db_query("SELECT null FROM {$CONFIG['TABLE_VOTE_STATS']} WHERE pid = {$CURRENT_PIC_DATA['pid']} AND ip = '$raw_ip'");
3626
3627        $user_can_vote = 'false';
3628        if ($CURRENT_PIC_DATA['owner_id'] == $USER_DATA['user_id'] && $USER_DATA['user_id'] != 0 && ($CONFIG['rate_own_files'] == 0 || $CONFIG['rate_own_files'] == 2 && !USER_IS_ADMIN)) {
3629            // user is owner
3630            $rate_title = $lang_rate_pic['forbidden'];
3631        } elseif (!$result_votes->numRows() && !$result_vote_stats->numRows()) {
3632            // user hasn't voted yet, show voting things
3633            $rate_title = $lang_rate_pic['rate_this_pic'];
3634            $user_can_vote = 'true';
3635        } else {
3636            //user has voted
3637            $rate_title = $lang_rate_pic['already_voted'];
3638        }
3639        $result_votes->free();
3640        $result_vote_stats->free();
3641
3642        $rating_stars_amount = ($CONFIG['old_style_rating']) ? 5 : $CONFIG['rating_stars_amount'];
3643        $votes = $CURRENT_PIC_DATA['votes'] ? sprintf($lang_rate_pic['rating'], round(($CURRENT_PIC_DATA['pic_rating'] / 2000) / (5/$rating_stars_amount), 1), $rating_stars_amount, $CURRENT_PIC_DATA['votes']) : $lang_rate_pic['no_votes'];
3644        $pid = $CURRENT_PIC_DATA['pid'];
3645
3646        if (defined('THEME_HAS_RATING_GRAPHICS')) {
3647            $location= $THEME_DIR;
3648        } else {
3649            $location= '';
3650        }
3651
3652        $superCage = Inspekt::makeSuperCage();
3653
3654        $params = array(
3655            '{TITLE}'      => $rate_title,
3656            '{VOTES}'      => $votes,
3657            '{LOCATION}'   => $location,
3658            '{WIDTH}'      => $CONFIG['picture_table_width'] == "100%" ? $CONFIG['main_table_width'] : $CONFIG['picture_table_width'],
3659        );
3660
3661        if ($CONFIG['old_style_rating']) {
3662            // use old-style rating
3663            $start_td = '<td class="tableb" width="17%" align="center">';
3664            $end_td = '</td>';
3665            $empty_star = '<img style="cursor:pointer" id="' . $pid . '_0" title="0" src="' . $location . 'images/rate_empty.png" alt="' . $lang_rate_pic['rubbish'] . '" onclick="rate(this)" />';
3666            $rating_images = $start_td . $empty_star . $empty_star . $empty_star . $empty_star . $empty_star . $end_td . $LINEBREAK;
3667
3668            $empty_star = '<img style="cursor:pointer" id="' . $pid . '_1" title="1" src="' . $location . 'images/rate_empty.png" alt="' . $lang_rate_pic['poor'] . '" onclick="rate(this)" />';
3669            $full_star = '<img style="cursor:pointer" id="' . $pid . '_1" title="1" src="' . $location . 'images/rate_full.png" alt="' . $lang_rate_pic['poor'] . '" onclick="rate(this)" />';
3670            $rating_images .= $start_td . $full_star . $empty_star . $empty_star . $empty_star . $empty_star . $end_td . $LINEBREAK;
3671
3672            $empty_star = '<img style="cursor:pointer" id="' . $pid . '_2" title="2" src="' . $location . 'images/rate_empty.png" alt="' . $lang_rate_pic['fair'] . '" onclick="rate(this)" />';
3673            $full_star = '<img style="cursor:pointer" id="' . $pid . '_2" title="2" src="' . $location . 'images/rate_full.png" alt="' . $lang_rate_pic['fair'] . '" onclick="rate(this)" />';
3674            $rating_images .= $start_td . $full_star . $full_star . $empty_star . $empty_star . $empty_star . $end_td . $LINEBREAK;
3675
3676            $empty_star = '<img style="cursor:pointer" id="' . $pid . '_3" title="3" src="' . $location . 'images/rate_empty.png" alt="' . $lang_rate_pic['good'] . '" onclick="rate(this)" />';
3677            $full_star = '<img style="cursor:pointer" id="' . $pid . '_3" title="3" src="' . $location . 'images/rate_full.png" alt="' . $lang_rate_pic['good'] . '" onclick="rate(this)" />';
3678            $rating_images .= $start_td . $full_star . $full_star . $full_star . $empty_star . $empty_star . $end_td . $LINEBREAK;
3679
3680            $empty_star = '<img style="cursor:pointer" id="' . $pid . '_4" title="4" src="' . $location . 'images/rate_empty.png" alt="' . $lang_rate_pic['excellent'] . '" onclick="rate(this)" />';
3681            $full_star = '<img style="cursor:pointer" id="' . $pid . '_4" title="4" src="' . $location . 'images/rate_full.png" alt="' . $lang_rate_pic['excellent'] . '" onclick="rate(this)" />';
3682            $rating_images .= $start_td . $full_star . $full_star . $full_star . $full_star . $empty_star . $end_td . $LINEBREAK;
3683
3684            $full_star = '<img style="cursor:pointer" id="' . $pid . '_5" title="5" src="' . $location . 'images/rate_full.png" alt="' . $lang_rate_pic['great'] . '" onclick="rate(this)" />';
3685            $rating_images .= $start_td . $full_star . $full_star . $full_star . $full_star . $full_star . $end_td . $LINEBREAK;
3686
3687            set_js_var('stars_amount', 'fallback');
3688            set_js_var('lang_rate_pic', $rate_title);
3689            $params['{RATING_IMAGES}'] = $rating_images;
3690            $template_rating = $template_image_rating_oldstyle;
3691
3692        } else {
3693            //use new rating
3694            set_js_var('stars_amount', $rating_stars_amount);
3695            set_js_var('lang_rate_pic', $lang_rate_pic['rollover_to_rate']);
3696            $params['{JS_WARNING}'] = $lang_rate_pic['js_warning'];
3697            $template_rating = $template_image_rating;
3698        }
3699        set_js_var('rating', round(($CURRENT_PIC_DATA['pic_rating'] / 2000) / (5/$rating_stars_amount), 0));
3700        set_js_var('theme_dir', $location);
3701        set_js_var('can_vote', $user_can_vote);
3702        list($timestamp, $form_token) = getFormToken();
3703        set_js_var('form_token', $form_token);
3704        set_js_var('timestamp', $timestamp);
3705
3706        return template_eval($template_rating, $params);
3707    }
3708}
3709/******************************************************************************
3710** Section <<<theme_html_rating_box>>> - END
3711******************************************************************************/
3712}  //{THEMES}
3713
3714if (!function_exists('theme_html_comments')) {  //{THEMES}
3715/******************************************************************************
3716** Section <<<theme_html_comments>>> - START
3717******************************************************************************/
3718// Displays comments for a specific picture
3719function theme_html_comments($pid)
3720{
3721    global $CONFIG, $USER, $CURRENT_ALBUM_DATA, $lang_date, $HTML_SUBST, $THEME_DIR;
3722    global $template_image_comments, $template_add_your_comment, $lang_display_comments, $lang_common, $REFERER, $lang_bbcode_help_title, $lang_bbcode_help;
3723
3724    $superCage = Inspekt::makeSuperCage();
3725    $template_add_your_comment = CPGPluginAPI::filter('theme_add_comment', $template_add_your_comment);
3726    $template_image_comments = CPGPluginAPI::filter('theme_edit_comment', $template_image_comments);
3727
3728    list($timestamp, $form_token) = getFormToken();
3729
3730    $html = '';
3731
3732    //report to moderator buttons
3733    if (!(($CONFIG['report_post']==1) && (USER_CAN_SEND_ECARDS))) {
3734        template_extract_block($template_image_comments, 'report_comment_button');
3735    }
3736
3737    if (!$CONFIG['enable_smilies']) {
3738        $tmpl_comment_edit_box = template_extract_block($template_image_comments, 'edit_box_no_smilies', '{EDIT}');
3739        template_extract_block($template_image_comments, 'edit_box_smilies');
3740        template_extract_block($template_add_your_comment, 'input_box_smilies');
3741    } else {
3742        $tmpl_comment_edit_box = template_extract_block($template_image_comments, 'edit_box_smilies', '{EDIT}');
3743        template_extract_block($template_image_comments, 'edit_box_no_smilies');
3744        template_extract_block($template_add_your_comment, 'input_box_no_smilies');
3745    }
3746
3747
3748    $tmpl_comments_buttons = template_extract_block($template_image_comments, 'buttons', '{BUTTONS}');
3749    $tmpl_comments_ipinfo = template_extract_block($template_image_comments, 'ipinfo', '{IPINFO}');
3750
3751    if ($CONFIG['comments_sort_descending'] == 1) {
3752        $comment_sort_order = 'DESC';
3753    } else {
3754        $comment_sort_order = 'ASC';
3755    }
3756
3757    $result = cpg_db_query("SELECT COUNT(msg_id) FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='$pid'");
3758    list($num) = $result->fetchRow(true);
3759
3760    if ($num) {
3761
3762        $limit = $CONFIG['comments_per_page'];
3763        $max = ceil($num/$limit);
3764
3765        if ($superCage->get->keyExists('page')) {
3766            $page = $superCage->get->getInt('page');
3767            $page = min($page, $max);
3768            $page = max(0, $page);
3769        } else if ($CONFIG['comments_sort_descending'] == 1) {
3770            $page = 1;
3771        } else {
3772            $page = $max;
3773        }
3774
3775        $start = max(0, $num - (($max-($page-1))*$limit));
3776
3777        $location = defined('THEME_HAS_COMMENT_GRAPHICS') ? $THEME_DIR: '';
3778
3779        ob_start();
3780        echo '<br />';
3781        starttable();
3782
3783        echo '<tr><td class="tableh2"><div style="float: left">'.$lang_display_comments['comment'].' '.sprintf($lang_display_comments['comment_x_to_y_of_z'], ($start+1), min($num, $start+$limit), $num).'</div>';
3784        echo '<div style="float: right">'.$lang_display_comments['page'].': ';
3785        $links = array();
3786
3787        for ($i = 1; $i <= $max; $i++){
3788            if ($i < 5 || ($i > $max - 5) || (($i > $page -5) && ($i < $page + 5))){
3789                $links[$i]= '<a href="displayimage.php?pid=' . $pid . '&amp;page='.$i.'#comments_top">'.$i.'</a>';
3790            }
3791        }
3792
3793        $links[$page] = "<b>$page</b>";
3794        echo implode(' - ', $links);
3795        echo '</div></td></tr>';
3796
3797        endtable();
3798        echo '<br />';
3799        $html .= ($tabs = ob_get_clean());
3800
3801        $result = cpg_db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip, pid, approval FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='$pid' ORDER BY msg_id $comment_sort_order LIMIT $start, $limit");
3802
3803        while ($row = $result->fetchAssoc()) { // while-loop start
3804            $user_can_edit = (GALLERY_ADMIN_MODE) || (USER_ID && USER_ID == $row['author_id'] && USER_CAN_POST_COMMENTS) || (!USER_ID && USER_CAN_POST_COMMENTS && ($USER['ID'] == $row['author_md5_id']));
3805            if (($user_can_edit != '' && $CONFIG['comment_user_edit'] != 0) || (GALLERY_ADMIN_MODE)) {
3806                $comment_buttons = $tmpl_comments_buttons;
3807                $comment_edit_box = $tmpl_comment_edit_box;
3808            } else {
3809                $comment_buttons = '';
3810                $comment_edit_box = '';
3811            }
3812            $comment_ipinfo = ($row['msg_raw_ip'] && GALLERY_ADMIN_MODE)?$tmpl_comments_ipinfo : '';
3813            $hide_comment = 0;
3814
3815            // comment approval
3816            $pending_approval = '';
3817            if (USER_IS_ADMIN) {
3818                //display the selector approve/disapprove
3819                if ($row['approval'] == 'NO') {
3820                    $pending_approval = '<img src="' . $location . 'images/icons/comment_disapprove_disabled.png" border="0" alt="" width="16" height="16" class="icon" /><a href="reviewcom.php?pos=-{PID}&amp;msg_id={MSG_ID}&amp;form_token={FORM_TOKEN}&amp;timestamp={TIMESTAMP}&amp;what=approve" title="' . $lang_display_comments['approve'] . '"><img src="' . $location . 'images/icons/comment_approve.png" border="0" alt="" width="16" height="16" class="icon" /></a>';
3821                } else {
3822                    $pending_approval = '<a href="reviewcom.php?pos=-{PID}&amp;msg_id={MSG_ID}&amp;form_token={FORM_TOKEN}&amp;timestamp={TIMESTAMP}&amp;what=disapprove" title="' . $lang_display_comments['disapprove'] . '"><img src="' . $location . 'images/icons/comment_disapprove.png" border="0" alt="" width="16" height="16" class="icon" /></a><img src="' . $location . 'images/icons/comment_approve_disabled.png" border="0" alt="" width="16" height="16" class="icon" />';
3823                }
3824            } else { // user or guest is logged in - start
3825                if ($row['approval'] == 'NO') { // the comment is not approved - start
3826                    if ($user_can_edit) { // the comment comes from the current visitor, display it with a warning that it needs admin approval
3827                        $pending_approval = '<img src="' . $location . 'images/icons/comment_approval.png" border="0" alt="" width="16" height="16" title="' . $lang_display_comments['pending_approval'] . '" class="icon" />';
3828                    } else { // the comment comes from someone else - don't display it at all
3829                        if ($CONFIG['comment_placeholder'] == 0) {
3830                            $hide_comment = 1;
3831                        } else {
3832                            $row['msg_author'] = $lang_display_comments['unapproved_comment'];
3833                            $row['msg_body'] = $lang_display_comments['pending_approval_message'];
3834                            $row['author_id'] = 0;
3835                        }
3836                    }
3837                } // the comment is not approved - end
3838            } // user or guest is logged in - end
3839
3840            if ($CONFIG['enable_smilies']) {
3841                $comment_body = process_smilies(make_clickable($row['msg_body']));
3842                $smilies = generate_smilies("f{$row['msg_id']}", 'msg_body');
3843            } else {
3844                $comment_body = make_clickable($row['msg_body']);
3845                $smilies = '';
3846            }
3847
3848            // wrap the comment into italics if it isn't approved
3849            if ($row['approval'] == 'NO') {
3850                $comment_body = '<em>'.$comment_body.'</em>';
3851                $row['msg_author'] = $row['msg_author'];
3852            }
3853
3854            list($row['ip_detail']) = CPGPluginAPI::filter('ip_information', array('', $row['msg_hdr_ip']));
3855            $ip = $row['msg_hdr_ip']. $row['ip_detail'];
3856            if ($row['msg_hdr_ip'] != $row['msg_raw_ip']) {
3857                list($row['ip_detail']) = CPGPluginAPI::filter('ip_information', array('', $row['msg_raw_ip']));
3858                $ip .= ' [' . $row['msg_raw_ip'] . $row['ip_detail'] . ']';
3859            }
3860
3861            list($timestamp, $form_token) = getFormToken();
3862            $params = array('{EDIT}' => &$comment_edit_box,
3863                '{BUTTONS}' => &$comment_buttons,
3864                '{IPINFO}' => &$comment_ipinfo,
3865                '{PENDING_APPROVAL}' => &$pending_approval,
3866                '{FORM_TOKEN}' => $form_token,
3867                '{TIMESTAMP}' => $timestamp,
3868                );
3869
3870            $template = template_eval($template_image_comments, $params);
3871
3872            if ($row['author_id'] == 0) {
3873                $profile_lnk = stripslashes($row['msg_author']);
3874            } else {
3875                $profile_lnk = '<a href="profile.php?uid='.$row['author_id'].'">'.stripslashes($row['msg_author']).'</a>';
3876            }
3877
3878            $params = array('{MSG_AUTHOR_LNK}' => $profile_lnk,
3879                '{MSG_AUTHOR}' => $row['msg_author'],
3880                '{MSG_ID}' => $row['msg_id'],
3881                '{PID}' => $row['pid'],
3882                '{EDIT_TITLE}' => &$lang_display_comments['edit_title'],
3883                '{DELETE_TITLE}' => &$lang_display_comments['delete_title'],
3884                '{DELETE_ICON}' => '<img src="' . $location . 'images/icons/delete.png" border="0" alt="" width="16" height="16" class="icon" />',
3885                '{EDIT_ICON}' => '<img src="' . $location . 'images/icons/edit.png" border="0" alt="" width="16" height="16" class="icon" />',
3886                '{CONFIRM_DELETE}' => &$lang_display_comments['confirm_delete'],
3887                '{MSG_DATE}' => localised_date($row['msg_date'], $lang_date['comment']),
3888                '{MSG_BODY}' => bb_decode($comment_body),
3889                '{MSG_BODY_RAW}' => $row['msg_body'],
3890                '{OK}' => &$lang_common['ok'],
3891                '{SMILIES}' => $smilies,
3892                '{IP}' => $ip,
3893                '{REPORT_COMMENT_TITLE}' => &$lang_display_comments['report_comment_title'],
3894                '{REPORT_COMMENT_ICON}' => '<img src="' . $location . 'images/icons/report.png" border="0" alt="" width="16" height="16" class="icon" />',
3895                '{WIDTH}' => $CONFIG['picture_table_width'] == "100%" ? $CONFIG['main_table_width'] : $CONFIG['picture_table_width'],
3896                '{FORM_TOKEN}' => $form_token,
3897                '{TIMESTAMP}' => $timestamp,
3898                );
3899
3900            if ($hide_comment != 1) {
3901                $html .= template_eval($template, $params);
3902            }
3903        } // while-loop end
3904        $result->free();
3905
3906        $html .= $tabs;
3907    }
3908    if (USER_CAN_POST_COMMENTS && $CURRENT_ALBUM_DATA['comments'] == 'YES') {
3909        if (USER_ID) {
3910            $user_name_input = '<tr><td colspan="2"><input type="hidden" name="msg_author" value="' . stripslashes(USER_NAME) . '" /></td>';
3911            template_extract_block($template_add_your_comment, 'user_name_input', $user_name_input);
3912            $user_name = '';
3913        } else {
3914            if (isset($USER['name'])) {
3915              $user_name = strtr($USER['name'], $HTML_SUBST);
3916            } else {
3917              $user_name = $lang_display_comments['your_name'];
3918            }
3919        }
3920
3921        if (($CONFIG['comment_captcha'] == 0) || ($CONFIG['comment_captcha'] == 2 && USER_ID)) {
3922            template_extract_block($template_add_your_comment, 'comment_captcha');
3923        } else {
3924            $template_add_your_comment = CPGPluginAPI::filter('captcha_comment_print', $template_add_your_comment);
3925        }
3926
3927        if ($CONFIG['show_bbcode_help']) {
3928            $captionLabel = '&nbsp;'. cpg_display_help('f=empty.htm&amp;h=lang_bbcode_help_title&amp;t=lang_bbcode_help',470,245);
3929        }
3930
3931        list($timestamp, $form_token) = getFormToken();
3932        $params = array('{ADD_YOUR_COMMENT}' => $lang_display_comments['add_your_comment'],
3933            // Modified Name and comment field
3934            '{NAME}' => $lang_display_comments['name'],
3935            '{COMMENT}' => $lang_display_comments['comment'],
3936            '{CONFIRM}' => $lang_common['confirm'].'&nbsp;'. cpg_display_help('f=empty.htm&amp;h=lang_common[captcha_help_title]&amp;t=lang_common[captcha_help]',470,245),
3937            '{PIC_ID}' => $pid,
3938            '{USER_NAME}' => $user_name,
3939            '{MAX_COM_LENGTH}' => $CONFIG['max_com_size'],
3940            '{OK}' => $lang_common['ok'],
3941            '{OK_ICON}' => cpg_fetch_icon('ok', 1),
3942            '{DEFAULT_USERNAME}' => $lang_display_comments['your_name'],
3943            '{DEFAULT_USERNAME_MESSAGE}' => $lang_display_comments['default_username_message'],
3944            '{SMILIES}' => '',
3945            '{WIDTH}' => $CONFIG['picture_table_width'] == "100%" ? $CONFIG['main_table_width'] : $CONFIG['picture_table_width'],
3946            '{HELP_ICON}' => $captionLabel,
3947            '{FORM_TOKEN}' => $form_token,
3948            '{TIMESTAMP}' => $timestamp,
3949            );
3950
3951        if ($CONFIG['enable_smilies']) {
3952            $params['{SMILIES}'] = generate_smilies();
3953        } else {
3954            template_extract_block($template_add_your_comment, 'smilies');
3955        }
3956
3957        template_extract_block($template_add_your_comment, 'login_to_comment');
3958        if ($CONFIG['comments_sort_descending'] == 1) {
3959            $html = '<br />'.template_eval($template_add_your_comment, $params).$html;
3960        } else {
3961            $html .= template_eval($template_add_your_comment, $params);
3962        }
3963    } else { // user can not post comments
3964        if ($CONFIG['comment_promote_registration'] == 1 && $CURRENT_ALBUM_DATA['comments'] == 'YES') {
3965            template_extract_block($template_add_your_comment, 'user_name_input');
3966            if ($CONFIG['enable_smilies'] == 1) {
3967                template_extract_block($template_add_your_comment, 'input_box_smilies');
3968            } else {
3969                template_extract_block($template_add_your_comment, 'input_box_no_smilies');
3970            }
3971            template_extract_block($template_add_your_comment, 'comment_captcha');
3972            template_extract_block($template_add_your_comment, 'smilies');
3973            template_extract_block($template_add_your_comment, 'submit');
3974            $params = array('{ADD_YOUR_COMMENT}' => $lang_display_comments['add_your_comment'],
3975                '{WIDTH}' => $CONFIG['picture_table_width'] == "100%" ? $CONFIG['main_table_width'] : $CONFIG['picture_table_width'],
3976                '{LOGIN_TO_COMMENT}' => sprintf($lang_display_comments['log_in_to_comment'], '<a href="login.php?referer='.$REFERER.'">', '</a>'),
3977                '{HELP_ICON}' => '',
3978                );
3979            if ($CONFIG['comments_sort_descending'] == 1) {
3980                $html = '<br />'.template_eval($template_add_your_comment, $params).$html;
3981            } else {
3982                $html .= template_eval($template_add_your_comment, $params);
3983            }
3984        }
3985    }
3986
3987    return $html;
3988}
3989/******************************************************************************
3990** Section <<<theme_html_comments>>> - END
3991******************************************************************************/
3992}  //{THEMES}
3993
3994if (!function_exists('theme_slideshow')) {  //{THEMES}
3995/******************************************************************************
3996** Section <<<theme_slideshow>>> - START
3997******************************************************************************/
3998function theme_slideshow($start_img,$title)
3999{
4000    global $CONFIG, $lang_display_image_php, $template_display_media, $lang_common, $album, $pid, $slideshow;
4001    global $cat, $date, $THEME_DIR;
4002
4003    pageheader($lang_display_image_php['slideshow']);
4004    template_extract_block($template_display_media, 'img_desc');
4005
4006    /** set styles to slideshow background */
4007    $setDimentionW= $CONFIG['picture_width'] + 100;
4008    $setDimentionH= $CONFIG['picture_width'] + 10;
4009
4010    if (defined('THEME_HAS_PROGRESS_GRAPHICS')) {
4011        $prefix = $THEME_DIR;
4012    } else {
4013        $prefix = '';
4014    }
4015
4016    $params = array(
4017        '{SLIDESHOW_STYLE}' => 'width:' .$setDimentionW. 'px; height: '.$setDimentionH.'px; position: relative;' ,
4018        '{IMAGE}' => '<img id="showImage" src="' . $start_img . '" class="image" alt="" border="" /><br />',
4019        '{ADMIN_MENU}' => '',
4020        '{LOADER_ICON_PATH}' => $prefix . 'images/loader.gif',
4021    );
4022
4023    echo '<a name="top_display_media"></a>';
4024    starttable();
4025    echo <<<EOT
4026        <tr class="noscript">
4027            <td align="center" class="tableh2">
4028              <noscript>
4029                  {$lang_common['javascript_needed']}
4030              </noscript>
4031            </td>
4032        </tr>
4033        <tr>
4034            <td align="center" class="navmenu" style="white-space: nowrap;">
4035                <div id="title">{$title}</div>
4036            </td>
4037        </tr>
4038EOT;
4039    endtable();
4040
4041    starttable();
4042    echo template_eval($template_display_media, $params);
4043    endtable();
4044
4045    starttable();
4046    echo <<<EOT
4047        <tr>
4048                <td align="center" id="back-to" class="navmenu" >
4049                        <a class="navmenu" style="cursor:pointer">{$lang_display_image_php['stop_slideshow']}</a>
4050                </td>
4051        </tr>
4052
4053EOT;
4054    endtable();
4055    pagefooter();
4056}
4057/******************************************************************************
4058** Section <<<theme_slideshow>>> - END
4059******************************************************************************/
4060}  //{THEMES}
4061
4062if (!function_exists('theme_display_fullsize_pic')) {  //{THEMES}
4063/******************************************************************************
4064** Section <<<theme_display_fullsize_pic>>> - START
4065******************************************************************************/
4066// Display the full size image
4067function theme_display_fullsize_pic()
4068{
4069    global $CONFIG, $THEME_DIR, $FORBIDDEN_SET, $LINEBREAK, $pid;
4070    global $lang_errors, $lang_fullsize_popup, $lang_charset;
4071
4072    $superCage = Inspekt::makeSuperCage();
4073
4074    if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
4075        printf($lang_errors['login_needed'],'','','','');
4076        die();
4077    } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) {
4078        printf($lang_errors['access_intermediate_only'],'','','','');
4079        die();
4080    }
4081    if ($superCage->get->keyExists('picfile')) {
4082        if (!GALLERY_ADMIN_MODE) {
4083            cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
4084        }
4085        //$picfile = $_GET['picfile'];
4086        //$picfile = $superCage->get->getPath('picfile'); // doesn't work with HTML entities
4087        $matches = $superCage->get->getMatched('picfile', '/^[0-9A-Za-z~ \/_.-]+$/');
4088        $picfile = $matches[0];
4089        $picname = $CONFIG['fullpath'] . $picfile;
4090        $imagesize = @getimagesize($picname);
4091        $imagedata = array('name' => $picfile, 'path' => path2url($picname), 'geometry' => $imagesize[3]);
4092    } elseif ($pid) {
4093        $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight FROM {$CONFIG['TABLE_PICTURES']} AS p " . "WHERE pid='$pid' $FORBIDDEN_SET";
4094        $result = cpg_db_query($sql);
4095        if (!$result->numRows()) {
4096            cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
4097        }
4098        $row = $result->fetchAssoc(true);
4099        if (is_image($row['filename'])) {
4100            $pic_url = get_pic_url($row, 'fullsize');
4101            $geom = 'width="' . $row['pwidth'] . '" height="' . $row['pheight'] . '"';
4102            $imagedata = array('name' => $row['filename'], 'path' => $pic_url, 'geometry' => $geom);
4103        } else {
4104            $pic_html = theme_html_picture();
4105            if (is_movie($row['filename'])) {
4106                $mime_content = cpg_get_type($row['filename']);
4107                $ctrl_offset['mov']=15;
4108                $ctrl_offset['wmv']=45;
4109                $ctrl_offset['swf']=0;
4110                $ctrl_offset['rm']=0;
4111                $ctrl_offset_default=45;
4112                $ctrl_height = (isset($ctrl_offset[$mime_content['extension']]))?($ctrl_offset[$mime_content['extension']]):$ctrl_offset_default;
4113                preg_match('/width="([0-9]+)".*height="([0-9]+)"/', $pic_html, $matches);
4114                $width = $matches[1] + $CONFIG['fullsize_padding_x'];
4115                $height = $matches[2] + $CONFIG['fullsize_padding_y']+ $ctrl_height;
4116                $resize_window = '<script type="text/javascript">window.resizeTo('.$width.', '.$height.')</script>';
4117            }
4118            preg_match('/<td align="center" style="{SLIDESHOW_STYLE}">.*(.*)<\/td>/Us', $pic_html, $matches);
4119            $pic_html = $matches[1].$resize_window;
4120        }
4121    }
4122    if ((!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) || (USER_ID && USER_ACCESS_LEVEL <= 2)) {
4123        // adjust the size of the window if we don't have to catter for a full-size pop-up, but only a text message
4124        $row['pwidth'] = 200;
4125        $row['pheight'] = 100;
4126    }
4127
4128    $charset = ($CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset']);
4129    $jquery_path = CPG_JQUERY_VERSION;
4130    $fullsize_html = <<<EOT
4131<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4132<html>
4133    <head>
4134        <meta http-equiv="content-type" content="text/html; charset=$charset" />
4135        <title>{$CONFIG['gallery_name']}: {$lang_fullsize_popup['click_to_close']}</title>
4136        <style type="text/css">
4137            body { margin: 0; padding: 0; background-color: gray; }
4138            img { margin:0; padding:0; border:0; }
4139            #content { margin:0 auto; padding:0; border:0; }
4140            table { border:0; width:{$row['pwidth']}px; height:{$row['pheight']}px; border-collapse:collapse}
4141            td { vertical-align: middle; text-align:center; }
4142        </style>
4143
4144        <script type="text/javascript" src="{$jquery_path}"></script>
4145        <script type="text/javascript" src="js/jquery.dimensions.pack.js"></script>
4146        <script type="text/javascript" src="js/displayimage.fullsize.js"></script>
4147    </head>
4148    <body style="margin:0px; padding:0px; background-color: gray;">
4149
4150EOT;
4151    if (!empty($pic_html)) {
4152        $fullsize_html .= $pic_html;
4153    } else {
4154        if ($CONFIG['transparent_overlay'] == 1) {
4155            $fullsize_html .= <<<EOT
4156            <table cellpadding="0" cellspacing="0" align="center" style="padding:0px;">
4157                <tr>
4158
4159EOT;
4160            $fullsize_html .=  '<td align="center" valign="middle" background="' . htmlspecialchars($imagedata['path']) . '" ' . $imagedata['geometry'] . ' class="image">';
4161            $fullsize_html .=  '<div id="content">';
4162            $fullsize_html .=  '<a href="javascript: window.close()" style="border:none"><img src="images/image.gif?id='
4163                    . floor(rand()*1000+rand())
4164                    . '&amp;fullsize=yes" '
4165                    . $imagedata['geometry']
4166                    . ' alt="'
4167                    . htmlspecialchars($imagedata['name'])
4168                    . '" title="'
4169                    . htmlspecialchars($imagedata['name'])
4170                    . $LINEBREAK . $lang_fullsize_popup['click_to_close']
4171                    . '" /></a><br />' . $LINEBREAK;
4172            $fullsize_html .=  <<<EOT
4173                        </div>
4174                    </td>
4175                </tr>
4176            </table>
4177
4178EOT;
4179        } else {
4180            $fullsize_html .=  '        <div id="content">'.$LINEBREAK;
4181            $fullsize_html .=  '<a href="javascript: window.close()"><img src="'
4182            . htmlspecialchars($imagedata['path']) . '" '
4183            . $imagedata['geometry']
4184            . ' id="fullsize_image" alt="'
4185            . htmlspecialchars($imagedata['name'])
4186            . '" title="'
4187            . htmlspecialchars($imagedata['name'])
4188            . $LINEBREAK . $lang_fullsize_popup['click_to_close']
4189            . '" /></a><br />' . $LINEBREAK
4190            . '        </div>'.$LINEBREAK;
4191        }
4192    }
4193    $fullsize_html .= <<<EOT
4194  </body>
4195</html>
4196
4197EOT;
4198
4199    $fullsize_html = CPGPluginAPI::filter('fullsize_html', $fullsize_html);
4200    echo $fullsize_html;
4201}
4202/******************************************************************************
4203** Section <<<theme_display_fullsize_pic>>> - END
4204******************************************************************************/
4205}  //{THEMES}
4206
4207if (!function_exists('theme_vanity')) {  //{THEMES}
4208/******************************************************************************
4209** Section <<<theme_vanity>>> - START
4210******************************************************************************/
4211function theme_vanity()
4212{
4213    global $template_vanity ;
4214
4215    return template_eval($template_vanity, array());
4216}
4217/******************************************************************************
4218** Section <<<theme_vanity>>> - END
4219******************************************************************************/
4220} //{THEMES}
4221
4222if (!function_exists('theme_display_bar')) {  //{THEMES}
4223/******************************************************************************
4224** Section <<<theme_display_bar>>> - START
4225******************************************************************************/
4226/**
4227* theme_display_bar()
4228*
4229* Display a bar graph.
4230* For a list of possible valid color names, look up the function definition of
4231* cpgValidateColor in include/functions.inc.php
4232*
4233* @param float $actualValue
4234* @param float $maxValue
4235* @param string $textColor // color code or hex value
4236* @param string $textShadowColor // color code or hex value
4237* @param string $textUnit // text to show up after value (e.g. % or kB)
4238* @param string $leftBar // color code or hex value or path to background image
4239* @param string $rightBar // color code or hex value or path to background image
4240* @return string $return
4241**/
4242function theme_display_bar(
4243                       $actualValue = 0,
4244                       $maxValue = '100',
4245                       $maxBarSizeInPixels = '400',
4246                       $textColor = 'black',
4247                       $textShadowColor = '',
4248                       $textUnit = '',
4249                       $leftBar = 'red',
4250                       $rightBar = ''
4251                       )
4252{
4253    global $lang_errors;
4254    // Validate parameters
4255    if ($maxValue == 0 || $maxValue == '') {
4256        $maxValue = $actualValue;
4257    }
4258    // Initialize some vars:
4259    $return = '';
4260    $cell1Width = (($maxValue != 0) ? floor(100 * $actualValue/$maxValue): 0);
4261    $cell2Width = 100 - $cell1Width;
4262    // compose the output string
4263    $return .= '<table border="0" cellspacing="0" cellpadding="0" width="'.$maxBarSizeInPixels.'">';
4264    $return .= '<tr>';
4265    $return .= '<td width="'.$cell1Width.'%" style="';
4266    if ($leftBar != '') {
4267        $leftBarColor = cpgValidateColor($leftBar);
4268        if ($leftBarColor != '') {
4269            $return .= 'background-color:'.$leftBarColor.';';
4270        } else {
4271            $return .= 'background-image:url('.$leftBar.');';
4272        }
4273    }
4274    $return .= '">';
4275    $return .= '<img src="images/spacer.gif" width="1" height="16" border="0" alt="" align="left" />';
4276    if ($textShadowColor != '') {
4277        $textShadowColor = cpgValidateColor($textShadowColor);
4278        $return .= '<div style="position:absolute;display:block;color:'.$textShadowColor.';padding-top:1px;padding-left:1px;height:16px;';
4279        $return .= '">';
4280        $return .= $actualValue;
4281        $return .= $textUnit;
4282        $return .= '</div>';
4283    }
4284    $return .= '<div style="position:absolute;display:block;';
4285    if ($textColor != '') {
4286        $textColor = cpgValidateColor($textColor);
4287        $return .= 'color:'.$textColor;
4288    }
4289    $return .= '">';
4290    $return .= $actualValue;
4291    $return .= $textUnit;
4292    $return .= '</div>';
4293    $return .= '</td>';
4294    $return .= '<td width="'.$cell2Width.'%" style="';
4295    if ($rightBar != '') {
4296        $rightBarColor = cpgValidateColor($rightBar);
4297        if ($leftBarColor != '') {
4298            $return .= 'background-color:'.$rightBarColor.';';
4299        } else {
4300            $return .= 'background-image:url('.$rightBar.');';
4301        }
4302    }
4303    $return .= '">';
4304    $return .= '<img src="images/spacer.gif" width="1" height="16" border="0" alt="" align="left" />';
4305    $return .= '</td>';
4306    $return .= '</tr>';
4307    $return .= '</table>';
4308    return $return;
4309}
4310/******************************************************************************
4311** Section <<<theme_display_bar>>> - END
4312******************************************************************************/
4313} //{THEMES}
4314
4315if (!function_exists('theme_page_title')) { //{THEMES}
4316/******************************************************************************
4317** Section <<<theme_page_title>>> - START
4318******************************************************************************/
4319// Creates the title tag for each page
4320// For the sake of search engine friendliness, the dynamic part $section should come first
4321function theme_page_title($section)
4322{
4323    global $CONFIG;
4324    $return = strip_tags(bb_decode($section)) . ' - ' . $CONFIG['gallery_name'];
4325    return $return;
4326}
4327/******************************************************************************
4328** Section <<<theme_page_title>>> - END
4329******************************************************************************/
4330} //{THEMES}
4331
4332if (!isset($template_sidebar)) { //{THEMES}
4333/******************************************************************************
4334** Section <<<$template_sidebar>>> - START
4335******************************************************************************/
4336// HTML template for sidebar
4337$jquery_path = CPG_JQUERY_VERSION;
4338$template_sidebar = <<<EOT
4339<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4340<html dir="{LANG_DIR}">
4341<head>
4342<meta http-equiv="content-type" content="text/html; charset={CHARSET}" />
4343<title>{TITLE}</title>
4344<script src="{$jquery_path}" type="text/javascript"></script>
4345<script src="js/jquery.treeview.min.js" type="text/javascript"></script>
4346<script type="text/javascript">
4347    $(function() {
4348        $("#tree").treeview({
4349            collapsed: true,
4350            unique: true,
4351            animated: "slow",
4352            persist: "location",
4353        });
4354    })
4355</script>
4356<link rel="stylesheet" href="css/coppermine.css" type="text/css" />
4357<link rel="stylesheet" href="css/treeview.css" type="text/css" />
4358</head>
4359<body>
4360{SIDEBAR_CONTENT}
4361<form method="GET" action="thumbnails.php" target="_content">
4362  <input type="hidden" name="album" value="search" />
4363  <input type="hidden" name="title" value="on" />
4364  <input type="hidden" name="caption" value="on" />
4365  <input type="hidden" name="keywords" value="on" />
4366  <input type="hidden" name="filename" value="on" />
4367  <div id="SidebarSearchWrapper" style="margin: 1px 1px;float: left;">
4368    <input id="sidebarSearchField" type="text" name="search" class="textinput" />
4369    <button type="submit" class="button" name="sidebarSearchButton" id="sidebarSearchButton" value="{SEARCH_TITLE}">{SEARCH_ICON}</button>
4370    <a href="sidebar.php" target="_self">{REFRESH_ICON}</a>
4371  </div>
4372</form>
4373</body>
4374</html>
4375EOT;
4376/******************************************************************************
4377** Section <<<$template_sidebar>>> - END
4378******************************************************************************/
4379} //{THEMES}
4380
4381if (!function_exists('adminmessages')) { //{THEMES}
4382/******************************************************************************
4383** Section <<<adminmessages>>> - START
4384******************************************************************************/
4385// Function to display messages which are shown only to admin
4386function adminmessages()
4387{
4388    global $register_globals_flag, $lang_errors;
4389    // If user is not admin (and in admin mode), then return
4390    if (!GALLERY_ADMIN_MODE) {
4391        return;
4392    }
4393
4394    // If register_globals is On, then show the warning message.
4395    if ($register_globals_flag == true) {
4396        msg_box($lang_errors['register_globals_title'], $lang_errors['register_globals_warning'] . ' ' . cpg_display_help('f=install.htm&amp;as=install_server_config_register_globals&amp;ae=install_server_config_register_globals_end&amp;top=1', '800', '600'), '', '', 'warning');
4397    }
4398}
4399/******************************************************************************
4400** Section <<<adminmessages>>> - END
4401******************************************************************************/
4402} //{THEMES}
4403
4404if (!function_exists('theme_album_info')) { //{THEMES}
4405/******************************************************************************
4406** Section <<<theme_album_info>>> - START
4407******************************************************************************/
4408// Format information which is displayed next to each album
4409function theme_album_info($pic_count, $link_pic_count, $last_upload_date)
4410{
4411    global $CONFIG, $lang_list_albums;
4412
4413    if ($CONFIG['link_last_upload']) {
4414        $album_info = sprintf($lang_list_albums['n_pictures'], $pic_count) . (($CONFIG['link_pic_count'] && $link_pic_count > 0 ) ? sprintf(", {$lang_list_albums['n_link_pictures']}, {$lang_list_albums['total_pictures']}", $link_pic_count, $pic_count + $link_pic_count) : "") . (($pic_count || ($CONFIG['link_pic_count'] && $link_pic_count > 0 )) ? sprintf($lang_list_albums['last_added'], $last_upload_date) : "");
4415    } else {
4416        $album_info = sprintf($lang_list_albums['n_pictures'], $pic_count) . ($pic_count ? sprintf($lang_list_albums['last_added'], $last_upload_date) : "") . (($CONFIG['link_pic_count'] && $link_pic_count > 0) ? sprintf(", {$lang_list_albums['n_link_pictures']}, {$lang_list_albums['total_pictures']}", $link_pic_count, $pic_count + $link_pic_count) : "");
4417    }
4418
4419    return $album_info;
4420}
4421/******************************************************************************
4422** Section <<<theme_album_info>>> - END
4423******************************************************************************/
4424} //{THEMES}
4425//EOF
4426