public function store($updateNulls = false) { $isNew = false; if (!$this->id) { // New document $this->downloaded = 0; $isNew = true; } if (isset($this->alias) && isset($this->name) && $this->alias == "") { $this->alias = preg_replace("/ /", "-", strtolower($this->name)); } if (version_compare(JVERSION, '3.0', '>=')) { $this->alias = JApplicationHelper::stringURLSafe($this->alias); } else { $this->alias = JApplication::stringURLSafe($this->alias); } // Trigger events to osdownloads plugins $dispatcher = $this->getDispatcher(); $pluginResults = $dispatcher->trigger('onOSDownloadsBeforeSaveFile', array(&$this, $isNew)); $result = false; if ($pluginResults !== false) { $result = parent::store($updateNulls); $dispatcher->trigger('onOSDownloadsAfterSaveFile', array($result, &$this)); } return $result; }
/** * Sets an entire array of search paths for templates or resources. * * @access protected * @param string $type The type of path to set, typically 'template'. * @param string|array $path The new set of search paths. If null or * false, resets to the current directory only. */ function _setPath($type, $path) { $option = JApplicationHelper::getComponentName(); $app = JFactory::getApplication(); $extensions = JoomleagueHelper::getExtensions(JRequest::getInt('p')); if (!count($extensions)) { return parent::_setPath($type, $path); } // clear out the prior search dirs $this->_path[$type] = array(); // actually add the user-specified directories $this->_addPath($type, $path); // add extensions paths if (strtolower($type) == 'template') { foreach ($extensions as $e => $extension) { $JLGPATH_EXTENSION = JPATH_COMPONENT_SITE . '/extensions/' . $extension; // set the alternative template search dir if (isset($app)) { if ($app->isAdmin()) { $this->_addPath('template', $JLGPATH_EXTENSION . '/admin/views/' . $this->getName() . '/tmpl'); } else { $this->_addPath('template', $JLGPATH_EXTENSION . '/views/' . $this->getName() . '/tmpl'); } // always add the fallback directories as last resort $option = preg_replace('/[^A-Z0-9_\\.-]/i', '', $option); $fallback = JPATH_THEMES . '/' . $app->getTemplate() . '/html/' . $option . '/' . $extension . '/' . $this->getName(); $this->_addPath('template', $fallback); } } } }
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); }
/** * Returns a JPathway object * * @param string $client The name of the client * @param array $options An associative array of options * * @return JPathway A JPathway object. * * @since 1.5 * @throws RuntimeException */ public static function getInstance($client, $options = array()) { if (empty(self::$instances[$client])) { // Create a JPathway object $classname = 'JPathway' . ucfirst($client); if (!class_exists($classname)) { // @deprecated 4.0 Everything in this block is deprecated but the warning is only logged after the file_exists // Load the pathway object $info = JApplicationHelper::getClientInfo($client, true); if (is_object($info)) { $path = $info->path . '/includes/pathway.php'; if (file_exists($path)) { JLog::add('Non-autoloadable JPathway subclasses are deprecated, support will be removed in 4.0.', JLog::WARNING, 'deprecated'); include_once $path; } } } if (class_exists($classname)) { self::$instances[$client] = new $classname($options); } else { throw new RuntimeException(JText::sprintf('JLIB_APPLICATION_ERROR_PATHWAY_LOAD', $client), 500); } } return self::$instances[$client]; }
/** * Initialise the application. * * @param array $options An optional associative array of configuration settings. * * @return void * @since 1.5 */ public function initialise($options = array()) { $config = JFactory::getConfig(); // if a language was specified it has priority // otherwise use user or default language settings if (empty($options['language'])) { $user = JFactory::getUser(); $lang = $user->getParam('admin_language'); // Make sure that the user's language exists if ($lang && JLanguage::exists($lang)) { $options['language'] = $lang; } else { $params = JComponentHelper::getParams('com_languages'); $client = JApplicationHelper::getClientInfo($this->getClientId()); $options['language'] = $params->get($client->name, $config->get('language', 'es-LA')); } } // One last check to make sure we have something if (!JLanguage::exists($options['language'])) { $lang = $config->get('language', 'es-LA'); if (JLanguage::exists($lang)) { $options['language'] = $lang; } else { $options['language'] = 'es-LA'; // as a last ditch fail to english } } // Execute the parent initialise method. parent::initialise($options); // Load Library language $lang = JFactory::getLanguage(); $lang->load('lib_joomla', JPATH_ADMINISTRATOR, null, false, true); }
/** * Method to get a list of all the files to edit in a template. * * @return array A nested array of relevant files. * @since 1.6 */ public function getFiles() { // Initialise variables. $result = array(); if ($template = $this->getTemplate()) { jimport('joomla.filesystem.folder'); $client = JApplicationHelper::getClientInfo($template->client_id); $path = JPath::clean($client->path . '/templates/' . $template->element . '/'); $lang = JFactory::getLanguage(); // Load the core and/or local language file(s). $lang->load('tpl_' . $template->element, $client->path, null, false, false) || $lang->load('tpl_' . $template->element, $client->path . '/templates/' . $template->element, null, false, false) || $lang->load('tpl_' . $template->element, $client->path, $lang->getDefault(), false, false) || $lang->load('tpl_' . $template->element, $client->path . '/templates/' . $template->element, $lang->getDefault(), false, false); // Check if the template path exists. if (is_dir($path)) { $result['main'] = array(); $result['css'] = array(); $result['clo'] = array(); $result['mlo'] = array(); $result['html'] = array(); // Handle the main PHP files. $result['main']['index'] = $this->getFile($path, 'index.php'); $result['main']['error'] = $this->getFile($path, 'error.php'); $result['main']['print'] = $this->getFile($path, 'component.php'); $result['main']['offline'] = $this->getFile($path, 'offline.php'); // Handle the CSS files. $files = JFolder::files($path . '/css', '\\.css$', false, false); foreach ($files as $file) { $result['css'][] = $this->getFile($path . '/css/', 'css/' . $file); } } else { $this->setError(JText::_('COM_TEMPLATES_ERROR_TEMPLATE_FOLDER_NOT_FOUND')); return false; } } return $result; }
/** * Returns a reference to the global JRouter object, only creating it if it * doesn't already exist. * * This method must be invoked as: * <pre> $menu = &JRouter::getInstance();</pre> * * @access public * @param string $client The name of the client * @param array $options An associative array of options * @return JRouter A router object. */ function &getInstance($client, $options = array()) { static $instances; if (!isset($instances)) { $instances = array(); } if (empty($instances[$client])) { //Load the router object $info =& JApplicationHelper::getClientInfo($client, true); $classname = 'JRouter' . ucfirst($client); if (!class_exists($classname)) { $path = $info->path . DS . 'includes' . DS . 'router.php'; if (file_exists($path)) { require_once $path; } } if (!class_exists($classname)) { $error = JError::raiseError(500, 'Unable to load router: ' . $client); return $error; } $instance = new $classname($options); $instances[$client] =& $instance; } return $instances[$client]; }
/** * Current discovered extension list */ function _loadItems() { jimport('joomla.filesystem.folder'); /* Get a database connector */ $db =& JFactory::getDBO(); $query = 'SELECT *' . ' FROM #__extensions' . ' WHERE state = -1' . ' ORDER BY type, client_id, folder, name'; $db->setQuery($query); $rows = $db->loadObjectList(); $apps =& JApplicationHelper::getClientInfo(); $numRows = count($rows); for ($i = 0; $i < $numRows; $i++) { $row =& $rows[$i]; if (strlen($row->manifest_cache)) { $data = unserialize($row->manifest_cache); if ($data) { foreach ($data as $key => $value) { $row->{$key} = $value; } } } $row->jname = JString::strtolower(str_replace(" ", "_", $row->name)); if (isset($apps[$row->client_id])) { $row->client = ucfirst($apps[$row->client_id]->name); } else { $row->client = $row->client_id; } } $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; } }
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; } }
/** * 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; } }
/** * Method to get the field input markup. * * @return string The field input markup. * * @since 1.6 */ protected function getInput() { // Get the client id. $clientId = $this->element['client_id']; if (!isset($clientId)) { $clientName = $this->element['client']; if (isset($clientName)) { $client = JApplicationHelper::getClientInfo($clientName, true); $clientId = $client->id; } } if (!isset($clientId) && $this->form instanceof JForm) { $clientId = $this->form->getValue('client_id'); } $clientId = (int) $clientId; // Load the modal behavior script. JHtml::_('behavior.modal', 'a.modal'); // Build the script. $script = array(); $script[] = ' function jSelectPosition_' . $this->id . '(name) {'; $script[] = ' document.id("' . $this->id . '").value = name;'; $script[] = ' SqueezeBox.close();'; $script[] = ' }'; // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); // Setup variables for display. $html = array(); $link = 'index.php?option=com_modules&view=positions&layout=modal&tmpl=component&function=jSelectPosition_' . $this->id . '&client_id=' . $clientId; // The current user display field. $html[] = '<div class="input-append">'; $html[] = parent::getInput() . '<a class="btn modal" title="' . JText::_('COM_MODULES_CHANGE_POSITION_TITLE') . '" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 450}}">' . '<i class="icon-screenshot"></i> ' . JText::_('COM_MODULES_CHANGE_POSITION_BUTTON') . '</a>'; $html[] = '</div>'; return implode("\n", $html); }
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); }
function display($tpl = null) { /*Ověření, jestli jde o přístup z administrace nebo front-endu*/ $doc =& JFactory::getDocument(); if (JPATH_BASE == JPATH_ADMINISTRATOR) { require_once JApplicationHelper::getPath('toolbar_html'); TOOLBAR_mapping::_DEFAULT(); } else { echo '<div class="componentheading">' . JText::_('COM_MAPPING') . '</div>'; $doc->addStyleSheet('components/com_mapping/css/general.css'); $doc->addStyleSheet('components/com_mapping/css/component.css'); } /**/ echo '<h1>' . JText::_('MAPPING_FINALIZATION') . '</h1>'; echo '<p>' . JText::_('MAPPING_SAVED_INFO') . '</p>'; if ($this->redirectUrl) { echo '<p>' . JText::_('REDIRECT_INFO') . '</p>'; echo '<script type="text/javascript"> function redirectToUrl(){ location.href="' . $this->redirectUrl . '"; } var t=setTimeout("redirectToUrl();",5000); </script>'; } }
function getUnidades() { $joopoa_helper = JApplicationHelper::getPath('helper', 'com_joopoa'); require $joopoa_helper; $unidades =& JoopoaHelper::getUnidades(); return $unidades; }
/** * * Disable JT3 infomode * * @return: Save setting to file params.ini */ public function disableInfoMode() { JSNFactory::localimport('libraries.joomlashine.database'); $template = JSNDatabase::getDefaultTemplate(); $client = JApplicationHelper::getClientInfo($template->client_id); $file = $client->path . '/templates/' . $template->element . '/params.ini'; $data = JFile::read($file); $data = explode("\n", $data); $params = array(); $needChange = false; foreach ($data as $val) { $spos = strpos($val, "="); $key = substr($val, 0, $spos); $value = substr($val, $spos + 1, strlen($val) - $spos); if ($key == 'infomode') { if ($value == '"1"') { $value = '"0"'; $needChange = true; } } $params[$key] = $value; } if ($needChange) { $data = array(); foreach ($params as $key => $val) { $data[] = $key . '=' . $val; } $data = implode("\n", $data); if (JFile::exists($file)) { @chmod($file, 0777); } JFile::write($file, $data); } }
function __construct(JXMLElement $element = null) { if ($element && is_a($element, 'JXMLElement')) { $this->type = (string) $element->attributes()->type; $this->id = (string) $element->attributes()->id; switch ($this->type) { case 'component': // by default a component doesn't have anything break; case 'module': case 'template': case 'language': $this->client = (string) $element->attributes()->client; $this->client_id = JApplicationHelper::getClientInfo($this->client, 1); $this->client_id = $this->client_id->id; break; case 'plugin': $this->group = (string) $element->attributes()->group; break; default: // catch all // get and set client and group if we don't recognise the extension if ($client = (string) $element->attributes()->client) { $this->client_id = JApplicationHelper::getClientInfo($this->client, 1); $this->client_id = $this->client_id->id; } if ($group = (string) $element->attributes()->group) { $this->group = (string) $element->attributes()->group; } break; } $this->filename = (string) $element; } }
/** * Returns a reference to a JMenu object * * This method must be invoked as: * <pre> $menu = &JSite::getMenu();</pre> * * @access public * @param string $client The name of the client * @param array $options An associative array of options * @return JMenu A menu object. * @since 1.5 */ function &getInstance($client, $options = array()) { static $instances; if (!isset($instances)) { $instances = array(); } if (empty($instances[$client])) { //Load the router object $info =& JApplicationHelper::getClientInfo($client, true); $path = $info->path . DS . 'includes' . DS . 'menu.php'; if (file_exists($path)) { require_once $path; // Create a JPathway object $classname = 'JMenu' . ucfirst($client); $instance = new $classname($options); } else { //$error = JError::raiseError( 500, 'Unable to load menu: '.$client); $error = null; //Jinx : need to fix this return $error; } $instances[$client] =& $instance; } return $instances[$client]; }
/** * Method to perform sanity checks on the JTable instance properties to ensure * they are safe to store in the database. Child classes should override this * method to make sure the data they are storing in the database is safe and * as expected before storage. * * @return boolean True if the instance is sane and able to be stored in the database. * * @since 2.5 */ public function check() { try { parent::check(); } catch (\Exception $e) { $this->setError($e->getMessage()); return false; } if (trim($this->alias) == '') { $this->alias = $this->title; } $this->alias = JApplicationHelper::stringURLSafe($this->alias); if (trim(str_replace('-', '', $this->alias)) == '') { $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); } $params = new Registry($this->params); $nullDate = $this->_db->getNullDate(); $d1 = $params->get('d1', $nullDate); $d2 = $params->get('d2', $nullDate); // Check the end date is not earlier than the start date. if ($d2 > $nullDate && $d2 < $d1) { // Swap the dates. $params->set('d1', $d2); $params->set('d2', $d1); $this->params = (string) $params; } return true; }
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 listslanguagesType() { jimport('joomla.filesystem.folder'); $path = JLanguage::getLanguagePath(JPATH_ROOT); $dirs = JFolder::folders($path); $this->languages = array(); foreach ($dirs as $dir) { if (strlen($dir) != 5 || $dir == "xx-XX") { continue; } $xmlFiles = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$'); $xmlFile = reset($xmlFiles); if (empty($xmlFile)) { continue; } $data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $xmlFile); $oneLanguage = new stdClass(); $oneLanguage->language = strtolower($dir); $oneLanguage->name = empty($data['name']) ? $dir : $data['name']; $this->languages[] = $oneLanguage; } if (count($this->languages) < 2) { return; } $this->multipleLang = true; $this->choice = array(); $this->choice[] = JHTML::_('select.option', 'all', JText::_('ACY_ALL')); $this->choice[] = JHTML::_('select.option', 'special', JText::_('ACY_CUSTOM')); $js = "function updateLanguages(){\n\t\t\tchoice = eval('document.adminForm.choice_languages');\n\t\t\tchoiceValue = 'special';\n\t\t\tfor (var i=0; i < choice.length; i++){\n\t\t\t\t if (choice[i].checked){\n\t\t\t\t\t choiceValue = choice[i].value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\thiddenVar = document.getElementById('hidden_languages');\n\t\t\tif(choiceValue != 'special'){\n\t\t\t\thiddenVar.value = choiceValue;\n\t\t\t\tdocument.getElementById('div_languages').style.display = 'none';\n\t\t\t}else{\n\t\t\t\tdocument.getElementById('div_languages').style.display = 'block';\n\t\t\t\tspecialVar = eval('document.adminForm.special_languages');\n\t\t\t\tfinalValue = '';\n\t\t\t\tfor (var i=0; i < specialVar.length; i++){\n\t\t\t\t\tif (specialVar[i].checked){\n\t\t\t\t\t\t\t finalValue += specialVar[i].value+',';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\thiddenVar.value = finalValue;\n\t\t\t}\n\n\t\t}"; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($js); }
/** * 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; }
/** * Retrieve Kunena version from manifest.xml * * @return string version */ function versionXML() { if ($data = JApplicationHelper::parseXMLInstallFile(KUNENA_FILE_INSTALL)) { return $data['version']; } return 'ERROR'; }
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 ''; } }
/** * Initialise the application. * * @access public */ function initialise( $options = array()) { // if a language was specified it has priority // otherwise use user or default language settings if (empty($options['language'])) { $user = & JFactory::getUser(); $lang = $user->getParam( 'language' ); // Make sure that the user's language exists if ( $lang && JLanguage::exists($lang) ) { $options['language'] = $lang; } else { $params = JComponentHelper::getParams('com_extensions'); $client =& JApplicationHelper::getClientInfo($this->getClientId()); $options['language'] = $params->get('language_'.$client->name, 'en-GB'); } } // One last check to make sure we have something if ( ! JLanguage::exists($options['language']) ) { $options['language'] = 'en-GB'; } parent::initialise($options); }
function display($tpl = null) { global $mainframe; // we need to add these paths so the component can work in both site and administrator $this->addTemplatePath(dirname(__FILE__) . DS . 'tmpl'); // client information (site, administrator, ... ) jimport('joomla.application.helper'); $client = JApplicationHelper::getClientInfo($mainframe->getClientID()); // make sure we only show the component JRequest::setVar('tmpl', 'component'); $document =& JFactory::getDocument(); $document->setTitle('J!Dump - ' . ucfirst($client->name)); $document->addScriptDeclaration("var imageFolder = '" . DUMP_URL . "assets/images/'"); // Path to images $document->addStyleSheet(DUMP_URL . 'assets/css/folder-tree-static.css'); $document->addStyleSheet(DUMP_URL . 'assets/css/dump.css'); $document->addScript(DUMP_URL . 'assets/js/folder-tree-static.js'); $document->addScript(DUMP_URL . 'assets/js/dump.js'); // render tree and assign to template $tree =& $this->renderTree(); $this->assignRef('tree', $tree); $this->assignRef('application', $client->name); $this->assign('version', DUMP_VERSION); $this->assign('closebutton', JRequest::getVar('closebutton', 1)); parent::display($tpl); }
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; } }
/** * Method to get the list of template style options * grouped by template. * Use the client attribute to specify a specific client. * Use the template attribute to specify a specific template * * @return array The field option objects as a nested array in groups. * * @since 11.1 */ protected function getGroups() { // Initialize variables. $groups = array(); $lang = JFactory::getLanguage(); // Get the client and client_id. $clientName = $this->element['client'] ? (string) $this->element['client'] : 'site'; $client = JApplicationHelper::getClientInfo($clientName, true); // Get the template. $template = (string) $this->element['template']; // Get the database object and a new query object. $db = JFactory::getDBO(); $query = $db->getQuery(true); // Build the query. $query->select('s.id, s.title, e.name as name, s.template'); $query->from('#__template_styles as s'); $query->where('s.client_id = ' . (int) $client->id); $query->order('template'); $query->order('title'); if ($template) { $query->where('s.template = ' . $db->quote($template)); } $query->join('LEFT', '#__extensions as e on e.element=s.template'); $query->where('e.enabled=1'); // Set the query and load the styles. $db->setQuery($query); $styles = $db->loadObjectList(); // Build the grouped list array. if ($styles) { foreach ($styles as $style) { $template = $style->template; $lang->load('tpl_' . $template . '.sys', $client->path, null, false, false) || $lang->load('tpl_' . $template . '.sys', $client->path . '/templates/' . $template, null, false, false) || $lang->load('tpl_' . $template . '.sys', $client->path, $lang->getDefault(), false, false) || $lang->load('tpl_' . $template . '.sys', $client->path . '/templates/' . $template, $lang->getDefault(), false, false); $name = JText::_($style->name); // Initialize the group if necessary. if (!isset($groups[$name])) { $groups[$name] = array(); } $groups[$name][] = JHtml::_('select.option', $style->id, $style->title); } } // Merge any additional groups in the XML definition. $groups = array_merge(parent::getGroups(), $groups); return $groups; }
function display($tpl = null) { /*Ověření, jestli jde o přístup z administrace nebo front-endu*/ if (JPATH_BASE == JPATH_ADMINISTRATOR) { require_once JApplicationHelper::getPath('toolbar_html'); TOOLBAR_ginclude::_DEFAULT(); } else { echo '<div class="componentheading">' . JText::_('GINCLUDE-UPDATE') . '</div>'; $doc =& JFactory::getDocument(); $doc->addStyleSheet('components/com_ginclude/css/general.css'); $doc->addStyleSheet('components/com_ginclude/css/component.css'); } /**/ $model = $this->getModel(); echo '<div>' . JText::_('RELOAD_PARTS_ABOUT') . '</div>'; /*css*/ $doc =& JFactory::getDocument(); $declaration = "div.oldDiv {background-color:#F0C0FF;border:2px solid red;color:black;}\r\n div.newDiv {background-color:#C0FFA0;border:2px solid green;color:black;}\r\n hr#system-readmore {border:1px dotted red;}\r\n div.radioDiv {background-color:#ECECEC;border:2px solid black;padding:2px;color:black;}"; $doc->addStyleDeclaration($declaration); $article = $model->getArticleDB($this->articleId); $article = $article[0]; echo '<div style="padding-left:10px;"><h2>' . $article->title . '</h2></div>'; echo '<form action="index.php?option=com_ginclude&task=reloadPartsSave" method="post"> <input type="hidden" name="article" value="' . $this->articleId . '" /> <div style="padding:10px;margin:5px;border:1px dotted gray;">'; /*vypsani dat z modelu*/ echo $model->getPartsView($this->articleId); echo '</div><div style="padding:10px;"><input type="submit" value="' . JText::_('SAVE_ARTICLE_CHANGES') . '" /></div>'; echo '</form>'; }
/** * Returns a JMenu object * * @param string $client The name of the client * @param array $options An associative array of options * * @return JMenu A menu object. * * @since 11.1 */ public static function getInstance($client, $options = array()) { static $instances; if (!isset($instances)) { $instances = array(); } if (empty($instances[$client])) { //Load the router object $info = JApplicationHelper::getClientInfo($client, true); $path = $info->path . '/includes/menu.php'; if (file_exists($path)) { include_once $path; // Create a JPathway object $classname = 'JMenu' . ucfirst($client); $instance = new $classname($options); } else { //$error = JError::raiseError(500, 'Unable to load menu: '.$client); //TODO: Solve this $error = null; return $error; } $instances[$client] =& $instance; } return $instances[$client]; }
public function display($tpl = null) { JToolBarHelper::title(JText::_('Template Manager'), 'thememanager'); JToolBarHelper::custom('edit', 'back.png', 'back_f2.png', 'Back', false, false); require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'templates.php'; // Initialise some variables $option = JRequest::getCmd('option'); $id = JRequest::getVar('id', '', 'method', 'int'); $template = TemplatesHelper::getTemplateName($id); $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); $tp = true; $url = $client->id ? JURI::base() : JURI::root(); if (!$template) { return JError::raiseWarning(500, JText::_('Template not specified')); } // Set FTP credentials, if given jimport('joomla.client.helper'); JClientHelper::setCredentialsFromRequest('ftp'); $this->assignRef('option', $option); $this->assignRef('client', $client); $this->assignRef('id', $id); $this->assignRef('template', $template); $this->assignRef('tp', $tp); $this->assignRef('url', $url); parent::display($tpl); }