public function load($config) { if (!array_key_exists('component', $config)) { self::$component = $config['extensionName']; } else { self::$component = $config['component']; } if (!array_key_exists('key', $config)) { self::$key = 'liveupdate'; } else { self::$key = $config['key']; } jimport('joomla.html.parameter'); jimport('joomla.application.component.helper'); // Not using JComponentHelper to avoid conflicts ;) $db = JFactory::getDbo(); if (version_compare(JVERSION, '1.6.0', 'ge')) { $sql = $db->getQuery(true)->select($db->nq('params'))->from($db->nq('#__extensions'))->where($db->nq('type') . ' = ' . $db->q('component'))->where($db->nq('element') . ' = ' . $db->q(self::$component)); } else { $sql = 'SELECT ' . $db->nameQuote('params') . ' FROM ' . $db->nameQuote('#__components') . ' WHERE ' . $db->nameQuote('option') . ' = ' . $db->Quote(self::$component) . " AND `parent` = 0 AND `menuid` = 0"; } $db->setQuery($sql); $rawparams = $db->loadResult(); if (version_compare(JVERSION, '1.6.0', 'ge')) { $params = new JRegistry(); $params->loadJSON($rawparams); } else { $params = new JParameter($rawparams); } $data = $params->getValue(self::$key, ''); jimport('joomla.registry.registry'); self::$registry = new JRegistry('update'); self::$registry->loadINI($data); }
/** * Get user state from database. * * @param string $param property name * @return string */ public static function getUserState($param) { if (isset($_COOKIE['joomdoc'])) { $db = JFactory::getDbo(); $db->setQuery('SELECT `params` FROM `#__joomdoc_userstate` WHERE `session` = ' . (int) $_COOKIE['joomdoc']); $params = new JParameter($db->loadResult()); return $params->getValue($param); } return null; }
function display($tpl = null) { $app = JFactory::getApplication(); $user = JFactory::getUser(); JHTML::_('behavior.tooltip'); //get vars $cid = JRequest::getVar('cid'); $field_type = JRequest::getVar('field_type', 0); //Get data from the model $model = $this->getModel(); if (FLEXI_J16GE) { $form = $this->get('Form'); } else { $row =& $this->get('Field'); //Import File system jimport('joomla.filesystem.file'); // Create the form $pluginpath = JPATH_PLUGINS . DS . 'flexicontent_fields' . DS . $field_type . '.xml'; if (JFile::exists($pluginpath)) { $form = new JParameter('', $pluginpath); } else { $form = new JParameter('', JPATH_PLUGINS . DS . 'flexicontent_fields' . DS . 'core.xml'); } $form->loadINI($row->attribs); } $isnew = FLEXI_J16GE ? !$form->getValue('id') : !$row->id; // fail if checked out not by 'me' if (!$isnew) { if ($model->isCheckedOut($user->get('id'))) { JError::raiseWarning('SOME_ERROR_CODE', $row->name . ' ' . JText::_('FLEXI_EDITED_BY_ANOTHER_ADMIN')); $app->redirect('index.php?option=com_flexicontent&view=fields'); } } if ($field_type) { if (!FLEXI_J16GE) { echo $form->render('params', 'group-' . $field_type); } else { foreach ($form->getFieldset('group-' . $field_type) as $field) { echo '<fieldset class="panelform">' . $field->label . $field->input . '</fieldset>' . "\n"; } } } else { echo "<br /><span style=\"padding-left:25px;\"'>" . JText::_('FLEXI_APPLY_TO_SEE_THE_PARAMETERS') . "</span><br /><br />"; } //parent::display($tpl); }
function routeJFRule($router, &$uri) { $registry = JFactory::getConfig(); $multilingual_support = $registry->getValue("config.multilingual_support", false); $jfLang = $registry->getValue("joomfish.language", false); if ($multilingual_support && $jfLang) { if ($uri->getVar("lang", "") == "") { $uri->setVar("lang", $jfLang->shortcode != '' ? $jfLang->shortcode : $jfLang->iso); } // this is dependent on Joomfish router being first!! $lang = $uri->getVar("lang", ""); $conf = JFactory::getConfig(); // This may not ready at this stage $params = $conf->getValue("jfrouter.params"); // so load plugin parameters directly if (is_null($params)) { $params = JPluginHelper::getPlugin("system", "jfrouter"); $params = new JParameter($params->params); } $sefordomain = $params->get("sefordomain", "sefprefix"); if ($sefordomain == "domain") { // If I set config_live_site I actually don't need this function at all let alone this logic ? Apart from language switcher. // TODO cache the indexed array $rawsubdomains = $params->getValue("sefsubdomain", array()); $subdomains = array(); $jfm = JoomFishManager::getInstance(); $langs = $jfm->getLanguagesIndexedById(); foreach ($rawsubdomains as $domain) { list($langid, $domain) = explode("::", $domain, 2); $domain = strtolower(str_replace("http://", "", $domain)); $domain = str_replace("https://", "", $domain); $domain = preg_replace("#/\$#", "", $domain); //$domain = str_replace("/","",$domain); $subdomains[$langs[$langid]->shortcode] = $domain; } if (array_key_exists($lang, $subdomains)) { $uri->setHost($subdomains[$lang]); $uri->delVar("lang"); $registry->setValue("joomfish.sef_host", $subdomains[$lang]); plgSystemJFRouter::procesCustomBuildRule($router, $uri); return; } } else { // Get the path data $route = $uri->getPath(); //Add the suffix to the uri if ($router->_mode == JROUTER_MODE_SEF && $route && !$lang !== "") { $jfm = JoomFishManager::getInstance(); $jfLang = $jfm->getLanguageByShortcode($lang); if (!$jfLang) { return; } $sefprefixes = $params->getValue("sefprefixes", array()); // Workaround if some language prefixes are missing $langs = $jfm->getLanguagesIndexedById(); if (!is_array($sefprefixes)) { $sefprefixes = array(); } if (count($sefprefixes) < count($langs)) { foreach ($sefprefixes as $prefix) { list($langid, $prefix) = explode("::", $prefix, 2); if (array_key_exists($langid, $langs)) { $langs[$langid]->hasprefix = true; } } foreach ($langs as $lang) { if (!isset($lang->hasprefix)) { $sefprefixes[] = $lang->lang_id . "::" . $lang->sef; } } } foreach ($sefprefixes as $prefix) { list($langid, $prefix) = explode("::", $prefix, 2); if ($jfLang->lang_id == $langid) { $uri->setPath($uri->getPath() . "/" . $prefix); $uri->delVar("lang"); plgSystemJFRouter::procesCustomBuildRule($router, $uri); return; } } } } } return; }
function renderInstalledPaymentPlugins($selected) { if (JVM_VERSION === 1) { $table = '#__plugins'; $ext_id = 'id'; $enable = 'published'; } else { $table = '#__extensions'; $ext_id = 'extension_id'; $enable = 'enabled'; } $db = JFactory::getDBO(); //Todo speed optimize that, on the other hand this function is NOT often used and then only by the vendors // $q = 'SELECT * FROM #__plugins as pl JOIN `#__virtuemart_payment_method` AS pm ON `pl`.`id`=`pm`.`payment_jplugin_id` WHERE `folder` = "vmpayment" AND `published`="1" '; // $q = 'SELECT * FROM #__plugins as pl,#__virtuemart_payment_method as pm WHERE `folder` = "vmpayment" AND `published`="1" AND pl.id=pm.payment_jplugin_id'; $q = 'SELECT * FROM `' . $table . '` WHERE `folder` = "vmpayment" and `state`="0" AND `element`<>"moneybookers" ORDER BY `ordering`,`name` ASC'; $db->setQuery($q); $result = $db->loadAssocList($ext_id); if (empty($result)) { $app = JFactory::getApplication(); $app->enqueueMessage(JText::_('COM_VIRTUEMART_NO_PAYMENT_PLUGINS_INSTALLED')); } $listHTML = '<select id="payment_jplugin_id" name="payment_jplugin_id" style= "width: 300px;">'; if (!class_exists('JParameter')) { require JPATH_VM_LIBRARIES . DS . 'joomla' . DS . 'html' . DS . 'parameter.php'; } foreach ($result as $paym) { $params = new JParameter($paym['params']); if ($paym[$ext_id] == $selected) { $checked = 'selected="selected"'; } else { $checked = ''; } // Get plugin info $pType = $params->getValue('pType'); if ($pType == 'Y' || $pType == 'C') { $id = 'pam_type_CC_on'; } else { $id = 'pam_type_CC_off'; } $listHTML .= '<option id="' . $id . '" ' . $checked . ' value="' . $paym[$ext_id] . '">' . JText::_($paym['name']) . '</option>'; } $listHTML .= '</select>'; return $listHTML; }
function display($tpl = null) { //initialise variables $app = JFactory::getApplication(); $user = JFactory::getUser(); //JHTML::_('behavior.tooltip'); //get vars $cid = JRequest::getVar('cid'); $field_type = JRequest::getVar('field_type', 0); //Get data from the model $model = $this->getModel(); $form = $this->get('Form'); if (!FLEXI_J16GE) { $row =& $this->get('Field'); //Import File system jimport('joomla.filesystem.file'); // Create the form $pluginpath = JPATH_PLUGINS . DS . 'flexicontent_fields' . DS . $field_type . '.xml'; if (JFile::exists($pluginpath)) { $form = new JParameter('', $pluginpath); } else { $form = new JParameter('', JPATH_PLUGINS . DS . 'flexicontent_fields' . DS . 'core.xml'); } $form->loadINI($row->attribs); } $isnew = FLEXI_J16GE ? !$form->getValue('id') : !$row->id; // fail if checked out not by 'me' if (!$isnew) { if ($model->isCheckedOut($user->get('id'))) { JError::raiseWarning('SOME_ERROR_CODE', $row->name . ' ' . JText::_('FLEXI_EDITED_BY_ANOTHER_ADMIN')); $app->redirect('index.php?option=com_flexicontent&view=fields'); } } /*if ($field_type) { if (!FLEXI_J16GE) { echo $form->render('params', 'group-' . $field_type ); } else { foreach ($form->getFieldset('group-' . $field_type) as $field) { echo '<fieldset class="panelform">' . $field->label . $field->input . '</fieldset>' . "\n"; } } } else { echo "<br /><span style=\"padding-left:25px;\"'>" . JText::_( 'FLEXI_APPLY_TO_SEE_THE_PARAMETERS' ) . "</span><br /><br />"; }*/ ?> <div class="fctabber fields_tabset" id="field_specific_props_tabset"> <?php $fieldSets = $form->getFieldsets('attribs'); $prefix_len = strlen('group-' . $field_type . '-'); foreach ($fieldSets as $name => $fieldSet) { if ($name != 'basic' && $name != 'standard' && (substr($name, 0, $prefix_len) != 'group-' . $field_type . '-' || $name === 'group-' . $field_type)) { continue; } if ($fieldSet->label) { $label = JText::_($fieldSet->label); } else { $label = $name == 'basic' || $name == 'standard' ? JText::_('FLEXI_BASIC') : ucfirst(str_replace("group-", "", $name)); } if (@$fieldSet->label_prefix) { $label = JText::_($fieldSet->label_prefix) . ' - ' . $label; } $icon = @$fieldSet->icon_class ? 'data-icon-class="' . $fieldSet->icon_class . '"' : ''; $prepend = @$fieldSet->prepend_text ? 'data-prefix-text="' . JText::_($fieldSet->prepend_text) . '"' : ''; $description = $fieldSet->description ? JText::_($fieldSet->description) : ''; ?> <div class="tabbertab" id="fcform_tabset_<?php echo $name; ?> _tab" <?php echo $icon; ?> <?php echo $prepend; ?> > <h3 class="tabberheading hasTooltip" title="<?php echo $description; ?> "><?php echo $label; ?> </h3> <?php $i = 0; ?> <?php foreach ($form->getFieldset($name) as $field) { $_depends = FLEXI_J30GE ? $field->getAttribute('depend_class') : $form->getFieldAttribute($field->__get('fieldname'), 'depend_class', '', 'attribs'); echo ' <fieldset class="panelform' . ($i ? '' : ' fc-nomargin') . ' ' . ($_depends ? ' ' . $_depends : '') . '" id="' . $field->id . '-container"> ' . ($field->label ? ' <span class="label-fcouter">' . str_replace('class="', 'class="label label-fcinner ', $field->label) . '</span> <div class="container_fcfield">' . $field->input . '</div> ' : $field->input) . ' </fieldset> '; $i++; } ?> </div> <?php } ?> </div> <?php //parent::display($tpl); }
function removeOnePhotoActivity($app, $uniqueId, $datetime, $photoId, $thumbnail) { $db = JFactory::getDBO(); $query = 'SELECT * FROM ' . $db->nameQuote('#__community_activities') . ' ' . 'WHERE ' . $db->nameQuote('app') . '=' . $db->Quote($app) . ' ' . 'AND ' . $db->nameQuote('cid') . '=' . $db->Quote($uniqueId) . ' ' . 'AND ( ' . $db->nameQuote('created') . ' BETWEEN ' . $db->Quote($datetime) . ' ' . 'AND ( ADDTIME(' . $db->Quote($datetime) . ', ' . $db->Quote('00:00:05') . ' ) ) ) '; $db->setQuery($query); $result = $db->loadObjectList(); if ($db->getErrorNum()) { JError::raiseError(500, $db->stderr()); } $activityId = null; $handler = new JParameter(null); // the activity data contains photoid and the photo thumbnail // which can be useful for us to find the correct activity id foreach ($result as $activity) { $handler->loadINI($activity->params); if ($handler->getValue('photoid') == $photoId) { $activityId = $activity->id; break; } if (JString::strpos($activity->content, $thumbnail) !== false) { $activityId = $activity->id; break; } } if (is_null($activityId)) { return $this->removeOneActivity($app, $uniqueId); } $query = 'DELETE FROM ' . $db->nameQuote('#__community_activities') . ' ' . 'WHERE ' . $db->nameQuote('id') . '=' . $db->Quote($activityId) . ' ' . 'LIMIT 1 '; $db->setQuery($query); $status = $db->query(); if ($db->getErrorNum()) { JError::raiseError(500, $db->stderr()); } return $status; }
/** * Fetch username/password and Download ID from the component's configuration. */ private function populateAuthorization() { if (!$this->_requiresAuthorization) { return; } if (substr($this->_extensionName, 0, 3) != 'com') { return; } jimport('joomla.html.parameter'); jimport('joomla.application.component.helper'); // Not using JComponentHelper to avoid conflicts ;) $db = JFactory::getDbo(); if (version_compare(JVERSION, '1.6.0', 'ge')) { $sql = $db->getQuery(true)->select($db->nq('params'))->from($db->nq('#__extensions'))->where($db->nq('type') . ' = ' . $db->q('component'))->where($db->nq('element') . ' = ' . $db->q($this->_extensionName)); } else { $sql = 'SELECT ' . $db->nameQuote('params') . ' FROM ' . $db->nameQuote('#__components') . ' WHERE ' . $db->nameQuote('option') . ' = ' . $db->Quote($this->_extensionName) . " AND `parent` = 0 AND `menuid` = 0"; } $db->setQuery($sql); $rawparams = $db->loadResult(); if (version_compare(JVERSION, '1.6.0', 'ge')) { $params = new JRegistry(); $params->loadJSON($rawparams); } else { $params = new JParameter($rawparams); } $this->_username = $params->getValue('username', ''); $this->_password = $params->getValue('password', ''); $this->_downloadID = $params->getValue('downloadid', ''); }
/** * Fetch username/password and Download ID from the component's configuration. */ private function populateAuthorization() { if (!$this->_requiresAuthorization) { return; } if (substr($this->_extensionName, 0, 3) != 'com') { return; } jimport('joomla.html.parameter'); jimport('joomla.application.component.helper'); $component =& JComponentHelper::getComponent($this->_extensionName); $params = new JParameter($component->params); $this->_username = $params->getValue('username', ''); $this->_password = $params->getValue('password', ''); $this->_downloadID = $params->getValue('downloadid', ''); }