コード例 #1
0
    public static function footer($products = array(), $echo = true)
    {
        JHTML::_('behavior.tooltip');
        // Get extension manifest cache
        $info = JSNUtilsXml::loadManifestCache('', 'component');
        // Initialize variables
        $name = $info->name;
        $edition = JSNUtilsText::getConstant('EDITION');
        $version = JSNUtilsText::getConstant('VERSION');
        // Initialize links
        $links['info'] = JSNUtilsText::getConstant('INFO_LINK');
        $links['doc'] = JSNUtilsText::getConstant('DOC_LINK');
        $links['review'] = JSNUtilsText::getConstant('REVIEW_LINK');
        $links['update'] = JSNUtilsText::getConstant('UPDATE_LINK');
        $links['upgrade'] = JSNUtilsText::getConstant('UPGRADE_LINK');
        // Generate markup
        $html[] = '
			<div id="jsn-footer" class="jsn-page-footer jsn-bootstrap">
			<div class="pull-left">
			<ul class="jsn-footer-menu">' . '<a class="btn btn-primary" style="margin-left: 10px;" href="https://www.joomlashine.com/jsn-easyslider-beta.html" target="_blank">Submit your feedback about JSN EasySlider</a>' . '</ul>
			<ul class="jsn-footer-menu">
				<li class="first">';
        if (!empty($links['info'])) {
            $html[] = '
					<a href="' . JRoute::_($links['info']) . '" target="_blank">JSN ' . preg_replace('/JSN\\s*/i', '', JText::_($name)) . ' ' . $edition . ' v' . $version . '</a>';
        } else {
            $html[] = 'JSN ' . preg_replace('/JSN\\s*/i', '', JText::_($name)) . ' ' . $edition . ' v' . $version;
        }
        $html[] = ' by <a href="http://www.joomlashine.com" target="_blank">JoomlaShine.com</a>';
        if (!empty($edition) and !empty($links['upgrade']) and ($pos = strpos('free + pro standard', strtolower($edition))) !== false) {
            $html[] = '
					&nbsp;<a class="label label-important" href="' . JRoute::_($links['upgrade']) . '"><strong class="jsn-text-attention">' . JText::_($pos ? 'JSN_EXTFW_GENERAL_UPGRADE_TO_PRO_UNLIMITED' : 'JSN_EXTFW_GENERAL_UPGRADE_TO_PRO') . '</strong></a>';
        }
        $html[] = '
				</li>';
        try {
            $hasUpdate = false;
            foreach (JSNUpdateHelper::check($products) as $result) {
                if ($result) {
                    $hasUpdate = true;
                    break;
                }
            }
            if ($hasUpdate) {
                $html[] = '
				<li id="jsn-global-check-version-result" class="jsn-outdated-version">
					<span class="jsn-global-outdated-version">' . JText::_('JSN_EXTFW_GENERAL_UPDATE_AVAILABLE') . '</span>
					&nbsp;<a href="' . JRoute::_($links['update']) . '" class="label label-important">' . JText::_('JSN_EXTFW_GENERAL_UPDATE_NOW') . '</a>
				</li>';
            }
        } catch (Exception $e) {
            // Simply ignore
        }
        $html[] = '
			</ul>
			</div>
			<div class="pull-right">
			<ul class="jsn-footer-menu">
				<li class="jsn-iconbar first">
					<span class="hasTip" title="' . JText::_('JSN_EXTFW_GENERAL_POWERADMIN') . '"><a target="_blank" href="http://www.joomlashine.com/joomla-extensions/jsn-poweradmin.html">
						<i class="jsn-icon32 jsn-icon-products jsn-icon-poweradmin"></i>
					</a></span>
					<span class="hasTip" title="' . JText::_('JSN_EXTFW_GENERAL_IMAGESHOW') . '"><a target="_blank" href="http://www.joomlashine.com/joomla-extensions/jsn-imageshow.html">
						<i class="jsn-icon32 jsn-icon-products jsn-icon-imageshow"></i>
					</a></span>
					<span class="hasTip" title="' . JText::_('JSN_EXTFW_GENERAL_UNIFORM') . '"><a target="_blank" href="http://www.joomlashine.com/joomla-extensions/jsn-uniform.html">
						<i class="jsn-icon32 jsn-icon-products jsn-icon-uniform"></i>
					</a></span>
					<span class="hasTip" title="' . JText::_('JSN_EXTFW_GENERAL_MOBILIZE') . '"><a target="_blank" href="http://www.joomlashine.com/joomla-extensions/jsn-mobilize.html">
						<i class="jsn-icon32 jsn-icon-products jsn-icon-mobilize"></i>
					</a></span>
					<span class="hasTip" title="' . JText::_('JSN_EXTFW_GENERAL_PAGEBUILDER') . '"><a target="_blank" href="http://www.joomlashine.com/joomla-extensions/jsn-pagebuilder.html">
						<i class="jsn-icon32 jsn-icon-products jsn-icon-pagebuilder"></i>
					</a></span>
				</li>
			</ul>
			</div>
			<div class="clearbreak"></div>
			</div>
			';
        if ($echo) {
            echo implode($html);
        } else {
            return implode($html);
        }
    }
コード例 #2
0
ファイル: helper.php プロジェクト: jdrzaic/joomla-dummy
 /**
  * Communicate with JoomlaShine server for latest product version.
  *
  * If a product does not have sub-product, the <b>$products</b> parameter
  * does not required when calling this method:
  *
  * <pre>JSNUpdateHelper::check();</pre>
  *
  * Result will be returned in the following format:
  *
  * <pre>If product update is available:
  * <code>array(
  *     'identified_name' => object(
  *         'name' => 'The product name',
  *         'identified_name' => 'The product identification',
  *         'description' => 'The product description',
  *         'version' => 'The latest product version',
  *         'authentication' => 'Indicates whether authentication is required when updating product'
  *     )
  * )</code>
  * If the product does not have update:
  * <code>array(
  *     'identified_name' => false
  * )</code></pre>
  *
  * If a product has sub-product, this method need to be called as below to
  * check all sub-product for latest version:
  *
  * <pre>JSNUpdateHelper::check(
  *     array(
  *         // Core component
  *         'imageshow' => '4.2.0',
  *
  *         // Themes
  *         'themeclassic' => '1.1.5',
  *         'themeslider'  => '1.0.4',
  *         'themegrid'    => '1.0.0',
  *
  *         // Sources
  *         'picasa'      => '1.1.2',
  *         'flickr'      => '1.1.2',
  *         'phoca'       => '1.0.1',
  *         'joomgallery' => '1.0.1',
  *         'rsgallery2'  => '1.0.1',
  *         'facebook'    => '1.0.1'
  *     )
  * );</pre>
  *
  * In this case, the returned result might look like below:
  *
  * <pre>array(
  *     // Core component
  *     'imageshow' => object(
  *         'name' => 'JSN ImageShow',
  *         'identified_name' => 'imageshow',
  *         'description' => 'Something about JSN ImageShow',
  *         'version' => '4.3.0',
  *         'editions' => array(
  *             0 => object(
  *                 'edition' => 'PRO STANDARD',
  *                 'authentication' => 1
  *             ),
  *             1 => object(
  *                 'edition' => 'PRO UNLIMITED',
  *                 'authentication' => 1
  *             ),
  *             2 => object(
  *                 'edition' => 'FREE',
  *                 'authentication' => 0
  *             )
  *         )
  *     ),
  *
  *     // Themes
  *     'themeclassic' => false, // Product update not available
  *     'themeslider' => false,  // Product update not available
  *     'themegrid' => object(
  *         'name' => 'Theme Grid',
  *         'identified_name' => 'themegrid',
  *         'description' => 'JSN ImageShow Theme Grid plugin',
  *         'version' => '1.0.1',
  *         'edition' => 'FREE',
  *         'authentication' => 0
  *     ),
  *
  *     // Sources
  *     'picasa' => false,      // Product update not available
  *     'flickr' => false,      // Product update not available
  *     'phoca' => false,       // Product update not available
  *     'joomgallery' => false, // Product update not available
  *     'rsgallery2' => false,  // Product update not available
  *     'facebook' => object(
  *         'name' => 'FaceBook',
  *         'identified_name' => 'facebook',
  *         'description' => 'JSN ImageShow Image Source Facebook plugin',
  *         'version' => '1.0.2',
  *         'edition' => 'FREE',
  *         'authentication' => 0
  *     )
  * )</pre>
  *
  * @param   array   $products               Array of identified name for checking latest version.
  * @param   string  $requiredJoomlaVersion  Joomla version required by extension, e.g. 2.5, 3.0, etc.
  * @param   array   $latestUpdates          Latest update response (for use in self recursive call only).
  * @param   array   $results                Check update results (for use in self recursive call only).
  *
  * @return  mixed
  */
 public static function check($products = array(), $requiredJoomlaVersion = JSN_FRAMEWORK_REQUIRED_JOOMLA_VER, $latestUpdates = '', $results = '')
 {
     // Only communicate with server if check update URLs is not load before
     if (empty($latestUpdates)) {
         if (!isset(self::$versions)) {
             try {
                 // Get Joomla config and input object
                 $config = JFactory::getConfig();
                 $input = JFactory::getApplication()->input;
                 // Generate cache file path
                 $cache = $config->get('tmp_path') . '/JoomlaShineUpdates.json';
                 // Get current option and view
                 $option = $input->getCmd('option');
                 $view = $input->getCmd('view');
                 // Get latest version from local file if not in about page or cache is not timed out
                 if ((!in_array($option, JSNVersion::$products) or $view != 'about') and is_readable($cache) and time() - filemtime($cache) < CHECK_UPDATE_PERIOD) {
                     // Decode JSON encoded update details
                     self::$versions = json_decode(JFile::read($cache));
                 } else {
                     // Always update cache file modification time
                     is_writable($cache) and touch($cache, time());
                     // Communicate with JoomlaShine server via latest version checking URL
                     try {
                         self::$versions = JSNUtilsHttp::get(JSN_EXT_VERSION_CHECK_URL);
                         self::$versions = isset(self::$versions['body']) ? self::$versions['body'] : '{"items":[]}';
                         // Cache latest version to local file system
                         JFile::write($cache, self::$versions);
                         // Decode JSON encoded update details
                         self::$versions = json_decode(self::$versions);
                     } catch (Exception $e) {
                         throw $e;
                     }
                 }
             } catch (Exception $e) {
                 throw new Exception(JText::_('JSN_EXTFW_VERSION_CHECK_FAIL'));
             }
         }
         $latestUpdates = self::$versions;
     }
     // Prepare product identification
     if (!is_array($products) or !count($products)) {
         is_array($products) or $products = array();
         // Get the product info
         $version = JSNUtilsText::getConstant('VERSION');
         // Is identified name defined?
         if ($const = JSNUtilsText::getConstant('IDENTIFIED_NAME')) {
             $products[$const] = $version;
         } else {
             $component = substr(JFactory::getApplication()->input->getCmd('option'), 4);
             $products[$component] = $version;
             $products['ext_' . $component] = $version;
         }
     }
     // Get Joomla version
     $joomlaVersion = new JVersion();
     // Preset return results
     is_array($results) or $results = array();
     // Get the latest product version
     foreach ($products as $product => $current) {
         if (!isset($results[$product])) {
             foreach ($latestUpdates->items as $item) {
                 if (isset($item->items)) {
                     $results = self::check(array($product => $current), $requiredJoomlaVersion, $item, $results);
                     continue;
                 }
                 if (isset($item->identified_name) and $item->identified_name == $product) {
                     $results[$product] = $item;
                     break;
                 }
             }
             // Does latest product info found?
             if (isset($results[$product]) and is_object($results[$product])) {
                 // Does product support installed Joomla version?
                 $tags = explode(';', $results[$product]->tags);
                 if (!in_array($joomlaVersion->RELEASE, $tags)) {
                     $results[$product] = false;
                 }
                 // Does product upgradable?
                 if ($results[$product] and !empty($requiredJoomlaVersion) and !JSNVersion::isJoomlaCompatible($requiredJoomlaVersion) and !version_compare($results[$product]->version, $current, '>=')) {
                     $results[$product] = false;
                 }
                 // Does product have newer version?
                 if ($results[$product] and (empty($requiredJoomlaVersion) or JSNVersion::isJoomlaCompatible($requiredJoomlaVersion)) and !version_compare($results[$product]->version, $current, '>')) {
                     $results[$product] = false;
                 }
             }
         }
     }
     return $results;
 }
コード例 #3
0
ファイル: default.php プロジェクト: densem-2013/exikom
<?php

/**
 * @version     $Id: default.php 19014 2012-11-28 04:48:56Z thailv $
 * @package     JSNUniform
 * @subpackage  Update
 * @author      JoomlaShine Team <*****@*****.**>
 * @copyright   Copyright (C) 2015 JoomlaShine.com. All Rights Reserved.
 * @license     GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
 *
 * Websites: http://www.joomlashine.com
 * Technical Support:  Feedback - http://www.joomlashine.com/contact-us/get-support.html
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// Display messages
if (JFactory::getApplication()->input->getInt('ajax') != 1) {
    echo $this->msgs;
}
// Display config form
JSNUpdateHelper::render($this->product);
コード例 #4
0
ファイル: default.php プロジェクト: jdrzaic/joomla-dummy
?>
</p>
			<div class="alert alert-info">
				<p><span class="label label-info"><?php 
echo JText::_('JSN_EXTFW_GENERAL_IMPORTANT_NOTE');
?>
</span></p>
				<ul><li><?php 
echo JText::sprintf('JSN_EXTFW_GENERAL_DATA_REMAIN', $name, 'update');
?>
</li></ul>
			</div>
<?php 
$hasUpdate = false;
$authentication = false;
foreach (JSNUpdateHelper::check($products) as $result) {
    if ($result) {
        $hasUpdate or $hasUpdate = true;
        // Is authentication required?
        if (isset($result->authentication) and $result->authentication) {
            $authentication = true;
        } elseif (isset($result->editions)) {
            foreach ($result->editions as $item) {
                if (strcasecmp($item->edition, $edition) == 0 and $item->authentication) {
                    $authentication = true;
                }
            }
        }
        // Build query string for updating product
        $query = 'id=' . $result->identified_name . '&edition=' . str_replace(' ', '+', trim(isset($result->edition) ? $result->edition : $edition));
        // Generate HTML code
コード例 #5
0
ファイル: dependency.php プロジェクト: densem-2013/exikom
            $checkUpdate = true;
        }
    }
    // Load installer model for checking dependency
    require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/installer.php';
    $model = new JSNMobilizeModelInstaller();
    if (($result = $model->check($check, $checkUpdate)) !== -1) {
        $missingDependency = true;
    }
    if ($missingDependency) {
        // Redirect to dependency installer view
        $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=installer');
    }
    // Check compatibility between component and installed Joomla version
    if (!JSNVersion::isJoomlaCompatible(JSN_MOBILIZE_REQUIRED_JOOMLA_VER)) {
        try {
            $result = JSNUpdateHelper::check(JSN_MOBILIZE_IDENTIFIED_NAME, JSN_MOBILIZE_REQUIRED_JOOMLA_VER);
            if ($result[JSN_MOBILIZE_IDENTIFIED_NAME]) {
                $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update');
            } else {
                $app->enqueueMessage(JText::_('JSN_MOBILIZE_NOT_COMPATIBLE_MSG'));
            }
        } catch (Exception $e) {
            $app->enqueueMessage(JText::_('JSN_MOBILIZE_NOT_COMPATIBLE_MSG'));
        }
    }
    // Check compatibility between component and the installed version of JoomlaShine extension framework
    if (!JSNVersion::checkCompatibility(JSN_MOBILIZE_IDENTIFIED_NAME, JSN_MOBILIZE_VERSION)) {
        $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update');
    }
}
コード例 #6
0
<?php

/**
 * @author    JoomlaShine.com
 * @copyright JoomlaShine.com
 * @link      http://joomlashine.com/
 * @package   JSN Poweradmin
 * @version   $Id: default.php 16038 2012-09-14 05:10:06Z hiepnv $
 * @license   GNU/GPL v2 http://www.gnu.org/licenses/gpl-2.0.html
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$products = JSNPaExtensionsHelper::getDependentExtensions();
// Display config form
JSNUpdateHelper::render($this->product, $products, $this->redirAfterFinish);
コード例 #7
0
ファイル: dependency.php プロジェクト: NallelyFlores89/basvec
        // Checking for dependency is necessary
        $checkUpdate = true;
    }
    // Load installer model for checking dependency
    require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/installer.php';
    $model = new JSNUniformModelInstaller();
    if (($result = $model->check($check, $checkUpdate)) !== -1) {
        $missingDependency = true;
    }
    if ($missingDependency) {
        // Redirect to dependency installer view
        $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=installer');
    }
    // Check compatibility between component and installed Joomla version
    if (!JSNVersion::isJoomlaCompatible(JSN_UNIFORM_REQUIRED_JOOMLA_VER)) {
        try {
            $result = JSNUpdateHelper::check(JSN_UNIFORM_IDENTIFIED_NAME, JSN_UNIFORM_REQUIRED_JOOMLA_VER);
            if ($result[JSN_UNIFORM_IDENTIFIED_NAME]) {
                $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update');
            } else {
                $app->enqueueMessage(JText::_('JSN_UNIFORM_NOT_COMPATIBLE_MSG'), 'error');
            }
        } catch (Exception $e) {
            $app->enqueueMessage(JText::_('JSN_UNIFORM_NOT_COMPATIBLE_MSG'), 'error');
        }
    }
    // Check compatibility between component and the installed version of JoomlaShine extension framework
    if (!JSNVersion::checkCompatibility(JSN_UNIFORM_IDENTIFIED_NAME, JSN_UNIFORM_VERSION)) {
        $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update');
    }
}
コード例 #8
0
ファイル: dependency.php プロジェクト: jdrzaic/joomla-dummy
        }
    }
    /******************************* JSN IMAGESHOW ***************************************/
    // Load installer model for checking dependency
    require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/installer.php';
    $model = new ImageShowModelInstaller();
    if (($result = $model->check($check, $checkUpdate)) !== -1) {
        $missingDependency = true;
    }
    if ($missingDependency) {
        // Redirect to dependency installer view
        $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=installer');
    }
    // Check compatibility between component and installed Joomla version
    if (!JSNVersion::isJoomlaCompatible('3.')) {
        try {
            $result = JSNUpdateHelper::check(JSN_IMAGESHOW_IDENTIFIED_NAME, '3.0');
            if ($result[JSN_IMAGESHOW_IDENTIFIED_NAME]) {
                $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update');
            } else {
                $app->enqueueMessage(JText::_('JSN_IMAGESHOW_NOT_COMPATIBLE_MSG'));
            }
        } catch (Exception $e) {
            $app->enqueueMessage(JText::_('JSN_IMAGESHOW_NOT_COMPATIBLE_MSG'));
        }
    }
    // Check compatibility between component and the installed version of JoomlaShine extension framework
    if (!JSNVersion::checkCompatibility(JSN_IMAGESHOW_IDENTIFIED_NAME, JSN_IMAGESHOW_VERSION)) {
        $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update');
    }
}
コード例 #9
0
ファイル: generate.php プロジェクト: NallelyFlores89/basvec
    /**
     * Generate HTML markup for footer.
     *
     * If a product has sub-product, this method need to be called as below to
     * check all sub-product for latest version:
     *
     * <pre>JSNHtmlGenerate::footer(
     *     array(
     *         // Core component
     *         'imageshow' => '4.2.0',
     *
     *         // Themes
     *         'themeclassic' => '1.1.5',
     *         'themeslider'  => '1.0.4',
     *         'themegrid'    => '1.0.0',
     *
     *         // Sources
     *         'picasa'      => '1.1.2',
     *         'flickr'      => '1.1.2',
     *         'phoca'       => '1.0.1',
     *         'joomgallery' => '1.0.1',
     *         'rsgallery2'  => '1.0.1',
     *         'facebook'    => '1.0.1'
     *     )
     * );</pre>
     *
     * If a product does not have sub-product, the <b>$products</b> parameter
     * does not required when calling this method:
     *
     * <pre>JSNHtmlGenerate::footer();</pre>
     *
     * @param   array    $products  Array of product identified name.
     * @param   boolean  $echo      Whether to echo the output or not?
     *
     * @return  string
     */
    public static function footer($products = array(), $echo = true)
    {
        // Get extension manifest cache
        $info = JSNUtilsXml::loadManifestCache();
        // Initialize variables
        $name = $info->name;
        $edition = JSNUtilsText::getConstant('EDITION');
        $version = JSNUtilsText::getConstant('VERSION');
        // Initialize links
        $links['info'] = JSNUtilsText::getConstant('INFO_LINK');
        $links['doc'] = JSNUtilsText::getConstant('DOC_LINK');
        $links['review'] = JSNUtilsText::getConstant('REVIEW_LINK');
        $links['update'] = JSNUtilsText::getConstant('UPDATE_LINK');
        $links['upgrade'] = JSNUtilsText::getConstant('UPGRADE_LINK');
        // Generate markup
        $html[] = '
<div id="jsn-footer" class="jsn-page-footer jsn-bootstrap">
<div class="pull-left">
<ul class="jsn-footer-menu">
	<li class="first">';
        if (!empty($links['doc'])) {
            $html[] = '
		<a href="' . JRoute::_($links['doc']) . '" target="_blank">' . JText::_('JSN_EXTFW_GENERAL_DOCUMENTATION') . '</a>
	</li>
	<li>';
        }
        $html[] = '
		<a href="http://www.joomlashine.com/contact-us/get-support.html" target="_blank">' . JText::_('JSN_EXTFW_GENERAL_SUPPORT') . '</a>
	</li>';
        if (!empty($links['review'])) {
            $html[] = '
	<li>
		<a href="' . JRoute::_($links['review']) . '" target="_blank">' . JText::_('JSN_EXTFW_GENERAL_VOTE') . '</a>
	</li>';
        }
        $html[] = '
	<li class="jsn-iconbar">
		<strong>' . JText::_('JSN_EXTFW_GENERAL_KEEP_IN_TOUCH') . ':</strong>
		<a title="' . JText::_('JSN_EXTFW_GENERAL_FACEBOOK') . '" target="_blank" href="http://www.facebook.com/joomlashine"><i class="jsn-icon16 jsn-icon-social jsn-icon-facebook"></i></a><a title="' . JText::_('JSN_EXTFW_GENERAL_TWITTER') . '" target="_blank" href="http://www.twitter.com/joomlashine"><i class="jsn-icon16 jsn-icon-social jsn-icon-twitter""></i></a><a title="' . JText::_('JSN_EXTFW_GENERAL_YOUTUBE') . '" target="_blank" href="http://www.youtube.com/joomlashine"><i class="jsn-icon16 jsn-icon-social jsn-icon-youtube""></i></a>
	</li>
</ul>
<ul class="jsn-footer-menu">
	<li class="first">';
        if (!empty($links['info'])) {
            $html[] = '
		<a href="' . JRoute::_($links['info']) . '" target="_blank">JSN ' . preg_replace('/JSN\\s*/i', '', JText::_($name)) . ' ' . $edition . ' v' . $version . '</a>';
        } else {
            $html[] = 'JSN ' . preg_replace('/JSN\\s*/i', '', JText::_($name)) . ' ' . $edition . ' v' . $version;
        }
        $html[] = ' by <a href="http://www.joomlashine.com" target="_blank">JoomlaShine.com</a>';
        if (!empty($edition) and !empty($links['upgrade']) and ($pos = strpos('free + pro standard', strtolower($edition))) !== false) {
            $html[] = '
		&nbsp;<a class="label label-important" href="' . JRoute::_($links['upgrade']) . '"><strong class="jsn-text-attention">' . JText::_($pos ? 'JSN_EXTFW_GENERAL_UPGRADE_TO_PRO_UNLIMITED' : 'JSN_EXTFW_GENERAL_UPGRADE_TO_PRO') . '</strong></a>';
        }
        $html[] = '
	</li>';
        try {
            $hasUpdate = false;
            foreach (JSNUpdateHelper::check($products) as $result) {
                if ($result) {
                    $hasUpdate = true;
                    break;
                }
            }
            if ($hasUpdate) {
                $html[] = '
	<li id="jsn-global-check-version-result" class="jsn-outdated-version">
		<span class="jsn-global-outdated-version">' . JText::_('JSN_EXTFW_GENERAL_UPDATE_AVAILABLE') . '</span>
		&nbsp;<a href="' . JRoute::_($links['update']) . '" class="label label-important">' . JText::_('JSN_EXTFW_GENERAL_UPDATE_NOW') . '</a>
	</li>';
            }
        } catch (Exception $e) {
            // Simply ignore
        }
        $html[] = '
</ul>
</div>
<div class="pull-right">
<ul class="jsn-footer-menu">
	<li class="jsn-iconbar first">
		<a title="' . JText::_('JSN_EXTFW_GENERAL_POWERADMIN') . '" target="_blank" href="http://www.joomlashine.com/joomla-extensions/jsn-poweradmin.html">
			<i class="jsn-icon32 jsn-icon-products jsn-icon-poweradmin"></i>
		</a>
		<a title="' . JText::_('JSN_EXTFW_GENERAL_IMAGESHOW') . '" target="_blank" href="http://www.joomlashine.com/joomla-extensions/jsn-imageshow.html">
			<i class="jsn-icon32 jsn-icon-products jsn-icon-imageshow""></i>
		</a>
		<a title="' . JText::_('JSN_EXTFW_GENERAL_UNIFORM') . '" target="_blank" href="http://www.joomlashine.com/joomla-extensions/jsn-uniform.html">
			<i class="jsn-icon32 jsn-icon-products jsn-icon-uniform""></i>
		</a>
		<a title="' . JText::_('JSN_EXTFW_GENERAL_MOBILIZE') . '" target="_blank" href="http://www.joomlashine.com/joomla-extensions/jsn-mobilize-joomla-mobile-extension.html">
			<i class="jsn-icon32 jsn-icon-products jsn-icon-mobilize""></i>
		</a>
	</li>
</ul>
</div>
<div class="clearbreak"></div>
</div>
';
        if ($echo) {
            echo implode($html);
        } else {
            return implode($html);
        }
    }
コード例 #10
0
 /**
  * Check if there is new update for installed JoomlaShine product.
  *
  * @return  mixed
  */
 private function checkUpdate()
 {
     // Initialize extensions to check for update
     $exts = JSNVersion::isJoomlaCompatible('3.1') ? array($this->option) : JSNVersion::$products;
     // Get Joomla version
     $joomlaVersion = new JVersion();
     // Get list of JoomlaShine product need to be checked for new update
     $checks = $products = array();
     foreach ($exts as $product) {
         // Instantiate JSN Config model
         self::$_app->input->set('option', $product);
         $model = new JSNConfigModel();
         // Only continue if product is installed
         if (is_readable(JPATH_ROOT . '/administrator/components/' . $product . '/config.xml')) {
             // Get product configuration
             $cfg = JSNConfigHelper::get($product);
             if (!$cfg->get('config-table-not-exists') and !$cfg->get('live_update_checking', 0)) {
                 if (time() - $cfg->get('live_update_last_check', 0) >= (int) $cfg->get('live_update_check_interval', 6) * 60 * 60) {
                     // Store necessary data to config table
                     $form = $model->getForm(array(), true, JPATH_ROOT . '/administrator/components/' . $product . '/config.xml');
                     $data = array('live_update_checking' => 1);
                     try {
                         $model->save($form, $data);
                         // Store product for checking new update later
                         file_exists($define = JPATH_ROOT . '/administrator/components/' . $product . '/' . substr($product, 4) . '.defines.php') or file_exists($define = JPATH_ROOT . '/administrator/components/' . $product . '/defines.' . substr($product, 4) . '.php') or file_exists($define = JPATH_ROOT . '/administrator/components/' . $product . '/defines.php') or $define = null;
                         if (!empty($define)) {
                             if ($product == 'com_imageshow' and !class_exists('JSNISFactory')) {
                                 // JSN ImageShow specific fix
                                 if (file_exists(JPATH_ROOT . '/administrator/components/com_imageshow/classes/jsn_is_factory.php')) {
                                     require_once JPATH_ROOT . '/administrator/components/com_imageshow/classes/jsn_is_factory.php';
                                 } else {
                                     // Do nothing as this is a background process
                                     continue;
                                 }
                             }
                             require_once $define;
                             $products[JSNUtilsText::getConstant('IDENTIFIED_NAME')] = $product;
                             $checks[JSNUtilsText::getConstant('IDENTIFIED_NAME')] = JSNUtilsText::getConstant('VERSION', $product);
                         }
                     } catch (Exception $e) {
                         // Do nothing as this is a background process
                         continue;
                     }
                 }
             }
         }
     }
     // Check update for installed JoomlaShine product
     if (count($products)) {
         if ($checks = JSNUpdateHelper::check($checks, $joomlaVersion->RELEASE)) {
             // Get database object
             $db = JFactory::getDbo();
             foreach ($checks as $id => &$result) {
                 // Instantiate JSN Config model
                 self::$_app->input->set('option', $products[$id]);
                 $model = new JSNConfigModel();
                 // Get product configuration
                 $cfg = JSNConfigHelper::get($products[$id]);
                 // Decode last update info
                 $last = is_string($last = $cfg->get('live_update_last_notified', '{"version":"0.0.0"}')) ? json_decode($last) : $last;
                 if ($result and version_compare($result->version, $last->version, '>')) {
                     // Get product details
                     if ($info = JSNUtilsXml::loadManifestCache($products[$id])) {
                         $name = 'JSN ' . preg_replace('/^JSN\\s*/i', '', $info->name) . (($edition = JSNUtilsText::getConstant('EDITION', $products[$id])) ? ' ' . $edition : '');
                         if (!JSNVersion::isJoomlaCompatible('3.1')) {
                             // Get extension ID
                             $q = $db->getQuery(true);
                             $q->select('extension_id');
                             $q->from('#__extensions');
                             $q->where("element = '" . $products[$id] . "'");
                             $q->where("type = 'component'", 'AND');
                             $db->setQuery($q);
                             $eid = $db->loadResult();
                             // Check if update is stored before
                             $q = $db->getQuery(true);
                             $q->select('version');
                             $q->from('#__updates');
                             $q->where("extension_id = '{$eid}'");
                             $db->setQuery($q);
                             // Store update info to Joomla updates table
                             if ($current = $db->loadResult()) {
                                 $q = $db->getQuery(true);
                                 $q->update('#__updates');
                                 $q->set("version = '{$result->version}'");
                                 $q->where("extension_id = '{$eid}'");
                                 $q->where("version = '{$current}'", 'AND');
                             } else {
                                 $q = $db->getQuery(true);
                                 $q->insert('#__updates');
                                 $q->columns('extension_id, name, element, type, version');
                                 $q->values("{$eid}, '{$name}', '{$products[$id]}', 'component', '{$result->version}'");
                             }
                             $db->setQuery($q);
                             $db->execute();
                         } else {
                             // Generate XML content for latest update
                             $xml[] = '<?xml version="1.0" encoding="utf-8"?>';
                             $xml[] = '<extensionset name="JoomlaShine Extensions" description="JoomlaShine Extensions Updates">';
                             $xml[] = '	<extension name="' . $name . '" element="' . $products[$id] . '" type="component" client="administrator" version="' . $result->version . '" detailsurl="" />';
                             $xml[] = '</extensionset>';
                             // Write XML content to a local cache file
                             JFile::write(JFactory::getConfig()->get('tmp_path') . '/' . str_replace('com_', 'jsn_', $products[$id]) . '_update.xml', implode("\n", $xml));
                         }
                         if ($cfg->get('live_update_notification', 0)) {
                             // Get super administrator account to notify about update available
                             if (!isset($admins)) {
                                 // Get Joomla config
                                 $joomlaConfig = JFactory::getConfig();
                                 // Build query to get super administrator account
                                 $q = $db->getQuery(true);
                                 $q->select('u.id, u.email');
                                 $q->from('#__user_usergroup_map AS g');
                                 $q->join('INNER', '#__users AS u ON g.user_id = u.id');
                                 $q->where('g.group_id = 8');
                                 $q->where('u.sendEmail = 1');
                                 $q->where('u.block = 0');
                                 $db->setQuery($q);
                                 try {
                                     if (!($admins = $db->loadObjectList())) {
                                         return;
                                     }
                                 } catch (Exception $e) {
                                     return;
                                 }
                             }
                             // Generate replacement
                             $substitutions = array('__SITE_NAME__' => $joomlaConfig->get('sitename'), '__SITE_URL__' => JUri::root(), '__PRODUCT__' => $name, '__CURRENT__' => JSNUtilsText::getConstant('VERSION', $products[$id]), '__NEW__' => $result->version, '__LINK__' => JUri::root() . 'administrator/index.php?option=' . $products[$id] . '&view=update');
                             // Initialize email subject and message
                             $subject = JText::_('JSN_EXTFW_UPDATE_NOTIFICATION_SUBJECT');
                             $message = JText::_('JSN_EXTFW_UPDATE_NOTIFICATION_MESSAGE');
                             foreach ($substitutions as $k => $v) {
                                 $subject = str_replace($k, $v, $subject);
                                 $message = str_replace($k, $v, $message);
                             }
                             foreach ($admins as $admin) {
                                 // Initialize mailer then send update notification email
                                 try {
                                     $mailer = JFactory::getMailer();
                                     $mailer->setSender(array($joomlaConfig->get('mailfrom'), $joomlaConfig->get('fromname')));
                                     $mailer->addRecipient($admin->email);
                                     $mailer->setSubject($subject);
                                     $mailer->setBody($message);
                                     $mailer->Send();
                                 } catch (Exception $e) {
                                     return;
                                 }
                             }
                         }
                     }
                 }
                 // Store last check update time
                 $form = $model->getForm(array(), true, JPATH_ROOT . '/administrator/components/' . $products[$id] . '/config.xml');
                 $data = array('live_update_checking' => '0', 'live_update_last_check' => time());
                 if ($result) {
                     // Store last version notified
                     $data['live_update_last_notified'] = json_encode($result);
                 }
                 try {
                     $model->save($form, $data);
                 } catch (Exception $e) {
                     // Do nothing as this is a background process
                     continue;
                 }
             }
         }
     }
     // Restore current option
     self::$_app->input->set('option', $this->option);
     // In Joomla! 3.1, return generated XML content about latest update
     if (JSNVersion::isJoomlaCompatible('3.1')) {
         if (isset($xml)) {
             return implode("\n", $xml);
         } elseif (is_readable($cache = JFactory::getConfig()->get('tmp_path') . '/' . str_replace('com_', 'jsn_', $this->option) . '_update.xml')) {
             return JFile::read($cache);
         } else {
             return '<?xml version="1.0" encoding="utf-8"?><extensionset />';
         }
     }
 }
コード例 #11
0
ファイル: dependency.php プロジェクト: densem-2013/exikom
        // Checking for dependency is necessary
        $checkUpdate = true;
    }
    // Load installer model for checking dependency
    require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/installer.php';
    $model = new JSNPagebuilderModelInstaller();
    if (($result = $model->check($check, $checkUpdate)) !== -1) {
        $missingDependency = true;
    }
    if ($missingDependency) {
        // Redirect to dependency installer view
        $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=installer');
    }
    // Check compatibility between component and installed Joomla version
    if (!JSNVersion::isJoomlaCompatible('3.')) {
        try {
            $result = JSNUpdateHelper::check(JSN_PAGEBUILDER_IDENTIFIED_NAME, '3.0');
            if ($result[JSN_PAGEBUILDER_IDENTIFIED_NAME]) {
                $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update');
            } else {
                $app->enqueueMessage(JText::_('JSN_PAGEBUILDER_NOT_COMPATIBLE_MSG'));
            }
        } catch (Exception $e) {
            $app->enqueueMessage(JText::_('JSN_PAGEBUILDER_NOT_COMPATIBLE_MSG'));
        }
    }
    // Check compatibility between component and the installed version of JoomlaShine extension framework
    if (!JSNVersion::checkCompatibility(JSN_PAGEBUILDER_IDENTIFIED_NAME, JSN_PAGEBUILDER_VERSION)) {
        $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update');
    }
}
コード例 #12
0
ファイル: dependency.php プロジェクト: densem-2013/exikom
        // Checking for dependency is necessary
        $checkUpdate = true;
    }
    // Load installer model for checking dependency
    require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/installer.php';
    $model = new JSNEasySliderModelInstaller();
    if (($result = $model->check($check, $checkUpdate)) !== -1) {
        $missingDependency = true;
    }
    if ($missingDependency) {
        // Redirect to dependency installer view
        $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=installer');
    }
    // Check compatibility between component and installed Joomla version
    if (!JSNVersion::isJoomlaCompatible(JSN_EASYSLIDER_REQUIRED_JOOMLA_VER)) {
        try {
            $result = JSNUpdateHelper::check(JSN_EASYSLIDER_IDENTIFIED_NAME, JSN_EASYSLIDER_REQUIRED_JOOMLA_VER);
            if ($result[JSN_EASYSLIDER_IDENTIFIED_NAME]) {
                $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update');
            } else {
                $app->enqueueMessage(JText::_('JSN_EASYSLIDER_NOT_COMPATIBLE_MSG'));
            }
        } catch (Exception $e) {
            $app->enqueueMessage(JText::_('JSN_EASYSLIDER_NOT_COMPATIBLE_MSG'));
        }
    }
    // Check compatibility between component and the installed version of JoomlaShine extension framework
    if (!JSNVersion::checkCompatibility(JSN_EASYSLIDER_IDENTIFIED_NAME, JSN_EASYSLIDER_VERSION)) {
        $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update');
    }
}
コード例 #13
0
        // Checking for dependency is necessary
        $checkUpdate = true;
    }
    // Load installer model for checking dependency
    require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/installer.php';
    $model = new PoweradminModelInstaller();
    if (($result = $model->check($check, $checkUpdate)) !== -1) {
        $missingDependency = true;
    }
    if ($missingDependency) {
        // Redirect to dependency installer view
        $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=installer');
    }
    // Check compatibility between component and installed Joomla version
    if (!JSNVersion::isJoomlaCompatible('3.')) {
        try {
            $result = JSNUpdateHelper::check(JSN_POWERADMIN_IDENTIFIED_NAME, '3.0');
            if ($result[JSN_POWERADMIN_IDENTIFIED_NAME]) {
                $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update');
            } else {
                $app->enqueueMessage(JText::_('JSN_POWERADMIN_NOT_COMPATIBLE_MSG'));
            }
        } catch (Exception $e) {
            $app->enqueueMessage(JText::_('JSN_POWERADMIN_NOT_COMPATIBLE_MSG'));
        }
    }
    // Check compatibility between component and the installed version of JoomlaShine extension framework
    if (!JSNVersion::checkCompatibility(JSN_POWERADMIN_IDENTIFIED_NAME, JSN_POWERADMIN_VERSION)) {
        $app->redirect('index.php?option=' . $input->getCmd('option') . '&view=update');
    }
}