示例#1
0
 /**
  * Display method.
  *
  * @param   string  $tpl  The name of the template file to parse.
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     // Get product info
     $info = JSNUtilsXml::loadManifestCache();
     // Pass data to view
     $this->assignRef('product', $info);
     // Display the template
     parent::display($tpl);
 }
示例#2
0
 /**
  * Display method.
  *
  * @param   string  $tpl  The name of the template file to parse.
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     // Is product upgradable?
     if (!($edition = JSNUtilsText::getConstant('EDITION')) or strcasecmp($edition, 'pro unlimited') == 0) {
         $app->redirect('index.php?option=' . $app->input->getCmd('option') . '&view=update');
     }
     // Get product info
     $info = JSNUtilsXml::loadManifestCache();
     // Pass data to view
     $this->assignRef('product', $info);
     // Display the template
     parent::display($tpl);
 }
示例#3
0
 /**
  * Get configuration data from database.
  *
  * If configuration data does not exist in database, default configuration
  * value declared in the <b>administrator/components/com_YourComponentName/config.xml</b>
  * file will be returned.
  *
  * @param   string  $component  Component to get configuration data for. Leave empty to get configuration data for requested component.
  *
  * @return  object  An instance of JObject class.
  */
 public static function get($component = '')
 {
     // Get component
     !empty($component) or $component = JFactory::getApplication()->input->getCmd('option');
     if (!isset(self::$config) or !isset(self::$config[$component])) {
         // Instantiate config object
         self::$config[$component] = new JObject();
         // Parse config.xml file for default parameter value
         if (is_readable(JPATH_ADMINISTRATOR . '/components/' . $component . '/config.xml')) {
             $xml = JSNUtilsXml::load(JPATH_ADMINISTRATOR . '/components/' . $component . '/config.xml');
             foreach ($xml->xpath('//field["name"]') as $field) {
                 self::$config[$component]->set((string) $field['name'], (string) $field['default']);
             }
         }
         // Get name of config data table
         $table = '#__jsn_' . preg_replace('/^com_/i', '', $component) . '_config';
         // Check if table exists
         $db = JFactory::getDbo();
         $ts = $db->getTableList();
         if (in_array($table = str_replace('#__', $db->getPrefix(), $table), $ts)) {
             // Build query to get component configuration
             $q = $db->getQuery(true);
             $q->select(array('name', 'value'));
             $q->from($table);
             $q->where('1');
             $db->setQuery($q);
             if ($rows = $db->loadObjectList()) {
                 // Finalize config params
                 foreach ($rows as $row) {
                     // Decode value if it is a JSON encoded string
                     if (substr($row->value, 0, 1) == '{' and substr($row->value, -1) == '}') {
                         $row->value = json_decode($row->value);
                     }
                     self::$config[$component]->set($row->name, $row->value);
                 }
             }
         } else {
             self::$config[$component]->set('config-table-not-exists', true);
         }
     }
     return self::$config[$component];
 }
    public static function about($products = array())
    {
        // Get extension manifest cache
        $info = JSNUtilsXml::loadManifestCache();
        // Add assets
        JSNHtmlAsset::loadScript('jsn/about', array('language' => JSNUtilsLanguage::getTranslated(array('JSN_EXTFW_ABOUT_SEE_OTHERS_MODAL_TITLE', 'JSN_EXTFW_GENERAL_CLOSE'))));
        // Generate markup
        $html[] = '
<div id="jsn-about" class="jsn-page-about">
<div class="jsn-bootstrap">';
        $html[] = self::aboutInfo($info, $products);
        $html[] = '
	<div class="jsn-product-support">';
        $html[] = self::aboutHelp();
        $html[] = self::aboutFeedback();
        $html[] = '
	</div>
</div>
</div>
<div class="clr"></div>';
        echo implode($html);
    }
示例#5
0
 /**
  * This task will be send list of editions to the client in JSON format.
  *
  * @return  void
  */
 public function editions()
 {
     // Initialize variables
     $input = JFactory::getApplication()->input;
     $jVer = new JVersion();
     $info = JSNUtilsXml::loadManifestCache();
     // Get product edition and identified name
     $edition = strtolower(JSNUtilsText::getConstant('EDITION'));
     $identified = ($identified = JSNUtilsText::getConstant('IDENTIFIED_NAME')) ? $identified : strtolower($info->name);
     // Build query string
     $query[] = 'joomla_version=' . urlencode($jVer->RELEASE);
     $query[] = 'username='******'customer_username'));
     $query[] = 'password='******'customer_password'));
     $query[] = 'identified_name=' . ($input->getCmd('id') ? urlencode($input->getCmd('id')) : urlencode($identified));
     // Finalize link
     $url = str_replace('upgrade=yes', 'upgrade=no', JSN_EXT_DOWNLOAD_UPDATE_URL) . '&' . implode('&', $query);
     // Get results
     try {
         $result = JSNUtilsHttp::get($url);
         if (substr($result['body'], 0, 3) == 'ERR') {
             jexit(json_encode(array('message' => JText::_('JSN_EXTFW_LIGHTCART_ERROR_' . $result['body']), 'type' => 'error')));
         }
         // JSON-decode the result
         $result = json_decode($result['body']);
         if (is_null($result)) {
             jexit(json_encode(array('message' => JText::_('JSN_EXTFW_VERSION_CHECK_FAIL'), 'type' => 'error')));
         }
         if ($edition != 'free') {
             if (!in_array('PRO UNLIMITED', $result->editions)) {
                 jexit(json_encode(array('message' => JText::sprintf('JSN_EXTFW_UPGRADE_YOUR_ACCOUNT_IS_NOT_PROVIDED_WITH_UNLIMITED_EDITION', JText::_($info->name) . ' PRO Unlimited'), 'type' => 'error')));
             }
             $result->editions = array('PRO UNLIMITED');
         }
         jexit(json_encode($result->editions));
     } catch (Exception $e) {
         jexit(json_encode(array('message' => JText::_('JSN_EXTFW_VERSION_CHECK_FAIL'), 'type' => 'error')));
     }
 }
示例#6
0
    /**
     * Generate markup for message configuration.
     *
     * @param   array  $msgs  Queried messages.
     *
     * @return  string
     */
    public static function showConfig($msgs = array())
    {
        // Parse configuration declaration
        $xml = JSNUtilsXml::load(JPATH_COMPONENT_ADMINISTRATOR . '/config.xml');
        $html[] = '
	<table border="0" class="table table-bordered">
		<thead>
			<tr>
				<th width="20" class="center">#</th>
				<th class="center">' . JText::_('JSN_EXTFW_MESSAGE') . '</th>
				<th width="150" nowrap="nowrap" class="center">' . JText::_('JSN_EXTFW_MESSAGE_SCREEN') . '</th>
				<th width="80" nowrap="nowrap" class="center">' . JText::_('JSN_EXTFW_MESSAGE_ORDER') . '</th>
				<th width="80" nowrap="nowrap" class="center">' . JText::_('JSN_EXTFW_MESSAGE_SHOW') . '</th>
			</tr>
		</thead>
		<tbody>';
        for ($i = 0, $n = count($msgs); $i < $n; $i++) {
            $msg =& $msgs[$i];
            $scr = $xml->xpath('//field[@type="messagelist"]/option[@value="' . $msg->msg_screen . '"]');
            $html[] = '
			<tr>
				<td class="center">' . ($i + 1) . '</td>
				<td><span title="::' . htmlspecialchars(strip_tags(JText::_('MESSAGE_' . $msg->msg_screen . '_' . $msg->ordering . '_PRIMARY'))) . '" class="editlinktip hasTip">' . JSNUtilsText::getWords(strip_tags(JText::_('MESSAGE_' . $msg->msg_screen . '_' . $msg->ordering . '_PRIMARY')), 15) . '</span></td>
				<td class="center">' . JText::_((string) $scr[0]) . '</td>
				<td class="center">' . $msg->ordering . '</td>
				<td class="center"><input type="checkbox"' . ($msg->published ? ' checked="checked"' : '') . ' value="' . $msg->msg_id . '" name="messages[]" /></td>
			</tr>';
            if ($msg->published) {
                $html[] = '<input type="hidden" name="messagelist[]" value="' . $msg->msg_id . '" />';
            }
        }
        $html[] = '
		</tbody>
	</table>
';
        return implode($html);
    }
示例#7
0
    // Get config model
    $model = new JSNConfigModel();
    // Turn on/off periodical popup asking for review
    $form = $model->getForm(array(), true, JPATH_ROOT . '/administrator/components/' . $component . '/config.xml');
    $data = array('review_popup' => (int) $status);
    try {
        // Save new configuration
        $model->save($form, $data);
    } catch (Exception $e) {
        // Do nothing as this is a background process
        jexit($e->getMessage());
    }
    jexit('SUCCESS');
} else {
    // Get product info
    $product = JSNUtilsXml::loadManifestCache($component, 'component');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title><?php 
echo JText::_('JSN_EXTFW_CHOOSERS_REVIEW_ON_JED');
?>
</title>
	<meta name="author" content="JoomlaShine Team">
	<?php 
if (JSNVersion::isJoomlaCompatible('3.0')) {
    ?>
	<link href="../../../../../../../media/jui/css/bootstrap.min.css" rel="stylesheet" />
示例#8
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);
        }
    }
示例#9
0
 /**
  * Do any preparation needed before doing real data restore.
  *
  * @param   string   &$backup       Path to folder containing extracted backup files.
  * @param   boolean  $checkEdition  Check for matching edition before restore?
  *
  * @return  void
  */
 protected function beforeRestore(&$backup, $checkEdition = true)
 {
     // Initialize variables
     $com = preg_replace('/^com_/i', '', JFactory::getApplication()->input->getCmd('option'));
     $info = JSNUtilsXml::loadManifestCache();
     $jVer = new JVersion();
     // Extract backup file
     if (!JArchive::extract($backup, substr($backup, 0, -4))) {
         throw new Exception(JText::_('JSN_EXTFW_DATA_EXTRACT_UPLOAD_FILE_FAIL'));
     }
     $backup = substr($backup, 0, -4);
     // Auto-detect backup XML file
     $files = glob("{$backup}/*.xml");
     foreach ($files as $file) {
         $this->data = JSNUtilsXml::load($file);
         // Check if this XML file contain backup data for our product
         if (strcasecmp($this->data->getName(), 'backup') == 0 and isset($this->data['extension-name']) and isset($this->data['extension-version']) and isset($this->data['joomla-version'])) {
             // Store backup XML file name
             $this->xml = basename($file);
             // Simply break the loop if we found backup file
             break;
         }
         unset($this->data);
     }
     if (isset($this->data)) {
         // Check if Joomla series match
         if (!$jVer->isCompatible((string) $this->data['joomla-version'])) {
             throw new Exception(JText::_('JSN_EXTFW_DATA_JOOMLA_VERSION_NOT_MATCH'));
         }
         // Check if extension match
         if ((string) $this->data['extension-name'] != 'JSN ' . preg_replace('/JSN\\s*/i', '', JText::_($info->name))) {
             throw new Exception(JText::_('JSN_EXTFW_DATA_INVALID_PRODUCT'));
         } elseif (isset($this->data['extension-edition']) and $checkEdition and (!($const = JSNUtilsText::getConstant('EDITION')) or (string) $this->data['extension-edition'] != $const)) {
             throw new Exception(JText::_('JSN_EXTFW_DATA_INVALID_PRODUCT_EDITION'));
         } elseif (!version_compare($info->version, (string) $this->data['extension-version'], '=') and !$checkEdition) {
             // Get update link for out-of-date product
             $ulink = $info->authorUrl;
             if (isset($this->data['update-url'])) {
                 $ulink = (string) $this->data['update-url'];
             } elseif ($const = JSNUtilsText::getConstant('UPDATE_LINK')) {
                 $ulink = $const;
             }
             throw new Exception(JText::_('JSN_EXTFW_DATA_PRODUCT_VERSION_OUTDATE') . '&nbsp;<a href="' . $ulink . '" class="jsn-link-action">' . JText::_('JSN_EXTFW_GENERAL_UPDATE_NOW') . '</a>');
         } elseif (!version_compare($info->version, (string) $this->data['extension-version'], 'ge')) {
             // Get update link for out-of-date product
             $ulink = $info->authorUrl;
             if (isset($this->data['update-url'])) {
                 $ulink = (string) $this->data['update-url'];
             } elseif ($const = JSNUtilsText::getConstant('UPDATE_LINK')) {
                 $ulink = $const;
             }
             throw new Exception(JText::_('JSN_EXTFW_DATA_PRODUCT_VERSION_OUTDATE') . '&nbsp;<a href="' . $ulink . '" class="jsn-link-action">' . JText::_('JSN_EXTFW_GENERAL_UPDATE_NOW') . '</a>');
         }
     } else {
         throw new Exception(JText::_('JSN_EXTFW_DATA_BACKUP_XML_NOT_FOUND'));
     }
     $dataForm = $this->getForm();
     if (!empty($dataForm) && count($dataForm)) {
         foreach ($dataForm as $formId) {
             if (!empty($formId->form_id) && (int) $formId->form_id) {
                 $this->_db->setQuery("DROP TABLE IF EXISTS #__jsn_uniform_submissions_{$formId->form_id}");
                 $this->_db->execute();
             }
         }
     }
     if (JSNUniformHelper::checkTableSql('#__jsn_uniform_submissions') === false) {
         JSNUniformHelper::createTableIfNotExistsSubmissions();
     }
     if (JSNUniformHelper::checkTableSql('#__jsn_uniform_submission_data') === false) {
         JSNUniformHelper::createTableIfNotExistsSubmissionData();
     }
 }
示例#10
0
    /**
     * 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);
        }
    }
示例#11
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 />';
         }
     }
 }
示例#12
0
# Technical Support:  Feedback - http://www.joomlashine.com/joomlashine/contact-us.html
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# @version $Id: default.php 13922 2012-07-12 04:23:17Z thangbh $
-------------------------------------------------------------------------*/
// no direct access
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
// Create shortcuts to some parameters.
$item =& $data;
$params = $item->params;
$canEdit = $item->params->get('access-edit');
$user = JFactory::getUser();
if (!is_object($params)) {
    return;
}
$manifest = JSNUtilsXml::loadManifestCache('pagebuilder', 'plugin', 'jsnpoweradmin');
$version = $manifest->version;
?>
<link rel="stylesheet" href="<?php 
echo JURI::root() . '/plugins/jsnpoweradmin/pagebuilder/assets/css/jsnpa-pagebuilder.css?version=' . $version;
?>
" type="text/css" />
<div class="jsn-article-layout">
	<!-- Show/hide category -->
	<?php 
$showCategoryClass = $item->parent_slug != '1:root' ? 'display-default display-item' : 'hide-item';
?>
	<div class="show-category <?php 
echo $showCategoryClass;
?>
" >
示例#13
0
 /**
  * Do any preparation needed before installing update package.
  *
  * @param   string  $path  Path to downloaded update package.
  *
  * @return  void
  */
 protected function beforeInstall($path)
 {
     // Get product config
     $xml = JSNUtilsXml::load(JPATH_COMPONENT_ADMINISTRATOR . '/config.xml');
     // Build backup options
     $backupOptions = array('no-download' => true);
     if (is_array($xml->xpath('//field[@type="databackup"]/option'))) {
         foreach ($xml->xpath('//field[@type="databackup"]/option') as $option) {
             // Parse option parameters
             $value = array();
             if ((string) $option['type'] == 'tables') {
                 // Generate option value
                 foreach ($option->table as $param) {
                     $value[] = (string) $param;
                 }
             } elseif ((string) $option['type'] == 'files') {
                 // Generate option value
                 foreach ($option->folder as $param) {
                     $value[(string) $param] = (string) $param['filter'];
                 }
             } else {
                 continue;
             }
             $backupOptions[(string) $option['type']][] = json_encode($value);
         }
     }
     // Backup the product data
     try {
         $this->backup = new JSNDataModel();
         $this->backup = $this->backup->backup($backupOptions);
     } catch (Exception $e) {
         throw $e;
     }
 }
示例#14
0
 /**
  * Parse configuration declaration.
  *
  * This method parses the <b>administrator/components/com_YourComponentName/config.xml</b>
  * file for configuration declaration.
  *
  * @param   array    $data        Data to preset into form field.
  * @param   boolean  $loadData    Load data for form field or not?
  * @param   string   $configFile  Path to config declaration XML file.
  *
  * @return  array  Array of stdClass objects.
  */
 public function getForm($data = array(), $loadData = true, $configFile = '')
 {
     // Load configuration declaration
     if (empty($configFile)) {
         $xml = JSNUtilsXml::load(JPATH_COMPONENT_ADMINISTRATOR . '/config.xml');
     } else {
         $xml = JSNUtilsXml::load($configFile);
     }
     if (is_null($xml->section[0])) {
         return array();
     }
     // Automatically add script movement settings
     if (isset($xml->section[0]->group[0]->tab)) {
         $tab = $xml->section[0]->group[0]->addChild('tab');
         $tab->addAttribute('name', 'global-parameter-optimization');
         $tab->addAttribute('label', 'JSN_EXTFW_CONFIG_OPTIMIZATION');
         $fieldset = $tab->addChild('fieldset');
         $fieldset->addAttribute('name', 'optimization');
         $field = $fieldset->addChild('field');
     } elseif (isset($xml->section[0]->group[0]->fieldset)) {
         $fieldset = $xml->section[0]->group[0]->addChild('fieldset');
         $fieldset->addAttribute('name', 'optimization');
         $fieldset->addAttribute('label', 'JSN_EXTFW_CONFIG_OPTIMIZATION');
         $field = $fieldset->addChild('field');
     } else {
         $field = $xml->section[0]->group[0]->addChild('field');
     }
     $field->addAttribute('name', 'script_movement');
     $field->addAttribute('type', 'jsnradio');
     $field->addAttribute('default', 0);
     $field->addAttribute('filter', 'int');
     $field->addAttribute('label', 'JSN_EXTFW_CONFIG_OPTIMIZATION_SCRIPT_MOVEMENT_LABEL');
     $field->addAttribute('description', 'JSN_EXTFW_CONFIG_OPTIMIZATION_SCRIPT_MOVEMENT_DESC');
     $option = $field->addChild('option', 'JYES');
     $option->addAttribute('value', 1);
     $option = $field->addChild('option', 'JNO');
     $option->addAttribute('value', 0);
     if (isset($fieldset)) {
         $action = $fieldset->addChild('action');
         $action->addAttribute('label', 'JAPPLY');
         $action->addAttribute('task', 'configuration.save');
         $action->addAttribute('track', 1);
         $action->addAttribute('ajax', 1);
     }
     // Automatically add live update notification settings
     $group = $xml->section[0]->addChild('group');
     $group->addAttribute('name', 'update');
     $group->addAttribute('label', 'JSN_EXTFW_CONFIG_UPDATE');
     $group->addAttribute('icon', 'download');
     $fieldset = $group->addChild('fieldset');
     $fieldset->addAttribute('name', 'update');
     $field = $fieldset->addChild('field');
     $field->addAttribute('name', 'live_update_check_interval');
     $field->addAttribute('type', 'jsntext');
     $field->addAttribute('input-type', 'number');
     $field->addAttribute('default', 6);
     $field->addAttribute('filter', 'int');
     $field->addAttribute('exttext', JText::_('JSN_EXTFW_CONFIG_LIVE_UPDATE_CHECK_INTERVAL_UNIT'));
     $field->addAttribute('class', 'input-small validate-positive-number');
     $field->addAttribute('label', 'JSN_EXTFW_CONFIG_LIVE_UPDATE_CHECK_INTERVAL_LABEL');
     $field->addAttribute('description', 'JSN_EXTFW_CONFIG_LIVE_UPDATE_CHECK_INTERVAL_DESC');
     $field = $fieldset->addChild('field');
     $field->addAttribute('name', 'live_update_notification');
     $field->addAttribute('type', 'jsnradio');
     $field->addAttribute('default', 0);
     $field->addAttribute('filter', 'int');
     $field->addAttribute('label', 'JSN_EXTFW_CONFIG_LIVE_UPDATE_NOTIFICATION_LABEL');
     $field->addAttribute('description', 'JSN_EXTFW_CONFIG_LIVE_UPDATE_NOTIFICATION_DESC');
     $option = $field->addChild('option', 'JYES');
     $option->addAttribute('value', 1);
     $option = $field->addChild('option', 'JNO');
     $option->addAttribute('value', 0);
     $action = $fieldset->addChild('action');
     $action->addAttribute('label', 'JAPPLY');
     $action->addAttribute('task', 'configuration.save');
     $action->addAttribute('track', 1);
     $action->addAttribute('ajax', 1);
     // Parse configuration declaration
     return $this->loadSections($xml);
 }