コード例 #1
0
ファイル: plugin.php プロジェクト: ZerGabriel/joomla-platform
 /**
  * Constructor
  *
  * @param   object  &$subject  The object to observe
  * @param   array   $config    An optional associative array of configuration settings.
  *                             Recognized key values include 'name', 'group', 'params', 'language'
  *                             (this list is not meant to be comprehensive).
  *
  * @since   11.1
  */
 public function __construct(&$subject, $config = array())
 {
     // Get the parameters.
     if (isset($config['params'])) {
         if ($config['params'] instanceof JRegistry) {
             $this->params = $config['params'];
         } else {
             $this->params = new JRegistry();
             $this->params->loadString($config['params']);
         }
     }
     // Get the plugin name.
     if (isset($config['name'])) {
         $this->_name = $config['name'];
     }
     // Get the plugin type.
     if (isset($config['type'])) {
         $this->_type = $config['type'];
     }
     // Load the language files if needed.
     if ($this->autoloadLanguage) {
         $this->loadLanguage();
     }
     parent::__construct($subject);
 }
コード例 #2
0
ファイル: jSGCache.php プロジェクト: jbelborja/lavid3
 /**
  * Constructor
  *
  * @access public
  * @param   object  &$subject  The object to observe
  */
 public function __construct(&$subject)
 {
     if (isset($_GET['sgCacheCheck']) && $_GET['sgCacheCheck'] == md5('joomlaCheck')) {
         die('OK');
     }
     parent::__construct($subject);
     $plugin = JPluginHelper::getPlugin('system', 'jSGCache');
     $this->params = new JRegistry();
     $this->params->loadString($plugin->params, 'JSON');
     $this->_cacheEnabled = $this->params->get('cache_enabled');
     if ($this->_cacheEnabled === null) {
         $this->_cacheEnabled == 1;
     }
     $this->_autoflush = $this->params->get('autoFlush');
     if ($this->_autoflush === null) {
         $this->_autoflush = 1;
     }
     $this->_autoflush3rdParty = $this->params->get('autoFlush-ThirdParty');
     if ($this->_autoflush3rdParty === null) {
         $this->_autoflush3rdParty = 1;
     }
     $this->_autoflushClientSide = $this->params->get('autoFlush-ClientSide');
     if ($this->_autoflushClientSide === null) {
         $this->_autoflushClientSide = 0;
     }
 }
コード例 #3
0
ファイル: helper.php プロジェクト: vstorm83/propertease
 /**
  * Merge params with layoutsettings params
  * @return JRegistry object
  */
 public function loadParams()
 {
     $mainframe = JFactory::getApplication();
     $mixed_params = new JRegistry();
     if (trim($this->db_params->get('layoutsettings', '')) != '') {
         //Load params from layout params
         $mixed_params->loadString($this->db_params->get('layoutsettings', ''));
     }
     //Overwrite it by database params, by this way, DB params have higher priority, if DB params and layout params have the same param name, DB params will overwrite all
     $mixed_params->loadString($this->db_params->toString());
     //Remove layout setttings
     $mixed_params->set('layoutsettings', '');
     return $mixed_params;
 }
コード例 #4
0
ファイル: field.php プロジェクト: Glonum/tz_portfolio
 public function getItem($pk = null)
 {
     // Initialise variables.
     $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');
     $item->title = htmlspecialchars(strip_tags($item->title));
     if (property_exists($item, 'params')) {
         $registry = new JRegistry();
         $registry->loadString($item->params);
         $item->params = $registry->toArray();
     }
     if ($item) {
         $arr = str_replace('[', '', $item->value);
         $arr = str_replace(']', '', $arr);
         if (preg_match('/.*\\},{\\.*?/s', $arr, $match)) {
             //var_dump($match);
             $values = str_replace('},', '}///', $arr);
             $values = explode('///', $values);
         } else {
             $values = (array) $arr;
         }
         //            $artOptFields   = $this -> _checkArticleFields($item -> id);
         if (count($values) > 0) {
             $list = array();
             $i = 0;
             foreach ($values as $value) {
                 $list[$i] = new stdClass();
                 $param = new JRegistry($value);
                 $list[$i]->type = $item->type;
                 if (!empty($item->default_value)) {
                     $list[$i]->default_value = explode(',', $item->default_value);
                 } else {
                     $list[$i]->default_value = array();
                 }
                 $list[$i]->name = $param->get('name');
                 $list[$i]->value = $param->get('value');
                 $list[$i]->target = $param->get('target');
                 $list[$i]->editor = $param->get('editor');
                 $list[$i]->image = $param->get('image');
                 $list[$i]->ordering = $param->get('ordering');
                 $i++;
             }
             $item->defvalue = $list;
         }
         $item->groups = $this->getGroups();
     }
     return $item;
 }
コード例 #5
0
 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);
 }
コード例 #6
0
ファイル: settings.php プロジェクト: BillVGN/PortalPRP
	/**
	 * 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;
	}
コード例 #7
0
ファイル: user.php プロジェクト: VierlingMt/joomla-3.x
 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;
 }
コード例 #8
0
ファイル: rokcandy.php プロジェクト: enjoy2000/smcd
 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;
 }
コード例 #9
0
ファイル: plugin.php プロジェクト: rcorral/com_api
 public static function getInstance($name)
 {
     if (isset(self::$instances[$name])) {
         return self::$instances[$name];
     }
     $plugin = JPluginHelper::getPlugin('api', $name);
     if (empty($plugin)) {
         throw new Exception(JText::_('COM_API_PLUGIN_CLASS_NOT_FOUND'), 400);
     }
     jimport('joomla.filesystem.file');
     $plgfile = JPATH_BASE . self::$plg_path . $name . DS . $name . '.php';
     $param_path = JPATH_BASE . self::$plg_path . $name . DS . $name . '.xml';
     if (!JFile::exists($plgfile)) {
         throw new Exception(JText::_('COM_API_FILE_NOT_FOUND'), 400);
     }
     include $plgfile;
     $class = self::$plg_prefix . ucwords($name);
     if (!class_exists($class)) {
         throw new Exception(JText::_('COM_API_PLUGIN_CLASS_NOT_FOUND'), 400);
     }
     $handler = new $class();
     $cparams = JComponentHelper::getParams('com_api');
     $params = new JRegistry();
     $params->loadString($plugin->params);
     $cparams->merge($params);
     $handler->set('params', $cparams);
     $handler->set('component', JRequest::getCmd('app'));
     $handler->set('resource', JRequest::getCmd('resource'));
     $handler->set('format', $handler->negotiateContent(JRequest::getCmd('output', null)));
     $handler->set('request_method', JRequest::getMethod());
     self::$instances[$name] = $handler;
     return self::$instances[$name];
 }
コード例 #10
0
ファイル: countries.php プロジェクト: smhnaji/sdnet
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 public function getOptions()
 {
     $options = array();
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select('code As value, title As `text`, print_title')->from('#__sibdiet_countries')->order('title')->where('published = 1');
     $db->setQuery($query);
     try {
         $options = $db->loadObjectList();
     } catch (RuntimeException $e) {
         JError::raiseWarning(500, $e->getMessage());
     }
     $lang_tag = JFactory::getLanguage()->get('tag');
     foreach ($options as $option) {
         // Convert the print_title field to an array.
         $registry = new JRegistry();
         $registry->loadString($option->print_title);
         $print_title = $registry->toArray();
         if (array_key_exists($lang_tag, $print_title)) {
             $option->text = $print_title[$lang_tag];
         }
     }
     // Sort Options
     usort($options, function ($a, $b) {
         return strcmp($a->text, $b->text);
     });
     return array_merge(parent::getOptions(), $options);
 }
コード例 #11
0
ファイル: repodirs.php プロジェクト: bellodox/Migrator
 protected function migrate($row)
 {
     $this->project = $row;
     $registry = new JRegistry();
     $registry->loadString($row->attribs);
     $repo_root_id = (int) $registry->get('repo_dir');
     $query = $this->_db->getQuery(true);
     $query->select('a.*, t.parent_id')->from('#__pf_folders_tmp AS a')->join('INNER', '#__pf_folder_tree_tmp AS t ON t.folder_id = a.id')->where('a.project = ' . $row->id)->order('a.id ASC');
     $this->_db->setQuery($query);
     $this->items = $this->_db->loadObjectList();
     if (empty($this->items) || !is_array($this->items)) {
         return true;
     }
     $this->items = $this->sortItems();
     // Start migrating from the top
     foreach ($this->items as $item) {
         if ($item->parent_id == 0) {
             $item->parent_id = $repo_root_id;
         }
         if (!$this->store($item)) {
             return false;
         }
     }
     return true;
 }
コード例 #12
0
 public static function getAjax()
 {
     jimport('joomla.application.module.helper');
     $input = JFactory::getApplication()->input;
     $module = JModuleHelper::getModule('hoicoi_openmeetings');
     $params = new JRegistry();
     $params->loadString($module->params);
     $values = explode(',', rtrim($params->get('rooms'), ","));
     if (self::getVerification($values, $input->get("room_id"), $input->get("password", "", 'STRING'))) {
         $options = array("protocol" => $params->get('protocol'), "port" => $params->get('port'), "host" => $params->get('host'), "webappname" => $params->get('webappname'), "adminUser" => $params->get('adminUser'), "adminPass" => $params->get('adminPass'));
         $access = new openmeetings_gateway($options);
         if (!$access->loginuser()) {
             $data = array("error" => 03, "text" => self::getErrorInfo(03));
             return $data;
         }
         $hash = $access->setUserObjectAndGenerateRoomHash($input->get("name"), $input->get("name", "", 'STRING'), "", "", $input->get("email", "", 'STRING'), JSession::getInstance("", "")->getId(), "Joomla", $input->get("room_id"), self::$isAdmin, self::$isRecodring);
         if (preg_match('/\\D/', $hash)) {
             $url = $access->getUrl() . "/?secureHash=" . $hash;
             //Get final URL
             $data = array("url" => $url);
             return $data;
         } else {
             $data = array("error" => $hash, "text" => self::getErrorInfo($hash));
             return $data;
         }
     } else {
         $data = array("error" => 02, "text" => self::getErrorInfo(02));
         return $data;
     }
     $data = array("error" => 01, "text" => self::getErrorInfo(01));
     return $data;
 }
コード例 #13
0
 public function getInput()
 {
     $objectID = JRequest::getInt('id', 0);
     // Create a new query object.
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     // Select the required fields from the table.
     $query->select('a.*');
     $query->from('`#__autofilter_regions` AS a');
     $db->setQuery($query);
     $regions = $db->loadObjectList();
     $loadedObject = array();
     if ($objectID != 0) {
         // Select the required fields from the table.
         $query = $db->getQuery(true);
         $query->select('a.regions_covered_ids');
         $query->from('`#__autofilter_repairmans` AS a');
         $query->where('(a.id = ' . $objectID . ')');
         $db->setQuery($query);
         $loadedObject = $db->loadObject();
         $registry = new JRegistry();
         $registry->loadString($loadedObject->regions_covered_ids);
         $loadedObject = array_values($registry->toArray());
     }
     $html = '<select id="' . $this->id . '" name="' . $this->name . '" multiple="multiple">';
     foreach ($regions as $region) {
         $selected = in_array($region->id, $loadedObject) ? 'selected' : '';
         $html .= '<option value="' . $region->id . '" ' . $selected . '>' . $region->name . '</option>';
     }
     $html .= '</select>';
     return $html;
 }
コード例 #14
0
 function display($tpl = null)
 {
     $option = JRequest::getCmd('option');
     $mainframe = JFactory::getApplication();
     $uri = JFactory::getURI();
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $version = urlencode(JoomleagueHelper::getVersion());
     $css = 'components/com_joomleague/assets/css/tabs.css?v=' . $version;
     $document->addStyleSheet($css);
     $model = $this->getModel();
     $this->assignRef('club', $model->getClub());
     $lists = array();
     $this->club->merge_teams = explode(",", $this->club->merge_teams);
     $this->assignRef('form', $this->get('Form'));
     // extended club data
     $xmlfile = JLG_PATH_ADMIN . DS . 'assets' . DS . 'extended' . DS . 'club.xml';
     $jRegistry = new JRegistry();
     $jRegistry->loadString($this->club->extended, 'ini');
     $extended =& JForm::getInstance('extended', $xmlfile, array('control' => 'extended'), false, '/config');
     $extended->bind($jRegistry);
     $this->assignRef('extended', $extended);
     $this->assignRef('lists', $lists);
     $this->assign('cfg_which_media_tool', JComponentHelper::getParams('com_joomleague')->get('cfg_which_media_tool', 0));
     $this->assign('cfg_be_show_merge_teams', JComponentHelper::getParams('com_joomleague')->get('cfg_be_show_merge_teams', 0));
     parent::display($tpl);
 }
コード例 #15
0
 /**
  * Получаем сообщение.
  *
  * @param   int  $id  Id сообщения.
  *
  * @return  object  Объект сообщения, которое отображается пользователю.
  *
  * @throws  Exception  Если сообщение не найдено.
  *
  */
 public function getItem($id = null)
 {
     // Если id не установлено, то получаем его из состояния.
     $id = !empty($id) ? $id : (int) $this->getState('message.id');
     if ($this->_item === null) {
         $this->_item = array();
     }
     if (!isset($this->_item[$id])) {
         // Конструируем SQL запрос.
         $query = $this->_db->getQuery(true);
         $query->select('h.greeting, h.params')->from('#__helloworld as h')->select('c.title as category')->leftJoin('#__categories as c ON c.id = h.catid')->where('h.id = ' . (int) $id)->where('h.state > 0');
         $this->_db->setQuery($query);
         $data = $this->_db->loadObject();
         // Генерируем исключение, если сообщение не найдено.
         if (empty($data)) {
             throw new Exception(JText::_('COM_HELLOWORLD_ERROR_MESSAGE_NOT_FOUND'), 404);
         }
         // Загружаем JSON строку параметров.
         $params = new JRegistry();
         $params->loadString($data->params);
         $data->params = $params;
         // Объединяем глобальные параметры с индивидуальными.
         $params = clone $this->getState('params');
         $params->merge($data->params);
         $data->params = $params;
         $this->_item[$id] = $data;
     }
     return $this->_item[$id];
 }
コード例 #16
0
ファイル: helper.php プロジェクト: madcsaba/li-de
 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;
 }
コード例 #17
0
ファイル: directory.php プロジェクト: eno93/Projectfork
 /**
  * Method to get a single record.
  *
  * @param     integer    The id of the primary key.
  *
  * @return    mixed      Object on success, false on failure.
  */
 public function getItem($pk = null)
 {
     $item = parent::getItem($pk);
     if ($item == false) {
         return false;
     }
     if (property_exists($item, 'attribs')) {
         // Convert the params field to an array.
         $registry = new JRegistry();
         $registry->loadString($item->attribs);
         $item->params = $registry;
         $item->attribs = $registry->toArray();
     }
     if ($item->id > 0) {
         // Existing record
         $labels = $this->getInstance('Labels', 'PFModel');
         $item->labels = $labels->getConnections('com_pfrepo.directory', $item->id);
         $item->orphaned = $this->isOrphaned($item->project_id);
         $item->element_count = 0;
     } else {
         // New record
         $item->labels = array();
         $item->orphaned = false;
         $item->element_count = $this->getElementCount($pk);
     }
     return $item;
 }
コード例 #18
0
 public function install($adapter)
 {
     /** @var $plugin JTableExtension */
     $plugin = JTable::getInstance('extension');
     if (!$plugin->load(array('type' => 'plugin', 'folder' => 'system', 'element' => 'communitybuilder'))) {
         return false;
     }
     /** @var $legacy JTableExtension */
     $legacy = JTable::getInstance('extension');
     if ($legacy->load(array('type' => 'plugin', 'folder' => 'system', 'element' => 'cbcoreredirect'))) {
         $pluginParams = new JRegistry();
         $pluginParams->loadString($plugin->get('params'));
         $legacyParams = new JRegistry();
         $legacyParams->loadString($legacy->get('params'));
         $pluginParams->set('rewrite_urls', $legacyParams->get('rewrite_urls', 1));
         $pluginParams->set('itemids', $legacyParams->get('itemids', 1));
         $plugin->set('params', $pluginParams->toString());
         $installer = new JInstaller();
         try {
             $installer->uninstall('plugin', $legacy->get('extension_id'));
         } catch (RuntimeException $e) {
         }
     }
     $plugin->set('enabled', 1);
     return $plugin->store();
 }
コード例 #19
0
ファイル: config.php プロジェクト: ForAEdesWeb/AEW4
 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();
 }
コード例 #20
0
ファイル: order.php プロジェクト: ForAEdesWeb/AEW3
 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 (!is_array($item->items)) {
         if (isset($item->id)) {
             $this->_db->setQuery('SELECT * FROM #__djc2_order_items WHERE order_id=\'' . $item->id . '\'');
             $item->items = $this->_db->loadObjectList();
         } else {
             $item->items = array();
         }
     }
     if (property_exists($item, 'params')) {
         $registry = new JRegistry();
         $registry->loadString($item->params);
         $item->params = $registry->toArray();
     }
     return $item;
 }
コード例 #21
0
ファイル: categories.php プロジェクト: pguilford/vcomcc
 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;
 }
コード例 #22
0
 private function getParams()
 {
     $module = JModuleHelper::getModule('instagram');
     $params = new JRegistry();
     $params->loadString($module->params);
     return $params;
 }
コード例 #23
0
ファイル: teamids.php プロジェクト: esorone/efcpw
 /**
  * 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'));
 }
コード例 #24
0
 /**
  * method to run after an install/update/uninstall method
  *
  * @return void
  */
 function postflight($type, $parent)
 {
     $mainframe =& JFactory::getApplication();
     $db = JFactory::getDbo();
     // $parent is the class calling this method
     // $type is the type of change (install, update or discover_install)
     //echo '<p>' . JText::_('COM_JOOMLEAGUE_POSTFLIGHT_' . $type . '_TEXT' ) . $parent->get('manifest')->version . '</p>';
     $mainframe->enqueueMessage(JText::_(' Joomleague ') . $type . JText::_(' Version: ') . $parent->get('manifest')->version, '');
     $db->setQuery('SELECT params FROM #__extensions WHERE name = "joomleague" and type ="component" ');
     $paramsdata = json_decode($db->loadResult(), true);
     //$mainframe->enqueueMessage(JText::_('postflight paramsdata<br><pre>'.print_r($paramsdata,true).'</pre>'   ),'');
     $params = JComponentHelper::getParams('com_joomleague');
     $xmlfile = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_joomleague' . DS . 'config.xml';
     $jRegistry = new JRegistry();
     $jRegistry->loadString($params->toString('ini'), 'ini');
     $form =& JForm::getInstance('com_joomleague', $xmlfile, array('control' => ''), false, "/config");
     $form->bind($jRegistry);
     $newparams = array();
     foreach ($form->getFieldset($fieldset->name) as $field) {
         //echo 'name -> '. $field->name.'<br>';
         //echo ' -> '. $field->type.'<br>';
         //echo ' -> '. $field->input.'<br>';
         //echo 'value -> '. $field->value.'<br>';
         $newparams[$field->name] = $field->value;
     }
     //$mainframe->enqueueMessage(JText::_('postflight newparams<br><pre>'.print_r($newparams,true).'</pre>'   ),'');
     //$paramsString = json_encode( $newparams );
     //$mainframe->enqueueMessage(JText::_('postflight paramsString<br><pre>'.print_r($paramsString,true).'</pre>'   ),'');
     //$mainframe->enqueueMessage(JText::_('postflight jRegistry<br><pre>'.print_r($jRegistry,true).'</pre>'   ),'');
     //$mainframe->enqueueMessage(JText::_('postflight form<br><pre>'.print_r($form,true).'</pre>'   ),'');
     //$params = $form->getFieldsets('params');
     //$mainframe->enqueueMessage(JText::_('postflight params<br><pre>'.print_r($params,true).'</pre>'   ),'');
     switch ($type) {
         case "install":
             self::installComponentLanguages();
             self::installModules();
             self::installPlugins();
             self::createImagesFolder();
             self::migratePicturePath();
             //self::deleteInstallFolders();
             self::sendInfoMail();
             self::InstallJoomla();
             //$parent->getParent()->setRedirectURL('index.php?option=com_joomleague');
             break;
         case "update":
             self::installComponentLanguages();
             self::installModules();
             self::installPlugins();
             self::createImagesFolder();
             self::migratePicturePath();
             self::setParams($newparams);
             //self::deleteInstallFolders();
             self::sendInfoMail();
             self::InstallJoomla();
             //$parent->getParent()->setRedirectURL('index.php?option=com_joomleague');
             break;
         case "discover_install":
             break;
     }
 }
コード例 #25
0
 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;
 }
コード例 #26
0
ファイル: cpanels.php プロジェクト: jonatasmm/akeebasubs
 public function wizardstep()
 {
     $wizardstep = (int) $this->input->getInt('wizardstep', 0);
     // Fetch the component parameters
     $db = JFactory::getDbo();
     $sql = $db->getQuery(true)->select($db->qn('params'))->from($db->qn('#__extensions'))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('element') . ' = ' . $db->q('com_akeebasubs'));
     $db->setQuery($sql);
     $rawparams = $db->loadResult();
     $params = new JRegistry();
     $params->loadString($rawparams, 'JSON');
     // Set the wzardstep parameter to whatever we were told to
     $params->set('wizardstep', $wizardstep);
     // Save the component parameters
     $data = $params->toString('JSON');
     $sql = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('params') . ' = ' . $db->q($data))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('element') . ' = ' . $db->q('com_akeebasubs'));
     $db->setQuery($sql);
     $db->execute();
     // Redirect back to the control panel
     $url = '';
     $returnurl = $this->input->getBase64('returnurl', '');
     if (!empty($returnurl)) {
         $url = base64_decode($returnurl);
     }
     if (empty($url)) {
         $url = JURI::base() . 'index.php?option=com_akeebasubs';
     }
     $this->setRedirect($url);
 }
コード例 #27
0
 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;
 }
コード例 #28
0
 public function getItem($pk = null)
 {
     $storeId = md5(__METHOD__);
     if (!isset($this->cache[$storeId])) {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('config_params');
         $query->from('#__judownload_categories');
         $query->where('parent_id = 0');
         $query->where('level = 0');
         $db->setQuery($query);
         $config_params = $db->loadResult();
         $registry = new JRegistry();
         $registry->loadString($config_params);
         $globalConfig = $registry->toObject();
         foreach ($globalConfig as $key => $value) {
             if (is_object($value)) {
                 $registry = new JRegistry();
                 $registry->loadObject($value);
                 $globalConfig->{$key} = $registry->toArray();
             }
         }
         $this->cache[$storeId] = $globalConfig;
     }
     return $this->cache[$storeId];
 }
コード例 #29
0
ファイル: edit.php プロジェクト: sankam-nikolya/lptt
 /**
  * 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;
 }
コード例 #30
0
ファイル: todaymanyyearsago.php プロジェクト: Lothurm/J3.x
 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;
 }