Example #1
0
 public final function get($key, $default)
 {
     $value = self::$registry->getValue("update.{$key}", $default);
     if ($key == 'updatedata') {
         if (function_exists('json_encode') && function_exists('json_decode')) {
             $value = json_decode($value);
         } elseif (function_exists('base64_encode') && function_exists('base64_decode')) {
             $value = unserialize(base64_decode($value));
         } else {
             $value = unserialize($value);
         }
     }
     return $value;
 }
Example #2
0
 /**
  * Check wheter data exists in the session store
  *
  * @access public
  * @param string 	$name 		Name of variable
  * @param  string 	$namespace 	Namespace to use, default to 'default'
  * @return boolean $result true if the variable exists
  */
 function has($name, $namespace = 'default')
 {
     $namespace = '__' . $namespace;
     //add prefix to namespace to avoid collisions
     if ($this->_state !== 'active') {
         // @TODO :: generated error here
         return null;
     }
     return !is_null($this->data->getValue($namespace . '.' . $name, null));
 }
Example #3
0
 /**
  * Processes the language merge tags ([IFLANG langCode], [/IFLANG]) in some
  * block of text.
  *
  * @param string $text The text to process
  * @param string $lang Which language to keep. Null means the default language.
  */
 public static function processLanguage($text, $lang = null)
 {
     // Get the default language
     if (empty($lang)) {
         $enableTranslation = JFactory::getApplication()->getLanguageFilter();
         if ($enableTranslation) {
             $lang = JFactory::getLanguage()->getTag();
         } else {
             $user = JFactory::getUser();
             if (property_exists($user, 'language')) {
                 $lang = $user->language;
             } else {
                 $params = $user->params;
                 if (!is_object($params)) {
                     JLoader::import('joomla.registry.registry');
                     $params = new JRegistry($params);
                 }
                 if (version_compare(JVERSION, '3.0', 'ge')) {
                     $lang = $params->get('language', '');
                 } else {
                     $lang = $params->getValue('language', '');
                 }
             }
             if (empty($lang)) {
                 $lang = JComponentHelper::getParams('com_languages')->get('site', 'en-GB');
             }
         }
     }
     // Find languages
     $translations = array();
     while (strpos($text, '[IFLANG ') !== false) {
         $start = strpos($text, '[IFLANG ');
         $end = strpos($text, '[/IFLANG]');
         $langEnd = strpos($text, ']', $start);
         $langCode = substr($text, $start + 8, $langEnd - $start - 8);
         $langText = substr($text, $langEnd + 1, $end - $langEnd - 1);
         $translations[$langCode] = $langText;
         if ($start > 0) {
             $temp = substr($text, 0, $start - 1);
         } else {
             $temp = 0;
         }
         $temp .= substr($text, $end + 9);
         $text = $temp;
     }
     if (!empty($text)) {
         if (!array_key_exists('*', $translations)) {
             $translations['*'] = $text;
         }
     }
     $siteLang = JComponentHelper::getParams('com_languages')->get('site', 'en-GB');
     if (array_key_exists($lang, $translations)) {
         return $translations[$lang];
     } elseif (array_key_exists($siteLang, $translations)) {
         return $translations[$siteLang];
     } elseif (array_key_exists('*', $translations)) {
         return $translations['*'];
     } else {
         return $text;
     }
 }
Example #4
0
 /**
  * Save the configuration
  */
 function save()
 {
     global $mainframe;
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     // Set FTP credentials, if given
     jimport('joomla.client.helper');
     JClientHelper::setCredentialsFromRequest('ftp');
     $ftp = JClientHelper::getCredentials('ftp');
     //Save user and media manager settings
     $table =& JTable::getInstance('component');
     $userpost['params'] = JRequest::getVar('userparams', array(), 'post', 'array');
     $userpost['option'] = 'com_users';
     $table->loadByOption('com_users');
     $table->bind($userpost);
     // pre-save checks
     if (!$table->check()) {
         JError::raiseWarning(500, $table->getError());
         return false;
     }
     // save the changes
     if (!$table->store()) {
         JError::raiseWarning(500, $table->getError());
         return false;
     }
     $mediapost['params'] = JRequest::getVar('mediaparams', array(), 'post', 'array');
     $mediapost['option'] = 'com_media';
     //Sanitize $file_path and $image_path
     $file_path = $mediapost['params']['file_path'];
     $image_path = $mediapost['params']['image_path'];
     if (strpos($file_path, '/') === 0 || strpos($file_path, '\\') === 0) {
         //Leading slash.  Kill it and default to /media
         $file_path = 'images';
     }
     if (strpos($image_path, '/') === 0 || strpos($image_path, '\\') === 0) {
         //Leading slash.  Kill it and default to /media
         $image_path = 'images/stories';
     }
     if (strpos($file_path, '..') !== false) {
         //downward directories.  Kill it and default to images/
         $file_path = 'images';
     }
     if (strpos($image_path, '..') !== false) {
         //downward directories  Kill it and default to images/stories
         $image_path = 'images/stories';
     }
     $mediapost['params']['file_path'] = $file_path;
     $mediapost['params']['image_path'] = $image_path;
     $table->loadByOption('com_media');
     $table->bind($mediapost);
     // pre-save checks
     if (!$table->check()) {
         JError::raiseWarning(500, $table->getError());
         return false;
     }
     // save the changes
     if (!$table->store()) {
         JError::raiseWarning(500, $table->getError());
         return false;
     }
     $config = new JRegistry('config');
     $config_array = array();
     // SITE SETTINGS
     $config_array['offline'] = JRequest::getVar('offline', 0, 'post', 'int');
     $config_array['editor'] = JRequest::getVar('editor', 'tinymce', 'post', 'cmd');
     $config_array['list_limit'] = JRequest::getVar('list_limit', 20, 'post', 'int');
     $config_array['helpurl'] = JRequest::getVar('helpurl', 'http://help.joomla.org', 'post', 'string');
     // DEBUG
     $config_array['debug'] = JRequest::getVar('debug', 0, 'post', 'int');
     $config_array['debug_lang'] = JRequest::getVar('debug_lang', 0, 'post', 'int');
     // SEO SETTINGS
     $config_array['sef'] = JRequest::getVar('sef', 0, 'post', 'int');
     $config_array['sef_rewrite'] = JRequest::getVar('sef_rewrite', 0, 'post', 'int');
     $config_array['sef_suffix'] = JRequest::getVar('sef_suffix', 0, 'post', 'int');
     // FEED SETTINGS
     $config_array['feed_limit'] = JRequest::getVar('feed_limit', 10, 'post', 'int');
     $config_array['feed_email'] = JRequest::getVar('feed_email', 'author', 'post', 'word');
     // SERVER SETTINGS
     $config_array['secret'] = JRequest::getVar('secret', 0, 'post', 'string');
     $config_array['gzip'] = JRequest::getVar('gzip', 0, 'post', 'int');
     $config_array['error_reporting'] = JRequest::getVar('error_reporting', -1, 'post', 'int');
     $config_array['xmlrpc_server'] = JRequest::getVar('xmlrpc_server', 0, 'post', 'int');
     $config_array['log_path'] = JRequest::getVar('log_path', JPATH_ROOT . DS . 'logs', 'post', 'string');
     $config_array['tmp_path'] = JRequest::getVar('tmp_path', JPATH_ROOT . DS . 'tmp', 'post', 'string');
     $config_array['live_site'] = rtrim(JRequest::getVar('live_site', '', 'post', 'string'), '/\\');
     $config_array['force_ssl'] = JRequest::getVar('force_ssl', 0, 'post', 'int');
     // LOCALE SETTINGS
     $config_array['offset'] = JRequest::getVar('offset', 0, 'post', 'float');
     // CACHE SETTINGS
     $config_array['caching'] = JRequest::getVar('caching', 0, 'post', 'int');
     $config_array['cachetime'] = JRequest::getVar('cachetime', 900, 'post', 'int');
     $config_array['cache_handler'] = JRequest::getVar('cache_handler', 'file', 'post', 'word');
     $config_array['memcache_settings'] = JRequest::getVar('memcache_settings', array(), 'post');
     // FTP SETTINGS
     $config_array['ftp_enable'] = JRequest::getVar('ftp_enable', 0, 'post', 'int');
     $config_array['ftp_host'] = JRequest::getVar('ftp_host', '', 'post', 'string');
     $config_array['ftp_port'] = JRequest::getVar('ftp_port', '', 'post', 'int');
     $config_array['ftp_user'] = JRequest::getVar('ftp_user', '', 'post', 'string');
     $config_array['ftp_pass'] = JRequest::getVar('ftp_pass', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $config_array['ftp_root'] = JRequest::getVar('ftp_root', '', 'post', 'string');
     // DATABASE SETTINGS
     $config_array['dbtype'] = JRequest::getVar('dbtype', 'mysql', 'post', 'word');
     $config_array['host'] = JRequest::getVar('host', 'localhost', 'post', 'string');
     $config_array['user'] = JRequest::getVar('user', '', 'post', 'string');
     $config_array['db'] = JRequest::getVar('db', '', 'post', 'string');
     $config_array['dbprefix'] = JRequest::getVar('dbprefix', 'jos_', 'post', 'string');
     // MAIL SETTINGS
     $config_array['mailer'] = JRequest::getVar('mailer', 'mail', 'post', 'word');
     $config_array['mailfrom'] = JRequest::getVar('mailfrom', '', 'post', 'string');
     $config_array['fromname'] = JRequest::getVar('fromname', 'Joomla 1.5', 'post', 'string');
     $config_array['sendmail'] = JRequest::getVar('sendmail', '/usr/sbin/sendmail', 'post', 'string');
     $config_array['smtpauth'] = JRequest::getVar('smtpauth', 0, 'post', 'int');
     $config_array['smtpsecure'] = JRequest::getVar('smtpsecure', 'none', 'post', 'word');
     $smtpport = JRequest::getVar('smtpport', '', 'post', 'int');
     $config_array['smtpport'] = $smtpport ? $smtpport : '25';
     $config_array['smtpuser'] = JRequest::getVar('smtpuser', '', 'post', 'string');
     $config_array['smtppass'] = JRequest::getVar('smtppass', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $config_array['smtphost'] = JRequest::getVar('smtphost', '', 'post', 'string');
     // META SETTINGS
     $config_array['MetaAuthor'] = JRequest::getVar('MetaAuthor', 1, 'post', 'int');
     $config_array['MetaTitle'] = JRequest::getVar('MetaTitle', 1, 'post', 'int');
     // SESSION SETTINGS
     $config_array['lifetime'] = JRequest::getVar('lifetime', 0, 'post', 'int');
     $config_array['session_handler'] = JRequest::getVar('session_handler', 'none', 'post', 'word');
     //LANGUAGE SETTINGS
     //$config_array['lang']				= JRequest::getVar('lang', 'none', 'english', 'cmd');
     //$config_array['language']			= JRequest::getVar('language', 'en-GB', 'post', 'cmd');
     $config->loadArray($config_array);
     //override any possible database password change
     $config->setValue('config.password', $mainframe->getCfg('password'));
     // handling of special characters
     $sitename = htmlspecialchars(JRequest::getVar('sitename', '', 'post', 'string'), ENT_COMPAT, 'UTF-8');
     $config->setValue('config.sitename', $sitename);
     $MetaDesc = htmlspecialchars(JRequest::getVar('MetaDesc', '', 'post', 'string'), ENT_COMPAT, 'UTF-8');
     $config->setValue('config.MetaDesc', $MetaDesc);
     $MetaKeys = htmlspecialchars(JRequest::getVar('MetaKeys', '', 'post', 'string'), ENT_COMPAT, 'UTF-8');
     $config->setValue('config.MetaKeys', $MetaKeys);
     // handling of quotes (double and single) and amp characters
     // htmlspecialchars not used to preserve ability to insert other html characters
     $offline_message = JRequest::getVar('offline_message', '', 'post', 'string');
     $offline_message = JFilterOutput::ampReplace($offline_message);
     $offline_message = str_replace('"', '"', $offline_message);
     $offline_message = str_replace("'", ''', $offline_message);
     $config->setValue('config.offline_message', $offline_message);
     //purge the database session table (only if we are changing to a db session store)
     if ($mainframe->getCfg('session_handler') != 'database' && $config->getValue('session_handler') == 'database') {
         $table =& JTable::getInstance('session');
         $table->purge(-1);
     }
     // Get the path of the configuration file
     $fname = JPATH_CONFIGURATION . DS . 'configuration.php';
     // Update the credentials with the new settings
     $oldconfig =& JFactory::getConfig();
     $oldconfig->setValue('config.ftp_enable', $config_array['ftp_enable']);
     $oldconfig->setValue('config.ftp_host', $config_array['ftp_host']);
     $oldconfig->setValue('config.ftp_port', $config_array['ftp_port']);
     $oldconfig->setValue('config.ftp_user', $config_array['ftp_user']);
     $oldconfig->setValue('config.ftp_pass', $config_array['ftp_pass']);
     $oldconfig->setValue('config.ftp_root', $config_array['ftp_root']);
     JClientHelper::getCredentials('ftp', true);
     if (!$config->get('caching') && $oldconfig->get('caching')) {
         $cache = JFactory::getCache();
         $cache->clean();
     }
     // Try to make configuration.php writeable
     jimport('joomla.filesystem.path');
     if (!$ftp['enabled'] && JPath::isOwner($fname) && !JPath::setPermissions($fname, '0644')) {
         JError::raiseNotice('SOME_ERROR_CODE', 'Could not make configuration.php writable');
     }
     // Get the config registry in PHP class format and write it to configuation.php
     jimport('joomla.filesystem.file');
     if (JFile::write($fname, $config->toString('PHP', 'config', array('class' => 'JConfig')))) {
         $msg = JText::_('The Configuration Details have been updated');
     } else {
         $msg = JText::_('ERRORCONFIGFILE');
     }
     // Redirect appropriately
     $task = $this->getTask();
     switch ($task) {
         case 'apply':
             $this->setRedirect('index.php?option=com_config', $msg);
             break;
         case 'save':
         default:
             $this->setRedirect('index.php', $msg);
             break;
     }
     // Try to make configuration.php unwriteable
     //if (!$ftp['enabled'] && JPath::isOwner($fname) && !JPath::setPermissions($fname, '0444')) {
     if ($config_array['ftp_enable'] == 0 && !$ftp['enabled'] && JPath::isOwner($fname) && !JPath::setPermissions($fname, '0444')) {
         JError::raiseNotice('SOME_ERROR_CODE', 'Could not make configuration.php unwritable');
     }
 }
Example #5
0
 public function routeJFRule($router, &$uri)
 {
     jimport('joomla.html.parameter');
     $registry = JFactory::getConfig();
     $multilingual_support = $registry->getValue("config.multilingual_support", false);
     $jfLang = $registry->getValue("joomfish_language", false);
     $jfm = JoomFishManager::getInstance();
     $langs = $jfm->getLanguagesIndexedById();
     if ($multilingual_support && $jfLang) {
         if ($uri->getVar("lang", "") == "") {
             $uri->setVar("lang", $jfLang->shortcode != '' ? $jfLang->shortcode : $jfLang->iso);
         }
         // this is dependent on Joomfish router being first!!
         $lang = $uri->getVar("lang", "");
         // This may not ready at this stage
         $params = $registry->getValue("jfrouter.params");
         // so load plugin parameters directly
         if (is_null($params)) {
             $params = JPluginHelper::getPlugin("system", "jfrouter");
             $params = new JRegistry($params->params);
         }
         $sefordomain = $params->get("sefordomain", "sefprefix");
         if ($sefordomain == "domain") {
             // If I set config_live_site I actually don't need this function at all let alone this logic ?  Apart from language switcher.
             // TODO cache the indexed array
             $rawsubdomains = $params->getValue("sefsubdomain", array());
             $subdomains = array();
             foreach ($rawsubdomains as $domain) {
                 list($langid, $domain) = explode("::", $domain, 2);
                 $domain = strtolower(str_replace("http://", "", $domain));
                 $domain = str_replace("https://", "", $domain);
                 $domain = preg_replace("#/\$#", "", $domain);
                 //$domain = str_replace("/","",$domain);
                 $subdomains[$langs[$langid]->shortcode] = $domain;
             }
             if (array_key_exists($lang, $subdomains)) {
                 $uri->setHost($subdomains[$lang]);
                 $uri->delVar("lang");
                 $registry->setValue("joomfish.sef_host", $subdomains[$lang]);
                 plgSystemJFRouter::procesCustomBuildRule($router, $uri);
                 return;
             }
         } else {
             // Get the path data
             $route = $uri->getPath();
             //Add the suffix to the uri
             if ($router->getMode() == JROUTER_MODE_SEF && $route && !$lang !== "") {
                 $jfLang = $jfm->getLanguageByShortcode($lang);
                 if (!$jfLang) {
                     return;
                 }
                 $sefprefixes = $params->getValue("sefprefixes", array());
                 // Workaround if some language prefixes are missing
                 if (!is_array($sefprefixes)) {
                     $sefprefixes = array();
                 }
                 if (count($sefprefixes) < count($langs)) {
                     foreach ($sefprefixes as $prefix) {
                         list($langid, $prefix) = explode("::", $prefix, 2);
                         if (array_key_exists($langid, $langs)) {
                             $langs[$langid]->hasprefix = true;
                         }
                     }
                     foreach ($langs as $lang) {
                         if (!isset($lang->hasprefix)) {
                             $sefprefixes[] = $lang->lang_id . "::" . $lang->sef;
                         }
                     }
                 }
                 foreach ($sefprefixes as $prefix) {
                     list($langid, $prefix) = explode("::", $prefix, 2);
                     if ($jfLang->lang_id == $langid) {
                         $uri->setPath($uri->getPath() . "/" . $prefix);
                         $uri->delVar("lang");
                         plgSystemJFRouter::procesCustomBuildRule($router, $uri);
                         return;
                     }
                 }
             }
         }
     }
     return;
 }
Example #6
0
 /**
  * @return string the database hostname for the platform
  */
 public function getHost()
 {
     return $this->config->getValue('config.host');
 }
 public function migratePostContentType()
 {
     jimport('joomla.registry.registry');
     $db = self::getDbo();
     $query = 'SELECT ' . $db->nameQuote('params') . ' FROM ' . $db->nameQuote('#__discuss_configs');
     $query .= ' WHERE ' . $db->nameQuote('name') . '=' . $db->Quote('config');
     $db->setQuery($query);
     $rawParams = $db->loadResult();
     if (empty($rawParams)) {
         return true;
     }
     $config = new JRegistry();
     $editorType = '';
     if ($this->getJoomlaVersion() >= '1.6') {
         $config->loadString($rawParams, 'INI');
         $editorType = $config->get('layout_editor', '');
     } else {
         $config->loadINI($rawParams);
         $editorType = $config->getValue('layout_editor', '');
     }
     if ($editorType == 'bbcode') {
         $query = 'update `#__discuss_posts` set `content_type` = ' . $db->Quote('bbcode');
         $query .= ' where `content_type` is null';
         $db->setQuery($query);
         $db->query();
     } else {
         // replies
         $query = 'update `#__discuss_posts` set `content_type` = ' . $db->Quote('bbcode');
         $query .= ' where `content_type` is null';
         $query .= ' and `parent_id` > 0';
         $db->setQuery($query);
         $db->query();
         // question
         $query = 'update `#__discuss_posts` set `content_type` = ' . $db->Quote('html');
         $query .= ' where `content_type` is null';
         $query .= ' and `parent_id` = 0';
         $db->setQuery($query);
         $db->query();
     }
 }
Example #8
0
 public function save()
 {
     // CSRF prevention
     $this->_csrfProtection();
     $enableAutoupdate = $this->input->getBool('autoupdate', 0);
     $enableAutojupdate = $this->input->getBool('autojupdate', 0);
     $acceptlicense = $this->input->getBool('acceptlicense', 0);
     $acceptsupport = $this->input->getBool('acceptsupport', 0);
     $db = JFactory::getDBO();
     if ($enableAutoupdate || $enableAutojupdate) {
         $query = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('enabled') . ' = ' . $db->q('1'))->where($db->qn('element') . ' = ' . $db->q('oneclickaction'))->where($db->qn('folder') . ' = ' . $db->q('system'));
         $db->setQuery($query);
         $db->execute();
     } else {
         $query = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('enabled') . ' = ' . $db->q('0'))->where($db->qn('element') . ' = ' . $db->q('oneclickaction'))->where($db->qn('folder') . ' = ' . $db->q('system'));
         $db->setQuery($query);
         $db->execute();
     }
     $query = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('enabled') . ' = ' . $db->q('0'))->where($db->qn('element') . ' = ' . $db->q('atoolsupdatecheck'))->where($db->qn('folder') . ' = ' . $db->q('system'));
     $db->setQuery($query);
     $db->execute();
     if ($enableAutojupdate) {
         $query = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('enabled') . ' = ' . $db->q('1'))->where($db->qn('element') . ' = ' . $db->q('atoolsjupdatecheck'))->where($db->qn('folder') . ' = ' . $db->q('system'));
         $db->setQuery($query);
         $db->execute();
     } else {
         $query = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('enabled') . ' = ' . $db->q('0'))->where($db->qn('element') . ' = ' . $db->q('atoolsjupdatecheck'))->where($db->qn('folder') . ' = ' . $db->q('system'));
         $db->setQuery($query);
         $db->execute();
     }
     // Load the component parameters. DO NOT USE JCOMPONENTHELPER!
     $query = $db->getQuery(true)->select(array($db->qn('params')))->from($db->qn('#__extensions'))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('element') . ' = ' . $db->q('com_admintools'));
     $db->setQuery($query);
     $rawparams = $db->loadResult();
     $params = new JRegistry();
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $params->loadString($rawparams, 'JSON');
     } else {
         $params->loadJSON($rawparams);
     }
     // Apply htmaker folders fix.
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $has240Fix = $params->get('htmaker_folders_fix_at240', '0');
     } else {
         $has240Fix = $params->getValue('htmaker_folders_fix_at240', '0');
     }
     if (!$has240Fix) {
         $htmaker = $this->getModel('htmaker');
         $config = $htmaker->loadConfiguration();
         $isConfigChanged = false;
         $jUpdateRestore = 'administrator/components/com_joomlaupdate/restore.php';
         if (!in_array($jUpdateRestore, $config->exceptionfiles)) {
             array_push($config->exceptionfiles, $jUpdateRestore);
             $isConfigChanged = true;
         }
         $fontDir = 'media/jui/fonts';
         if (!in_array($fontDir, $config->fepexdirs)) {
             array_push($config->fepexdirs, $fontDir);
             $isConfigChanged = true;
         }
         if ($isConfigChanged) {
             $htmaker->saveConfiguration($config, true);
         }
         if (version_compare(JVERSION, '3.0', 'ge')) {
             $params->set('htmaker_folders_fix_at240', '1');
         } else {
             $params->setValue('htmaker_folders_fix_at240', '1');
         }
     }
     // Update last version check.
     if ($acceptlicense && $acceptsupport) {
         $version = ADMINTOOLS_VERSION;
     } else {
         $version = '0.0.0';
     }
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $params->set('lastversion', $version);
         $params->set('acceptlicense', $acceptlicense);
         $params->set('acceptsupport', $acceptsupport);
     } else {
         $params->setValue('lastversion', $version);
         $params->setValue('acceptlicense', $acceptlicense);
         $params->setValue('acceptsupport', $acceptsupport);
     }
     // Joomla! 1.6
     $data = $params->toString('JSON');
     $sql = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('params') . ' = ' . $db->q($data))->where($db->qn('element') . ' = ' . $db->q('com_admintools'))->where($db->qn('type') . ' = ' . $db->q('component'));
     $db->setQuery($sql);
     $db->execute();
     // Even better, create the "admintools.lastversion.php" file with this information
     $fileData = "<" . "?php\ndefined('_JEXEC') or die;\ndefine('ADMINTOOLS_LASTVERSIONCHECK','" . $version . "');";
     JLoader::import('joomla.filesystem.file');
     $fileName = JPATH_COMPONENT_ADMINISTRATOR . '/admintools.lastversion.php';
     JFile::write($fileName, $fileData);
     $url = 'index.php?option=com_admintools&view=cpanel';
     // Reset the Joomla! plugins cache
     F0FUtilsCacheCleaner::clearPluginsCache();
     if (!$acceptlicense) {
         JFactory::getApplication()->enqueueMessage(JText::_('COM_ADMINTOOLS_POSTSETUP_ERR_ACCEPTLICENSE'), 'error');
         $url = 'index.php?option=com_admintools&view=postsetup';
     }
     if (!$acceptsupport) {
         JFactory::getApplication()->enqueueMessage(JText::_('COM_ADMINTOOLS_POSTSETUP_ERR_ACCEPTSUPPORT'), 'error');
         $url = 'index.php?option=com_admintools&view=postsetup';
     }
     JFactory::getApplication()->redirect($url);
 }
Example #9
0
 /**
  * Get version information
  * @return $html
  **/
 function getVersionInfo($getData = false)
 {
     global $option;
     $url = 'http://dev.jyaml.de/JYAML.GET/version.ini';
     $read_online = false;
     $info['c-j-version'] = '?';
     $info['c-j-build'] = '?';
     $jc_version = '';
     $j_version = '';
     $html = '';
     $data = false;
     $allow_url_fopen = ini_get('allow_url_fopen');
     if (!@fsockopen('dev.jyaml.de', 80) || !$allow_url_fopen) {
         $read_online = false;
         $html .= '<div class="off">' . JText::_('YAML VERSION NOT AVAILABLE') . '</div> ';
         if (!$allow_url_fopen) {
             $html .= '<div class="off">' . JText::_('YAML OPEN EXTERNAL URL NOT ALLOWED') . '</div> ';
         }
         $html .= '<br />';
     } else {
         $data = JFile::read($url);
         $read_online = true;
     }
     if ($data) {
         $registry = new JRegistry($option);
         $registry->loadINI($data);
         // get current version info
         $info['c-j-version'] = $registry->getValue($option . '.YAML JOOMLA VERSION');
         $info['c-j-build'] = $registry->getValue($option . '.YAML JOOMLA BUILD');
     }
     // Installed component version
     $xml =& JFactory::getXMLParser('Simple');
     if (!$xml->loadFile(JPATH_BASE . DS . 'components' . DS . $option . DS . substr($option, 4) . '.xml')) {
         unset($xml);
     } else {
         $element =& $xml->document->version[0];
         $info['i-j-version'] = $element ? $element->data() : '';
         $element =& $xml->document->build[0];
         $info['i-j-build'] = $element ? $element->data() : '';
     }
     $update = false;
     if ($info['c-j-version'] . $info['c-j-build'] > $info['i-j-version'] . $info['i-j-build']) {
         $j_version = '<span class="off" style="font-weight:normal;">' . $info['i-j-version'] . '(Build: ' . $info['i-j-build'] . ')</span>';
         $jc_version = '<span class="on" style="font-weight:bold;">' . $info['c-j-version'] . '(Build: ' . $info['c-j-build'] . ')</span>';
         $update = true;
     } else {
         $j_version = '<span>' . $info['i-j-version'] . '(Build: ' . $info['i-j-build'] . ')</span>';
         $jc_version = '<span>' . $info['c-j-version'] . '(Build: ' . $info['c-j-build'] . ')</span>';
     }
     if ($info['i-j-version']) {
         $html .= JText::_('YAML JOOMLA VERSION INSTALLED') . ': ' . $j_version . '<br />';
     } else {
         $html .= JText::_('YAML JOOMLA VERSION INSTALLED') . ': (SVN Version)<br />';
     }
     $html .= JText::_('YAML JOOMLA VERSION CURRENT') . ': ' . $jc_version . '<br /><br />';
     if ($update && $info['i-j-version']) {
         $bar =& new JToolBar('My ToolBar');
         $button =& $bar->loadButtonType('Custom');
         $url = 'index3.php?option=' . $option . '&amp;controller=update&amp;task=make_update';
         $link = "<a class=\"modal\" href=\"{$url}\" rel=\"{closeWithOverlay:false, handler: 'iframe', size: {x: 640, y: 480}}\">\n";
         $link .= JText::_('YAML UPDATE BUTTON');
         $link .= "</a>\n";
         $html .= '<p id="make_update">' . $button->fetchButton('Custom', $link, 'editfile') . '</p>';
     }
     if ($getData) {
         return $info;
     } else {
         return $html;
     }
 }