$albums[] = $file; } } closedir($handle); sort($albums, SORT_STRING); // to make sure $count[] array is in sync with the $albums[] array, we need to perform this extra round AFTER the sort() operation. foreach ($albums as $key => $file) { // Count files in album $images = fileList(BASE_PATH . '/media/albums/' . $file); $count[$key] = count($images); } } $album = getGETparam4Filename('album'); $album_path = in_array($album, $albums) ? BASE_PATH . '/media/albums/' . $album : null; $page_id = getGETparam4IdOrNumber('page_id'); $preview_checkcode = GenerateNewPreviewCode($page_id); $tinyMCE_required = false; $textarea4descr_id = str2variablename('lightbox_' . $page_id . (!empty($album) ? '_' . $album : '')); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>Lightbox module</title> <link rel="stylesheet" type="text/css" href="../../../admin/img/styles/base.css,liquid.css,layout.css,sprite.css,last_minute_fixes.css" /> <link rel="stylesheet" type="text/css" href="modLightbox.css" /> <!--[if IE]> <link rel="stylesheet" type="text/css" href="../../../admin/img/styles/ie.css" /> <![endif]--> </head> <body>
if (empty($id)) { $newsID = false; // Load recordset for all news on specific news page $newsrows = $db->QueryObjects("SELECT * FROM `" . $cfg['db_prefix'] . "modnews` n LEFT JOIN `" . $cfg['db_prefix'] . "users` u ON n.userID=u.userID WHERE newsPublished<>'0' AND page_id=" . MySQL::SQLValue($page_id, MySQL::SQLVALUE_NUMBER) . " ORDER BY newsModified DESC"); } else { // Do actions for specific news // Define requested news item $newsID = explode("-", $id, 2); // Load recordset for newsID $newsrows = $db->QueryObjects("SELECT * FROM `" . $cfg['db_prefix'] . "modnews` n LEFT JOIN `" . $cfg['db_prefix'] . "users` u ON n.userID=u.userID WHERE newsID=" . MySQL::SQLValue($newsID[0], MySQL::SQLVALUE_NUMBER) . " AND newsPublished<>'0' AND page_id=" . MySQL::SQLValue($page_id, MySQL::SQLVALUE_NUMBER)); } if ($newsrows === false) { $db->Kill(); } // generate the preview code when applicable: $preview_checkcode = $ccms['preview'] == 'Y' ? GenerateNewPreviewCode($page_id, null) : false; $ccms['previewcode'] = $preview_checkcode; ?> <!-- additional style and code --> <link rel="stylesheet" href="<?php echo $cfg['rootdir']; ?> lib/modules/news/resources/style.css" type="text/css" media="screen" title="lightbox" charset="utf-8" /> <!-- lay-out --> <?php // Start switch for news, select all the right details if (count($newsrows) > 0) { if (empty($do)) { $newsCount = count($newsrows);
set_ccms_opt('templatedir', $tplel[0]); set_ccms_opt('template', $tpl); set_ccms_opt('module', $row->module); set_ccms_opt('module_info', $modules[$modules_index[$row->module]]); if (0) { // create a plugin/module instance tailored to this particular page if (is_object($modules[$row->module]) && method_exists($modules[$row->module], 'getInstance')) { set_ccms_opt('module_instance', $modules[$row->module]->getInstance($ccms)); if (!is_object($ccms['module_instance'])) { die('FATAL: module ' . $row->module . ' failed to initialize for page ' . $row->urlpage); } } } // BREADCRUMB == // Create breadcrumb for the current page $preview_checkcode = GenerateNewPreviewCode($row->page_id, null); set_ccms_opt('previewcode', $preview_checkcode); $preview_qry = $preview ? '?preview=' . $preview_checkcode : ''; $bc = array(); $bc[] = '<a href="' . $cfg['rootdir'] . $preview_qry . '" title="' . ucfirst($cfg['sitename']) . ' ' . $ccms['lang']['system']['home'] . '">' . $ccms['lang']['system']['home'] . '</a>'; if (!checkSpecialPageName($row->urlpage, SPG_IS_HOMEPAGE)) { if ($row->sublevel == 0) { $bc[] = '<a href="' . $cfg['rootdir'] . $row->urlpage . '.html' . $preview_qry . '" title="' . $row->subheader . '">' . $row->pagetitle . '</a>'; } else { // sublevel page if (is_array($pagelist) && count($pagelist) > 0) { foreach ($pagelist as $entry) { if ($entry['menu_id'] == $row->menu_id && $entry['sublevel'] == 0 && $entry['toplevel'] == $row->toplevel) { $bc[] = '<a href="' . $cfg['rootdir'] . $entry['urlpage'] . '.html' . $preview_qry . '" title="' . $entry['subheader'] . '">' . $entry['pagetitle'] . '</a>'; break; }
$album = !empty($imgID) ? $imgID : (count($spec_album) > 0 ? $spec_album[0] : $albums[0]); // [i_a] PHP evaluates nested ?: from RIGHT-TO-LEFT! Without the braces, you'ld get the wrong result. $desc = null; $lines = @file($album_path . '/' . $album . '/info.txt'); for ($x = 1; $x < count($lines); $x++) { $desc .= ' ' . $lines[$x]; } echo '<h3>' . $ccms['lang']['album']['album'] . ' ' . ucfirst($album) . "</h3>\n"; $back_to_overview_html = ''; if (!empty($imgID)) { if (!$is_printing) { $back_to_overview_html = '<div class="album-back-to-ov-top"><a href="' . $cfg['rootdir'] . $pageID . '.html">' . $ccms['lang']['backend']['tooverview'] . "</a></div>\n"; echo $back_to_overview_html; } // and augment the breadcrumb trail and other template variables: $preview_checkcode = $ccms['preview'] == 'Y' ? GenerateNewPreviewCode(null, $pageID) : false; $ccms['previewcode'] = $preview_checkcode; $preview_qry = $preview_checkcode ? '?preview=' . $preview_checkcode : ''; $ccms['breadcrumb'][] = '<a href="' . $cfg['rootdir'] . $ccms['page_name'] . '/' . $album . '.html' . $preview_qry . '" title="' . $ccms['lang']['album']['album'] . ' ' . ucfirst($album) . '">' . $ccms['lang']['album']['album'] . ' ' . ucfirst($album) . '</a>'; $ccms['urlpage'] = $ccms['page_name'] . '/' . $album; $ccms['complete_page_url'] = $ccms['urlpage'] . '.html'; $ccms['pagetitle'] .= ' : ' . $ccms['lang']['album']['album'] . ' ' . ucfirst($album); //$ccms['subheader'] = $row->subheader; $ccms['desc'] = $desc; //$ccms['keywords'] = $row->keywords; $ccms['title'] = ucfirst($ccms['pagetitle']) . " - " . $ccms['sitename'] . " | " . $ccms['subheader']; } echo '<div class="lightbox-description">' . $desc . "</div>\n"; // Get the images in an album $images = fileList($album_path . '/' . $album); // If album is not empty and thumbnail is found
/** * Return FALSE when the specified preview code is invalid; otherwise return the page number encoded with the preview code. * * Note: as the page number will NEVER be zero, you can simply check for a valid preview code (if that's all you need) by * comparing the function return value like this: * * if (IsValidPreviewCode($code)) { ... } */ function IsValidPreviewCode($previewCode) { if (empty($previewCode)) { return false; } $code = explode('-', $previewCode, 2); if (!is_array($code) || count($code) != 2 || !is_numeric($code[0])) { return false; } $orig_page_id = $code[0]; // regenerate the preview code as it should be and compare that one with what we've actually got: $sollwert = GenerateNewPreviewCode($orig_page_id, null, true); if ($sollwert === false) { return false; } return $sollwert === $previewCode ? $orig_page_id : false; }