Example #1
0
 /**
  * Method to get the element.
  *
  * @return  string  A message containing the installed version and,
  *                  if necessary, information on a new version.
  *
  * @since   2.1
  */
 function fetchElement($name, $value, &$node, $control_name)
 {
     // Check if cURL is loaded; if not, proceed no further
     if (!extension_loaded('curl')) {
         return JText::_('MOD_TWEETDISPLAYBACK_ERROR_NOCURL');
     } else {
         // Get the module's XML
         $xmlfile = JPATH_SITE . '/modules/mod_tweetdisplayback/mod_tweetdisplayback.xml';
         $data = JApplicationHelper::parseXMLInstallFile($xmlfile);
         // The module's version
         $version = $data['version'];
         // The target to check against
         $target = 'http://www.flbab.com/updates/TDB_version';
         // Get the JSON data
         $update = ModTweetDisplayBackHelper::getJSON($target);
         // Message containing the version
         $message = '<label style="max-width:100%">' . JText::sprintf('MOD_TWEETDISPLAYBACK_VERSION_INSTALLED', $version);
         // If an update is available, notify the user
         if (version_compare($update['version'], $version, 'gt')) {
             $message .= '  <a href="' . $update['notice'] . '" target="_blank">' . JText::sprintf('MOD_TWEETDISPLAYBACK_VERSION_UPDATE', $update['version']) . '</a></label>';
         } else {
             $message .= '  ' . JText::_('MOD_TWEETDISPLAYBACK_VERSION_CURRENT') . '</label>';
         }
         return $message;
     }
 }
Example #2
0
 /**
  * Method to get the field label.
  *
  * @return  string  A message containing the installed version and,
  *                  if necessary, information on a new version.
  *
  * @since           2.1
  */
 protected function getLabel()
 {
     // Check if cURL is loaded; if not, proceed no further
     if (!extension_loaded('curl')) {
         return JText::_('TPL_CONSTRUCT5_ERROR_NOCURL');
     } else {
         // Get the module's XML
         $xmlfile = JPATH_SITE . '/templates/construct5/templateDetails.xml';
         $data = JApplicationHelper::parseXMLInstallFile($xmlfile);
         // The module's version
         $version = $data['version'];
         $name = str_replace(array('construct', 'bootstruct'), array('Construct', 'Bootstruct'), $data['name']);
         // The target to check against
         $target = 'http://construct-framework.com/upgradecheck/' . $data['name'];
         $curl = curl_init();
         curl_setopt($curl, CURLOPT_URL, $target);
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($curl, CURLOPT_HEADER, false);
         $update = curl_exec($curl);
         curl_close($curl);
         // Message containing the version
         $message = '<label style="max-width:100%">' . JText::sprintf('TPL_CONSTRUCT5_VERSION_INSTALLED', $name, $version);
         // If an update is available, and compatible with the current Joomla! version, notify the user
         if (version_compare($version, $update, 'lt')) {
             $message .= '  <a href="http://construct-framework.com" target="_blank">' . JText::sprintf('TPL_CONSTRUCT5_VERSION_UPDATE', $update) . '</a></label>';
         } else {
             $message .= '  ' . JText::_('TPL_CONSTRUCT5_VERSION_CURRENT') . '</label>';
         }
         return $message;
     }
 }
Example #3
0
 /**
  * Retrieve Kunena version from manifest.xml
  *
  * @return string version
  */
 function versionXML()
 {
     if ($data = JApplicationHelper::parseXMLInstallFile(KUNENA_FILE_INSTALL)) {
         return $data['version'];
     }
     return 'ERROR';
 }
Example #4
0
 function _loadItems()
 {
     global $mainframe, $option;
     // Get a database connector
     $db =& JFactory::getDBO();
     $query = 'SELECT e.id as id, e.name as name, e.extension as extension, e.folder as folder, p.name as file, p.title as plugin' . ' FROM #__jce_extensions AS e' . ' INNER JOIN #__jce_plugins as p ON e.pid = p.id' . ' ORDER BY e.name';
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     $numRows = count($rows);
     for ($i = 0; $i < $numRows; $i++) {
         $row =& $rows[$i];
         $plugin = $row->plugin;
         $name = $row->name;
         $folder = $row->folder;
         // Get the plugin base path
         $baseDir = JPATH_PLUGINS . DS . 'editors' . DS . 'jce' . DS . 'tiny_mce' . DS . 'plugins';
         // Get the plugin xml file
         $xmlfile = $baseDir . DS . $row->file . DS . 'extensions' . DS . $row->folder . DS . $row->extension . ".xml";
         if (file_exists($xmlfile)) {
             if ($data = JApplicationHelper::parseXMLInstallFile($xmlfile)) {
                 foreach ($data as $key => $value) {
                     $row->{$key} = $value;
                 }
             }
         }
         $row->name = $name;
         $row->plugin = $plugin;
     }
     $this->setState('pagination.total', $numRows);
     if ($this->_state->get('pagination.limit') > 0) {
         $this->_items = array_slice($rows, $this->_state->get('pagination.offset'), $this->_state->get('pagination.limit'));
     } else {
         $this->_items = $rows;
     }
 }
Example #5
0
 function _getXMLInfos($info)
 {
     $folder = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jinc';
     if (JFolder::exists($folder)) {
         $xmlFilesInDir = JFolder::files($folder, 'com_jinc.xml');
     } else {
         $folder = JPATH_SITE . DS . 'components' . DS . 'com_jinc';
         if (JFolder::exists($folder)) {
             $xmlFilesInDir = JFolder::files($folder, 'com_jinc.xml');
         } else {
             $xmlFilesInDir = null;
         }
     }
     $xml_items = '';
     if (count($xmlFilesInDir)) {
         foreach ($xmlFilesInDir as $xmlfile) {
             if ($data = JApplicationHelper::parseXMLInstallFile($folder . DS . $xmlfile)) {
                 foreach ($data as $key => $value) {
                     $xml_items[$key] = $value;
                 }
             }
         }
     }
     if (isset($xml_items[$info]) && $xml_items[$info] != '') {
         return $xml_items[$info];
     } else {
         return '';
     }
 }
 function display($tpl = null)
 {
     global $option;
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     $client = JRequest::getWord('client', 'site');
     $id = JRequest::getVar('id', '', '', 'int');
     $lists = array();
     $query = 'SELECT * FROM #__jomtube_plugins WHERE id = ' . $id;
     $db->setQuery($query);
     $row = $db->loadObject();
     if ($id) {
         $data = JApplicationHelper::parseXMLInstallFile(JPATH_SITE . DS . $row->folder . DS . $row->element . '.xml');
     } else {
         $row->folder = '';
         $row->ordering = 999;
         $row->published = 1;
         $row->description = '';
     }
     $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published);
     // get params definitions
     $params = new JParameter($row->params, JPATH_SITE . DS . $row->folder . DS . $row->element . '.xml', 'plugin');
     $this->assignRef('lists', $lists);
     $this->assignRef('plugin', $row);
     $this->assignRef('params', $params);
     parent::display($tpl);
 }
 /**
  * Get extension versions
  * @return Array
  */
 function getVersions()
 {
     $db = JFactory::getDBO();
     // Get Component xml
     $com_xml = JApplicationHelper::parseXMLInstallFile(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jce' . DS . 'jce.xml');
     $mediabox_xml_file = WF_JOOMLA15 ? JPATH_PLUGINS . DS . 'system' . DS . 'jcemediabox.xml' : JPATH_PLUGINS . DS . 'system' . DS . 'jcemediabox' . DS . 'jcemediabox.xml';
     if (file_exists($mediabox_xml_file)) {
         $mediabox_xml = JApplicationHelper::parseXMLInstallFile($mediabox_xml_file);
     } else {
         $mediabox_xml['version'] = 0;
         // return 0 for false
     }
     $versions = array('joomla' => array('com_jce' => $com_xml['version'], 'plg_jcemediabox' => $mediabox_xml['version']), 'jce' => array());
     $model = JModel::getInstance('plugins', 'WFModel');
     // get all plugins
     $plugins = $model->getPlugins();
     // get all extensions
     $extensions = $model->getExtensions();
     foreach ($plugins as $plugin) {
         if ($plugin->core == 0) {
             $file = WF_EDITOR_PLUGINS . DS . $plugin->name . DS . $plugin->name . '.xml';
             $xml = JApplicationHelper::parseXMLInstallFile($file);
             $versions['jce']['jce_' . $plugin->name] = $xml['version'];
         }
     }
     foreach ($extensions as $extension) {
         if ($extension->core == 0) {
             $file = WF_EDITOR_EXTENSIONS . DS . $extension->folder . DS . $extension->extension . '.xml';
             $xml = JApplicationHelper::parseXMLInstallFile($file);
             $versions['jce']['jce_' . $extension->folder . '_' . $extension->extension] = $xml['version'];
         }
     }
     return $versions;
 }
Example #8
0
	public static function getExtensionVersion($c = 'phocadownload') {
		$folder = JPATH_ADMINISTRATOR .DS. 'components'.DS.'com_'.$c;
		if (JFolder::exists($folder)) {
			$xmlFilesInDir = JFolder::files($folder, '.xml$');
		} else {
			$folder = JPATH_SITE .DS. 'components'.DS.'com_'.$c;
			if (JFolder::exists($folder)) {
				$xmlFilesInDir = JFolder::files($folder, '.xml$');
			} else {
				$xmlFilesInDir = null;
			}
		}

		$xml_items = '';
		if (count($xmlFilesInDir))
		{
			foreach ($xmlFilesInDir as $xmlfile)
			{
				if ($data = JApplicationHelper::parseXMLInstallFile($folder.DS.$xmlfile)) {
					foreach($data as $key => $value) {
						$xml_items[$key] = $value;
					}
				}
			}
		}
		
		if (isset($xml_items['version']) && $xml_items['version'] != '' ) {
			return $xml_items['version'];
		} else {
			return '';
		}
	}
 function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $language = JFactory::getLanguage();
     // create a unique id
     $id = preg_replace('#([^a-z0-9_-]+)#i', '', $control_name . 'filesystem' . $name);
     // add javascript if element has parameters
     if ($node->attributes('parameters')) {
         $document = JFactory::getDocument();
         $document->addScriptDeclaration('$jce.Parameter.add("#' . $id . '", "filesystem");');
     }
     // path to directory
     $path = WF_EDITOR_EXTENSIONS . DS . 'filesystem';
     $filter = '\\.xml$';
     $files = JFolder::files($path, $filter, false, true);
     $options = array();
     if (!$node->attributes('exclude_default')) {
         $options[] = JHTML::_('select.option', '', WFText::_('WF_OPTION_NOT_SET'));
     }
     if (is_array($files)) {
         foreach ($files as $file) {
             // load language file
             $language->load('com_jce_filesystem_' . basename($file, '.xml'), JPATH_SITE);
             $xml = JApplicationHelper::parseXMLInstallFile($file);
             $options[] = JHTML::_('select.option', basename($file, '.xml'), WFText::_($xml['name']));
         }
     }
     return JHTML::_('select.genericlist', $options, '' . $control_name . '[filesystem][' . $name . ']', 'class="inputbox"', 'value', 'text', $value, $id);
 }
 function _loadItems()
 {
     global $mainframe, $option;
     // Get a database connector
     $db =& JFactory::getDBO();
     $where = null;
     if ($search = $this->_state->get('filter.string')) {
         $where .= ' AND title LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
     }
     $query = 'SELECT id, title, type, name' . ' FROM #__jce_plugins' . ' WHERE type="plugin"' . ' AND iscore=0' . $where . ' ORDER BY name';
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     // Get the plugin base path
     $baseDir = JPATH_PLUGINS . DS . 'editors' . DS . 'jce' . DS . 'tiny_mce' . DS . 'plugins';
     $numRows = count($rows);
     for ($i = 0; $i < $numRows; $i++) {
         $row =& $rows[$i];
         // Get the plugin xml file
         $xmlfile = $baseDir . DS . $row->name . DS . $row->name . ".xml";
         if (file_exists($xmlfile)) {
             if ($data = JApplicationHelper::parseXMLInstallFile($xmlfile)) {
                 foreach ($data as $key => $value) {
                     $row->{$key} = $value;
                 }
             }
         }
     }
     $this->setState('pagination.total', $numRows);
     if ($this->_state->get('pagination.limit') > 0) {
         $this->_items = array_slice($rows, $this->_state->get('pagination.offset'), $this->_state->get('pagination.limit'));
     } else {
         $this->_items = $rows;
     }
 }
Example #11
0
 /**
  * Метод для отображения вида
  */
 public function display($tpl = null)
 {
     $data = JApplicationHelper::parseXMLInstallFile(JPATH_COMPONENT . DS . 'smfaq.xml');
     $this->assignRef('data', $data);
     require_once JPATH_COMPONENT . '/helpers/smfaq.php';
     SmFaqHelper::addSubmenu($this->_name);
     parent::display($tpl);
 }
Example #12
0
 public function isEnabled()
 {
     $path_to_xml = JPATH_ADMINISTRATOR . '/components/com_mtree/mtree.xml';
     if (JFile::exists($path_to_xml) && ($data = JApplicationHelper::parseXMLInstallFile($path_to_xml))) {
         return version_compare($data['version'], '2.1.3') >= 0;
     }
     return false;
 }
Example #13
0
 /**
  * If K2 is installed on the system
  *
  * @return boolean If K2 is installed on the system
  *
  * @since 2.0
  */
 public function isEnabled()
 {
     $path_to_xml = JPATH_ADMINISTRATOR . '/components/com_k2/';
     if (JFile::exists($path_to_xml . 'manifest.xml') and $data = JApplicationHelper::parseXMLInstallFile($path_to_xml . 'manifest.xml') or JFile::exists($path_to_xml . 'k2.xml') and $data = JApplicationHelper::parseXMLInstallFile($path_to_xml . 'k2.xml')) {
         return version_compare($data['version'], '2.1') >= 0;
     }
     return false;
 }
Example #14
0
 public function onAfterInitialise()
 {
     if (!($app = @(include JPATH_ADMINISTRATOR . '/components/com_widgetkit/widgetkit-app.php') and file_exists($path = JPATH_ADMINISTRATOR . '/components/com_k2/k2.xml') and JComponentHelper::getComponent('com_k2', true)->enabled and $data = JApplicationHelper::parseXMLInstallFile(JPATH_ADMINISTRATOR . '/components/com_k2/k2.xml') and version_compare($data['version'], '2.1', '>='))) {
         return;
     }
     $app['plugins']->addPath(__DIR__ . '/plugin/plugin.php');
     $app['locator']->addPath('plugins/content/k2', __DIR__ . '/plugin');
 }
Example #15
0
 function display($tpl = null)
 {
     global $option;
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     $client = JRequest::getWord('client', 'site');
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     JArrayHelper::toInteger($cid, array(0));
     $lists = array();
     $row =& JTable::getInstance('plugin');
     // load the row from the db table
     $row->load($cid[0]);
     // fail if checked out not by 'me'
     if ($row->isCheckedOut($user->get('id'))) {
         $msg = JText::sprintf('DESCBEINGEDITTED', JText::_('The plugin'), $row->title);
         $this->setRedirect('index.php?option=' . $option . '&client=' . $client, $msg, 'error');
         return false;
     }
     if ($client == 'admin') {
         $where = "client_id='1'";
     } else {
         $where = "client_id='0'";
     }
     // get list of groups
     if ($row->access == 99 || $row->client_id == 1) {
         $lists['access'] = 'Administrator<input type="hidden" name="access" value="99" />';
     } else {
         // build the html select list for the group access
         $lists['access'] = JHTML::_('list.accesslevel', $row);
     }
     if ($cid[0]) {
         $row->checkout($user->get('id'));
         if ($row->ordering > -10000 && $row->ordering < 10000) {
             // build the html select list for ordering
             $query = 'SELECT ordering AS value, name AS text' . ' FROM #__plugins' . ' WHERE folder = ' . $db->Quote($row->folder) . ' AND published > 0' . ' AND ' . $where . ' AND ordering > -10000' . ' AND ordering < 10000' . ' ORDER BY ordering';
             $order = JHTML::_('list.genericordering', $query);
             $lists['ordering'] = JHTML::_('select.genericlist', $order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval($row->ordering));
         } else {
             $lists['ordering'] = '<input type="hidden" name="ordering" value="' . $row->ordering . '" />' . JText::_('This plugin cannot be reordered');
         }
         $lang =& JFactory::getLanguage();
         $lang->load('plg_' . trim($row->folder) . '_' . trim($row->element), JPATH_ADMINISTRATOR);
         $data = JApplicationHelper::parseXMLInstallFile(JPATH_SITE . DS . 'plugins' . DS . $row->folder . DS . $row->element . '.xml');
         $row->description = $data['description'];
     } else {
         $row->folder = '';
         $row->ordering = 999;
         $row->published = 1;
         $row->description = '';
     }
     $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published);
     // get params definitions
     $params = new JParameter($row->params, JApplicationHelper::getPath('plg_xml', $row->folder . DS . $row->element), 'plugin');
     $this->assignRef('lists', $lists);
     $this->assignRef('plugin', $row);
     $this->assignRef('params', $params);
     parent::display($tpl);
 }
Example #16
0
 function _loadItems()
 {
     global $mainframe, $option, $rsgConfig;
     $db =& JFactory::getDBO();
     $clientInfo =& $rsgConfig->getClientInfo('site', true);
     $client = $clientInfo->name;
     $templateDirs = JFolder::folders($clientInfo->path . '/templates');
     for ($i = 0; $i < count($templateDirs); $i++) {
         $template = new stdClass();
         $template->folder = $templateDirs[$i];
         $template->client = $clientInfo->id;
         $template->baseDir = $clientInfo->path . '/templates';
         if ($this->_state->get('filter.string')) {
             if (strpos($template->folder, $this->_state->get('filter.string')) !== false) {
                 $templates[] = $template;
             }
         } else {
             $templates[] = $template;
         }
     }
     // Get a list of the currently active templates
     $inactiveList = array('meta');
     $rows = array();
     $rowid = 0;
     // Check that the directory contains an xml file
     foreach ($templates as $template) {
         $dirName = $template->baseDir . '/' . $template->folder;
         $xmlFilesInDir = JFolder::files($dirName, '.xml$');
         foreach ($xmlFilesInDir as $xmlfile) {
             $data = JApplicationHelper::parseXMLInstallFile($dirName . '/' . $xmlfile);
             $row = new StdClass();
             $row->id = $rowid;
             $row->client_id = $template->client;
             $row->directory = $template->folder;
             $row->baseDir = $template->baseDir;
             if ($data) {
                 foreach ($data as $key => $value) {
                     $row->{$key} = $value;
                 }
             }
             $row->isDisabled = in_array($row->directory, $inactiveList);
             $row->isDefault = $rsgConfig->get('template') == $template->folder;
             $row->checked_out = 0;
             $row->jname = JString::strtolower(str_replace(' ', '_', $row->name));
             $rows[] = $row;
             $rowid++;
         }
     }
     $this->setState('pagination.total', count($rows));
     if ($this->_state->get('pagination.limit') > 0) {
         $this->_items = array_slice($rows, $this->_state->get('pagination.offset'), $this->_state->get('pagination.limit'));
     } else {
         $this->_items = $rows;
     }
 }
Example #17
0
 /**
  * Get the current version
  * @return Version
  */
 function getVersion()
 {
     // Get Component xml
     $xml = JApplicationHelper::parseXMLInstallFile(WF_ADMINISTRATOR . DS . 'jce.xml');
     // return cleaned version number or date
     $version = preg_replace('/[^0-9a-z]/i', '', $xml['version']);
     if (!$version) {
         return date('Y-m-d', strtotime('today'));
     }
     return $version;
 }
Example #18
0
 public function display($tpl = null)
 {
     $component_xml = JApplicationHelper::parseXMLInstallFile(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_tracker' . DS . 'tracker.xml');
     JToolBarHelper::title(JText::_('COM_TRACKER_CONTROL_PANEL'), 'trackerpanel');
     $this->assignRef('component_info', $component_xml);
     // Set the toolbar
     $this->addToolbar();
     // Display the template
     parent::display($tpl);
     // Set the document
     $this->setDocument();
 }
    function showEndForm($params, $order)
    {
        $jshopConfig = JSFactory::getConfig();
        $item_name = sprintf(_JSHOP_PAYMENT_NUMBER, $order->order_number);
        $order->order_total = $this->fixOrderTotal($order);
        $data = array($params['user_id'], $params['project_id'], '', '', '', '', $order->order_total, $order->currency_code_iso, $item_name, '', $order->order_id, '', '', '', '', '', $params['project_password']);
        $data_implode = implode('|', $data);
        $hash = sha1($data_implode);
        $datajshopping = JApplicationHelper::parseXMLInstallFile($jshopConfig->admin_path . "jshopping.xml");
        ?>
        <form id="paymentform" action="https://www.sofortueberweisung.de/payment/start" name = "paymentform" method = "post">
        <input type='hidden' name='user_id' value='<?php 
        print $params['user_id'];
        ?>
' />
        <input type='hidden' name='project_id' value='<?php 
        print $params['project_id'];
        ?>
' />
        <input type="hidden" name="user_variable_0" value="<?php 
        print $order->order_id;
        ?>
">
        <input type='hidden' name='reason_1' value='<?php 
        print $item_name;
        ?>
' />
        <input type='hidden' name='amount' value='<?php 
        print $order->order_total;
        ?>
'/>
        <input type="hidden" name="currency_id" value="<?php 
        print $order->currency_code_iso;
        ?>
" />
        <input type='hidden' name='hash' value='<?php 
        print $hash;
        ?>
' />
		<input type='hidden' name='interface_version' value='joomshopping_<?php 
        print $datajshopping['version'];
        ?>
' />
        </form>
        <?php 
        print _JSHOP_REDIRECT_TO_PAYMENT_PAGE;
        ?>
        <br>
        <script type="text/javascript">document.getElementById('paymentform').submit();</script>
        <?php 
        die;
    }
Example #20
0
 function checkVersion()
 {
     $file = JPATH_PLUGINS . DS . 'system' . DS . 'jcemediabox.xml';
     if (!is_file($file)) {
         $file = JPATH_PLUGINS . DS . 'system' . 'jcemediabox' . DS . 'jcemediabox.xml';
     }
     $required = $this->get('_requires');
     if ($xml = JApplicationHelper::parseXMLInstallFile($file)) {
         if (version_compare($xml['version'], (int) $required, '<')) {
             echo '<p class="required">' . WFText::sprintf('WF_POPUPS_JCEMEDIABOX_VERSION_ERROR', $required) . '</p>';
         }
     }
 }
Example #21
0
	function _loadItems()
	{
		global $mainframe, $option;

		$db = &JFactory::getDBO();

		// Get the site languages
		$langBDir = JLanguage::getLanguagePath(JPATH_SITE);
		$langDirs = JFolder::folders($langBDir);

		for ($i=0; $i < count($langDirs); $i++)
		{
			$lang = new stdClass();
			$lang->folder = $langDirs[$i];
			$lang->baseDir = $langBDir;
			$languages[] = $lang;
		}
		$rows = array();
		$rowid = 0;
		foreach ($languages as $language)
		{
			$files = JFolder::files( $language->baseDir.DS.$language->folder, '\.(com_jce)\.xml$' );
			foreach ($files as $file)
			{
				$data = JApplicationHelper::parseXMLInstallFile($language->baseDir.DS.$language->folder.DS.$file);

				$row 			= new StdClass();
				$row->id 		= $rowid;
				$row->language 	= $language->baseDir.DS.$language->folder;

				// If we didn't get valid data from the xml file, move on...
				if (!is_array($data)) {
					continue;
				}

				// Populate the row from the xml meta file
				foreach($data as $key => $value) {
					$row->$key = $value;
				}
				$row->jname = JString::strtolower( str_replace( " ", "_", $row->name ) );
				$rows[] = $row;
				$rowid++;
			}
		}
		$this->setState('pagination.total', count($rows));
		if($this->_state->get('pagination.limit') > 0) {
			$this->_items = array_slice( $rows, $this->_state->get('pagination.offset'), $this->_state->get('pagination.limit') );
		} else {
			$this->_items = $rows;
		}
	}
Example #22
0
 function findExtensions()
 {
     $db =& JFactory::getDBO();
     $query = 'SELECT name' . ' FROM #__jce_plugins' . ' WHERE type = ' . $db->Quote('plugin');
     $db->setQuery($query);
     $plugins = $db->loadResultArray();
     /*$query = 'SELECT extension'
     		. ' FROM #__jce_extensions'
     		;
     		$db->setQuery($query);
     		$installed = $db->loadResultArray();*/
     $extensions = array();
     $language =& JFactory::getLanguage();
     foreach ($plugins as $plugin) {
         $xml = JCE_PLUGINS . DS . $plugin . DS . $plugin . '.xml';
         $ext = JCE_PLUGINS . DS . $plugin . DS . 'extensions';
         if (is_dir($ext) && file_exists($xml)) {
             $files = JFolder::files($ext, '\\.xml$', true, true);
             foreach ($files as $file) {
                 //if (!in_array(basename($file, '.xml'), $installed)) {
                 $data = JApplicationHelper::parseXMLInstallFile($file);
                 if (!is_array($data)) {
                     continue;
                 }
                 $extension = new StdClass();
                 // Populate the row from the xml meta file
                 foreach ($data as $key => $value) {
                     $extension->{$key} = $value;
                 }
                 $extension->id = '';
                 // Read the file to see if it's a valid XML file
                 $xml =& JFactory::getXMLParser('Simple');
                 if ($xml->loadFile($file)) {
                     if (is_object($xml->document) && $xml->document->attributes('type') == 'extension') {
                         $plugin = $xml->document->attributes('plugin');
                         $name = $xml->document->attributes('extension');
                         $extension->id = $plugin . '.' . $xml->document->attributes('folder') . '.' . $name;
                         $language->load('com_jce_' . trim($plugin), JPATH_SITE);
                         $language->load('com_jce_' . trim($plugin) . '_' . trim($name), JPATH_SITE);
                         $query = 'SELECT title' . ' FROM #__jce_plugins' . ' WHERE name = ' . $db->Quote($xml->document->attributes('plugin'));
                         $db->setQuery($query);
                         $extension->plugin = $db->loadResult();
                     }
                 }
                 $extensions[] = $extension;
                 //}
             }
         }
     }
     return $extensions;
 }
Example #23
0
 public function display($tpl = null)
 {
     // Fetch common objects from JFactory
     $application =& JFactory::getApplication();
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     $document =& JFactory::getDocument();
     $data = JApplicationHelper::parseXMLInstallFile(JPATH_COMPONENT . '/simplelists.xml');
     require_once JPATH_COMPONENT . '/helpers/update.php';
     $update = SimplelistsUpdate::getUpdate($data['authorUrl']);
     $this->assignRef('data', $data);
     $this->assignRef('update', $update);
     parent::display($tpl);
 }
Example #24
0
 function getXmlFile($row)
 {
     $baseDir = JPATH_ROOT . DS . 'plugins';
     $xmlfile = $baseDir . DS . $row->folder . DS . $row->element . ".xml";
     $result = new stdClass();
     if (file_exists($xmlfile)) {
         if ($data = JApplicationHelper::parseXMLInstallFile($xmlfile)) {
             foreach ($data as $key => $value) {
                 $result->{$key} = $value;
             }
         }
     }
     return $result;
 }
Example #25
0
 function _loadItems()
 {
     global $mainframe, $option;
     $db =& JFactory::getDBO();
     $and = null;
     if ($this->_state->get('filter.client') < 0) {
         if ($search = $this->_state->get('filter.string')) {
             $and = ' AND title LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
         }
     } else {
         if ($search = $this->_state->get('filter.string')) {
             $and = ' AND client_id = ' . (int) $this->_state->get('filter.client');
             $and .= ' AND title LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
         } else {
             $and = ' AND client_id = ' . (int) $this->_state->get('filter.client');
         }
     }
     $query = 'SELECT id, module, client_id, title, iscore' . ' FROM #__modules' . ' WHERE module LIKE "mod_%" ' . $and . ' GROUP BY module, client_id' . ' ORDER BY iscore, client_id, module';
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     $n = count($rows);
     for ($i = 0; $i < $n; $i++) {
         $row =& $rows[$i];
         // path to module directory
         if ($row->client_id == "1") {
             $moduleBaseDir = JPATH_ADMINISTRATOR . DS . "modules";
         } else {
             $moduleBaseDir = JPATH_SITE . DS . "modules";
         }
         // xml file for module
         $xmlfile = $moduleBaseDir . DS . $row->module . DS . $row->module . ".xml";
         if (file_exists($xmlfile)) {
             if ($data = JApplicationHelper::parseXMLInstallFile($xmlfile)) {
                 foreach ($data as $key => $value) {
                     $row->{$key} = $value;
                 }
             }
         }
     }
     $this->setState('pagination.total', $n);
     // if the offset is greater than the total, then can the offset
     if ($this->_state->get('pagination.offset') > $this->_state->get('pagination.total')) {
         $this->setState('pagination.offset', 0);
     }
     if ($this->_state->get('pagination.limit') > 0) {
         $this->_items = array_slice($rows, $this->_state->get('pagination.offset'), $this->_state->get('pagination.limit'));
     } else {
         $this->_items = $rows;
     }
 }
Example #26
0
 function getVersion($extension, $xml)
 {
     if (!$extension || !$xml) {
         return;
     }
     $version = '';
     if ($xml) {
         $xml = JApplicationHelper::parseXMLInstallFile(JPATH_SITE . DS . str_replace('/', DS, $xml));
         if ($xml && isset($xml['version'])) {
             $version = $xml['version'];
         }
     }
     return $version;
 }
Example #27
0
 /**
  * Method to get the field label.
  *
  * @return  string  A message containing the installed version and,
  *                  if necessary, information on a new version.
  *
  * @since   2.1
  */
 protected function getLabel()
 {
     // Get the module's XML
     $xmlfile = dirname(__DIR__) . '/mod_tweetdisplayback.xml';
     $data = JApplicationHelper::parseXMLInstallFile($xmlfile);
     $cacheFile = JPATH_CACHE . '/tweetdisplayback_update.json';
     // The module's version
     $version = $data['version'];
     // The target to check against
     $target = 'https://www.babdev.com/updates/TDB_version_new';
     // Get the module params
     $params = static::getModuleParams($this->form->getValue('id', null, 0));
     // Get the stability level we want to show data for
     $stability = $params->get('stability', 'stable');
     // Check if we have cached data and use it if unexpired
     if (!file_exists($cacheFile) || time() - @filemtime($cacheFile) > 86400) {
         // Get the data from remote
         $helper = new ModTweetDisplayBackHelper(new JRegistry());
         $data = $helper->getJSON($target);
         $update = $data->{$stability};
         // Write the cache if data exists
         if (isset($update->notice)) {
             $cache = json_encode($data);
             file_put_contents($cacheFile, $cache);
         }
     } else {
         // Render from the cached data
         $data = json_decode(file_get_contents($cacheFile));
         $update = $data->{$stability};
     }
     // Message containing the version
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $message = '<div class="alert alert-info">';
         $close = '</div>';
     } else {
         $message = '<label style="max-width:100%">';
         $close = '</label>';
     }
     $message .= JText::sprintf('MOD_TWEETDISPLAYBACK_VERSION_INSTALLED', $version);
     // Make sure that the $update object actually has data
     if (!isset($update->notice)) {
         $message .= '  ' . JText::_('MOD_TWEETDISPLAYBACK_VERSION_FAILED') . $close;
     } elseif (version_compare($update->version, $version, 'gt') && version_compare(JVERSION, $update->jversion, 'ge')) {
         $message .= '  <a href="' . $update->notice . '" target="_blank">' . JText::sprintf('MOD_TWEETDISPLAYBACK_VERSION_UPDATE', $update->version) . '</a></label>';
     } else {
         $message .= '  ' . JText::_('MOD_TWEETDISPLAYBACK_VERSION_CURRENT') . $close;
     }
     return $message;
 }
Example #28
0
 public function get()
 {
     jimport('joomla.application.helper');
     $xml = JApplicationHelper::parseXMLInstallFile(JPATH_COMPONENT_ADMINISTRATOR . '/api.xml');
     if (false == $xml) {
         $response = $this->getErrorResponse(400, JText::_('COM_API_UNEXPECTED_ERROR'));
     } else {
         $response = $this->getSuccessResponse(200, JText::_('COM_API_SUCCESS'));
         $response->version = $xml['version'];
         // Add version that it is also backward compatible with
         $response->compatible_from = '0.1';
         $response->compatbile_msg = '';
     }
     $this->plugin->setResponse($response);
 }
Example #29
0
 /**
  * import categories, venues and events from eventlist
  */
 public function importeventlist()
 {
     // find out eventlist version !
     // is eventlist installed ?
     if (file_exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_eventlist' . DS . 'eventlist.xml') && 0) {
         $data = JApplicationHelper::parseXMLInstallFile(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_eventlist' . DS . 'eventlist.xml');
         $version = $data['version'];
     } else {
         $tables = $this->_db->getTableList();
         if (in_array($this->_db->getPrefix() . 'eventlist_cats_event_relations', $tables)) {
             $version = '1.1';
         } else {
             if (in_array($this->_db->getPrefix() . 'eventlist_events', $tables)) {
                 $version = '1.0';
             } else {
                 $this->setError(JText::_('COM_REDEVENT_EVENTLIST_NOT_FOUND'));
                 return false;
             }
         }
     }
     // make sure redevent db is empty
     $query = ' SELECT COUNT(*) FROM #__redevent_events ';
     $this->_db->setQuery($query);
     $count = $this->_db->loadResult();
     if ($count) {
         $this->setError(JText::_('COM_REDEVENT_EVENTLIST_IMPORT_DB_NOT_EMPTY'));
         return false;
     }
     $query = ' SELECT COUNT(*) FROM #__redevent_categories ';
     $this->_db->setQuery($query);
     $count = $this->_db->loadResult();
     if ($count) {
         $this->setError(JText::_('COM_REDEVENT_EVENTLIST_IMPORT_DB_NOT_EMPTY'));
         return false;
     }
     $query = ' SELECT COUNT(*) FROM #__redevent_venues ';
     $this->_db->setQuery($query);
     $count = $this->_db->loadResult();
     if ($count) {
         $this->setError(JText::_('COM_REDEVENT_EVENTLIST_IMPORT_DB_NOT_EMPTY'));
         return false;
     }
     if (version_compare($version, '1.1.a') > 0) {
         return self::_importeventlist11();
     } else {
         return self::_importeventlist10();
     }
 }
Example #30
0
 public static function parseXMLTemplateFile($templateBaseDir, $templateDir)
 {
     $data = new JObject();
     // Check of the xml file exists
     $filePath = JPath::clean($templateBaseDir . '/templates/' . $templateDir . '/templateDetails.xml');
     if (is_file($filePath)) {
         $xml = JApplicationHelper::parseXMLInstallFile($filePath);
         if ($xml['type'] != 'template') {
             return false;
         }
         foreach ($xml as $key => $value) {
             $data->set($key, $value);
         }
     }
     return $data;
 }