Example #1
0
 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();
 }
 /**
  * Method to get a category.
  *
  * @param	integer	An optional id of the object to get, otherwise the id from the model state is used.
  * @return	mixed	Category data object on success, false on failure.
  * @since	1.6
  */
 public function getItem($pk = null)
 {
     if ($result = parent::getItem($pk)) {
         // Prime required properties.
         if (empty($result->id)) {
             $result->parent_id = $this->getState('category.parent_id');
             $result->extension = $this->getState('category.extension');
         }
         // Convert the metadata field to an array.
         $registry = new JRegistry();
         $registry->loadJSON($result->metadata);
         $result->metadata = $registry->toArray();
         // Convert the created and modified dates to local user time for display in the form.
         jimport('joomla.utilities.date');
         $tz = new DateTimeZone(JFactory::getApplication()->getCfg('offset'));
         if (intval($result->created_time)) {
             $date = new JDate($result->created_time);
             $date->setTimezone($tz);
             $result->created_time = $date->toMySQL(true);
         } else {
             $result->created_time = null;
         }
         if (intval($result->modified_time)) {
             $date = new JDate($result->modified_time);
             $date->setTimezone($tz);
             $result->modified_time = $date->toMySQL(true);
         } else {
             $result->modified_time = null;
         }
     }
     return $result;
 }
Example #3
0
 /**
  * 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;
 }
Example #4
0
 /**
  * Renders a module script and returns the results as a string
  *
  * @param	string $name	The name of the module to render
  * @param	array $attribs	Associative array of values
  *
  * @return	string			The output of the script
  * @since   1.0
  */
 public function render($module, $attribs = array(), $content = null)
 {
     // add the environment data to attributes of module
     $registry = JRegistry::getInstance('document.environment');
     $env = $registry->getValue('params', array());
     $attribs = array_merge($env, $attribs);
     if (!is_object($module)) {
         $title = isset($attribs['title']) ? $attribs['title'] : null;
         $module = MigurModuleHelper::getModule($module, $title);
         if (!is_object($module)) {
             if (is_null($content)) {
                 return '';
             } else {
                 /**
                  * If module isn't found in the database but data has been pushed in the buffer
                  * we want to render it
                  */
                 $tmp = $module;
                 $module = new stdClass();
                 $module->params = null;
                 $module->module = $tmp;
                 $module->id = 0;
                 $module->user = 0;
             }
         }
     }
     // get the user and configuration object
     //$user = JFactory::getUser();
     $conf = JFactory::getConfig();
     // set the module content
     if (!is_null($content)) {
         $module->content = $content;
     }
     //get module parameters
     $params = new JRegistry();
     $params->loadJSON($module->params);
     // use parameters from template
     if (isset($attribs['params'])) {
         $template_params = new JRegistry();
         $template_params->loadJSON(html_entity_decode($attribs['params'], ENT_COMPAT, 'UTF-8'));
         $params->merge($template_params);
         $module = clone $module;
         $module->params = (string) $params;
     }
     $contents = '';
     $cachemode = $params->get('cachemode', 'oldstatic');
     // default for compatibility purposes. Set cachemode parameter or use JModuleHelper::moduleCache from within the module instead
     if ($params->get('cache', 0) == 1 && $conf->get('caching') >= 1 && $cachemode != 'id' && $cachemode != 'safeuri') {
         // default to itemid creating mehod and workarounds on
         $cacheparams = new stdClass();
         $cacheparams->cachemode = $cachemode;
         $cacheparams->class = 'JModuleHelper';
         $cacheparams->method = 'renderModule';
         $cacheparams->methodparams = array($module, $attribs);
         $contents = MigurModuleHelper::ModuleCache($module, $params, $cacheparams);
     } else {
         $contents = MigurModuleHelper::renderModule($module, $attribs);
     }
     return $contents;
 }
Example #5
0
 /**
  * Method to get an item.
  *
  * @param	integer	The id of the  item to get.
  *
  * @return	mixed	Item data object on success, false on failure.
  */
 public function &getItem($itemId = null)
 {
     // Initialise variables.
     $itemId = !empty($itemId) ? $itemId : (int) $this->getState('contact.id');
     $false = false;
     // Get a row instance.
     $table =& $this->getTable();
     // Attempt to load the row.
     $return = $table->load($itemId);
     // Check for a table object error.
     if ($return === false && $table->getError()) {
         $this->setError($table->getError());
         return $false;
     }
     // Prime required properties.
     if (empty($table->id)) {
         $table->parent_id = $this->getState('item.parent_id');
         //$table->menutype	= $this->getState('item.menutype');
         //$table->type		= $this->getState('item.type');
     }
     // Convert the params field to an array.
     $registry = new JRegistry();
     $registry->loadJSON($table->params);
     $table->params = $registry->toArray();
     // Convert the params field to an array.
     $registry = new JRegistry();
     //$registry->loadJSON($table->metadata);
     $table->metadata = $registry->toArray();
     $value = JArrayHelper::toObject($table->getProperties(1), 'JObject');
     return $value;
 }
 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->loadJSON($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;
 }
Example #7
0
	/**
	 * Method to get article data.
	 *
	 * @param	integer	The id of the article.
	 *
	 * @return	mixed	Menu item data object on success, false on failure.
	 */
	public function &getItem ($pk = null)
	{
		$pk = 0;
		$this->setState('article.id', $pk);

		$this->_item[$pk] = new stdClass();

		$registry = new JRegistry;
		$registry->loadJSON('{}');
		$this->_item[$pk]->params = $registry;
		$this->_item[$pk]->attribs = $registry;
		$this->_item[$pk]->metadata = $registry;

		$this->_item[$pk]->title = '{post-title}';
		$this->_item[$pk]->introtext = '{post-body}';
		$this->_item[$pk]->fulltext = null;

		$this->_item[$pk]->params->set('show_page_heading', 0);
		$this->_item[$pk]->params->set('show_title', 1);
		$this->_item[$pk]->params->set('access-view', true);
		$this->_item[$pk]->params->set('access-edit', 0);
		$this->_item[$pk]->params->set('show_print_icon', 0);
		$this->_item[$pk]->params->set('show_email_icon', 0);
		$this->_item[$pk]->params->set('show_author', 0);
		$this->_item[$pk]->params->set('show_category', 0);
		$this->_item[$pk]->params->set('show_parent_category', 0);
		$this->_item[$pk]->params->set('show_create_date', 0);
		$this->_item[$pk]->params->set('show_modify_date', 0);
		$this->_item[$pk]->params->set('show_publish_date', 0);
		$this->_item[$pk]->params->set('show_hits', 0);

		$this->getState('params')->set('show_page_heading', 0);

		return $this->_item[$pk];
	}
Example #8
0
 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->loadJSON($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;
 }
Example #9
0
 function getPluginParamValues($name, $type = 'system')
 {
     jimport('joomla.plugin.plugin');
     $plugin = JPluginHelper::getPlugin($type, $name);
     $registry = new JRegistry();
     $registry->loadJSON($plugin->params);
     return $this->getParams($registry->toObject(), JPATH_PLUGINS . DS . $type . DS . $name . DS . $name . '.xml');
 }
Example #10
0
 /**
  * Display the view
  *
  * @return	mixed	False on error, null otherwise.
  */
 function display($tpl = null)
 {
     $comName = JRequest::getCmd('option');
     $document =& JFactory::getDocument();
     $app = JFactory::getApplication();
     $params = $app->getParams();
     //Check whether category access level allows access.
     $user = JFactory::getUser();
     $groups = $user->getAuthorisedViewLevels();
     //Load resources
     $document->addStyleSheet($this->baseurl . "/media/{$comName}/css/styles.css");
     //Get some data from the models
     $state = $this->get('State');
     $items = $this->get('Items');
     $category = $this->get('Category');
     $children = $this->get('Children');
     $parent = $this->get('Parent');
     $pagination = $this->get('Pagination');
     //Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     //Prepare the data
     //Compute the contact slug
     for ($i = 0, $n = count($items); $i < $n; $i++) {
         $item =& $items[$i];
         $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
         $temp = new JRegistry();
         $temp->loadJSON($item->params);
         $item->params = clone $params;
         $item->params->merge($temp);
         if ($item->params->get('show_email', 0) == 1) {
             $item->email_to = trim($item->email_to);
             if (!empty($item->email_to) && JMailHelper::isEmailAddress($item->email_to)) {
                 $item->email_to = JHtml::_('email.cloak', $item->email_to);
             } else {
                 $item->email_to = '';
             }
         }
     }
     //Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     $maxLevel = $params->get('maxLevel', -1);
     $this->assignRef('maxLevel', $maxLevel);
     $this->assignRef('state', $state);
     $this->assignRef('items', $items);
     $this->assignRef('category', $category);
     $this->assignRef('children', $children);
     $this->assignRef('params', $params);
     $this->assignRef('parent', $parent);
     $this->assignRef('pagination', $pagination);
     //define some few document params
     $this->_prepareDocument();
     //Display the view
     parent::display($tpl);
 }
Example #11
0
 function init_all($context)
 {
     // Current version for infornation message
     $this->botmtversion = 'Multithumb 3.7.3';
     // Don't initialize anymore if plugin is disabled
     $this->published = JPluginHelper::isEnabled('content', 'multithumb');
     if (!$this->published) {
         return;
     }
     $this->_live_site = JURI::base(true);
     $this->jversion = new JVersion();
     if (version_compare($this->jversion->getShortVersion(), '1.6.0', '>=')) {
         $this->loadLanguage();
     }
     // Initialize paramters
     $plugin = JPluginHelper::getPlugin('content', 'multithumb');
     if (version_compare($this->jversion->getShortVersion(), '1.6.0', '>=')) {
         $plugin = JPluginHelper::getPlugin('content', 'multithumb');
         $params = new JRegistry();
         if (version_compare($this->jversion->getShortVersion(), '3.0.0', '>=')) {
             $params->loadString($plugin->params);
         } else {
             $params->loadJSON($plugin->params);
         }
         $this->init_params($params, $context);
     } else {
         $this->init_params(new JParameter($plugin->params), $context);
     }
     if ($this->_params->get('highslide_headers') == 2) {
         $this->botAddMultiThumbHeader('highslide');
     }
     if ($this->_params->get('lightbox_headers') == 2) {
         $this->botAddMultiThumbHeader('lightbox');
     }
     if ($this->_params->get('slimbox_headers') == 2) {
         $this->botAddMultiThumbHeader('slimbox');
     }
     if ($this->_params->get('prettyphoto_headers') == 2) {
         $this->botAddMultiThumbHeader('prettyPhoto');
     }
     if ($this->_params->get('shadowbox_headers') == 2) {
         $this->botAddMultiThumbHeader('shadowbox');
     }
     if ($this->_params->get('jquery_headers') == 2) {
         $this->botAddMultiThumbHeader('jquery');
     }
     if ($this->_params->get('iload_headers') == 2) {
         $this->botAddMultiThumbHeader('iLoad');
     }
     if (!$this->_params->get('disable_image_cache_link') && !is_link(JPATH_BASE . "/images/multithumb_thumbs")) {
         symlink(JPATH_CACHE . "/multithumb_thumbs", JPATH_BASE . "/images/multithumb_thumbs");
     }
     if ($this->_params->get('disable_image_cache_link') == 2 && is_link(JPATH_BASE . "/images/multithumb_thumbs")) {
         unlink(JPATH_BASE . "/images/multithumb_thumbs");
     }
 }
Example #12
0
 public function getItem($pk = null)
 {
     if ($item = parent::getItem($pk)) {
         // Convert the params field to an array.
         $registry = new JRegistry();
         $registry->loadJSON($item->metadata);
         $item->metadata = $registry->toArray();
     }
     return $item;
 }
Example #13
0
 /**
  * Overloaded load function
  *
  * @param       int $pk primary key
  * @param       boolean $reset reset data
  * @return      boolean
  * @see JTable:load
  */
 public function load($pk = null, $reset = true)
 {
     if (parent::load($pk, $reset)) {
         // Convert the params field to a registry.
         $params = new JRegistry();
         $params->loadJSON($this->params);
         $this->params = $params;
         return true;
     } else {
         return false;
     }
 }
Example #14
0
 public function onBeforeBrowse()
 {
     $result = parent::onBeforeBrowse();
     if ($result) {
         $view = $this->getThisView();
         $view->setModel($this->getThisModel(), true);
         // Upgrade the database schema if necessary
         $this->getThisModel()->checkAndFixDatabase();
         // Migrate user data if necessary
         $this->getThisModel()->autoMigrate();
         // Refresh the update site definitions if required. Also takes into account any change of the Download ID
         // in the Options.
         /** @var AdmintoolsModelUpdates $updateModel */
         $updateModel = F0FModel::getTmpInstance('Updates', 'AdmintoolsModel');
         $updateModel->refreshUpdateSite();
         // Is a Download ID needed but missing?
         $needDLID = $this->getThisModel()->needsDownloadID();
         $view->needsdlid = $needDLID;
         // Check the last installed version and show the post-setup page on Joomla! 3.1 or earlier
         if (!version_compare(JVERSION, '3.2.0', 'ge')) {
             $versionLast = null;
             if (file_exists(JPATH_COMPONENT_ADMINISTRATOR . '/admintools.lastversion.php')) {
                 include_once JPATH_COMPONENT_ADMINISTRATOR . '/admintools.lastversion.php';
                 if (defined('ADMINTOOLS_LASTVERSIONCHECK')) {
                     $versionLast = ADMINTOOLS_LASTVERSIONCHECK;
                 }
             }
             if (is_null($versionLast)) {
                 // FIX 2.1.13: Load the component parameters WITHOUT using JComponentHelper
                 $db = JFactory::getDbo();
                 $query = $db->getQuery(true);
                 $query->select(array($db->quoteName('params')))->from($db->quoteName('#__extensions'))->where($db->quoteName('type') . ' = ' . $db->Quote('component'))->where($db->quoteName('element') . ' = ' . $db->Quote('com_admintools'));
                 $db->setQuery($query);
                 $rawparams = $db->loadResult();
                 $params = new JRegistry();
                 if (version_compare(JVERSION, '3.0', 'ge')) {
                     $params->loadString($rawparams, 'JSON');
                 } else {
                     $params->loadJSON($rawparams);
                 }
                 $versionLast = $params->get('lastversion', '');
             }
             if (version_compare(ADMINTOOLS_VERSION, $versionLast, 'ne') || empty($versionLast)) {
                 $this->setRedirect('index.php?option=com_admintools&view=postsetup');
                 return true;
             }
         }
     }
     return $result;
 }
Example #15
0
 /**
  * Class constructor
  *
  * @param   array    $options  An array of configuration options.
  *
  * @return  JMenu  A JMenu object
  * @since   11.1
  */
 public function __construct($options = array())
 {
     // Load the menu items
     $this->load();
     foreach ($this->_items as $k => $item) {
         if ($item->home) {
             $this->_default[$item->language] = $item->id;
         }
         // Decode the item params
         $result = new JRegistry();
         $result->loadJSON($item->params);
         $item->params = $result;
     }
 }
Example #16
0
 /**
  * Method to get a list of items.
  *
  * @return	mixed	An array of objects on success, false on failure.
  */
 public function &getItems()
 {
     // Invoke the parent getItems method to get the main list
     $items =& parent::getItems();
     // Convert the params field into an object, saving original in _params
     for ($i = 0, $n = count($items); $i < $n; $i++) {
         $item =& $items[$i];
         if (!isset($this->_params)) {
             $params = new JRegistry();
             $params->loadJSON($item->params);
             $item->params = $params;
         }
     }
     return $items;
 }
Example #17
0
 /**
  * Overloaded load function
  *
  * @param       int $pk primary key
  * @param       boolean $reset reset data
  * @return      boolean
  * @see JTable:load
  */
 public function load($pk = null, $reset = true)
 {
     if (parent::load($pk, $reset)) {
         // Convert the params field to a registry.
         $params = new JRegistry();
         // loadJSON is @deprecated    12.1  Use loadString passing JSON as the format instead.
         // $params->loadString($this->item->params, 'JSON');
         // "item" should not be present.
         $params->loadJSON($this->params);
         $this->params = $params;
         return true;
     } else {
         return false;
     }
 }
Example #18
0
 public function getCommentsParams($id)
 {
     $o = array();
     $item = self::getFbUserInfo($id);
     if (isset($item->appid)) {
         $o['fb_comment_app_id'] = $item->appid;
     }
     if (isset($item->comments) && $item->comments != '') {
         $registry = new JRegistry();
         $registry->loadJSON($item->comments);
         $item->comments = $registry->toArray();
         foreach ($item->comments as $key => $value) {
             $o[$key] = $value;
         }
     }
     return $o;
 }
Example #19
0
 private function _setMiscOptions()
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select($db->qn('params'))->from($db->qn('#__extensions'))->where($db->qn('type') . ' = ' . $db->quote('component'))->where($db->qn('element') . ' = ' . $db->quote('com_admintools'));
     $db->setQuery($query);
     $rawparams = $db->loadResult();
     $params = new JRegistry();
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $params->loadString($rawparams, 'JSON');
     } else {
         $params->loadJSON($rawparams);
     }
     $acceptlicense = $params->get('acceptlicense', '0');
     $acceptsupport = $params->get('acceptsupport', '0');
     $this->acceptlicense = $acceptlicense;
     $this->acceptsupport = $acceptsupport;
 }
Example #20
0
 public function save()
 {
     $data = self::$registry->toString('INI');
     $db =& JFactory::getDBO();
     // An interesting discovery: if your component is manually updating its
     // component parameters before Live Update is called, then calling Live
     // Update will reset the modified component parameters because
     // JComponentHelper::getComponent() returns the old, cached version of
     // them. So, we have to forget the following code and shoot ourselves in
     // the feet. Dammit!!!
     /*
     jimport('joomla.html.parameter');
     jimport('joomla.application.component.helper');
     $component =& JComponentHelper::getComponent(self::$component);
     $params = new JParameter($component->params);
     $params->setValue(self::$key, $data);
     */
     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();
     $params = new JRegistry();
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         $params->loadJSON($rawparams);
     } else {
         $params->loadINI($rawparams);
     }
     $params->setValue(self::$key, $data);
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         // Joomla! 1.6
         $data = $params->toString('JSON');
         $sql = $db->getQuery(true)->update($db->nq('#__extensions'))->set($db->nq('params') . ' = ' . $db->q($data))->where($db->nq('type') . ' = ' . $db->q('component'))->where($db->nq('element') . ' = ' . $db->q(self::$component));
     } else {
         // Joomla! 1.5
         $data = $params->toString('INI');
         $sql = 'UPDATE `#__components` SET `params` = ' . $db->Quote($data) . ' WHERE ' . "`option` = " . $db->Quote(self::$component) . " AND `parent` = 0 AND `menuid` = 0";
     }
     $db->setQuery($sql);
     $db->query();
 }
Example #21
0
 public function __construct()
 {
     jimport('joomla.filesystem.file');
     // Require helper file
     if (!defined('DS')) {
         define('DS', DIRECTORY_SEPARATOR);
     }
     $version_php = JPATH_COMPONENT_ADMINISTRATOR . DS . 'version.php';
     if (!defined('COM_CWCONTACT_VERSION') && JFile::exists($version_php)) {
         require_once $version_php;
     }
     $isPro = COM_CWCONTACT_PRO == 1;
     // Load the component parameters, not using JComponentHelper to avoid conflicts ;)
     jimport('joomla.html.parameter');
     jimport('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_coalawebcontact'));
     $db->setQuery($sql);
     $rawparams = $db->loadResult();
     $params = new JRegistry();
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $params->loadString($rawparams, 'JSON');
     } else {
         $params->loadJSON($rawparams);
     }
     // Determine the appropriate update URL based on whether we're on Core or Professional edition
     if ($isPro) {
         $this->_updateURL = 'https://coalaweb.com/index.php?option=com_ars&view=update&format=ini&id=12';
         $this->_extensionTitle = 'CoalaWeb Contact Pro';
     } else {
         $this->_updateURL = 'https://coalaweb.com/index.php?option=com_ars&view=update&format=ini&id=11';
         $this->_extensionTitle = 'CoalaWeb Contact Core';
     }
     // Get the minimum stability level for updates
     $this->_minStability = 'beta';
     // Do we need authorized URLs?
     $this->_requiresAuthorization = $isPro;
     // Should I use our private CA store?
     if (@file_exists(dirname(__FILE__) . '/../assets/cacert.pem')) {
         $this->_cacerts = dirname(__FILE__) . '/../assets/cacert.pem';
     }
     parent::__construct();
 }
Example #22
0
 /**
  * Get the message
  * @return object The message to be displayed to the user
  */
 public function getItem()
 {
     if (!isset($this->item)) {
         $id = $this->getState('message.id');
         $this->_db->setQuery($this->_db->getQuery(true)->from('#__helloworld as h')->leftJoin('#__categories as c ON h.catid=c.id')->select('h.greeting, h.params, c.title as category')->where('h.id=' . (int) $id));
         if (!($this->item = $this->_db->loadObject())) {
             $this->setError($this->_db->getError());
         } else {
             // Load the JSON string
             $params = new JRegistry();
             $params->loadJSON($this->item->params);
             $this->item->params = $params;
             // Merge global params with item params
             $params = clone $this->getState('params');
             $params->merge($this->item->params);
             $this->item->params = $params;
         }
     }
     return $this->item;
 }
Example #23
0
 /**
  * redefine the function an add some properties to make the styling more easy
  *
  * @return mixed An array of data items on success, false on failure.
  */
 public function getItems()
 {
     if (!count($this->_items)) {
         $app = JFactory::getApplication();
         $menu = $app->getMenu();
         $active = $menu->getActive();
         $params = new JRegistry();
         if ($active) {
             $params->loadJSON($active->params);
         }
         $options = array();
         $options['countItems'] = $params->get('show_cat_items_cat', 1) || !$params->get('show_empty_categories_cat', 0);
         $categories = JCategories::getInstance('Contact', $options);
         $this->_parent = $categories->get($this->getState('filter.parentId', 'root'));
         if (is_object($this->_parent)) {
             $this->_items = $this->_parent->getChildren();
         } else {
             $this->_items = false;
         }
     }
     return $this->_items;
 }
Example #24
0
 function loadParams(&$result)
 {
     if (!empty($result->params)) {
         if (version_compare(JVERSION, '1.6', '<')) {
             $lines = explode("\n", $result->params);
             $result->params = array();
             foreach ($lines as $line) {
                 $param = explode('=', $line, 2);
                 if (count($param) == 2) {
                     $result->params[$param[0]] = $param[1];
                 }
             }
         } else {
             $registry = new JRegistry();
             if (!HIKASHOP_J30) {
                 $registry->loadJSON($result->params);
             } else {
                 $registry->loadString($result->params);
             }
             $result->params = $registry->toArray();
         }
     }
 }
Example #25
0
 /**
  * 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)
 {
     // Initialise variables.
     $pk = !empty($pk) ? $pk : (int) $this->getState('style.id');
     if (!isset($this->_cache[$pk])) {
         $false = false;
         // Get a row instance.
         $table =& $this->getTable();
         // 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.
         $this->_cache[$pk] = JArrayHelper::toObject($table->getProperties(1), 'JObject');
         // Convert the params field to an array.
         $registry = new JRegistry();
         $registry->loadJSON($table->params);
         $this->_cache[$pk]->params = $registry->toArray();
     }
     return $this->_cache[$pk];
 }
Example #26
0
 function display($tpl = null)
 {
     $this->mainframe = JFactory::getApplication();
     $this->option = JRequest::getCmd('option');
     $filter_order = $this->mainframe->getUserStateFromRequest($this->option . '.polls.filter_order', 'filter_order', 'm.title', 'string');
     $filter_order_Dir = $this->mainframe->getUserStateFromRequest($this->option . '.polls.filter_order_Dir', 'filter_order_Dir', '', 'word');
     $search = $this->mainframe->getUserStateFromRequest($this->option . '.polls.search', 'search', '', 'string');
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     JHTML::_('behavior.tooltip');
     $menu = JSite::getMenu()->getActive();
     $menu_params = new JRegistry();
     $menu_params->loadJSON($menu->params);
     $params = clone $this->mainframe->getParams();
     $params->merge($menu_params);
     $this->assignRef('lists', $lists);
     $this->assignRef('params', $params);
     $this->assignRef('items', $this->get('Data'));
     $this->assignRef('pagination', $this->get('Pagination'));
     parent::display($tpl);
 }
Example #27
0
 /**
  * Method to get category data for the current category
  *
  * @param	int		An optional ID
  *
  * @return	object
  * @since	1.5
  */
 public function getCategory()
 {
     if (!is_object($this->_item)) {
         $app = JFactory::getApplication();
         $menu = $app->getMenu();
         $active = $menu->getActive();
         $params = new JRegistry();
         if ($active) {
             $params->loadJSON($active->params);
         }
         $options = array();
         $options['countItems'] = $params->get('show_cat_items', 1) || $params->get('show_empty_categories', 0);
         $categories = JCategories::getInstance('Newsfeeds', $options);
         $this->_item = $categories->get($this->getState('category.id', 'root'));
         if (is_object($this->_item)) {
             $this->_children = $this->_item->getChildren();
             $this->_parent = false;
             if ($this->_item->getParent()) {
                 $this->_parent = $this->_item->getParent();
             }
             $this->_rightsibling = $this->_item->getSibling();
             $this->_leftsibling = $this->_item->getSibling(false);
         } else {
             $this->_children = false;
             $this->_parent = false;
         }
     }
     return $this->_item;
 }
Example #28
0
 /**
  * Returns the category metadata
  *
  * @return  JRegistry  A JRegistry object containing the metadata
  * @since   11.1
  */
 function getMetadata()
 {
     if (!$this->metadata instanceof JRegistry) {
         $temp = new JRegistry();
         $temp->loadJSON($this->metadata);
         $this->metadata = $temp;
     }
     return $this->metadata;
 }
Example #29
0
 /**
  *
  * Callback function
  * @param string $tagAttr
  * @param string $tagContent
  * @return string
  */
 function callBack($tagAttr, $tagContent)
 {
     $tagAttr = $this->parseParamValue($tagAttr);
     $modalObject = $this->_modelObject[0];
     // Check model
     if (isset($tagAttr['modal'])) {
         // load plugin parameters
         $plugin = JPluginHelper::getPlugin('system', 'japopup');
         $params = new JRegistry();
         $params->loadJSON($plugin->params);
         // Get modal window type
         $modal = $tagAttr['modal'];
         // Require library for each Popup type
         if (!file_exists(dirname(__FILE__) . '/' . $modal . '/' . $modal . '.php')) {
             return;
         }
         require_once dirname(__FILE__) . '/' . $modal . '/' . $modal . '.php';
         $modalWindowType = $modal . "Class";
         $modalObject = new $modalWindowType($params);
         $this->_modelObject[] = $modalObject;
     }
     if (is_array($this->_callback) && count($this->_callback) >= 2) {
         $callbackmethod = $this->_callback[1];
         return $modalObject->{$callbackmethod}($tagAttr, $tagContent);
     } else {
         if (function_exists($this->_callback)) {
             $callback = $this->_callback;
             return $callback($tagAttr, $tagContent);
         }
     }
 }
Example #30
0
 function &getItems()
 {
     if (!isset($this->_items)) {
         $this->_items =& parent::getItems();
         foreach ($this->_items as &$item) {
             $parameters = new JRegistry();
             $parameters->loadJSON($item->params);
             $item->params = $parameters->toObject();
         }
     }
     return $this->_items;
 }