public static function getExtConfigurations($extName = '')
 {
     $installedComponents = PoweradminHelper::getInstalledComponents();
     $configurations = array();
     if (!$extName) {
         $supportedList = JPluginHelper::getPlugin('jsnpoweradmin');
         if (count($supportedList)) {
             foreach ($supportedList as $key => $ext) {
                 if (in_array('com_' . $ext->name, $installedComponents)) {
                     $config = self::executeExtMethod($ext->name, 'addConfiguration');
                     if (count($config)) {
                         $configurations[$ext->name] = $config;
                     }
                 }
             }
         }
     } else {
         if (in_array('com_' . $extName, $installedComponents)) {
             $config = self::executeExtMethod($extName, 'addConfiguration');
             if (count($config)) {
                 $configurations[$extName] = $config;
             }
         }
     }
     return $configurations;
 }
 /**
  * Typical view method for MVC based architecture
  *
  * This function is provide as a default implementation, in most cases
  * you will need to override it in your own controllers.
  *
  * @param   boolean  $cachable   If true, the view output will be cached
  * @param   array    $urlparams  An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return  JController  A JController object to support chaining.
  *
  * @since   11.1
  */
 function display($cachable = false, $urlparams = false)
 {
     // Set default view if not set
     JRequest::setVar('view', JRequest::getCmd('view', 'rawmode'));
     PoweradminHelper::addSubmenu(JRequest::getCmd('view'));
     // Call parent behavior
     parent::display($cachable);
 }
示例#3
0
 /**
  * Return a list of coverages that use to generate select box
  * @return Array
  */
 private function getCoverages()
 {
     $coverages = array();
     foreach (PoweradminHelper::getSearchCoverages() as $coverage) {
         if ($coverage == 'adminmenus') {
             continue;
         }
         $coverages[] = array('value' => $coverage, 'text' => JText::_('PLG_JSNADMINBAR_SEARCH_COVERAGE_' . strtoupper(str_replace(JSN_3RD_EXTENSION_STRING . '-', '', $coverage)), true));
     }
     return $coverages;
 }
示例#4
0
 public function display($tpl = null)
 {
     // Get config parameters
     $config = JSNConfigHelper::get();
     // Set the toolbar
     JToolBarHelper::title(JText::_('JSN_POWERADMIN_UPDATE_TITLE'));
     // Add assets
     $document = JFactory::getDocument();
     JSNHtmlAsset::addStyle(PoweradminHelper::makeUrlWithSuffix(JSN_URL_ASSETS . '/joomlashine/css/jsn-gui.css'));
     $redirAfterFinish = 'index.php?option=com_poweradmin&view=about';
     $this->assign('redirAfterFinish', $redirAfterFinish);
     // Display the template
     parent::display($tpl);
 }
示例#5
0
 /**
  * Populate search and response results to client as json format
  * @return void
  */
 function json()
 {
     header("Cache-Control: no-cache, must-revalidate");
     // HTTP/1.1
     header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
     // Date in the past
     $keyword = JRequest::getString('keyword');
     $coverages = array_map('trim', explode(',', JRequest::getString('coverages')));
     $dispatcher =& JDispatcher::getInstance();
     require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers/poweradmin.php';
     require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers/plugin.php';
     $params = JSNConfigHelper::get('com_poweradmin');
     $resultLimit = (int) $params->get('search_result_num', 10);
     //JRequest::setVar('limit', $resultLimit);
     // Load language
     JFactory::getLanguage()->load('plg_system_jsnpoweradmin');
     // Load model
     $model = JSNBaseModel::getInstance('Search', 'PowerAdminModel');
     $model->setState('search.keyword', $keyword);
     $model->setState('search.pagination', false);
     $installedComponents = PoweradminHelper::getInstalledComponents();
     $results = array();
     foreach ($coverages as $coverage) {
         if ($coverage == 'adminmenus') {
             continue;
         }
         $components = array();
         if ($coverage == 'components') {
             if (in_array('com_banners', $installedComponents)) {
                 $components['com_banners'] = array('com_banners', 'com_banners_categories', 'com_banners_clients');
             }
             if (in_array('com_contacts', $installedComponents)) {
                 $components['com_contacts'] = array('com_contacts', 'com_contacts_categories');
             }
             if (in_array('com_messages', $installedComponents)) {
                 $components['com_messages'] = array('com_messages');
             }
             if (in_array('com_newsfeeds', $installedComponents)) {
                 $components['com_newsfeeds'] = array('com_newsfeeds', 'com_newsfeeds_categories');
             }
             if (in_array('com_weblinks', $installedComponents)) {
                 $components['com_weblinks'] = array('com_weblinks', 'com_weblinks_categories');
             }
         }
         if (strpos($coverage, JSN_3RD_EXTENSION_STRING) !== false) {
             $_extName = explode(JSN_3RD_EXTENSION_STRING . "-", $coverage);
             $_extName = $_extName[1];
             if ($_extName && in_array('com_' . $_extName, $installedComponents)) {
                 JPluginHelper::importPlugin('jsnpoweradmin', $_extName);
                 $_range = $dispatcher->trigger('addSearchRange');
                 if (count($_range[0])) {
                     $components['com_' . strtolower($_extName)] = array();
                     foreach ($_range[0] as $key => $value) {
                         array_push($components['com_' . strtolower($_extName)], $key);
                     }
                 }
             } else {
                 continue;
             }
         }
         if (strpos($coverage, JSN_3RD_EXTENSION_NOT_INSTALLED_STRING) !== false) {
             $results[] = array('type' => 'notice', 'target' => 'index.php?option=com_poweradmin&view=configuration&s=maintainence&g=extensions', 'title' => JText::_('JSN_POWERADMIN_EXT_SPOTLIGHT_INSTALL_EXTENSION') . ' ' . str_ireplace(JSN_3RD_EXTENSION_NOT_INSTALLED_STRING . '-', 'com_', $coverage));
             continue;
         }
         if (strpos($coverage, JSN_3RD_EXTENSION_NOT_ENABLED_STRING) !== false) {
             $results[] = array('type' => 'notice', 'link' => 'index.php?option=com_poweradmin&view=configuration', 'title' => JText::_('JSN_POWERADMIN_EXT_SPOTLIGHT_ENABLE_EXTENSION') . ' ' . str_ireplace(JSN_3RD_EXTENSION_NOT_ENABLED_STRING . '-', 'com_', $coverage));
             continue;
         }
         if (!empty($components)) {
             foreach ($components as $key => $component) {
                 $componentResults = array();
                 $type = $component;
                 if (is_array($component)) {
                     $type = $key;
                     foreach ($component as $subsection) {
                         $model->setState('search.coverage', $subsection);
                         $componentResults = array_merge($componentResults, $model->getItems());
                     }
                 } else {
                     $model->setState('search.coverage', $component);
                     $componentResults = array_merge($componentResults, $model->getItems());
                 }
                 if (count($componentResults) > 0) {
                     $results[] = array('title' => JText::_('PLG_JSNADMINBAR_SEARCH_COVERAGE_' . strtoupper($type), true), 'description' => '', 'type' => $type, 'coverage' => $coverage);
                     $results = array_merge($results, $componentResults);
                 }
             }
             continue;
         }
         $model->setState('search.coverage', $coverage);
         $total = $model->getTotal();
         $items = $model->getItems();
         if (count($items) > 0) {
             $results[] = array('title' => JText::_('PLG_JSNADMINBAR_SEARCH_COVERAGE_' . strtoupper($coverage)), 'description' => '', 'type' => $coverage, 'coverage' => $coverage, 'hasMore' => $total - $resultLimit);
             $results = array_merge($results, $items);
         }
     }
     echo json_encode($results);
     jexit();
 }
示例#6
0
 /**
  * Retrieve list installed components
  * @return mixed
  */
 public static function getInstalledComponents()
 {
     if (self::$_installedComponents == null) {
         $dbo = JFactory::getDBO();
         $dbo->setQuery("SELECT element FROM #__extensions WHERE type='component'");
         self::$_installedComponents = $dbo->loadColumn();
     }
     return self::$_installedComponents;
 }
示例#7
0
 /**
  *
  * Parse all queue to page
  *
  */
 public function addMedia()
 {
     $document = JFactory::getDocument();
     $docType = $document->getType();
     if ($this->_load_js_language) {
         JSNFactory::localimport('libraries.joomlashine.language.javascriptlanguages');
         $jsLang = JSNJavascriptLanguages::getInstance();
         $this->addScriptDeclaration($jsLang->loadLang());
     }
     if ($this->_docType == 'raw') {
         $medias = array();
         //Add all style file to page
         if (count($this->_styles)) {
             foreach ($this->_styles as $style) {
                 $medias[] = '<link  type="text/css" rel="stylesheet" href="' . $style . '" />';
             }
         }
         //Add all script file to page
         if (count($this->_scripts)) {
             foreach ($this->_scripts as $script) {
                 $medias[] = '<script type="text/javascript" src="' . $script . '"></script>';
             }
             if (!in_array(PoweradminHelper::makeUrlWithSuffix(JSN_POWERADMIN_LIB_JSNJS_URI . 'conflict.js'), $this->_scripts)) {
                 $medias[] = '<script type="text/javascript" src="' . PoweradminHelper::makeUrlWithSuffix(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.conflict.js') . '"></script>';
             }
         }
         //Add all custom tag to page
         if (count($this->_customs)) {
             foreach ($this->_customs as $custom) {
                 $medias[] = $custom;
             }
         }
         //Add all style declaration to page
         if (count($this->_styleDeclaration)) {
             $medias[] = '<style type="text/css">' . implode(PHP_EOL, $this->_styleDeclaration) . '</style>';
         }
         //Add all script declaration to page
         if (count($this->_scriptDeclaration)) {
             $medias[] = '<script type="text/javascript">' . implode(PHP_EOL, $this->_scriptDeclaration) . '</script>';
         }
         echo implode(PHP_EOL, $medias);
     } else {
         //behavior mootools
         JHtmlBehavior::framework();
         //behavior modal
         JHtml::_('behavior.modal');
         //behavior tooltip
         JHtml::_('behavior.tooltip');
         //behavior formvalidation
         JHtml::_('behavior.formvalidation');
         //behavior combobox
         JHtml::_('behavior.combobox');
         //Add all style file to page
         if (count($this->_styles)) {
             foreach ($this->_styles as $style) {
                 $document->addStyleSheet($style);
             }
         }
         $system_js = array();
         $user_js = array();
         $docScripts = $document->_scripts;
         if (count($docScripts)) {
             foreach ($docScripts as $key => $script) {
                 if (strpos($key, '/media/system/') !== false) {
                     $system_js[$key] = $script;
                 } else {
                     if (!is_jquery($key)) {
                         $user_js[$key] = $script;
                     }
                 }
             }
             $document->_scripts = array();
         }
         //Add all script file to page
         if (count($this->_scripts)) {
             foreach ($this->_scripts as $script) {
                 JSNHtmlAsset::addScript($script);
             }
             if (!in_array(PoweradminHelper::makeUrlWithSuffix(JSN_POWERADMIN_LIB_JSNJS_URI . 'conflict.js'), $this->_scripts)) {
                 JSNHtmlAsset::addScript(PoweradminHelper::makeUrlWithSuffix(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.conflict.js'));
             }
         }
         $docScripts = $document->_scripts;
         $index = 0;
         $jsn_jquery = array();
         foreach ($docScripts as $key => $script) {
             if ($index < 2) {
                 $jsn_jquery[$key] = $script;
             } else {
                 $user_js[$key] = $script;
             }
             $index++;
         }
         $document->_scripts = $system_js + $jsn_jquery + $user_js;
         //Add all custom tag to page
         if (count($this->_customs)) {
             foreach ($this->_customs as $custom) {
                 $document->addCustomTag($custom);
             }
         }
         //Add all style declaration to page
         if (count($this->_styleDeclaration)) {
             $document->addStyleDeclaration(implode(PHP_EOL, $this->_styleDeclaration));
         }
         //Add all script declaration to page
         if (count($this->_scriptDeclaration)) {
             $document->addScriptDeclaration(implode(PHP_EOL, $this->_scriptDeclaration));
         }
     }
     $this->_dispatch = true;
     $this->__construct();
 }
 /**
  * Return parameters for client side as JSON format
  * @return string
  */
 private function _getJSConfiguration()
 {
     $input = $this->_application->input;
     $defaultStyles = $this->_getDefaultStyles();
     $installedComponents = PoweradminHelper::getInstalledComponents();
     $supportedExtList = JSNPaExtensionsHelper::getSupportedExtList();
     if (!$this->_params->get('search_coverage')) {
         $coverages = PoweradminHelper::getSearchCoverages();
     } else {
         $coverages = json_decode($this->_params->get('search_coverage', PoweradminHelper::getSearchCoverages()));
     }
     foreach ($supportedExtList as $_supportedExt => $value) {
         $supportedExtAlias = str_replace('com_', JSN_3RD_EXTENSION_STRING . '-', $_supportedExt);
         $_extShortName = str_ireplace('com_', '', $_supportedExt);
         $_plg = JPluginHelper::getPlugin('jsnpoweradmin', $_extShortName);
         if (in_array($_supportedExt, $installedComponents) && !in_array($_supportedExt, $coverages) && !count($_plg) && !in_array($supportedExtAlias, explode(',', $this->_params->get('search_coverage_order')))) {
             array_push($coverages, JSN_3RD_EXTENSION_NOT_INSTALLED_STRING . '-' . $_extShortName);
         }
         if (in_array($_supportedExt, $installedComponents) && count($_plg) && !in_array($supportedExtAlias, explode(',', $this->_params->get('search_coverage_order')))) {
             array_push($coverages, JSN_3RD_EXTENSION_NOT_ENABLED_STRING . '-' . $_extShortName);
         }
     }
     $logoFile = $this->_params->get('logo_file', 'administrator/components/com_poweradmin/assets/images/logo-jsnpoweradmin.png');
     $logoFile = $logoFile == 'N/A' ? '' : JURI::root(true) . '/' . $logoFile;
     $canInstall = $this->_user->authorise('core.manage', 'com_installer');
     // Get editors
     $curEditor = JFactory::getUser()->getParam('editor');
     $editorOptions = array();
     foreach ($this->_getEditorOptions() as $option) {
         $_isAtive = $curEditor == $option->value ? true : false;
         $editorOptions[] = array('value' => $option->value, 'name' => $option->text, 'active' => $_isAtive);
     }
     $conf = array('currentUrl' => $_SERVER["REQUEST_URI"], 'baseUrl' => JURI::base(true) . '/', 'rootUrl' => JURI::root(true) . '/', 'userId' => $this->_user->id, 'protected' => $this->_getProtectedComponents(), 'defaultStyles' => $defaultStyles, 'logoFile' => $logoFile, 'logoLink' => $this->_params->get('logo_link', 'http://www.joomlashine.com/joomla-extensions/jsn-poweradmin.html'), 'logoLinkTarget' => $this->_params->get('logo_target', '_blank'), 'logoTitle' => JText::_($this->_params->get('logo_slogan', JText::_('PLG_JSNADMINBAR_CONFIG_LOGO_SLOGAN_DEFAULT'))), 'allowUninstall' => $this->_params->get('allow_uninstall', true) && $canInstall, 'linkTarget' => $this->_target, 'preloadImages' => array('bg-overlay.png', 'loader.gif', 'dark-loader.gif', 'ui-window-buttons.png'), 'pinned' => $this->_params->get('pinned_bar', true), 'sessionInfinite' => $this->_params->get('admin_session_timer_infinite', false), 'warningTime' => $this->_params->get('session_timeout_warning', 1), 'disableWarning' => $this->_params->get('admin_session_timeout_warning_disabled', false), 'searchCoverages' => $coverages, 'sitemenu' => array('preview' => $this->_preview->getPreviewLink(), 'manager' => JRoute::_('index.php?option=com_poweradmin&view=rawmode', false)), 'usermenu' => array('messages' => $this->_getMessagesCount(), 'profileLink' => "index.php?option=com_admin&task=profile.edit&id={$this->_user->id}&tmpl=component", 'messageLink' => "index.php?option=com_messages", 'logoutLink' => "index.php?option=com_login&task=logout&" . JSession::getFormToken() . "=1"), 'history' => array('url' => 'index.php?option=com_poweradmin&task=history.load'), 'spotlight' => array('limit' => $this->_params->get('search_result_num', 10)), 'urlparams' => array('option' => $input->getVar('option', ''), 'task' => $input->getVar('task', ''), 'view' => $input->getVar('view', ''), 'layout' => $input->getVar('layout', ''), 'id' => $input->getInt('id', 0)), 'editors' => $editorOptions);
     return json_encode($conf);
 }
    /**
     * Get the language manager markup.
     *
     * @return  string
     */
    protected function getInput()
    {
        require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/extensions.php';
        // Generate field container id
        $id = str_replace('_', '-', $this->id) . '-field';
        // Preset output
        $supportedExtList = JSNPaExtensionsHelper::getSupportedExtList();
        JSNHtmlAsset::addScript(JURI::root(true) . '/plugins/system/jsnframework/assets/3rd-party/jquery-tipsy/jquery.tipsy.js');
        JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JS_URI . 'joomlashine/configuration/extmanager.js');
        $customScript = "var baseUrl       = '" . JURI::root() . "';";
        JSNHtmlAsset::addInlineScript($customScript);
        if (count($supportedExtList)) {
            $installedComponents = PoweradminHelper::getInstalledComponents();
            foreach ($supportedExtList as $key => $ext) {
                $_shortName = str_ireplace("com_", "", $key);
                $ext->name = $_shortName;
                $ext->comInstalled = in_array($key, $installedComponents) ? true : false;
                $extStatus = JSNPaExtensionsHelper::checkInstalledPlugin($_shortName);
                if ($extStatus['isInstalled']) {
                    $ext->plgInstalled = true;
                    $ext->enabled = $extStatus['isEnabled'];
                } else {
                    $ext->plgInstalled = false;
                    $ext->enabled = false;
                }
                $list[$_shortName] = $ext;
            }
        }
        $html[] = '<div class="jsn-supported-ext-list">
					<input type="hidden" id="label-disable" value="' . JText::_('JSN_POWERADMIN_EXTPAGE_DISABLE') . '">
					<input type="hidden" id="label-enable" value="' . JText::_('JSN_POWERADMIN_EXTPAGE_ENABLE') . '">
					<input type="hidden" id="label-install" value="' . JText::_('JSN_POWERADMIN_EXTPAGE_INSTALL') . '">
					';
        $html[] = '<ul class="thumbnails">';
        foreach ($list as $ext) {
            $_className = '';
            $_alt = '';
            $posibleAct = '';
            $_id = JSN_POWERADMIN_EXT_IDENTIFIED_NAME_PREFIX . $ext->name;
            if (!$ext->comInstalled) {
                $_className = 'item-locked';
                $_alt = JText::_('JSN_POWERADMIN_EXTPAGE_COM_NOT_INSTALLED_EXPLAIN');
                $posibleAct = '<a class="btn btn-primary disabled" href="#" title="' . JText::_('JSN_POWERADMIN_EXTPAGE_COM_NOT_INSTALLED_EXPLAIN') . '">' . JText::_('JSN_POWERADMIN_EXTPAGE_INSTALL') . '</a>';
            } else {
                if ($ext->plgInstalled) {
                    if (!$ext->enabled) {
                        $_className = 'item-installed item-disabled';
                        $_alt = JText::_('JSN_POWERADMIN_EXTPAGE_CLICK_TO_ENABLE');
                        $posibleAct = '<a class="btn btn-primary" id="' . $_id . '" act="enable" href="#">' . JText::_('JSN_POWERADMIN_EXTPAGE_ENABLE') . '</a>';
                    } else {
                        $_className = 'item-installed item-enabled';
                        $_alt = JText::_('JSN_POWERADMIN_EXTPAGE_CLICK_TO_DISABLE');
                        $posibleAct = '<a class="btn btn-primary" id="' . $_id . '" act="disable" href="#">' . JText::_('JSN_POWERADMIN_EXTPAGE_DISABLE') . '</a>';
                    }
                } else {
                    $_className = 'item-notinstalled';
                    $_alt = JText::_('JSN_POWERADMIN_EXTPAGE_CLICK_TO_INSTALL');
                    $posibleAct = '<a class="btn btn-primary" id="' . $_id . '" act="install" href="#">' . JText::_('JSN_POWERADMIN_EXTPAGE_INSTALL') . '</a>';
                }
            }
            $html[] = '	 <li class="span4">
								<div class="thumbnail">
									<img src="' . $ext->thumbnail . '" alt="">
									<div class="caption">
										<h2>' . ucfirst($ext->name) . '</h2>
										<p>
											' . $posibleAct . '
										</p>
									</div>
								</div>
							</li>';
        }
        $html[] = '</ul>';
        return implode($html);
    }
示例#10
0
 /**
  * Proceed positions rendering
  *
  * Remove default tp=1 layout, replace by jsn style to
  * show page positions
  *
  * @return  void
  */
 public function onAfterDispatch()
 {
     if (!JSNVersion::isJoomlaCompatible(JSN_FRAMEWORK_REQUIRED_JOOMLA_VER)) {
         return;
     }
     // Keep this for joomla 2.5. Will be deprecated.
     if (JSNVersion::isJoomlaCompatible('2.5') and !JSNVersion::isJoomlaCompatible('3.0')) {
         if (self::$_app->isAdmin() and self::$_app->input->getVar('format', '') != 'raw' and self::$_app->input->getVar('option', '') == 'com_poweradmin' and self::$_app->input->getVar('view') != 'update' and self::$_app->input->getVar('view') != 'changeposition') {
             $version = PoweradminHelper::getVersion();
             if (version_compare($version, '1.1.3', '>=')) {
                 $JSNMedia = JSNFactory::getMedia();
                 $JSNMedia->addMedia();
             }
         }
     }
     if (self::$_app->input->getCmd('poweradmin', 0) == 1) {
         $jsnHelper = JSNPositionsModel::_getInstance();
         $jsnHelper->renderEmptyComponent();
         $jsnHelper->renderEmptyModule();
     }
 }
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     JSNFactory::localimport('helpers.poweradmin');
     // Initialize variables.
     $options = array();
     //get predefined search coverages
     $options = PoweradminHelper::getSearchCoverages();
     return $options;
 }