function __construct($lifetime) { $this->MijosefConfig = Mijosef::getConfig(); $JoomlaConfig =& JFactory::getConfig(); $options = array('defaultgroup' => 'com_mijosef', 'cachebase' => JPATH_SITE . '/cache', 'lifetime' => $lifetime, 'language' => 'en-GB', 'storage' => $JoomlaConfig->get('cache_handler', 'file'), 'caching' => true); parent::__construct($options); }
function saveDownloadID() { $pid = trim(JRequest::getVar('pid', '', 'post', 'string')); if (!empty($pid)) { $MijosefConfig = Mijosef::getConfig(); $MijosefConfig->pid = $pid; Mijosef::get('utility')->storeConfig($MijosefConfig); } }
function __construct() { // Get config object $this->MijosefConfig = Mijosef::getConfig(); // Multilanguage fix $language = Mijosef::get('language'); $language->multilangFix(); $language->parseLang(array('lang' => $language->_getLangVar())); }
function __construct($params = null) { // Get config object $this->MijosefConfig = Mijosef::getConfig(); // Meta $this->meta_title = array(); $this->meta_desc = null; $this->params = $params; // Skip menu self::skipMenu(false); }
function display($tpl = null) { // Toolbar JToolBarHelper::title(JText::_('COM_MIJOSEF_COMMON_CONTROLPANEL'), 'mijosef'); $this->toolbar->appendButton('Popup', 'cache', JText::_('COM_MIJOSEF_CACHE_CLEAN'), 'index.php?option=com_mijosef&controller=purgeupdate&task=cache&tmpl=component', 300, 380); JToolBarHelper::divider(); $this->toolbar->appendButton('Popup', 'help1', JText::_('Help'), 'http://www.mijosoft.com/support/docs/mijosef/user-manual/control-panel?tmpl=component', 650, 500); $this->MijosefConfig = Mijosef::getConfig(); // Assign vars to the template $this->assignRef('info', $this->get('Info')); $this->assignRef('extensions', $this->get('Extensions')); parent::display($tpl); }
function __construct(&$subject, $config) { parent::__construct($subject, $config); $factory_file = JPATH_ADMINISTRATOR . '/components/com_mijosef/library/mijosef.php'; if (file_exists($factory_file)) { require_once $factory_file; if (!class_exists('MijoDatabase')) { require_once JPATH_ADMINISTRATOR . '/components/com_mijosef/library/database.php'; } require_once JPATH_ADMINISTRATOR . '/components/com_mijosef/library/metadata.php'; require_once JPATH_ADMINISTRATOR . '/components/com_mijosef/library/utility.php'; $this->MijosefConfig = Mijosef::getConfig(); } }
public function getLang(&$uri) { if (Mijosef::getConfig()->multilang == 0) { return ''; } $lang = $uri->getVar('lang'); if (empty($lang)) { $lang = self::$_lang; if (empty($lang)) { $lang = JRequest::getWord('lang', ''); } } if (empty($lang)) { return ''; } $uri->setVar('lang', $lang); return $lang; }
public function __construct() { $this->MijosefConfig = Mijosef::getConfig(); }
public static function sefToolEnabled() { //check mijosef $mijoseffilename = JPATH_ADMINISTRATOR . '/components/com_mijosef/library/mijosef.php'; if (JFile::exists($mijoseffilename)) { require_once($mijoseffilename); $mijoconfig = Mijosef::getConfig(); if ($mijoconfig->mode == 1){ return true; } } //check sh404 $sh404filename = JPATH_ADMINISTRATOR . '/components/com_sh404sef/sh404sef.class.php'; if (JFile::exists($sh404filename)) { require_once($sh404filename); // get our configuration $sefConfig = &Sh404sefFactory::getConfig(); if ($sefConfig->Enabled) { return true; } } //check acesef //no more necessary with acesef > 4.1.1 // $aceseffilename = JPATH_ADMINISTRATOR . '/components/com_acesef/library/utility.php'; // if (JFile::exists($aceseffilename)) { // require_once($aceseffilename); // $AcesefConfig = AcesefFactory::getConfig(); // if ($AcesefConfig->mode == 1){ // //woraround to set language filter mijosef don't set it in 4.1.1 // $app = JFactory::getApplication(); // if ($app->isSite()){ // $app->setLanguageFilter(true); // } // return true; // } // } return false; }
public function _systemCheckup($check_raw = true) { static $status; if (!isset($status)) { $status = true; if (version_compare(PHP_VERSION, '5.2.0', '<')) { JError::raiseWarning('100', JText::sprintf('MijoSEF requires PHP 5.2.x to run, please contact your hosting company.')); $status = false; return $status; } $mijosef = JPATH_ADMINISTRATOR . '/components/com_mijosef/library/mijosef.php'; if (!file_exists($mijosef)) { $status = false; return $status; } require_once $mijosef; $this->MijosefConfig = Mijosef::getConfig(); // Is backend if (JFactory::getApplication()->isAdmin()) { $status = false; return $status; } // Joomla SEF is disabled if (!JFactory::getConfig()->get('sef')) { $status = false; return $status; } // Check if MijoSEF is enabled if ($this->MijosefConfig->mode == 0) { $status = false; return $status; } // Is plugin enabled if (!JPluginHelper::isEnabled('system', 'mijosef')) { $status = false; return $status; } } if ($check_raw == true) { $raw = JRequest::getCmd('format') == 'raw' || JRequest::getCmd('format') == 'xml' || JRequest::getCmd('tmpl') == 'raw'; if ($raw) { $status = false; } } return $status; }
} } // Status if ($info->version == JText::_('Disabled')) { $status = $info->version; } elseif ($info->version == JText::_('Not Available')) { $status = '<input type="button" class="button hasTip" value="' . JText::_('COM_MIJOSEF_EXTENSIONS_VIEW_STATUS_4') . '" onclick="window.open(\'http://www.mijosoft.com/services/new-extension-request\');" title="' . JText::_('COM_MIJOSEF_EXTENSIONS_VIEW_STATUS_GET') . '" />'; } else { if (file_exists(JPATH_MIJOSEF_ADMIN . '/extensions/' . $row->extension . '.php')) { $compared = version_compare($installed_version, $info->version); if ($compared != -1) { // Up-to-date $status = JText::_('COM_MIJOSEF_EXTENSIONS_VIEW_STATUS_1'); } else { // Upgrade needed $pid = Mijosef::getConfig()->pid; if ($license == 'Free') { $url = 'index.php?option=com_mijoextensions&view=download&model=ext_mijosef_' . str_replace('com_', '', $row->extension) . '&free=1'; $func = "upgradeExt('" . $url . "');"; } elseif (!empty($pid)) { $url = 'index.php?option=com_mijoextensions&view=download&model=ext_mijosef_' . str_replace('com_', '', $row->extension) . '&pid=' . $pid; $func = "upgradeExt('" . $url . "');"; } else { $func = "return noPersonalId();"; } $status = '<input type="button" class="button hasTip" value="' . JText::_('COM_MIJOSEF_EXTENSIONS_VIEW_STATUS_2') . '" onclick="' . $func . '" title="' . JText::_('COM_MIJOSEF_EXTENSIONS_VIEW_STATUS_UPGRADE') . '"/>'; } } else { $status = '<input type="button" class="button hasTip" value="' . JText::_('COM_MIJOSEF_EXTENSIONS_VIEW_STATUS_3') . '" onclick="window.open(\'' . $info->link . '\');" title="' . JText::_('COM_MIJOSEF_EXTENSIONS_VIEW_STATUS_GET') . '" />'; } }
function __construct() { // Get config object $this->MijosefConfig = Mijosef::getConfig(); }
function install() { // Get the extension manifest object $this->manifest =& $this->parent->getManifest(); // Set the extension's name $name = (string) $this->manifest->name; $this->parent->set('name', $name); // Set the extension's description $description = (string) $this->manifest->description; $this->parent->set('message', $description); // Set the installation path $this->parent->setPath('extension_root', JPATH_ADMINISTRATOR . '/components/com_mijosef/extensions'); /** * --------------------------------------------------------------------------------------------- * Filesystem Processing Section * --------------------------------------------------------------------------------------------- */ // If the extension directory does not exist, lets create it $created = false; if (!file_exists($this->parent->getPath('extension_root'))) { if (!($created = JFolder::create($this->parent->getPath('extension_root')))) { $this->parent->abort(JText::_('MijoSEF Extension') . ' ' . JText::_('Install') . ': ' . JText::_('Failed to create directory') . ': "' . $this->parent->getPath('extension_root') . '"'); return false; } } if ($created) { $this->parent->pushStep(array('type' => 'folder', 'path' => $this->parent->getPath('extension_root'))); } // Copy all necessary files $element =& $this->manifest->files; if ($this->parent->parseFiles($element, -1) === false) { // Install failed, roll back changes $this->parent->abort(); return false; } // If there is an install file, lets copy it. $installScriptElement = (string) $this->manifest->installfile; if ($installScriptElement) { // Make sure it hasn't already been copied (this would be an error in the xml install file) if (!file_exists($this->parent->getPath('extension_root') . DS . $installScriptElement)) { $path['src'] = $this->parent->getPath('source') . DS . $installScriptElement; $path['dest'] = $this->parent->getPath('extension_root') . DS . $installScriptElement; if (!$this->parent->copyFiles(array($path))) { // Install failed, rollback changes $this->parent->abort(JText::_('MijoSEF Extension') . ' ' . JText::_('Install') . ': ' . JText::_('Could not copy PHP install file.')); return false; } } $this->set('install.script', $installScriptElement); } // If there is an uninstall file, lets copy it. $uninstallScriptElement = (string) $this->manifest->uninstallfile; if ($uninstallScriptElement) { // Make sure it hasn't already been copied (this would be an error in the xml install file) if (!file_exists($this->parent->getPath('extension_root') . DS . $uninstallScriptElement)) { $path['src'] = $this->parent->getPath('source') . DS . $uninstallScriptElement; $path['dest'] = $this->parent->getPath('extension_root') . DS . $uninstallScriptElement; if (!$this->parent->copyFiles(array($path))) { // Install failed, rollback changes $this->parent->abort(JText::_('MijoSEF Extension') . ' ' . JText::_('Install') . ': ' . JText::_('Could not copy PHP uninstall file.')); return false; } } } /** * --------------------------------------------------------------------------------------------- * Database Processing Section * --------------------------------------------------------------------------------------------- */ $db =& JFactory::getDBO(); /* * Let's run the install queries for the component * If backward compatibility is required - run queries in xml file * If Joomla 1.5 compatible, with discreet sql files - execute appropriate * file for utf-8 support or non-utf-8 support */ $result = $this->parent->parseQueries($this->manifest->install->queries); if ($result === false) { // Install failed, rollback changes $this->parent->abort(JText::_('MijoSEF Extension') . ' ' . JText::_('Install') . ': ' . JText::_('SQL Error') . " " . $db->stderr(true)); return false; } elseif ($result === 0) { // no backward compatibility queries found - try for Joomla 1.5 type queries // second argument is the utf compatible version attribute $utfresult = $this->parent->parseSQLFiles($this->manifest->install->sql); if ($utfresult === false) { // Install failed, rollback changes $this->parent->abort(JText::_('MijoSEF Extension') . ' ' . JText::_('Install') . ': ' . JText::_('SQLERRORORFILE') . " " . $db->stderr(true)); return false; } } // Get extension $extension = preg_replace('/.xml$/', '', basename($this->parent->getPath('manifest'))); // Check if extension exists and upgrade is performed $db->setQuery("SELECT name, params FROM #__mijosef_extensions WHERE extension = '{$extension}'"); $existing = $db->loadObject(); $installation = false; // Existing Install if (!is_null($existing)) { if ($existing->name == "") { Mijosef::get('utility')->import('library.parameter'); $old_p = new JRegistry($existing->params); $new_p = new JRegistry(self::_getDefaultParams()); $new_p->set('prefix', $old_p->get('prefix', '')); $new_p->set('skip_menu', $old_p->get('skip_menu', '0')); $params = $new_p->toString(); $db->setQuery("UPDATE #__mijosef_extensions SET name = '{$name}', params = '{$params}' WHERE extension = '{$extension}'"); $db->query(); $installation = true; } } else { JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_mijosef/tables'); $row =& JTable::getInstance('MijosefExtensions', 'Table'); $row->name = $name; $row->extension = $extension; $row->params = self::_getDefaultParams(); $row->store(); $installation = true; } // Remove already created URLs for this extension require_once JPATH_ADMINISTRATOR . '/components/com_mijosef/library/mijosef.php'; $MijosefConfig =& Mijosef::getConfig(); if ($installation && $MijosefConfig->purge_ext_urls == 1) { $db->setQuery("DELETE FROM #__mijosef_urls WHERE (url_real LIKE '%option={$extension}&%' OR url_real LIKE '%option={$extension}') AND params LIKE '%locked=0\nb%'"); $db->query(); } /** * --------------------------------------------------------------------------------------------- * Custom Installation Script Section * --------------------------------------------------------------------------------------------- */ /* * If we have an install script, lets include it, execute the custom * install method, and append the return value from the custom install * method to the installation message. */ if ($this->get('install.script')) { if (is_file($this->parent->getPath('extension_root') . DS . $this->get('install.script'))) { ob_start(); ob_implicit_flush(false); require_once $this->parent->getPath('extension_root') . DS . $this->get('install.script'); if (function_exists('com_install')) { if (com_install() === false) { $this->parent->abort(JText::_('MijoSEF Extension') . ' ' . JText::_('Install') . ': ' . JText::_('Custom install routine failure')); return false; } } $msg = ob_get_contents(); ob_end_clean(); if ($msg != '') { $this->parent->set('extension.message', $msg); } } } /** * --------------------------------------------------------------------------------------------- * Finalization and Cleanup Section * --------------------------------------------------------------------------------------------- */ // Lastly, we will copy the manifest file to its appropriate place. if (!$this->parent->copyManifest(-1)) { // Install failed, rollback changes $this->parent->abort(JText::_('Could not copy setup file')); return false; } return true; }
function getRemoteInfo() { // Get config object if (!isset($this->MijosefConfig)) { $this->MijosefConfig = Mijosef::getConfig(); } static $information; if ($this->MijosefConfig->cache_versions == 1) { $cache = Mijosef::getCache('86400'); $information = $cache->load('versions'); } if (!is_array($information)) { $information = array(); $information['mijosef'] = '?.?.?'; $components = self::getRemoteData('http://www.mijosoft.com/index.php?option=com_mijoextensions&view=xml&format=xml&catid=1'); $extensions = self::getRemoteData('http://www.mijosoft.com/index.php?option=com_mijoextensions&view=xml&format=xml&catid=2'); if (strstr($components, '<?xml version="1.0" encoding="UTF-8" ?>')) { $manifest = JFactory::getXML($components, false); if (is_null($manifest)) { return $information; } $category = $manifest->category; if (!is_a($category, 'JXMLElement') || count($category->children()) == 0) { return $information; } foreach ($category->children() as $component) { $option = $component->getAttribute('option'); $compability = $component->getAttribute('compability'); if ($option == 'com_mijosef' && ($compability == 'all' || $compability == '1.6' || $compability == '1.5_1.6')) { $information['mijosef'] = trim($component->getAttribute('version')); break; } } } if (strstr($extensions, '<?xml version="1.0" encoding="UTF-8" ?>')) { $manifest = JFactory::getXML($extensions, false); if (is_null($manifest)) { return $information; } $category = $manifest->category; if (!is_a($category, 'JXMLElement') || count($category->children()) == 0) { return $information; } foreach ($category->children() as $extension) { $option = $extension->getAttribute('option'); $compability = $extension->getAttribute('compability'); if ($compability == 'all' || $compability == '1.6' || $compability == '1.5_1.6') { $ext = new stdClass(); $ext->version = trim($extension->getAttribute('version')); $ext->link = trim($extension->getAttribute('download')); $ext->description = trim($extension->getAttribute('description')); $information[$option] = $ext; } } } if ($this->MijosefConfig->cache_versions == 1 && !empty($information)) { $cache->save($information, 'versions'); } } return $information; }
protected function showError() { if (Mijosef::getConfig()->show_db_errors == 1 && self::$_dbo->getErrorNum()) { throw new Exception(__METHOD__ . ' failed. (' . self::$_dbo->getErrorMsg() . ')'); } }
function __construct() { // Get config object $this->MijosefConfig = Mijosef::getConfig(); $this->attributes = new stdClass(); }
/** * Helper method to check if MijoSEF is installed * * @return bool */ public static function mijosef() { $class = JPATH_ADMINISTRATOR . '/components/com_mijosef/library/mijosef.php'; if (!is_file($class) || !is_readable($class)) { return false; } jimport('joomla.application.component.helper'); if (JComponentHelper::isEnabled('com_mijosef') == false) { return false; } include_once $class; if (!class_exists('Mijosef')) { return false; } $app = JFactory::getApplication(); $config = JFactory::getConfig(); if ($app->isAdmin()) { return false; } if ($config->get('sef') == false) { return false; } $MijosefConfig = Mijosef::getConfig(); if ($MijosefConfig->mode == 0) { return false; } if (!JPluginHelper::isEnabled('system', 'mijosef')) { return false; } return true; }
function __construct($options = array()) { parent::__construct($options); // Get config object $this->MijosefConfig = Mijosef::getConfig(); }