/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise an Error object. * * @since 1.0 */ public function display($tpl = null) { $app = JFactory::getApplication(); $config = JComponentHelper::getParams('com_media'); if (!$app->isAdmin()) { return $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'warning'); } /* * Display form for FTP credentials? * Don't set them here, as there are other functions called before this one if there is any file write operation */ $ftp = !JClientHelper::hasCredentials('ftp'); $session = JFactory::getSession(); $state = $this->get('state'); $this->session = $session; $this->config =& $config; $this->state =& $state; $this->require_ftp = $ftp; $this->folders_id = ' id="media-tree"'; $this->folders = $this->get('folderTree'); $this->sidebar = JHtmlSidebar::render(); // Set the toolbar $this->addToolbar(); parent::display($tpl); }
function display($tpl = null) { global $mainframe; $style = $mainframe->getUserStateFromRequest('media.list.layout', 'layout', 'thumbs', 'word'); $listStyle = "\n\t\t\t<ul id=\"submenu\">\n\t\t\t\t<li><a id=\"thumbs\" onclick=\"MediaManager.setViewType('thumbs')\">" . JText::_('Thumbnail View') . "</a></li>\n\t\t\t\t<li><a id=\"details\" onclick=\"MediaManager.setViewType('details')\">" . JText::_('Detail View') . "</a></li>\n\t\t\t</ul>\n\t\t"; $document =& JFactory::getDocument(); $document->setBuffer($listStyle, 'module', 'submenu'); JHTML::_('behavior.mootools'); $document->addScript('components/com_media/assets/mediamanager.js'); $document->addStyleSheet('components/com_media/assets/mediamanager.css'); JHTML::_('behavior.modal'); $document->addScriptDeclaration("\n\t\twindow.addEvent('domready', function() {\n\t\t\tdocument.preview = SqueezeBox;\n\t\t});"); JHTML::script('mootree.js'); JHTML::stylesheet('mootree.css'); JHTML::_('behavior.uploader', 'file-upload', array('onAllComplete' => 'function(){ MediaManager.refreshFrame(); }')); $base = str_replace("\\", "/", JPATH_ROOT); $js = "\n\t\t\tvar basepath = '" . $base . '/images' . "';\n\t\t\tvar viewstyle = '" . $style . "';\n\t\t"; $document->addScriptDeclaration($js); /* * Display form for FTP credentials? * Don't set them here, as there are other functions called before this one if there is any file write operation */ jimport('joomla.client.helper'); $ftp = !JClientHelper::hasCredentials('ftp'); $this->assignRef('session', JFactory::getSession()); $this->assignRef('config', JComponentHelper::getParams('com_media')); $this->assignRef('state', $this->get('state')); $this->assign('require_ftp', $ftp); $this->assign('folders_id', ' id="media-tree"'); $this->assign('folders', $this->get('folderTree')); // Set the toolbar $this->_setToolBar(); parent::display($tpl); echo JHTML::_('behavior.keepalive'); }
function display($tpl = null) { global $mainframe; $config =& JComponentHelper::getParams('com_media'); $app = JFactory::getApplication(); $append = ''; if ($app->getClientId() == 1) { $append = 'administrator/'; } JHTML::_('script', 'popup-imagemanager.js', $append . 'components/com_media/assets/'); JHTML::_('stylesheet', 'popup-imagemanager.css', $append . 'components/com_media/assets/'); if ($config->get('enable_flash', 1)) { JHTML::_('behavior.uploader', 'file-upload', array('onAllComplete' => 'function(){ ImageManager.refreshFrame(); }')); } /* * Display form for FTP credentials? * Don't set them here, as there are other functions called before this one if there is any file write operation */ jimport('joomla.client.helper'); $ftp = !JClientHelper::hasCredentials('ftp'); $this->assignRef('session', JFactory::getSession()); $this->assignRef('config', $config); $this->assignRef('state', $this->get('state')); $this->assignRef('folderList', $this->get('folderList')); $this->assign('require_ftp', $ftp); parent::display($tpl); }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. * * @since 3.6 */ public function display($tpl = null) { $this->user = JFactory::getUser(); $this->bar = JToolbar::getInstance('toolbar'); $ftp = !JClientHelper::hasCredentials('ftp'); $images = $this->get('images'); $subfolders = $this->get('folders'); $folders = $this->getModel()->getFolders(COM_MEDIA_BASE); $currentFolder = $this->getModel()->getCurrentFolder(); $state = $this->get('state'); $this->session = JFactory::getSession(); $this->config = JComponentHelper::getParams('com_media'); $this->state = $this->get('state'); $this->require_ftp = $ftp; $this->images = $images; $this->folders = $folders; $this->current_folder = $currentFolder; $this->subfolders = $subfolders; $this->state = $state; if ($this->state->folder === "") { $this->state->folder = COM_MEDIA_BASEURL; } // Set the toolbar $this->addToolbar(); parent::display($tpl); }
function display($tpl = null) { $config = JComponentHelper::getParams('com_media'); $app = JFactory::getApplication(); $lang = JFactory::getLanguage(); $append = ''; $clave = JRequest::getVar('clave'); JHtml::_('behavior.framework', true); JHtml::_('script', 'media/popup-imagemanager.js', true, true); JHtml::_('stylesheet', 'media/popup-imagemanager.css', array(), true); if ($lang->isRTL()) { JHtml::_('stylesheet', 'media/popup-imagemanager_rtl.css', array(), true); } /* * Display form for FTP credentials? * Don't set them here, as there are other functions called before this one if there is any file write operation */ $ftp = !JClientHelper::hasCredentials('ftp'); $this->session = JFactory::getSession(); $this->config = $config; $this->state = $this->get('state'); $this->folderList = $this->get('folderList'); $this->require_ftp = $ftp; parent::display($tpl); }
function display($tpl = null) { $app =& JFactory::getApplication(); $config =& JComponentHelper::getParams('com_media'); $style = $app->getUserStateFromRequest('media.list.layout', 'layout', 'thumbs', 'word'); $document =& JFactory::getDocument(); $document->setBuffer($this->loadTemplate('navigation'), 'modules', 'submenu'); JHtml::_('behavior.framework', true); $document->addScript('../media/media/js/mediamanager.js'); $document->addStyleSheet('../media/media/css/mediamanager.css'); JHtml::_('behavior.modal'); $document->addScriptDeclaration("\n\t\twindow.addEvent('domready', function() {\n\t\t\tdocument.preview = SqueezeBox;\n\t\t});"); JHtml::script('mootree.js'); JHtml::stylesheet('mootree.css'); if ($config->get('enable_flash', 1)) { $fileTypes = $config->get('image_extensions', 'bmp,gif,jpg,png,jpeg'); $types = explode(',', $fileTypes); $displayTypes = ''; // this is what the user sees $filterTypes = ''; // this is what controls the logic $firstType = true; foreach ($types as $type) { if (!$firstType) { $displayTypes .= ', '; $filterTypes .= '; '; } else { $firstType = false; } $displayTypes .= '*.' . $type; $filterTypes .= '*.' . $type; } $typeString = '{ \'Images (' . $displayTypes . ')\': \'' . $filterTypes . '\' }'; JHtml::_('behavior.uploader', 'upload-flash', array('onComplete' => 'function(){ MediaManager.refreshFrame(); }', 'targetURL' => '\\$(\'uploadForm\').action', 'typeFilter' => $typeString)); } if (DS == '\\') { $base = str_replace(DS, "\\\\", COM_MEDIA_BASE); } else { $base = COM_MEDIA_BASE; } $js = "\n\t\t\tvar basepath = '" . $base . "';\n\t\t\tvar viewstyle = '" . $style . "';\n\t\t"; $document->addScriptDeclaration($js); /* * Display form for FTP credentials? * Don't set them here, as there are other functions called before this one if there is any file write operation */ jimport('joomla.client.helper'); $ftp = !JClientHelper::hasCredentials('ftp'); $this->assignRef('session', JFactory::getSession()); $this->assignRef('config', $config); $this->assignRef('state', $this->get('state')); $this->assign('require_ftp', $ftp); $this->assign('folders_id', ' id="media-tree"'); $this->assign('folders', $this->get('folderTree')); // Set the toolbar $this->_setToolBar(); parent::display($tpl); echo JHtml::_('behavior.keepalive'); }
function display($tpl = null) { $config = JComponentHelper::getParams('com_media'); $app = JFactory::getApplication(); $lang = JFactory::getLanguage(); $append = ''; JHtml::_('behavior.framework', true); //JHtml::_('script', 'media/popup-imagemanager.js', true, true); JHtml::_('stylesheet', 'media/popup-imagemanager.css', array(), true); if ($lang->isRTL()) { JHtml::_('stylesheet', 'media/popup-imagemanager_rtl.css', array(), true); } $document =& JFactory::getDocument(); $directory = "administrator/"; if (JFactory::getApplication()->isAdmin()) { $directory = ""; } if (JRequest::getVar("only") == "folder") { $document->addScript($directory . "components/com_fieldsattach/popup-imagemanager_folder.js"); } else { $document->addScript($directory . "components/com_fieldsattach/popup-imagemanager.js"); } //ADD LANGUAGE $lang =& JFactory::getLanguage(); $extension = 'com_media'; $base_dir = JPATH_SITE; $language_tag = JRequest::getVar("lang"); $reload = true; $lang->load($extension, $base_dir, $language_tag, $reload); //FILEROOT /*$path = "file_path"; $view = JRequest::getCmd('view'); if (substr(strtolower($view), 0, 6) == "images" || $popup_upload == 1) { $path = "image_path"; } define('COM_MEDIA_BASE', JPATH_ROOT.'/'.$config->get($path, 'images')); define('COM_MEDIA_BASEURL', JURI::root().$config->get($path, 'images')); */ // $sitepath = JPATH_ADMINISTRATOR ; // JLoader::register('MediaModelManager', $sitepath.DS.'components/com_media/models/manager.php'); /* * Display form for FTP credentials? * Don't set them here, as there are other functions called before this one if there is any file write operation */ $ftp = !JClientHelper::hasCredentials('ftp'); $this->session = JFactory::getSession(); $this->config = $config; $this->state = $this->get('state'); $this->folderList = $this->get('folderList'); //$this->folderList = MediaModelManager::getFolderList(COM_MEDIA_BASE); //echo "FOLDEER:".MediaModelManager::getFolderList(COM_MEDIA_BASE) ; $this->require_ftp = $ftp; parent::display($tpl); }
function display($tpl = null) { // Initialise variables. $app = JFactory::getApplication(); $config = JComponentHelper::getParams(JACOMPONENT); $lang = JFactory::getLanguage(); //$style = $app->getUserStateFromRequest('media.list.layout', 'layout', 'details', 'word'); $style = "details"; JHtml::_('behavior.framework', true); $assets = JURI::root() . 'administrator/components/com_jaextmanager/assets/'; $document = JFactory::getDocument(); if (jaIsJoomla3x()) { $document->setBuffer($this->loadTemplate('navigation'), 'modules', 'top'); JHtml::_('script', $assets . 'repo_manager_3/' . 'repomanager.js', false, true); JHtml::_('stylesheet', $assets . 'repo_manager_3/' . 'repomanager.css', false, true); } else { $document->setBuffer($this->loadTemplate('navigation'), 'modules', 'submenu'); JHtml::_('script', $assets . 'repo_manager/' . 'repomanager.js', false, true); JHtml::_('stylesheet', $assets . 'repo_manager/' . 'repomanager.css', false, true); } JHtml::_('behavior.modal', 'a.modal'); $document->addScriptDeclaration("\n\t\twindow.addEvent('domready', function() {\n\t\t\tdocument.preview = SqueezeBox;\n\t\t});"); JHtml::_('script', 'system/mootree.js', true, true, false, false); JHtml::_('stylesheet', 'system/mootree.css', array(), true); if ($lang->isRTL()) { JHtml::_('stylesheet', 'media/mootree_rtl.css', array(), true); } if ($config->get('enable_flash', 0)) { JHtml::_('behavior.uploader', 'file-upload', array('onAllComplete' => 'function(){ MediaManager.refreshFrame(); }')); } if (DS == '\\') { $base = str_replace(DS, "\\\\", JA_WORKING_DATA_FOLDER); } else { $base = JA_WORKING_DATA_FOLDER; } $js = "\n\t\t\tvar basepath = '" . $base . "';\n\t\t\tvar viewstyle = '" . $style . "';\n\t\t"; $document->addScriptDeclaration($js); /* * Display form for FTP credentials? * Don't set them here, as there are other functions called before this one if there is any file write operation */ jimport('joomla.client.helper'); $ftp = !JClientHelper::hasCredentials('ftp'); $session = JFactory::getSession(); $state = $this->get('state'); $folderTree = $this->get('folderTree'); $this->assignRef('session', $session); $this->assignRef('config', $config); $this->assignRef('state', $state); $this->assign('require_ftp', $ftp); $this->assign('folders_id', ' id="media-tree"'); $this->assign('folders', $folderTree); // Set the toolbar $this->addToolbar(); parent::display($tpl); echo JHtml::_('behavior.keepalive'); }
public function display($tpl = null) { $app = JFactory::getApplication(); $config = JComponentHelper::getParams('com_media'); if (!$app->isAdmin()) { return $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'warning'); } $lang = JFactory::getLanguage(); $style = $app->getUserStateFromRequest('media.list.layout', 'layout', 'thumbs', 'word'); $document = JFactory::getDocument(); JHtml::_('behavior.framework', true); JHtml::_('script', 'media/mediamanager.js', true, true); /* JHtml::_('stylesheet', 'media/mediamanager.css', array(), true); if ($lang->isRTL()) : JHtml::_('stylesheet', 'media/mediamanager_rtl.css', array(), true); endif; */ JHtml::_('behavior.modal'); $document->addScriptDeclaration("\n\t\twindow.addEvent('domready', function()\n\t\t{\n\t\t\tdocument.preview = SqueezeBox;\n\t\t});"); // JHtml::_('script', 'system/mootree.js', true, true, false, false); JHtml::_('stylesheet', 'system/mootree.css', array(), true); if ($lang->isRTL()) { JHtml::_('stylesheet', 'media/mootree_rtl.css', array(), true); } if (DIRECTORY_SEPARATOR == '\\') { $base = str_replace(DIRECTORY_SEPARATOR, "\\\\", COM_MEDIA_BASE); } else { $base = COM_MEDIA_BASE; } $js = "\n\t\t\tvar basepath = '" . $base . "';\n\t\t\tvar viewstyle = '" . $style . "';\n\t\t"; $document->addScriptDeclaration($js); /* * Display form for FTP credentials? * Don't set them here, as there are other functions called before this one if there is any file write operation */ $ftp = !JClientHelper::hasCredentials('ftp'); $session = JFactory::getSession(); $state = $this->get('state'); $this->session = $session; $this->config =& $config; $this->state =& $state; $this->require_ftp = $ftp; $this->folders_id = ' id="media-tree"'; $this->folders = $this->get('folderTree'); // Set the toolbar $this->addToolbar(); parent::display($tpl); echo JHtml::_('behavior.keepalive'); }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. * * @since 1.0 */ public function display($tpl = null) { $config = JComponentHelper::getParams('com_media'); /* * Display form for FTP credentials? * Don't set them here, as there are other functions called before this one if there is any file write operation */ $ftp = !JClientHelper::hasCredentials('ftp'); $this->session = JFactory::getSession(); $this->config = $config; $this->state = $this->get('state'); $this->folderList = $this->get('folderList'); $this->require_ftp = $ftp; parent::display($tpl); }
function display($tpl = null) { Html::behavior('framework', true); \Hubzero\Document\Assets::addComponentScript('com_media', 'popup-imagemanager.js'); \Hubzero\Document\Assets::addComponentStylesheet('com_media', 'popup-imagemanager.css'); // Display form for FTP credentials? // Don't set them here, as there are other functions called before this one if there is any file write operation $ftp = !JClientHelper::hasCredentials('ftp'); $this->session = App::get('session'); $this->config = Component::params('com_media'); $this->state = $this->get('state'); $this->folderList = $this->get('folderList'); $this->require_ftp = $ftp; parent::display($tpl); }
function display($tpl = null) { $config = JComponentHelper::getParams('com_media'); $app = JFactory::getApplication(); $lang = JFactory::getLanguage(); $append = ''; JHtml::_('behavior.framework', true); JHtml::_('script', 'media/popup-imagemanager.js', true, true); JHtml::_('stylesheet', 'media/popup-imagemanager.css', array(), true); if ($lang->isRTL()) { JHtml::_('stylesheet', 'media/popup-imagemanager_rtl.css', array(), true); } if ($config->get('enable_flash', 1)) { $fileTypes = $config->get('image_extensions', 'bmp,gif,jpg,png,jpeg'); $types = explode(',', $fileTypes); $displayTypes = ''; // this is what the user sees $filterTypes = ''; // this is what controls the logic $firstType = true; foreach ($types as $type) { if (!$firstType) { $displayTypes .= ', '; $filterTypes .= '; '; } else { $firstType = false; } $displayTypes .= '*.' . $type; $filterTypes .= '*.' . $type; } $typeString = '{ \'' . JText::_('COM_MEDIA_FILES', 'true') . ' (' . $displayTypes . ')\': \'' . $filterTypes . '\' }'; JHtml::_('behavior.uploader', 'upload-flash', array('onBeforeStart' => 'function(){ Uploader.setOptions({url: document.id(\'uploadForm\').action + \'&folder=\' + document.id(\'imageForm\').folderlist.value}); }', 'onComplete' => 'function(){ window.frames[\'imageframe\'].location.href = window.frames[\'imageframe\'].location.href; }', 'targetURL' => '\\document.id(\'uploadForm\').action', 'typeFilter' => $typeString, 'fileSizeMax' => (int) ($config->get('upload_maxsize', 0) * 1024 * 1024))); } /* * Display form for FTP credentials? * Don't set them here, as there are other functions called before this one if there is any file write operation */ jimport('joomla.client.helper'); $ftp = !JClientHelper::hasCredentials('ftp'); $this->assignRef('session', JFactory::getSession()); $this->assignRef('config', $config); $this->assignRef('state', $this->get('state')); $this->assignRef('folderList', $this->get('folderList')); $this->assign('require_ftp', $ftp); parent::display($tpl); }
function display($tpl = null) { global $mainframe; $config =& JComponentHelper::getParams(JACOMPONENT); //$style = $mainframe->getUserStateFromRequest('media.list.layout', 'layout', 'details', 'word'); $style = "details"; $listStyle = "\n\t\t\t<ul id=\"submenu\">\n\t\t\t\t<li><a title=\"\" href=\"index.php?option=" . JACOMPONENT . "&extionsion_type=&search=\"> " . JText::_("Extensions Manager") . "</a></li>\n\t\t\t\t<li><a title=\"\" href=\"index.php?option=" . JACOMPONENT . "&view=services\"> " . JText::_("Services Manager") . "</a></li>\n\t\t\t\t<li><a title=\"\" class=\"active\" href=\"index.php?option=" . JACOMPONENT . "&view=repo\"> " . JText::_("Repository Manager") . "</a></li>\n\t\t\t\t<li><a title=\"\" href=\"index.php?option=" . JACOMPONENT . "&view=default&layout=config_service\"> " . JText::_("Configurations") . "</a></li>\n\t\t\t\t<li><a title=\"\" href=\"index.php?option=" . JACOMPONENT . "&view=default&layout=help_support\"> " . JText::_("Help and Support") . "</a></li>\n\t\t\t</ul>\n\t\t"; $document =& JFactory::getDocument(); $document->setBuffer($listStyle, 'modules', 'submenu'); JHTML::_('behavior.mootools'); $document->addScript('components/' . JACOMPONENT . '/assets/repo_manager/repomanager.js'); $document->addStyleSheet('components/' . JACOMPONENT . '/assets/repo_manager/repomanager.css'); JHTML::_('behavior.modal'); $document->addScriptDeclaration("\n\t\twindow.addEvent('domready', function() {\n\t\t\tdocument.preview = SqueezeBox;\n\t\t});"); JHTML::script('mootree.js'); JHTML::stylesheet('mootree.css'); if ($config->get('enable_flash', 0)) { JHTML::_('behavior.uploader', 'file-upload', array('onAllComplete' => 'function(){ MediaManager.refreshFrame(); }')); } if (DS == '\\') { $base = str_replace(DS, "\\\\", JA_WORKING_DATA_FOLDER); } else { $base = JA_WORKING_DATA_FOLDER; } $js = "\n\t\t\tvar basepath = '" . $base . "';\n\t\t\tvar viewstyle = '" . $style . "';\n\t\t"; $document->addScriptDeclaration($js); /* * Display form for FTP credentials? * Don't set them here, as there are other functions called before this one if there is any file write operation */ jimport('joomla.client.helper'); $ftp = !JClientHelper::hasCredentials('ftp'); $this->assignRef('session', JFactory::getSession()); $this->assignRef('config', $config); $this->assignRef('state', $this->get('state')); $this->assign('require_ftp', $ftp); $this->assign('folders_id', ' id="media-tree"'); $this->assign('folders', $this->get('folderTree')); $user =& JFactory::getUser(); $this->assignRef('user', $user); // Set the toolbar $this->_setToolBar(); parent::display($tpl); echo JHTML::_('behavior.keepalive'); }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a JError object. */ public function display($tpl = null) { $app = JFactory::getApplication(); $config = JComponentHelper::getParams('com_media'); $lang = JFactory::getLanguage(); $document = JFactory::getDocument(); $mediaModel = JModelLegacy::getInstance('Manager', 'MediaModel'); $m_params = JComponentHelper::getParams('com_media'); define('COM_MEDIA_BASE', JPATH_ROOT . '/' . $m_params->get('file_path', 'images')); if (!$app->isAdmin()) { return $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'warning'); } $style = $app->getUserStateFromRequest('media.list.layout', 'layout', 'thumbs', 'word'); // Include jQuery JHtml::_('jquery.framework'); JHtml::_('script', 'bw_postman/popup-imagemanager.js', true, true); JHtml::_('stylesheet', 'media/popup-imagemanager.css', array(), true); JHtml::_('stylesheet', 'system/mootree.css', array(), true); if ($lang->isRTL()) { JHtml::_('stylesheet', 'media/popup-imagemanager_rtl.css', array(), true); JHtml::_('stylesheet', 'media/mootree_rtl.css', array(), true); } if (DIRECTORY_SEPARATOR == '\\') { $base = str_replace(DIRECTORY_SEPARATOR, "\\\\", COM_MEDIA_BASE); } else { $base = COM_MEDIA_BASE; } $js = "\n\t\t\tvar basepath = '" . $base . "';\n\t\t\tvar viewstyle = '" . $style . "';\n\t\t"; $document->addScriptDeclaration($js); /* * Display form for FTP credentials? * Don't set them here, as there are other functions called before this one if there is any file write operation */ $ftp = !JClientHelper::hasCredentials('ftp'); $this->session = JFactory::getSession(); $this->config = $config; $state = $mediaModel->getState(); $this->state =& $state; $this->folderList = $mediaModel->getFolderList(); $this->require_ftp = $ftp; $this->folders_id = ' id="media-tree"'; $this->folders = $mediaModel->getFolderTree(); parent::display($tpl); }
function display($tpl = null) { global $mainframe; $params =& JComponentHelper::getParams('com_phocagallery'); // Do not allow cache JResponse::allowCache(false); $document =& JFactory::getDocument(); $document->addStyleSheet('../administrator/components/com_phocagallery/assets/phocagallery.css'); $document->addStyleSheet('../administrator/templates/system/css/system.css'); $document->addCustomTag("<!--[if IE]>\n<link rel=\"stylesheet\" href=\"../administrator/components/com_phocagallery/assets/phocagalleryieall.css\" type=\"text/css\" />\n<![endif]-->"); $path = PhocaGalleryHelper::getPathSet(); $path_orig_rel = $path['orig_rel_ds']; $this->assign('path_orig_rel', $path_orig_rel); $this->assignRef('images', $this->get('images')); $this->assignRef('folders', $this->get('folders')); $this->assignRef('state', $this->get('state')); // Upload Form ------------------------------------ JHTML::_('behavior.mootools'); //$document->addScript('components/com_phocagallery/assets/upload/mediamanager.js'); $document->addStyleSheet('components/com_phocagallery/assets/upload/mediamanager.css'); // Set FTP form $ftp = !JClientHelper::hasCredentials('ftp'); // Set flash uploader if ftp password and login exists (will be not problems) $state = $this->get('state'); $refreshSite = 'index.php?option=com_phocagallery&view=phocagalleryi&tmpl=component&folder=' . $state->folder; if (!$ftp) { if ($params->get('enable_flash', 1)) { PhocaGalleryHelperUpload::uploader('file-upload', array('onAllComplete' => 'function(){ window.location.href="' . $refreshSite . '"; }')); } } // PARAMS - Upload size $upload_maxsize = 3000000; if ($params->get('upload_maxsize') != '') { $upload_maxsize = $params->get('upload_maxsize'); } // END Upload Form ------------------------------------ $this->assignRef('session', JFactory::getSession()); $this->assignRef('uploadmaxsize', $upload_maxsize); $this->assign('require_ftp', $ftp); parent::display($tpl); echo JHTML::_('behavior.keepalive'); }
function display($tpl = null) { $config = Component::params('com_media'); $style = Request::getState('media.list.layout', 'layout', 'thumbs', 'word'); Document::setBuffer($this->loadTemplate('navigation'), 'modules', 'submenu'); Html::behavior('framework', true); \Hubzero\Document\Assets::addComponentScript('com_media', 'mediamanager.js'); \Hubzero\Document\Assets::addComponentStylesheet('com_media', 'mediamanager.css'); Html::behavior('modal'); Document::addScriptDeclaration("\n\t\tjQuery(document).ready(function(\$){\n\t\t\tdocument.preview = \$.fancybox;\n\t\t});"); Html::asset('script', 'system/jquery.treeview.js', true, true, false, false); Html::asset('stylesheet', 'system/jquery.treeview.css', array(), true); if (Lang::isRTL()) { Html::asset('stylesheet', 'media/jquery.treeview_rtl.css', array(), true); } if (DIRECTORY_SEPARATOR == '\\') { $base = str_replace(DIRECTORY_SEPARATOR, "\\\\", COM_MEDIA_BASE); } else { $base = COM_MEDIA_BASE; } $js = "\n\t\t\tvar basepath = '" . $base . "';\n\t\t\tvar viewstyle = '" . $style . "';\n\t\t"; Document::addScriptDeclaration($js); // Display form for FTP credentials? // Don't set them here, as there are other functions called before this one if there is any file write operation $ftp = !JClientHelper::hasCredentials('ftp'); $session = App::get('session'); $state = $this->get('state'); $this->assignRef('session', $session); $this->assignRef('config', $config); $this->assignRef('state', $state); $this->require_ftp = $ftp; $this->folders_id = ' id="media-tree"'; $this->folders = $this->get('folderTree'); // Set the toolbar $this->addToolbar(); parent::display($tpl); echo Html::behavior('keepalive'); }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. * * @since 1.0 */ public function display($tpl = null) { $config = JComponentHelper::getParams('com_media'); $lang = JFactory::getLanguage(); // Include jQuery JHtml::_('jquery.framework'); JHtml::_('script', 'media/popup-imagemanager.js', true, true); JHtml::_('stylesheet', 'media/popup-imagemanager.css', array(), true); if ($lang->isRtl()) { JHtml::_('stylesheet', 'media/popup-imagemanager_rtl.css', array(), true); } /* * Display form for FTP credentials? * Don't set them here, as there are other functions called before this one if there is any file write operation */ $ftp = !JClientHelper::hasCredentials('ftp'); $this->session = JFactory::getSession(); $this->config = $config; $this->state = $this->get('state'); $this->folderList = $this->get('folderList'); $this->require_ftp = $ftp; //parent::display($tpl) include dirname(__FILE__) . '/tmpl/default.php'; }
function _displayForm($tpl) { global $mainframe, $option; $uri =& JFactory::getURI(); $phocagallery =& $this->get('Data'); //Data from model $lists = array(); $db =& JFactory::getDBO(); $document =& JFactory::getDocument(); $params =& JComponentHelper::getParams('com_phocagallery'); JToolBarHelper::title(JText::_('Phoca gallery') . ': <small><small>[ ' . JText::_('Multiple Add') . ' ]</small></small>'); JToolBarHelper::save(); JToolBarHelper::cancel(); JToolBarHelper::help('screen.phocagallery', true); $phocagallery->published = 1; $phocagallery->order = 0; $phocagallery->catid = JRequest::getVar('catid', 0, 'post', 'int'); $phocagallery->id = 0; // build the html select list for ordering $query = 'SELECT ordering AS value, title AS text' . ' FROM #__phocagallery' . ' WHERE catid = ' . (int) $phocagallery->catid . ' ORDER BY ordering'; $lists['ordering'] = JHTML::_('list.specificordering', $phocagallery, $phocagallery->id, $query, false); //------------------------------------------------------------------------ //build the list of categories $query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid' . ' FROM #__phocagallery_categories AS a' . ' ORDER BY a.ordering'; $db->setQuery($query); $phocagallerys = $db->loadObjectList(); $tree = array(); $text = ''; $tree = PhocaGalleryHelper::CategoryTree($phocagallerys, $tree, 0, $text); $phocagallerys_tree_array = PhocaGalleryHelper::CategoryTreeCreating($phocagallerys, $tree, 0); array_unshift($phocagallerys_tree_array, JHTML::_('select.option', '0', '- ' . JText::_('Select Category') . ' -', 'value', 'text')); //list categories $lists['catid'] = JHTML::_('select.genericlist', $phocagallerys_tree_array, 'catid', '', 'value', 'text', $phocagallery->catid); //----------------------------------------------------------------------- // build the html select list $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $phocagallery->published); //clean gallery data jimport('joomla.filter.output'); JFilterOutput::objectHTMLSafe($phocagallery, ENT_QUOTES, 'description'); $this->assignRef('lists', $lists); $this->assignRef('phocagallery', $phocagallery); $this->assignRef('button', $button); $this->assignRef('request_url', $uri->toString()); //-------------------------------------------------------------------------------------------------------- /*image manager*/ JResponse::allowCache(false); // Do not allow cache $path = PhocaGalleryHelper::getPathSet(); // Upload Form ------------------------------------ JHTML::_('behavior.mootools'); //$document->addScript('components/com_phocagallery/assets/upload/mediamanager.js'); $document->addStyleSheet('components/com_phocagallery/assets/upload/mediamanager.css'); // Set FTP form $ftp = !JClientHelper::hasCredentials('ftp'); // Set flash uploader if ftp password and login exists (will be not problems) $state = $this->get('state'); $refreshSite = 'index.php?option=com_phocagallery&view=phocagallerym&layout=form&hidemainmenu=1&folder=' . $state->folder; if (!$ftp) { if ($params->get('enable_flash', 1)) { PhocaGalleryHelperUpload::uploader('file-upload', array('onAllComplete' => 'function(){ window.location.href="' . $refreshSite . '"; }')); } } // PARAMS - Upload size $upload_maxsize = 3000000; if ($params->get('upload_maxsize') != '') { $upload_maxsize = $params->get('upload_maxsize'); } // END Upload Form ------------------------------------ $this->assignRef('session', JFactory::getSession()); $this->assignRef('uploadmaxsize', $upload_maxsize); $this->assign('require_ftp', $ftp); $this->assignRef('path_orig_rel', $path['orig_rel_ds']); $this->assignRef('images', $this->get('images')); $this->assignRef('folders', $this->get('folders')); $this->assignRef('state', $this->get('state')); parent::display($tpl); echo JHTML::_('behavior.keepalive'); }
function display($tpl = null) { $app = JFactory::getApplication(); // Don't load all the framework if nonsense $id = $app->input->get('id', 0, 'int'); $this->tagId = $app->input->get('tagid', 0, 'int'); if ($id < 1 && $this->tagId < 1) { JError::raiseError(404, JText::_("COM_PHOCAGALLERY_CATEGORY_IS_UNPUBLISHED")); exit; } $document = JFactory::getDocument(); $uri = JFactory::getURI(); $menus = $app->getMenu(); $menu = $menus->getActive(); $this->params = $app->getParams(); $this->tmpl['user'] = JFactory::getUser(); $this->tmpl['action'] = $uri->toString(); $this->tmpl['path'] = PhocaGalleryPath::getPath(); $limitStart = $app->input->get('limitstart', 0, 'int'); $this->tmpl['tab'] = $app->input->get('tab', 0, 'int'); $this->tmpl['pl'] = 'index.php?option=com_users&view=login&return=' . base64_encode($uri->toString()); $this->tmpl['icon_path'] = 'media/com_phocagallery/images/'; $this->tmpl['plcat'] = 'index.php?option=com_phocagallery&view=category'; $this->itemId = $app->input->get('Itemid', 0, 'int'); $neededAccessLevels = PhocaGalleryAccess::getNeededAccessLevels(); $access = PhocaGalleryAccess::isAccess($this->tmpl['user']->getAuthorisedViewLevels(), $neededAccessLevels); // CSS PhocaGalleryRenderFront::renderAllCSS(); // LIBRARY $library = PhocaGalleryLibrary::getLibrary(); $libraries['pg-group-shadowbox'] = $library->getLibrary('pg-group-shadowbox'); $libraries['pg-group-highslide'] = $library->getLibrary('pg-group-highslide'); $libraries['pg-group-jak'] = $library->getLibrary('pg-group-jak'); // PARAMS $this->tmpl['image_categories_size_cv'] = $this->params->get('image_categories_size_cv', 1); $this->tmpl['display_cat_name_title'] = $this->params->get('display_cat_name_title', 1); $this->tmpl['display_categories_cv'] = $this->params->get('display_categories_cv', 0); $this->tmpl['switch_image'] = $this->params->get('switch_image', 0); $this->tmpl['switch_height'] = $this->params->get('switch_height', 480); $this->tmpl['switch_width'] = $this->params->get('switch_width', 640); $this->tmpl['switch_fixed_size'] = $this->params->get('switch_fixed_size', 0); $this->tmpl['show_page_heading'] = $this->params->get('show_page_heading', 1); $this->tmpl['phocagallery_width'] = $this->params->get('phocagallery_width', ''); $this->tmpl['phocagallery_center'] = $this->params->get('phocagallery_center', ''); $this->tmpl['imagewidth'] = $this->params->get('medium_image_width', 100); $this->tmpl['imageheight'] = $this->params->get('medium_image_height', 100); $this->tmpl['picasa_correct_width_m'] = (int) $this->params->get('medium_image_width', 100); $this->tmpl['picasa_correct_height_m'] = (int) $this->params->get('medium_image_height', 100); $this->tmpl['picasa_correct_width_s'] = (int) $this->params->get('small_image_width', 50); $this->tmpl['picasa_correct_height_s'] = (int) $this->params->get('small_image_height', 50); $this->tmpl['picasa_correct_width_l'] = (int) $this->params->get('large_image_width', 640); $this->tmpl['picasa_correct_height_l'] = (int) $this->params->get('large_image_height', 480); $this->tmpl['category_box_space'] = $this->params->get('category_box_space', 0); $this->tmpl['detail_window'] = $this->params->get('detail_window', 0); $this->tmpl['display_name'] = $this->params->get('display_name', 1); $this->tmpl['display_rating'] = $this->params->get('display_rating', 0); $this->tmpl['display_rating_img'] = $this->params->get('display_rating_img', 0); $this->tmpl['display_comment'] = $this->params->get('display_comment', 0); $this->tmpl['display_comment_img'] = $this->params->get('display_comment_img', 0); $this->tmpl['display_subcategory'] = $this->params->get('display_subcategory', 1); $this->tmpl['display_icon_detail'] = $this->params->get('display_icon_detail', 1); $this->tmpl['display_icon_download'] = $this->params->get('display_icon_download', 2); $this->tmpl['display_icon_vm'] = $this->params->get('display_icon_vm', 0); $this->tmpl['display_img_desc_box'] = $this->params->get('display_img_desc_box', 0); $this->tmpl['diff_thumb_height'] = $this->params->get('diff_thumb_height', 0); $this->tmpl['overlib_attributes'] = $this->params->get('overlib_attributes', "BELOW, RIGHT, CSSCLASS, TEXTFONTCLASS, 'fontPhocaClass', FGCLASS, 'fgPhocaClass', BGCLASS, 'bgPhocaClass', CAPTIONFONTCLASS,'capfontPhocaClass', CLOSEFONTCLASS, 'capfontclosePhocaClass'"); // Switch image JS $this->tmpl['basic_image'] = ''; if ($this->tmpl['switch_image'] == 1) { $this->tmpl['wait_image'] = $this->tmpl['path']->image_rel_front_full . 'icon-switch.gif'; $this->tmpl['basic_image'] = $this->tmpl['path']->image_rel_front_full . 'phoca_thumb_l_no_image.png'; $document->addCustomTag(PhocaGalleryRenderFront::switchImage($this->tmpl['wait_image'])); $basic_imageSelected = 0; // we have not selected the basic image yet } $display_cat_name_breadcrumbs = $this->params->get('display_cat_name_breadcrumbs', 1); $popup_width = $this->params->get('front_modal_box_width', 680); $popup_height = $this->params->get('front_modal_box_height', 560); $this->tmpl['maxuploadchar'] = $this->params->get('max_upload_char', 1000); $this->tmpl['maxcommentchar'] = $this->params->get('max_comment_char', 1000); $this->tmpl['maxcreatecatchar'] = $this->params->get('max_create_cat_char', 1000); $this->tmpl['commentwidth'] = $this->params->get('comment_width', 500); $this->tmpl['displaycategorygeotagging'] = $this->params->get('display_category_geotagging', 0); $this->tmpl['displaycategorystatistics'] = $this->params->get('display_category_statistics', 0); // Used for Highslide JS (only image) $this->tmpl['displaydescriptiondetail'] = $this->params->get('display_description_detail', 0); $this->tmpl['display_title_description'] = $this->params->get('display_title_description', 0); $this->tmpl['charlengthname'] = $this->params->get('char_length_name', 15); $this->tmpl['char_cat_length_name'] = $this->params->get('char_cat_length_name', 9); $this->tmpl['display_icon_geo'] = $this->params->get('display_icon_geotagging', 0); // Check the category $this->tmpl['display_icon_geoimage'] = $this->params->get('display_icon_geotagging', 0); // Check the image $this->tmpl['display_camera_info'] = $this->params->get('display_camera_info', 0); // PARAMS - Upload $this->tmpl['multipleuploadchunk'] = $this->params->get('multiple_upload_chunk', 0); $this->tmpl['displaytitleupload'] = $this->params->get('display_title_upload', 0); $this->tmpl['displaydescupload'] = $this->params->get('display_description_upload', 0); $this->tmpl['enablejava'] = $this->params->get('enable_java', -1); $this->tmpl['enablemultiple'] = $this->params->get('enable_multiple', 0); $this->tmpl['multipleuploadmethod'] = $this->params->get('multiple_upload_method', 1); $this->tmpl['multipleresizewidth'] = $this->params->get('multiple_resize_width', -1); $this->tmpl['multipleresizeheight'] = $this->params->get('multiple_resize_height', -1); $this->tmpl['javaboxwidth'] = $this->params->get('java_box_width', 480); $this->tmpl['javaboxheight'] = $this->params->get('java_box_height', 480); $this->tmpl['large_image_width'] = $this->params->get('large_image_width', 640); $this->tmpl['large_image_height'] = $this->params->get('large_image_height', 640); $this->tmpl['uploadmaxsize'] = $this->params->get('upload_maxsize', 3145728); $this->tmpl['uploadmaxsizeread'] = PhocaGalleryFile::getFileSizeReadable($this->tmpl['uploadmaxsize']); $this->tmpl['uploadmaxreswidth'] = $this->params->get('upload_maxres_width', 3072); $this->tmpl['uploadmaxresheight'] = $this->params->get('upload_maxres_height', 2304); $display_description_detail = $this->params->get('display_description_detail', 0); $description_detail_height = $this->params->get('description_detail_height', 16); $detail_buttons = $this->params->get('detail_buttons', 1); //$modal_box_overlay_color = $this->params->get( 'modal_box_overlay_color', '#000000' ); $modal_box_overlay_opacity = $this->params->get('modal_box_overlay_opacity', 0.3); //$modal_box_border_color = $this->params->get( 'modal_box_border_color', '#6b6b6b' ); //$modal_box_border_width = $this->params->get( 'modal_box_border_width', '2' ); $this->tmpl['enablecooliris'] = $this->params->get('enable_cooliris', 0); $highslide_class = $this->params->get('highslide_class', 'rounded-white'); $highslide_opacity = $this->params->get('highslide_opacity', 0); $highslide_outline_type = $this->params->get('highslide_outline_type', 'rounded-white'); $highslide_fullimg = $this->params->get('highslide_fullimg', 0); $highslide_slideshow = $this->params->get('highslide_slideshow', 1); $highslide_close_button = $this->params->get('highslide_close_button', 0); $this->tmpl['jakslideshowdelay'] = $this->params->get('jak_slideshow_delay', 5); $this->tmpl['jakorientation'] = $this->params->get('jak_orientation', 'none'); $this->tmpl['jakdescription'] = $this->params->get('jak_description', 1); $this->tmpl['jakdescriptionheight'] = $this->params->get('jak_description_height', 0); $this->tmpl['categoryimageordering'] = $this->params->get('category_image_ordering', 10); $this->tmpl['externalcommentsystem'] = $this->params->get('external_comment_system', 0); $display_subcat_page_cv = $this->params->get('display_subcat_page_cv', 0); $this->tmpl['display_back_button_cv'] = $this->params->get('display_back_button_cv', 1); $this->tmpl['display_categories_back_button_cv'] = $this->params->get('display_categories_back_button_cv', 1); $medium_image_width_cv = (int) $this->params->get('medium_image_width', 100) + 18; $medium_image_height_cv = (int) $this->params->get('medium_image_height', 100) + 18; $small_image_width_cv = (int) $this->params->get('small_image_width', 50) + 18; $small_image_height_cv = (int) $this->params->get('small_image_height', 50) + 18; $this->tmpl['imagetypecv'] = $this->tmpl['image_categories_size_cv']; $this->tmpl['overlibimagerate'] = (int) $this->params->get('overlib_image_rate', ''); $this->tmpl['gallerymetakey'] = $this->params->get('gallery_metakey', ''); $this->tmpl['gallerymetadesc'] = $this->params->get('gallery_metadesc', ''); $this->tmpl['altvalue'] = $this->params->get('alt_value', 1); $paramsFb = PhocaGalleryFbSystem::getCommentsParams($this->params->get('fb_comment_user_id', '')); // Facebook $this->tmpl['fb_comment_app_id'] = isset($paramsFb['fb_comment_app_id']) ? $paramsFb['fb_comment_app_id'] : ''; $this->tmpl['fb_comment_width'] = isset($paramsFb['fb_comment_width']) ? $paramsFb['fb_comment_width'] : 550; $this->tmpl['fb_comment_lang'] = isset($paramsFb['fb_comment_lang']) ? $paramsFb['fb_comment_lang'] : 'en_US'; $this->tmpl['fb_comment_count'] = isset($paramsFb['fb_comment_count']) ? $paramsFb['fb_comment_count'] : ''; $this->tmpl['enable_direct_subcat'] = $this->params->get('enable_direct_subcat', 0); $this->tmpl['display_comment_nopup'] = $this->params->get('display_comment_nopup', 0); $this->tmpl['boxplus_theme'] = $this->params->get('boxplus_theme', 'lightsquare'); $this->tmpl['boxplus_bautocenter'] = (int) $this->params->get('boxplus_bautocenter', 1); $this->tmpl['boxplus_autofit'] = (int) $this->params->get('boxplus_autofit', 1); $this->tmpl['boxplus_slideshow'] = (int) $this->params->get('boxplus_slideshow', 0); $this->tmpl['boxplus_loop'] = (int) $this->params->get('boxplus_loop', 0); $this->tmpl['boxplus_captions'] = $this->params->get('boxplus_captions', 'bottom'); $this->tmpl['boxplus_thumbs'] = $this->params->get('boxplus_thumbs', 'inside'); $this->tmpl['boxplus_duration'] = (int) $this->params->get('boxplus_duration', 250); $this->tmpl['boxplus_transition'] = $this->params->get('boxplus_transition', 'linear'); $this->tmpl['boxplus_contextmenu'] = (int) $this->params->get('boxplus_contextmenu', 1); $this->tmpl['enablecustomcss'] = $this->params->get('enable_custom_css', 0); $this->tmpl['customcss'] = $this->params->get('custom_css', ''); $this->tmpl['display_tags_links'] = $this->params->get('display_tags_links', 0); $this->tmpl['displaying_tags_true'] = 0; //No tag found, if yes, the box will be resized $this->tmpl['ytbupload'] = $this->params->get('youtube_upload', 0); $this->tmpl['ytb_display'] = $this->params->get('ytb_display', 0); $this->tmpl['enable_multibox'] = $this->params->get('enable_multibox', 0); $this->tmpl['multibox_height'] = (int) $this->params->get('multibox_height', 560); $this->tmpl['multibox_width'] = (int) $this->params->get('multibox_width', 980); // CSS /*switch($this->tmpl['image_categories_size']) { // medium case 1: $this->tmpl['picasa_correct_width'] = (int)$this->params->get( 'medium_image_width', 100 ); $this->tmpl['picasa_correct_height'] = (int)$this->params->get( 'medium_image_height', 100 ); $this->tmpl['imagewidth'] = (int)$this->params->get( 'medium_image_width', 100 ); $this->tmpl['imageheight'] = (int)$this->params->get( 'medium_image_height', 100 ); $this->tmpl['class_suffix'] = 'medium'; break; // small case 0: default: $this->tmpl['picasa_correct_width'] = (int)$this->params->get( 'small_image_width', 50 ); $this->tmpl['picasa_correct_height'] = (int)$this->params->get( 'small_image_height', 50 ); $this->tmpl['imagewidth'] = (int)$this->params->get( 'small_image_width', 50 ); $this->tmpl['imageheight'] = (int)$this->params->get( 'small_image_height', 50 ); $this->tmpl['class_suffix'] = 'small'; break; }*/ // CSS Specific /*$s = '.pg-cv {'."\n"; if ($this->tmpl['phocagallerywidth'] != '') { $s .= ' margin: auto;'."\n"; $s .= ' width: '.$this->tmpl['phocagallerywidth'].'px;'."\n"; } $s .= '}'."\n"; $s .= '.pg-cv-box {'."\n"; $s .= ' height: '.$this->tmpl['boxsize']['height'].'px;'."\n"; $s .= ' width: '.$this->tmpl['boxsize']['width'].'px;"'."\n"; $s .= '}'."\n"; $s .= '.pg-cv-box-img {'."\n"; $s .= ' height: '.$this->tmpl['imageheight'].'px;'."\n"; $s .= ' width: '.$this->tmpl['imagewidth'].'px;"'."\n"; $s .= '}'."\n"; $document->addCustomTag('<style type="text/css">'.$s.'</style>');*/ // Correct Height // Description detail height if ($display_description_detail == 1) { $popup_height = $popup_height + $description_detail_height; } // Detail buttons in detail view if ($detail_buttons != 1) { $popup_height = $popup_height - 45; } if ($this->tmpl['display_rating_img'] == 1) { $popup_height = $popup_height + 35; } // Youtube video without padding, margin if ($this->tmpl['detail_window'] != 7 && $this->tmpl['ytb_display'] == 1) { $document->addCustomTag("<style type=\"text/css\"> \n" . " #boxplus .boxplus-dialog .boxplus-controlsclose {\n\t\t\t\ttop: -15px !important;\n\t\t\t\tright: -15px !important;\n\t\t\t\tmargin:0px 0 0 0 !important;\n\t\t\t} \n" . " </style> \n"); $popup_width = PhocaGallerySettings::getAdvancedSettings('youtubewidth'); $popup_height = PhocaGallerySettings::getAdvancedSettings('youtubeheight'); } // Multibox if ($this->tmpl['enable_multibox'] == 1) { $popup_width = $this->tmpl['multibox_width']; $popup_height = $this->tmpl['multibox_height']; } if ($this->tmpl['detail_window'] == 4) { $popup_height = $popup_height + 12; } // Comment Image JS if ((int) $this->tmpl['display_comment_img'] == 2 || (int) $this->tmpl['display_comment_img'] == 3) { PhocaGalleryCommentImage::renderCommentImageJS(); } // Rate Image JS if ((int) $this->tmpl['display_rating_img'] == 2) { PhocaGalleryRateImage::renderRateImgJS(); } // ======================================================= // DIFFERENT METHODS OF DISPLAYING THE DETAIL VIEW // ======================================================= // MODAL - will be displayed in case e.g. highslide or shadowbox too, because in there are more links JHtml::_('behavior.modal', 'a.pg-modal-button'); $btn = new PhocaGalleryRenderDetailWindow(); $btn->popupWidth = $popup_width; $btn->popupHeight = $popup_height; $btn->mbOverlayOpacity = $modal_box_overlay_opacity; $btn->sbSlideshowDelay = $this->params->get('sb_slideshow_delay', 5); $btn->sbSettings = $this->params->get('sb_settings', "overlayColor: '#000',overlayOpacity:0.5,resizeDuration:0.35,displayCounter:true,displayNav:true"); $btn->hsSlideshow = $highslide_slideshow; $btn->hsClass = $highslide_class; $btn->hsOutlineType = $highslide_outline_type; $btn->hsOpacity = $highslide_opacity; $btn->hsCloseButton = $highslide_close_button; $btn->hsFullImg = $highslide_fullimg; $btn->jakDescHeight = $this->tmpl['jakdescriptionheight']; $btn->jakDescWidth = ''; $btn->jakOrientation = $this->tmpl['jakorientation']; $btn->jakSlideshowDelay = $this->tmpl['jakslideshowdelay']; $btn->bpTheme = $this->tmpl['boxplus_theme']; $btn->bpBautocenter = (int) $this->tmpl['boxplus_bautocenter']; $btn->bpAutofit = (int) $this->tmpl['boxplus_autofit']; $btn->bpSlideshow = (int) $this->tmpl['boxplus_slideshow']; $btn->bpLoop = (int) $this->tmpl['boxplus_loop']; $btn->bpCaptions = $this->tmpl['boxplus_captions']; $btn->bpThumbs = $this->tmpl['boxplus_thumbs']; $btn->bpDuration = (int) $this->tmpl['boxplus_duration']; $btn->bpTransition = $this->tmpl['boxplus_transition']; $btn->bpContextmenu = (int) $this->tmpl['boxplus_contextmenu']; $btn->setButtons($this->tmpl['detail_window'], $libraries, $library); $this->button = $btn->getB1(); $this->button2 = $btn->getB2(); $this->buttonother = $btn->getB3(); $this->tmpl['highslideonclick'] = ''; // for using with highslide if (isset($this->button->highslideonclick)) { $this->tmpl['highslideonclick'] = $this->button->highslideonclick; // TODO } $this->tmpl['highslideonclick2'] = ''; if (isset($this->button->highslideonclick2)) { $this->tmpl['highslideonclick2'] = $this->button->highslideonclick2; // TODO } $folderButton = new JObject(); $folderButton->set('name', 'image'); $folderButton->set('options', ""); // End open window parameters // ================================================================== // Information about current category $this->category = $this->get('category'); // Cooliris (Piclens) $this->tmpl['start_cooliris'] = 0; if ($this->tmpl['enablecooliris'] == 1) { $this->tmpl['start_cooliris'] = $this->params->get('start_cooliris', 0); // CSS - PicLens START $document->addCustomTag(PhocaGalleryRenderFront::renderPicLens($this->category->id)); } // PARAMS - Pagination and subcategories on other sites // Subcategories will be displayed only on first page if pagination will be used $display_subcat_page = $this->params->get('display_subcat_page', 0); // On the first site subcategories will be displayed always $get['start'] = $app->input->get('limitstart', '', 'string'); if ($display_subcat_page == 2) { $display_subcat_page = 0; // Nowhere } else { if ($display_subcat_page == 0 && $get['start'] > 0) { $display_subcat_page = 0; //in case: second page and param=0 } else { $display_subcat_page = 1; //in case:first page or param==1 } } // Categories View in Category View if ($display_subcat_page_cv == 2) { $display_subcat_page_cv = 0; // Nowhere } else { if ($display_subcat_page_cv == 0 && $get['start'] > 0) { $display_subcat_page_cv = 0; //in case: second page and param=0 } else { $display_subcat_page_cv = 1; //in case:first page or param==1 } } // PARAMS - Display Back Buttons $display_back_button = $this->params->get('display_back_button', 1); $display_categories_back_button = $this->params->get('display_categories_back_button', 1); // PARAMS - Access Category - display category (subcategory folder or backbutton to not accessible cat $display_access_category = $this->params->get('display_access_category', 1); // Set page title per category if ($this->tmpl['display_cat_name_title'] == 1 && isset($this->category->title)) { $document->setTitle($this->params->get('page_title') . ' - ' . $this->category->title); } else { $document->setTitle($this->params->get('page_title')); } // Breadcrumb display: // 0 - only menu link // 1 - menu link - category name // 2 - only category name $this->_addBreadCrumbs(isset($menu->query['id']) ? $menu->query['id'] : 0, $display_cat_name_breadcrumbs); // Define image tag attributes /* if (!empty ($this->category->image)) { $attribs['align'] = '"'.$this->category->image_position.'"'; $attribs['hspace'] = '"6"'; $this->tmpl['image'] = JHtml::_('image', 'images/stories/'.$this->category->image,'', $attribs); }*/ // Overlib $enable_overlib = $this->params->get('enable_overlib', 0); if ((int) $enable_overlib > 0) { $document->addScript(JURI::base(true) . '/components/com_phocagallery/assets/overlib/overlib_mini.js'); } // MODEL $model = $this->getModel(); // Trash $this->tmpl['trash'] = 0; $this->tmpl['publish_unpublish'] = 0; $this->tmpl['approved_not_approved'] = 0; // only to see the info // USER RIGHT - DELETE - - - - - - - - - - - // 2, 2 means that user access will be ignored in function getUserRight for display Delete button $rightDisplayDelete = 0; // default is to null (all users cannot upload) if (!empty($this->category)) { $rightDisplayDelete = PhocaGalleryAccess::getUserRight('deleteuserid', $this->category->deleteuserid, 2, $this->tmpl['user']->getAuthorisedViewLevels(), $this->tmpl['user']->get('id', 0), 0); } if ($rightDisplayDelete == 1) { $this->tmpl['trash'] = 1; $this->tmpl['publish_unpublish'] = 1; $this->tmpl['approved_not_approved'] = 1; // only to see the info } // - - - - - - - - - - - - - - - - - - - - - // Upload $this->tmpl['displayupload'] = 0; // USER RIGHT - UPLOAD - - - - - - - - - - - // 2, 2 means that user access will be ignored in function getUserRight for display Delete button $rightDisplayUpload = 0; // default is to null (all users cannot upload) if (!empty($this->category)) { $rightDisplayUpload = PhocaGalleryAccess::getUserRight('uploaduserid', $this->category->uploaduserid, 2, $this->tmpl['user']->getAuthorisedViewLevels(), $this->tmpl['user']->get('id', 0), 0); } if ($rightDisplayUpload == 1) { $this->tmpl['displayupload'] = 1; $document->addCustomTag(PhocaGalleryRenderFront::renderOnUploadCategoryJS()); $document->addCustomTag(PhocaGalleryRenderFront::renderDescriptionUploadJS((int) $this->tmpl['maxuploadchar'])); } $this->tmpl['displaycreatecat'] = 0; if ($rightDisplayUpload == 1 && $this->tmpl['enable_direct_subcat'] == 1) { $this->tmpl['displaycreatecat'] = 1; $document->addCustomTag(PhocaGalleryRenderFront::renderOnUploadCategoryJS()); $document->addCustomTag(PhocaGalleryRenderFront::renderDescriptionCreateSubCatJS((int) $this->tmpl['maxcreatecatchar'])); } // - - - - - - - - - - - - - - - - - - - - - // USER RIGHT - ACCESS - - - - - - - - - - - $rightDisplay = 1; //default is set to 1 (all users can see the category) if (!empty($this->category)) { $rightDisplay = PhocaGalleryAccess::getUserRight('accessuserid', $this->category->accessuserid, 0, $this->tmpl['user']->getAuthorisedViewLevels(), $this->tmpl['user']->get('id', 0), $display_access_category); } if ($rightDisplay == 0) { $app->redirect(JRoute::_($this->tmpl['pl'], false), JText::_('COM_PHOCAGALLERY_NOT_AUTHORISED_ACTION')); exit; } // - - - - - - - - - - - - - - - - - - - - - // 1. GEOTAGGING CATEGORY $this->map['longitude'] = ''; // will be used for 1. default_geotagging to not display pane and 2. to remove pane (line cca 1554) $this->map['latitude'] = ''; if (isset($this->category->latitude) && $this->category->latitude != '' && $this->category->latitude != 0 && isset($this->category->longitude) && $this->category->longitude != '' && $this->category->longitude != 0) { $this->map['longitude'] = $this->category->longitude; $this->map['latitude'] = $this->category->latitude; $this->map['zoom'] = $this->category->zoom; $this->map['geotitle'] = $this->category->geotitle; $this->map['description'] = $this->category->description; if ($this->map['geotitle'] == '') { $this->map['geotitle'] = $this->category->title; } } else { $this->tmpl['display_icon_geo'] = 0; } $this->tmpl['categoryimageordering'] = $this->params->get('category_image_ordering', 10); //$this->tmpl['categoryimageorderingcv'] = 10;//$this->params->get( 'category_image_ordering_cv', 10 ); // Image next to Category in Categories View in Category View is ordered by Random as default phocagalleryimport('phocagallery.ordering.ordering'); $this->categoryImageOrdering = PhocaGalleryOrdering::getOrderingString($this->tmpl['categoryimageordering']); //$this->categoryImageOrderingCV = PhocaGalleryOrdering::getOrderingString($this->tmpl['categoryimageorderingcv']); // = = = = = = = = = = = = = = = = = = = = // BOXES // = = = = = = = = = = = = = = = = = = = = // Information because of height of box (if they are used not by all images) $this->tmpl['display_icon_extlink1_box'] = 0; $this->tmpl['display_icon_extlink2_box'] = 0; $this->tmpl['display_icon_vmbox'] = 0; $this->tmpl['display_icon_geo_box'] = 0; $iS = 0; $iCV = 0; $this->items = array(); // Category View $this->itemscv = array(); // Category List (Categories View) in Category View // ---------------------------------------- // PARENT FOLDERS(I) or Back Button STANDARD // ---------------------------------------- /* // Set Back Button to CATEGORIES VIEW $this->itemsLink = $menu->getItems('link', 'index.php?option=com_phocagallery&view=categories'); $itemId = 0; if(isset($this->itemsLink[0])) { $itemId = $this->itemsLink[0]->id; } $backLink = 'index.php?option=com_phocagallery&view=categories&Itemid='.$itemId;*/ $posItemid = $posItemidNull = $backLinkItemId = false; $backLink = PhocaGalleryRoute::getCategoriesRoute(); $posItemidNull = strpos($backLink, "Itemid=0"); $posItemid = strpos($backLink, "Itemid="); if ($posItemidNull === false && $posItemid) { $backLinkItemId = 1; } $parentCategory = $this->get('parentcategory'); if ($display_back_button == 1) { if (!empty($parentCategory)) { $this->items[$iS] = $parentCategory; // USER RIGHT - ACCESS - - - - - - - - - - - // Should be the link to parentcategory displayed $rightDisplay = PhocaGalleryAccess::getUserRight('accessuserid', $this->items[$iS]->accessuserid, $this->items[$iS]->access, $this->tmpl['user']->getAuthorisedViewLevels(), $this->tmpl['user']->get('id', 0), $display_access_category); // Display Key Icon (in case we want to display unaccessable categories in list view) $rightDisplayKey = 1; if ($display_access_category == 1) { // we simulate that we want not to display unaccessable categories // so we get rightDisplayKey = 0 then the key will be displayed if (!empty($parentCategory)) { $rightDisplayKey = PhocaGalleryAccess::getUserRight('accessuserid', $this->items[$iS]->accessuserid, $this->items[$iS]->access, $this->tmpl['user']->getAuthorisedViewLevels(), $this->tmpl['user']->get('id', 0), 0); } } // - - - - - - - - - - - - - - - - - - - - - if ($rightDisplay > 0) { $this->items[$iS]->cls = 'pg-box-parentfolder'; $this->items[$iS]->slug = $this->items[$iS]->id . ':' . $this->items[$iS]->alias; $this->items[$iS]->item_type = "parentfolder"; $this->items[$iS]->linkthumbnailpath = PhocaGalleryImageFront::displayBackFolder('medium', $rightDisplayKey); $this->items[$iS]->extm = $this->items[$iS]->linkthumbnailpath; $this->items[$iS]->exts = $this->items[$iS]->linkthumbnailpath; $this->items[$iS]->numlinks = 0; // We are in category view $this->items[$iS]->link = JRoute::_('index.php?option=com_phocagallery&view=category&id=' . $this->items[$iS]->slug . '&Itemid=' . $this->itemId); $this->items[$iS]->button =& $folderButton; $this->items[$iS]->button->methodname = ''; $this->items[$iS]->display_icon_detail = 0; $this->items[$iS]->display_icon_download = 0; $this->items[$iS]->display_name = 0; $this->items[$iS]->display_icon_vm = ''; $this->items[$iS]->start_cooliris = 0; $this->items[$iS]->trash = 0; $this->items[$iS]->publish_unpublish = 0; $this->items[$iS]->approved_not_approved = 0; $this->items[$iS]->enable_cooliris = 0; $this->items[$iS]->overlib = 0; $this->items[$iS]->display_icon_geo = 0; $this->items[$iS]->display_icon_commentimg = 0; $this->items[$iS]->type = 0; $this->items[$iS]->camera_info = 0; $this->items[$iS]->display_icon_extlink1 = 0; $this->items[$iS]->display_icon_extlink2 = 0; $this->items[$iS]->description = ''; $this->items[$iS]->altvalue = ''; $iS++; } else { // There is no right to see the data but the object exists (because it was loaded from database // Destroy it unset($this->items[$iS]); } } else { // Back button to categories list if it exists if ($backLinkItemId != 0 && $display_categories_back_button == 1) { $this->items[$iS] = new JObject(); $this->items[$iS]->cls = 'pg-box-backbtn'; $this->items[$iS]->link = JRoute::_($backLink); $this->items[$iS]->title = JTEXT::_('COM_PHOCAGALLERY_CATEGORY_LIST'); $this->items[$iS]->item_type = "categorieslist"; $this->items[$iS]->linkthumbnailpath = PhocaGalleryImageFront::displayBackFolder('medium', 1); $this->items[$iS]->extm = $this->items[$iS]->linkthumbnailpath; $this->items[$iS]->exts = $this->items[$iS]->linkthumbnailpath; $this->items[$iS]->numlinks = 0; // We are in category view $this->items[$iS]->button =& $folderButton; $this->items[$iS]->button->methodname = ''; $this->items[$iS]->display_icon_detail = 0; $this->items[$iS]->display_icon_download = 0; $this->items[$iS]->display_name = 0; $this->items[$iS]->display_icon_vm = ''; $this->items[$iS]->start_cooliris = 0; $this->items[$iS]->trash = 0; $this->items[$iS]->publish_unpublish = 0; $this->items[$iS]->approved_not_approved = 0; $this->items[$iS]->enable_cooliris = 0; $this->items[$iS]->overlib = 0; $this->items[$iS]->display_icon_geo = 0; $this->items[$iS]->display_icon_commentimg = 0; $this->items[$iS]->type = 0; $this->items[$iS]->camera_info = 0; $this->items[$iS]->display_icon_extlink1 = 0; $this->items[$iS]->display_icon_extlink2 = 0; $this->items[$iS]->description = ''; $this->items[$iS]->altvalue = ''; $iS++; } } } // ---------------------------------------- // PARENT FOLDERS(II) or Back Button CATEGORIES VIEW IN CATEGORY VIEW // ---------------------------------------- if ($this->tmpl['display_back_button_cv'] == 1 && $this->tmpl['display_categories_cv'] == 1) { if (!empty($parentCategory)) { $this->itemscv[$iCV] = clone $parentCategory; // USER RIGHT - ACCESS - - - - - - - - - - - // Should be the link to parentcategory displayed $rightDisplay = PhocaGalleryAccess::getUserRight('accessuserid', $this->itemscv[$iCV]->accessuserid, $this->itemscv[$iCV]->access, $this->tmpl['user']->getAuthorisedViewLevels(), $this->tmpl['user']->get('id', 0), $display_access_category); // Display Key Icon (in case we want to display unaccessable categories in list view) $rightDisplayKey = 1; if ($display_access_category == 1) { // we simulate that we want not to display unaccessable categories // so we get rightDisplayKey = 0 then the key will be displayed if (!empty($parentCategory)) { $rightDisplayKey = PhocaGalleryAccess::getUserRight('accessuserid', $this->itemscv[$iCV]->accessuserid, $this->itemscv[$iCV]->access, $this->tmpl['user']->getAuthorisedViewLevels(), $this->tmpl['user']->get('id', 0), 0); } } // - - - - - - - - - - - - - - - - - - - - - if ($rightDisplay > 0) { $this->itemscv[$iCV]->cls = 'pg-box-parentfolder-cv'; $this->itemscv[$iCV]->slug = $this->itemscv[$iCV]->id . ':' . $this->itemscv[$iCV]->alias; $this->itemscv[$iCV]->item_type = "parentfoldercv"; $this->itemscv[$iCV]->linkthumbnailpath = PhocaGalleryImageFront::displayBackFolder('medium', $rightDisplayKey); $this->itemscv[$iCV]->extm = $this->itemscv[$iCV]->linkthumbnailpath; $this->itemscv[$iCV]->exts = $this->itemscv[$iCV]->linkthumbnailpath; $this->itemscv[$iCV]->numlinks = 0; // We are in category view $this->itemscv[$iCV]->link = JRoute::_('index.php?option=com_phocagallery&view=category&id=' . $this->itemscv[$iCV]->slug . '&Itemid=' . $this->itemId); $this->itemscv[$iCV]->type = 3; $this->itemscv[$iCV]->altvalue = ''; $iCV++; } else { // There is no right to see the data but the object exists (because it was loaded from database // Destroy it unset($this->itemscv[$iCV]); } } else { // Back button to categories list if it exists if ($backLinkItemId != 0 && $this->tmpl['display_categories_back_button_cv'] == 1) { $this->itemscv[$iCV] = new JObject(); $this->itemscv[$iCV]->cls = 'pg-cvcsv-back'; $this->itemscv[$iCV]->link = $backLink; $this->itemscv[$iCV]->title = JTEXT::_('COM_PHOCAGALLERY_CATEGORY_LIST'); $this->itemscv[$iCV]->item_type = "categorieslistcv"; $this->itemscv[$iCV]->linkthumbnailpath = PhocaGalleryImageFront::displayBackFolder('medium', 1); $this->itemscv[$iCV]->extm = $this->itemscv[$iCV]->linkthumbnailpath; $this->itemscv[$iCV]->exts = $this->itemscv[$iCV]->linkthumbnailpath; $this->itemscv[$iCV]->numlinks = 0; // We are in category view $this->itemscv[$iCV]->link = JRoute::_($this->itemscv[$iCV]->link); $this->itemscv[$iCV]->type = 3; $this->itemscv[$iCV]->altvalue = ''; $iCV++; } } } // ---------------------------------------- // SUB FOLDERS(1) STANDARD // ---------------------------------------- // Display subcategories on every page if ($display_subcat_page == 1) { $subCategory = $this->get('subcategory'); $totalSubCat = count($subCategory); if ((int) $this->tagId > 0) { $subCategory = array(); } // No subcategories for tag searching if (!empty($subCategory)) { $this->items[$iS] =& $subCategory; for ($iSub = 0; $iSub < $totalSubCat; $iSub++) { $this->items[$iS] =& $subCategory[$iSub]; // USER RIGHT - ACCESS - - - - - - - - - - $rightDisplay = PhocaGalleryAccess::getUserRight('accessuserid', $this->items[$iS]->accessuserid, $this->items[$iS]->access, $this->tmpl['user']->getAuthorisedViewLevels(), $this->tmpl['user']->get('id', 0), $display_access_category); // Display Key Icon (in case we want to display unaccessable categories in list view) $rightDisplayKey = 1; if ($display_access_category == 1) { // we simulate that we want not to display unaccessable categories // so we get rightDisplayKey = 0 then the key will be displayed if (!empty($this->items[$iS])) { $rightDisplayKey = PhocaGalleryAccess::getUserRight('accessuserid', $this->items[$iS]->accessuserid, $this->items[$iS]->access, $this->tmpl['user']->getAuthorisedViewLevels(), $this->tmpl['user']->get('id', 0), 0); } } // - - - - - - - - - - - - - - - - - - - - if ($rightDisplay > 0) { $this->items[$iS]->cls = 'pg-box-subfolder'; $this->items[$iS]->slug = $this->items[$iS]->id . ':' . $this->items[$iS]->alias; $this->items[$iS]->item_type = "subfolder"; $numlinks = $model->getCountItem($this->items[$iS]->id); //Should be get from main subcategories query if (isset($numlinks[0]) && $numlinks[0] > 0) { $this->items[$iS]->numlinks = (int) $numlinks[0]; } else { $this->items[$iS]->numlinks = 0; } $extImage = PhocaGalleryImage::isExtImage($this->items[$iS]->extid); if ($extImage) { $imagePic = new stdClass(); if ($this->tmpl['categoryimageordering'] != 10) { $imagePic = PhocaGalleryImageFront::getRandomImageRecursive($this->items[$iS]->id, $this->categoryImageOrdering, 1); $fileThumbnail = PhocaGalleryImageFront::displayCategoryExtImgOrFolder($imagePic->exts, $imagePic->extm, 'medium', $rightDisplayKey, 'display_category_icon_image'); } else { $fileThumbnail = PhocaGalleryImageFront::displayCategoryExtImgOrFolder($this->items[$iS]->exts, $this->items[$iS]->extm, 'medium', $rightDisplayKey, 'display_category_icon_image'); $imagePic->extw = $this->items[$iS]->extw; $imagePic->exth = $this->items[$iS]->exth; } // in case category is locked or no extm exists $this->items[$iS]->linkthumbnailpath = $fileThumbnail->linkthumbnailpath; $this->items[$iS]->extm = $fileThumbnail->extm; $this->items[$iS]->exts = $fileThumbnail->exts; $this->items[$iS]->exthswitch = $this->items[$iS]->extwswitch = 0; if ($imagePic->extw != '') { $extw = explode(',', $imagePic->extw); $this->items[$iS]->extw = $extw[1]; $this->items[$iS]->extwswitch = $extw[0]; } if ($imagePic->exth != '') { $exth = explode(',', $imagePic->exth); $this->items[$iS]->exth = $exth[1]; $this->items[$iS]->exthswitch = $exth[0]; } $this->items[$iS]->extpic = $fileThumbnail->extpic; } else { if ($this->tmpl['categoryimageordering'] != 10) { $randomImage = PhocaGalleryImageFront::getRandomImageRecursive($this->items[$iS]->id, $this->categoryImageOrdering); $fileThumbnail = PhocaGalleryImageFront::displayCategoryImageOrFolder($randomImage, 'medium', $rightDisplayKey, 'display_category_icon_image'); } else { $fileThumbnail = PhocaGalleryImageFront::displayCategoryImageOrFolder($this->items[$iS]->filename, 'medium', $rightDisplayKey, 'display_category_icon_image'); } $this->items[$iS]->linkthumbnailpath = $fileThumbnail->rel; } $this->items[$iS]->link = JRoute::_('index.php?option=com_phocagallery&view=category&id=' . $this->items[$iS]->slug . '&Itemid=' . $this->itemId); $this->items[$iS]->button =& $folderButton; $this->items[$iS]->button->methodname = ''; $this->items[$iS]->display_icon_detail = 0; $this->items[$iS]->display_icon_download = 0; $this->items[$iS]->display_name = $this->tmpl['display_name']; $this->items[$iS]->display_icon_vm = ''; $this->items[$iS]->start_cooliris = 0; $this->items[$iS]->trash = 0; $this->items[$iS]->publish_unpublish = 0; $this->items[$iS]->approved_not_approved = 0; $this->items[$iS]->enable_cooliris = 0; $this->items[$iS]->overlib = 0; $this->items[$iS]->display_icon_geo = 0; $this->items[$iS]->type = 1; $this->items[$iS]->camera_info = 0; $this->items[$iS]->display_icon_extlink1 = 0; $this->items[$iS]->display_icon_extlink2 = 0; $this->items[$iS]->description = ''; $this->items[$iS]->display_icon_commentimg = 0; $this->items[$iS]->altvalue = ''; $iS++; } else { // There is no right to see the data but the object exists (because it was loaded from database // Destroy it unset($this->items[$iS]); } } } } // ---------------------------------------- // SUB FOLDERS(II) or Back Button CATEGORIES VIEW IN CATEGORY VIEW // ---------------------------------------- //display subcategories on every page if ($display_subcat_page_cv == 1 && $this->tmpl['display_categories_cv'] == 1) { $subCategory = $this->get('subcategory'); $totalSubCat = count($subCategory); if ((int) $this->tagId > 0) { $subCategory = array(); } // No subcategories for tag searching if (!empty($subCategory)) { $this->itemscv[$iCV] =& $subCategory; for ($iSub = 0; $iSub < $totalSubCat; $iSub++) { $this->itemscv[$iCV] =& $subCategory[$iSub]; // USER RIGHT - ACCESS - - - - - - - - - - $rightDisplay = PhocaGalleryAccess::getUserRight('accessuserid', $this->itemscv[$iCV]->accessuserid, $this->itemscv[$iCV]->access, $this->tmpl['user']->getAuthorisedViewLevels(), $this->tmpl['user']->get('id', 0), $display_access_category); // Display Key Icon (in case we want to display unaccessable categories in list view) $rightDisplayKey = 1; if ($display_access_category == 1) { // we simulate that we want not to display unaccessable categories // so we get rightDisplayKey = 0 then the key will be displayed if (!empty($this->itemscv[$iCV])) { $rightDisplayKey = PhocaGalleryAccess::getUserRight('accessuserid', $this->itemscv[$iCV]->accessuserid, $this->itemscv[$iCV]->access, $this->tmpl['user']->getAuthorisedViewLevels(), $this->tmpl['user']->get('id', 0), 0); } } // - - - - - - - - - - - - - - - - - - - - if ($rightDisplay > 0) { $this->itemscv[$iCV]->cls = 'pg-cvcsv-name'; $this->itemscv[$iCV]->slug = $this->itemscv[$iCV]->id . ':' . $this->itemscv[$iCV]->alias; $this->itemscv[$iCV]->item_type = "subfoldercv"; $this->itemscv[$iCV]->link = JRoute::_('index.php?option=com_phocagallery&view=category&id=' . $this->itemscv[$iCV]->slug . '&Itemid=' . $this->itemId); $this->itemscv[$iCV]->type = 4; $numlinks = $model->getCountItem($this->itemscv[$iCV]->id); //Should be get from main subcategories query if (isset($numlinks[0]) && $numlinks[0] > 0) { $this->itemscv[$iCV]->numlinks = (int) $numlinks[0]; } else { $this->itemscv[$iCV]->numlinks = 0; } $extImage = PhocaGalleryImage::isExtImage($this->itemscv[$iCV]->extid); if ($extImage) { /*$imagePic = new stdClass(); if ($this->tmpl['categoryimageordering'] != 10) { $imagePic= PhocaGalleryImageFront::getRandomImageRecursive($this->itemscv[$iCV]->id, $this->categoryImageOrderingCV, 1); $fileThumbnail = PhocaGalleryImageFront::displayCategoryExtImgOrFolder($imagePic->exts, $imagePic->extm, 'medium', $rightDisplayKey, 'display_category_icon_image'); } else { $fileThumbnail = PhocaGalleryImageFront::displayCategoryExtImgOrFolder($this->itemscv[$iCV]->exts,$this->itemscv[$iCV]->extm, 'medium', $rightDisplayKey, 'display_category_icon_image'); $imagePic->extw = $this->itemscv[$iCV]->extw; $imagePic->exth = $this->itemscv[$iCV]->exth; } // in case category is locked or no extm exists $this->itemscv[$iCV]->linkthumbnailpath = $fileThumbnail->linkthumbnailpath; $this->itemscv[$iCV]->extm = $fileThumbnail->extm; $this->itemscv[$iCV]->exts = $fileThumbnail->exts; $this->itemscv[$iCV]->exthswitch = $this->items[$iCV]->extwswitch = 0; if ($imagePic->extw != '') { $extw = explode(',',$imagePic->extw); $this->itemscv[$iCV]->extw = $extw[1]; $this->itemscv[$iCV]->extwswitch = $extw[0]; } if ($imagePic->exth != '') { $exth = explode(',',$imagePic->exth); $this->itemscv[$iCV]->exth = $exth[1]; $this->itemscv[$iCV]->exthswitch = $exth[0]; }*/ $this->itemscv[$iCV]->extpic = ''; } else { /*if ($this->tmpl['categoryimageordering'] != 10) { $randomImage = PhocaGalleryImageFront::getRandomImageRecursive($this->itemscv[$iCV]->id, $this->categoryImageOrderingCV); $fileThumbnail = PhocaGalleryImageFront::displayCategoryImageOrFolder($randomImage, 'medium', $rightDisplayKey, 'display_category_icon_image_cv'); } else { $fileThumbnail = PhocaGalleryImageFront::displayCategoryImageOrFolder($this->itemscv[$iCV]->filename, 'medium', $rightDisplayKey, 'display_category_icon_image_cv'); }*/ $this->itemscv[$iCV]->linkthumbnailpath = ''; $this->itemscv[$iCV]->altvalue = ''; } $iCV++; } else { // There is no right to see the data but the object exists (because it was loaded from database // Destroy it unset($this->itemscv[$iCV]); } } } } // ---------------------------------------- // IMAGES // ---------------------------------------- // If user has rights to delete or publish or unpublish, unbublished items should be displayed if ($rightDisplayDelete == 1) { $images = $model->getData(1, $this->tagId); $this->tmpl['pagination'] = $model->getPagination(1, $this->tagId); } else { $images = $model->getData(0, $this->tagId); $this->tmpl['pagination'] = $model->getPagination(0, $this->tagId); } $this->tmpl['ordering'] = $model->getOrdering(); $totalImg = count($images); if ($limitStart > 0) { $this->tmpl['limitstarturl'] = '&limitstart=' . $limitStart; } else { $this->tmpl['limitstarturl'] = ''; } $this->tmpl['jakdatajs'] = array(); $this->tmpl['display_icon_commentimg_box'] = 0; for ($iM = 0; $iM < $totalImg; $iM++) { $this->items[$iS] = $images[$iM]; $this->items[$iS]->cls = 'pg-box-image'; $this->items[$iS]->slug = $this->items[$iS]->id . ':' . $this->items[$iS]->alias; $this->items[$iS]->item_type = "image"; $this->items[$iS]->linknr = ''; //Def $extImage = PhocaGalleryImage::isExtImage($this->items[$iS]->extid); // Get file thumbnail or No Image $this->items[$iS]->exthswitch = $this->items[$iS]->extwswitch = 0; if ($this->items[$iS]->extm != '') { if ($this->items[$iS]->extw != '') { $extw = explode(',', $this->items[$iS]->extw); $this->items[$iS]->extw = $extw[1]; $this->items[$iS]->extwswitch = $extw[0]; } if ($this->items[$iS]->exth != '') { $exth = explode(',', $this->items[$iS]->exth); $this->items[$iS]->exth = $exth[1]; $this->items[$iS]->exthswitch = $exth[0]; } $this->items[$iS]->extpic = 1; $this->items[$iS]->linkthumbnailpath = ''; } else { // Mansory $iFormat = 'medium'; if ($this->tmpl['diff_thumb_height'] > 0) { if ($this->items[$iS]->format == 2) { $iFormat = 'medium1'; // by portraits in everycase (medium1 = medium * x2(height)) } else { $m2 = mt_rand(0, 1); if ($m2 == 1) { $iFormat = 'medium1'; } } } $this->items[$iS]->linkthumbnailpath = PhocaGalleryImageFront::displayCategoryImageOrNoImage($this->items[$iS]->filename, $iFormat); } if (isset($parentCategory->params)) { $this->items[$iS]->parentcategoryparams = $parentCategory->params; } // SWITCH IMAGE - Add the first Image as basic image if ($this->tmpl['switch_image'] == 1) { if ($basic_imageSelected == 0) { if ((int) $this->tmpl['switch_width'] > 0 && (int) $this->tmpl['switch_height'] > 0 && $this->tmpl['switch_fixed_size'] == 1) { $wHArray = array('id' => 'PhocaGalleryobjectPicture', 'border' => '0', 'width' => $this->tmpl['switch_width'], 'height' => $this->tmpl['switch_height']); $wHString = ' id="PhocaGalleryobjectPicture" border="0" width="' . $this->tmpl['switch_width'] . '" height="' . $this->tmpl['switch_height'] . '"'; } else { $wHArray = array('id' => 'PhocaGalleryobjectPicture', 'border' => '0'); $wHString = ' id="PhocaGalleryobjectPicture" border="0"'; } if (isset($this->items[$iS]->extpic) && $this->items[$iS]->extpic != '') { $this->tmpl['basic_image'] = JHtml::_('image', $this->items[$iS]->extl, '', $wHArray); } else { $this->tmpl['basic_image'] = JHtml::_('image', str_replace('phoca_thumb_m_', 'phoca_thumb_l_', $this->items[$iS]->linkthumbnailpath), '', $wHString); } $basic_imageSelected = 1; } } $thumbLink = PhocaGalleryFileThumbnail::getThumbnailName($this->items[$iS]->filename, 'large'); $thumbLinkM = PhocaGalleryFileThumbnail::getThumbnailName($this->items[$iS]->filename, 'medium'); $imgLinkOrig = JURI::base(true) . '/' . PhocaGalleryFile::getFileOriginal($this->items[$iS]->filename, 1); if ($this->tmpl['detail_window'] == 7) { $siteLink = JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $this->items[$iS]->catslug . '&id=' . $this->items[$iS]->slug . '&Itemid=' . $this->itemId); } else { $siteLink = JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $this->items[$iS]->catslug . '&id=' . $this->items[$iS]->slug . '&tmpl=component' . '&Itemid=' . $this->itemId); } $imgLink = $thumbLink->rel; if ($extImage) { $imgLink = $this->items[$iS]->extl; $imgLinkOrig = $this->items[$iS]->exto; } // Detail Window if ($this->tmpl['detail_window'] == 2) { $this->items[$iS]->link = $imgLink; $this->items[$iS]->link2 = $imgLink; $this->items[$iS]->linkother = $imgLink; $this->items[$iS]->linkorig = $imgLinkOrig; } else { if ($this->tmpl['detail_window'] == 3) { $this->items[$iS]->link = $imgLink; $this->items[$iS]->link2 = $imgLink; $this->items[$iS]->linkother = $siteLink; $this->items[$iS]->linkorig = $imgLinkOrig; } else { if ($this->tmpl['detail_window'] == 5) { $this->items[$iS]->link = $imgLink; $this->items[$iS]->link2 = $siteLink; $this->items[$iS]->linkother = $siteLink; $this->items[$iS]->linkorig = $imgLinkOrig; } else { if ($this->tmpl['detail_window'] == 6) { $this->items[$iS]->link = $imgLink; $this->items[$iS]->link2 = $imgLink; $this->items[$iS]->linkother = $siteLink; $this->items[$iS]->linkorig = $imgLinkOrig; // jak data js switch ($this->tmpl['jakdescription']) { case 0: $descriptionJakJs = ''; break; case 2: $descriptionJakJs = PhocaGalleryText::strTrimAll(addslashes($this->items[$iS]->description)); break; case 3: $descriptionJakJs = PhocaGalleryText::strTrimAll(addslashes($this->items[$iS]->title)); if ($this->items[$iS]->description != '') { $descriptionJakJs .= '<br />' . PhocaGalleryText::strTrimAll(addslashes($this->items[$iS]->description)); } break; case 1: default: $descriptionJakJs = PhocaGalleryText::strTrimAll(addslashes($this->items[$iS]->title)); break; } $this->items[$iS]->linknr = $iM; $this->tmpl['jakdatajs'][$iS] = "{alt: '" . PhocaGalleryText::strTrimAll(addslashes($this->items[$iS]->title)) . "',"; if ($descriptionJakJs != '') { $this->tmpl['jakdatajs'][$iS] .= "description: '" . $descriptionJakJs . "',"; } else { $this->tmpl['jakdatajs'][$iS] .= "description: ' ',"; } if ($extImage) { $this->tmpl['jakdatajs'][$iS] .= "small: {url: '" . $this->items[$iS]->extm . "'}," . "big: {url: '" . $this->items[$iS]->extl . "'} }"; } else { $this->tmpl['jakdatajs'][$iS] .= "small: {url: '" . htmlentities(JURI::base(true) . '/' . PhocaGalleryText::strTrimAll(addslashes($thumbLinkM->rel))) . "'}," . "big: {url: '" . htmlentities(JURI::base(true) . '/' . PhocaGalleryText::strTrimAll(addslashes($imgLink))) . "'} }"; } } else { if ($this->tmpl['detail_window'] == 8) { $this->items[$iS]->link = $imgLink; $this->items[$iS]->link2 = $imgLink; $this->items[$iS]->linkother = $imgLink; $this->items[$iS]->linkorig = $imgLinkOrig; } else { if ($this->tmpl['detail_window'] == 9) { $this->items[$iS]->link = $siteLink; $this->items[$iS]->link2 = $siteLink; $this->items[$iS]->linkother = $siteLink; $this->items[$iS]->linkorig = $imgLinkOrig; } else { if ($this->tmpl['detail_window'] == 10) { $this->items[$iS]->link = $imgLink; $this->items[$iS]->link2 = $imgLink; $this->items[$iS]->linkother = $siteLink; $this->items[$iS]->linkorig = $imgLinkOrig; } else { $this->items[$iS]->link = $siteLink; $this->items[$iS]->link2 = $siteLink; $this->items[$iS]->linkother = $siteLink; $this->items[$iS]->linkorig = $imgLinkOrig; } } } } } } } // Buttons, e.g. shadowbox: // button - click on image // button2 - click on zoom icon (cannot be the same as click on image because of duplicity of images) // buttonOther - other detail window like download, geotagging $this->items[$iS]->button =& $this->button; $this->items[$iS]->button2 =& $this->button2; $this->items[$iS]->buttonother =& $this->buttonother; $this->items[$iS]->display_icon_detail = $this->tmpl['display_icon_detail']; $this->items[$iS]->display_icon_download = $this->tmpl['display_icon_download']; $this->items[$iS]->display_name = $this->tmpl['display_name']; $this->items[$iS]->display_icon_vm = ''; $this->items[$iS]->start_cooliris = $this->tmpl['start_cooliris']; $this->items[$iS]->type = 2; // Trash icon if ($this->tmpl['trash'] == 1) { $this->items[$iS]->trash = 1; } else { $this->items[$iS]->trash = 0; } // Publish Unpublish icon if ($this->tmpl['publish_unpublish'] == 1) { $this->items[$iS]->publish_unpublish = 1; } else { $this->items[$iS]->publish_unpublish = 0; } // Publish Unpublish icon if ($this->tmpl['approved_not_approved'] == 1) { $this->items[$iS]->approved_not_approved = 1; } else { $this->items[$iS]->approved_not_approved = 0; } // PICLENS if ($this->tmpl['enablecooliris']) { $this->items[$iS]->enable_cooliris = 1; } else { $this->items[$iS]->enable_cooliris = 0; } // 2. GEOTAGGING IMAGE // We have checked the category so if geotagging is enabled // and there is no geotagging data for category, then $this->tmpl['display_icon_geo'] = 0; // so we need to check it for the image too, we need to set the $this->tmpl['display_icon_geoimage'] for image only // we are in loop now $this->tmpl['display_icon_geoimagetmp'] = 0; if ($this->tmpl['display_icon_geoimage'] == 1) { $this->tmpl['display_icon_geoimagetmp'] = 1; if (isset($this->items[$iS]->latitude) && $this->items[$iS]->latitude != '' && $this->items[$iS]->latitude != 0 && isset($this->items[$iS]->longitude) && $this->items[$iS]->longitude != '' && $this->items[$iS]->longitude != 0) { } else { $this->tmpl['display_icon_geoimagetmp'] = 0; } } // GEOTAGGING if ($this->tmpl['display_icon_geo'] == 1 || $this->tmpl['display_icon_geoimagetmp'] == 1) { $this->items[$iS]->display_icon_geo = 1; $this->tmpl['display_icon_geo_box'] = 1; // because of height of box } else { $this->items[$iS]->display_icon_geo = 0; } // Set it back because of loop $this->tmpl['display_icon_geoimagetmp'] = 0; // CAMERA INFO if ($this->tmpl['display_camera_info'] == 1) { $this->items[$iS]->camera_info = 1; } else { $this->items[$iS]->camera_info = 0; } // EXT LINK $this->items[$iS]->display_icon_extlink1 = 0; if (isset($this->items[$iS]->extlink1)) { $this->items[$iS]->extlink1 = explode("|", $this->items[$iS]->extlink1, 4); if (isset($this->items[$iS]->extlink1[0]) && $this->items[$iS]->extlink1[0] != '' && isset($this->items[$iS]->extlink1[1])) { $this->items[$iS]->display_icon_extlink1 = 1; $this->tmpl['display_icon_extlink1_box'] = 1; // because of height of box if (!isset($this->items[$iS]->extlink1[2])) { $this->items[$iS]->extlink1[2] = '_self'; } if (!isset($this->items[$iS]->extlink1[3]) || $this->items[$iS]->extlink1[3] == 1) { $this->items[$iS]->extlink1[4] = JHtml::_('image', 'media/com_phocagallery/images/icon-extlink1.png', JText::_($this->items[$iS]->extlink1[1])); $this->items[$iS]->extlink1[5] = ''; } else { $this->items[$iS]->extlink1[4] = $this->items[$iS]->extlink1[1]; $this->items[$iS]->extlink1[5] = 'style="text-decoration:underline"'; } } else { $this->items[$iS]->display_icon_extlink1 = 0; } } $this->items[$iS]->display_icon_extlink2 = 0; if (isset($this->items[$iS]->extlink2)) { $this->items[$iS]->extlink2 = explode("|", $this->items[$iS]->extlink2, 4); if (isset($this->items[$iS]->extlink2[0]) && $this->items[$iS]->extlink2[0] != '' && isset($this->items[$iS]->extlink2[1])) { $this->items[$iS]->display_icon_extlink2 = 1; $this->tmpl['display_icon_extlink2_box'] = 1; // because of height of box if (!isset($this->items[$iS]->extlink2[2])) { $this->items[$iS]->extlink2[2] = '_self'; } if (!isset($this->items[$iS]->extlink2[3]) || $this->items[$iS]->extlink2[3] == 1) { $this->items[$iS]->extlink2[4] = JHtml::_('image', 'media/com_phocagallery/images/icon-extlink2.png', JText::_($this->items[$iS]->extlink2[1])); $this->items[$iS]->extlink2[5] = ''; } else { $this->items[$iS]->extlink2[4] = $this->items[$iS]->extlink2[1]; $this->items[$iS]->extlink2[5] = 'style="text-decoration:underline"'; } } else { $this->items[$iS]->display_icon_extlink2 = 0; } } // OVERLIB if (!empty($this->items[$iS]->description)) { $divPadding = 'ph-ovrl1'; } else { $divPadding = 'ph-ovrl2'; } // Resize image in overlib by rate $wHOutput = array(); if (isset($this->items[$iS]->extpic) && $this->items[$iS]->extpic != '') { if ((int) $this->tmpl['overlibimagerate'] > 0) { $imgSize = @getimagesize($this->items[$iS]->extl); $wHOutput = PhocaGalleryImage::getTransformImageArray($imgSize, $this->tmpl['overlibimagerate']); } $oImg = JHtml::_('image', $this->items[$iS]->extl, '', $wHOutput); } else { $thumbL = str_replace('phoca_thumb_m1_', 'phoca_thumb_m_', $this->items[$iS]->linkthumbnailpath); $thumbL = str_replace('phoca_thumb_m2_', 'phoca_thumb_m_', $thumbL); $thumbL = str_replace('phoca_thumb_m3_', 'phoca_thumb_m_', $thumbL); $thumbL = str_replace('phoca_thumb_m_', 'phoca_thumb_l_', $thumbL); if ((int) $this->tmpl['overlibimagerate'] > 0) { $imgSize = @getimagesize($thumbL); $wHOutput = PhocaGalleryImage::getTransformImageArray($imgSize, $this->tmpl['overlibimagerate']); } $thumbLI = str_replace('phoca_thumb_m1_', 'phoca_thumb_m_', $this->items[$iS]->linkthumbnailpath); $thumbLI = str_replace('phoca_thumb_m2_', 'phoca_thumb_m_', $thumbLI); $thumbLI = str_replace('phoca_thumb_m3_', 'phoca_thumb_m_', $thumbLI); $oImg = JHtml::_('image', $thumbL, '', $wHOutput); } switch ($enable_overlib) { case 1: case 4: $uBy = ''; //Uploaded by ... if ($enable_overlib == 4 && isset($this->items[$iS]->usernameno) && $this->items[$iS]->usernameno != '') { $uBy = '<div>' . JText::_('COM_PHOCAGALLERY_UPLOADED_BY') . ' <strong>' . $this->items[$iS]->usernameno . '</strong></div>'; } $this->items[$iS]->overlib = 1; $this->items[$iS]->overlib_value = "\n\n" . "onmouseover=\"return overlib('" . htmlspecialchars(addslashes('<div class="pg-overlib"><center>' . $oImg . "</center></div>" . $uBy)) . "', CAPTION, '" . htmlspecialchars(addslashes($this->items[$iS]->title)) . "' ," . htmlspecialchars($this->tmpl['overlib_attributes']) . ");\"" . " onmouseout=\"return nd();\"" . "\n"; break; case 2: case 5: $uBy = ''; //Uploaded by ... if ($enable_overlib == 5 && isset($this->items[$iS]->usernameno) && $this->items[$iS]->usernameno != '') { $uBy = '<div>' . JText::_('COM_PHOCAGALLERY_UPLOADED_BY') . ' <strong>' . $this->items[$iS]->usernameno . '</strong></div>'; } $this->items[$iS]->overlib = 2; $this->items[$iS]->description = str_replace('"', '\'', $this->items[$iS]->description); $this->items[$iS]->description = str_replace("\n", '<br />', $this->items[$iS]->description); $sA = array(utf8_encode(chr(11)), utf8_encode(chr(160))); $eA = array("\t", "\n", "\r", ""); $this->items[$iS]->description = str_replace($sA, ' ', $this->items[$iS]->description); $this->items[$iS]->description = str_replace($eA, '', $this->items[$iS]->description); $this->items[$iS]->overlib_value = " onmouseover=\"return overlib('" . htmlspecialchars(addslashes('<div class="pg-overlib"><div class="' . $divPadding . '">' . $this->items[$iS]->description . '</div></div>' . $uBy)) . "', CAPTION, '" . htmlspecialchars(addslashes($this->items[$iS]->title)) . "', " . htmlspecialchars($this->tmpl['overlib_attributes']) . ");\"" . " onmouseout=\"return nd();\" "; break; case 3: case 6: $uBy = ''; //Uploaded by ... if ($enable_overlib == 6 && isset($this->items[$iS]->usernameno) && $this->items[$iS]->usernameno != '') { $uBy = '<div>' . JText::_('COM_PHOCAGALLERY_UPLOADED_BY') . ' <strong>' . $this->items[$iS]->usernameno . '</strong></div>'; } $this->items[$iS]->overlib = 3; $this->items[$iS]->description = str_replace('"', '\'', $this->items[$iS]->description); $this->items[$iS]->description = str_replace("\n", '<br />', $this->items[$iS]->description); $sA = array(utf8_encode(chr(11)), utf8_encode(chr(160))); $eA = array("\t", "\n", "\r", ""); $this->items[$iS]->description = str_replace($sA, ' ', $this->items[$iS]->description); $this->items[$iS]->description = str_replace($eA, '', $this->items[$iS]->description); $this->items[$iS]->overlib_value = " onmouseover=\"return overlib('" . PhocaGalleryText::strTrimAll(htmlspecialchars(addslashes('<div class="pg-overlib"><div style="text-align:center"><center>' . $oImg . '</center></div><div class="' . $divPadding . '">' . $this->items[$iS]->description . '</div></div>' . $uBy))) . "', CAPTION, '" . htmlspecialchars(addslashes($this->items[$iS]->title)) . "', " . htmlspecialchars($this->tmpl['overlib_attributes']) . ");\"" . " onmouseout=\"return nd();\" "; break; default: $this->items[$iS]->overlib = 0; $this->items[$iS]->overlib_value = ''; break; } // VirtueMart link if ($this->tmpl['display_icon_vm'] == 1) { phocagalleryimport('phocagallery.virtuemart.virtuemart'); $vmLink = PhocaGalleryVirtueMart::getVmLink($this->items[$iS]->vmproductid, $errorMsg); if (!$vmLink) { $this->items[$iS]->display_icon_vm = ''; } else { $this->items[$iS]->display_icon_vm = 1; $this->items[$iS]->vmlink = $vmLink; $this->tmpl['display_icon_vmbox'] = 1; // because of height of box } } else { $this->items[$iS]->display_icon_vm = ''; } // End VM Link // V O T E S - IMAGES if ((int) $this->tmpl['display_rating_img'] == 1) { $this->items[$iS]->votescountimg = 0; $this->items[$iS]->votesaverageimg = 0; $this->items[$iS]->voteswidthimg = 0; $votesStatistics = PhocaGalleryRateImage::getVotesStatistics((int) $this->items[$iS]->id); if (!empty($votesStatistics->count)) { $this->items[$iS]->votescountimg = $votesStatistics->count; } if (!empty($votesStatistics->average)) { $this->items[$iS]->votesaverageimg = $votesStatistics->average; if ($this->items[$iS]->votesaverageimg > 0) { $this->items[$iS]->votesaverageimg = round((double) $this->items[$iS]->votesaverageimg / 0.5) * 0.5; $this->items[$iS]->voteswidthimg = 16 * $this->items[$iS]->votesaverageimg; } else { $this->items[$iS]->votesaverageimg = (int) 0; // not float displaying } } } $this->items[$iS]->display_icon_commentimg = 0; // C O M M E N T S - IMAGES if ((int) $this->tmpl['display_comment_img'] == 1 || (int) $this->tmpl['display_comment_img'] == 3) { $this->items[$iS]->display_icon_commentimg = 1; $this->tmpl['display_icon_commentimg_box'] = 1; // because of height of box } // COMMENTS IMAGES, masonry if ((int) $this->tmpl['display_comment_img'] == 2 || (int) $this->tmpl['display_comment_img'] == 3) { //PhocaGalleryCommentImage::renderCommentImageJS(); $this->items[$iS]->allready_commented = 0; $this->items[$iS]->allready_commented = PhocaGalleryCommentImage::checkUserComment((int) $this->items[$iS]->id, (int) $this->tmpl['user']->id); $this->items[$iS]->comment_items = PhocaGalleryCommentImage::displayComment($this->items[$iS]->id); } // ALT VALUE $altValue = PhocaGalleryRenderFront::getAltValue($this->tmpl['altvalue'], $this->items[$iS]->title, $this->items[$iS]->description, $this->items[$iS]->metadesc); $this->items[$iS]->altvalue = $altValue; // TITLE TAG - Description Output in Title Tag $imgAlt = $imgTitle = ''; // Some methods cannot use Alt because of conflicting with Title and popup methods if ($this->tmpl['detail_window'] == 3 || $this->tmpl['detail_window'] == 9 || $this->tmpl['detail_window'] == 10) { $imgAlt = $this->items[$iS]->altvalue; $imgTitle = $this->items[$iS]->title; if ($imgAlt == $imgTitle) { $imgAlt = ''; } $this->items[$iS]->oimgalt = $imgAlt; } else { $this->items[$iS]->oimgalt = $altValue; } // TITLE TAG - Detail if ($this->tmpl['detail_window'] == 9 || $this->tmpl['detail_window'] == 10) { $detailAlt = $this->items[$iS]->altvalue; $detailTitle = $this->items[$iS]->title; if ($detailAlt == $detailTitle) { $detailAlt = ''; } } else { $detailAlt = JText::_('COM_PHOCAGALLERY_IMAGE_DETAIL'); $detailTitle = JText::_('COM_PHOCAGALLERY_IMAGE_DETAIL'); } $this->items[$iS]->oimgaltdetail = $detailAlt; $this->items[$iS]->oimgtitledetail = $detailTitle; $titleDesc = ''; if ($this->tmpl['display_title_description'] == 1) { $titleDesc .= $this->items[$iS]->title; if ($this->items[$iS]->description != '' && $titleDesc != '') { $titleDesc .= ' - '; } } if ($this->tmpl['detail_window'] == 8 && $this->tmpl['displaydescriptiondetail'] == 1) { $this->items[$iS]->odesctitletag = strip_tags($titleDesc) . strip_tags($this->items[$iS]->description); } else { $this->items[$iS]->odesctitletag = strip_tags($imgTitle); } // Overlib class if ($this->items[$iS]->overlib == 0) { $this->items[$iS]->ooverlibclass = array('class' => 'pg-image'); } else { $this->items[$iS]->ooverlibclass = array('class' => 'pimo pg-image'); } // Tags $this->items[$iS]->otags = ''; if ($this->tmpl['display_tags_links'] == 1 || $this->tmpl['display_tags_links'] == 3) { $this->items[$iS]->otags = PhocaGalleryTag::displayTags($this->items[$iS]->id); if ($this->items[$iS]->otags != '') { $this->tmpl['displaying_tags_true'] = 1; } } $iS++; } // END IMAGES // Upload Form - - - - - - - - - - - - - // Set FTP form $ftp = !JClientHelper::hasCredentials('ftp'); // PARAMS - Upload size $this->tmpl['uploadmaxsize'] = $this->params->get('upload_maxsize', 3000000); $sess = JFactory::getSession(); $this->assignRef('session', $sess); //$this->assignRef('uploadmaxsize', $upload_maxsize); // END Upload Form - - - - - - - - - - - - // V O T E S - CATEGORY // Only registered (VOTES + COMMENTS) $this->tmpl['not_registered'] = true; $this->tmpl['name'] = ''; if ($access > 0) { $this->tmpl['not_registered'] = false; $this->tmpl['name'] = $this->tmpl['user']->name; } // VOTES Statistics if ((int) $this->tmpl['display_rating'] == 1 && (int) $id > 0) { $this->tmpl['votescount'] = 0; $this->tmpl['votesaverage'] = 0; $this->tmpl['voteswidth'] = 0; $votesStatistics = PhocaGalleryRateCategory::getVotesStatistics((int) $id); if (!empty($votesStatistics->count)) { $this->tmpl['votescount'] = $votesStatistics->count; } if (!empty($votesStatistics->average)) { $this->tmpl['votesaverage'] = $votesStatistics->average; if ($this->tmpl['votesaverage'] > 0) { $this->tmpl['votesaverage'] = round((double) $this->tmpl['votesaverage'] / 0.5) * 0.5; $this->tmpl['voteswidth'] = 22 * $this->tmpl['votesaverage']; } else { $this->tmpl['votesaverage'] = (int) 0; // not float displaying } } if ((int) $this->tmpl['votescount'] > 1) { $this->tmpl['votestext'] = 'COM_PHOCAGALLERY_VOTES'; } else { $this->tmpl['votestext'] = 'COM_PHOCAGALLERY_VOTE'; } // Already rated? $this->tmpl['alreay_rated'] = PhocaGalleryRateCategory::checkUserVote((int) $id, (int) $this->tmpl['user']->id); } // COMMENTS if ((int) $this->tmpl['display_comment'] == 1 && (int) $id > 0) { $document->addScript(JURI::base(true) . '/media/com_phocagallery/js/comments.js'); $document->addCustomTag(PhocaGalleryRenderFront::renderCommentJS((int) $this->tmpl['maxcommentchar'])); $this->tmpl['already_commented'] = PhocaGalleryCommentCategory::checkUserComment((int) $id, (int) $this->tmpl['user']->id); $commentItem = PhocaGalleryCommentCategory::displaycomment((int) $id); $this->assignRef('commentitem', $commentItem); } // - - - - - - - - - - - - - - - - // TABS // - - - - - - - - - - - - - - - - $this->tmpl['displaytabs'] = 0; $this->tmpl['currenttab'] = 0; if ((int) $id > 0) { $displayTabs = 0; // R A T I N G if ((int) $this->tmpl['display_rating'] == 0) { $currentTab['rating'] = -1; } else { $currentTab['rating'] = $displayTabs; $displayTabs++; } // C O M M E N T S if ((int) $this->tmpl['display_comment'] == 0) { $currentTab['comment'] = -1; } else { $currentTab['comment'] = $displayTabs; $displayTabs++; } // S T A T I S T I C S if ((int) $this->tmpl['displaycategorystatistics'] == 0) { $currentTab['statistics'] = -1; } else { $currentTab['statistics'] = $displayTabs; $displayTabs++; $this->tmpl['displaymaincatstat'] = $this->params->get('display_main_cat_stat', 1); $this->tmpl['displaylastaddedcatstat'] = $this->params->get('display_lastadded_cat_stat', 1); $this->tmpl['displaymostviewedcatstat'] = $this->params->get('display_mostviewed_cat_stat', 1); $this->tmpl['countlastaddedcatstat'] = $this->params->get('count_lastadded_cat_stat', 3); $this->tmpl['countmostviewedcatstat'] = $this->params->get('count_mostviewed_cat_stat', 3); if ($this->tmpl['displaymaincatstat'] == 1) { $numberImgP = $model->getCountImages($id, 1); $this->tmpl['numberimgpub'] = $numberImgP->countimg; $numberImgU = $model->getCountImages($id, 0); $this->tmpl['numberimgunpub'] = $numberImgU->countimg; $this->categoryViewed = $model->getHits($id); $this->tmpl['categoryviewed'] = $this->categoryViewed->catviewed; } // M O S T V I E W E D I M A G E S //$this->tmpl['mostviewedimg'] = array(); if ($this->tmpl['displaymostviewedcatstat'] == 1) { $mostViewedImages = $model->getStatisticsImages($id, 'hits', 'DESC', $this->tmpl['countmostviewedcatstat']); for ($i = 0; $i < count($mostViewedImages); $i++) { $itemMVI =& $mostViewedImages[$i]; $itemMVI->button =& $this->button; $itemMVI->button2 =& $this->button2; $itemMVI->buttonother =& $this->buttonother; $itemMVI->display_icon_detail = $this->tmpl['display_icon_detail']; $itemMVI->display_name = $this->tmpl['display_name']; $itemMVI->type = 2; $altValue = PhocaGalleryRenderFront::getAltValue($this->tmpl['altvalue'], $itemMVI->title, $itemMVI->description, $itemMVI->metadesc); $itemMVI->altvalue = $altValue; $thumbLink = PhocaGalleryFileThumbnail::getThumbnailName($itemMVI->filename, 'large'); $siteLink = JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $this->category->slug . '&id=' . $itemMVI->slug . '&tmpl=component' . '&Itemid=' . $this->itemId); $imgLink = JURI::base(true) . '/' . $thumbLink->rel; switch ($this->tmpl['detail_window']) { case 2: case 3: case 8: $itemMVI->link = $imgLink; break; default: $itemMVI->link = $siteLink; break; } //$this->tmpl['mostviewedimg'][] = $itemMVI; if ($itemMVI->extw != '') { $extw = explode(',', $itemMVI->extw); $itemMVI->extw = $extw[1]; } if ($itemMVI->exth != '') { $exth = explode(',', $itemMVI->exth); $itemMVI->exth = $exth[1]; } } $this->tmpl['mostviewedimg'] = $mostViewedImages; } // L A S T A D D E D I M A G E S //$this->tmpl['lastaddedimg'] = array(); if ($this->tmpl['displaylastaddedcatstat'] == 1) { $lastAddedImages = $model->getStatisticsImages($id, 'date', 'DESC', $this->tmpl['countlastaddedcatstat']); for ($i = 0; $i < count($lastAddedImages); $i++) { $itemLAI =& $lastAddedImages[$i]; $itemLAI->link = JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $this->category->slug . '&id=' . $itemLAI->slug . '&tmpl=component' . '&Itemid=' . $this->itemId); $itemLAI->button =& $this->button; $itemLAI->button2 =& $this->button2; $itemLAI->buttonother =& $this->buttonother; $itemLAI->display_icon_detail = $this->tmpl['display_icon_detail']; $itemLAI->display_name = $this->tmpl['display_name']; $itemLAI->type = 2; $altValue = PhocaGalleryRenderFront::getAltValue($this->tmpl['altvalue'], $itemLAI->title, $itemLAI->description, $itemLAI->metadesc); $itemLAI->altvalue = $altValue; $thumbLink = PhocaGalleryFileThumbnail::getThumbnailName($itemLAI->filename, 'large'); $siteLink = JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $this->category->slug . '&id=' . $itemLAI->slug . '&tmpl=component' . '&Itemid=' . $this->itemId); $imgLink = JURI::base(true) . '/' . $thumbLink->rel; switch ($this->tmpl['detail_window']) { case 2: case 3: case 8: $itemLAI->link = $imgLink; break; default: $itemLAI->link = $siteLink; break; } //$this->tmpl['lastaddedimg'][] = $itemLAI; if ($itemLAI->extw != '') { $extw = explode(',', $itemLAI->extw); $itemLAI->extw = $extw[1]; } if ($itemLAI->exth != '') { $exth = explode(',', $itemLAI->exth); $itemLAI->exth = $exth[1]; } } $this->tmpl['lastaddedimg'] = $lastAddedImages; } } // G E O T A G G I N G if ((int) $this->tmpl['displaycategorygeotagging'] == 0) { $currentTab['geotagging'] = -1; } else { if ($this->map['longitude'] == '') { $currentTab['geotagging'] = -1; } else { if ($this->map['latitude'] == '') { $currentTab['geotagging'] = -1; } else { $currentTab['geotagging'] = $displayTabs; $displayTabs++; $this->tmpl['googlemapsapikey'] = $this->params->get('google_maps_api_key', ''); $this->tmpl['categorymapwidth'] = $this->params->get('category_map_width', ''); $this->tmpl['categorymapheight'] = $this->params->get('category_map_height', 400); } } } if ((int) $this->tmpl['displaycreatecat'] == 0) { $currentTab['createsubcategory'] = -1; } else { $currentTab['createsubcategory'] = $displayTabs; $displayTabs++; } // = = = = = = = = = = // U P L O A D // = = = = = = = = = = $this->tmpl['ftp'] = !JClientHelper::hasCredentials('ftp'); // SEF problem $isThereQM = false; $isThereQM = preg_match("/\\?/i", $this->tmpl['action']); if ($isThereQM) { $amp = '&'; // will be protected by htmlspecialchars } else { $amp = '?'; } $isThereTab = false; $isThereTab = preg_match("/tab=/i", $this->tmpl['action']); if ((int) $this->tmpl['displayupload'] == 0) { $currentTab['upload'] = -1; } else { $currentTab['upload'] = $displayTabs; $displayTabs++; } if ((int) $this->tmpl['ytbupload'] == 0 || (int) $this->tmpl['displayupload'] == 0) { $currentTab['ytbupload'] = -1; } else { $currentTab['ytbupload'] = $displayTabs; $displayTabs++; } if ((int) $this->tmpl['enablemultiple'] < 1 || (int) $this->tmpl['displayupload'] == 0) { $currentTab['multipleupload'] = -1; } else { $currentTab['multipleupload'] = $displayTabs; $displayTabs++; } if ((int) $this->tmpl['enablejava'] < 1 || (int) $this->tmpl['displayupload'] == 0) { $currentTab['javaupload'] = -1; } else { $currentTab['javaupload'] = $displayTabs; $displayTabs++; } $this->tmpl['displaytabs'] = $displayTabs; $this->tmpl['currenttab'] = $currentTab; // - - - - - - - - - - - // Upload // - - - - - - - - - - - if ((int) $this->tmpl['displayupload'] == 1) { $sU = new PhocaGalleryFileUploadSingle(); $sU->returnUrl = htmlspecialchars($this->tmpl['action'] . $amp . 'task=upload&' . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&viewback=category&tab=' . $this->tmpl['currenttab']['upload']); $sU->tab = $this->tmpl['currenttab']['upload']; $this->tmpl['su_output'] = $sU->getSingleUploadHTML(1); $this->tmpl['su_url'] = htmlspecialchars($this->tmpl['action'] . $amp . 'task=upload&' . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&viewback=category&tab=' . $this->tmpl['currenttab']['upload']); } // - - - - - - - - - - - // Youtube Upload (single upload form can be used) // - - - - - - - - - - - if ((int) $this->tmpl['ytbupload'] == 1 && $this->tmpl['displayupload'] == 1) { $sYU = new PhocaGalleryFileUploadSingle(); $sYU->returnUrl = htmlspecialchars($this->tmpl['action'] . $amp . 'task=ytbupload&' . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&viewback=category&tab=' . $this->tmpl['currenttab']['ytbupload']); $sYU->tab = $this->tmpl['currenttab']['ytbupload']; $this->tmpl['syu_output'] = $sYU->getSingleUploadHTML(1); $this->tmpl['syu_url'] = htmlspecialchars($this->tmpl['action'] . $amp . 'task=ytbupload&' . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&viewback=category&tab=' . $this->tmpl['currenttab']['ytbupload']); } // - - - - - - - - - - - // Multiple Upload // - - - - - - - - - - - // Get infos from multiple upload $muFailed = $app->input->get('mufailed', '0', 'int'); $muUploaded = $app->input->get('muuploaded', '0', 'int'); $this->tmpl['mu_response_msg'] = $muUploadedMsg = ''; if ($muUploaded > 0) { $muUploadedMsg = JText::_('COM_PHOCAGALLERY_COUNT_UPLOADED_IMG') . ': ' . $muUploaded; } if ($muFailed > 0) { $muFailedMsg = JText::_('COM_PHOCAGALLERY_COUNT_NOT_UPLOADED_IMG') . ': ' . $muFailed; } if ($muFailed > 0 && $muUploaded > 0) { $this->tmpl['mu_response_msg'] = '<div class="alert alert-info">' . JText::_('COM_PHOCAGALLERY_COUNT_UPLOADED_IMG') . ': ' . $muUploaded . '<br />' . JText::_('COM_PHOCAGALLERY_COUNT_NOT_UPLOADED_IMG') . ': ' . $muFailed . '</div>'; } else { if ($muFailed > 0 && $muUploaded == 0) { $this->tmpl['mu_response_msg'] = '<div class="alert alert-error">' . JText::_('COM_PHOCAGALLERY_COUNT_NOT_UPLOADED_IMG') . ': ' . $muFailed . '</div>'; } else { if ($muFailed == 0 && $muUploaded > 0) { $this->tmpl['mu_response_msg'] = '<div class="alert alert-success">' . JText::_('COM_PHOCAGALLERY_COUNT_UPLOADED_IMG') . ': ' . $muUploaded . '</div>'; } else { $this->tmpl['mu_response_msg'] = ''; } } } if ((int) $this->tmpl['enablemultiple'] == 1 && (int) $this->tmpl['displayupload'] == 1) { PhocaGalleryFileUploadMultiple::renderMultipleUploadLibraries(); $mU = new PhocaGalleryFileUploadMultiple(); $mU->frontEnd = 1; $mU->method = $this->tmpl['multipleuploadmethod']; $mU->url = htmlspecialchars($this->tmpl['action'] . $amp . 'controller=category&task=multipleupload&' . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&tab=' . $this->tmpl['currenttab']['multipleupload']); $mU->reload = htmlspecialchars($this->tmpl['action'] . $amp . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&tab=' . $this->tmpl['currenttab']['multipleupload']); $mU->maxFileSize = PhocaGalleryFileUploadMultiple::getMultipleUploadSizeFormat($this->tmpl['uploadmaxsize']); $mU->chunkSize = '1mb'; $mU->imageHeight = $this->tmpl['multipleresizeheight']; $mU->imageWidth = $this->tmpl['multipleresizewidth']; $mU->imageQuality = 100; $mU->renderMultipleUploadJS(0, $this->tmpl['multipleuploadchunk']); $this->tmpl['mu_output'] = $mU->getMultipleUploadHTML(); } // - - - - - - - - - - - // Java Upload // - - - - - - - - - - - if ((int) $this->tmpl['enablejava'] == 1 && (int) $this->tmpl['displayupload'] == 1) { $jU = new PhocaGalleryFileUploadJava(); $jU->width = $this->tmpl['javaboxwidth']; $jU->height = $this->tmpl['javaboxheight']; $jU->resizewidth = $this->tmpl['multipleresizewidth']; $jU->resizeheight = $this->tmpl['multipleresizeheight']; $jU->uploadmaxsize = $this->tmpl['uploadmaxsize']; $jU->returnUrl = $this->tmpl['action'] . $amp . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&tab=' . $this->tmpl['currenttab']['javaupload']; $jU->url = $this->tmpl['action'] . $amp . 'controller=category&task=javaupload&' . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&tab=' . $this->tmpl['currenttab']['javaupload']; $jU->source = JURI::root(true) . '/components/com_phocagallery/assets/jupload/wjhk.jupload.jar'; $this->tmpl['ju_output'] = $jU->getJavaUploadHTML(); } } $this->tmpl['dem'] = '<div style="text-align:right;color:#ccc;display:block">Powered by <a href="http://www.phoca.cz/phocagallery">Phoca Gallery</a></div>'; // ADD STATISTICS if ((int) $id > 0) { $model->hit($id); } // ADD JAK DATA CSS style if ($this->tmpl['detail_window'] == 6) { $document->addCustomTag('<script type="text/javascript">' . 'var dataJakJs = [' . implode($this->tmpl['jakdatajs'], ',') . ']' . '</script>'); } // Detail Window - will be popup or not if ($this->tmpl['detail_window'] == 7) { $this->tmpl['tmplcom'] = ''; $this->tmpl['tmplcomcomments'] = ''; } else { $this->tmpl['tmplcom'] = '&tmpl=component'; $this->tmpl['tmplcomcomments'] = '&tmpl=component'; } if ($this->tmpl['display_comment_nopup'] == 1) { $this->tmpl['tmplcomcomments'] = ''; } $this->tmpl['boxsize'] = PhocaGalleryImage::setBoxSize($this->tmpl, 2); $this->tmpl['boxsizestat'] = PhocaGalleryImage::setBoxSize($this->tmpl, 3); $masBoxWidth = $this->tmpl['boxsize']['width'] + 20; // Masonry effect if ($this->tmpl['diff_thumb_height'] == 2) { $document->addScript(JURI::base(true) . '/components/com_phocagallery/assets/masonry/masonry.min.js'); $document->addCustomTag('<script type="text/javascript"> window.onload = function() { var wall = new Masonry( document.getElementById(\'pg-msnr-container\'), { isFitWidth: true }); }; </script>'); } // CSS Specific $s = "\n" . '#phocagallery {' . "\n"; if ($this->tmpl['phocagallery_center'] != '') { $s .= ' margin: 0 auto; text-align: center;' . "\n"; } if ($this->tmpl['phocagallery_width'] != '') { $s .= ' width: ' . $this->tmpl['phocagallery_width'] . 'px;' . "\n"; } $s .= '}' . "\n"; if ($this->tmpl['phocagallery_center'] != '') { $s = "\n" . '#pg-msnr-container {' . "\n"; $s .= ' margin: 0 auto;' . "\n"; $s .= '}' . "\n"; } $s .= '.pg-cv-box {' . "\n"; if ($this->tmpl['diff_thumb_height'] > 0) { } else { $s .= ' height: ' . $this->tmpl['boxsize']['height'] . 'px;' . "\n"; } $s .= ' width: ' . $this->tmpl['boxsize']['width'] . 'px;"' . "\n"; $s .= '}' . "\n"; $s .= '.pg-cv-box-stat {' . "\n"; $s .= ' height: ' . $this->tmpl['boxsizestat']['height'] . 'px;' . "\n"; $s .= ' width: ' . $this->tmpl['boxsizestat']['width'] . 'px;"' . "\n"; $s .= '}' . "\n"; $s .= '.pg-cv-box-img {' . "\n"; $s .= ' height: ' . $this->tmpl['imageheight'] . 'px;' . "\n"; $s .= ' width: ' . $this->tmpl['imagewidth'] . 'px;"' . "\n"; $s .= '}' . "\n"; $document->addCustomTag('<style type="text/css">' . $s . '</style>'); $this->_prepareDocument(); parent::display($tpl); }
/** * Determine whether input fields for client settings need to be shown * * If valid credentials were passed along with the request, they are saved to the session. * This functions returns an exception if invalid credentials have been given or if the * connection to the server failed for some other reason. * * @param string $client The name of the client. * * @return mixed True, if FTP settings should be shown or an exception * * @since 11.1 */ public static function setCredentialsFromRequest($client) { // Determine wether FTP credentials have been passed along with the current request $user = JRequest::getString('username', null, 'POST', JREQUEST_ALLOWRAW); $pass = JRequest::getString('password', null, 'POST', JREQUEST_ALLOWRAW); if ($user != '' && $pass != '') { // Add credentials to the session if (JClientHelper::setCredentials($client, $user, $pass)) { $return = false; } else { $return = JError::raiseWarning('SOME_ERROR_CODE', JText::_('JLIB_CLIENT_ERROR_HELPER_SETCREDENTIALSFROMREQUEST_FAILED')); } } else { // Just determine if the FTP input fields need to be shown $return = !JClientHelper::hasCredentials('ftp'); } return $return; }
/** * Does the user need to provide FTP credentials? It also registers any FTP credentials provided in the URL. * * @return bool True if the user needs to provide FTP credentials */ public function needsFTPCredentials() { // Determine wether FTP credentials have been passed along with the current request \JLoader::import('joomla.client.helper'); $user = $this->input->get('username', null, 'raw'); $pass = $this->input->get('password', null, 'raw'); if (!($user == '' && $pass == '')) { // Add credentials to the session if (\JClientHelper::setCredentials('ftp', $user, $pass)) { return false; } return true; } return !\JClientHelper::hasCredentials('ftp'); }
/** * Determine wether input fields for client settings need to be shown * * If valid credentials were passed along with the request, they are saved to the session. * This functions returns an exeption if invalid credentials have been given or if the * connection to the server failed for some other reason. * @static * @return boolean|JExeption True, if FTP settings should be shown, or an exeption * @since 1.5 */ function &setCredentialsFromRequest($client) { // Determine wether FTP credentials have been passed along with the current request $user = JRequest::getString('username', null, 'POST', JREQUEST_ALLOWRAW); $pass = JRequest::getString('password', null, 'POST', JREQUEST_ALLOWRAW); if ($user != '' && $pass != '') { // Add credentials to the session if (JClientHelper::setCredentials($client, $user, $pass)) { $return = false; } else { $return =& JError::raiseWarning('SOME_ERROR_CODE', 'JClientHelper::setCredentialsFromRequest failed'); } } else { // Just determine if the FTP input fields need to be shown $return = !JClientHelper::hasCredentials('ftp'); } return $return; }
function display($tpl = null) { global $mainframe; $document =& JFactory::getDocument(); $uri =& JFactory::getURI(); $menus =& JSite::getMenu(); $menu = $menus->getActive(); $params =& $mainframe->getParams(); $user =& JFactory::getUser(); // Only registered users if ($user->aid == 0) { $mainframe->redirect(JRoute::_('index.php?option=com_user&view=login', false), JText::_("ALERTNOTAUTH")); exit; } // CSS, JS JHTML::stylesheet('phocagallery.css', 'components/com_phocagallery/assets/'); $document->addCustomTag("<!--[if lt IE 8]>\n<link rel=\"stylesheet\" href=\"" . JURI::base(true) . "/components/com_phocagallery/assets/phocagalleryieall.css\" type=\"text/css\" />\n<![endif]-->"); $document->addScript(JURI::base(true) . '/components/com_phocagallery/assets/js/comments.js'); //$id = JRequest::getVar('id', 0, '', 'int'); $tmpl['tab'] = JRequest::getVar('tab', 0, '', 'string'); $tmpl['formaticon'] = PhocaGalleryHelperFront::getFormatIcon(); $tmpl['displaytitleupload'] = $params->get('display_title_upload', 0); $tmpl['displaydescupload'] = $params->get('display_description_upload', 0); $tmpl['maxuploadchar'] = $params->get('max_upload_char', 1000); $tmpl['maxcreatecatchar'] = $params->get('max_create_cat_char', 1000); $display_phoca_info = $params->get('display_phoca_info', 1); $tmpl['phocainfocode'] = PhocaGalleryHelper::getPhocaInfoCode((int) $display_phoca_info); $tmpl['showpagetitle'] = $params->get('show_page_title', 1); // UCP is disabled (security reasons) $enable_user_cp = $params->get('enable_user_cp', 0); if ($enable_user_cp == 0) { $mainframe->redirect(JURI::base(true), JText::_("User Control Panel is disabled")); exit; } // PANE - CATEGORY EDIT | CREATE // MODEL - Get user's category $model = $this->getModel('user'); $userCategory = $model->getUserCategory($user->id); if (!empty($userCategory->categoryid)) { if ((int) $userCategory->categorypublished == 1) { $tmpl['createoredithead'] = JText::_('Edit Category'); $tmpl['createoredit'] = JText::_('Phoca Gallery Edit'); $tmpl['categorytitle'] = $userCategory->categorytitle; $tmpl['categorydescription'] = $userCategory->categorydescription; $tmpl['categorypublished'] = 1; } else { $tmpl['categorypublished'] = 0; } } else { $tmpl['createoredithead'] = JText::_('Create Category'); $tmpl['createoredit'] = JText::_('Phoca Gallery Create'); $tmpl['categorytitle'] = ''; $tmpl['categorydescription'] = ''; $tmpl['categorypublished'] = -1; } $document->addCustomTag(PhocaGalleryHelperRender::renderDescriptionCreateCatJS((int) $tmpl['maxcreatecatchar'])); // PANE - UPLOAD // Category Params if (!empty($userCategory->categoryid)) { $catParams = $model->getCategoryParams((int) $userCategory->categoryid); // =========================================================== // Upload $tmpl['displayupload'] = 0; // USER RIGHT - UPLOAD ======================================= // 2, 2 means that user access will be ignored in function getUserRight for display Delete button $rightDisplayUpload = 0; // default is to null (all users cannot upload) if (isset($catParams->params)) { $rightDisplayUpload = PhocaGalleryHelper::getUserRight($catParams->params, 'uploaduserid', 1, $user->get('aid', 0), $user->get('id', 0), 0); } if ($rightDisplayUpload == 1) { $tmpl['displayupload'] = 1; $document->addCustomTag(PhocaGalleryHelperRender::renderDescriptionUploadJS((int) $tmpl['maxuploadchar'])); } // =========================================================== // USER RIGHT - ACCESS ======================================= $rightDisplay = 1; //default is set to 1 (all users can see the category) if (isset($catParams->params)) { $rightDisplay = PhocaGalleryHelper::getUserRight($catParams->params, 'accessuserid', 0, $user->get('aid', 0), $user->get('id', 0), 1); } if ($rightDisplay == 0) { $mainframe->redirect(JRoute::_('index.php?option=com_user&view=login', false), JText::_("ALERTNOTAUTH")); exit; } // =========================================================== // Upload Form ----------------------------------------------- // Set FTP form $ftp = !JClientHelper::hasCredentials('ftp'); // PARAMS - Upload size $tmpl['uploadmaxsize'] = $params->get('upload_maxsize', 3000000); $this->assignRef('session', JFactory::getSession()); // END Upload Form ------------------------------------------- } else { $tmpl['displayupload'] = 0; } $tmpl['createcategory'] = 1; // Tabs $displayTabs = 0; if ((int) $tmpl['createcategory'] == 0) { $currentTab['createcategory'] = -1; } else { $currentTab['createcategory'] = $displayTabs; $displayTabs++; } if ((int) $tmpl['displayupload'] == 0) { $currentTab['upload'] = -1; } else { $currentTab['upload'] = $displayTabs; $displayTabs++; } $tmpl['displaytabs'] = $displayTabs; $tmpl['currenttab'] = $currentTab; // ACTION $tmpl['action'] = $uri->toString(); // ASIGN $this->assignRef('tmpl', $tmpl); $this->assignRef('params', $params); $this->assignRef('session', JFactory::getSession()); parent::display($tpl); }
function display($tpl = null) { $app = JFactory::getApplication(); $document = JFactory::getDocument(); $uri = JFactory::getURI(); $menus = $app->getMenu(); $menu = $menus->getActive(); $this->t['p'] = $app->getParams(); $user = JFactory::getUser(); $db = JFactory::getDBO(); $user = JFactory::getUser(); $userLevels = implode(',', $user->getAuthorisedViewLevels()); $this->t['pi'] = 'media/com_phocadownload/images/'; $this->t['pp'] = 'index.php?option=com_phocadownload&view=user&controller=user'; $this->t['pl'] = 'index.php?option=com_users&view=login&return=' . base64_encode($this->t['pp'] . '&Itemid=' . $app->input->get('Itemid', 0, 'int')); $neededAccessLevels = PhocaDownloadAccess::getNeededAccessLevels(); $access = PhocaDownloadAccess::isAccess($user->getAuthorisedViewLevels(), $neededAccessLevels); if (!$access) { $app->redirect(JRoute::_($this->t['pl'], false), JText::_("COM_PHOCADOWNLOAD_NOT_AUTHORISED_ACTION")); return; } PhocaDownloadRenderFront::renderAllCSS(); // = = = = = = = = = = = // PANE // = = = = = = = = = = = // - - - - - - - - - - // ALL TABS // - - - - - - - - - - // UCP is disabled (security reasons) if ((int) $this->t['p']->get('enable_user_cp', 0) == 0) { $app->redirect(JURI::base(false), JText::_("COM_PHOCADOWNLOAD_USER_UPLOAD_DISABLED")); exit; } $this->t['tab'] = $app->input->get('tab', 0, 'string'); $this->t['maxuploadchar'] = $this->t['p']->get('max_upload_char', 1000); $this->t['enableuseruploadapprove'] = $this->t['p']->get('enable_user_upload_approve', 0); $this->t['showpageheading'] = $this->t['p']->get('show_page_heading', 1); $this->t['uploadmaxsize'] = $this->t['p']->get('user_file_upload_size', 3145728); $this->t['uploadmaxsizeread'] = PhocaDownloadFile::getFileSizeReadable($this->t['uploadmaxsize']); $this->t['userfilesmaxcount'] = $this->t['p']->get('user_files_max_count', 5); $this->t['userfilesmaxsize'] = $this->t['p']->get('user_files_max_size', 20971520); $this->t['send_mail_upload'] = $this->t['p']->get('send_mail_upload', 0); $this->t['pw'] = PhocaDownloadRenderFront::renderPhocaDownload(); //Subcateogry //$this->t['parentid'] = $app->input->get('parentcategoryid', 0, 'int'); //$document->addScript(JURI::base(true).'/components/com_phocadownload/assets/js/comments.js'); $document->addCustomTag(PhocaDownloadRenderFront::renderOnUploadJS()); $document->addCustomTag(PhocaDownloadRenderFront::renderDescriptionUploadJS((int) $this->t['maxuploadchar'])); $document->addCustomTag(PhocaDownloadRenderFront::userTabOrdering()); $model = $this->getModel('user'); // Upload Form - - - - - - - - - - - - - - - $ftp = !JClientHelper::hasCredentials('ftp'); // Set FTP form $session = JFactory::getSession(); $this->assignRef('session', $session); // END Upload Form - - - - - - - - - - - - - $this->t['displayupload'] = 1; // - - - - - - - - - - // FORM // - - - - - - - - - - // No Controller because of returning back the values in case some form field is not OK // Set default for returning back $formData = new JObject(); $formData->set('title', ''); $formData->set('description', ''); $formData->set('author', ''); $formData->set('email', ''); $formData->set('license', ''); $formData->set('website', ''); $formData->set('version', ''); $this->t['errorcatid'] = ''; $this->t['erroremail'] = ''; $this->t['errorwebsite'] = ''; $this->t['errorfile'] = ''; $task = $app->input->get('task', '', 'string'); if ($task == 'upload') { $post['title'] = $app->input->get('phocadownloaduploadtitle', '', 'string'); $post['description'] = $app->input->get('phocadownloaduploaddescription', '', 'string'); $post['catidfiles'] = $app->input->get('catidfiles', 0, 'int'); $post['description'] = substr($post['description'], 0, (int) $this->t['maxuploadchar']); $post['approved'] = 0; $post['published'] = 1; $post['owner_id'] = $user->id; if ($this->t['enableuseruploadapprove'] == 0) { $post['approved'] = 1; } $post['author'] = $app->input->get('phocadownloaduploadauthor', '', 'string'); $post['email'] = $app->input->get('phocadownloaduploademail', '', 'string'); $post['website'] = $app->input->get('phocadownloaduploadwebsite', '', 'string'); $post['license'] = $app->input->get('phocadownloaduploadlicense', '', 'string'); $post['version'] = $app->input->get('phocadownloaduploadversion', '', 'string'); if ($post['title'] != '') { $formData->set('title', $post['title']); } if ($post['description'] != '') { $formData->set('description', $post['description']); } if ($post['author'] != '') { $formData->set('author', $post['author']); } if ($post['email'] != '') { $formData->set('email', $post['email']); } if ($post['website'] != '') { $formData->set('website', $post['website']); } if ($post['license'] != '') { $formData->set('license', $post['license']); } if ($post['version'] != '') { $formData->set('version', $post['version']); } //catid $returnForm = 0; if ($post['catidfiles'] < 1) { $this->t['errorcatid'] = JText::_('COM_PHOCADOWNLOAD_PLEASE_SELECT_CATEGORY'); $returnForm = 1; } jimport('joomla.mail.helper'); if ($post['email'] != '' && !JMailHelper::isEmailAddress($post['email'])) { $this->t['erroremail'] = JText::_('COM_PHOCADOWNLOAD_PLEASE_ENTER_VALID_EMAIL_ADDRESS'); $returnForm = 1; } if ($post['website'] != '' && !PhocaDownloadUtils::isURLAddress($post['website'])) { $this->t['errorwebsite'] = JText::_('COM_PHOCADOWNLOAD_PLEASE_ENTER_VALID_WEBSITE'); $returnForm = 1; } // Upload $errUploadMsg = ''; $redirectUrl = ''; $fileArray = JRequest::getVar('Filedata', '', 'files', 'array'); if (empty($fileArray) || isset($fileArray['name']) && $fileArray['name'] == '') { $this->t['errorfile'] = JText::_('COM_PHOCADOWNLOAD_PLEASE_ADD_FILE'); $returnForm = 1; } if ($post['title'] == '') { $post['title'] = PhocaDownloadFile::removeExtension($fileArray['name']); } $post['alias'] = PhocaDownloadUtils::getAliasName($post['title']); if ($returnForm == 0) { $errorUploadMsg = ''; if ($model->singleFileUpload($errorUploadMsg, $fileArray, $post)) { if ($this->t['send_mail_upload'] > 0) { PhocaDownloadMail::sendMail((int) $this->t['send_mail_upload'], $post['title'], 2); } $Itemid = $app->input->get('Itemid', 0, 'int'); $limitStart = $app->input->get('limitstart', 0, 'int'); if ($limitStart > 0) { $limitStartUrl = '&limitstart=' . $limitStart; } else { $limitStartUrl = ''; } $link = 'index.php?option=com_phocadownload&view=user&Itemid=' . $Itemid . $limitStartUrl; $app->redirect(JRoute::_($link, false), JText::_("COM_PHOCADOWNLOAD_SUCCESS_FILE_UPLOADED")); exit; } else { $this->t['errorfile'] = JText::_('COM_PHOCADOWNLOAD_ERROR_FILE_UPLOADED'); if ($errorUploadMsg != '') { $this->t['errorfile'] .= '<br />' . $errorUploadMsg; } } } } // - - - - - - - - - - - // FILES // - - - - - - - - - - - $this->t['filesitems'] = $model->getDataFiles($user->id); $this->t['filestotal'] = $model->getTotalFiles($user->id); $this->t['filespagination'] = $model->getPaginationFiles($user->id); $filter_state_files = $app->getUserStateFromRequest($this->_context_files . '.filter_state', 'filter_state', '', 'word'); $filter_catid_files = $app->getUserStateFromRequest($this->_context_files . '.filter_catid', 'filter_catid', 0, 'int'); $catid_files = $app->getUserStateFromRequest($this->_context_files . '.catid', 'catid', 0, 'int'); //$filter_sectionid_files = $app->getUserStateFromRequest( $this->_context_files.'.filter_sectionid', 'filter_sectionid', 0, 'int' ); $filter_order_files = $app->getUserStateFromRequest($this->_context_files . '.filter_order', 'filter_order', 'a.ordering', 'cmd'); $filter_order_Dir_files = $app->getUserStateFromRequest($this->_context_files . '.filter_order_Dir', 'filter_order_Dir', '', 'word'); $search_files = $app->getUserStateFromRequest($this->_context_files . '.search', 'search', '', 'string'); $search_files = JString::strtolower($search_files); // build list of categories $javascript = 'class="inputbox" size="1" onchange="document.phocadownloadfilesform.submit();"'; // get list of categories for dropdown filter $whereC = array(); //if ($filter_sectionid_files > 0) { // $whereC[] = ' cc.section = '.$db->Quote($filter_sectionid_files); //} //$whereC[] = "(cc.uploaduserid LIKE '%-1%' OR cc.uploaduserid LIKE '%".(int)$user->id."%')"; //$whereC[] = "(cc.uploaduserid LIKE '%-1%' OR cc.uploaduserid LIKE '%,{".(int)$user->id."}' OR cc.uploaduserid LIKE '{".(int)$user->id."},%' OR cc.uploaduserid LIKE '%,{".(int)$user->id."},%' OR cc.uploaduserid ={".(int)$user->id."} )"; $whereC[] = "(cc.uploaduserid LIKE '%-1%' OR cc.uploaduserid LIKE '%," . (int) $user->id . "' OR cc.uploaduserid LIKE '" . (int) $user->id . ",%' OR cc.uploaduserid LIKE '%," . (int) $user->id . ",%' OR cc.uploaduserid =" . (int) $user->id . " )"; $whereC = count($whereC) ? ' WHERE ' . implode(' AND ', $whereC) : ''; // get list of categories for dropdown filter $query = 'SELECT cc.id AS value, cc.title AS text, cc.parent_id as parentid' . ' FROM #__phocadownload_categories AS cc' . $whereC . ' ORDER BY cc.ordering'; $lists_files['catid'] = PhocaDownloadCategory::filterCategory($query, $catid_files, TRUE, TRUE, TRUE); /*$whereS = array(); //$whereS[] = "(cc.uploaduserid LIKE '%-1%' OR cc.uploaduserid LIKE '%".(int)$user->id."%')"; $whereS[] = "(cc.uploaduserid LIKE '%-1%' OR cc.uploaduserid LIKE '%,".(int)$user->id."' OR cc.uploaduserid LIKE '".(int)$user->id.",%' OR cc.uploaduserid LIKE '%,".(int)$user->id.",%' OR cc.uploaduserid =".(int)$user->id." )"; $whereS[] = 's.published = 1'; $whereS = ( count( $whereS ) ? ' WHERE '. implode( ' AND ', $whereS ) : '' ); // sectionid $query = 'SELECT s.title AS text, s.id AS value' . ' FROM #__phocadownload_sections AS s' . ' LEFT JOIN #__phocadownload_categories AS cc ON cc.section = s.id' . $whereS . ' GROUP BY s.id' . ' ORDER BY s.ordering'; // state filter /* $state_files[] = JHTML::_('select.option', '', '- '. JText::_( 'Select State' ) .' -' ); $state_files[] = JHTML::_('select.option', 'P', JText::_( 'Published' ) ); $state_files[] = JHTML::_('select.option', 'U', JText::_( 'Unpublished') ); $lists_image['state'] = JHTML::_('select.genericlist', $state_files, 'filter_state', 'class="inputbox" size="1" onchange="document.phocadownloadfilesform.submit();"', 'value', 'text', $filter_state );*/ //$lists_files['sectionid'] = PhocaDownloadCategory::filterSection($query, $filter_sectionid_files, TRUE); // state filter $lists_files['state'] = JHTML::_('grid.state', $filter_state_files); // table ordering $lists_files['order_Dir'] = $filter_order_Dir_files; $lists_files['order'] = $filter_order_files; // search filter $lists_files['search'] = $search_files; $this->t['catidfiles'] = $catid_files; $this->t['filestab'] = 1; // Tabs $displayTabs = 0; if ((int) $this->t['filestab'] == 0) { $currentTab['files'] = -1; } else { $currentTab['files'] = $displayTabs; $displayTabs++; } $this->t['displaytabs'] = $displayTabs; $this->t['currenttab'] = $currentTab; // ACTION $this->t['action'] = $uri->toString(); // SEF problem $isThereQM = false; $isThereQM = preg_match("/\\?/i", $this->t['action']); if ($isThereQM) { $amp = '&'; } else { $amp = '?'; } $this->t['actionamp'] = htmlspecialchars($this->t['action']) . $amp; $this->t['istheretab'] = false; $this->t['istheretab'] = preg_match("/tab=/i", $this->t['action']); $this->t['ps'] = '&tab=' . $this->t['currenttab']['files'] . '&limitstart=' . $this->t['filespagination']->limitstart; // ASIGN $this->assignRef('listsfiles', $lists_files); $this->assignRef('formdata', $formData); $this->assignRef('tmpl', $this->t); $this->assignRef('params', $this->t['p']); $session = JFactory::getSession(); $this->assignRef('session', $session); parent::display($tpl); }
function display($tpl = null) { $app = JFactory::getApplication(); $config = JComponentHelper::getParams('com_media'); $lang = JFactory::getLanguage(); $style = $app->getUserStateFromRequest('media.list.layout', 'layout', 'thumbs', 'word'); $document = JFactory::getDocument(); $document->setBuffer($this->loadTemplate('navigation'), 'modules', 'submenu'); JHtml::_('behavior.framework', true); JHtml::_('script', 'media/mediamanager.js', true, true); JHtml::_('stylesheet', 'media/mediamanager.css', array(), true); if ($lang->isRTL()) { JHtml::_('stylesheet', 'media/mediamanager_rtl.css', array(), true); } JHtml::_('behavior.modal'); $document->addScriptDeclaration("\n\t\twindow.addEvent('domready', function() {\n\t\t\tdocument.preview = SqueezeBox;\n\t\t});"); JHtml::_('script', 'system/mootree.js', true, true, false, false); JHtml::_('stylesheet', 'system/mootree.css', array(), true); if ($lang->isRTL()) { JHtml::_('stylesheet', 'media/mootree_rtl.css', array(), true); } if ($config->get('enable_flash', 1)) { $fileTypes = $config->get('upload_extensions', 'bmp,gif,jpg,png,jpeg'); $types = explode(',', $fileTypes); $displayTypes = ''; // this is what the user sees $filterTypes = ''; // this is what controls the logic $firstType = true; foreach ($types as $type) { if (!$firstType) { $displayTypes .= ', '; $filterTypes .= '; '; } else { $firstType = false; } $displayTypes .= '*.' . $type; $filterTypes .= '*.' . $type; } $typeString = '{ \'' . JText::_('COM_MEDIA_FILES', 'true') . ' (' . $displayTypes . ')\': \'' . $filterTypes . '\' }'; JHtml::_('behavior.uploader', 'upload-flash', array('onBeforeStart' => 'function(){ Uploader.setOptions({url: document.id(\'uploadForm\').action + \'&folder=\' + document.id(\'mediamanager-form\').folder.value}); }', 'onComplete' => 'function(){ MediaManager.refreshFrame(); }', 'targetURL' => '\\document.id(\'uploadForm\').action', 'typeFilter' => $typeString, 'fileSizeMax' => (int) ($config->get('upload_maxsize', 0) * 1024 * 1024))); } if (DIRECTORY_SEPARATOR == '\\') { $base = str_replace(DIRECTORY_SEPARATOR, "\\\\", COM_MEDIA_BASE); } else { $base = COM_MEDIA_BASE; } $js = "\n\t\t\tvar basepath = '" . $base . "';\n\t\t\tvar viewstyle = '" . $style . "';\n\t\t"; $document->addScriptDeclaration($js); /* * Display form for FTP credentials? * Don't set them here, as there are other functions called before this one if there is any file write operation */ $ftp = !JClientHelper::hasCredentials('ftp'); $session = JFactory::getSession(); $state = $this->get('state'); $this->assignRef('session', $session); $this->assignRef('config', $config); $this->assignRef('state', $state); $this->require_ftp = $ftp; $this->folders_id = ' id="media-tree"'; $this->folders = $this->get('folderTree'); // Set the toolbar $this->addToolbar(); parent::display($tpl); echo JHtml::_('behavior.keepalive'); }
/** * Applies FTP credentials to Joomla! itself, when required * * @return void * * @since 2.5.4 */ protected function _applyCredentials() { if (!JClientHelper::hasCredentials('ftp')) { $user = JFactory::getApplication()->getUserStateFromRequest('com_joomlaupdate.ftp_user', 'ftp_user', null, 'raw'); $pass = JFactory::getApplication()->getUserStateFromRequest('com_joomlaupdate.ftp_pass', 'ftp_pass', null, 'raw'); if ($user != '' && $pass != '') { // Add credentials to the session if (!JClientHelper::setCredentials('ftp', $user, $pass)) { JError::raiseWarning('SOME_ERROR_CODE', JText::_('JLIB_CLIENT_ERROR_HELPER_SETCREDENTIALSFROMREQUEST_FAILED')); } } } }
function display($tpl = null) { $app = JFactory::getApplication(); $document =& JFactory::getDocument(); $uri =& JFactory::getURI(); $menus = $app->getMenu(); $menu = $menus->getActive(); $this->params =& $app->getParams(); $user =& JFactory::getUser(); $path = PhocaGalleryPath::getPath(); $this->itemId = $app->input->get('Itemid', 0, 'int'); $neededAccessLevels = PhocaGalleryAccess::getNeededAccessLevels(); $access = PhocaGalleryAccess::isAccess($user->getAuthorisedViewLevels(), $neededAccessLevels); $this->tmpl['pi'] = 'media/com_phocagallery/images/'; $this->tmpl['pp'] = 'index.php?option=com_phocagallery&view=user&controller=user'; $this->tmpl['pl'] = 'index.php?option=com_users&view=login&return=' . base64_encode($this->tmpl['pp'] . '&Itemid=' . $this->itemId); // LIBRARY $library =& PhocaGalleryLibrary::getLibrary(); //$libraries['pg-css-ie'] = $library->getLibrary('pg-css-ie'); // Only registered users if (!$access) { $app->redirect(JRoute::_($this->tmpl['pl'], false), JText::_('COM_PHOCAGALLERY_NOT_AUTHORISED_ACTION')); exit; } $this->tmpl['gallerymetakey'] = $this->params->get('gallery_metakey', ''); $this->tmpl['gallerymetadesc'] = $this->params->get('gallery_metadesc', ''); if ($this->tmpl['gallerymetakey'] != '') { $document->setMetaData('keywords', $this->tmpl['gallerymetakey']); } if ($this->tmpl['gallerymetadesc'] != '') { $document->setMetaData('description', $this->tmpl['gallerymetadesc']); } PhocaGalleryRenderFront::renderAllCSS(); // = = = = = = = = = = = // PANE // = = = = = = = = = = = // - - - - - - - - - - // ALL TABS // - - - - - - - - - - // UCP is disabled (security reasons) if ((int) $this->params->get('enable_user_cp', 0) == 0) { $app->redirect(JURI::base(true), JText::_('COM_PHOCAGALLERY_UCP_DISABLED')); exit; } $this->tmpl['tab'] = $app->input->get('tab', 0, 'string'); $this->tmpl['maxuploadchar'] = $this->params->get('max_upload_char', 1000); $this->tmpl['maxcreatecatchar'] = $this->params->get('max_create_cat_char', 1000); $this->tmpl['dp'] = PhocaGalleryRenderInfo::getPhocaIc((int) $this->params->get('display_phoca_info', 1)); $this->tmpl['showpageheading'] = $this->params->get('show_page_heading', 1); $this->tmpl['javaboxwidth'] = $this->params->get('java_box_width', 480); $this->tmpl['javaboxheight'] = $this->params->get('java_box_height', 480); $this->tmpl['enableuploadavatar'] = $this->params->get('enable_upload_avatar', 1); $this->tmpl['uploadmaxsize'] = $this->params->get('upload_maxsize', 3145728); $this->tmpl['uploadmaxsizeread'] = PhocaGalleryFile::getFileSizeReadable($this->tmpl['uploadmaxsize']); $this->tmpl['uploadmaxreswidth'] = $this->params->get('upload_maxres_width', 3072); $this->tmpl['uploadmaxresheight'] = $this->params->get('upload_maxres_height', 2304); $this->tmpl['multipleuploadchunk'] = $this->params->get('multiple_upload_chunk', 0); $this->tmpl['displaytitleupload'] = $this->params->get('display_title_upload', 0); $this->tmpl['displaydescupload'] = $this->params->get('display_description_upload', 0); $this->tmpl['enablejava'] = $this->params->get('enable_java', -1); $this->tmpl['enablemultiple'] = $this->params->get('enable_multiple', 0); $this->tmpl['ytbupload'] = $this->params->get('youtube_upload', 0); $this->tmpl['multipleuploadmethod'] = $this->params->get('multiple_upload_method', 1); $this->tmpl['multipleresizewidth'] = $this->params->get('multiple_resize_width', -1); $this->tmpl['multipleresizeheight'] = $this->params->get('multiple_resize_height', -1); $this->tmpl['usersubcatcount'] = $this->params->get('user_subcat_count', 5); $this->tmpl['userimagesmaxspace'] = $this->params->get('user_images_max_size', 20971520); $this->tmpl['iepx'] = '<div style="font-size:1px;height:1px;margin:0px;padding:0px;"> </div>'; //Subcateogry $this->tmpl['parentid'] = $app->input->get('parentcategoryid', 0, 'int'); $document->addScript(JURI::base(true) . '/media/com_phocagallery/js/comments.js'); $document->addCustomTag(PhocaGalleryRenderFront::renderOnUploadJS()); $document->addCustomTag(PhocaGalleryRenderFront::renderDescriptionCreateCatJS((int) $this->tmpl['maxcreatecatchar'])); $document->addCustomTag(PhocaGalleryRenderFront::userTabOrdering()); // SubCategory + Image $document->addCustomTag(PhocaGalleryRenderFront::renderDescriptionCreateSubCatJS((int) $this->tmpl['maxcreatecatchar'])); $document->addCustomTag(PhocaGalleryRenderFront::saveOrderUserJS()); $model = $this->getModel('user'); $ownerMainCategory = $model->getOwnerMainCategory($user->id); $this->tmpl['usertab'] = 1; $this->tmpl['createcategory'] = 1; $this->tmpl['createsubcategory'] = 1; $this->tmpl['images'] = 1; $this->tmpl['displayupload'] = 1; // Tabs $displayTabs = 0; if ((int) $this->tmpl['usertab'] == 0) { $currentTab['user'] = -1; } else { $currentTab['user'] = $displayTabs; $displayTabs++; } if ((int) $this->tmpl['createcategory'] == 0) { $currentTab['createcategory'] = -1; } else { $currentTab['createcategory'] = $displayTabs; $displayTabs++; } if ((int) $this->tmpl['createsubcategory'] == 0) { $currentTab['createsubcategory'] = -1; } else { $currentTab['createsubcategory'] = $displayTabs; $displayTabs++; } if ((int) $this->tmpl['displayupload'] == 0) { $currentTab['images'] = -1; } else { $currentTab['images'] = $displayTabs; $displayTabs++; } $this->tmpl['displaytabs'] = $displayTabs; $this->tmpl['currenttab'] = $currentTab; // ACTION $this->tmpl['action'] = $uri->toString(); $this->tmpl['ftp'] = !JClientHelper::hasCredentials('ftp'); $this->assignRef('session', JFactory::getSession()); // SEF problem $isThereQM = false; $isThereQM = preg_match("/\\?/i", $this->tmpl['action']); if ($isThereQM) { $amp = '&'; // will be translated to htmlspecialchars } else { $amp = '?'; } $this->tmpl['actionamp'] = $this->tmpl['action'] . $amp; $this->tmpl['istheretab'] = false; $this->tmpl['istheretab'] = preg_match("/tab=/i", $this->tmpl['action']); // EDIT - subcategory, image $this->tmpl['task'] = $app->input->get('task', '', 'string'); $id = $app->input->get('id', '', 'string'); $idAlias = $id; // - - - - - - - - - - - // USER (AVATAR) // - - - - - - - - - - - $this->tmpl['user'] = $user->name; $this->tmpl['username'] = $user->username; $this->tmpl['useravatarimg'] = JHtml::_('image', $this->tmpl['pi'] . 'phoca_thumb_m_no_image.png', ''); $this->tmpl['useravatarapproved'] = 0; $userAvatar = $model->getUserAvatar($user->id); if ($userAvatar) { $pathAvatarAbs = $path->avatar_abs . 'thumbs' . DS . 'phoca_thumb_m_' . $userAvatar->avatar; $pathAvatarRel = $path->avatar_rel . 'thumbs/phoca_thumb_m_' . $userAvatar->avatar; if (JFile::exists($pathAvatarAbs)) { $this->tmpl['useravatarimg'] = '<img src="' . JURI::base(true) . '/' . $pathAvatarRel . '?imagesid=' . md5(uniqid(time())) . '" alt="" />'; $this->tmpl['useravatarapproved'] = $userAvatar->approved; } } if ($ownerMainCategory) { $this->tmpl['usermaincategory'] = $ownerMainCategory->title; } else { $this->tmpl['usermaincategory'] = JHtml::_('image', $this->tmpl['pi'] . 'icon-unpublish.png', JText::_('COM_PHOCAGALLERY_NOT_CREATED')) . ' (' . JText::_('COM_PHOCAGALLERY_NOT_CREATED') . ')'; } $this->tmpl['usersubcategory'] = $model->getCountUserSubCat($user->id); $this->tmpl['usersubcategoryleft'] = (int) $this->tmpl['usersubcatcount'] - (int) $this->tmpl['usersubcategory']; if ((int) $this->tmpl['usersubcategoryleft'] < 0) { $this->tmpl['usersubcategoryleft'] = 0; } $this->tmpl['userimages'] = $model->getCountUserImage($user->id); $this->tmpl['userimagesspace'] = $model->getSumUserImage($user->id); $this->tmpl['userimagesspaceleft'] = (int) $this->tmpl['userimagesmaxspace'] - (int) $this->tmpl['userimagesspace']; if ((int) $this->tmpl['userimagesspaceleft'] < 0) { $this->tmpl['userimagesspaceleft'] = 0; } $this->tmpl['userimagesspace'] = PhocaGalleryFile::getFileSizeReadable($this->tmpl['userimagesspace']); $this->tmpl['userimagesspaceleft'] = PhocaGalleryFile::getFileSizeReadable($this->tmpl['userimagesspaceleft']); $this->tmpl['userimagesmaxspace'] = PhocaGalleryFile::getFileSizeReadable($this->tmpl['userimagesmaxspace']); // - - - - - - - - - - - // MAIN CATEGORY // - - - - - - - - - - - $ownerMainCategory = $model->getOwnerMainCategory($user->id); if (!empty($ownerMainCategory->id)) { if ((int) $ownerMainCategory->published == 1) { $this->tmpl['categorycreateoredithead'] = JText::_('COM_PHOCAGALLERY_MAIN_CATEGORY'); $this->tmpl['categorycreateoredit'] = JText::_('COM_PHOCAGALLERY_EDIT'); $this->tmpl['categorytitle'] = $ownerMainCategory->title; $this->tmpl['categoryapproved'] = $ownerMainCategory->approved; $this->tmpl['categorydescription'] = $ownerMainCategory->description; $this->tmpl['categorypublished'] = 1; } else { $this->tmpl['categorypublished'] = 0; } } else { $this->tmpl['categorycreateoredithead'] = JText::_('COM_PHOCAGALLERY_MAIN_CATEGORY'); $this->tmpl['categorycreateoredit'] = JText::_('COM_PHOCAGALLERY_CREATE'); $this->tmpl['categorytitle'] = ''; $this->tmpl['categorydescription'] = ''; $this->tmpl['categoryapproved'] = ''; $this->tmpl['categorypublished'] = -1; } // - - - - - - - - - - - // SUBCATEGORY // - - - - - - - - - - - if (!empty($ownerMainCategory->id)) { // EDIT $this->tmpl['categorysubcatedit'] = $model->getCategory((int) $id, $user->id); $this->tmpl['displaysubcategory'] = 1; // Get All Data - Subcategories $this->tmpl['subcategoryitems'] = $model->getDataSubcat($user->id); $this->tmpl['subcategorytotal'] = count($this->tmpl['subcategoryitems']); $model->setTotalSubCat($this->tmpl['subcategorytotal']); $this->tmpl['subcategorypagination'] = $model->getPaginationSubCat($user->id); $this->tmpl['subcategoryitems'] = array_slice($this->tmpl['subcategoryitems'], (int) $this->tmpl['subcategorypagination']->limitstart, (int) $this->tmpl['subcategorypagination']->limit); $filter_state_subcat = $app->getUserStateFromRequest($this->_context_subcat . '.filter_state', 'filter_state_subcat', '', 'word'); $filter_catid_subcat = $app->getUserStateFromRequest($this->_context_subcat . '.filter_catid', 'filter_catid_subcat', 0, 'int'); $filter_order_subcat = $app->getUserStateFromRequest($this->_context_subcat . '.filter_order', 'filter_order_subcat', 'a.ordering', 'cmd'); $filter_order_Dir_subcat = $app->getUserStateFromRequest($this->_context_subcat . '.filter_order_Dir', 'filter_order_Dir_subcat', '', 'word'); $search_subcat = $app->getUserStateFromRequest($this->_context_subcat . '.search', 'phocagallerysubcatsearch', '', 'string'); if (strpos($search_subcat, '"') !== false) { $search_subcat = str_replace(array('=', '<'), '', $search_subcat); } $search_subcat = JString::strtolower($search_subcat); $categories = $model->getCategoryList($user->id); if (!empty($categories)) { $javascript = 'class="inputbox" onchange="document.phocagallerysubcatform.submit();"'; $tree = array(); $text = ''; $tree = PhocaGalleryCategory::CategoryTreeOption($categories, $tree, 0, $text, -1); array_unshift($tree, JHtml::_('select.option', '0', '- ' . JText::_('COM_PHOCAGALLERY_SELECT_CATEGORY') . ' -', 'value', 'text')); $lists_subcat['catid'] = JHtml::_('select.genericlist', $tree, 'filter_catid_subcat', $javascript, 'value', 'text', $filter_catid_subcat); } $this->tmpl['parentcategoryid'] = $filter_catid_subcat; // state filter //$lists['state'] = JHtml::_('grid.state', $filter_state ); $state_subcat[] = JHtml::_('select.option', '', '- ' . JText::_('COM_PHOCAGALLERY_SELECT_STATE') . ' -'); $state_subcat[] = JHtml::_('select.option', 'P', JText::_('COM_PHOCAGALLERY_PUBLISHED')); $state_subcat[] = JHtml::_('select.option', 'U', JText::_('COM_PHOCAGALLERY_UNPUBLISHED')); $lists_subcat['state'] = JHtml::_('select.genericlist', $state_subcat, 'filter_state_subcat', 'class="inputbox" size="1" onchange="document.phocagallerysubcatform.submit();"', 'value', 'text', $filter_state_subcat); // table ordering $lists_subcat['order_Dir'] = $filter_order_Dir_subcat; $lists_subcat['order'] = $filter_order_subcat; $this->tmpl['subcategoryordering'] = $lists_subcat['order'] == 'a.ordering'; //Ordering allowed ? // search filter $lists_subcat['search'] = $search_subcat; } else { $this->tmpl['displaysubcategory'] = 0; } // - - - - - - - - - - - // IMAGES // - - - - - - - - - - - if (!empty($ownerMainCategory->id)) { $catAccess = PhocaGalleryAccess::getCategoryAccess((int) $ownerMainCategory->id); // EDIT $this->tmpl['imageedit'] = $model->getImage((int) $id, $user->id); $this->tmpl['imageitems'] = $model->getDataImage($user->id); $this->tmpl['imagetotal'] = $model->getTotalImage($user->id); $this->tmpl['imagepagination'] = $model->getPaginationImage($user->id); $filter_state_image = $app->getUserStateFromRequest($this->_context_image . '.filter_state', 'filter_state_image', '', 'word'); $filter_catid_image = $app->getUserStateFromRequest($this->_context_image . '.filter_catid', 'filter_catid_image', 0, 'int'); $filter_order_image = $app->getUserStateFromRequest($this->_context_image . '.filter_order', 'filter_order_image', 'a.ordering', 'cmd'); $filter_order_Dir_image = $app->getUserStateFromRequest($this->_context_image . '.filter_order_Dir', 'filter_order_Dir_image', '', 'word'); $search_image = $app->getUserStateFromRequest($this->_context_image . '.search', 'phocagalleryimagesearch', '', 'string'); if (strpos($search_image, '"') !== false) { $search_image = str_replace(array('=', '<'), '', $search_image); } $search_image = JString::strtolower($search_image); $categoriesImage = $model->getCategoryList($user->id); if (!empty($categoriesImage)) { $javascript = 'class="inputbox" size="1" onchange="document.phocagalleryimageform.submit();"'; $tree = array(); $text = ''; $tree = PhocaGalleryCategory::CategoryTreeOption($categoriesImage, $tree, 0, $text, -1); array_unshift($tree, JHtml::_('select.option', '0', '- ' . JText::_('COM_PHOCAGALLERY_SELECT_CATEGORY') . ' -', 'value', 'text')); $lists_image['catid'] = JHtml::_('select.genericlist', $tree, 'filter_catid_image', $javascript, 'value', 'text', $filter_catid_image); } // state filter $state_image[] = JHtml::_('select.option', '', '- ' . JText::_('COM_PHOCAGALLERY_SELECT_STATE') . ' -'); $state_image[] = JHtml::_('select.option', 'P', JText::_('COM_PHOCAGALLERY_FIELD_PUBLISHED_LABEL')); $state_image[] = JHtml::_('select.option', 'U', JText::_('COM_PHOCAGALLERY_FIELD_UNPUBLISHED_LABEL')); $lists_image['state'] = JHtml::_('select.genericlist', $state_image, 'filter_state_image', 'class="inputbox" size="1" onchange="document.phocagalleryimageform.submit();"', 'value', 'text', $filter_state_image); // table ordering $lists_image['order_Dir'] = $filter_order_Dir_image; $lists_image['order'] = $filter_order_image; $this->tmpl['imageordering'] = $lists_image['order'] == 'a.ordering'; //Ordering allowed ? // search filter $lists_image['search'] = $search_image; $this->tmpl['catidimage'] = $filter_catid_image; // Upload $this->tmpl['displayupload'] = 0; // USER RIGHT - UPLOAD - - - - - - - - - - - // 2, 2 means that user access will be ignored in function getUserRight for display Delete button $rightDisplayUpload = 0; // default is to null (all users cannot upload) if (!empty($catAccess)) { $rightDisplayUpload = PhocaGalleryAccess::getUserRight('uploaduserid', $catAccess->uploaduserid, 2, $user->getAuthorisedViewLevels(), $user->get('id', 0), 0); } if ($rightDisplayUpload == 1) { $this->tmpl['displayupload'] = 1; $document->addCustomTag(PhocaGalleryRenderFront::renderDescriptionUploadJS((int) $this->tmpl['maxuploadchar'])); } // - - - - - - - - - - - - - - - - - - - - - // USER RIGHT - ACCESS - - - - - - - - - - - $rightDisplay = 1; //default is set to 1 (all users can see the category) if (!empty($catAccess)) { $rightDisplay = PhocaGalleryAccess::getUserRight('accessuserid', $catAccess->accessuserid, 0, $user->getAuthorisedViewLevels(), $user->get('id', 0), 1); } if ($rightDisplay == 0) { $app->redirect(JRoute::_($this->tmpl['pl'], false), JText::_('COM_PHOCAGALLERY_NOT_AUTHORISED_ACTION')); exit; } // - - - - - - - - - - - - - - - - - - - - - // = = = = = = = = = = // U P L O A D // = = = = = = = = = = // - - - - - - - - - - - // Upload // - - - - - - - - - - - if ((int) $this->tmpl['displayupload'] == 1) { $sU = new PhocaGalleryFileUploadSingle(); $sU->returnUrl = htmlspecialchars($this->tmpl['action'] . $amp . 'task=upload&' . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&viewback=category&tab=' . $this->tmpl['currenttab']['images']); $sU->tab = $this->tmpl['currenttab']['images']; $this->tmpl['su_output'] = $sU->getSingleUploadHTML(1); $this->tmpl['su_url'] = htmlspecialchars($this->tmpl['action'] . $amp . 'task=upload&' . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&viewback=category&tab=' . $this->tmpl['currenttab']['images']); } // - - - - - - - - - - - // Youtube Upload (single upload form can be used) // - - - - - - - - - - - if ((int) $this->tmpl['ytbupload'] > 0) { $sYU = new PhocaGalleryFileUploadSingle(); $sYU->returnUrl = htmlspecialchars($this->tmpl['action'] . $amp . 'task=ytbupload&' . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&viewback=category&tab=' . $this->tmpl['currenttab']['images']); $sYU->tab = $this->tmpl['currenttab']['images']; $this->tmpl['syu_output'] = $sYU->getSingleUploadHTML(1); $this->tmpl['syu_url'] = htmlspecialchars($this->tmpl['action'] . $amp . 'task=ytbupload&' . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&viewback=category&tab=' . $this->tmpl['currenttab']['images']); } // - - - - - - - - - - - // Multiple Upload // - - - - - - - - - - - // Get infos from multiple upload $muFailed = $app->input->get('mufailed', '0', 'int'); $muUploaded = $app->input->get('muuploaded', '0', 'int'); $this->tmpl['mu_response_msg'] = $muUploadedMsg = ''; if ($muUploaded > 0) { $muUploadedMsg = JText::_('COM_PHOCAGALLERY_COUNT_UPLOADED_IMG') . ': ' . $muUploaded; } if ($muFailed > 0) { $muFailedMsg = JText::_('COM_PHOCAGALLERY_COUNT_NOT_UPLOADED_IMG') . ': ' . $muFailed; } if ($muFailed > 0 && $muUploaded > 0) { $this->tmpl['mu_response_msg'] = '<div class="alert alert-info">' . JText::_('COM_PHOCAGALLERY_COUNT_UPLOADED_IMG') . ': ' . $muUploaded . '<br />' . JText::_('COM_PHOCAGALLERY_COUNT_NOT_UPLOADED_IMG') . ': ' . $muFailed . '</div>'; } else { if ($muFailed > 0 && $muUploaded == 0) { $this->tmpl['mu_response_msg'] = '<div class="alert alert-error">' . JText::_('COM_PHOCAGALLERY_COUNT_NOT_UPLOADED_IMG') . ': ' . $muFailed . '</div>'; } else { if ($muFailed == 0 && $muUploaded > 0) { $this->tmpl['mu_response_msg'] = '<div class="alert alert-success">' . JText::_('COM_PHOCAGALLERY_COUNT_UPLOADED_IMG') . ': ' . $muUploaded . '</div>'; } else { $this->tmpl['mu_response_msg'] = ''; } } } if ((int) $this->tmpl['enablemultiple'] == 1 && (int) $this->tmpl['displayupload'] == 1) { PhocaGalleryFileUploadMultiple::renderMultipleUploadLibraries(); $mU = new PhocaGalleryFileUploadMultiple(); $mU->frontEnd = 2; $mU->method = $this->tmpl['multipleuploadmethod']; $mU->url = htmlspecialchars($this->tmpl['action'] . $amp . 'controller=user&task=multipleupload&' . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&tab=' . $this->tmpl['currenttab']['images'] . '&catid=' . $this->tmpl['catidimage']); $mU->reload = htmlspecialchars($this->tmpl['action'] . $amp . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&tab=' . $this->tmpl['currenttab']['images']); $mU->maxFileSize = PhocaGalleryFileUploadMultiple::getMultipleUploadSizeFormat($this->tmpl['uploadmaxsize']); $mU->chunkSize = '1mb'; $mU->imageHeight = $this->tmpl['multipleresizeheight']; $mU->imageWidth = $this->tmpl['multipleresizewidth']; $mU->imageQuality = 100; $mU->renderMultipleUploadJS(0, $this->tmpl['multipleuploadchunk']); $this->tmpl['mu_output'] = $mU->getMultipleUploadHTML(); } // - - - - - - - - - - - // Java Upload // - - - - - - - - - - - if ((int) $this->tmpl['enablejava'] == 1 && (int) $this->tmpl['displayupload'] == 1) { $jU = new PhocaGalleryFileUploadJava(); $jU->width = $this->tmpl['javaboxwidth']; $jU->height = $this->tmpl['javaboxheight']; $jU->resizewidth = $this->tmpl['multipleresizewidth']; $jU->resizeheight = $this->tmpl['multipleresizeheight']; $jU->uploadmaxsize = $this->tmpl['uploadmaxsize']; $jU->returnUrl = htmlspecialchars($this->tmpl['action'] . $amp . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&tab=' . $this->tmpl['currenttab']['images']); $jU->url = htmlspecialchars($this->tmpl['action'] . $amp . 'controller=user&task=javaupload&' . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&tab=' . $this->tmpl['currenttab']['images'] . '&catid=' . $this->tmpl['catidimage']); $jU->source = JURI::root(true) . '/components/com_phocagallery/assets/jupload/wjhk.jupload.jar'; $this->tmpl['ju_output'] = $jU->getJavaUploadHTML(); } } else { $this->tmpl['displayupload'] = 0; } if (!empty($ownerMainCategory->id)) { $this->tmpl['ps'] = '&tab=' . $this->tmpl['currenttab']['createsubcategory'] . '&limitstartsubcat=' . $this->tmpl['subcategorypagination']->limitstart . '&limitstartimage=' . $this->tmpl['imagepagination']->limitstart; } else { $this->tmpl['ps'] = '&tab=' . $this->tmpl['currenttab']['createsubcategory']; } if (!empty($ownerMainCategory->id)) { $this->tmpl['psi'] = '&tab=' . $this->tmpl['currenttab']['images'] . '&limitstartsubcat=' . $this->tmpl['subcategorypagination']->limitstart . '&limitstartimage=' . $this->tmpl['imagepagination']->limitstart; } else { $this->tmpl['psi'] = '&tab=' . $this->tmpl['currenttab']['images']; } // ASIGN $this->assignRef('listssubcat', $lists_subcat); $this->assignRef('listsimage', $lists_image); //$this->assignRef( 'tmpl', $this->tmpl); //$this->assignRef( 'params', $this->params); $this->assignRef('session', JFactory::getSession()); $this->_prepareDocument(); parent::display($tpl); }
/** * Update function * @return void **/ function make_update() { global $option, $mainframe; jimport('joomla.client.helper'); $ftp_requiered = !JClientHelper::hasCredentials('ftp'); ?> <fieldset> <div class="configuration"><?php echo JText::_('YAML UPDATE TITLE'); ?> </div> </fieldset> <?php if ($ftp_requiered) { ?> <div class="designbox ftpwarn floatbox"> <div class="legend"><?php echo JText::_('YAML FTP TITLE'); ?> </div> <div class="content"> <strong><?php echo JText::_('YAML FTP DESC'); ?> </strong> <form action="index.php" name="ftpForm" id="ftpForm" method="post"> <p> <label for="username">FTP-<?php echo JText::_('Username'); ?> :</label><br /> <input type="text" id="username" name="username" class="input_box" size="70" value="<?php echo $mainframe->getCfg('ftp_user'); ?> " /> </p> <p> <label for="password">FTP-<?php echo JText::_('Password'); ?> :</label><br /> <input type="password" id="password" name="password" class="input_box" size="70" value="" /> </p> <p> <input type="submit" value="<?php echo JText::_('YAML FTP SET BUTTON'); ?> " /> </p> <input type="hidden" name="return" value="index3.php?option=<?php echo $option; ?> &controller=update&task=make_update" /> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="task" value="ftpLogin" /> <input type="hidden" name="controller" value="hmyaml" /> </form> </div> </div> <?php } else { ?> <p><?php echo JText::_('YAML DOWNLOAD UPDATE DESC'); ?> </p> <div align="center"> <button id="startUpdate" onclick="startUpdate()" type="button"><?php echo JText::_('YAML START UPDATE BUTTON'); ?> </button> </div> <div id="updateResult"></div> <script type="text/javascript"> function startUpdate() { jQuery("#startUpdate").hide(); pd = jQuery(parent.document); pd.find("#sbox-btn-close").hide(); jQuery("#updateResult").html('<div id="updateResult"><h3><?php echo JText::_('YAML DOWNLOAD UPDATE FILES'); ?> </h3><img src="<?php echo JURI::base(); ?> /components/<?php echo $option; ?> /images/ajax-loader.gif" width="31" height="31" alt="Loading..." /></div>'); jQuery("#updateResult").load("index3.php?option=<?php echo $option; ?> &controller=update&task=processUpdate"); } </script> <?php } }
public function display($tpl = null) { $this->field = JRequest::getVar('field'); $this->fce = 'phocaSelectFileName_' . $this->field; JHTML::stylesheet('media/com_phocagallery/css/administrator/phocagallery.css'); $document =& JFactory::getDocument(); //$document->addCustomTag(PhocaGalleryRenderAdmin::renderIeCssLink(1)); $this->folderstate = $this->get('FolderState'); $this->images = $this->get('Images'); $this->folders = $this->get('Folders'); $this->session = JFactory::getSession(); $params = JComponentHelper::getParams('com_phocagallery'); $this->tmpl['enablethumbcreation'] = $params->get('enable_thumb_creation', 1); $this->tmpl['enablethumbcreationstatus'] = PhocaGalleryRenderAdmin::renderThumbnailCreationStatus((int) $this->tmpl['enablethumbcreation']); $this->tmpl['multipleuploadchunk'] = $params->get('multiple_upload_chunk', 0); $this->tmpl['large_image_width'] = $params->get('large_image_width', 640); $this->tmpl['large_image_height'] = $params->get('large_image_height', 480); $this->tmpl['javaboxwidth'] = $params->get('java_box_width', 480); $this->tmpl['javaboxheight'] = $params->get('java_box_height', 480); $this->tmpl['uploadmaxsize'] = $params->get('upload_maxsize', 3145728); $this->tmpl['uploadmaxsizeread'] = PhocaGalleryFile::getFileSizeReadable($this->tmpl['uploadmaxsize']); $this->tmpl['uploadmaxreswidth'] = $params->get('upload_maxres_width', 3072); $this->tmpl['uploadmaxresheight'] = $params->get('upload_maxres_height', 2304); $this->tmpl['enablejava'] = $params->get('enable_java', -1); $this->tmpl['enablemultiple'] = $params->get('enable_multiple', 0); $this->tmpl['multipleuploadmethod'] = $params->get('multiple_upload_method', 1); $this->tmpl['multipleresizewidth'] = $params->get('multiple_resize_width', -1); $this->tmpl['multipleresizeheight'] = $params->get('multiple_resize_height', -1); $this->currentFolder = ''; if (isset($this->folderstate->folder) && $this->folderstate->folder != '') { $this->currentFolder = $this->folderstate->folder; } // - - - - - - - - - - //TABS // - - - - - - - - - - $this->tmpl['tab'] = JRequest::getVar('tab', '', '', 'string'); $this->tmpl['displaytabs'] = 0; // UPLOAD $this->tmpl['currenttab']['upload'] = $this->tmpl['displaytabs']; $this->tmpl['displaytabs']++; // MULTIPLE UPLOAD if ((int) $this->tmpl['enablemultiple'] >= 0) { $this->tmpl['currenttab']['multipleupload'] = $this->tmpl['displaytabs']; $this->tmpl['displaytabs']++; } // MULTIPLE UPLOAD if ($this->tmpl['enablejava'] >= 0) { $this->tmpl['currenttab']['javaupload'] = $this->tmpl['displaytabs']; $this->tmpl['displaytabs']++; } // - - - - - - - - - - - // Upload // - - - - - - - - - - - $sU = new PhocaGalleryFileUploadSingle(); $sU->returnUrl = 'index.php?option=com_phocagallery&view=phocagalleryi&tab=upload&tmpl=component&field=' . $this->field . '&folder=' . $this->currentFolder; $sU->tab = 'upload'; $this->tmpl['su_output'] = $sU->getSingleUploadHTML(); $this->tmpl['su_url'] = JURI::base() . 'index.php?option=com_phocagallery&task=phocagalleryu.upload&' . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&viewback=phocagalleryi&field=' . $this->field . '&' . 'folder=' . $this->currentFolder . '&tab=upload'; // - - - - - - - - - - - // Multiple Upload // - - - - - - - - - - - // Get infos from multiple upload $muFailed = JRequest::getVar('mufailed', '0', '', 'int'); $muUploaded = JRequest::getVar('muuploaded', '0', '', 'int'); $this->tmpl['mu_response_msg'] = $muUploadedMsg = ''; if ($muUploaded > 0) { $muUploadedMsg = JText::_('COM_PHOCAGALLERY_COUNT_UPLOADED_IMG') . ': ' . $muUploaded; } if ($muFailed > 0) { $muFailedMsg = JText::_('COM_PHOCAGALLERY_COUNT_NOT_UPLOADED_IMG') . ': ' . $muFailed; } if ($muFailed > 0 && $muUploaded > 0) { $this->tmpl['mu_response_msg'] = '<div class="alert alert-info">' . '<button type="button" class="close" data-dismiss="alert">×</button>' . JText::_('COM_PHOCAGALLERY_COUNT_UPLOADED_IMG') . ': ' . $muUploaded . '<br />' . JText::_('COM_PHOCAGALLERY_COUNT_NOT_UPLOADED_IMG') . ': ' . $muFailed . '</div>'; } else { if ($muFailed > 0 && $muUploaded == 0) { $this->tmpl['mu_response_msg'] = '<div class="alert alert-error">' . '<button type="button" class="close" data-dismiss="alert">×</button>' . JText::_('COM_PHOCAGALLERY_COUNT_NOT_UPLOADED_IMG') . ': ' . $muFailed . '</div>'; } else { if ($muFailed == 0 && $muUploaded > 0) { $this->tmpl['mu_response_msg'] = '<div class="alert alert-success">' . '<button type="button" class="close" data-dismiss="alert">×</button>' . JText::_('COM_PHOCAGALLERY_COUNT_UPLOADED_IMG') . ': ' . $muUploaded . '</div>'; } else { $this->tmpl['mu_response_msg'] = ''; } } } if ((int) $this->tmpl['enablemultiple'] >= 0) { PhocaGalleryFileUploadMultiple::renderMultipleUploadLibraries(); $mU = new PhocaGalleryFileUploadMultiple(); $mU->frontEnd = 0; $mU->method = $this->tmpl['multipleuploadmethod']; $mU->url = JURI::base() . 'index.php?option=com_phocagallery&task=phocagalleryu.multipleupload&' . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&tab=multipleupload&field=' . $this->field . '&folder=' . $this->currentFolder; $mU->reload = JURI::base() . 'index.php?option=com_phocagallery&view=phocagalleryi&tmpl=component&' . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&tab=multipleupload&' . 'field=' . $this->field . '&folder=' . $this->currentFolder; $mU->maxFileSize = PhocaGalleryFileUploadMultiple::getMultipleUploadSizeFormat($this->tmpl['uploadmaxsize']); $mU->chunkSize = '1mb'; $mU->imageHeight = $this->tmpl['multipleresizeheight']; $mU->imageWidth = $this->tmpl['multipleresizewidth']; $mU->imageQuality = 100; $mU->renderMultipleUploadJS(0, $this->tmpl['multipleuploadchunk']); $this->tmpl['mu_output'] = $mU->getMultipleUploadHTML(); } // - - - - - - - - - - - // Java Upload // - - - - - - - - - - - if ((int) $this->tmpl['enablejava'] >= 0) { $jU = new PhocaGalleryFileUploadJava(); $jU->width = $this->tmpl['javaboxwidth']; $jU->height = $this->tmpl['javaboxheight']; $jU->resizewidth = $this->tmpl['multipleresizewidth']; $jU->resizeheight = $this->tmpl['multipleresizeheight']; $jU->uploadmaxsize = $this->tmpl['uploadmaxsize']; $jU->returnUrl = JURI::base() . 'index.php?option=com_phocagallery&view=phocagalleryi&tmpl=component&tab=javaupload&' . 'field=' . $this->field . '&folder=' . $this->currentFolder; $jU->url = JURI::base() . 'index.php?option=com_phocagallery&task=phocagalleryu.javaupload&' . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&viewback=phocagalleryi&tab=javaupload' . '&field=' . $this->field . '&folder=' . $this->currentFolder; $jU->source = JURI::root(true) . '/components/com_phocagallery/assets/jupload/wjhk.jupload.jar'; $this->tmpl['ju_output'] = $jU->getJavaUploadHTML(); } $this->tmpl['ftp'] = !JClientHelper::hasCredentials('ftp'); parent::display($tpl); echo JHTML::_('behavior.keepalive'); }
/** * Helper wrapper method for hasCredentials * * @param string $client Client name, currently only 'ftp' is supported * * @return boolean True if login credentials are available * * @see JClientHelper::hasCredentials() * @since 3.4 */ public function hasCredentials($client) { return JClientHelper::hasCredentials($client); }