示例#1
0
 /**
  * Constructor
  *
  * @access  protected
  * @return  void
  * @since   1.5.5
  */
 function __construct($config = array())
 {
     parent::__construct($config);
     $this->_ambit = JoomAmbit::getInstance();
     $this->_config = JoomConfig::getInstance();
     $this->_mainframe = JFactory::getApplication('administrator');
     $this->_user = JFactory::getUser();
     $this->_doc = JFactory::getDocument();
     $this->_doc->addStyleSheet($this->_ambit->getStyleSheet('admin.joomgallery.css'));
     JHtmlBehavior::framework();
     $this->_doc->addScript($this->_ambit->getScript('admin.js'));
     JoomHelper::addSubmenu();
     JHTML::addIncludePath(JPATH_COMPONENT . '/helpers/html');
     // Check for available updates
     if (!($checked = $this->_mainframe->getUserState('joom.update.checked'))) {
         $controller = JRequest::getCmd('controller');
         if ($this->_config->get('jg_checkupdate') && $controller && $controller != 'control') {
             $dated_extensions = JoomExtensions::checkUpdate();
             if (count($dated_extensions)) {
                 $this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_ADMENU_SYSTEM_NOT_UPTODATE'), 'warning');
                 $this->_mainframe->setUserState('joom.update.checked', -1);
             } else {
                 $this->_mainframe->setUserState('joom.update.checked', 1);
             }
         }
     } else {
         if ($checked == -1) {
             $controller = JRequest::getCmd('controller');
             if ($controller && $controller != 'control') {
                 $this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_ADMENU_SYSTEM_NOT_UPTODATE'), 'warning');
             }
         }
     }
 }
示例#2
0
 /**
  * Updates a passed and dated extension
  *
  * The cURL library needs to be installed on the server for this.
  *
  * @access  public
  * @return  void
  * @since   1.5.5
  */
 function update()
 {
     $extension = JRequest::getCmd('extension', 0, 'get');
     $extensions = JoomExtensions::checkUpdate();
     if (!isset($extensions[$extension]['updatelink']) || !extension_loaded('curl')) {
         $this->setRedirect('index.php?option=' . _JOOM_OPTION, JText::_('COM_JOOMGALLERY_ADMENU_MSG_ERROR_FETCHING_ZIP'), 'error');
     } else {
         JoomExtensions::autoUpdate($extensions[$extension]['updatelink']);
     }
     // Tell JoomGallery to do the update check again after the update
     $mainframe = JFactory::getApplication();
     $mainframe->setUserState('joom.update.checked', null);
 }
示例#3
0
 /**
  * HTML view display method
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  * @since   1.5.5
  */
 public function display($tpl = null)
 {
     $this->params = JComponentHelper::getParams('com_joomgallery');
     JToolBarHelper::title(JText::_('COM_JOOMGALLERY_ADMENU_ADMINMENU'), 'joomgallery');
     $this->canDo = JoomHelper::getActions();
     if ($this->canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_joomgallery');
         JToolBarHelper::spacer();
     }
     // Get data from the model
     $model = $this->getModel();
     $this->state = $model->getState();
     $this->items = $model->getData();
     $this->popularImages = $model->getImages('a.hits desc', true, 5, 'a.hits > 0');
     $this->notApprovedImages = $model->getImages('a.imgdate desc', false, 5);
     $this->notApprovedComments = $model->getComments('c.cmtdate desc', false, 5);
     $this->topDownloads = $model->getImages('a.downloads desc', true, 5, 'a.downloads > 0');
     $lang = JFactory::getLanguage();
     $this->modules =& JModuleHelper::getModules('joom_cpanel');
     if ($this->_config->get('jg_checkupdate')) {
         $available_extensions = JoomExtensions::getAvailableExtensions();
         $this->params->set('url_fopen_allowed', @ini_get('allow_url_fopen'));
         $this->params->set('curl_loaded', extension_loaded('curl'));
         // If there weren't any available extensions found
         // loading the RSS feed wasn't successful
         if (count($available_extensions)) {
             $installed_extensions = JoomExtensions::getInstalledExtensions();
             $this->assignRef('available_extensions', $available_extensions);
             $this->assignRef('installed_extensions', $installed_extensions);
             $this->params->set('show_available_extensions', 1);
             $dated_extensions = JoomExtensions::checkUpdate();
             if (count($dated_extensions)) {
                 $this->assignRef('dated_extensions', $dated_extensions);
                 $this->params->set('dated_extensions', 1);
             } else {
                 $this->params->set('dated_extensions', 0);
                 $this->params->set('show_update_info_text', 1);
             }
         }
     } else {
         $this->params->set('dated_extensions', 0);
     }
     parent::display($tpl);
 }