예제 #1
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   3.1
  */
 public function display($tpl = null)
 {
     $doc = JFactory::getDocument();
     $xml_file = JPath::clean(JPATH_COMPONENT . '/changelog.xml');
     $this->changelog = simplexml_load_file($xml_file);
     parent::display($tpl);
 }
예제 #2
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   3.0
  */
 public function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('COM_JOOMGALLERY_AJAX_UPLOAD'), 'upload');
     $this->_doc->addScriptDeclaration('    var jg_filenamewithjs = ' . ($this->_config->get('jg_filenamewithjs') ? 'true' : 'false') . ';');
     // Load Fine Uploader resources
     $this->_doc->addStyleSheet($this->_ambit->getScript('fineuploader/fineuploader.css'));
     $this->_doc->addScript($this->_ambit->getScript('fineuploader/js/fineuploader' . (JFactory::getConfig()->get('debug') ? '' : '.min') . '.js'));
     $this->fileSizeLimit = 0;
     $this->chunkSize = 0;
     $post_max_size = @ini_get('post_max_size');
     if (!empty($post_max_size)) {
         $post_max_size = JoomHelper::iniToBytes($post_max_size);
         $this->chunkSize = (int) min(500000, (int) (0.8 * $post_max_size));
     }
     $upload_max_filesize = @ini_get('upload_max_filesize');
     if (!empty($upload_max_filesize)) {
         $upload_max_filesize = JoomHelper::iniToBytes($upload_max_filesize);
         $this->fileSizeLimit = $upload_max_filesize;
     }
     $this->editFilename = $this->_config->get('jg_useorigfilename');
     JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     $this->form = JForm::getInstance(_JOOM_OPTION . '.ajaxupload', 'ajaxupload');
     $this->form->setFieldAttribute('access', 'default', (int) JFactory::getConfig()->get('access'));
     if ($this->_config->get('jg_useorigfilename')) {
         $this->form->setFieldAttribute('imgtitle', 'required', 'false');
     }
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
예제 #3
0
 /**
  * HTML view display method
  *
  * @access  public
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('COM_JOOMGALLERY_MIGMAN_MIGRATION_MANAGER'), 'loop');
     $this->sidebar = JHtmlSidebar::render();
     $this->output = $this->_mainframe->getUserState('joom.migration.output', null);
     $this->_mainframe->setUserState('joom.migration.output', null);
     $this->files = JFolder::files(JPATH_COMPONENT . '/helpers/migration', '.php$', false, true);
     parent::display($tpl);
 }
예제 #4
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 public function display($tpl = null)
 {
     // Get the category data
     $item = $this->get('Data');
     $isNew = $item->cid < 1;
     if ($isNew) {
         $item->published = 1;
     }
     // Get image source for the thumbnail preview
     if ($item->thumbnail && $item->thumbnail_available) {
         $imgsource = $this->_ambit->getImg('thumb_url', $item->thumbnail);
     } else {
         $imgsource = '../media/system/images/blank.png';
     }
     // Get the form and fill the fields
     $form = $this->get('Form');
     if (!$isNew) {
         // Add additional attribute for category form field to exclude current
         // category id from select box
         $form->setFieldAttribute('parent_id', 'exclude', $item->cid);
     }
     // Ordering box is not available if option for performance improvement has been enabled
     if (!$this->_config->get('jg_disableunrequiredchecks')) {
         // Set some additional attributes for the ordering select box
         $form->setFieldAttribute('ordering', 'originalOrder', $item->cid);
         $form->setFieldAttribute('ordering', 'originalParent', $item->parent_id == 1 ? 0 : $item->parent_id);
         $form->setFieldAttribute('ordering', 'orderings', base64_encode(serialize($this->getModel()->getOrderings($item->cid ? $item->parent_id : null))));
         // Perhaps there is a better way to set the field attribute
         $parent_field = $this->_findFieldByFieldName($form, 'parent_id');
         if ($parent_field !== false) {
             $form->setFieldAttribute('ordering', 'parent_id', $parent_field->id);
         }
     }
     $imagelib_field = $this->_findFieldByFieldName($form, 'imagelib');
     // Set additional attribute for the thumbnail select box
     if ($imagelib_field !== false) {
         $form->setFieldAttribute('thumbnail', 'imagelib_id', $imagelib_field->id);
     }
     // Bind the data to the form
     $form->bind($item);
     // Set thumbnail image source for thumbnail preview form field
     $form->setValue('imagelib', null, $imgsource);
     // Set immutable fields
     if ($item->published) {
         $form->setValue('publishhiddenstate', null, $item->hidden ? JText::_('COM_JOOMGALLERY_COMMON_PUBLISHED_BUT_HIDDEN') : JText::_('COM_JOOMGALLERY_COMMON_STATE_PUBLISHED'));
     } else {
         $form->setValue('publishhiddenstate', null, JText::_('COM_JOOMGALLERY_COMMON_STATE_UNPUBLISHED'));
     }
     if ($item->thumbnail && !$item->thumbnail_available) {
         $form->setValue('notice', null, JText::sprintf('COM_JOOMGALLERY_CATMAN_THUMBNAIL_NOT_AVAILABLE', $item->thumbnail));
     }
     $this->assignRef('item', $item);
     $this->assignRef('isNew', $isNew);
     $this->assignRef('form', $form);
     $this->addToolbar();
     parent::display($tpl);
 }
예제 #5
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 public function display($tpl = null)
 {
     // Get data from the model
     $this->items = $this->get('Comments');
     $this->state = $this->get('State');
     $this->pagination = $this->get('Pagination');
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
     $this->addToolbar();
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
예제 #6
0
 /**
  * HTML view display method
  *
  * @access  public
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   2.0
  */
 function display($tpl = null)
 {
     // Get data from the model
     $this->items = $this->get('Configs');
     $this->allitems = $this->get('AllConfigs');
     $this->state = $this->get('State');
     $this->pagination = $this->get('Pagination');
     $this->usergroups = $this->get('Usergroups');
     $this->addToolbar();
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
예제 #7
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 public function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('COM_JOOMGALLERY_UPLOAD_BATCH_UPLOAD_MANAGER'), 'upload');
     JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     $this->form = JForm::getInstance(_JOOM_OPTION . '.batchupload', 'batchupload');
     $this->form->setFieldAttribute('access', 'default', (int) JFactory::getConfig()->get('access'));
     if ($this->_config->get('jg_useorigfilename')) {
         $this->form->setFieldAttribute('imgtitle', 'required', 'false');
     }
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
예제 #8
0
 /**
  * HTML view display method
  *
  * @access  public
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 function display($tpl = null)
 {
     $params = $this->_mainframe->getParams();
     // Breadcrumbs
     if ($this->_config->get('jg_completebreadcrumbs')) {
         $breadcrumbs = $this->_mainframe->getPathway();
         $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_DOWNLOADZIP_DOWNLOAD'));
     }
     // Header and footer
     JoomHelper::prepareParams($params);
     $pathway = JText::_('COM_JOOMGALLERY_DOWNLOADZIP_DOWNLOAD');
     $backtarget = JRoute::_('index.php?view=favourites');
     //see above
     $backtext = JText::_('COM_JOOMGALLERY_DOWNLOADZIP_BACK_TO_FAVOURITES');
     // Get number of images and hits in gallery
     $numbers = JoomHelper::getNumberOfImgHits();
     // Load modules at position 'top'
     $modules['top'] = JoomHelper::getRenderedModules('top');
     if (count($modules['top'])) {
         $params->set('show_top_modules', 1);
     }
     // Load modules at position 'btm'
     $modules['btm'] = JoomHelper::getRenderedModules('btm');
     if (count($modules['btm'])) {
         $params->set('show_btm_modules', 1);
     }
     $zipname = $this->_mainframe->getUserState('joom.favourites.zipname');
     if (!$zipname || !file_exists(JPath::clean(JPATH_ROOT . '/' . $zipname))) {
         $this->_mainframe->redirect(JRoute::_('index.php?view=favourites', false), JText::_('COM_JOOMGALLERY_DOWNLOADZIP_ZIPFILE_NOT_FOUND'), 'error');
     }
     $zipsize = filesize($zipname);
     if ($zipsize < 1000000) {
         $zipsize = round($zipsize, -3) / 1000;
         $zipsize_string = JText::sprintf('COM_JOOMGALLERY_FAVOURITES_ZIP_SIZEKB', $zipsize);
     } else {
         $zipsize = round($zipsize, -6) / 1000000;
         $zipsize_string = JText::sprintf('COM_JOOMGALLERY_FAVOURITES_ZIP_SIZEMB', $zipsize);
     }
     $this->assignRef('params', $params);
     $this->assignRef('zipname', $zipname);
     $this->assignRef('zipsize', $zipsize_string);
     $this->assignRef('pathway', $pathway);
     $this->assignRef('modules', $modules);
     $this->assignRef('backtarget', $backtarget);
     $this->assignRef('backtext', $backtext);
     $this->assignRef('numberofpics', $numbers[0]);
     $this->assignRef('numberofhits', $numbers[1]);
     parent::display($tpl);
 }
예제 #9
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 public function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('COM_JOOMGALLERY_HLPIFO_HELP_MANAGER'), 'info');
     $languages = array('de-DE-formal' => array('translator' => 'JoomGallery::ProjectTeam de-DE (formal)', 'downloadlink' => 'http://www.joomgallery.net/downloads/joomgallery-fuer-joomla-3/sprachdateien/die-deutschen-formellen-sprachdateien.html', 'flag' => 'de.png', 'type' => 'formal'), 'de-DE-informal' => array('translator' => 'JoomGallery::ProjectTeam de-DE (informal)', 'downloadlink' => 'http://www.joomgallery.net/downloads/joomgallery-fuer-joomla-3/sprachdateien/die-deutschen-informellen-sprachdateien.html', 'flag' => 'de.png'), 'ar-AA' => array('translator' => 'JoomGallery::TranslationTeam::Arabic ar-AA', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-arabic-unitag-language-files.html', 'flag' => 'sy.png'), 'bs-BA' => array('translator' => 'JoomGallery::TranslationTeam::Bosnian (Bosnia and Herzegovina) bs-BA', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-bosnian-language-files.html', 'flag' => 'ba.png'), 'bg-BG' => array('translator' => 'JoomGallery::TranslationTeam::Bulgarian (Bulgaria) bg-BG', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-bulgarian-language-files.html', 'flag' => 'bg.png'), 'zh-CN' => array('translator' => 'JoomGallery::TranslationTeam::Chinese (China) zh-CN', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-chinese-simplified-language-files.html', 'flag' => 'cn.png'), 'zh-TW' => array('translator' => 'JoomGallery::TranslationTeam::Chinese (Taiwan) zh-TW', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-chinese-traditional-language-files.html', 'flag' => 'cn.png'), 'hr-HR' => array('translator' => 'JoomGallery::TranslationTeam::Croatian (Croatia) hr-HR', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-croatian-language-files.html', 'flag' => 'hr.png'), 'cs-CZ' => array('translator' => 'JoomGallery::TranslationTeam::Czech (Czech Republic) cs-CZ', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-czech-language-files.html', 'flag' => 'cz.png'), 'da-DK' => array('translator' => 'JoomGallery::TranslationTeam::Danish (Denmark) da-DK', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-danish-language-files.html', 'flag' => 'dk.png'), 'nl-NL' => array('translator' => 'JoomGallery::TranslationTeam::Dutch (Netherlands) nl-NL', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-dutch-language-files.html', 'flag' => 'nl.png'), 'fi-FI' => array('translator' => 'JoomGallery::TranslationTeam::Finnish (Finland) fi-FI', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-finnish-language-files.html', 'flag' => 'fi.png'), 'fr-FR' => array('translator' => 'JoomGallery::TranslationTeam::French (France) fr-FR', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-french-language-files.html', 'flag' => 'fr.png'), 'el-GR' => array('translator' => 'JoomGallery::TranslationTeam::Greek (Greece) el-GR', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-greek-language-files.html', 'flag' => 'gr.png'), 'hu-HU-formal' => array('translator' => 'JoomGallery::TranslationTeam::Hungarian (Hungary) hu-HU (formal)', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-hungarian-formal-language-files.html', 'flag' => 'hu.png'), 'hu-HU-informal' => array('translator' => 'JoomGallery::TranslationTeam::Hungarian (Hungary) hu-HU (informal)', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-hungarian-informal-language-files.html', 'flag' => 'hu.png'), 'it-IT' => array('translator' => 'JoomGallery::TranslationTeam::Italian (Italy) it-IT', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-italian-language-files.html', 'flag' => 'it.png'), 'ja-JP' => array('translator' => 'JoomGallery::TranslationTeam::Japanese (Japan) ja-JP', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-japanese-language-files.html', 'flag' => 'jp.png'), 'lt-LT' => array('translator' => 'JoomGallery::TranslationTeam::Lithuanian (Lithuania) lt-LT', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-lithunian-language-files.html', 'flag' => 'lt.png'), 'lv-LV' => array('translator' => 'JoomGallery::TranslationTeam::Latvian (Latvia) lv-LV', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-latvian-language-files.html', 'flag' => 'lv.png'), 'nb-NO' => array('translator' => 'JoomGallery::TranslationTeam::Norwegian Bokmål (Norway) nb-NO', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-norwegian-language-files.html', 'flag' => 'no.png'), 'fa-IR' => array('translator' => 'JoomGallery::TranslationTeam::Persian (Iran) fa-IR', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-persian-language-files.html', 'flag' => 'ir.png'), 'pl-PL' => array('translator' => 'JoomGallery::TranslationTeam::Polish (Poland) pl-PL', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-polish-language-files.html', 'flag' => 'pl.png'), 'pt-BR' => array('translator' => 'JoomGallery::TranslationTeam::Portuguese (Brazil) pt-BR', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-portuguese-brazilian-language-files.html', 'flag' => 'br.png'), 'pt-PT' => array('translator' => 'JoomGallery::TranslationTeam::Portuguese (Portugal) pt-PT', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-portuguese-language-files.html', 'flag' => 'pt.png'), 'ru-RU' => array('translator' => 'JoomGallery::TranslationTeam::Russian (Russia) ru-RU', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-russian-language-files.html', 'flag' => 'ru.png'), 'sr-RS' => array('translator' => 'JoomGallery::TranslationTeam::Serbian (Serbia) sr-RS', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-serbian-cyrillic-language-files.html', 'flag' => 'rs.png'), 'sr-YU' => array('translator' => 'JoomGallery::TranslationTeam::Serbian sr-YU', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-serbian-language-files.html', 'flag' => 'rs.png'), 'sk-SK' => array('translator' => 'JoomGallery::TranslationTeam::Slovak (Slovakia) sk-SK', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-slovak-language-files.html', 'flag' => 'sk.png'), 'sl-SI' => array('translator' => 'JoomGallery::TranslationTeam::Slovenian (Slovenia) sl-SI', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-slovenian-language-files.html', 'flag' => 'si.png'), 'es-ES' => array('translator' => 'JoomGallery::TranslationTeam::Spanish (Spain) es-ES', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-spanish-language-files.html', 'flag' => 'es.png'), 'sv-SE' => array('translator' => 'JoomGallery::TranslationTeam::Swedish (Sweden) sv-SE', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-swedish-language-files.html', 'flag' => 'se.png'), 'tr-TR' => array('translator' => 'JoomGallery::TranslationTeam::Turkish (Turkey) tr-TR', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-turkish-language-files.html', 'flag' => 'tr.png'), 'uk-UA' => array('translator' => 'JoomGallery::TranslationTeam::Ukrainian (Ukraine) uk-UA', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-ukrainian-language-files.html', 'flag' => 'ua.png'), 'vi-VN' => array('translator' => 'JoomGallery::TranslationTeam::Vietnamese (Viet Nam) vi-VN', 'downloadlink' => 'http://www.en.joomgallery.net/downloads/joomgallery-for-joomla-3/languages/the-vietnamese-language-files.html', 'flag' => 'vn.png'));
     $credits = array(array('title' => 'Joomla!', 'author' => '', 'link' => 'http://www.joomla.org'), array('title' => 'CMotion Image Gallery (modified) - Detail view', 'author' => 'Jscheuer1', 'link' => 'http://www.dynamicdrive.com/dynamicindex4/cmotiongallery.htm'), array('title' => 'Slimbox (modified) - Detail and Category view', 'author' => 'Christophe Beyls', 'link' => 'http://www.digitalia.be/software/slimbox'), array('title' => 'Thickbox3.1 (modified) - Detail and Category view', 'author' => 'Cody Lindley', 'link' => 'http://www.codylindley.com'), array('title' => 'pngbehavior.htc (PNG in IE6)', 'author' => 'Erik Arvidsson', 'link' => 'http://webfx.eae.net'), array('title' => 'ImageMagick', 'author' => 'ImageMagick Studio LLC', 'link' => 'http://www.imagemagick.org/script/index.php'), array('title' => 'Jupload - Java Applet for uploading', 'author' => 'Etienne Gauthier', 'link' => 'http://jupload.sourceforge.net/'), array('title' => 'Watermark (modified)', 'author' => 'Michael Mueller', 'link' => 'http://www.php4u.net'), array('title' => 'fastimagecopyresampled (fast conversion of pictures in GD)', 'author' => 'Tim Eckel', 'link' => 'http://de.php.net/manual/en/function.imagecopyresampled.php#77679'), array('title' => 'TabPane (Backend)', 'author' => 'Erik Arvidsson', 'link' => 'http://webfx.eae.net/dhtml/tabpane/tabpane.html'), array('title' => 'NestedTabs (Backend)', 'author' => 'PerfectDesigningLTD', 'link' => 'http://www.perfectdesigning.net/development_projects/support/joomla!_tab_system.html'), array('title' => 'Wonderful Icons', 'author' => 'Mark James', 'link' => 'http://www.famfamfam.com'), array('title' => 'Smoothgallery (modified) slideshow in detail view', 'author' => 'Jonathan Schemoul', 'link' => 'http://smoothgallery.jondesign.net'), array('title' => 'Resize Image with Different Aspect Ratio - resizing thumbnails', 'author' => 'Nash', 'link' => 'http://nashruddin.com/Resize_Image_to_Different_Aspect_Ratio_on_the_fly'), array('title' => 'Weighted rating according to Thomas Bayes', 'author' => 'Michael Jašek', 'link' => 'http://www.buntesuppe.de/blog/123/bayessche-bewertung'), array('title' => 'Fine Uploader', 'author' => 'Ray Nicholus, Andrew Valums', 'link' => 'http://fineuploader.com'));
     $params = JComponentHelper::getParams('com_joomgallery');
     if ($this->_config->get('jg_checkupdate') && extension_loaded('curl')) {
         $params->set('autoinstall_possible', 1);
     }
     $this->languages = $languages;
     $this->credits = $credits;
     $this->params = $params;
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
예제 #10
0
파일: view.html.php 프로젝트: naka211/kkvn
 /**
  * HTML view display method
  *
  * @access  public
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 function display($tpl = null)
 {
     // Get data from the model
     $items = $this->get('Images');
     $state = $this->get('State');
     $pagination = $this->get('Pagination');
     $this->assignRef('items', $items);
     $this->assignRef('state', $state);
     $this->assignRef('pagination', $pagination);
     if ($state->get('filter.inuse') && !$this->get('Total')) {
         $this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_IMGMAN_MSG_NO_IMAGES_FOUND_MATCHING_YOUR_QUERY'));
     }
     $this->addToolbar();
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
예제 #11
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 public function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('COM_JOOMGALLERY_UPLOAD_FTP_UPLOAD_MANAGER'), 'upload');
     JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     $this->form = JForm::getInstance(_JOOM_OPTION . '.ftpupload', 'ftpupload');
     $subdirectory = $this->_mainframe->getUserStateFromRequest('joom.upload.ftp.subdirectory', 'subdirectory', '/', '', 'string');
     $this->form->setFieldAttribute('directory', 'default', JPath::clean($this->_ambit->get('ftp_path') . $subdirectory));
     $this->form->setFieldAttribute('subdirectory', 'directory', $this->_ambit->get('ftp_path'));
     $this->form->setFieldAttribute('ftpfiles', 'directory', $this->_ambit->get('ftp_path') . $subdirectory);
     $this->form->setFieldAttribute('subdirectory', 'default', $subdirectory);
     $this->form->setFieldAttribute('access', 'default', (int) JFactory::getConfig()->get('access'));
     if ($this->_config->get('jg_useorigfilename')) {
         $this->form->setFieldAttribute('imgtitle', 'required', 'false');
     }
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
예제 #12
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 public function display($tpl = null)
 {
     $this->params = JComponentHelper::getParams('com_joomgallery');
     JToolBarHelper::title(JText::_('COM_JOOMGALLERY_ADMENU_ADMINMENU'), 'joomgallery');
     $this->canDo = JoomHelper::getActions();
     if ($this->canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_joomgallery');
         JToolBarHelper::spacer();
     }
     // Get data from the model
     $model = $this->getModel();
     $this->state = $model->getState();
     $this->items = $model->getData();
     $this->popularImages = $model->getImages('a.hits desc', true, 5, 'a.hits > 0');
     $this->notApprovedImages = $model->getImages('a.imgdate desc', false, 5);
     $this->notApprovedComments = $model->getComments('c.cmtdate desc', false, 5);
     $this->topDownloads = $model->getImages('a.downloads desc', true, 5, 'a.downloads > 0');
     $lang = JFactory::getLanguage();
     $this->modules =& JModuleHelper::getModules('joom_cpanel');
     if ($this->_config->get('jg_checkupdate')) {
         $available_extensions = JoomExtensions::getAvailableExtensions();
         $this->params->set('url_fopen_allowed', @ini_get('allow_url_fopen'));
         $this->params->set('curl_loaded', extension_loaded('curl'));
         // If there weren't any available extensions found
         // loading the RSS feed wasn't successful
         if (count($available_extensions)) {
             $installed_extensions = JoomExtensions::getInstalledExtensions();
             $this->assignRef('available_extensions', $available_extensions);
             $this->assignRef('installed_extensions', $installed_extensions);
             $this->params->set('show_available_extensions', 1);
             $dated_extensions = JoomExtensions::checkUpdate();
             if (count($dated_extensions)) {
                 $this->assignRef('dated_extensions', $dated_extensions);
                 $this->params->set('dated_extensions', 1);
             } else {
                 $this->params->set('dated_extensions', 0);
                 $this->params->set('show_update_info_text', 1);
             }
         }
     } else {
         $this->params->set('dated_extensions', 0);
     }
     parent::display($tpl);
 }
예제 #13
0
 /**
  * HTML view display method
  *
  * @access  public
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 function display($tpl = null)
 {
     $items = $this->get('Images');
     $cids = JRequest::getVar('cid', array(), '', 'array');
     $cids = implode(',', $cids);
     // Get the form and fill the fields
     $form = $this->get('Form');
     // Bind the data to the form
     $form->bind($items[0]);
     // Set some form fields manually
     $form->setValue('txtclearhits', null, JText::_('COM_JOOMGALLERY_IMGMAN_CLEAR_HITS_FOR_ALL_IMAGES'));
     $form->setValue('txtclearvotes', null, JText::_('COM_JOOMGALLERY_IMGMAN_CLEAR_VOTES_FOR_ALL_IMAGES'));
     $form->setValue('txtcleardownloads', null, JText::_('COM_JOOMGALLERY_IMGMAN_CLEAR_DOWNLOADS_FOR_ALL_IMAGES'));
     $this->assignRef('items', $items);
     $this->assignRef('cids', $cids);
     $this->assignRef('form', $form);
     $this->addToolbar();
     parent::display($tpl);
 }
예제 #14
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 public function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('COM_JOOMGALLERY_UPLOAD_IMAGE_UPLOAD_MANAGER'), 'upload');
     $this->_doc->addScriptDeclaration('    var jg_filenamewithjs = ' . ($this->_config->get('jg_filenamewithjs') ? 'true' : 'false') . ';');
     $this->_doc->addScript($this->_ambit->getScript('upload.js'));
     JText::script('COM_JOOMGALLERY_COMMON_ALERT_IMAGE_MUST_HAVE_TITLE');
     JText::script('COM_JOOMGALLERY_COMMON_ALERT_YOU_MUST_SELECT_CATEGORY');
     JText::script('COM_JOOMGALLERY_COMMON_ALERT_YOU_MUST_SELECT_ONE_IMAGE');
     JText::script('COM_JOOMGALLERY_COMMON_ALERT_WRONG_EXTENSION');
     JText::script('COM_JOOMGALLERY_COMMON_ALERT_WRONG_FILENAME');
     JText::script('COM_JOOMGALLERY_UPLOAD_ALERT_FILENAME_DOUBLE_ONE');
     JText::script('COM_JOOMGALLERY_UPLOAD_ALERT_FILENAME_DOUBLE_TWO');
     JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     $this->form = JForm::getInstance(_JOOM_OPTION . '.upload', 'upload');
     $this->form->setFieldAttribute('access', 'default', (int) JFactory::getConfig()->get('access'));
     if ($this->_config->get('jg_useorigfilename')) {
         $this->form->setFieldAttribute('imgtitle', 'required', 'false');
     }
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
예제 #15
0
 /**
  * HTML view display method
  *
  * @access  public
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 function display($tpl = null)
 {
     jimport('joomla.filesystem.file');
     JToolBarHelper::apply('apply');
     JToolBarHelper::save('save');
     $path = JPATH_ROOT . '/media/joomgallery/css/';
     $title = JText::_('COM_JOOMGALLERY_CSSMAN_CSS_MANAGER');
     if (JFile::exists($path . 'joom_local.css')) {
         $title .= ' (' . JText::_('COM_JOOMGALLERY_COMMON_TOOLBAR_EDIT') . ')';
         JToolBarHelper::deleteList(JText::_('COM_JOOMGALLERY_CSSMAN_CSS_CONFIRM_DELETE', true), 'remove', 'COM_JOOMGALLERY_CSSMAN_TOOLBAR_DELETE_CSS');
         $file = $path . 'joom_local.css';
         if (!is_writable($file)) {
             JError::raiseNotice(111, JText::_('COM_JOOMGALLERY_CSSMAN_CSS_WARNING_PERMS'));
         }
         $edit = true;
     } else {
         $title .= ' (' . JText::_('COM_JOOMGALLERY_COMMON_TOOLBAR_NEW') . ')';
         $file = $path . 'joom_local.css.README';
         if (!is_writable($path)) {
             JError::raiseNotice(111, JText::_('COM_JOOMGALLERY_CSSMAN_CSS_WARNING_PERMS'));
         }
         $edit = false;
     }
     JToolBarHelper::title($title, 'file');
     $content = JFile::read($file);
     if ($content === false) {
         // Unable to read the file
         JError::raiseWarning(111, JText::_('COM_JOOMGALLERY_CSSMAN_CSS_ERROR_READING') . $file);
     } else {
         $content = htmlspecialchars($content, ENT_QUOTES, 'UTF-8');
     }
     $file = $path . 'joom_local.css';
     $this->assignRef('content', $content);
     $this->assignRef('edit', $edit);
     $this->assignRef('file', $file);
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
예제 #16
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 public function display($tpl = null)
 {
     $item = $this->get('Data');
     $isNew = $item->id < 1;
     $rating = 0.0;
     // Get the form and fill the fields
     $form = $this->get('Form');
     if ($isNew) {
         // Set some field attributes for javascript validation
         $form->setFieldAttribute('detail_catid', 'required', true);
         $form->setFieldAttribute('detail_catid', 'validate', 'joompositivenumeric');
         $form->setFieldAttribute('thumb_catid', 'required', true);
         $form->setFieldAttribute('thumb_catid', 'validate', 'joompositivenumeric');
         $form->setFieldAttribute('imgfilename', 'required', true);
         $form->setFieldAttribute('imgthumbname', 'required', true);
         // Detail images
         $detail_catpath = JoomHelper::getCatPath($item->detail_catid);
         $detail_path = $this->_ambit->get('img_path') . $detail_catpath;
         $form->setFieldAttribute('imgfilename', 'directory', $detail_path);
         $imgfilename_field = $this->_findFieldByFieldName($form, 'imgfilename');
         $imagelib_field = $this->_findFieldByFieldName($form, 'imagelib2');
         // Thumbnail images
         $thumb_catpath = JoomHelper::getCatPath($item->thumb_catid);
         $thumb_path = $this->_ambit->get('thumb_path') . $thumb_catpath;
         $form->setFieldAttribute('imgthumbname', 'directory', $thumb_path);
         $imgthumbname_field = $this->_findFieldByFieldName($form, 'imgthumbname');
         $imagelib_field = $this->_findFieldByFieldName($form, 'imagelib');
     } else {
         if ($item->imgvotes > 0) {
             $rating = JoomHelper::getRating($item->id);
         }
     }
     // Bind the data to the form
     $form->bind($item);
     // Set some form fields manually
     if ($isNew) {
         // Does the original image file exist
         if ($form->getValue('imgfilename', null) == '') {
             $form->setValue('original_exists', null, JText::_('COM_JOOMGALLERY_IMGMAN_NO_IMAGE_SELECTED'));
         } else {
             if (JFile::exists($this->_ambit->getImg('orig_path', $item->imgfilename, null, $item->detail_catid))) {
                 $orig_msg = JText::_('COM_JOOMGALLERY_IMGMAN_ORIGINAL_EXIST');
                 $color = 'green';
             } else {
                 $orig_msg = JText::_('COM_JOOMGALLERY_IMGMAN_ORIGINAL_NOT_EXIST');
                 $color = 'red';
             }
             $form->setValue('original_exists', null, $orig_msg);
             $original_exists_field = $this->_findFieldByFieldName($form, 'original_exists');
             $js = "\n        window.addEvent('domready', function() {\n          \$('" . $original_exists_field->id . "').setStyle('color', '" . $color . "');\n        });";
             $this->_doc->addScriptDeclaration($js);
         }
     } else {
         // Plublished and hidden state
         if ($item->published) {
             $form->setValue('publishhiddenstate', null, $item->hidden ? JText::_('COM_JOOMGALLERY_COMMON_PUBLISHED_BUT_HIDDEN') : JText::_('COM_JOOMGALLERY_COMMON_STATE_PUBLISHED'));
         } else {
             $form->setValue('publishhiddenstate', null, JText::_('COM_JOOMGALLERY_COMMON_STATE_UNPUBLISHED'));
         }
         // Rating
         $form->setValue('rating', null, JText::sprintf('COM_JOOMGALLERY_IMGMAN_IMAGE_VOTES', $rating, $item->imgvotes));
         // Date
         $form->setValue('date', null, JHTML::_('date', $item->imgdate, JText::_('DATE_FORMAT_LC2')));
     }
     // Set image source for detail image preview
     if ($item->imgfilename) {
         if ($isNew) {
             // We have to look for the image ID fist because the image may have to be output through the script
             $id = $this->getModel()->getIdByFilename($item->imgfilename, $item->detail_catid);
             $imgsource = $this->_ambit->getImg('img_url', $id);
         } else {
             $imgsource = $this->_ambit->getImg('img_url', $item);
         }
     } else {
         $imgsource = '../media/system/images/blank.png';
     }
     $form->setValue('imagelib2', null, $imgsource);
     // Set image source for thumbnail preview
     if ($item->imgthumbname) {
         if ($isNew) {
             // We have to look for the image ID fist because the image may have to be output through the script
             $id = $this->getModel()->getIdByFilename($item->imgthumbname, $item->thumb_catid, true);
             $thumbsource = $this->_ambit->getImg('thumb_url', $id);
         } else {
             $thumbsource = $this->_ambit->getImg('thumb_url', $item);
         }
     } else {
         $thumbsource = '../media/system/images/blank.png';
     }
     $form->setValue('imagelib', null, $thumbsource);
     $this->assignRef('item', $item);
     $this->assignRef('isNew', $isNew);
     $this->assignRef('form', $form);
     $this->addToolbar();
     parent::display($tpl);
 }
예제 #17
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 public function display($tpl = null)
 {
     if (!$this->_config->get('jg_userspace')) {
         $msg = JText::_('JERROR_ALERTNOAUTHOR');
         $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), $msg, 'notice');
     }
     // Additional security check for unregistered users
     if (!$this->_user->get('id') && !$this->_config->get('jg_unregistered_permissions')) {
         $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), JText::_('COM_JOOMGALLERY_COMMON_MSG_YOU_ARE_NOT_LOGGED'), 'notice');
     }
     $params = $this->_mainframe->getParams();
     // Breadcrumbs
     if ($this->_config->get('jg_completebreadcrumbs')) {
         $breadcrumbs = $this->_mainframe->getPathway();
         $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_COMMON_USER_PANEL'), 'index.php?view=userpanel');
         $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_COMMON_CATEGORIES'));
     }
     // Header and footer
     JoomHelper::prepareParams($params);
     $this->pathway = null;
     if ($this->_config->get('jg_showpathway')) {
         $this->pathway = '<a href="' . JRoute::_('index.php?view=userpanel') . '">' . JText::_('COM_JOOMGALLERY_COMMON_USER_PANEL') . '</a>';
         $this->pathway .= ' &raquo; ' . JText::_('COM_JOOMGALLERY_COMMON_CATEGORIES');
     }
     $this->backtarget = JRoute::_('index.php?view=userpanel');
     $this->backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_USER_PANEL');
     // Get number of images and hits in gallery
     $numbers = JoomHelper::getNumberOfImgHits();
     $this->numberofpics = $numbers[0];
     $this->numberofhits = $numbers[1];
     // Load modules at position 'top'
     $this->modules['top'] = JoomHelper::getRenderedModules('top');
     if (count($this->modules['top'])) {
         $params->set('show_top_modules', 1);
     }
     // Load modules at position 'btm'
     $this->modules['btm'] = JoomHelper::getRenderedModules('btm');
     if (count($this->modules['btm'])) {
         $params->set('show_btm_modules', 1);
     }
     // Show upload quota
     if ($this->_config->get('jg_newpicnote') && $this->_user->get('id')) {
         $params->set('show_categories_notice', 1);
     }
     // Get data from the model
     $this->total = $this->get('Total');
     $this->state = $this->get('State');
     if ($this->state->get('list.start') >= $this->total) {
         // This may happen for instance when a category has been deleted on a page with just one entry
         $limitstart = $this->total > 0 && $this->total > $this->state->get('list.limit') ? floor(($this->total - 1) / $this->state->get('list.limit')) * $this->state->get('list.limit') : 0;
         $this->state->set('list.start', $limitstart);
     }
     $this->slimitstart = $this->state->get('list.start') > 0 ? '&limitstart=' . $this->state->get('list.start') : '';
     // Get data from the model
     $this->categoryNumber = $this->get('CategoryNumber');
     $this->items = $this->get('Categories');
     $this->pagination = $this->get('Pagination');
     // Enqueue a message in case no categories were found
     if (!$this->total) {
         if ($this->state->get('filter.inuse')) {
             $this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_USERPANEL_MSG_NO_CATEGORIES_FOUND_MATCHING_YOUR_QUERY'));
         } else {
             // Guests cannot own any categories
             if (!$this->_user->get('id')) {
                 $this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_USERCATEGORIES_GUESTS_CANNOT_OWN_CATEGORIES'));
             } else {
                 $this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_USERCATEGORIES_YOU_NOT_HAVE_CATEGORY'));
             }
         }
     }
     // Show the button to create a new category only for users
     // with create permissions and who have not reached the limits
     if (($this->_user->authorise('core.create', _JOOM_OPTION) || $this->_config->get('jg_disableunrequiredchecks') || count(JoomHelper::getAuthorisedCategories('core.create'))) && $this->_config->get('jg_maxusercat') - $this->categoryNumber > 0) {
         $params->set('show_category_button', 1);
     }
     // Preprocess the list of items to find ordering divisions.
     foreach ($this->items as &$item) {
         $this->ordering[$item->parent_id][] = $item->cid;
     }
     $this->lists = array();
     // Filter by state
     $options = array(JHTML::_('select.option', 0, JText::_('COM_JOOMGALLERY_COMMON_SELECT_STATE')), JHTML::_('select.option', 1, JText::_('COM_JOOMGALLERY_COMMON_OPTION_PUBLISHED_ONLY')), JHTML::_('select.option', 2, JText::_('COM_JOOMGALLERY_COMMON_OPTION_NOT_PUBLISHED_ONLY')));
     $this->lists['filter_state'] = JHTML::_('select.genericlist', $options, 'filter_state', 'class="inputbox" size="1" onchange="form.submit();"', 'value', 'text', $this->state->get('filter.state'));
     $this->params = $params;
     parent::display($tpl);
 }
예제 #18
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 public function display($tpl = null)
 {
     jimport('joomla.filesystem.file');
     $params = $this->_mainframe->getParams();
     // Prepare params for header and footer
     JoomHelper::prepareParams($params);
     // Load modules at position 'top'
     $modules['top'] = JoomHelper::getRenderedModules('top');
     if (count($modules['top'])) {
         $params->set('show_top_modules', 1);
     }
     // Load modules at position 'btm'
     $modules['btm'] = JoomHelper::getRenderedModules('btm');
     if (count($modules['btm'])) {
         $params->set('show_btm_modules', 1);
     }
     $pathway = null;
     $params->set('show_header_backlink', 0);
     $params->set('show_footer_backlink', 0);
     // Get number of images and hits in gallery
     $numbers = JoomHelper::getNumberOfImgHits();
     // Get number of all root categories
     if ($this->_config->get('jg_hideemptycats') == 2) {
         $total = $this->get('TotalWithoutEmpty');
     } else {
         $total = $this->get('Total');
     }
     // Calculation of the number of total pages
     $catperpage = $this->_config->get('jg_catperpage');
     if (!$catperpage) {
         $catperpage = 10;
     }
     $totalpages = floor($total / $catperpage);
     $offcut = $total % $catperpage;
     if ($offcut > 0) {
         $totalpages++;
     }
     $totalcategories = $total;
     $total = number_format($total, 0, ',', '.');
     // Get the current page
     $page = JRequest::getInt('page', 0);
     if ($page > $totalpages) {
         $page = $totalpages;
     }
     if ($page < 1) {
         $page = 1;
     }
     // Limitstart
     $limitstart = ($page - 1) * $catperpage;
     JRequest::setVar('limitstart', $limitstart);
     require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/pagination.php';
     $this->pagination = new JoomPagination($totalcategories, $limitstart, $catperpage, '', 'gallery');
     if ($totalpages > 1 && $total != 0) {
         if ($this->_config->get('jg_showgallerypagenav') == 1 || $this->_config->get('jg_showgallerypagenav') == 2) {
             $params->set('show_pagination_top', 1);
         }
         if ($this->_config->get('jg_showgallerypagenav') == 2 || $this->_config->get('jg_showgallerypagenav') == 3) {
             $params->set('show_pagination_bottom', 1);
         }
     }
     // Displaying of category number depends on pagination position
     if ($this->_config->get('jg_showcatcount')) {
         if ($this->_config->get('jg_showgallerypagenav') <= 2) {
             $params->set('show_count_top', 1);
         }
         if ($this->_config->get('jg_showgallerypagenav') >= 2) {
             $params->set('show_count_bottom', 1);
         }
     }
     // Favourites icon for categories
     if ($this->_config->get('jg_allimagesofcategory') && $this->_config->get('jg_favourites')) {
         if ($this->_user->get('id') || $this->_config->get('jg_usefavouritesforpubliczip') == 1 && !$this->_user->get('id')) {
             if ($this->_config->get('jg_usefavouritesforzip') || $this->_config->get('jg_usefavouritesforpubliczip') && !$this->_user->get('id')) {
                 $params->set('show_favourites_icon', 2);
             } else {
                 $params->set('show_favourites_icon', 1);
             }
         } else {
             if ($this->_config->get('jg_favouritesshownotauth') == 1) {
                 if ($this->_config->get('jg_usefavouritesforzip')) {
                     $params->set('show_favourites_icon', -2);
                 } else {
                     $params->set('show_favourites_icon', -1);
                 }
             }
         }
     }
     // Get all main categories of the gallery
     if ($this->_config->get('jg_hideemptycats') == 2) {
         // If the third alternative for hiding empty categories
         // is chosen ('Also those which contain empty sub-categories'),
         // we need additional code to exclude these categories.
         // (For the second alternative only the query in the model is modified.)
         $categories = $this->get('CategoriesWithoutEmpty');
     } else {
         $categories = $this->get('Categories');
     }
     $i = 0;
     foreach ($categories as $key => $category) {
         $categories[$key]->isnew = '';
         if ($this->_config->get('jg_showcatasnew')) {
             // Check if an image in this category or in sub-categories is marked with 'new'
             $categories[$key]->isnew = JoomHelper::checkNewCatg($categories[$key]->cid);
         }
         // Get number of images in category and sub-categories
         $imgshits = JoomHelper::getNumberOfImgHits($categories[$key]->cid);
         $categories[$key]->pictures = $imgshits[0];
         if ($categories[$key]->pictures == '1') {
             $categories[$key]->picorpics = 'COM_JOOMGALLERY_GALLERY_ONE_IMAGE';
         } else {
             $categories[$key]->picorpics = 'COM_JOOMGALLERY_GALLERY_IMAGES';
         }
         // Count the hits of all images in category and sub-categories
         $categories[$key]->totalhits = $imgshits[1];
         $category->thumb_src = null;
         $category->gallerycontainer = 'jg_element_gal';
         $category->photocontainer = 'jg_photo_container';
         $category->textcontainer = 'jg_element_txt';
         if ($this->_config->get('jg_showcatthumb') > 0 && in_array($categories[$key]->access, $this->_user->getAuthorisedViewLevels())) {
             if ($this->_config->get('jg_showcatthumb') == 1 || $this->_config->get('jg_showcatthumb') == 3 && (!$categories[$key]->thumbnail || !isset($categories[$key]->id))) {
                 // Random choice of category/thumbnail
                 switch ($this->_config->get('jg_showrandomcatthumb')) {
                     // Only from current category
                     case 1:
                         $random_catid = $categories[$key]->cid;
                         break;
                         // Only from sub-categories
                     // Only from sub-categories
                     case 2:
                         // Get array of all sub-categories without the current category
                         // Only with images
                         $allsubcats = JoomHelper::getAllSubCategories($categories[$key]->cid, false);
                         if (count($allsubcats)) {
                             $random_catid = $allsubcats[mt_rand(0, count($allsubcats) - 1)];
                         } else {
                             $random_catid = 0;
                         }
                         break;
                         // From both
                     // From both
                     case 3:
                         // Get array of all sub-categories including the current category
                         // Only with images
                         $allsubcats = JoomHelper::getAllSubCategories($categories[$key]->cid, true);
                         if (count($allsubcats)) {
                             $random_catid = $allsubcats[mt_rand(0, count($allsubcats) - 1)];
                         } else {
                             $random_catid = 0;
                         }
                         break;
                     default:
                         $random_catid = 0;
                         break;
                 }
                 // Random image, only if there are $randomcat(s)
                 if ($this->_config->get('jg_showrandomcatthumb') == 1 || $this->_config->get('jg_showrandomcatthumb') >= 2 && $random_catid != 0) {
                     $model = $this->getModel();
                     if ($row = $model->getRandomImage($categories[$key]->cid, $random_catid)) {
                         $cropx = null;
                         $cropy = null;
                         $croppos = null;
                         if ($this->_config->get('jg_dyncrop')) {
                             $cropx = $this->_config->get('jg_dyncropwidth');
                             $cropy = $this->_config->get('jg_dyncropheight');
                             $croppos = $this->_config->get('jg_dyncropposition');
                         }
                         $categories[$key]->thumb_src = $this->_ambit->getImg('thumb_url', $row, null, 0, true, $cropx, $cropy, $croppos);
                         if (isset($row->catid) && $categories[$key]->cid == $row->catid) {
                             // Store the image id for later skipping the category view
                             $categories[$key]->dtlimgid = $row->id;
                         }
                     }
                 }
                 // Thumbnail alignment of random thumbnails:
                 // The default classes are used except for the case that changing
                 // alignment is configured and we have to align right at the moment
                 if ($this->_config->get('jg_ctalign') == 0 && floor($i / $this->_config->get('jg_colcat')) % 2 == 0) {
                     $category->gallerycontainer = 'jg_element_gal_r';
                     $category->photocontainer = 'jg_photo_container_r';
                     $category->textcontainer = 'jg_element_txt_r';
                 }
             } else {
                 // Check if there's a category thumbnail selected
                 // 'isset' checks whether it is a valid image which we are allowed to display
                 if ($categories[$key]->thumbnail && isset($categories[$key]->id)) {
                     $cropx = null;
                     $cropy = null;
                     $croppos = null;
                     if ($this->_config->get('jg_dyncrop')) {
                         $cropx = $this->_config->get('jg_dyncropwidth');
                         $cropy = $this->_config->get('jg_dyncropheight');
                         $croppos = $this->_config->get('jg_dyncropposition');
                     }
                     $categories[$key]->thumb_src = $this->_ambit->getImg('thumb_url', $categories[$key], null, 0, true, $cropx, $cropy, $croppos);
                     if (!$categories[$key]->imghidden && isset($categories[$key]->catid) && $categories[$key]->cid == $categories[$key]->catid) {
                         // Store the image id for later skipping the category view
                         $categories[$key]->dtlimgid = $categories[$key]->id;
                     }
                 }
                 // Thumbnail alignment for own choice of thumbnails
                 switch ($category->img_position) {
                     case 0:
                         // Left
                         $categories[$key]->photocontainer = 'jg_photo_container_l';
                         $categories[$key]->textcontainer = 'jg_element_txt_l';
                         break;
                     case 1:
                         // Right
                         $categories[$key]->photocontainer = 'jg_photo_container_r';
                         $categories[$key]->textcontainer = 'jg_element_txt_r';
                         break;
                     case 2:
                         // Centered
                         $categories[$key]->photocontainer = 'jg_photo_container_c';
                         $categories[$key]->textcontainer = 'jg_element_txt_c';
                         break;
                     default:
                         // Use global settings:
                         // The default classes are used except for the case that changing
                         // alignment is configured and we have to align right at the moment
                         if ($this->_config->get('jg_ctalign') == 0 && floor($i / $this->_config->get('jg_colcat')) % 2 == 0) {
                             $category->gallerycontainer = 'jg_element_gal_r';
                             $category->photocontainer = 'jg_photo_container_r';
                             $category->textcontainer = 'jg_element_txt_r';
                         }
                         break;
                 }
             }
         }
         // Set the href url for the <a>-Tag, dependent on setting in
         // jg_skipcatview
         // link to category view or directly to detail view if the category
         // doesn't contain other categories
         if ($this->_config->get('jg_skipcatview')) {
             // Get subcategories from category
             $allsubcats = JoomHelper::getAllSubCategories($categories[$key]->cid, false);
             // Link to category view if there are any viewable subcategories
             // otherwise to detail view
             if (count($allsubcats)) {
                 $categories[$key]->link = JRoute::_('index.php?view=category&catid=' . $category->cid);
             } else {
                 // Try to set link to detail view
                 // get link with the help of category model if
                 // 1) view of thumb in configuration deactivated
                 // 2) view of thumb activated but no thumb setted for category
                 if ($this->_config->get('jg_showcatthumb') == 0 || $this->_config->get('jg_showcatthumb') != 0 && !isset($categories[$key]->dtlimgid)) {
                     // Get the model to reach other models
                     $model = $this->getModel();
                     // Get the category model, set catid before instantation because
                     // it will be needed in the constructor
                     JRequest::setVar('catid', $categories[$key]->cid);
                     $categoryModel = $model->getInstance('category', 'joomgallerymodel');
                     // Get the id of image
                     $image = $categoryModel->getImageCat($categories[$key]->cid);
                     // Set the id of image for the link to detail view
                     if (isset($image)) {
                         $categories[$key]->dtlimgid = $image;
                     }
                 }
                 // Check the id of image setted before
                 if (isset($categories[$key]->dtlimgid)) {
                     // Set link to detail view
                     $categories[$key]->link = JHTML::_('joomgallery.openimage', $this->_config->get('jg_detailpic_open'), $categories[$key]->dtlimgid);
                     // If category view is skipped we display the favourites icon for adding all images at the thumbnail.
                     $categories[$key]->show_favourites_icon = $params->get('show_favourites_icon');
                 } else {
                     $categories[$key]->link = JRoute::_('index.php?view=category&catid=' . $category->cid);
                 }
             }
         } else {
             // Set link to category view if no skipping
             $categories[$key]->link = JRoute::_('index.php?view=category&catid=' . $category->cid);
         }
         // Icon for quick upload at sub-category thumbnail
         if ($this->_config->get('jg_uploadicongallery') && ($this->_user->authorise('joom.upload', _JOOM_OPTION . '.category.' . $category->cid) || $category->owner && $category->owner == $this->_user->get('id') && $this->_user->authorise('joom.upload.inown', _JOOM_OPTION . '.category.' . $category->cid))) {
             $categories[$key]->show_upload_icon = true;
             JHtml::_('behavior.modal');
         }
         // Additional HTML added by plugins
         $results = $this->_mainframe->triggerEvent('onJoomAfterDisplayCatThumb', array($category->cid));
         $categories[$key]->event = new stdClass();
         $categories[$key]->event->afterDisplayCatThumb = trim(implode('', $results));
         /*// Additional icons added by plugins
           $results  = $this->_mainframe->triggerEvent('onJoomDisplayIcons', array('category.category', $category));
           $categories[$key]->event->icons                 = trim(implode('', $results));*/
         $i++;
     }
     $this->assignRef('params', $params);
     $this->assignRef('rows', $categories);
     $this->assignRef('total', $total);
     $this->assignRef('totalpages', $totalpages);
     $this->assignRef('page', $page);
     $this->assignRef('pathway', $pathway);
     $this->assignRef('modules', $modules);
     $this->assignRef('backtarget', $backlink[0]);
     $this->assignRef('backtext', $backlink[1]);
     $this->assignRef('numberofpics', $numbers[0]);
     $this->assignRef('numberofhits', $numbers[1]);
     // Include dTree script, dTree styles and treeview styles, if neccessary
     if ($this->_config->get('jg_showsubsingalleryview')) {
         $this->_doc->addStyleSheet($this->_ambit->getScript('dTree/css/jg_dtree.css'));
         $this->_doc->addStyleSheet($this->_ambit->getScript('dTree/css/jg_treeview.css'));
         $this->_doc->addScript($this->_ambit->getScript('dTree/js/jg_dtree.js'));
     }
     parent::display($tpl);
 }
예제 #19
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 public function display($tpl = null)
 {
     if (!$this->_config->get('jg_userspace')) {
         $msg = JText::_('JERROR_ALERTNOAUTHOR');
         $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), $msg, 'notice');
     }
     // Additional security check for unregistered users
     if (!$this->_user->get('id') && !$this->_config->get('jg_unregistered_permissions')) {
         $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), JText::_('COM_JOOMGALLERY_COMMON_MSG_YOU_ARE_NOT_LOGGED'), 'notice');
     }
     $params = $this->_mainframe->getParams();
     // Breadcrumbs
     if ($this->_config->get('jg_completebreadcrumbs')) {
         $breadcrumbs = $this->_mainframe->getPathway();
         $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_COMMON_USER_PANEL'), 'index.php?view=userpanel');
         $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_COMMON_CATEGORIES'), 'index.php?view=usercategories');
         if (JRequest::getInt('catid')) {
             $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_EDITCATEGORY_MODIFY_CATEGORY'));
         } else {
             $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_COMMON_NEW_CATEGORY'));
         }
     }
     // Header and footer
     JoomHelper::prepareParams($params);
     $pathway = null;
     if ($this->_config->get('jg_showpathway')) {
         $pathway = '<a href="' . JRoute::_('index.php?view=userpanel') . '">' . JText::_('COM_JOOMGALLERY_COMMON_USER_PANEL') . '</a>';
         $pathway .= ' &raquo; <a href="' . JRoute::_('index.php?view=usercategories') . '">' . JText::_('COM_JOOMGALLERY_COMMON_CATEGORIES') . '</a>';
         if (JRequest::getInt('catid')) {
             $pathway .= ' &raquo; ' . JText::_('COM_JOOMGALLERY_EDITCATEGORY_MODIFY_CATEGORY');
         } else {
             $pathway .= ' &raquo; ' . JText::_('COM_JOOMGALLERY_COMMON_NEW_CATEGORY');
         }
     }
     $backtarget = JRoute::_('index.php?view=userpanel');
     $backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_USER_PANEL');
     // Get number of images and hits in gallery
     $numbers = JoomHelper::getNumberOfImgHits();
     // Load modules at position 'top'
     $modules['top'] = JoomHelper::getRenderedModules('top');
     if (count($modules['top'])) {
         $params->set('show_top_modules', 1);
     }
     // Load modules at position 'btm'
     $modules['btm'] = JoomHelper::getRenderedModules('btm');
     if (count($modules['btm'])) {
         $params->set('show_btm_modules', 1);
     }
     // Load the category data
     $category = $this->get('Category');
     // Get the form and fill the fields
     $form = $this->get('Form');
     // Set some additional field attributes
     // Category slect box
     if ($category->cid) {
         // Exclude current category id from select box
         $form->setFieldAttribute('parent_id', 'exclude', $category->cid);
     } else {
         // If we are creating a new category pre-select a valid
         // parent category in select box in order to fix the content
         // of the parent category box and of the ordering box
         // (if the user is allowed to create main categories
         // 0 is already a valid value for the category select box)
         if (!$this->_config->get('jg_disableunrequiredchecks') && !$this->_user->authorise('core.create', _JOOM_OPTION)) {
             $parent_cats = JoomHelper::getAuthorisedCategories('core.create');
             if (isset($parent_cats[0])) {
                 $category->parent_id = $parent_cats[0]->cid;
             } else {
                 $msg = JText::_('COM_JOOMGALLERY_EDITCATEGORY_ERROR_NO_AVAILABLE_PARENT_CATEGORIES');
                 $this->_mainframe->redirect(JRoute::_('index.php?view=usercategories', false), $msg, 'notice');
             }
         }
     }
     // Ordering box is not available if option for performance improvement has been enabled
     if (!$this->_config->get('jg_disableunrequiredchecks')) {
         // Set some additional attributes for the ordering select box
         $form->setFieldAttribute('ordering', 'originalOrder', $category->cid);
         $form->setFieldAttribute('ordering', 'originalParent', $category->parent_id == 1 ? 0 : $category->parent_id);
         $form->setFieldAttribute('ordering', 'orderings', base64_encode(serialize($this->getModel()->getOrderings($category->cid ? $category->parent_id : null))));
         // Perhaps there is a better way to set the field attribute
         $parent_field = $this->_findFieldByFieldName($form, 'parent_id');
         if ($parent_field !== false) {
             $form->setFieldAttribute('ordering', 'parent_id', $parent_field->id);
         }
     }
     // Thumbnail preview
     $imagelib_field = $this->_findFieldByFieldName($form, 'imagelib');
     // Set additional attribute for the thumbnail select box
     if ($imagelib_field !== false) {
         $form->setFieldAttribute('thumbnail', 'imagelib_id', $imagelib_field->id);
     }
     // Bind the data to the form
     $form->bind($category);
     // Set some form fields manually
     $form->setValue('imagelib', null, $category->catimage_src);
     // Get limitstart from request to set the correct limitstart (page) in usercategories when
     // leaving edit/new mode with save or cancel
     $limitstart = JRequest::getVar('limitstart', null);
     $slimitstart = $limitstart != null ? '&limitstart=' . (int) $limitstart : '';
     $this->assignRef('params', $params);
     $this->assignRef('form', $form);
     $this->assignRef('category', $category);
     $this->assignRef('pathway', $pathway);
     $this->assignRef('modules', $modules);
     $this->assignRef('backtarget', $backtarget);
     $this->assignRef('backtext', $backtext);
     $this->assignRef('numberofpics', $numbers[0]);
     $this->assignRef('numberofhits', $numbers[1]);
     $this->assignRef('slimitstart', $slimitstart);
     parent::display($tpl);
 }
예제 #20
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 public function display($tpl = null)
 {
     $params = $this->_mainframe->getParams();
     // Header and footer
     JoomHelper::prepareParams($params);
     $backtarget = JRoute::_('index.php?view=gallery');
     //see above
     $backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_GALLERY');
     // Get number of images and hits in gallery
     $numbers = JoomHelper::getNumberOfImgHits();
     // Load modules at position 'top'
     $modules['top'] = JoomHelper::getRenderedModules('top');
     if (count($modules['top'])) {
         $params->set('show_top_modules', 1);
     }
     // Load modules at position 'btm'
     $modules['btm'] = JoomHelper::getRenderedModules('btm');
     if (count($modules['btm'])) {
         $params->set('show_btm_modules', 1);
     }
     $type = JRequest::getCmd('type');
     switch ($type) {
         case 'lastcommented':
             $rows = $this->get('LastCommented');
             $title = JText::sprintf('COM_JOOMGALLERY_TOPLIST_LAST_COMMENTED_IMAGE', $this->_config->get('jg_toplist'));
             $pathway = $title;
             break;
         case 'lastadded':
             $rows = $this->get('LastAdded');
             $title = JText::sprintf('COM_JOOMGALLERY_TOPLIST_LAST_ADDED_IMAGE', $this->_config->get('jg_toplist'));
             $pathway = $title;
             break;
         case 'toprated':
             $rows = $this->get('TopRated');
             $title = JText::sprintf('COM_JOOMGALLERY_TOPLIST_BEST_RATED_IMAGE', $this->_config->get('jg_toplist'));
             $pathway = $title;
             break;
         default:
             $rows = $this->get('MostViewed');
             $title = JText::sprintf('COM_JOOMGALLERY_TOPLIST_MOST_VIEWED_IMAGE', $this->_config->get('jg_toplist'));
             $pathway = $title;
             break;
     }
     // Check whether this is the active menu item. This is a
     // special case in addition to code in constructor of parent class
     // because here we have to check the toplist type, too.
     if ($type == 'lastcommented' || $type == 'lastadded' || $type == 'toprated') {
         $active = $this->_mainframe->getMenu()->getActive();
         if (!$active || strpos($active->link, '&type=' . $type) === false) {
             // Get the default layout from the configuration
             if ($layout = $this->_config->get('jg_alternative_layout')) {
                 $this->setLayout($layout);
             }
         }
     }
     // Breadcrumbs
     if ($this->_config->get('jg_completebreadcrumbs')) {
         $breadcrumbs = $this->_mainframe->getPathway();
         $breadcrumbs->addItem($title);
     }
     // Check whether the (comments) data rows where delivered by a plugin
     if (isset($rows[0]->delivered_by_plugin) && $rows[0]->delivered_by_plugin) {
         $params->set('delivered_by_plugin', 1);
     }
     foreach ($rows as $key => $row) {
         $rows[$key]->link = JHTML::_('joomgallery.openimage', $this->_config->get('jg_detailpic_open'), $row);
         $cropx = null;
         $cropy = null;
         $croppos = null;
         if ($this->_config->get('jg_dyncrop')) {
             $cropx = $this->_config->get('jg_dyncropwidth');
             $cropy = $this->_config->get('jg_dyncropheight');
             $croppos = $this->_config->get('jg_dyncropposition');
         }
         $rows[$key]->thumb_src = $this->_ambit->getImg('thumb_url', $row, null, 0, true, $cropx, $cropy, $croppos);
         // Set the title attribute in a tag with title and/or description of image
         // if a box is activated
         if (!is_numeric($this->_config->get('jg_detailpic_open')) || $this->_config->get('jg_detailpic_open') > 1) {
             $rows[$key]->atagtitle = JHTML::_('joomgallery.getTitleforATag', $row);
         } else {
             // Set the imgtitle by default
             $rows[$key]->atagtitle = 'title="' . $row->imgtitle . '"';
         }
         if ($this->_config->get('jg_showauthor')) {
             if ($row->imgauthor) {
                 $rows[$key]->authorowner = $row->imgauthor;
             } else {
                 if ($this->_config->get('jg_showowner')) {
                     $rows[$key]->authorowner = JHTML::_('joomgallery.displayname', $row->owner);
                 } else {
                     $rows[$key]->authorowner = JText::_('COM_JOOMGALLERY_COMMON_NO_DATA');
                 }
             }
         }
         if (!$params->get('delivered_by_plugin')) {
             if ($type == 'lastcommented' && $this->_config->get('jg_showthiscomment')) {
                 if ($row->userid) {
                     $rows[$key]->cmtname = JHTML::_('joomgallery.displayname', $row->userid, false);
                 }
                 $cmttext = $row->cmttext;
                 $cmttext = JoomHelper::processText($cmttext);
                 if ($this->_config->get('jg_bbcodesupport')) {
                     $cmttext = JHTML::_('joomgallery.bbdecode', $cmttext);
                 }
                 if ($this->_config->get('jg_smiliesupport')) {
                     $smileys = JoomHelper::getSmileys();
                     foreach ($smileys as $i => $sm) {
                         $cmttext = str_replace($i, '<img src="' . $sm . '" border="0" alt="' . $i . '" title="' . $i . '" />', $cmttext);
                     }
                 }
                 $cmttext = stripslashes($cmttext);
                 $rows[$key]->processed_cmttext = $cmttext;
             }
         }
         // Show editor links for that image
         $rows[$key]->show_edit_icon = false;
         $rows[$key]->show_delete_icon = false;
         if ($this->_config->get('jg_showtoplisteditorlinks') == 1 && $this->_config->get('jg_userspace') == 1) {
             if ($this->_user->authorise('core.edit', _JOOM_OPTION . '.image.' . $rows[$key]->id) || $this->_user->authorise('core.edit.own', _JOOM_OPTION . '.image.' . $rows[$key]->id) && $rows[$key]->owner && $rows[$key]->owner == $this->_user->get('id')) {
                 $rows[$key]->show_edit_icon = true;
             }
             if ($this->_user->authorise('core.delete', _JOOM_OPTION . '.image.' . $rows[$key]->id)) {
                 $rows[$key]->show_delete_icon = true;
             }
         }
     }
     // Download Icon
     if ($this->_config->get('jg_download') && $this->_config->get('jg_showtoplistdownload')) {
         if ($this->_user->get('id') || $this->_config->get('jg_download_unreg')) {
             $params->set('show_download_icon', 1);
         } else {
             if ($this->_config->get('jg_download_hint')) {
                 $params->set('show_download_icon', -1);
             }
         }
     }
     // Favourites icon
     if (!$params->get('disable_global_info') && $this->_config->get('jg_favourites') && $this->_config->get('jg_showtoplistfavourite')) {
         if ($this->_user->get('id') || $this->_config->get('jg_usefavouritesforpubliczip') == 1 && !$this->_user->get('id')) {
             if ($this->_config->get('jg_usefavouritesforzip') || $this->_config->get('jg_usefavouritesforpubliczip') && !$this->_user->get('id')) {
                 $params->set('show_favourites_icon', 2);
             } else {
                 $params->set('show_favourites_icon', 1);
             }
         } else {
             if ($this->_config->get('jg_favouritesshownotauth') == 1) {
                 if ($this->_config->get('jg_usefavouritesforzip')) {
                     $params->set('show_favourites_icon', -2);
                 } else {
                     $params->set('show_favourites_icon', -1);
                 }
             }
         }
     }
     // Report icon
     if ($this->_config->get('jg_report_images') && $this->_config->get('jg_toplist_report_images')) {
         if ($this->_user->get('id') || $this->_config->get('jg_report_unreg')) {
             $params->set('show_report_icon', 1);
             JHTML::_('behavior.modal');
         } else {
             if ($this->_config->get('jg_report_hint')) {
                 $params->set('show_report_icon', -1);
             }
         }
     }
     // Set redirect url used in editor links to redirect back to favourites view after edit/delete
     $redirect = '&redirect=' . base64_encode(JFactory::getURI()->toString());
     $this->assignRef('params', $params);
     $this->assignRef('rows', $rows);
     $this->assignRef('title', $title);
     $this->assignRef('type', $type);
     $this->assignRef('pathway', $pathway);
     $this->assignRef('modules', $modules);
     $this->assignRef('backtarget', $backtarget);
     $this->assignRef('backtext', $backtext);
     $this->assignRef('numberofpics', $numbers[0]);
     $this->assignRef('numberofhits', $numbers[1]);
     $this->assignRef('redirect', $redirect);
     parent::display($tpl);
 }
예제 #21
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 public function display($tpl = null)
 {
     $params = $this->_mainframe->getParams();
     // Breadcrumbs
     if ($this->_config->get('jg_completebreadcrumbs')) {
         $breadcrumbs = $this->_mainframe->getPathway();
         $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_SEARCH_RESULTS'));
     }
     // Header and footer
     JoomHelper::prepareParams($params);
     $pathway = JText::_('COM_JOOMGALLERY_SEARCH_RESULTS');
     $backtarget = JRoute::_('index.php?view=gallery');
     //see above
     $backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_GALLERY');
     // Get number of images and hits in gallery
     $numbers = JoomHelper::getNumberOfImgHits();
     // Load modules at position 'top'
     $modules['top'] = JoomHelper::getRenderedModules('top');
     if (count($modules['top'])) {
         $params->set('show_top_modules', 1);
     }
     // Load modules at position 'btm'
     $modules['btm'] = JoomHelper::getRenderedModules('btm');
     if (count($modules['btm'])) {
         $params->set('show_btm_modules', 1);
     }
     $sstring = trim(JRequest::getVar('sstring'));
     $rows = array();
     if (!empty($sstring)) {
         $rows = $this->get('SearchResults');
     }
     foreach ($rows as $key => $row) {
         $rows[$key]->link = JHTML::_('joomgallery.openimage', $this->_config->get('jg_detailpic_open'), $row);
         $cropx = null;
         $cropy = null;
         $croppos = null;
         if ($this->_config->get('jg_dyncrop')) {
             $cropx = $this->_config->get('jg_dyncropwidth');
             $cropy = $this->_config->get('jg_dyncropheight');
             $croppos = $this->_config->get('jg_dyncropposition');
         }
         $row->thumb_src = $this->_ambit->getImg('thumb_url', $row, null, 0, true, $cropx, $cropy, $croppos);
         // Set the title attribute in a tag with title and/or description of image
         // if a box is activated
         if (!is_numeric($this->_config->get('jg_detailpic_open')) || $this->_config->get('jg_detailpic_open') > 1) {
             $rows[$key]->atagtitle = JHTML::_('joomgallery.getTitleforATag', $row);
         } else {
             // Set the imgtitle by default
             $rows[$key]->atagtitle = 'title="' . $row->imgtitle . '"';
         }
         if ($this->_config->get('jg_showauthor')) {
             if ($row->imgauthor) {
                 $rows[$key]->authorowner = $row->imgauthor;
             } else {
                 if ($this->_config->get('jg_showowner')) {
                     $rows[$key]->authorowner = JHTML::_('joomgallery.displayname', $row->owner);
                 } else {
                     $rows[$key]->authorowner = JText::_('COM_JOOMGALLERY_COMMON_NO_DATA');
                 }
             }
         }
         // Show editor links for that image
         $rows[$key]->show_edit_icon = false;
         $rows[$key]->show_delete_icon = false;
         if ($this->_config->get('jg_showsearcheditorlinks') == 1 && $this->_config->get('jg_userspace') == 1) {
             if ($this->_user->authorise('core.edit', _JOOM_OPTION . '.image.' . $rows[$key]->id) || $this->_user->authorise('core.edit.own', _JOOM_OPTION . '.image.' . $rows[$key]->id) && $rows[$key]->owner && $rows[$key]->owner == $this->_user->get('id')) {
                 $rows[$key]->show_edit_icon = true;
             }
             if ($this->_user->authorise('core.delete', _JOOM_OPTION . '.image.' . $rows[$key]->id)) {
                 $rows[$key]->show_delete_icon = true;
             }
         }
     }
     // Download icon
     if ($this->_config->get('jg_download') && $this->_config->get('jg_showsearchdownload')) {
         if ($this->_user->get('id') || $this->_config->get('jg_download_unreg')) {
             $params->set('show_download_icon', 1);
         } else {
             if ($this->_config->get('jg_download_hint')) {
                 $params->set('show_download_icon', -1);
             }
         }
     }
     // Favourites icon
     if (!$params->get('disable_global_info') && $this->_config->get('jg_favourites') && $this->_config->get('jg_showsearchfavourite')) {
         if ($this->_user->get('id') || $this->_config->get('jg_usefavouritesforpubliczip') == 1 && !$this->_user->get('id')) {
             if ($this->_config->get('jg_usefavouritesforzip') || $this->_config->get('jg_usefavouritesforpubliczip') && !$this->_user->get('id')) {
                 $params->set('show_favourites_icon', 2);
             } else {
                 $params->set('show_favourites_icon', 1);
             }
         } else {
             if ($this->_config->get('jg_favouritesshownotauth') == 1) {
                 if ($this->_config->get('jg_usefavouritesforzip')) {
                     $params->set('show_favourites_icon', -2);
                 } else {
                     $params->set('show_favourites_icon', -1);
                 }
             }
         }
     }
     // Report icon
     if ($this->_config->get('jg_report_images') && $this->_config->get('jg_search_report_images')) {
         if ($this->_user->get('id') || $this->_config->get('jg_report_unreg')) {
             $params->set('show_report_icon', 1);
             JHTML::_('behavior.modal');
         } else {
             if ($this->_config->get('jg_report_hint')) {
                 $params->set('show_report_icon', -1);
             }
         }
     }
     $uri = JFactory::getURI();
     $uri->setVar('sstring', $sstring);
     $redirect = '&redirect=' . base64_encode($uri->toString());
     $this->assignRef('params', $params);
     $this->assignRef('rows', $rows);
     $this->assignRef('sstring', $sstring);
     $this->assignRef('pathway', $pathway);
     $this->assignRef('modules', $modules);
     $this->assignRef('backtarget', $backtarget);
     $this->assignRef('backtext', $backtext);
     $this->assignRef('numberofpics', $numbers[0]);
     $this->assignRef('numberofhits', $numbers[1]);
     $this->assignRef('redirect', $redirect);
     parent::display($tpl);
 }
예제 #22
0
 /**
  * HTML view display method
  *
  * @access  public
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 function display($tpl = null)
 {
     if (!$this->_config->get('jg_userspace')) {
         $msg = JText::_('JERROR_ALERTNOAUTHOR');
         $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), $msg, 'notice');
     }
     // Additional security check for unregistered users
     if (!$this->_user->get('id') && !$this->_config->get('jg_unregistered_permissions')) {
         $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), JText::_('COM_JOOMGALLERY_COMMON_MSG_YOU_ARE_NOT_LOGGED'), 'notice');
     }
     $params = $this->_mainframe->getParams();
     // Breadcrumbs
     if ($this->_config->get('jg_completebreadcrumbs')) {
         $breadcrumbs = $this->_mainframe->getPathway();
         $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_COMMON_USER_PANEL'), 'index.php?view=userpanel');
         $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_EDIT_EDIT_IMAGE'));
     }
     // Header and footer
     JoomHelper::prepareParams($params);
     $pathway = null;
     if ($this->_config->get('jg_showpathway')) {
         $pathway = '<a href="' . JRoute::_('index.php?view=userpanel') . '">' . JText::_('COM_JOOMGALLERY_COMMON_USER_PANEL') . '</a>';
         $pathway .= ' &raquo; ' . JText::_('COM_JOOMGALLERY_EDIT_EDIT_IMAGE');
     }
     $backtarget = JRoute::_('index.php?view=userpanel');
     //see above
     $backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_USER_PANEL');
     // Get number of images and hits in gallery
     $numbers = JoomHelper::getNumberOfImgHits();
     // Load modules at position 'top'
     $modules['top'] = JoomHelper::getRenderedModules('top');
     if (count($modules['top'])) {
         $params->set('show_top_modules', 1);
     }
     // Load modules at position 'btm'
     $modules['btm'] = JoomHelper::getRenderedModules('btm');
     if (count($modules['btm'])) {
         $params->set('show_btm_modules', 1);
     }
     $image = $this->get('Image');
     // Get the form and fill the fields
     $form = $this->get('Form');
     // Bind the data to the form
     $form->bind($image);
     // Set some form fields manually
     $form->setValue('imagelib', null, $image->thumb_url);
     // Get limitstart from request to set the correct limitstart (page) in userpanel when
     // leaving edit mode with save or cancel
     $limitstart = JRequest::getVar('limitstart', null);
     $slimitstart = $limitstart != null ? '&limitstart=' . (int) $limitstart : '';
     // Get redirect page, if any given by request
     $redirect = JRequest::getVar('redirect', null);
     $redirecturl = '';
     if ($redirect === null) {
         $redirect = '';
     } else {
         $redirecturl = base64_decode($redirect);
         if (!JURI::isInternal($redirecturl)) {
             $redirecturl = '';
             $redirect = '';
         } else {
             $redirect = '&redirect=' . $redirect;
         }
     }
     $this->assignRef('params', $params);
     $this->assignRef('form', $form);
     $this->assignRef('image', $image);
     $this->assignRef('pathway', $pathway);
     $this->assignRef('modules', $modules);
     $this->assignRef('backtarget', $backtarget);
     $this->assignRef('backtext', $backtext);
     $this->assignRef('numberofpics', $numbers[0]);
     $this->assignRef('numberofhits', $numbers[1]);
     $this->assignRef('slimitstart', $slimitstart);
     $this->assignRef('redirect', $redirect);
     $this->assignRef('redirecturl', $redirecturl);
     parent::display($tpl);
 }
예제 #23
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 public function display($tpl = null)
 {
     // Load language files of frontend for Exif and IPTC data
     $language = JFactory::getLanguage();
     $language->load(_JOOM_OPTION . '.exif', JPATH_SITE);
     $language->load(_JOOM_OPTION . '.iptc', JPATH_SITE);
     $display = true;
     if ($this->_config->isExtended()) {
         $config_id = JRequest::getInt('id');
         // Overwrite config object with specified one
         $this->_config = JoomConfig::getInstance($config_id);
         if (JRequest::getInt('group_id') || $config_id && $config_id != 1) {
             $display = false;
         }
     }
     // Check the installation of GD
     $gdver = $this->get('GDVersion');
     // Returns version, 0 if not installed, or -1 if appears
     // to be installed but not verified
     if ($gdver > 0) {
         $gdmsg = JText::sprintf('COM_JOOMGALLERY_CONFIG_GS_IP_GDLIB_INSTALLED', $gdver);
     } else {
         if ($gdver == -1) {
             $gdmsg = JText::_('COM_JOOMGALLERY_CONFIG_GS_IP_GDLIB_NO_VERSION');
         } else {
             $gdmsg = JText::_('COM_JOOMGALLERY_CONFIG_GS_IP_GDLIB_NOT_INSTALLED') . '<a href="http://www.php.net/gd" target="_blank">http://www.php.net/gd</a>' . JText::_('COM_JOOMGALLERY_GD_MORE_INFO');
         }
     }
     // Check the installation of ImageMagick
     // first check if exec() has been diabled in php.ini
     if ($this->get('DisabledExec')) {
         $immsg = JText::_('COM_JOOMGALLERY_CONFIG_GS_IP_IMAGIC_EXEC_DISABLED');
     } else {
         $imver = $this->get('IMVersion');
         // Returns version, 0 if not installed or path not properly configured
         if ($imver) {
             $immsg = JText::_('COM_JOOMGALLERY_CONFIG_GS_IP_IMAGIC_INSTALLED') . $imver;
             // Add the information that IM was detected automatically if path is empty
             if (!$this->_config->get('jg_impath')) {
                 $immsg .= JText::_('COM_JOOMGALLERY_CONFIG_GS_IP_IMAGIC_INSTALLED_AUTO');
             }
         } else {
             $immsg = JText::_('COM_JOOMGALLERY_CONFIG_GS_IP_IMAGIC_NOT_INSTALLED');
         }
     }
     // Check the installation of Exif
     $exifmsg = '';
     if (!extension_loaded('exif')) {
         $exifmsg = '<div style="color:#f00;font-weight:bold; text-align:center;">[' . JText::_('COM_JOOMGALLERY_CONFIG_DV_ED_NOT_INSTALLED') . ' ' . JText::_('COM_JOOMGALLERY_CONFIG_DV_ED_NO_OPTIONS') . ']</div>';
     } else {
         $exifmsg = '<div style="color:#080; text-align:center;">[' . JText::_('COM_JOOMGALLERY_CONFIG_DV_ED_INSTALLED') . ']</div>';
         if (!function_exists('exif_read_data')) {
             $exifmsg = '<div style="color:#f00;font-weight:bold; text-align:center;">[' . JText::_('COM_JOOMGALLERY_CONFIG_DV_ED_INSTALLED_BUT') . ' ' . JText::_('COM_JOOMGALLERY_CONFIG_DV_ED_NO_OPTIONS') . ']</div>';
         }
     }
     // Check pathes and watermark file
     $writeable = '<span style="color:#080;">' . JText::_('COM_JOOMGALLERY_CONFIG_GS_PD_DIRECTORY_WRITEABLE') . '</span>';
     $unwriteable = '<span style="color:#f00;">' . JText::_('COM_JOOMGALLERY_CONFIG_GS_PD_DIRECTORY_UNWRITEABLE') . '</span>';
     if (is_writeable($this->getPath('img'))) {
         $write_pathimages = $writeable;
     } else {
         $write_pathimages = $unwriteable;
     }
     if (is_writeable($this->getPath('orig'))) {
         $write_pathoriginalimages = $writeable;
     } else {
         $write_pathoriginalimages = $unwriteable;
     }
     if (is_writeable($this->getPath('thumb'))) {
         $write_paththumbs = $writeable;
     } else {
         $write_paththumbs = $unwriteable;
     }
     if (is_writeable($this->getPath('ftp'))) {
         $write_pathftpupload = $writeable;
     } else {
         $write_pathftpupload = $unwriteable;
     }
     if (is_writeable($this->getPath('temp'))) {
         $write_pathtemp = $writeable;
     } else {
         $write_pathtemp = $unwriteable;
     }
     if (is_writeable($this->getPath('wtm'))) {
         $write_pathwm = $writeable;
     } else {
         $write_pathwm = $unwriteable;
     }
     if (is_file($this->getPath('wtm') . '/' . $this->_config->get('jg_wmfile'))) {
         $wmfilemsg = '<span style="color:#080;">' . JText::_('COM_JOOMGALLERY_CONFIG_GS_PD_FILE_EXIST') . '</span>';
     } else {
         $wmfilemsg = '<span style="color:#f00;">' . JText::_('COM_JOOMGALLERY_CONFIG_GS_PD_FILE_NOT_EXIST') . '</span>';
     }
     // Check whether CSS file (joom_settings.css) is writeable
     if (is_writeable(JPATH_ROOT . '/media/joomgallery/css/' . $this->_config->getStyleSheetName())) {
         $cssfilemsg = '<div style="color:#080; text-align:center;">[' . JText::_('COM_JOOMGALLERY_CONFIG_GS_PD_CSS_CONFIGURATION_WRITEABLE') . ']</div>';
     } else {
         $cssfilemsg = '<div style="color:#f00;font-weight:bold; text-align:center;">[' . JText::_('COM_JOOMGALLERY_CONFIG_GS_PD_CSS_CONFIGURATION_NOT_WRITEABLE') . ' ' . JText::_('COM_JOOMGALLERY_COMMON_CHECK_PERMISSIONS') . ']</div>';
     }
     // Exif
     require_once JPATH_COMPONENT . '/includes/exifarray.php';
     $ifdotags = explode(',', $this->_config->get('jg_ifdotags'));
     $subifdtags = explode(',', $this->_config->get('jg_subifdtags'));
     $gpstags = explode(',', $this->_config->get('jg_gpstags'));
     $exif_definitions = array(1 => array('TAG' => 'IFD0', 'JG' => $ifdotags, 'NAME' => 'jg_ifdotags[]', 'HEAD' => JText::_('COM_JOOMGALLERY_IFD0TAGS')), 2 => array('TAG' => 'EXIF', 'JG' => $subifdtags, 'NAME' => 'jg_subifdtags[]', 'HEAD' => JText::_('COM_JOOMGALLERY_SUBIFDTAGS')), 3 => array('TAG' => 'GPS', 'JG' => $gpstags, 'NAME' => 'jg_gpstags[]', 'HEAD' => JText::_('COM_JOOMGALLERY_GPSTAGS')));
     // IPTC
     require_once JPATH_COMPONENT . '/includes/iptcarray.php';
     $iptctags = explode(',', $this->_config->get('jg_iptctags'));
     $iptc_definitions = array(1 => array('TAG' => 'IPTC', 'JG' => $iptctags, 'NAME' => 'jg_iptctags[]', 'HEAD' => JText::_('COM_JOOMGALLERY_IPTCTAGS')));
     // Include javascript for form validation, cleaning and submitting
     $this->_doc->addScript($this->_ambit->getScript('config.js'));
     JText::script('COM_JOOMGALLERY_CONFIG_GS_PD_ALERT_THUMBNAIL_PATH_SUPPORT');
     $this->assignRef('display', $display);
     $this->assignRef('cssfilemsg', $cssfilemsg);
     $this->assignRef('exifmsg', $exifmsg);
     $this->assignRef('gdmsg', $gdmsg);
     $this->assignRef('immsg', $immsg);
     $this->assignRef('write_pathimages', $write_pathimages);
     $this->assignRef('write_pathoriginalimages', $write_pathoriginalimages);
     $this->assignRef('write_paththumbs', $write_paththumbs);
     $this->assignRef('write_pathftpupload', $write_pathftpupload);
     $this->assignRef('write_pathtemp', $write_pathtemp);
     $this->assignRef('write_pathwm', $write_pathwm);
     $this->assignRef('wmfilemsg', $wmfilemsg);
     $this->assignRef('exif_definitions', $exif_definitions);
     $this->assignRef('exif_config_array', $exif_config_array);
     $this->assignRef('iptc_definitions', $iptc_definitions);
     $this->assignRef('iptc_config_array', $iptc_config_array);
     $this->addToolbar();
     if (!$this->_mainframe->input->getBool('hidemainmenu')) {
         $this->sidebar = JHtmlSidebar::render();
     }
     parent::display();
 }
예제 #24
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 public function display($tpl = null)
 {
     if (!$this->_config->get('jg_userspace')) {
         $msg = JText::_('JERROR_ALERTNOAUTHOR');
         $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), $msg, 'notice');
     }
     // Additional security check for unregistered users
     if (!$this->_user->get('id') && !$this->_config->get('jg_unregistered_permissions')) {
         $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), JText::_('COM_JOOMGALLERY_COMMON_MSG_YOU_ARE_NOT_LOGGED'), 'notice');
     }
     $params = $this->_mainframe->getParams();
     // Breadcrumbs
     if ($this->_config->get('jg_completebreadcrumbs')) {
         $breadcrumbs = $this->_mainframe->getPathway();
         $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_COMMON_USER_PANEL'));
     }
     // Header and footer
     JoomHelper::prepareParams($params);
     $this->pathway = JText::_('COM_JOOMGALLERY_COMMON_USER_PANEL');
     $this->backtarget = JRoute::_('index.php?view=gallery');
     $this->backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_GALLERY');
     // Get number of images and hits in gallery
     $numbers = JoomHelper::getNumberOfImgHits();
     $this->numberofpics = $numbers[0];
     $this->numberofhits = $numbers[1];
     // Load modules at position 'top'
     $this->modules['top'] = JoomHelper::getRenderedModules('top');
     if (count($this->modules['top'])) {
         $params->set('show_top_modules', 1);
     }
     // Load modules at position 'btm'
     $this->modules['btm'] = JoomHelper::getRenderedModules('btm');
     if (count($this->modules['btm'])) {
         $params->set('show_btm_modules', 1);
     }
     // Display button 'Upload' only if there is at least
     // one category into which the user is allowed to upload
     if ($this->_config->get('jg_disableunrequiredchecks') || count(JoomHelper::getAuthorisedCategories('joom.upload'))) {
         $params->set('show_upload_button', 1);
     } else {
         $params->set('show_upload_button', 0);
     }
     // Display button 'Categories' if the current user is allowed
     // to create categories or if there are categories owned by him
     if ($this->_user->authorise('core.create', _JOOM_OPTION) || $this->_config->get('jg_disableunrequiredchecks') || count(JoomHelper::getAuthorisedCategories('core.create')) || count($this->get('Categories'))) {
         $params->set('show_categories_button', 1);
     } else {
         $params->set('show_categories_button', 0);
     }
     // Get data from the model
     $this->total = $this->get('Total');
     $this->state = $this->get('State');
     if ($this->state->get('list.start') >= $this->total) {
         // This may happen for instance when an image has been deleted on a page with just one entry
         $limitstart = $this->total > 0 && $this->total > $this->state->get('list.limit') ? floor(($this->total - 1) / $this->state->get('list.limit')) * $this->state->get('list.limit') : 0;
         $this->state->set('list.start', $limitstart);
     }
     $this->slimitstart = $this->state->get('list.start') > 0 ? '&limitstart=' . $this->state->get('list.start') : '';
     $this->items = $this->get('Images');
     $this->pagination = $this->get('Pagination');
     if (!$this->total) {
         if ($this->state->get('filter.inuse')) {
             $this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_USERPANEL_MSG_NO_IMAGES_FOUND_MATCHING_YOUR_QUERY'));
         } else {
             // Guests cannot own any images
             if (!$this->_user->get('id')) {
                 $this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_USERPANEL_GUESTS_CANNOT_OWN_IMAGES'));
             } else {
                 $this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_USERPANEL_YOU_DO_NOT_HAVE_IMAGE'));
             }
         }
     }
     $this->lists = array();
     // Filter by type
     $options = array(JHTML::_('select.option', 0, JText::_('COM_JOOMGALLERY_COMMON_SELECT_STATE')), JHTML::_('select.option', 1, JText::_('COM_JOOMGALLERY_COMMON_OPTION_APPROVED_ONLY')), JHTML::_('select.option', 2, JText::_('COM_JOOMGALLERY_COMMON_OPTION_NOT_APPROVED_ONLY')), JHTML::_('select.option', 3, JText::_('COM_JOOMGALLERY_COMMON_OPTION_PUBLISHED_ONLY')), JHTML::_('select.option', 4, JText::_('COM_JOOMGALLERY_COMMON_OPTION_NOT_PUBLISHED_ONLY')));
     $this->lists['filter_state'] = JHTML::_('select.genericlist', $options, 'filter_state', 'class="inputbox" size="1" onchange="form.submit();"', 'value', 'text', $this->state->get('filter.state'));
     foreach ($this->items as $key => &$item) {
         // Set the title attribute in a tag with title and/or description of image
         // if a box is activated
         if (!is_numeric($this->_config->get('jg_detailpic_open')) || $this->_config->get('jg_detailpic_open') > 1) {
             $item->atagtitle = JHTML::_('joomgallery.getTitleforATag', $item);
         } else {
             // Set the imgtitle by default
             $item->atagtitle = 'title="' . $item->imgtitle . '"';
         }
         // Show editor links for that image
         $this->items[$key]->show_edit_icon = false;
         $this->items[$key]->show_delete_icon = false;
         if ($this->_user->authorise('core.edit', _JOOM_OPTION . '.image.' . $this->items[$key]->id) || $this->_user->authorise('core.edit.own', _JOOM_OPTION . '.image.' . $this->items[$key]->id) && $this->items[$key]->owner && $this->items[$key]->owner == $this->_user->get('id')) {
             $this->items[$key]->show_edit_icon = true;
         }
         if ($this->_user->authorise('core.delete', _JOOM_OPTION . '.image.' . $this->items[$key]->id)) {
             $this->items[$key]->show_delete_icon = true;
         }
     }
     $this->params = $params;
     parent::display($tpl);
 }
예제 #25
0
 /**
  * HTML view display method
  *
  * @access  public
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('COM_JOOMGALLERY_MAIMAN_MAINTENANCE_MANAGER'), 'wrench');
     $this->_doc->addStyleDeclaration('    .icon-32-refresh {
   background-image:url(templates/khepri/images/toolbar/icon-32-refresh.png);
 }');
     $lists = array();
     jimport('joomla.html.pane');
     $tabs = array('images' => 0, 'categories' => 1, 'orphans' => 2, 'folders' => 3, 'comments' => 4, 'favourites' => 5, 'nametags' => 6, 'votes' => 7, 'database' => 8);
     $tab = $this->_mainframe->getUserStateFromRequest('joom.maintenance.tab', 'tab', 'images', 'cmd');
     if (!$tab || !isset($tabs[$tab])) {
         $tab = 'images';
     }
     $checked = $this->_mainframe->getUserState('joom.maintenance.checked');
     $state = $this->get('State');
     switch ($tab) {
         case 'categories':
             // Select list of the batch jobs for the categories
             $b_options = array();
             $b_options[] = JHTML::_('select.option', '', JText::_('COM_JOOMGALLERY_MAIMAN_SELECT_JOB'));
             $b_options[] = JHTML::_('select.option', 'setuser', JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_SET_NEW_USER'));
             $b_options[] = JHTML::_('select.option', 'addorphanedfolders', JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_ADD_ORPHANED_FOLDERS'));
             $b_options[] = JHTML::_('select.option', 'create', JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_CREATE_FOLDERS'));
             $b_options[] = JHTML::_('select.option', 'removecategory', JText::_('COM_JOOMGALLERY_MAIMAN_CT_OPTION_REMOVE_CATEGORIES'));
             $lists['cat_jobs'] = JHTML::_('select.genericlist', $b_options, 'job', 'class="inputbox" size="1" onchange="joom_selectbatchjob(this.value);"', 'value', 'text');
             $f_options = array();
             $f_options[] = JHTML::_('select.option', 0, JText::_('COM_JOOMGALLERY_COMMON_OPTION_ALL_CATEGORIES'));
             $f_options[] = JHTML::_('select.option', 1, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_MISSING_THUMB_FOLDER_ONLY'));
             $f_options[] = JHTML::_('select.option', 2, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_MISSING_IMG_FOLDER_ONLY'));
             $f_options[] = JHTML::_('select.option', 3, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_MISSING_ORIG_FOLDER_ONLY'));
             $f_options[] = JHTML::_('select.option', 4, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_MISSING_USER_ONLY'));
             $f_options[] = JHTML::_('select.option', 5, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_MISSING_PARENT_CATEGORY_ONLY'));
             $lists['cat_filter'] = JHTML::_('select.genericlist', $f_options, 'filter_type', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $state->get('filter.type'));
             if (!is_null($checked)) {
                 // Get data from the model
                 $items = $this->get('Categories');
             }
             break;
         case 'orphans':
             // Select list of the batch jobs for the orphans
             $b_options = array();
             $b_options[] = JHTML::_('select.option', '', JText::_('COM_JOOMGALLERY_MAIMAN_SELECT_JOB'));
             $b_options[] = JHTML::_('select.option', 'addorphan', JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_ADD_ORPHANS'));
             $b_options[] = JHTML::_('select.option', 'applysuggestions', JText::_('COM_JOOMGALLERY_MAIMAN_APPLY_SUGGESTIONS'));
             $b_options[] = JHTML::_('select.option', 'deleteorphan', JText::_('COM_JOOMGALLERY_MAIMAN_REMOVE_ORPHANS'));
             $lists['orphan_jobs'] = JHTML::_('select.genericlist', $b_options, 'job', 'class="inputbox" size="1"', 'value', 'text');
             $p_options = array();
             $p_options[] = JHTML::_('select.option', 0, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_ALL_FILES'));
             $p_options[] = JHTML::_('select.option', 1, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_PROPOSAL_AVAILABLE'));
             $p_options[] = JHTML::_('select.option', 2, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_NO_PROPOSAL_AVAILABLE'));
             $lists['orphan_proposal'] = JHTML::_('select.genericlist', $p_options, 'filter_proposal', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $state->get('filter.proposal'));
             $f_options = array();
             $f_options[] = JHTML::_('select.option', 0, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_ALL_FILES'));
             $f_options[] = JHTML::_('select.option', 1, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_TYPE_THUMB_ONLY'));
             $f_options[] = JHTML::_('select.option', 2, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_TYPE_IMG_ONLY'));
             $f_options[] = JHTML::_('select.option', 3, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_TYPE_ORIG_ONLY'));
             $f_options[] = JHTML::_('select.option', 4, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_TYPE_UNKNOWN_ONLY'));
             $lists['orphan_filter'] = JHTML::_('select.genericlist', $f_options, 'filter_type', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $state->get('filter.type'));
             if (!is_null($checked)) {
                 // Get data from the model
                 $items = $this->get('Orphans');
             }
             break;
         case 'folders':
             // Select list of the batch jobs for the orphans
             $b_options = array();
             $b_options[] = JHTML::_('select.option', '', JText::_('COM_JOOMGALLERY_MAIMAN_SELECT_JOB'));
             $b_options[] = JHTML::_('select.option', 'addorphanedfolder', JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_ADD_ORPHANED_FOLDERS'));
             $b_options[] = JHTML::_('select.option', 'applyfoldersuggestions', JText::_('COM_JOOMGALLERY_MAIMAN_APPLY_SUGGESTIONS'));
             $b_options[] = JHTML::_('select.option', 'deleteorphanedfolder', JText::_('COM_JOOMGALLERY_MAIMAN_OF_OPTION_REMOVE_ORPHANED_FOLDERS'));
             $lists['folder_jobs'] = JHTML::_('select.genericlist', $b_options, 'job', 'class="inputbox" size="1"', 'value', 'text');
             $p_options = array();
             $p_options[] = JHTML::_('select.option', 0, JText::_('COM_JOOMGALLERY_MAIMAN_OF_OPTION_ALL_FOLDERS'));
             $p_options[] = JHTML::_('select.option', 1, JText::_('COM_JOOMGALLERY_MAIMAN_OF_OPTION_PROPOSAL_AVAILABLE_FOLDERS'));
             $p_options[] = JHTML::_('select.option', 2, JText::_('COM_JOOMGALLERY_MAIMAN_OF_OPTION_NO_PROPOSAL_AVAILABLE_FOLDERS'));
             $lists['folder_proposal'] = JHTML::_('select.genericlist', $p_options, 'filter_proposal', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $state->get('filter.proposal'));
             $f_options = array();
             $f_options[] = JHTML::_('select.option', 0, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_ALL_FILES'));
             $f_options[] = JHTML::_('select.option', 1, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_TYPE_THUMB_ONLY'));
             $f_options[] = JHTML::_('select.option', 2, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_TYPE_IMG_ONLY'));
             $f_options[] = JHTML::_('select.option', 3, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_TYPE_ORIG_ONLY'));
             $f_options[] = JHTML::_('select.option', 4, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_TYPE_UNKNOWN_ONLY'));
             $lists['folder_filter'] = JHTML::_('select.genericlist', $f_options, 'filter_type', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $state->get('filter.type'));
             if (!is_null($checked)) {
                 // Get data from the model
                 $items = $this->get('OrphanedFolders');
             }
             break;
         default:
             // Select list of the batch jobs for the images
             $b_options = array();
             $b_options[] = JHTML::_('select.option', '', JText::_('COM_JOOMGALLERY_MAIMAN_SELECT_JOB'));
             $b_options[] = JHTML::_('select.option', 'setuser', JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_SET_NEW_USER'));
             $b_options[] = JHTML::_('select.option', 'addorphans', JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_ADD_ORPHANS'));
             $b_options[] = JHTML::_('select.option', 'recreate', JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_RECREATE'));
             $b_options[] = JHTML::_('select.option', 'remove', JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_REMOVE_IMAGES'));
             $lists['img_jobs'] = JHTML::_('select.genericlist', $b_options, 'job', 'class="inputbox" size="1" onchange="joom_selectbatchjob(this.value);"', 'value', 'text');
             $f_options = array();
             $f_options[] = JHTML::_('select.option', 0, JText::_('COM_JOOMGALLERY_COMMON_OPTION_ALL_IMAGES'));
             $f_options[] = JHTML::_('select.option', 1, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_MISSING_THUMB_ONLY'));
             $f_options[] = JHTML::_('select.option', 2, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_MISSING_IMG_ONLY'));
             $f_options[] = JHTML::_('select.option', 3, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_MISSING_ORIG_ONLY'));
             $f_options[] = JHTML::_('select.option', 4, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_MISSING_USER_ONLY'));
             $f_options[] = JHTML::_('select.option', 5, JText::_('COM_JOOMGALLERY_MAIMAN_OPTION_MISSING_CATEGORY_ONLY'));
             $lists['img_filter'] = JHTML::_('select.genericlist', $f_options, 'filter_type', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $state->get('filter.type'));
             if (!is_null($checked)) {
                 // Get data from the model
                 $items = $this->get('Images');
             }
             break;
     }
     if (!is_null($checked)) {
         $this->items = $items;
         $this->pagination = $this->get('Pagination');
         if ($state->get('filter.inuse') && !$this->get('Total')) {
             $this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_MAIMAN_MSG_NO_ITEMS_FOUND_MATCHING_YOUR_QUERY'));
         }
     }
     $information = $this->get('Information');
     $warning = '<img src="' . $this->_ambit->getIcon('error.png') . '" border="0" alt="Warning" height="11" width="11" />';
     foreach ($information as $key => $found) {
         if ($found) {
             $information[$key] = '&nbsp;' . $warning;
         } else {
             $information[$key] = '';
         }
     }
     $this->assignRef('current_tab', $tab);
     $this->assignRef('startOffset', $tabs[$tab]);
     $this->assignRef('checked', $checked);
     $this->assignRef('information', $information);
     $this->assignRef('lists', $lists);
     $this->assignRef('state', $state);
     $this->_doc->addScript($this->_ambit->getScript('maintenance.js'));
     // Language
     JText::script('COM_JOOMGALLERY_MAIMAN_ALERT_RESET_VOTES_CONFIRM');
     JText::script('COM_JOOMGALLERY_MAIMAN_CM_ALERT_RESET_COMMENTS_CONFIRM');
     JText::script('COM_JOOMGALLERY_MAIMAN_FV_ALERT_RESET_FAVOURITES_CONFIRM');
     JText::script('COM_JOOMGALLERY_MAIMAN_NT_ALERT_RESET_NAMETAGS_CONFIRM');
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
예제 #26
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 public function display($tpl = null)
 {
     $params = $this->_mainframe->getParams();
     // Prepare params for header and footer
     JoomHelper::prepareParams($params);
     // Load modules at position 'top'
     $modules['top'] = JoomHelper::getRenderedModules('top');
     if (count($modules['top'])) {
         $params->set('show_top_modules', 1);
     }
     // Load modules at position 'btm'
     $modules['btm'] = JoomHelper::getRenderedModules('btm');
     if (count($modules['btm'])) {
         $params->set('show_btm_modules', 1);
     }
     // Check whether this is the active menu item. This is a
     // special case in addition to code in constructor of parent class
     // because here we have to check the category ID, too.
     $active = $this->_mainframe->getMenu()->getActive();
     if (!$active || strpos($active->link, '&catid=' . JRequest::getInt('catid')) === false) {
         // Get the default layout from the configuration
         if ($layout = $this->_config->get('jg_alternative_layout')) {
             $this->setLayout($layout);
         }
     }
     // Get number of images and hits in gallery
     $numbers = JoomHelper::getNumberOfImgHits();
     // Categories pagination
     if ($this->_config->get('jg_hideemptycats') == 2) {
         $totalcategories =& $this->get('TotalCategoriesWithoutEmpty');
     } else {
         $totalcategories = $this->get('TotalCategories');
     }
     // Calculation of the number of total pages
     $catperpage = $this->_config->get('jg_subperpage');
     if (!$catperpage) {
         $catperpage = 10;
     }
     $cattotalpages = floor($totalcategories / $catperpage);
     $offcut = $totalcategories % $catperpage;
     if ($offcut > 0) {
         $cattotalpages++;
     }
     $total = $totalcategories;
     $totalcategories = number_format($totalcategories, 0, ',', '.');
     // Get the current page
     $catpage = JRequest::getInt('catpage', 0);
     if ($catpage > $cattotalpages) {
         $catpage = $cattotalpages;
         if ($catpage <= 0) {
             $catpage = 1;
         }
     } else {
         if ($catpage < 1) {
             $catpage = 1;
         }
     }
     // Limitstart
     $limitstart = ($catpage - 1) * $catperpage;
     JRequest::setVar('catlimitstart', $limitstart);
     require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/pagination.php';
     $this->catpagination = new JoomPagination($total, $limitstart, $catperpage, 'cat', 'subcategory');
     if ($cattotalpages > 1 && $totalcategories != 0) {
         if ($this->_config->get('jg_showpagenavsubs') <= 2) {
             $params->set('show_pagination_cat_top', 1);
         }
         if ($this->_config->get('jg_showpagenavsubs') >= 2) {
             $params->set('show_pagination_cat_bottom', 1);
         }
     }
     // Displaying of category number depends on pagination position
     if ($this->_config->get('jg_showsubcatcount')) {
         if ($this->_config->get('jg_showpagenavsubs') <= 2) {
             $params->set('show_count_cat_top', 1);
         }
         if ($this->_config->get('jg_showpagenavsubs') >= 2) {
             $params->set('show_count_cat_bottom', 1);
         }
     }
     // Images pagination
     $totalimages = $this->get('TotalImages');
     // Calculation of the number of total pages
     $perpage = $this->_config->get('jg_perpage');
     if (!$perpage) {
         $perpage = 10;
     }
     $totalpages = floor($totalimages / $perpage);
     $offcut = $totalimages % $perpage;
     if ($offcut > 0) {
         $totalpages++;
     }
     $total = $totalimages;
     $totalimages = number_format($totalimages, 0, ',', '.');
     // Get the current page
     $page = JRequest::getInt('page', 0);
     if ($page > $totalpages) {
         $page = $totalpages;
         if ($page <= 0) {
             $page = 1;
         }
     } else {
         if ($page < 1) {
             $page = 1;
         }
     }
     // Limitstart
     $limitstart = ($page - 1) * $perpage;
     $this->pagination = new JoomPagination($total, $limitstart, $perpage);
     // 'jg_detailpic_open' is not numeric if an OpenImage plugin was selected, thus we handle it like > 4
     if ($this->_config->get('jg_lightbox_slide_all') && (!is_numeric($this->_config->get('jg_detailpic_open')) || $this->_config->get('jg_detailpic_open') > 4)) {
         $params->set('show_all_in_popup', 1);
         JRequest::setVar('limitstart', -1);
         // We need all images of this category
         $images = $this->get('Images');
         $popup = array();
         $end = ($page - 1) * $perpage;
         $start = $page * $perpage;
         $popup['before'] = JHTML::_('joomgallery.popup', $images, 0, $end);
         $popup['after'] = JHTML::_('joomgallery.popup', $images, $start);
         $this->assignRef('popup', $popup);
         // Now we have to select the images according to the pagination
         $images = array_slice($images, $limitstart, $perpage);
     } else {
         JRequest::setVar('limitstart', $limitstart);
         JRequest::setVar('limit', $this->_config->get('jg_perpage'));
         $images = $this->get('Images');
     }
     if ($totalpages > 1 && $totalimages != 0) {
         if ($this->_config->get('jg_showpagenav') <= 2) {
             $params->set('show_pagination_img_top', 1);
         }
         if ($this->_config->get('jg_showpagenav') >= 2) {
             $params->set('show_pagination_img_bottom', 1);
         }
     }
     // Displaying of image number depends on pagination position
     if ($this->_config->get('jg_showpiccount')) {
         if ($this->_config->get('jg_showpagenav') <= 2) {
             $params->set('show_count_img_top', 1);
         }
         if ($this->_config->get('jg_showpagenav') >= 2) {
             $params->set('show_count_img_bottom', 1);
         }
     }
     $cat = $this->get('Category');
     if (isset($cat->protected)) {
         $this->cat = $cat;
         echo $this->loadTemplate('password');
         return;
     }
     $backlink = array();
     if ($cat->parent_id > 1) {
         // Sub-category -> parent category
         $backlink[0] = JRoute::_('index.php?view=category&catid=' . $cat->parent_id);
         $backlink[1] = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_CATEGORY');
     } else {
         // Category view -> gallery view
         $backlink[0] = JRoute::_('index.php?view=gallery');
         $backlink[1] = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_GALLERY');
     }
     // Meta data
     if ($cat->metadesc) {
         $this->_doc->setDescription($cat->metadesc);
     }
     if ($cat->metakey) {
         $this->_doc->setMetadata('keywords', $cat->metakey);
     }
     /*if($this->_mainframe->getCfg('MetaAuthor') == '1' && $cat->author)
       {
         $this->_doc->setMetaData('author', $cat->author);
       }*/
     // Breadcrumbs
     if ($this->_config->get('jg_completebreadcrumbs') || $this->_config->get('jg_showpathway')) {
         $parents = JoomHelper::getAllParentCategories($cat->cid);
     }
     $menus = $this->_mainframe->getMenu();
     $menu = $menus->getActive();
     if ($menu && array_key_exists('view', $menu->query) && $this->_config->get('jg_completebreadcrumbs')) {
         $breadcrumbs = $this->_mainframe->getPathway();
         switch ($menu->query['view']) {
             case '':
             case 'gallery':
                 foreach ($parents as $parent) {
                     $breadcrumbs->addItem($parent->name, 'index.php?view=category&catid=' . $parent->cid);
                 }
                 $breadcrumbs->addItem($cat->name);
                 break;
             case 'category':
                 $skip = true;
                 foreach ($parents as $key => $parent) {
                     if ($skip) {
                         if ($key == $menu->query['catid']) {
                             $skip = false;
                         }
                     } else {
                         $breadcrumbs->addItem($parent->name, 'index.php?view=category&catid=' . $parent->cid);
                     }
                 }
                 if (!$skip) {
                     $breadcrumbs->addItem($cat->name);
                 }
                 break;
             default:
                 break;
         }
     }
     /*if($this->_config->get('jg_completebreadcrumbs'))
         {
           $breadcrumbs  = &$this->_mainframe->getPathway();
     
           foreach($parents as $parent)
           {
             $breadcrumbs->addItem($parent->name, 'index.php?view=category&catid='.$parent->cid);
           }
     
           $breadcrumbs->addItem($cat->name);
         }*/
     // JoomGallery Pathway
     $pathway = '';
     if ($this->_config->get('jg_showpathway')) {
         $pathway = '<a href="' . JRoute::_('index.php?view=gallery') . '" class="jg_pathitem">' . JText::_('COM_JOOMGALLERY_COMMON_HOME') . '</a> &raquo; ';
         foreach ($parents as $parent) {
             $pathway .= '<a href="' . JRoute::_('index.php?view=category&catid=' . $parent->cid) . '" class="jg_pathitem">' . $parent->name . '</a> &raquo; ';
         }
         $pathway .= $cat->name;
     }
     // Page title
     if ($this->_config->get('jg_pagetitle_cat')) {
         $pagetitle = JoomHelper::createPagetitle($this->_config->get('jg_pagetitle_cat'), $cat->name, '', $params->get('page_title') ? $params->get('page_title') : JText::_('COM_JOOMGALLERY_COMMON_GALLERY'));
         $this->_doc->setTitle($pagetitle);
     }
     // RSS feed
     if ($this->_config->get('jg_category_rss')) {
         $link = '&format=feed&limitstart=';
         $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
         $this->_doc->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
         $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
         $this->_doc->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
         if ($this->_config->get('jg_category_rss_icon')) {
             $params->set('show_feed_icon', 1);
             $params->set('feed_url', JRoute::_($link . '&type=' . $this->_config->get('jg_category_rss_icon')));
         }
     }
     // Favourites icon for categories
     if ($this->_config->get('jg_allimagesofcategory') && $this->_config->get('jg_favourites')) {
         if ($this->_user->get('id') || $this->_config->get('jg_usefavouritesforpubliczip') == 1 && !$this->_user->get('id')) {
             if ($this->_config->get('jg_usefavouritesforzip') || $this->_config->get('jg_usefavouritesforpubliczip') && !$this->_user->get('id')) {
                 $params->set('show_headerfavourites_icon', 2);
             } else {
                 $params->set('show_headerfavourites_icon', 1);
             }
         } else {
             if ($this->_config->get('jg_favouritesshownotauth') == 1) {
                 if ($this->_config->get('jg_usefavouritesforzip')) {
                     $params->set('show_headerfavourites_icon', -2);
                 } else {
                     $params->set('show_headerfavourites_icon', -1);
                 }
             }
         }
     }
     // Icon for quick upload
     if ($this->_config->get('jg_uploadiconcategory') && ($this->_user->authorise('joom.upload', _JOOM_OPTION . '.category.' . $cat->cid) || $cat->owner && $cat->owner == $this->_user->get('id') && $this->_user->authorise('joom.upload.inown', _JOOM_OPTION . '.category.' . $cat->cid))) {
         $params->set('show_upload_icon', 1);
         JHtml::_('behavior.modal');
     }
     // Get all sub-categories of the current category
     if ($this->_config->get('jg_hideemptycats') == 2) {
         // If the third alternative for hiding empty categories
         // is chosen ('Also those which contain empty sub-categories'),
         // we need additional code to exclude these categories.
         // (For the second alternative only the query in the model is modified.)
         $categories =& $this->get('CategoriesWithoutEmpty');
     } else {
         $categories = $this->get('Categories');
     }
     foreach ($categories as $key => $category) {
         $categories[$key]->isnew = '';
         if ($this->_config->get('jg_showcatasnew')) {
             // Check if an image in this category or in sub-categories is marked with 'new'
             $categories[$key]->isnew = JoomHelper::checkNewCatg($categories[$key]->cid);
         }
         // Count the images in category and sub-categories
         $imgshits = JoomHelper::getNumberOfImgHits($categories[$key]->cid);
         $categories[$key]->pictures = $imgshits[0];
         if ($categories[$key]->pictures == '1') {
             $categories[$key]->picorpics = 'COM_JOOMGALLERY_GALLERY_ONE_IMAGE';
         } else {
             $categories[$key]->picorpics = 'COM_JOOMGALLERY_GALLERY_IMAGES';
         }
         // Count the hits of all images in category and sub-categories
         $categories[$key]->totalhits = $imgshits[1];
         $category->thumb_src = null;
         $category->gallerycontainer = 'jg_subcatelem_cat';
         $category->photocontainer = 'jg_subcatelem_photo';
         $category->textcontainer = 'jg_subcatelem_txt';
         if ($this->_config->get('jg_showsubthumbs') > 0 && in_array($categories[$key]->access, $this->_user->getAuthorisedViewLevels())) {
             if ($this->_config->get('jg_showsubthumbs') == 2 || $this->_config->get('jg_showsubthumbs') == 3 && (!$categories[$key]->thumbnail || !isset($categories[$key]->id))) {
                 // Random choice of category/thumbnail
                 switch ($this->_config->get('jg_showrandomsubthumb')) {
                     // Only from current category
                     case 1:
                         $random_catid = $category->cid;
                         break;
                         // Only from sub-categories
                     // Only from sub-categories
                     case 2:
                         // Get array of all sub-categories without the current category
                         // Only with images
                         $allsubcats = JoomHelper::getAllSubCategories($category->cid, false);
                         if (count($allsubcats)) {
                             $random_catid = $allsubcats[mt_rand(0, count($allsubcats) - 1)];
                         } else {
                             $random_catid = 0;
                         }
                         break;
                         // From both
                     // From both
                     case 3:
                         // Get array of all sub-categories including the current category
                         // Only with images
                         $allsubcats = JoomHelper::getAllSubCategories($category->cid, true);
                         if (count($allsubcats)) {
                             $random_catid = $allsubcats[mt_rand(0, count($allsubcats) - 1)];
                         } else {
                             $random_catid = 0;
                         }
                         break;
                     default:
                         $random_catid = 0;
                         break;
                 }
                 // Random image, only if there are $randomcat(s)
                 if ($this->_config->get('jg_showrandomsubthumb') == 1 || $this->_config->get('jg_showrandomsubthumb') >= 2 && $random_catid != 0) {
                     $model = $this->getModel();
                     if ($row = $model->getRandomImage($category->cid, $random_catid)) {
                         $cropx = null;
                         $cropy = null;
                         $croppos = null;
                         if ($this->_config->get('jg_dyncrop')) {
                             $cropx = $this->_config->get('jg_dyncropwidth');
                             $cropy = $this->_config->get('jg_dyncropheight');
                             $croppos = $this->_config->get('jg_dyncropposition');
                         }
                         $categories[$key]->thumb_src = $this->_ambit->getImg('thumb_url', $row, null, 0, true, $cropx, $cropy, $croppos);
                         // Store the image id for later skipping the category view
                         if (isset($row->catid) && $categories[$key]->cid == $row->catid) {
                             $categories[$key]->dtlimgid = $row->id;
                         }
                     }
                 }
             } else {
                 // Check if there's a category thumbnail selected
                 // 'isset' checks whether it is a valid image which we are allowed to display
                 if ($categories[$key]->thumbnail && isset($categories[$key]->id)) {
                     $cropx = null;
                     $cropy = null;
                     $croppos = null;
                     if ($this->_config->get('jg_dyncrop')) {
                         $cropx = $this->_config->get('jg_dyncropwidth');
                         $cropy = $this->_config->get('jg_dyncropheight');
                         $croppos = $this->_config->get('jg_dyncropposition');
                     }
                     $categories[$key]->thumb_src = $this->_ambit->getImg('thumb_url', $categories[$key], null, 0, true, $cropx, $cropy, $croppos);
                     if (!$categories[$key]->imghidden && isset($categories[$key]->catid) && $categories[$key]->cid == $categories[$key]->catid) {
                         // Store the image id for later skipping the category view
                         $categories[$key]->dtlimgid = $categories[$key]->id;
                     }
                     // Own choice of alignment
                     switch ($categories[$key]->img_position) {
                         // Left
                         case 0:
                             $categories[$key]->photocontainer = 'jg_subcatelem_photo_l';
                             $categories[$key]->textcontainer = 'jg_subcatelem_txt_l';
                             break;
                             // Right
                         // Right
                         case 1:
                             $categories[$key]->gallerycontainer = 'jg_subcatelem_cat_r';
                             $categories[$key]->photocontainer = 'jg_subcatelem_photo_r';
                             $categories[$key]->textcontainer = 'jg_subcatelem_txt_r';
                             break;
                             // Centered
                         // Centered
                         case 2:
                             $categories[$key]->photocontainer = 'jg_subcatelem_photo_c';
                             $categories[$key]->textcontainer = 'jg_subcatelem_txt_c';
                             break;
                         default:
                             // Use global settings: The default classes are used
                             if ($this->_config->get('jg_subcatthumbalign') != 1) {
                                 $gallerycontainer = 'jg_subcatelem_cat_r';
                             }
                             break;
                     }
                 }
             }
         }
         // Set the href url for the <a>-Tag, dependent on setting in
         // jg_skipcatview
         // link to category view or directly to detail view if the category
         // doesn't contain other categories
         if ($this->_config->get('jg_skipcatview')) {
             // Get subcategories from category
             $allsubcats = JoomHelper::getAllSubCategories($categories[$key]->cid, false);
             // Link to category view if there are any viewable subcategories
             // otherwise to detail view
             if (count($allsubcats)) {
                 $categories[$key]->link = JRoute::_('index.php?view=category&catid=' . $category->cid);
             } else {
                 // Try to set link to detail view
                 // get link with the help of model if
                 // 1) view of thumb in configuration deactivated
                 // 2) view of thumb activated but no thumb setted for category
                 if ($this->_config->get('jg_showsubthumbs') == 0 || $this->_config->get('jg_showsubthumbs') != 0 && !isset($categories[$key]->dtlimgid)) {
                     // Get the model
                     $categoryModel = $this->getModel();
                     // Get the id of image
                     $image = $categoryModel->getImageCat($categories[$key]->cid);
                     // Set the id of image for the link to detail view
                     if (isset($image)) {
                         $categories[$key]->dtlimgid = $image;
                     }
                 }
                 // Check the id of image setted before
                 if (isset($categories[$key]->dtlimgid)) {
                     // Set link to detail view
                     $categories[$key]->link = JHTML::_('joomgallery.openimage', $this->_config->get('jg_detailpic_open'), $categories[$key]->dtlimgid);
                     // If category view is skipped we display the favourites icon for adding all images at the thumbnail.
                     // Calculations for that have already been done for the favourites icon in the header
                     $categories[$key]->show_favourites_icon = $params->get('show_headerfavourites_icon');
                 } else {
                     $categories[$key]->link = JRoute::_('index.php?view=category&catid=' . $category->cid);
                 }
             }
         } else {
             // Set link to category view if no skipping
             $categories[$key]->link = JRoute::_('index.php?view=category&catid=' . $category->cid);
         }
         // Icon for quick upload at sub-category thumbnail
         if ($this->_config->get('jg_uploadiconsubcat') && ($this->_user->authorise('joom.upload', _JOOM_OPTION . '.category.' . $category->cid) || $category->owner && $category->owner == $this->_user->get('id') && $this->_user->authorise('joom.upload.inown', _JOOM_OPTION . '.category.' . $category->cid))) {
             $categories[$key]->show_upload_icon = true;
             JHtml::_('behavior.modal');
         }
         $categories[$key]->event = new stdClass();
         // Additional HTML added by plugins
         $results = $this->_mainframe->triggerEvent('onJoomAfterDisplayCatThumb', array($category->cid));
         $categories[$key]->event->afterDisplayCatThumb = trim(implode('', $results));
         /*// Additional icons added by plugins
           $results  = $this->_mainframe->triggerEvent('onJoomDisplayIcons', array('category.category', $category));
           $categories[$key]->event->icons                 = trim(implode('', $results));*/
     }
     // Download icon
     if ($this->_config->get('jg_download') && $this->_config->get('jg_showcategorydownload')) {
         if ($this->_user->get('id') || $this->_config->get('jg_download_unreg')) {
             $params->set('show_download_icon', 1);
         } else {
             if ($this->_config->get('jg_download_hint')) {
                 $params->set('show_download_icon', -1);
             }
         }
     }
     // Favourites icon
     if (!$params->get('disable_global_info') && $this->_config->get('jg_favourites') && $this->_config->get('jg_showcategoryfavourite')) {
         if ($this->_user->get('id') || $this->_config->get('jg_usefavouritesforpubliczip') == 1 && !$this->_user->get('id')) {
             if ($this->_config->get('jg_usefavouritesforzip') || $this->_config->get('jg_usefavouritesforpubliczip') && !$this->_user->get('id')) {
                 $params->set('show_favourites_icon', 2);
             } else {
                 $params->set('show_favourites_icon', 1);
             }
         } else {
             if ($this->_config->get('jg_favouritesshownotauth') == 1) {
                 if ($this->_config->get('jg_usefavouritesforzip')) {
                     $params->set('show_favourites_icon', -2);
                 } else {
                     $params->set('show_favourites_icon', -1);
                 }
             }
         }
     }
     // Report icon
     if ($this->_config->get('jg_report_images') && $this->_config->get('jg_category_report_images')) {
         if ($this->_user->get('id') || $this->_config->get('jg_report_unreg')) {
             $params->set('show_report_icon', 1);
             JHTML::_('behavior.modal');
         } else {
             if ($this->_config->get('jg_report_hint')) {
                 $params->set('show_report_icon', -1);
             }
         }
     }
     foreach ($images as $key => $image) {
         $cropx = null;
         $cropy = null;
         $croppos = null;
         if ($this->_config->get('jg_dyncrop')) {
             $cropx = $this->_config->get('jg_dyncropwidth');
             $cropy = $this->_config->get('jg_dyncropheight');
             $croppos = $this->_config->get('jg_dyncropposition');
             $images[$key]->imgwh = 'width="' . $cropx . '" height="' . $cropy . '"';
         } else {
             // Get dimensions for width and height attribute in img tag
             $imgwh = getimagesize($this->_ambit->getImg('thumb_path', $image));
             $images[$key]->imgwh = $imgwh[3];
         }
         $images[$key]->thumb_src = $this->_ambit->getImg('thumb_url', $image, null, 0, true, $cropx, $cropy, $croppos);
         if ($this->_config->get('jg_showpicasnew')) {
             $images[$key]->isnew = JoomHelper::checkNew($image->imgdate, $this->_config->get('jg_daysnew'));
         }
         $images[$key]->link = JHTML::_('joomgallery.openimage', $this->_config->get('jg_detailpic_open'), $image);
         if ($this->_config->get('jg_showauthor')) {
             if ($image->imgauthor) {
                 $images[$key]->authorowner = $image->imgauthor;
             } else {
                 if ($this->_config->get('jg_showowner')) {
                     $images[$key]->authorowner = JHTML::_('joomgallery.displayname', $image->owner);
                 } else {
                     $images[$key]->authorowner = JText::_('COM_JOOMGALLERY_COMMON_NO_DATA');
                 }
             }
         }
         // Show editor links for that image
         $images[$key]->show_edit_icon = false;
         $images[$key]->show_delete_icon = false;
         if ($this->_config->get('jg_showcategoryeditorlinks') == 1 && $this->_config->get('jg_userspace') == 1) {
             if ($this->_user->authorise('core.edit', _JOOM_OPTION . '.image.' . $images[$key]->id) || $this->_user->authorise('core.edit.own', _JOOM_OPTION . '.image.' . $images[$key]->id) && $images[$key]->owner && $images[$key]->owner == $this->_user->get('id')) {
                 $images[$key]->show_edit_icon = true;
             }
             if ($this->_user->authorise('core.delete', _JOOM_OPTION . '.image.' . $images[$key]->id)) {
                 $images[$key]->show_delete_icon = true;
             }
         }
         // Set the title attribute in a tag with title and/or description of image
         // if a box is activated
         if (!is_numeric($this->_config->get('jg_detailpic_open')) || $this->_config->get('jg_detailpic_open') > 1) {
             $images[$key]->atagtitle = JHTML::_('joomgallery.getTitleforATag', $images[$key]);
         } else {
             // Set the imgtitle by default
             $images[$key]->atagtitle = 'title="' . $images[$key]->imgtitle . '"';
         }
         $images[$key]->event = new stdClass();
         // Additional HTML added by plugins
         $results = $this->_mainframe->triggerEvent('onJoomAfterDisplayThumb', array($image->id));
         $images[$key]->event->afterDisplayThumb = trim(implode('', $results));
         // Additional icons added by plugins
         $results = $this->_mainframe->triggerEvent('onJoomDisplayIcons', array('category.image', $image));
         $images[$key]->event->icons = trim(implode('', $results));
         // Check if there are any elements beside the image to be shown
         // if not deactivate the output of corresponding html tags in template
         // to avoid empty div/ul/li
         if (!$this->_config->get('jg_showtitle') && !$this->_config->get('jg_showpicasnew') && !$this->_config->get('jg_showhits') && !$this->_config->get('jg_showdownloads') && !$this->_config->get('jg_showauthor') && !$this->_config->get('jg_showcatcom') && !$this->_config->get('jg_showcatrate') && (!$this->_config->get('jg_showcatdescription') || $this->_config->get('jg_showcatdescription') && !$images[$key]->imgtext) && !$params->get('show_download_icon') && !$params->get('show_favourites_icon') && !$params->get('show_report_icon') && (!$this->_config->get('jg_showcategoryeditorlinks') || $this->_config->get('jg_showcategoryeditorlinks') && !$images[$key]->show_delete_icon && !$images[$key]->show_edit_icon) && !$images[$key]->event->afterDisplayThumb && !$images[$key]->event->icons) {
             $images[$key]->show_elems = false;
         } else {
             $images[$key]->show_elems = true;
         }
     }
     if ($this->_config->get('jg_cooliris') && count($images)) {
         $href = JRoute::_('index.php?view=category&catid=' . $cat->cid . '&page=' . $page . '&format=raw');
         $attribs = array('id' => 'gallery', 'type' => 'application/rss+xml', 'title' => 'Cooliris');
         $this->_doc->addHeadLink($href, 'alternate', 'rel', $attribs);
         if ($this->_config->get('jg_coolirislink')) {
             $this->_doc->addScript('http://lite.piclens.com/current/piclens.js');
         }
     }
     if ($this->_config->get('jg_usercatorder') && count($images)) {
         $orderby = $this->_mainframe->getUserStateFromRequest('joom.category.images.orderby', 'orderby');
         $orderdir = $this->_mainframe->getUserStateFromRequest('joom.category.images.orderdir', 'orderdir');
         // If subcategory navigation active insert current subcategory startpage
         if ($catpage > 1) {
             $sort_url = JRoute::_('index.php?view=category&catid=' . $cat->cid . '&catpage=' . $catpage) . JHTML::_('joomgallery.anchor', 'category');
         } else {
             $sort_url = JRoute::_('index.php?view=category&catid=' . $cat->cid) . JHTML::_('joomgallery.anchor', 'category');
         }
         $this->assignRef('sort_url', $sort_url);
         $this->assignRef('order_by', $orderby);
         $this->assignRef('order_dir', $orderdir);
     }
     // Set redirect url used in editor links to redirect back to favourites view after edit/delete
     $redirect = '&redirect=' . base64_encode(JFactory::getURI()->toString());
     $this->assignRef('params', $params);
     $this->assignRef('category', $cat);
     $this->assignRef('images', $images);
     $this->assignRef('categories', $categories);
     $this->assignRef('totalimages', $totalimages);
     $this->assignRef('totalpages', $totalpages);
     $this->assignRef('page', $page);
     $this->assignRef('totalcategories', $totalcategories);
     $this->assignRef('cattotalpages', $cattotalpages);
     $this->assignRef('catpage', $catpage);
     $this->assignRef('pathway', $pathway);
     $this->assignRef('modules', $modules);
     $this->assignRef('backtarget', $backlink[0]);
     $this->assignRef('backtext', $backlink[1]);
     $this->assignRef('numberofpics', $numbers[0]);
     $this->assignRef('numberofhits', $numbers[1]);
     $this->assignRef('redirect', $redirect);
     parent::display($tpl);
 }
예제 #27
0
 /**
  * HTML view display method
  *
  * @access  public
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 function display($tpl = null)
 {
     JForm::addFormPath(JPATH_COMPONENT_ADMINISTRATOR . '/models/forms');
     // Initialise some variables
     $this->page = 1;
     $this->e_name = $this->_mainframe->getUserStateFromRequest('joom.mini.e_name', 'e_name', 'text', 'string');
     $this->images_fields = array('type', 'position', 'linked', 'linked_type', 'alttext', 'class', 'linkedtext');
     $this->extended = $this->_mainframe->getUserStateFromRequest('joom.mini.extended', 'extended', 1, 'int');
     $this->upload_catid = $this->_mainframe->input->getInt('upload_category');
     $this->prefix = $this->_mainframe->getUserStateFromRequest('joom.mini.prefix', 'prefix', 'joom', 'cmd');
     // Decide which tabs have to be displayed
     $this->tabs = array('images' => true);
     if ($this->extended > 0) {
         $this->tabs = array('images' => true, 'categories' => true, 'upload' => true, 'createcategory' => true);
     }
     if ($this->upload_catid) {
         $this->tabs = array('upload' => true);
     }
     // Images tab
     if (isset($this->tabs['images'])) {
         // Also display the options for inserting images into articles
         if ($this->extended > 0) {
             $plugin = JPluginHelper::getPlugin('content', 'joomplu');
             if (!$this->upload_catid && !count($plugin)) {
                 $this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_MINI_MSG_NOT_INSTALLED_OR_ACTIVATED'), 'notice');
                 $params = '';
             } else {
                 $params = $plugin->params;
             }
             // Load plugin parameters
             $this->params = new JRegistry();
             $this->params->loadString($params);
             $this->images_form = JForm::getInstance(_JOOM_OPTION . '.mini.images', 'mini.images');
             $fields_default_values = array('type' => 'thumb', 'position' => '', 'linked' => 0, 'linked_type' => 'orig', 'alttext' => '', 'class' => '', 'linkedtext' => '');
             foreach ($this->images_fields as $field) {
                 $this->images_form->setFieldAttribute($field, 'default', $this->params->get('default_' . $field, $fields_default_values[$field]));
             }
             // Hidden images
             $this->_mainframe->setUserState('joom.mini.showhidden', $this->params->get('showhidden'));
         }
         // Pagination
         $this->total = $this->get('TotalImages');
         // Calculation of the number of total pages
         $limit = $this->_mainframe->getUserStateFromRequest('joom.mini.limit', 'limit', 30, 'int');
         if (!$limit) {
             $this->totalpages = 1;
         } else {
             $this->totalpages = floor($this->total / $limit);
             $offcut = $this->total % $limit;
             if ($offcut > 0) {
                 $this->totalpages++;
             }
         }
         $totalimages = $this->total;
         $this->total = number_format($this->total, 0, JText::_('COM_JOOMGALLERY_COMMON_DECIMAL_SEPARATOR'), JText::_('COM_JOOMGALLERY_COMMON_THOUSANDS_SEPARATOR'));
         // Get the current page
         $this->page = JRequest::getInt('page', 0);
         if ($this->page > $this->totalpages) {
             $this->page = $this->totalpages;
         }
         if ($this->page < 1) {
             $this->page = 1;
         }
         // Limitstart
         $limitstart = ($this->page - 1) * $limit;
         JRequest::setVar('limitstart', $limitstart);
         if ($this->total <= $limit) {
             $limitstart = 0;
             JRequest::setVar('limitstart', $limitstart);
         }
         JRequest::setVar('limit', $limit);
         require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/pagination.php';
         $onclick = 'javascript:ajaxRequest(\'index.php?option=' . _JOOM_OPTION . '&view=mini&format=json\', %u); return false;';
         $this->pagination = new JoomPagination($totalimages, $limitstart, $limit, '', null, $onclick);
         $this->images = $this->get('Images');
         $this->catid = $this->_mainframe->getUserStateFromRequest('joom.mini.catid', 'catid', 0, 'int');
         foreach ($this->images as $key => $image) {
             $image->thumb_src = null;
             $thumb = $this->_ambit->getImg('thumb_path', $image);
             if ($image->imgthumbname && is_file($thumb)) {
                 $imginfo = getimagesize($thumb);
                 $image->thumb_src = $this->_ambit->getImg('thumb_url', $image);
                 $image->thumb_width = $imginfo[0];
                 $image->thumb_height = $imginfo[1];
                 $this->image = $image;
                 $overlib = $this->loadTemplate('overlib');
                 $image->overlib = str_replace(array("\r\n", "\r", "\n"), '', htmlspecialchars($overlib, ENT_QUOTES, 'UTF-8'));
             }
             $this->images[$key] = $image;
         }
         // Limit Box
         $limits = array();
         // Create the option list
         for ($i = 5; $i <= 30; $i += 5) {
             $limits[] = JHtml::_('select.option', $i);
         }
         $limits[] = JHtml::_('select.option', '50');
         $limits[] = JHtml::_('select.option', '100');
         $limits[] = JHtml::_('select.option', '0', JText::_('JALL'));
         $url = 'index.php?option=' . _JOOM_OPTION . '&view=mini&format=json';
         $this->lists = array();
         $this->lists['limit'] = JHtml::_('select.genericlist', $limits, 'limit', 'class="inputbox input-mini" size="1" onchange="javascript:ajaxRequest(\'' . $url . '\', 0, \'limit=\' + this[this.selectedIndex].value)"', 'value', 'text', $limit);
         $this->lists['image_categories'] = JHtml::_('joomselect.categorylist', $this->catid, 'catid', 'onchange="javascript:ajaxRequest(\'' . $url . '\', 0, \'catid=\' + document.id(\'catid\').value)"', null, '- ', 'filter');
         $this->object = $this->_mainframe->getUserStateFromRequest('joom.mini.object', 'object', '', 'cmd');
         $this->search = $this->_mainframe->getUserStateFromRequest('joom.mini.search', 'search', '', 'string');
     }
     // Categories tab
     if (isset($this->tabs['categories'])) {
         $this->categories_form = JForm::getInstance(_JOOM_OPTION . '.mini.categories', 'mini.categories');
         $this->categories_form->setFieldAttribute('category_catid', 'onchange', str_replace('joom_', $this->prefix . '_', $this->categories_form->getFieldAttribute('category_catid', 'onchange')));
         $categories_fields = array('category_mode', 'category_limit', 'category_columns', 'category_ordering', 'category_linkedtext');
         foreach ($categories_fields as $field) {
             $this->categories_form->setFieldAttribute($field, 'default', $this->params->get('default_' . $field));
         }
     }
     // Upload tab
     if (isset($this->tabs['upload'])) {
         $this->upload_form = JForm::getInstance(_JOOM_OPTION . '.mini.upload', 'mini.upload');
         if ($this->upload_catid) {
             $this->upload_form->setFieldAttribute('catid', 'default', $this->upload_catid);
         }
         $this->fileSizeLimit = $this->_mainframe->isSite() ? $this->_config->get('jg_maxfilesize') : 0;
         $this->chunkSize = 0;
         $post_max_size = @ini_get('post_max_size');
         if (!empty($post_max_size)) {
             $post_max_size = JoomHelper::iniToBytes($post_max_size);
             $this->chunkSize = (int) min(500000, (int) (0.8 * $post_max_size));
         }
         $upload_max_filesize = @ini_get('upload_max_filesize');
         if (!empty($upload_max_filesize)) {
             $upload_max_filesize = JoomHelper::iniToBytes($upload_max_filesize);
             if ($this->fileSizeLimit <= 0 || $this->fileSizeLimit > $upload_max_filesize) {
                 $this->fileSizeLimit = $upload_max_filesize;
             }
         }
         $this->editFilename = $this->_mainframe->isSite() ? $this->_config->get('jg_useruseorigfilename') : $this->_config->get('jg_useorigfilename');
         $this->delete_original = $this->_mainframe->isSite() ? $this->_config->get('jg_delete_original_user') == 2 : $this->_config->get('jg_delete_original') == 2;
         JText::script('COM_JOOMGALLERY_MINI_TYPE');
         JText::script('COM_JOOMGALLERY_MINI_POSITION');
         JText::script('COM_JOOMGALLERY_MINI_ALTTEXT');
         JText::script('COM_JOOMGALLERY_COMMON_THUMBNAIL');
         JText::script('COM_JOOMGALLERY_MINI_DETAIL');
         JText::script('COM_JOOMGALLERY_MINI_ORIGINAL');
         JText::script('JNONE');
         JText::script('JGLOBAL_CENTER');
         JText::script('JGLOBAL_LEFT');
         JText::script('JGLOBAL_RIGHT');
     }
     // Create category tab
     if (isset($this->tabs['createcategory'])) {
         $this->category_form = JForm::getInstance(_JOOM_OPTION . '.mini.category', 'mini.category');
         JText::script('COM_JOOMGALLERY_MINI_PLEASE_ENTER_TEXT');
     }
     // The parameter object is necessary for the even if it
     // doesn't contain any data (this simplifies things)
     if (!isset($this->params)) {
         $this->params = new JRegistry();
         $this->params->loadString('');
     }
     // Set some default values before possibly modifying the view
     $this->upload_categories = null;
     $this->parent_categories = null;
     $this->upload_enabled = true;
     $this->createcat_enabled = true;
     // If we are in frontend modify the view by adding possibility to
     // change the category select boxes according to the plugin settings
     if (!$this->upload_catid && $this->_mainframe->isSite()) {
         $this->modifyView();
     }
     JText::script('JLIB_FORM_FIELD_INVALID');
     // Build the sorted message list
     $messages = $this->_mainframe->getMessageQueue();
     $this->messages = array();
     if (is_array($messages) && !empty($messages)) {
         foreach ($messages as $msg) {
             if (isset($msg['type']) && isset($msg['message'])) {
                 $this->messages[$msg['type']][] = $msg['message'];
             }
         }
     }
     parent::display($tpl);
 }
예제 #28
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 public function display($tpl = null)
 {
     if (!$this->_user->get('id') && !$this->_config->get('jg_showdetailpage')) {
         $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), JText::_('COM_JOOMGALLERY_COMMON_MSG_NOT_ALLOWED_VIEW_IMAGE'), 'notice');
     }
     if ((!is_numeric($this->_config->get('jg_detailpic_open')) || $this->_config->get('jg_detailpic_open') > 0) && $this->_config->get('jg_disabledetailpage')) {
         $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), JText::_('COM_JOOMGALLERY_DETAIL_MSG_NOT_ALLOWED_VIEW_DEFAULT_DETAIL_VIEW'), 'notice');
     }
     $images = $this->get('Images');
     $image = $this->get('Image');
     $slideshow = JRequest::getInt('slideshow');
     $params = $this->_mainframe->getParams();
     // Breadcrumbs
     if ($this->_config->get('jg_completebreadcrumbs') || $this->_config->get('jg_showpathway') || $this->_config->get('jg_pagetitle_detail')) {
         $parents = JoomHelper::getAllParentCategories($image->catid, true);
     }
     $menus = $this->_mainframe->getMenu();
     $menu = $menus->getActive();
     if ($menu && isset($menu->query['view']) && $menu->query['view'] != 'detail' && $this->_config->get('jg_completebreadcrumbs')) {
         $breadcrumbs = $this->_mainframe->getPathway();
         switch ($menu->query['view']) {
             case '':
             case 'gallery':
                 foreach ($parents as $parent) {
                     $breadcrumbs->addItem($parent->name, 'index.php?view=category&catid=' . $parent->cid);
                 }
                 $breadcrumbs->addItem($image->imgtitle);
                 break;
             case 'category':
                 $skip = true;
                 foreach ($parents as $key => $parent) {
                     if ($skip) {
                         if ($key == $menu->query['catid']) {
                             $skip = false;
                         }
                     } else {
                         $breadcrumbs->addItem($parent->name, 'index.php?view=category&catid=' . $parent->cid);
                     }
                 }
                 if (!$skip) {
                     $breadcrumbs->addItem($image->imgtitle);
                 }
                 break;
         }
     }
     // JoomGallery Pathway
     $pathway = null;
     if ($this->_config->get('jg_showpathway')) {
         $pathway = '<a href="' . JRoute::_('index.php?view=gallery') . '" class="jg_pathitem">' . JText::_('COM_JOOMGALLERY_COMMON_HOME') . '</a> &raquo; ';
         foreach ($parents as $parent) {
             $pathway .= '<a href="' . JRoute::_('index.php?view=category&catid=' . $parent->cid) . '" class="jg_pathitem">' . $parent->name . '</a> &raquo; ';
         }
         $pathway .= $image->imgtitle;
     }
     // Page Title
     if ($this->_config->get('jg_pagetitle_detail')) {
         $pagetitle = JoomHelper::createPagetitle($this->_config->get('jg_pagetitle_detail'), $parents[$image->catid]->name, $image->imgtitle, $params->get('page_title') ? $params->get('page_title') : JText::_('COM_JOOMGALLERY_COMMON_GALLERY'));
         $this->_doc->setTitle($pagetitle);
     }
     // Header and footer
     JoomHelper::prepareParams($params);
     // Generate the backlink
     if ($this->_config->get('jg_skipcatview')) {
         $allsubcats = JoomHelper::getAllSubCategories($image->catid, false);
         // Link to category view if it include subcategories
         if (count($allsubcats)) {
             $backtarget = JRoute::_('index.php?view=category&catid=' . $image->catid);
             $backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_CATEGORY');
         } else {
             // Get the parents including category itself if not read before
             if (!isset($parents)) {
                 $parents = JoomHelper::getAllParentCategories($image->catid, true);
             }
             if (count($parents) == 1) {
                 // Link to gallery view
                 $backtarget = JRoute::_('index.php?view=gallery');
                 $backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_GALLERY');
             } else {
                 // Link to parent of category
                 $backtarget = JRoute::_('index.php?view=category&catid=' . $parents[$image->catid]->parent_id);
                 $backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_CATEGORY');
             }
         }
     } else {
         $backtarget = JRoute::_('index.php?view=category&catid=' . $image->catid);
         $backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_CATEGORY');
     }
     // Get number of images and hits in gallery
     $numbers = JoomHelper::getNumberOfImgHits();
     // Load modules at position 'top'
     $modules['top'] = JoomHelper::getRenderedModules('top');
     if (count($modules['top'])) {
         $params->set('show_top_modules', 1);
     }
     // Load modules at position 'btm'
     $modules['btm'] = JoomHelper::getRenderedModules('btm');
     if (count($modules['btm'])) {
         $params->set('show_btm_modules', 1);
     }
     // Load modules at position 'detailbtm'
     $modules['detailbtm'] = JoomHelper::getRenderedModules('detailbtm');
     if (count($modules['detailbtm'])) {
         $params->set('show_detailbtm_modules', 1);
     }
     // Check whether this is the active menu item. This is a
     // special case in addition to code in constructor of parent class
     // because here we have to check the image ID, too.
     $active = $this->_mainframe->getMenu()->getActive();
     if (!$active || strpos($active->link, '&id=' . JRequest::getInt('id')) === false) {
         // Get the default layout from the configuration
         if ($layout = $this->_config->get('jg_alternative_layout')) {
             $this->setLayout($layout);
         }
     }
     // Meta data
     if ($image->metadesc) {
         $this->_doc->setDescription($image->metadesc);
     } elseif ($image->catmetadesc) {
         $this->_doc->setDescription($image->catmetadesc);
     }
     if ($image->metakey) {
         $this->_doc->setMetadata('keywords', $image->metakey);
     } elseif ($image->catmetakey) {
         $this->_doc->setMetadata('keywords', $image->catmetakey);
     }
     if ($this->_mainframe->getCfg('MetaAuthor') == '1' && $image->author && strcmp(JText::_('COM_JOOMGALLERY_COMMON_NO_DATA'), $image->author) != 0) {
         $this->_doc->setMetaData('author', $image->author);
     }
     // Set the title attribute in a tag with title and/or description of image
     // if a box is activated
     if ((!is_numeric($this->_config->get('jg_bigpic_open')) || $this->_config->get('jg_bigpic_open') > 1) && !$slideshow) {
         $image->atagtitle = JHTML::_('joomgallery.getTitleforATag', $image);
     } else {
         // Set the imgtitle by default
         $image->atagtitle = 'title="' . $image->imgtitle . '"';
     }
     // Accordion
     if ($this->_config->get('jg_showdetailaccordion')) {
         $toggler = 'class="joomgallery-toggler"';
         $slider = 'class="joomgallery-slider"';
         JHtml::_('behavior.framework', true);
         $accordionscript = 'window.addEvent(\'domready\', function(){
     new Fx.Accordion
     (
       $$(\'h4.joomgallery-toggler\'),
       $$(\'div.joomgallery-slider\'),
       {
         onActive: function(toggler, i)
         {
           toggler.addClass(\'joomgallery-toggler-down\');
           toggler.removeClass(\'joomgallery-toggler\');
         },
         onBackground: function(toggler, i)
         {
           toggler.addClass(\'joomgallery-toggler\');
           toggler.removeClass(\'joomgallery-toggler-down\');
         },
         duration         : ' . $this->_config->get('jg_accordionduration') . ',
         display          : ' . ($this->_config->get('jg_accordiondisplay') - 1) . ',
         initialDisplayFx : ' . $this->_config->get('jg_accordioninitialeffect') . ',
         opacity          : ' . $this->_config->get('jg_accordionopacity') . ',
         alwaysHide       : ' . $this->_config->get('jg_accordionalwayshide') . '
        });
     });';
         $this->_doc->addScriptDeclaration($accordionscript);
     } else {
         $toggler = '';
         $slider = '';
     }
     // Linked
     if (($this->_config->get('jg_bigpic') == 1 && $this->_user->get('id') || $this->_config->get('jg_bigpic_unreg') == 1 && !$this->_user->get('id')) && !$slideshow && $image->bigger_orig && (!$this->_config->get('jg_nameshields') || !$this->_config->get('jg_show_nameshields_unreg') && !$this->_user->get('id'))) {
         $params->set('image_linked', 1);
     }
     // Original size
     if ($image->orig_exists && $this->_config->get('jg_showoriginalfilesize') && !$slideshow) {
         $params->set('show_original_size', 1);
     }
     // Pagination
     if (isset($images[$image->position - 1]) && !$slideshow) {
         $params->set('show_previous_link', 1);
         $pagination['previous']['link'] = JRoute::_('index.php?view=detail&id=' . $images[$image->position - 1]->id) . JHTML::_('joomgallery.anchor');
         if ($this->_config->get('jg_showdetailnumberofpics')) {
             $params->set('show_previous_text', 1);
             $pagination['previous']['text'] = JText::sprintf('COM_JOOMGALLERY_DETAIL_IMG_IMAGE_OF_IMAGES', $image->position, count($images));
         }
     }
     if (isset($images[$image->position + 1]) && !$slideshow) {
         $params->set('show_next_link', 1);
         $pagination['next']['link'] = JRoute::_('index.php?view=detail&id=' . $images[$image->position + 1]->id) . JHTML::_('joomgallery.anchor');
         if ($this->_config->get('jg_showdetailnumberofpics')) {
             $params->set('show_next_text', 1);
             $pagination['next']['text'] = JText::sprintf('COM_JOOMGALLERY_DETAIL_IMG_IMAGE_OF_IMAGES', $image->position + 2, count($images));
         }
     }
     // Nametags
     if (!$slideshow && ($this->_config->get('jg_nameshields') && $this->_user->get('id') || $this->_config->get('jg_nameshields_unreg') && !$this->_user->get('id'))) {
         $nametags = $this->get('Nametags');
         if ($this->_user->get('id') || $nametags) {
             $params->set('show_nametags', 1);
             $this->assignRef('nametags', $nametags);
         }
         $already_tagged = false;
         foreach ($nametags as $nametag) {
             if ($nametag->nuserid == $this->_user->get('id')) {
                 $already_tagged = true;
                 break;
             }
         }
         if ($this->_config->get('jg_nameshields') && $this->_user->get('id') && !$slideshow && (!$already_tagged || $this->_config->get('jg_nameshields_others'))) {
             $params->set('show_movable_nametag', 1);
             $length = strlen($this->_user->get('username')) * $this->_config->get('jg_nameshields_width');
             $nametag = array();
             $nametag['length'] = $length;
             $nametag['name'] = $this->_user->get('username');
             $nametag['link'] = JRoute::_('index.php?task=nametags.save');
             $this->assignRef('nametag', $nametag);
             JHtml::_('behavior.framework');
             if ($this->_config->get('jg_nameshields_others')) {
                 JHTML::_('behavior.modal');
             }
         }
     }
     $script = '';
     // Slideshow
     if ($this->_config->get('jg_slideshow')) {
         $params->set('slideshow_enabled', 1);
         if ($slideshow) {
             JHtml::_('behavior.framework', true);
             $this->_doc->addStyleSheet($this->_ambit->getScript('smoothgallery/css/jd.gallery.css'));
             $this->_doc->addScript($this->_ambit->getScript('smoothgallery/scripts/jd.gallery.js'));
             // No include if standard effects 'fade/crossfade/fadebg' chosen
             switch ($this->_config->get('jg_slideshow_transition')) {
                 case 0:
                     $transition = 'fade';
                     break;
                 case 1:
                     $transition = 'fadeslideleft';
                     $this->_doc->addScript($this->_ambit->getScript('smoothgallery/scripts/jd.gallery.transitions.js'));
                     break;
                 case 2:
                     $transition = 'crossfade';
                     break;
                 case 3:
                     $transition = 'continuoushorizontal';
                     $this->_doc->addScript($this->_ambit->getScript('smoothgallery/scripts/jd.gallery.transitions.js'));
                     break;
                 case 4:
                     $transition = 'continuousvertical';
                     $this->_doc->addScript($this->_ambit->getScript('smoothgallery/scripts/jd.gallery.transitions.js'));
                     break;
                 case 5:
                     $transition = 'fadebg';
                     break;
                 default:
                     $transition = 'fade';
                     break;
             }
             // The slideshow needs an array of objects
             $script .= 'var photo = new Array();
               function joom_createphotoobject(image,thumbnail,linkTitle,link,title,description,number,date,hits,downloads,rating,filesizedtl,filesizeorg,author,detaillink) {
                 this.image = image;
                 this.thumbnail = thumbnail;
                 this.linkTitle = linkTitle;
                 this.link =link;
                 this.title = title;
                 this.description = description;
                 this.transition="' . $transition . '";
                 this.number=number;
                 this.date=date,
                 this.hits=hits,
                 this.downloads=downloads,
                 this.rating=rating,
                 this.filesizedtl=filesizedtl,
                 this.filesizeorg=filesizeorg,
                 this.author=author,
                 this.detaillink=detaillink
               }';
             $number = 0;
             $maxwidth = 0;
             $maxheight = 0;
             $imgstartidx = 0;
             foreach ($images as $row) {
                 // Description
                 if ($row->imgtext != '') {
                     $description = JoomHelper::fixForJS($row->imgtext);
                 } else {
                     $description = '&nbsp;';
                 }
                 // Date
                 if ($row->imgdate != '') {
                     $date = JHTML::_('date', $row->imgdate, JText::_('DATE_FORMAT_LC1'));
                 } else {
                     $date = '';
                 }
                 // Rating
                 $rating = addslashes(JHTML::_('joomgallery.rating', $row, true, 'jg_starrating_detail'));
                 // File size of detail image
                 if ($this->_config->get('jg_showdetailfilesize')) {
                     $filesizedtlhw = @filesize($this->_ambit->getImg('img_path', $row));
                     $filesizedtlhw = number_format($filesizedtlhw / 1024, 2, JText::_('COM_JOOMGALLERY_COMMON_DECIMAL_SEPARATOR'), JText::_('COM_JOOMGALLERY_COMMON_THOUSANDS_SEPARATOR'));
                     list($width, $height) = @getimagesize($this->_ambit->getImg('img_path', $row));
                     $filesizedtl = JText::sprintf('COM_JOOMGALLERY_COMMON_IMG_HW', $filesizedtlhw, $width, $height);
                 } else {
                     $filesizedtl = '&nbsp;';
                 }
                 // File size of original image
                 if ($this->_config->get('jg_showoriginalfilesize')) {
                     $filesizeorghw = @filesize($this->_ambit->getImg('orig_path', $row));
                     $filesizeorghw = number_format($filesizeorghw / 1024, 2, JText::_('COM_JOOMGALLERY_COMMON_DECIMAL_SEPARATOR'), JText::_('COM_JOOMGALLERY_COMMON_THOUSANDS_SEPARATOR'));
                     list($width, $height) = @getimagesize($this->_ambit->getImg('orig_path', $row));
                     $filesizeorg = JText::sprintf('COM_JOOMGALLERY_COMMON_IMG_HW', $filesizeorghw, $width, $height);
                 } else {
                     $filesizeorg = '&nbsp;';
                 }
                 // Author-owner
                 if ($this->_config->get('jg_showdetailauthor')) {
                     if ($row->imgauthor) {
                         $author = $row->imgauthor;
                     } else {
                         if ($this->_config->get('jg_showowner')) {
                             $author = JHTML::_('joomgallery.displayname', $row->imgowner, 'detail');
                         } else {
                             $author = JText::_('COM_JOOMGALLERY_COMMON_NO_DATA');
                         }
                     }
                 } else {
                     $author = '';
                 }
                 if ($this->_config->get('jg_slideshow_maxdimauto')) {
                     // Get dimensions of image for calculating the max. width/height
                     // of all images
                     $dimensions = getimagesize($this->_ambit->getImg('img_path', $row));
                     if ($dimensions[0] > $maxwidth) {
                         $maxwidth = $dimensions[0];
                     }
                     if ($dimensions[1] > $maxheight) {
                         $maxheight = $dimensions[1];
                     }
                 }
                 $script .= '
         photo[' . $number . '] = new joom_createphotoobject(
         "' . str_replace('&amp;', '&', $this->_ambit->getImg('img_url', $row)) . '",//image
         "' . $this->_ambit->getImg('thumb_url', $row) . '",//thumbnail
         "' . JoomHelper::fixForJS($row->imgtitle) . '",//linkTitle
         "' . str_replace('&amp;', '&', $this->_ambit->getImg('img_url', $row)) . '",//link
         "' . JoomHelper::fixForJS($row->imgtitle) . '",//title
         "' . $description . '",
         ' . $number . ',
         "' . $date . '",
         "' . $row->hits . '",
         "' . $row->downloads . '",
         "' . $rating . '",
         "' . $filesizedtl . '",
         "' . $filesizeorg . '",
         "' . str_replace(array("\r\n", "\r", "\n"), '', addcslashes($author, '"')) . '",
         "' . JHTML::_('joomgallery.openimage', 0, $row) . '"
       );';
                 // set start image index for slideshow
                 if ($row->id == $image->id) {
                     $imgstartidx = $number;
                 }
                 $number++;
             }
             if (!$this->_config->get('jg_slideshow_maxdimauto')) {
                 $maxwidth = $this->_config->get('jg_slideshow_width');
                 $maxheight = $this->_config->get('jg_slideshow_heigth');
             }
             $script .= 'var joom_slideshow=null;
                 function startGallery() {
                     joom_slideshow = new gallery($(\'jg_dtl_photo\'), {
                     timed: true,
                     delay: ' . $this->_config->get('jg_slideshow_timer') . ',
                     fadeDuration: ' . $this->_config->get('jg_slideshow_transtime') . ',
                     showArrows: ' . $this->_config->get('jg_slideshow_arrows') . ',
                     showCarousel: ' . $this->_config->get('jg_slideshow_carousel') . ',
                     textShowCarousel: \'' . JText::_('COM_JOOMGALLERY_DETAIL_SLIDESHOW_IMAGES', true) . '\',
                     showInfopane: ' . $this->_config->get('jg_slideshow_infopane') . ',
                     embedLinks: false,
                     manualData:photo,
                     preloader:false,
                     populateData:false,
                     maxWidth:' . $maxwidth . ',
                     maxHeight:' . $maxheight . ',
                     imgstartidx:' . $imgstartidx . ',
                     repeat: ' . $this->_config->get('jg_slideshow_repeat') . ',
                     repeattxt: \'' . JText::_('COM_JOOMGALLERY_DETAIL_SLIDESHOW_REPEAT', true) . '\'
                  });
                }
                window.addEvent(\'domready\', startGallery);
                function joom_stopslideshow() {
                  var url = photo[joom_slideshow.getCurrentIter()].detaillink + \'' . JHTML::_('joomgallery.anchor') . '\';
                  location.href = url.replace(/\\&amp;/g,\'&\');
                }
     ';
         } else {
             $script .= "function joom_startslideshow() {\n" . "  document.jg_slideshow_form.submit();\n" . "}\n";
         }
     }
     // Rightclick / Cursor navigation
     if ($this->_config->get('jg_disable_rightclick_detail')) {
         $script .= '
 var jg_photo_hover = 0;
 document.oncontextmenu = function() {
   if(jg_photo_hover==1) {
     return false;
   } else {
     return true;
   }
 }
 function joom_hover() {
   jg_photo_hover = (jg_photo_hover==1) ? 0 : 1;
 }';
     }
     if ($this->_config->get('jg_cursor_navigation') == 1) {
         $script .= 'document.onkeydown = joom_cursorchange;';
     }
     if ($script) {
         $this->_doc->addScriptDeclaration($script);
     }
     // MotionGallery
     if ($this->_config->get('jg_minis') && $this->_config->get('jg_motionminis') == 2) {
         $this->_doc->addScript($this->_ambit->getScript('motiongallery.js'));
         $script = "\n" . "   /***********************************************\n" . "   * CMotion Image Gallery- © Dynamic Drive DHTML code library (www.dynamicdrive.com)\n" . "   * Visit http://www.dynamicDrive.com for hundreds of DHTML scripts\n" . "   * This notice must stay intact for legal use\n" . "   * Modified by Jscheuer1 for autowidth and optional starting positions\n" . "   ***********************************************/";
         $this->_doc->addScriptDeclaration($script);
         $custom = "  <!-- Do not edit IE conditional style below -->" . "\n" . "  <!--[if gte IE 5.5]>" . "\n" . "  <style type=\"text/css\">\n" . "     #motioncontainer {\n" . "       width:expression(Math.min(this.offsetWidth, maxwidth)+'px');\n" . "     }\n" . "  </style>\n" . "  <![endif]-->" . "\n" . "  <!-- End Conditional Style -->";
         $this->_doc->addCustomTag($custom);
     }
     // Icons
     if (!$slideshow) {
         // Zoom
         if ($image->bigger_orig) {
             if ($this->_config->get('jg_bigpic') == 1 && $this->_user->get('id') || $this->_config->get('jg_bigpic_unreg') == 1 && !$this->_user->get('id')) {
                 $params->set('show_zoom_icon', 1);
             } else {
                 if ($this->_config->get('jg_bigpic') == 1 && !$this->_user->get('id')) {
                     $params->set('show_zoom_icon', -1);
                 }
             }
         }
         // Download icon
         if ($this->_config->get('jg_download') && $this->_config->get('jg_showdetaildownload') && ($image->orig_exists || $this->_config->get('jg_downloadfile') != 1)) {
             if ($this->_user->get('id') || $this->_config->get('jg_download_unreg')) {
                 $params->set('show_download_icon', 1);
                 $params->set('download_link', JRoute::_('index.php?task=download&id=' . $image->id));
             } else {
                 if ($this->_config->get('jg_download_hint')) {
                     $params->set('show_download_icon', -1);
                 }
             }
         }
         // Nametags
         if ($this->_config->get('jg_nameshields') && $this->_user->get('id')) {
             if (!$this->_config->get('jg_nameshields_others')) {
                 if (!$already_tagged) {
                     $params->set('show_nametag_icon', 1);
                 } else {
                     $params->set('show_nametag_icon', 2);
                     $params->set('nametag_link', JRoute::_('index.php?task=nametags.remove&id=' . $image->id, false));
                 }
             } else {
                 $params->set('show_nametag_icon', 3);
             }
         } else {
             if ($this->_config->get('jg_nameshields') && !$this->_user->get('id') && $this->_config->get('jg_show_nameshields_unreg')) {
                 $params->set('show_nametag_icon', -1);
             }
         }
         // Favourites
         if (!$params->get('disable_global_info') && $this->_config->get('jg_favourites')) {
             if ($this->_user->get('id') || $this->_config->get('jg_usefavouritesforpubliczip') == 1 && !$this->_user->get('id')) {
                 $params->set('favourites_link', JRoute::_('index.php?task=favourites.addimage&id=' . $image->id));
                 if ($this->_config->get('jg_usefavouritesforzip') == 1 || $this->_config->get('jg_usefavouritesforpubliczip') == 1 && !$this->_user->get('id')) {
                     $params->set('show_favourites_icon', 2);
                 } else {
                     $params->set('show_favourites_icon', 1);
                 }
             } else {
                 if ($this->_config->get('jg_favouritesshownotauth') == 1) {
                     if ($this->_config->get('jg_usefavouritesforzip') == 1) {
                         $params->set('show_favourites_icon', -2);
                     } else {
                         $params->set('show_favourites_icon', -1);
                     }
                 }
             }
         }
         // Report
         if ($this->_config->get('jg_report_images') && $this->_config->get('jg_detail_report_images')) {
             if ($this->_user->get('id') || $this->_config->get('jg_report_unreg')) {
                 $params->set('show_report_icon', 1);
                 JHTML::_('behavior.modal');
             } else {
                 if ($this->_config->get('jg_report_hint')) {
                     $params->set('show_report_icon', -1);
                 }
             }
         }
         // Show editor links for that image
         if ($this->_config->get('jg_showdetaileditorlinks') == 1 && $this->_config->get('jg_userspace') == 1) {
             if ($this->_user->authorise('core.edit', _JOOM_OPTION . '.image.' . $image->id) || $this->_user->authorise('core.edit.own', _JOOM_OPTION . '.image.' . $image->id) && $image->imgowner && $image->imgowner == $this->_user->get('id')) {
                 $params->set('show_edit_icon', 1);
             }
             if ($this->_user->authorise('core.delete', _JOOM_OPTION . '.image.' . $image->id)) {
                 $params->set('show_delete_icon', 1);
             }
         }
     }
     $extra = '';
     if ($this->_config->get('jg_disable_rightclick_detail') == 1) {
         $extra = 'onmouseover="javascript:joom_hover();" onmouseout="javascript:joom_hover();"';
     }
     $event = new stdClass();
     if (!$slideshow) {
         if ($this->_config->get('jg_lightbox_slide_all')) {
             $params->set('show_all_in_popup', 1);
             $popup = array();
             $popup['before'] = JHTML::_('joomgallery.popup', $images, 0, $image->position, $params->get('image_linked') ? 'joomgalleryIcon' : null);
             $popup['after'] = JHTML::_('joomgallery.popup', $images, $image->position + 1, null, $params->get('image_linked') ? 'joomgalleryIcon' : null);
             $this->assignRef('popup', $popup);
         }
         // Pane
         // Load modules at position 'detailpane'
         $modules['detailpane'] = JoomHelper::getRenderedModules('detailpane');
         if (count($modules['detailpane'])) {
             $params->set('show_detailpane_modules', 1);
         }
         // Exif data
         if ($this->_config->get('jg_showexifdata') && $image->orig_exists && extension_loaded('exif') && function_exists('exif_read_data')) {
             $exifdata = $this->get('Exifdata');
             if ($exifdata) {
                 $params->set('show_exifdata', 1);
                 $this->assignRef('exifdata', $exifdata);
             }
         }
         // GeoTagging data
         if ($this->_config->get('jg_showgeotagging') && $image->orig_exists && extension_loaded('exif') && function_exists('exif_read_data')) {
             $mapdata_array = $this->get('Mapdata');
             if ($mapdata_array) {
                 $mapdata = '';
                 if (isset($mapdata_array['N'])) {
                     $mapdata .= $mapdata_array['N'];
                 } else {
                     if (isset($mapdata_array['S'])) {
                         $mapdata .= '-' . $mapdata_array['S'];
                     }
                 }
                 $mapdata .= ', ';
                 if (isset($mapdata_array['E'])) {
                     $mapdata .= $mapdata_array['E'];
                 } else {
                     if (isset($mapdata_array['W'])) {
                         $mapdata .= '-' . $mapdata_array['W'];
                     }
                 }
                 if ($mapdata) {
                     $params->set('show_map', 1);
                     $this->assignRef('mapdata', $mapdata);
                     $apikey = $this->_config->get('jg_geotaggingkey');
                     $this->_doc->addScript('http' . (JUri::getInstance()->isSSL() ? 's' : '') . '://maps.google.com/maps/api/js?sensor=false' . (!empty($apikey) ? '&amp;key=' . $apikey : ''));
                     JText::script('COM_JOOMGALLERY_DETAIL_MAPS_BROWSER_IS_INCOMPATIBLE');
                 }
             }
         }
         // IPTC data
         if ($this->_config->get('jg_showiptcdata') && $image->orig_exists) {
             $iptcdata = $this->get('Iptcdata');
             if ($iptcdata) {
                 $params->set('show_iptcdata', 1);
                 $this->assignRef('iptcdata', $iptcdata);
             }
         }
         // Rating
         if ($this->_config->get('jg_showrating')) {
             if ($this->_config->get('jg_votingonlyreg') && !$this->_user->get('id')) {
                 // Set voting_area to 3 to show only the message in template
                 $params->set('show_voting_area', 3);
                 $params->set('voting_message', JText::_('COM_JOOMGALLERY_DETAIL_LOGIN_FIRST'));
             } else {
                 if ($this->_config->get('jg_votingonlyreg') && $image->owner == $this->_user->get('id')) {
                     // Set voting_area to 3 to show only the message in template
                     $params->set('show_voting_area', 3);
                     $params->set('voting_message', JText::_('COM_JOOMGALLERY_DETAIL_RATING_NOT_ON_OWN_IMAGES'));
                 } else {
                     // Set to 1 will show the voting area
                     JHtml::_('behavior.framework');
                     $params->set('show_voting_area', 1);
                     $params->set('ajaxvoting', $this->_config->get('jg_ajaxrating'));
                     if ($this->_config->get('jg_ratingdisplaytype') == 0) {
                         // Set to 0 will show textual voting bar with radio buttons
                         $params->set('voting_display_type', 0);
                         $selected = floor($this->_config->get('jg_maxvoting') / 2) + 1;
                         $voting = '';
                         $options = array();
                         for ($i = 1; $i <= $this->_config->get('jg_maxvoting'); $i++) {
                             $options[] = JHTML::_('select.option', $i);
                             // Delete options text manually, because it defaults to the value in JHTML::_('select.option'... ) if left empty
                             $options[$i - 1]->text = '';
                         }
                         $voting .= JHTML::_('select.radiolist', $options, 'imgvote', null, 'value', 'text', $selected);
                         $maxvoting = $i - 1;
                         $this->assignRef('voting', $voting);
                         $this->assignRef('maxvoting', $maxvoting);
                     } else {
                         if ($this->_config->get('jg_ratingdisplaytype') == 1) {
                             // Set to 1 will show graphical voting bar with stars
                             $params->set('voting_display_type', 1);
                             $maxvoting = $this->_config->get('jg_maxvoting');
                             $this->assignRef('maxvoting', $maxvoting);
                         }
                     }
                 }
             }
         }
         if ($this->_config->get('jg_bbcodelink')) {
             $current_uri = JURI::getInstance(JURI::base());
             $current_host = $current_uri->toString(array('scheme', 'host', 'port'));
             $params->set('show_bbcode', 1);
             if ($this->_config->get('jg_bbcodelink') == 1 || $this->_config->get('jg_bbcodelink') == 3) {
                 // Ensure that the correct host and path is prepended
                 $uri = JFactory::getUri($image->img_src);
                 $uri->setHost($current_host);
                 $params->set('bbcode_img', str_replace(array('&', 'http://http://'), array('&amp;', 'http://'), $uri->toString()));
             }
             if ($this->_config->get('jg_bbcodelink') == 2 || $this->_config->get('jg_bbcodelink') == 3) {
                 $url = JRoute::_('index.php?view=detail&id=' . $image->id) . JHTML::_('joomgallery.anchor');
                 // Ensure that the correct host and path is prepended
                 $uri = JFactory::getUri($url);
                 $uri->setHost($current_host);
                 $params->set('bbcode_url', str_replace('&', '&amp;', $uri->toString()));
             }
         }
         if ($this->_config->get('jg_showcomment')) {
             $params->set('show_comments_block', 1);
             // Check whether user is allowed to comment
             if ($this->_config->get('jg_anoncomment') || !$this->_config->get('jg_anoncomment') && $this->_user->get('id')) {
                 $params->set('commenting_allowed', 1);
                 $plugins = $this->_mainframe->triggerEvent('onJoomGetCaptcha');
                 $event->captchas = implode('', $plugins);
                 $this->_doc->addScriptDeclaration('    var jg_use_code = ' . $params->get('use_easycaptcha', 0) . ';');
                 if ($this->_config->get('jg_bbcodesupport')) {
                     $params->set('bbcode_status', JText::_('COM_JOOMGALLERY_DETAIL_BBCODE_ON'));
                 } else {
                     $params->set('bbcode_status', JText::_('COM_JOOMGALLERY_DETAIL_BBCODE_OFF'));
                 }
                 if ($this->_config->get('jg_smiliesupport')) {
                     $params->set('smiley_support', 1);
                     $smileys = JoomHelper::getSmileys();
                     $this->assignRef('smileys', $smileys);
                 }
                 JText::script('COM_JOOMGALLERY_DETAIL_SENDTOFRIEND_ALERT_ENTER_NAME_EMAIL');
                 JText::script('COM_JOOMGALLERY_DETAIL_COMMENTS_ALERT_ENTER_COMMENT');
                 JText::script('COM_JOOMGALLERY_DETAIL_COMMENTS_ALERT_ENTER_CODE');
             }
             // Check whether user is allowed to read comments
             if ($this->_user->get('username') || !$this->_user->get('username') && $this->_config->get('jg_showcommentsunreg') == 0) {
                 $comments = $this->get('Comments');
                 if (!$comments) {
                     $params->set('no_comments_message', JText::_('COM_JOOMGALLERY_DETAIL_COMMENTS_NOT_EXISTING'));
                     if ($params->get('commenting_allowed')) {
                         $params->set('no_comments_message2', JText::_('COM_JOOMGALLERY_DETAIL_COMMENTS_WRITE_FIRST'));
                     }
                 } else {
                     $params->set('show_comments', 1);
                     // Manager logged?
                     if ($this->_user->authorise('core.manage', _JOOM_OPTION)) {
                         $params->set('manager_logged', 1);
                     }
                     foreach ($comments as $key => $comment) {
                         // Display author name or notice that the author is a guest
                         if ($comment->userid) {
                             $comments[$key]->author = JHTML::_('joomgallery.displayname', $comment->userid, 'comment');
                         } else {
                             if ($this->_config->get('jg_namedanoncomment')) {
                                 if ($comment->cmtname != JText::_('COM_JOOMGALLERY_COMMON_GUEST')) {
                                     $comments[$key]->author = JText::sprintf('COM_JOOMGALLERY_DETAIL_COMMENTS_GUEST_NAME', $comment->cmtname);
                                 } else {
                                     $comments[$key]->author = $comment->cmtname;
                                 }
                             } else {
                                 $comments[$key]->author = JText::_('COM_JOOMGALLERY_COMMON_GUEST');
                             }
                         }
                         // Process comment text
                         $text = $comment->cmttext;
                         $text = JoomHelper::processText($text);
                         if ($this->_config->get('jg_bbcodesupport')) {
                             $text = JHTML::_('joomgallery.bbdecode', $text);
                         }
                         if ($this->_config->get('jg_smiliesupport')) {
                             $smileys = JoomHelper::getSmileys();
                             foreach ($smileys as $i => $sm) {
                                 $text = str_replace($i, '<img src="' . $sm . '" border="0" alt="' . $i . '" title="' . $i . '" />', $text);
                             }
                         }
                         $comments[$key]->text = $text;
                     }
                     $this->assignRef('comments', $comments);
                 }
             } else {
                 $params->set('no_comments_message', JText::_('COM_JOOMGALLERY_DETAIL_COMMENTS_NOT_FOR_UNREG'));
             }
         }
         if ($this->_config->get('jg_send2friend')) {
             $params->set('show_send2friend_block', 1);
             if ($this->_user->get('id')) {
                 $params->set('show_send2friend_form', 1);
             } else {
                 $params->set('send2friend_message', JText::_('COM_JOOMGALLERY_DETAIL_LOGIN_FIRST'));
             }
         }
     }
     $icons = $this->_mainframe->triggerEvent('onJoomDisplayIcons', array('detail.image', $image));
     $event->icons = implode('', $icons);
     $afterDisplay = $this->_mainframe->triggerEvent('onJoomAfterDisplayDetailImage', array($image));
     $event->afterDisplay = implode('', $afterDisplay);
     // Set redirect url used in editor links to redirect back to favourites view after edit/delete
     $redirect = '&redirect=' . base64_encode(JFactory::getURI()->toString());
     $this->assignRef('params', $params);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('image', $image);
     $this->assignRef('images', $images);
     $this->assignRef('extra', $extra);
     $this->assignRef('slideshow', $slideshow);
     $this->assignRef('slider', $slider);
     $this->assignRef('toggler', $toggler);
     $this->assignRef('pathway', $pathway);
     $this->assignRef('modules', $modules);
     $this->assignRef('event', $event);
     $this->assignRef('backtarget', $backtarget);
     $this->assignRef('backtext', $backtext);
     $this->assignRef('numberofpics', $numbers[0]);
     $this->assignRef('numberofhits', $numbers[1]);
     $this->assignRef('redirect', $redirect);
     $this->_doc->addScript($this->_ambit->getScript('detail.js'));
     parent::display($tpl);
 }
예제 #29
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 public function display($tpl = null)
 {
     if (!$this->_config->get('jg_userspace')) {
         $msg = JText::_('JERROR_ALERTNOAUTHOR');
         $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), $msg, 'notice');
     }
     // Additional security check for unregistered users
     if (!$this->_user->get('id') && !$this->_config->get('jg_unregistered_permissions')) {
         $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), JText::_('COM_JOOMGALLERY_COMMON_MSG_YOU_ARE_NOT_LOGGED'), 'notice');
     }
     if (!$this->_config->get('jg_disableunrequiredchecks') && !count(JoomHelper::getAuthorisedCategories('joom.upload'))) {
         $this->_mainframe->redirect(JRoute::_('index.php?view=userpanel', false), JText::_('COM_JOOMGALLERY_COMMON_MSG_YOU_ARE_NOT_ALLOWED_TO_UPLOAD'), 'notice');
     }
     $params = $this->_mainframe->getParams();
     // Breadcrumbs
     if ($this->_config->get('jg_completebreadcrumbs')) {
         $breadcrumbs = $this->_mainframe->getPathway();
         $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_COMMON_USER_PANEL'), 'index.php?view=userpanel');
         $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_COMMON_UPLOAD_NEW_IMAGE'));
     }
     // Header and footer
     JoomHelper::prepareParams($params);
     $pathway = null;
     if ($this->_config->get('jg_showpathway')) {
         $pathway = '<a href="' . JRoute::_('index.php?view=userpanel') . '">' . JText::_('COM_JOOMGALLERY_COMMON_USER_PANEL') . '</a>';
         $pathway .= ' &raquo; ' . JText::_('COM_JOOMGALLERY_COMMON_UPLOAD_NEW_IMAGE');
     }
     $backtarget = JRoute::_('index.php?view=gallery');
     $backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_GALLERY');
     // Get number of images and hits in gallery
     $numbers = JoomHelper::getNumberOfImgHits();
     // Load modules at position 'top'
     $modules['top'] = JoomHelper::getRenderedModules('top');
     if (count($modules['top'])) {
         $params->set('show_top_modules', 1);
     }
     // Load modules at position 'btm'
     $modules['btm'] = JoomHelper::getRenderedModules('btm');
     if (count($modules['btm'])) {
         $params->set('show_btm_modules', 1);
     }
     $count = $this->get('ImageNumber');
     if ($count >= $this->_config->get('jg_maxuserimage')) {
         $timespan = $this->_config->get('jg_maxuserimage_timespan');
         $msg = JText::sprintf('COM_JOOMGALLERY_UPLOAD_OUTPUT_MAY_ADD_MAX_OF', $this->_config->get('jg_maxuserimage'), $timespan > 0 ? JText::plural('COM_JOOMGALLERY_UPLOAD_NEW_IMAGE_MAXCOUNT_TIMESPAN', $timespan) : '');
         $this->_mainframe->redirect(JRoute::_('index.php?view=userpanel', false), $msg, 'notice');
     }
     $inputcounter = $this->_config->get('jg_maxuserimage') - $count;
     $remainder = $inputcounter;
     if ($inputcounter > $this->_config->get('jg_maxuploadfields')) {
         $inputcounter = $this->_config->get('jg_maxuploadfields');
     }
     $this->assignRef('count', $count);
     $this->assignRef('remainder', $remainder);
     $this->assignRef('inputcounter', $inputcounter);
     $this->_doc->addScriptDeclaration('    var jg_inputcounter = ' . $inputcounter . ';');
     $this->assignRef('params', $params);
     $this->assignRef('pathway', $pathway);
     $this->assignRef('modules', $modules);
     $this->assignRef('backtarget', $backtarget);
     $this->assignRef('backtext', $backtext);
     $this->assignRef('numberofpics', $numbers[0]);
     $this->assignRef('numberofhits', $numbers[1]);
     JHtml::_('behavior.formvalidation');
     JHtml::_('behavior.tooltip');
     $this->uploads = array();
     $types = array('single', 'ajax', 'batch', 'java');
     $tab = $this->_mainframe->input->get('tab');
     $active_found = false;
     foreach ($types as $type) {
         if ($this->_config->get('jg_userupload' . $type)) {
             $this->uploads[$type] = array('title' => 'COM_JOOMGALLERY_UPLOAD_TAB_' . strtoupper($type) . '_UPLOAD', 'active' => false);
             if ($tab == $type) {
                 $this->uploads[$type]['active'] = true;
                 $active_found = true;
             }
         }
     }
     // One tab has to be active
     if (!$active_found && count($this->uploads)) {
         // Reset the array in order to be able to use the key of the first element
         reset($this->uploads);
         $this->uploads[key($this->uploads)]['active'] = true;
     }
     JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     $this->single_form = JForm::getInstance(_JOOM_OPTION . '.upload', 'upload');
     $this->ajax_form = JForm::getInstance(_JOOM_OPTION . '.ajaxupload', 'ajaxupload');
     $this->batch_form = JForm::getInstance(_JOOM_OPTION . '.batchupload', 'batchupload');
     $this->applet_form = JForm::getInstance(_JOOM_OPTION . '.jupload', 'jupload');
     $this->single_form->setFieldAttribute('arrscreenshot', 'quantity', $inputcounter);
     $this->_doc->addScriptDeclaration('    var jg_filenamewithjs = ' . ($this->_config->get('jg_filenamewithjs') ? 'true' : 'false') . ';');
     $this->_doc->addScript($this->_ambit->getScript('upload.js'));
     JText::script('COM_JOOMGALLERY_COMMON_ALERT_IMAGE_MUST_HAVE_TITLE');
     JText::script('COM_JOOMGALLERY_COMMON_ALERT_YOU_MUST_SELECT_ONE_IMAGE');
     JText::script('COM_JOOMGALLERY_COMMON_ALERT_WRONG_EXTENSION');
     JText::script('COM_JOOMGALLERY_COMMON_ALERT_WRONG_FILENAME');
     JText::script('COM_JOOMGALLERY_UPLOAD_ALERT_FILENAME_DOUBLE_ONE');
     JText::script('COM_JOOMGALLERY_UPLOAD_ALERT_FILENAME_DOUBLE_TWO');
     // AJAX Drag'n'Drop Upload
     if ($this->_config->get('jg_useruploadajax')) {
         $this->_doc->addStyleSheet($this->_ambit->getScript('fineuploader/fineuploader.css'));
         $this->_doc->addScript($this->_ambit->getScript('fineuploader/js/fineuploader' . (JFactory::getConfig()->get('debug') ? '' : '.min') . '.js'));
         $this->ajax_form->setFieldAttribute('ajaxupload', 'redirect', $this->getModel()->getRedirectUrlAfterUpload('ajax'));
     }
     if ($this->_config->get('jg_useorigfilename')) {
         $this->single_form->setFieldAttribute('imgtitle', 'required', 'false');
         $this->ajax_form->setFieldAttribute('imgtitle', 'required', 'false');
         $this->batch_form->setFieldAttribute('imgtitle', 'required', 'false');
         $this->applet_form->setFieldAttribute('imgtitle', 'required', 'false');
     }
     if (!$this->_config->get('jg_disableunrequiredchecks')) {
         // Set default user upload category
         $defaultUserUploadCategory = $this->get('DefaultUserUploadCategory');
         $this->single_form->setValue('catid', null, $defaultUserUploadCategory);
         $this->ajax_form->setValue('catid', null, $defaultUserUploadCategory);
         $this->batch_form->setValue('catid', null, $defaultUserUploadCategory);
         $this->applet_form->setValue('catid', null, $defaultUserUploadCategory);
     }
     parent::display($tpl);
 }
예제 #30
0
 /**
  * HTML view display method
  *
  * @access  public
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 function display($tpl = null)
 {
     // Breadcrumbs
     if ($this->_config->get('jg_completebreadcrumbs')) {
         $breadcrumbs = $this->_mainframe->getPathway();
         $breadcrumbs->addItem($this->output('MY'));
     }
     $params = $this->_mainframe->getParams();
     // Header and footer
     JoomHelper::prepareParams($params);
     $pathway = $this->output('MY');
     $backtarget = JRoute::_('index.php?view=gallery');
     //see above
     $backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_GALLERY');
     // Get number of images and hits in gallery
     $numbers = JoomHelper::getNumberOfImgHits();
     // Load modules at position 'top'
     $modules['top'] = JoomHelper::getRenderedModules('top');
     if (count($modules['top'])) {
         $params->set('show_top_modules', 1);
     }
     // Load modules at position 'btm'
     $modules['btm'] = JoomHelper::getRenderedModules('btm');
     if (count($modules['btm'])) {
         $params->set('show_btm_modules', 1);
     }
     $state = $this->get('State');
     $rows = $this->get('Favourites');
     foreach ($rows as $key => $row) {
         $row->link = JHTML::_('joomgallery.openimage', $this->_config->get('jg_detailpic_open'), $row);
         $cropx = null;
         $cropy = null;
         $croppos = null;
         if ($this->_config->get('jg_dyncrop')) {
             $cropx = $this->_config->get('jg_dyncropwidth');
             $cropy = $this->_config->get('jg_dyncropheight');
             $croppos = $this->_config->get('jg_dyncropposition');
         }
         $row->thumb_src = $this->_ambit->getImg('thumb_url', $row, null, 0, true, $cropx, $cropy, $croppos);
         // Set the title attribute in a tag with title and/or description of image
         // if a box is activated
         if (!is_numeric($this->_config->get('jg_detailpic_open')) || $this->_config->get('jg_detailpic_open') > 1) {
             $rows[$key]->atagtitle = JHTML::_('joomgallery.getTitleforATag', $row);
         } else {
             // Set the imgtitle by default
             $rows[$key]->atagtitle = 'title="' . $row->imgtitle . '"';
         }
         if ($this->_config->get('jg_showauthor')) {
             if ($row->imgauthor) {
                 $row->authorowner = $row->imgauthor;
             } else {
                 if ($this->_config->get('jg_showowner')) {
                     $row->authorowner = JHTML::_('joomgallery.displayname', $row->imgowner);
                 } else {
                     $row->authorowner = JText::_('COM_JOOMGALLERY_COMMON_NO_DATA');
                 }
             }
         }
         // Show editor links for that image
         $row->show_edit_icon = false;
         $row->show_delete_icon = false;
         if ($this->_config->get('jg_showfavouriteseditorlinks') == 1 && $this->_config->get('jg_userspace') == 1) {
             if ($this->_user->authorise('core.edit', _JOOM_OPTION . '.image.' . $row->id) || $this->_user->authorise('core.edit.own', _JOOM_OPTION . '.image.' . $row->id) && $row->imgowner && $row->imgowner == $this->_user->get('id')) {
                 $row->show_edit_icon = true;
             }
             if ($this->_user->authorise('core.delete', _JOOM_OPTION . '.image.' . $row->id)) {
                 $row->show_delete_icon = true;
             }
         }
     }
     // Download Icon
     if ($this->_config->get('jg_download') && $this->_config->get('jg_showfavouritesdownload')) {
         if ($this->_user->get('id') || $this->_config->get('jg_download_unreg')) {
             $params->set('show_download_icon', 1);
         } else {
             if ($this->_config->get('jg_download_hint')) {
                 $params->set('show_download_icon', -1);
             }
         }
     }
     // Set redirect url used in editor links to redirect back to favourites view after edit/delete
     $redirect = '&redirect=' . base64_encode(JFactory::getURI()->toString());
     $this->assignRef('params', $params);
     $this->assignRef('rows', $rows);
     $this->assignRef('state', $state);
     $this->assignRef('pathway', $pathway);
     $this->assignRef('modules', $modules);
     $this->assignRef('backtarget', $backtarget);
     $this->assignRef('backtext', $backtext);
     $this->assignRef('numberofpics', $numbers[0]);
     $this->assignRef('numberofhits', $numbers[1]);
     $this->assignRef('redirect', $redirect);
     $layout = JRequest::getCmd('layout');
     if (!$layout && $this->get('Layout')) {
         $this->setLayout('list');
     }
     parent::display($tpl);
 }