$paramslink['number'] = $number; } if (isset($params['show'])) { $paramslink['show'] = $params['show']; } if (array_key_exists('fileid', $galleryinfo)) { if (!empty($galleryinfo['title'])) { $smarty->assign('gallerytitle', $galleryinfo['title']); } $smarty->assign('gallerycomment', array_key_exists('comment', $galleryinfo) ? $galleryinfo['comment'] : ''); $smarty->assign('gallerydate', $galleryinfo['filedate']); $smarty->assign('galleryid', $galleryinfo['fileid']); } else { $filepath = strpos($params['dir'], "/") === FALSE ? '' : substr($params['dir'], 0, strrpos($params['dir'], '/')); $filename = strpos($params['dir'], "/") === FALSE ? $params['dir'] . '/' : substr($params['dir'], strrpos($params['dir'], '/') + 1) . '/'; $parentinfo = Gallery_utils::Getgalleryinfo($filepath); $galleryinfo['fileid'] = Gallery_utils::AddFileToDB($filename, $filepath, date("Y-m-d H:i:s"), $parentinfo ? $parentinfo['fileid'] : 0); $galleryinfo['hideparentlink'] = 0; $smarty->assign('gallerydate', date("Y-m-d H:i:s")); $smarty->assign('galleryid', $galleryinfo['fileid']); } $paramslink['dir'] = strpos($params['dir'], '/') === FALSE ? '' : '/' . str_replace('%2F', '/', rawurlencode(preg_replace('/^(.*)(\\/.+)$/', '$1', $params['dir']))); $prettyurl = $urlprefix . $paramslink['dir'] . '/' . (isset($paramslink['start']) ? $paramslink['start'] . '-' . $paramslink['number'] . '-' : '') . (isset($paramslink['show']) ? $paramslink['show'] . '-' : '') . ($targetpage != '' ? $targetpage : $returnid); $smarty->assign('parentlink', empty($params['dir']) ? '' : $this->CreateFrontendLink($id, $targetpage != '' ? $targetpage : $returnid, 'default', $this->Lang('parent'), $paramslink, '', false, true, '', false, $prettyurl)); $smarty->assign('parent_url', empty($params['dir']) ? '' : $this->CreateFrontendLink($id, $targetpage != '' ? $targetpage : $returnid, 'default', '', $paramslink, '', true, true, '', false, $prettyurl)); $smarty->assign('parent_txt', $this->Lang('parent')); $smarty->assign('hideparentlink', $galleryinfo['hideparentlink']); // get the public custom fields related to this gallery $smarty->assign('fields', Gallery_utils::Getcustomfields($galleryinfo['fileid'], 1, '', 1)); // build gallery $dirfiles = Gallery_utils::Getdirfiles($params['dir'], FALSE);
exit; } $includesubdir = isset($params['dir']) && substr($params['dir'], -1) == "*" ? TRUE : FALSE; $params['dir'] = isset($params['dir']) ? rawurldecode(cms_html_entity_decode(trim(trim($params['dir'], "*"), "/"))) : ''; $number = isset($params['number']) && is_numeric($params['number']) ? $params['number'] : 6; $show = isset($params['show']) && in_array($params['show'], array('active', 'inactive', 'all')) ? $params['show'] : 'active'; $imgcount = 0; $itemcount = 0; $images = array(); $template = $this->GetPreference('current_template'); $urlprefix = $this->GetPreference('urlprefix', 'gallery'); if (is_dir(DEFAULT_GALLERY_PATH . $params['dir']) && strpos($params['dir'], '.') === FALSE) { $smarty->assign('gallerytitle', htmlspecialchars(trim(substr($params['dir'], strrpos($params['dir'], '/')), "/"))); $smarty->assign('galleryid', ''); // get gallery info $galleryinfo = Gallery_utils::Getgalleryinfo($params['dir']); if (isset($params['template'])) { // override template settings with param template $templateprops = Gallery_utils::GetTemplateprops($params['template']); $galleryinfo['templateid'] = $templateprops['templateid']; $galleryinfo['template'] = $templateprops['template']; $galleryinfo['thumbwidth'] = $templateprops['thumbwidth']; $galleryinfo['thumbheight'] = $templateprops['thumbheight']; $galleryinfo['resizemethod'] = $templateprops['resizemethod']; } if (empty($galleryinfo['templateid'])) { // override template settings with default template $templateprops = Gallery_utils::GetTemplateprops($template); $galleryinfo['templateid'] = $templateprops['templateid']; $galleryinfo['template'] = $templateprops['template']; $galleryinfo['thumbwidth'] = $templateprops['thumbwidth'];
$smarty->assign('maximagewidth', $this->GetPreference('maximagewidth', 800)); $smarty->assign('maximageheight', $this->GetPreference('maximageheight', 800)); $smarty->assign('imagejpgquality', $this->GetPreference('imagejpgquality', 80)); $_SESSION['uploaddir'] = trim(DEFAULT_GALLERY_PATH . ($params['gid'] == 1 ? '' : trim($galleryinfo['filepath'] . '/' . $galleryinfo['filename'], '/')), '/'); } if (abs($params['gid']) == 1) { $smarty->assign('pagetitle', $this->CreateLink($id, 'defaultadmin', $returnid, $this->Lang('list'))); } else { $gallerypatharr = explode('/', $galleryinfo['filepath']); $path = ''; $breadcrumbs = $this->CreateLink($id, 'defaultadmin', $returnid, $this->Lang('list')); $breadcrumbs .= ' / ' . $this->CreateLink($id, 'editgallery', $returnid, 'Gallery', array('gid' => 1, 'mode' => "edit")); foreach ($gallerypatharr as $item) { if (!empty($item)) { $path .= '/' . $item; $galinfo = Gallery_utils::Getgalleryinfo($path); $breadcrumbs .= ' / ' . $this->CreateLink($id, 'editgallery', $returnid, $item, array('gid' => $galinfo['fileid'], 'mode' => "edit")); } } $breadcrumbs .= ' / ' . trim($galleryinfo['filename'], '/'); $smarty->assign('pagetitle', $breadcrumbs); } $smarty->assign('prompt_gallerytitle', $this->Lang('gallerytitle')); $smarty->assign('prompt_comment', $this->Lang('comment')); $smarty->assign('prompt_date', $this->Lang('date')); $smarty->assign('customfields', Gallery_utils::Getcustomfields($params['gid'], 1, $id, FALSE, $permission_to_edit)); // template dropdown field $templatelist = array('- ' . $this->Lang('usedefault') . ' -' => 0); $query = "SELECT templateid, template FROM " . cms_db_prefix() . "module_gallery_templateprops " . ($this->CheckPermission('Modify Templates') ? "" : "WHERE visible=1 ") . "ORDER BY template ASC"; $result = $db->Execute($query); while ($result && ($row = $result->FetchRow())) {