private function getModuleParams($moduleId) { static $params; if (!isset($params)) { $app = JFactory::getApplication(); $clientid = (int) $app->getClientId(); $userAccessLevels = JoaktreeHelper::getUserAccessLevels(); if (!isset($moduleId) || $moduleId == 0) { $moduleId = JoaktreeHelper::getModuleId(); } else { $moduleId = (int) $moduleId; } $query = $this->_db->getQuery(true); $query->select(' m.id '); $query->select(' m.params '); $query->from(' #__modules AS m '); $query->where(' m.published = 1 '); $query->where(' m.access IN ' . $userAccessLevels . ' '); $query->where(' m.client_id = ' . $clientid . ' '); $query->where(' m.module = ' . $this->_db->Quote('mod_joaktree_todaymanyyearsago') . ' '); $this->_db->setQuery($query); $temp = $this->_db->loadObjectList(); $params = new JRegistry(); foreach ($temp as $module) { if ($module->id == $moduleId) { $params->loadString($module->params, 'JSON'); } } } return $params; }
/** * Get language items and store them in an array * */ function getTrans($lang, $item) { $app = JFactory::getApplication(); $option = 'com_osmembership'; $registry = new JRegistry(); $languages = array(); if (strpos($item, 'admin.') !== false) { $isAdmin = true; $item = substr($item, 6); } else { $isAdmin = false; } if ($isAdmin) { $path = JPATH_ROOT . '/administrator/language/en-GB/en-GB.' . $item . '.ini'; } else { $path = JPATH_ROOT . '/language/en-GB/en-GB.' . $item . '.ini'; } $registry->loadFile($path, 'INI'); $languages['en-GB'][$item] = $registry->toArray(); if ($isAdmin) { $path = JPATH_ROOT . '/administrator/language/' . $lang . '/' . $lang . '.' . $item . '.ini'; } else { $path = JPATH_ROOT . '/language/' . $lang . '/' . $lang . '.' . $item . '.ini'; } $search = $app->getUserStateFromRequest($option . 'search', 'search', '', 'string'); $search = JString::strtolower($search); if (JFile::exists($path)) { $registry->loadFile($path, 'INI'); $languages[$lang][$item] = $registry->toArray(); } else { $languages[$lang][$item] = array(); } return $languages; }
/** * Prepare content method * * Method is called by the view * * @param string $context The context of the content being passed to the plugin. * @param object &$row The article object. Note $article->text is also available * @param object &$params The article params * @param int $page The 'page' number * * @return void */ public function onContentPrepare($context, &$row, &$params, $page = 0) { jimport('joomla.html.parameter'); jimport('joomla.filesystem.file'); // Load fabrik language $lang = JFactory::getLanguage(); $lang->load('com_fabrik', JPATH_BASE . '/components/com_fabrik'); if (!defined('COM_FABRIK_FRONTEND')) { JError::raiseError(400, JText::_('COM_FABRIK_SYSTEM_PLUGIN_NOT_ACTIVE')); } // Get plugin info $plugin = JPluginHelper::getPlugin('content', 'fabrik'); // $$$ hugh had to rename this, it was stomping on com_content and friends $params // $$$ which is passed by reference to us! $fparams = new JRegistry($plugin->params); // Simple performance check to determine whether bot should process further $botRegex = $fparams->get('Botregex') != '' ? $fparams->get('Botregex') : 'fabrik'; if (JString::strpos($row->text, $botRegex) === false) { return true; } require_once COM_FABRIK_FRONTEND . '/helpers/parent.php'; /* $$$ hugh - hacky fix for nasty issue with IE, which (for gory reasons) doesn't like having our JS content * wrapped in P tags. But the default WYSIWYG editor in J! will automagically wrap P tags around everything. * So let's just look for obvious cases of <p>{fabrik ...}</p>, and replace the P's with DIV's. * Yes, it's hacky, but it'll save us a buttload of support work. */ $pregex = "/<p>\\s*{" . $botRegex . "\\s*.*?}\\s*<\\/p>/i"; $row->text = preg_replace_callback($pregex, array($this, 'preplace'), $row->text); // $$$ hugh - having to change this to use {[]} $regex = "/{" . $botRegex . "\\s*.*?}/i"; $row->text = preg_replace_callback($regex, array($this, 'replace'), $row->text); }
function getParams($params, $path = '', $default = '') { $xml = $this->_getXML($path, $default); if (!$params) { return (object) $xml; } if (!is_object($params)) { $registry = new JRegistry(); $registry->loadString($params); $params = $registry->toObject(); } elseif (method_exists($params, 'toObject')) { $params = $params->toObject(); } if (!$params) { return (object) $xml; } if (!empty($xml)) { foreach ($xml as $key => $val) { if (!isset($params->{$key}) || $params->{$key} == '') { $params->{$key} = $val; } } } return $params; }
/** * Gets a list of contacts * @param array * @return mixed Object or null */ function getContact($pk = null) { $query = $this->_getContactQuery($pk); try { $this->_db->setQuery($query); $result = $this->_db->loadObject(); if ($error = $this->_db->getErrorMsg()) { throw new Exception($error); } if (empty($result)) { throw new Exception(JText::_('Contact_Error_Contact_not_found'), 404); } // Convert parameter fields to object and merge with menu item params $registry = new JRegistry(); $registry->loadJSON($result->params); $result->mergedParams = clone $this->getState('params'); $result->mergedParams->merge($registry); } catch (Exception $e) { $this->setError($e); return false; } if ($result) { $user =& JFactory::getUser(); $groups = implode(',', $user->authorisedLevels()); //get the content by the linked user $query = 'SELECT id, title, state, access, created' . ' FROM #__content' . ' WHERE created_by = ' . (int) $result->user_id . ' AND access IN (' . $groups . ')' . ' ORDER BY state DESC, created DESC'; $this->_db->setQuery($query, 0, 10); $articles = $this->_db->loadObjectList(); $contact->articles = $articles; } return $result; }
public function display($tpl = null) { $app = JFactory::getApplication(); $params = $app->getParams(); $state = $this->get('State'); $items = $this->get('Items'); $pagination = $this->get('Pagination'); // Prepare the data. // Compute the weblink slug & link url. for ($i = 0, $n = count($items); $i < $n; $i++) { $item =& $items[$i]; $temp = new JRegistry(); $temp->loadString($item->params); $item->params = clone $params; $item->params->merge($temp); } // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseWarning(500, implode("\n", $errors)); return false; } $this->state =& $state; $this->items =& $items; $this->params =& $params; $this->pagination =& $pagination; //Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx')); $this->_prepareDocument(); parent::display($tpl); }
/** * Overloaded bind function * * @param array $hash named array * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable:bind * @since 1.5 */ public function bind($array, $ignore = array()) { if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); if ((int) $registry->get('width', 0) < 0) { $this->setError(JText::sprintf('JLIB_DATABASE_ERROR_NEGATIVE_NOT_PERMITTED', JText::_('COM_BANNERS_FIELD_WIDTH_LABEL'))); return false; } if ((int) $registry->get('height', 0) < 0) { $this->setError(JText::sprintf('JLIB_DATABASE_ERROR_NEGATIVE_NOT_PERMITTED', JText::_('COM_BANNERS_FIELD_HEIGHT_LABEL'))); return false; } // Converts the width and height to an absolute numeric value: $width = abs((int) $registry->get('width', 0)); $height = abs((int) $registry->get('height', 0)); // Sets the width and height to an empty string if = 0 $registry->set('width', $width ? $width : ''); $registry->set('height', $height ? $height : ''); $array['params'] = (string) $registry; } if (isset($array['imptotal'])) { $array['imptotal'] = abs((int) $array['imptotal']); } return parent::bind($array, $ignore); }
static function getCurrentTemplate() { $cache = JFactory::getCache('com_rokcandy', ''); if (!($templates = $cache->get('templates'))) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('id, home, template, params'); $query->from('#__template_styles'); $query->where('client_id = 0'); $db->setQuery($query); $templates = $db->loadObjectList('id'); foreach ($templates as &$template) { $registry = new JRegistry(); $registry->loadString($template->params); $template->params = $registry; // Create home element if ($template->home == '1' && !isset($templates[0])) { $templates[0] = clone $template; } } $cache->store($templates, 'templates'); } $template = $templates[0]; return $template->template; }
function get_category($catid) { if (!is_object($this->_item)) { $app = JFactory::getApplication(); $menu = $app->getMenu(); $active = $menu->getActive(); $params = new JRegistry(); if ($active) { $params->loadString($active->params); } $options = array(); $options['countItems'] = $params->get('show_cat_num_articles_cat', 1) || !$params->get('show_empty_categories_cat', 0); $catid = $catid > 0 ? $catid : 'root'; $categories = JCategories::getInstance('CommunitySurveys', $options); $this->_item = $categories->get($catid); if (is_object($this->_item)) { $user = JFactory::getUser(); $userId = $user->get('id'); $asset = 'com_content.category.' . $this->_item->id; if ($user->authorise('core.create', $asset)) { $this->_item->getParams()->set('access-create', true); } } } return $this->_item; }
/** * Display module contents. */ public final function display() { // Load CSS only once if (static::$css) { $this->document->addStyleSheet(JURI::root(true) . static::$css); static::$css = null; } // Use caching also for registered users if enabled. if ($this->params->get('owncache', 0)) { /** @var $cache JCacheControllerOutput */ $cache = JFactory::getCache('com_kunena', 'output'); $me = KunenaFactory::getUser(); $cache->setLifeTime($this->params->get('cache_time', 180)); $hash = md5(serialize($this->params)); if ($cache->start("display.{$me->userid}.{$hash}", 'mod_kunenalatest')) { return; } } // Initialize Kunena. KunenaForum::setup(); // Display module. $this->_display(); // Store cached page. if (isset($cache)) { $cache->end(); } }
/** * Stores a contact * * @param boolean True to update fields even if they are null. * @return boolean True on success, false on failure. * @since 1.6 */ public function store($updateNulls = false) { // Transform the params field if (is_array($this->params)) { $registry = new JRegistry(); $registry->loadArray($this->params); $this->params = (string) $registry; } $date = JFactory::getDate(); $user = JFactory::getUser(); if ($this->id) { // Existing item $this->modified = $date->toSql(); $this->modified_by = $user->get('id'); } else { // New newsfeed. A feed created and created_by field can be set by the user, // so we don't touch either of these if they are set. if (!intval($this->created)) { $this->created = $date->toSql(); } if (empty($this->created_by)) { $this->created_by = $user->get('id'); } } // Verify that the alias is unique $table = JTable::getInstance('Contact', 'ContactTable'); if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) { $this->setError(JText::_('COM_CONTACT_ERROR_UNIQUE_ALIAS')); return false; } // Attempt to store the data. return parent::store($updateNulls); }
public function display($tpl = null) { $uri = JFactory::getURI(); $this->setLayout('default'); $lists = array(); $detail = $this->get('data'); $isNew = $detail->extension_id < 1; $text = $isNew ? JText::_('COM_REDSHOP_NEW') : JText::_('COM_REDSHOP_EDIT'); JToolBarHelper::title(JText::_('COM_REDSHOP_SHIPPING') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_shipping48'); $adminpath = JPATH_ROOT . '/plugins'; $shippingpath = $adminpath . '/' . $detail->folder . '/' . $detail->element . '/' . $detail->element . '.xml'; $shippingcfg = $adminpath . '/' . $detail->folder . '/' . $detail->element . '/' . $detail->element . '.cfg.php'; if (file_exists($shippingcfg)) { include_once $shippingcfg; } $myparams = new JRegistry($detail->params, $shippingpath); $is_shipper = $myparams->get('is_shipper'); $shipper_location = $myparams->get('shipper_location'); if ($is_shipper) { JToolBarHelper::custom('shipping_rate', 'redshop_shipping_rates32', JText::_('COM_REDSHOP_SHIPPING_RATE_LBL'), JText::_('COM_REDSHOP_SHIPPING_RATE_LBL'), false, false); } elseif ($shipper_location) { JToolBarHelper::custom('shipping_rate', 'redshop_shipping_rates32', JText::_('COM_REDSHOP_SHIPPING_LOCATION'), JText::_('COM_REDSHOP_SHIPPING_LOCATION'), false, false); } JToolBarHelper::apply(); JToolBarHelper::save(); JToolBarHelper::cancel(); $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $detail->enabled); $this->lists = $lists; $this->detail = $detail; $this->request_url = $uri->toString(); parent::display($tpl); }
public function __construct() { JLoader::import('joomla.filesystem.file'); // $isPro = defined('ARS_PRO') ? (ARS_PRO == 1) : false; // Load the component parameters, not using JComponentHelper to avoid conflicts ;) JLoader::import('joomla.html.parameter'); JLoader::import('joomla.application.component.helper'); $db = JFactory::getDbo(); $sql = $db->getQuery(true)->select($db->quoteName('params'))->from($db->quoteName('#__extensions'))->where($db->quoteName('type') . ' = ' . $db->quote('component'))->where($db->quoteName('element') . ' = ' . $db->quote('com_j2store')); $db->setQuery($sql); $rawparams = $db->loadResult(); $params = new JRegistry(); if (version_compare(JVERSION, '3.0', 'ge')) { $params->loadString($rawparams, 'JSON'); } else { $params->loadJSON($rawparams); } // Dev releases use the "newest" strategy if (substr($this->_currentVersion, 1, 2) == 'ev') { $this->_versionStrategy = 'newest'; } else { $this->_versionStrategy = 'vcompare'; } // Get the minimum stability level for updates $this->_minStability = $params->get('minstability', 'stable'); // Do we need authorized URLs? $this->_requiresAuthorization = false; // Should I use our private CA store? if (@file_exists(dirname(__FILE__) . '/../assets/cacert.pem')) { $this->_cacerts = dirname(__FILE__) . '/../assets/cacert.pem'; } parent::__construct(); }
public static function getProfile($userid) { $db = JFactory::getDbo(); $q = $db->getQuery(true); $q->select('*'); $q->from('#__plg_slogin_profile'); $q->where('`user_id` = ' . (int) $userid); $q->where('`current_profile` = 1'); $db->setQuery($q, 0, 1); $profile = $db->loadObject(); if (!$profile) { $q = $db->getQuery(true); $q->select('*'); $q->from('#__plg_slogin_profile'); $q->where('`user_id` = ' . (int) $userid); $db->setQuery($q, 0, 1); $profile = $db->loadObject(); } if (!$profile) { return false; } if (!empty($profile->avatar)) { //Получаем папку с изображениями $plugin = JPluginHelper::getPlugin('slogin_integration', 'profile'); $pluginParams = new JRegistry(); $pluginParams->loadString($plugin->params); $paramFolder = $pluginParams->get('rootfolder', 'images/avatar'); $profile->avatar = preg_replace("/.*?\\//", "", $profile->avatar); $profile->avatar = $paramFolder . '/' . $profile->avatar; } return $profile; }
/** * Loading the table data */ public function getData() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select(array('*')); $query->from('#__jem_settings'); $query->where(array('id = 1 ')); $db->setQuery($query); $data = $db->loadObject(); // Convert the params field to an array. $registry = new JRegistry; $registry->loadString($data->globalattribs); $data->globalattribs = $registry->toArray(); // Convert Css settings to an array $registryCss = new JRegistry; $registryCss->loadString($data->css); $data->css = $registryCss->toArray(); return $data; }
function update() { $currency = JRequest::getInt('hikashopcurrency', 0); if (!empty($currency)) { $app = JFactory::getApplication(); $app->setUserState(HIKASHOP_COMPONENT . '.currency_id', $currency); $app->setUserState(HIKASHOP_COMPONENT . '.shipping_method', null); $app->setUserState(HIKASHOP_COMPONENT . '.shipping_id', null); $app->setUserState(HIKASHOP_COMPONENT . '.shipping_data', null); $app->setUserState(HIKASHOP_COMPONENT . '.payment_method', null); $app->setUserState(HIKASHOP_COMPONENT . '.payment_id', null); $app->setUserState(HIKASHOP_COMPONENT . '.payment_data', null); $url = JRequest::getString('return_url', ''); if (HIKASHOP_J30) { $plugin = JPluginHelper::getPlugin('system', 'cache'); $params = new JRegistry(@$plugin->params); $options = array('defaultgroup' => 'page', 'browsercache' => $params->get('browsercache', false), 'caching' => false); $cache = JCache::getInstance('page', $options); $cache->clean(); } if (!empty($url)) { if (hikashop_disallowUrlRedirect($url)) { return false; } $app->redirect(urldecode($url)); } } return true; }
protected function getInput() { $document = JFactory::getDocument(); $app = JFactory::getApplication(); $id = $app->input->getInt('id', 0); $attachments = array(); if ($this->value) { $registry = new JRegistry(); $registry->loadString($this->value); $attachments = $registry->toObject(); } $token = JSession::getFormToken(); $script = "jQuery(document).ready(function(\$){\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\$('#add_attachments').click(function() {\n\t\t\t\t\t\t\t\t\$('<tr><td><input type=\"file\" name=\"attachmentfiles[]\" multiple /></td><td><a href=\"#\" class=\"remove_attachment\" onclick=\"return false;\">" . JText::_('COM_JUDIRECTORY_REMOVE') . "</a></td></tr>').appendTo(\"#juemail table\");\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\$('#juemail').on('click', '.remove_attachment', function() {\n\t\t\t\t\t\t\t\t\$(this).parent().parent().remove();\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\$(\"#email-lists\").dragsort({ dragSelector: \"li\", dragEnd: saveOrder, placeHolderTemplate: \"<li class='placeHolder'></li>\", dragSelectorExclude: \"input, textarea, span\"});\n\t\t\t\t\t function saveOrder() {\n\t\t\t\t\t\t\t\tvar data = \$(\"#juemail li\").map(function() { return \$(this).data(\"itemid\"); }).get();\n\t\t\t\t\t };\n\t\t\t\t\t\t});"; $document->addScriptDeclaration($script); $html = '<div id="juemail" class="juemail" style="float: left">'; if ($attachments) { $html .= '<ul id="email-lists" class="email-lists">'; foreach ($attachments as $attachment) { $html .= '<li>'; $html .= '<a class="drag-icon"></a>'; $html .= '<input type="checkbox" name="' . $this->name . '[]" checked value="' . $attachment . '" />'; $html .= '<a href="index.php?option=com_judirectory&task=email.downloadattachment&id=' . $id . '&file=' . $attachment . '&' . $token . '=1"><span class="attachment">' . $attachment . '</span></a>'; $html .= '</li>'; } $html .= '</ul>'; } $html .= '<table></table>'; $html .= '<a href="#" class="btn btn-mini btn-primary add_attachments" id="add_attachments" onclick="return false;"><i class="icon-new"></i> ' . JText::_('COM_JUDIRECTORY_ADD_ATTACHMENT') . '</a>'; $html .= '</div>'; return $html; }
/** * Prepare reply history display. * * @return void */ protected function before() { parent::before(); $id = $this->input->getInt('id'); $this->topic = KunenaForumTopicHelper::get($id); $this->history = KunenaForumMessageHelper::getMessagesByTopic($this->topic, 0, (int) $this->config->historylimit, 'DESC'); $this->replycount = $this->topic->getReplies(); $this->historycount = count($this->history); KunenaAttachmentHelper::getByMessage($this->history); $userlist = array(); foreach ($this->history as $message) { $userlist[(int) $message->userid] = (int) $message->userid; } KunenaUserHelper::loadUsers($userlist); // Run events $params = new JRegistry(); $params->set('ksource', 'kunena'); $params->set('kunena_view', 'topic'); $params->set('kunena_layout', 'history'); $dispatcher = JEventDispatcher::getInstance(); JPluginHelper::importPlugin('kunena'); $dispatcher->trigger('onKunenaPrepare', array('kunena.messages', &$this->history, &$params, 0)); // FIXME: need to improve BBCode class on this... $this->attachments = KunenaAttachmentHelper::getByMessage($this->history); $this->inline_attachments = array(); $this->headerText = JText::_('COM_KUNENA_POST_EDIT') . ' ' . $this->topic->subject; }
function getPluginsB() { $return = ""; $plugin_items = $this->get('PluginList'); $plugins = array(); foreach ($plugin_items as $plugin_item) { $plugin_params = new JRegistry($plugin_item->params); //echo'<pre>'; print_r($plugin_item->params); die(); //$plugin_params = $plugin_item->params; //$plugin_params = explode("=", $plugin_params); //echo '<pre>'; print_r($plugin_params); die(); $pluginname = $plugin_params->get($plugin_item->name . '_label'); $plugins[] = JHTML::_('select.option', '0', JText::_('GURU_SELEECT_PAYM_GATEWAY')); $plugins[] = JHTML::_('select.option', $plugin_item->name, $pluginname); } $processor = ''; if (isset($plan_details['processor'])) { $processor = $plan_details['processor']; } if (!empty($plugins)) { $return = JHTML::_('select.genericlist', $plugins, 'processor', 'class="inputbox" size="1" ', 'value', 'text', $processor); } else { $return = JText::_('Payment plugins not installed'); } return $return; }
/** * Overloaded bind function * * @param array $array Named array to bind * @param mixed $ignore An optional array or space separated list of properties to ignore while binding. * * @return mixed Null if operation was satisfactory, otherwise returns an error * * @since 1.5 */ public function bind($array, $ignore = '') { if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry(); $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } if (!JFactory::getUser()->authorise('core.admin', 'com_quick2cart.region.' . $array['id'])) { $actions = JFactory::getACL()->getActions('com_quick2cart', 'region'); $default_actions = JFactory::getACL()->getAssetRules('com_quick2cart.region.' . $array['id'])->getData(); $array_jaccess = array(); foreach ($actions as $action) { $array_jaccess[$action->name] = $default_actions[$action->name]; } $array['rules'] = $this->JAccessRulestoArray($array_jaccess); } // Bind the rules for ACL where supported. if (isset($array['rules']) && is_array($array['rules'])) { $this->setRules($array['rules']); } return parent::bind($array, $ignore); }
/** * Overloaded bind function to pre-process the params. * * @param array Named array * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable:bind * @since 1.5 */ public function bind($array, $ignore = '') { if (!JFactory::getUser()->authorise('core.edit.state', 'com_einsatzkomponente.einsatzbilderbearbeiten.' . $array['id']) && $array['state'] == 1) { $array['state'] = 0; } if (!isset($array['created_by']) || $array['created_by'] == 0) { $array['created_by'] = JFactory::getUser()->id; } if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry(); $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } if (!JFactory::getUser()->authorise('core.admin', 'com_einsatzkomponente.einsatzbilderbearbeiten.' . $array['id'])) { $actions = JFactory::getACL()->getActions('com_einsatzkomponente', 'einsatzbilderbearbeiten'); $default_actions = JFactory::getACL()->getAssetRules('com_einsatzkomponente.einsatzbilderbearbeiten.' . $array['id'])->getData(); $array_jaccess = array(); foreach ($actions as $action) { $array_jaccess[$action->name] = $default_actions[$action->name]; } $array['rules'] = $this->JAccessRulestoArray($array_jaccess); } //Bind the rules for ACL where supported. if (isset($array['rules']) && is_array($array['rules'])) { $this->setRules($array['rules']); } return parent::bind($array, $ignore); }
/** * Overloaded bind function to pre-process the params. * * @param array Named array * * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable:bind * @since 1.5 */ public function bind($array, $ignore = '') { if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry(); $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } if (!JFactory::getUser()->authorise('core.admin', 'com_mapa.mapadevenezuela.' . $array['id'])) { $actions = JAccess::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/com_mapa/access.xml', "/access/section[@name='mapadevenezuela']/"); $default_actions = JAccess::getAssetRules('com_mapa.mapadevenezuela.' . $array['id'])->getData(); $array_jaccess = array(); foreach ($actions as $action) { $array_jaccess[$action->name] = $default_actions[$action->name]; } $array['rules'] = $this->JAccessRulestoArray($array_jaccess); } //Bind the rules for ACL where supported. if (isset($array['rules']) && is_array($array['rules'])) { $this->setRules($array['rules']); } return parent::bind($array, $ignore); }
/** * Overloaded bind function to pre-process the params. * * @param array $array Named array * @param mixed $ignore Optional array or list of parameters to ignore * * @return null|string null is operation was satisfactory, otherwise returns an error * * @see JTable:bind * @since 1.5 */ public function bind($array, $ignore = '') { $input = JFactory::getApplication()->input; $task = $input->getString('task', ''); if (($task == 'save' || $task == 'apply') && (!JFactory::getUser()->authorise('core.edit.state', 'com_autofilter') && $array['state'] == 1)) { $array['state'] = 0; } if ($array['id'] == 0) { $array['created_by'] = JFactory::getUser()->id; } if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry(); $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } if (!JFactory::getUser()->authorise('core.admin', 'com_autofilter.categorie.' . $array['id'])) { $actions = JAccess::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/com_autofilter/access.xml', "/access/section[@name='categorie']/"); $default_actions = JAccess::getAssetRules('com_autofilter.categorie.' . $array['id'])->getData(); $array_jaccess = array(); foreach ($actions as $action) { $array_jaccess[$action->name] = $default_actions[$action->name]; } $array['rules'] = $this->JAccessRulestoArray($array_jaccess); } // Bind the rules for ACL where supported. if (isset($array['rules']) && is_array($array['rules'])) { $this->setRules($array['rules']); } return parent::bind($array, $ignore); }
function getUserLang($formName = 'language') { $user =& JFactory::getUser(); $paramsC = JComponentHelper::getParams('com_phocagallery'); $userLang = $paramsC->get('user_ucp_lang', 1); $o = array(); switch ($userLang) { case 2: $registry = new JRegistry(); $registry->loadString($user->params); $o['lang'] = $registry->get('language', '*'); $o['langinput'] = '<input type="hidden" name="' . $formName . '" value="' . $o['lang'] . '" />'; break; case 3: $o['lang'] = JFactory::getLanguage()->getTag(); $o['langinput'] = '<input type="hidden" name="' . $formName . '" value="' . $o['lang'] . '" />'; break; default: case 1: $o['lang'] = '*'; $o['langinput'] = '<input type="hidden" name="' . $formName . '" value="*" />'; break; } return $o; }
/** * Overloaded bind function to pre-process the params. * * @param array Named array * * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable:bind * @since 1.5 */ public function bind($array, $ignore = '') { $input = JFactory::getApplication()->input; $task = $input->getString('task', ''); if (($task == 'save' || $task == 'apply') && (!JFactory::getUser()->authorise('core.edit.state', 'com_somosmaestros') && $array['state'] == 1)) { $array['state'] = 0; } if ($array['id'] == 0) { $array['created_by'] = JFactory::getUser()->id; } if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { $registry = new JRegistry(); $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } if (!JFactory::getUser()->authorise('core.admin', 'com_somosmaestros.video.' . $array['id'])) { $actions = JFactory::getACL()->getActions('com_somosmaestros', 'video'); $default_actions = JFactory::getACL()->getAssetRules('com_somosmaestros.video.' . $array['id'])->getData(); $array_jaccess = array(); foreach ($actions as $action) { $array_jaccess[$action->name] = $default_actions[$action->name]; } $array['rules'] = $this->JAccessRulestoArray($array_jaccess); } //Bind the rules for ACL where supported. if (isset($array['rules']) && is_array($array['rules'])) { $this->setRules($array['rules']); } return parent::bind($array, $ignore); }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @return void * */ protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication(); // Load the parameters. Merge Global and Menu Item params into new object $params = $app->getParams(); $menu_params = new JRegistry(); if ($menu = $app->getMenu()->getActive()) { $menu_params->loadString($menu->params); } $merged_params = clone $menu_params; $merged_params->merge($params); $this->setState('params', $merged_params); $params = $this->state->params; $user = JFactory::getUser(); $item_id = $app->input->getInt('id', 0) . ':' . $app->input->getInt('Itemid', 0); // Check to see if a single teamid has been specified either as a parameter or in the url Request $pk = $params->get('teamid_id', '') == '' ? $app->input->getInt('id', '') : $params->get('teamid_id'); $this->setState('filter.teamid_id', $pk); // List state information if ($app->input->getString('layout', 'default') == 'blog') { $limit = $params->def('teamid_num_leading', 1) + $params->def('teamid_num_intro', 4) + $params->def('teamid_num_links', 4); } else { $limit = $app->getUserStateFromRequest($this->context . '.list.' . $item_id . '.limit', 'limit', $params->get('teamid_num_per_page'), 'integer'); } $this->setState('list.limit', $limit); $value = $app->input->get('limitstart', 0, 'uint'); $this->setState('list.start', $value); $search = $app->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); $order_col = $app->getUserStateFromRequest($this->context . '.filter_order', 'filter_order', $params->get('teamid_initial_sort', 'a.ordering'), 'string'); if (!in_array($order_col, $this->filter_fields)) { $order_col = $params->get('teamid_initial_sort', 'a.ordering'); } $this->setState('list.ordering', $order_col); $list_order = $app->getUserStateFromRequest($this->context . '.filter_order_Dir', 'filter_order_Dir', $params->get('teamid_initial_direction', 'ASC'), 'cmd'); if (!in_array(JString::strtoupper($list_order), array('ASC', 'DESC', ''))) { $list_order = $params->get('teamid_initial_direction', 'ASC'); } $this->setState('list.direction', $list_order); if (!$user->authorise('core.edit.state', 'com_knvbapi2') and !$user->authorise('core.edit', 'com_knvbapi2')) { // filter on status of published for those who do not have edit or edit.state rights. $this->setState('filter.published', 1); } else { $this->setState('filter.published', array(0, 1, 2)); } $this->setState('filter.language', JLanguageMultilang::isEnabled()); // process show_teamid_noauth parameter if (!$params->get('show_teamid_noauth')) { $this->setState('filter.access', true); } else { $this->setState('filter.access', false); } if ($params->get('filter_teamid_featured') != "") { $this->setState('filter.featured', $params->get('filter_teamid_featured')); } if ($params->get('filter_teamid_archived')) { $this->setState('filter.archived', $params->get('filter_teamid_archived')); } $this->setState('layout', $app->input->getString('layout')); }
/** * Adds the ilike service to user tables; * @param unknown_type $post * @param unknown_type $userid */ public function addService($post, $userid) { TuiyoLoader::helper("parameter"); $table =& TuiyoLoader::table("userplugins", true); $table->load(null); //blank $table->name = "ilike"; $table->type = "service"; $table->userid = (int) $userid; $table->privacy = '%p00%'; //get parameters; $registry = new JRegistry(); $postParams = JRequest::getVar('params', array(), 'post', 'array'); if (count($postParams)) { $registry->loadArray($postParams); $table->params = $registry->toString(); //store the username and password and anything else; } if (!$table->store()) { echo $table->getError(); return false; //get the eror; } return true; }
/** * Overloaded bind function to pre-process the params. * * @param array Named array * * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable::bind */ public function bind($array, $ignore = '') { // For Fields group // Convert jform[fields_group][field] to jform[field] or JTable cannot bind data. // ========================================================================================== $data = array(); $array = AKHelper::_('array.pivotFromTwoDimension', $array); // Set field['param_xxx'] to params // ========================================================================================== if (empty($array['params'])) { $array['params'] = AKHelper::_('array.pivotFromPrefix', 'param_', $array, JArrayHelper::getValue($array, 'params', array())); } // Set params to JRegistry // ========================================================================================== if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = (string) $registry; } // Bind the rules. // ========================================================================================== if (isset($array['rules']) && is_array($array['rules'])) { $rules = new JAccessRules($array['rules']); $this->setRules($rules); } return parent::bind($array, $ignore); }
/** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. * * @since 1.6 */ public function getItem($pk = null) { $pk = !empty($pk) ? $pk : (int) $this->getState($this->getName() . '.id'); $table = $this->getTable(); if ($pk > 0) { // Attempt to load the row. $return = $table->load($pk); // Check for a table object error. if ($return === false && $table->getError()) { $this->setError($table->getError()); return false; } } // Convert to the JObject before adding other data. $properties = $table->getProperties(1); $item = JArrayHelper::toObject($properties, 'JObject'); if (property_exists($item, 'params')) { $registry = new JRegistry(); $registry->loadString($item->params); $item->params = $registry->toArray(); } if (property_exists($item, 'order_params')) { $registry = new JRegistry(); $registry->loadString($item->order_params); $item->order_params = $registry->toArray(); } return $item; }
/** * Overrides JGithub constructor to initialise the api property. * * @param mixed $input An optional argument to provide dependency injection for the application's * input object. If the argument is a JInputCli object that object will become * the application's input object, otherwise a default input object is created. * @param mixed $config An optional argument to provide dependency injection for the application's * config object. If the argument is a JRegistry object that object will become * the application's config object, otherwise a default config object is created. * @param mixed $dispatcher An optional argument to provide dependency injection for the application's * event dispatcher. If the argument is a JDispatcher object that object will become * the application's event dispatcher, if it is null then the default event dispatcher * will be created based on the application's loadDispatcher() method. * * @see loadDispatcher() * @since 11.1 */ public function __construct(JInputCli $input = null, JRegistry $config = null, JDispatcher $dispatcher = null) { parent::__construct($input, $config, $dispatcher); $options = new JRegistry(); $options->set('headers.Accept', 'application/vnd.github.html+json'); $this->api = new JGithub($options); }