function getInstalledVersion() { static $version = false; if (!$version) { $version = EasyBlogHelper::getLocalVersion(); } return (string) $version; }
public function loadScript($scripts) { $document = JFactory::getDocument(); $version = str_ireplace('.', '', EasyBlogHelper::getLocalVersion()); foreach ($scripts as $script) { $document->addScript(JURI::root() . $script . '?' . $version); } }
public function __construct() { if (defined('EASYBLOG_COMPONENT_CLI')) { $this->version = EASYBLOG_COMPONENT_VERSION; } else { $this->version = (string) EasyBlogHelper::getLocalVersion(); } $this->resourceManifestFile = EASYBLOG_RESOURCES . '/default-' . $this->version . '.json'; }
/** * @return bool */ public static function checkOldVersionEasyBlog() { if (file_exists(JPATH_ROOT . '/administrator/components/com_easyblog/includes/easyblog.php')) { include_once JPATH_ROOT . '/administrator/components/com_easyblog/includes/easyblog.php'; } if (file_exists(JPATH_ROOT . "/components/com_easyblog/helpers/helper.php") && !class_exists('EasyBlogHelper')) { include_once JPATH_ROOT . "/components/com_easyblog/helpers/helper.php"; } $local = EasyBlogHelper::getLocalVersion(); $version = $local instanceof SimpleXMLElement ? $local->__toString() : $local; return version_compare($version, '5', '<'); }
function __construct($config = array()) { // Include the tables in path JTable::addIncludePath(EBLOG_TABLES); $doc = JFactory::getDocument(); $version = str_ireplace('.', '', EasyBlogHelper::getLocalVersion()); $doc->addStyleSheet(rtrim(JURI::root(), '/') . '/administrator/components/com_easyblog/assets/css/reset.css'); $doc->addStyleSheet(rtrim(JURI::root(), '/') . '/components/com_easyblog/assets/css/common.css'); $doc->addStyleSheet(rtrim(JURI::root(), '/') . '/administrator/components/com_easyblog/assets/css/style.css'); EasyBlogHelper::loadHeaders(); parent::__construct(); }
public function __construct() { $config = EasyBlogHelper::getConfig(); // @legacy: If environment is set to production, change to static. $environment = $config->get('easyblog_environment'); if ($environment == 'production') { $environment = 'static'; } $this->fullName = 'EasyBlog'; $this->shortName = 'eb'; $this->environment = $environment; $this->mode = $config->get('easyblog_mode'); $this->version = (string) EasyBlogHelper::getLocalVersion(); $this->baseUrl = EasyBlogHelper::getBaseUrl(); $this->token = EasyBlogHelper::getToken(); $this->options = array("scriptVersioning" => (bool) $config->get('main_script_versioning'), "responsive" => (bool) $config->get('layout_responsive')); parent::__construct(); }
function getVersion() { $version = EasyBlogHelper::getLatestVersion(); $local = EasyBlogHelper::getLocalVersion(); // Test build only since build will always be incremented regardless of version $localVersion = explode('.', $local); $localBuild = $localVersion[2]; if (!$version) { return JText::_('Unable to contact update servers'); } $remoteVersion = explode('.', $version); $build = $remoteVersion[2]; $html = '<span class="version_outdated">' . JText::sprintf('COM_EASYBLOG_VERSION_OUTDATED', $local, JRoute::_('index.php?option=com_easyblog&view=updater')) . '</span>'; if ($localBuild >= $build) { $html = '<span class="version_latest">' . JText::sprintf('COM_EASYBLOG_VERSION_LATEST', $local) . '</span>'; } $ajax = new Ejax(); if (EasyBlogHelper::getJoomlaVersion() >= '3.0') { $ajax->script('$(\'#versionInfo\').append(\'' . $html . '\');'); } else { $ajax->script('$(\'#submenu-box #submenu\').append(\'<li style="float: right; margin:5px 10px 0 0;">' . $html . '</li>\');'); } $ajax->send(); }
public function extractFiles($folder, $filename) { $ajax = new Ejax(); JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator'); // This is where the patch files are stored. $storage = JPATH_ROOT . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . $folder; // This is where the path file should be extracted into. $filePath = $storage . DIRECTORY_SEPARATOR . $filename; $connector = EasyBlogHelper::getHelper('Connectors'); $localbuild = EasyBlogHelper::getLocalVersion(true); $infoServer = EBLOG_UPDATER_SERVER . 'from/' . $localbuild . '/info'; $connector->addUrl($infoServer); $connector->addQuery('apikey', EasyBlogHelper::getConfig()->get('apikey')); $connector->setMethod('POST'); $connector->execute(); $result = $connector->getResult($infoServer); // @rule: Store info file in the path. JFile::write($storage . DIRECTORY_SEPARATOR . 'info.json', $result); require_once EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'json.php'; $json = new Services_JSON(); $info = $json->decode($result); // @rule: Get the md5 of the zip and test the validity of the zipped contents. if ($info->md5 != md5_file($filePath)) { // @TODO: Download corrupted $ajax->script('$("#result-holder").append("<div>' . JText::_('COM_EASYBLOG_UPDATER_MD5_CHECKSUM_NOT_MATCH') . '</div>");'); return $ajax->send(); } // @rule: Extract the archive if (!JArchive::extract($filePath, $storage)) { $ajax->script('$("#result-holder").append("<div>' . JText::_('COM_EASYBLOG_UPDATER_EXTRACTING_PATCH_FILE_ERROR') . '</div>");'); return $ajax->send(); } // @rule: Delete the archive once the extraction is completed. JFile::delete($filePath); $ajax->script('$("#bar-progress").css("width" , "25%");'); $ajax->script('$("#bar-progress #progress-indicator").html("25%");'); $ajax->script('$("#result-holder").append("<div>' . JText::_('COM_EASYBLOG_UPDATER_EXTRACTING_PATCH_FILE_SUCCESSFULLY') . '</div>");'); $ajax->script('ejax.load("updater", "copyFiles" , "' . $folder . '","' . $filename . '");'); $ajax->send(); }