/** * Prepares the document */ protected function _prepareDocument() { $app = JFactory::getApplication(); $menus = $app->getMenu(); $title = NULL; // Because the application sets a default page title, // we need to get it from the menu item itself $menu = $menus->getActive(); if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); } $title = $this->params->get('page_title', ''); if ($this->folder->getDisplayName()) { $title = $this->folder->getDisplayName(); } // Check for empty title and add site name if param is set if (empty($title)) { $title = $app->getCfg('sitename'); } elseif ($app->getCfg('sitename_pagetitles', 0) == 1) { $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename')); } if (empty($title)) { $title = $this->folder->getDisplayName(); } $this->document->setTitle($title); if ($this->folder->getText()) { $this->document->setDescription($this->folder->getText()); } elseif (!$this->folder->getText() && $this->params->get('menu-meta_description')) { $this->document->setDescription($this->params->get('menu-meta_description')); } }
function display($tpl = NULL) { /** * @var JSite $app */ $app = JFactory::getApplication(); $this->state = $this->get('State'); $this->params = $app->getParams(); $model = $this->getModel('singleimage'); $model->getData(JRequest::getString('folder'), JRequest::getString('file')); $this->model = $model; $this->file = $model->file; if (!isset($this->file) || strlen($this->file->getFileName()) == 0 || $this->file->isPublished() != 1) { JError::raiseError(404, JText::_('COM_EVENTGALLERY_SINGLEIMAGE_NO_PUBLISHED_MESSAGE')); } $this->folder = $this->file->getFolder(); if (!isset($this->file) || strlen($this->file->getFileName()) == 0 || $this->file->isPublished() != 1) { JError::raiseError(404, JText::_('COM_EVENTGALLERY_SINGLEIMAGE_NO_PUBLISHED_MESSAGE')); } $this->position = $model->position; /* Default Page fallback*/ $active = $app->getMenu()->getActive(); if (NULL == $active) { $this->params->merge($app->getMenu()->getDefault()->params); $active = $app->getMenu()->getDefault(); } $this->currentItemid = $active->id; $this->use_comments = $this->params->get('use_comments'); if (!$this->folder->isVisible()) { $user = JFactory::getUser(); if ($user->guest) { $redirectUrl = JRoute::_("index.php?option=com_eventgallery&view=singleimage&folder=" . $this->folder->getFolderName() . "&file=" . $this->file->getFileName(), false); $redirectUrl = urlencode(base64_encode($redirectUrl)); $redirectUrl = '&return=' . $redirectUrl; $joomlaLoginUrl = 'index.php?option=com_users&view=login'; $finalUrl = JRoute::_($joomlaLoginUrl . $redirectUrl, false); $app->redirect($finalUrl); } else { $this->setLayout('noaccess'); } } $password = JRequest::getString('password', ''); $accessAllowed = EventgalleryHelpersFolderprotection::isAccessAllowed($this->folder, $password); if (!$accessAllowed) { $app->redirect(JRoute::_("index.php?option=com_eventgallery&view=password&folder=" . $this->folder->getFolderName(), false)); } $this->setLayout(JRequest::getString('layout', 'minipage')); parent::display($tpl); }
/** * Prepares the document */ protected function _prepareDocument() { $app = JFactory::getApplication(); $menus = $app->getMenu(); $menu = $menus->getActive(); $title = null; // Because the application sets a default page title, // we need to get it from the menu item itself if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); } $title = $this->params->get('page_title', ''); // checks for empty title or sets the folder description if // the current menu item is not the event view. This avoids // having the title of them menu item on all sub events if (empty($title) || isset($menu->query['view']) && strcmp($menu->query['view'], 'event') != 0) { $title = $this->folder->getDisplayName(); } // Check for empty title and add site name if param is set if (empty($title)) { $title = $app->getCfg('sitename'); } elseif ($app->getCfg('sitename_pagetitles', 0) == 1) { $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename')); } if (empty($title)) { $title = $this->folder->getDisplayName(); } $this->document->setTitle($title); $description = $this->params->get('menu-meta_description'); if (empty($description)) { $description = $this->folder->getMetadata()->get('metadesc'); } // set the text of the folder as description if the meta desc is not set // or the menu item does not link to a single event if (empty($description) || isset($menu->query['view']) && strcmp($menu->query['view'], 'event') != 0) { $description = strip_tags($this->folder->getText()); } $this->document->setDescription($description); $keys = $this->folder->getMetadata()->get('metakey'); if ($this->params->get('menu-meta_keywords')) { $keys = $this->params->get('menu-meta_keywords'); } $this->document->setMetadata('keywords', $keys); if ($this->params->get('robots')) { $this->document->setMetadata('robots', $this->params->get('robots')); } $this->document->setMetadata('fragment', '!'); }
/** * Prepares the document */ protected function _prepareDocument() { $app = JFactory::getApplication(); $menus = $app->getMenu(); $title = null; // Because the application sets a default page title, // we need to get it from the menu item itself $menu = $menus->getActive(); if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); } $title = $this->params->get('page_title', ''); if ($this->folder->getDisplayName()) { $title = $this->folder->getDisplayName(); } $title .= " - " . $this->position . ' / ' . $this->folder->getFileCount(); // Check for empty title and add site name if param is set if (empty($title)) { $title = $app->getCfg('sitename'); } elseif ($app->getCfg('sitename_pagetitles', 0) == 1) { $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename')); } if (empty($title)) { $title = $this->folder->getDisplayName(); } if ($this->document) { $description = $this->folder->getMetadata()->get('metadesc'); if (!empty($description)) { $this->document->setDescription($description); } elseif ($this->folder->getText()) { $this->document->setDescription(strip_tags($this->folder->getText())); } elseif (!$this->folder->getText() && $this->params->get('menu-meta_description')) { $this->document->setDescription($this->params->get('menu-meta_description')); } if ($this->params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); } else { $this->document->setMetadata('keywords', $this->folder->getMetadata()->get('metakey')); } if ($this->params->get('robots')) { $this->document->setMetadata('robots', $this->params->get('robots')); } $this->document->setTitle($title); $this->document->setMetadata('fragment', '!'); } }
/** * $creates the folder object. */ function __construct($foldername) { parent::__construct($foldername); }
function getData($foldername, $filename) { if (!$this->_dataLoaded) { $this->loadFolder($foldername); // picasa files are not stored in the database $files = $this->folder->getFiles(0, -1); $i = 0; $filesCount = count($files); /** * @var EventgalleryLibraryFile $file */ foreach ($files as $file) { if (strcmp($file->getFileName(), $filename) == 0) { /** * Update Hits */ $file->countHit(); /** * Set Data */ $this->_dataLoaded = true; $this->file = $file; $this->prevFile = $files[max(0, $i - 1)]; $this->nextFile = $files[min($filesCount - 1, $i + 1)]; $lower = floor($this->paging_images_count / 2); $upper = $this->paging_images_count - $lower; $lowerStop = $i - 1; $upperStart = $i + 1; /** Wenn weniger Bilder da sind, als für das BildPaging gebraucht werden */ if ($filesCount - 1 < $this->paging_images_count) { $lowerStart = 0; $upperStop = $filesCount - 1; } else { $lowerStart = $i - $lower; $upperStop = $i + $upper; if ($lowerStart < 0) { $upperStop += 0 - $lowerStart; $lowerStart = 0; } if ($upperStop >= $filesCount) { $lowerStart = $lowerStart - ($upperStop - $filesCount) - 1; $upperStop = $filesCount - 1; } } $this->nextFiles = array_slice($files, $upperStart, $upperStop - $upperStart + 1); if ($lowerStop >= 0) { $this->prevFiles = array_slice($files, $lowerStart, $lowerStop - $lowerStart + 1); } $this->lastFile = $files[count($files) - 1]; $this->firstFile = $files[0]; $this->loadComments(); $this->overallcount = count($files); $this->position = $i + 1; if ($this->getState('limit') > 0) { $this->currentLimitStart = $i - $i % $this->getState('limit'); } else { $this->currentLimitStart = 0; } } $i++; } } }