Example #1
0
 /**
  * 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;
 }
 /**
  * Method to run after installing the component
  */
 function postflight($type, $parent)
 {
     //Restore the modified language strings by merging to language files
     $registry = new JRegistry();
     foreach (self::$languageFiles as $languageFile) {
         $backupFile = JPATH_ROOT . '/language/en-GB/bak.' . $languageFile;
         $currentFile = JPATH_ROOT . '/language/en-GB/' . $languageFile;
         if (JFile::exists($currentFile) && JFile::exists($backupFile)) {
             $registry->loadFile($currentFile, 'INI');
             $currentItems = $registry->toArray();
             $registry->loadFile($backupFile, 'INI');
             $backupItems = $registry->toArray();
             $items = array_merge($currentItems, $backupItems);
             $content = "";
             foreach ($items as $key => $value) {
                 $content .= "{$key}=\"{$value}\"\n";
             }
             JFile::write($currentFile, $content);
         }
     }
     // Restore custom modified css file
     if (JFile::exists(JPATH_ROOT . '/components/com_osmembership/assets/css/bak.custom.css')) {
         JFile::copy(JPATH_ROOT . '/components/com_osmembership/assets/css/bak.custom.css', JPATH_ROOT . '/components/com_osmembership/assets/css/custom.css');
         JFile::delete(JPATH_ROOT . '/components/com_osmembership/assets/css/bak.custom.css');
     }
 }
Example #3
0
 public function getUpdates()
 {
     $updates = array();
     $all_plugins = $this->folder('j2store')->getList();
     $json = $this->sendRequest();
     $update_data = array();
     if (!empty($json)) {
         $registry = new JRegistry($json);
         $update_data = $registry->toArray();
     } else {
         return $updates;
     }
     //get plugins that have updates
     foreach ($all_plugins as $plugin) {
         if (isset($update_data[$plugin->element])) {
             //load manifest cache to get the version
             $manifest = json_decode($plugin->manifest_cache);
             if ($manifest) {
                 $version = (string) $manifest->version;
                 if (version_compare($update_data[$plugin->element], $version, 'gt')) {
                     $plugin->current_version = $version;
                     $plugin->new_version = $update_data[$plugin->element];
                     $updates[] = $plugin;
                 }
             }
         }
     }
     return $updates;
 }
 /**
  * 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;
 }
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     $options = array();
     $compositions_id = $this->form->getValue('id') ? $this->form->getValue('id') : 0;
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select("id AS `value`, title AS `text`, print_title")->from('#__sibdiet_compositions AS a')->order('a.title')->where("TRIM(IFNULL(a.compositions,'')) = '' AND a.id <> " . $compositions_id);
     // Get the options.
     $db->setQuery($query);
     try {
         $options = $db->loadObjectList();
     } catch (RuntimeException $e) {
         JError::raiseWarning(500, $e->getMessage());
     }
     $lang_tag = JFactory::getLanguage()->get('tag');
     foreach ($options as $key => $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)) {
             $options[$key]->text .= ' { ' . $print_title[$lang_tag] . ' }';
         }
         // Disable selected values
         if (array_key_exists($options[$key]->value, $this->value)) {
             $options[$key]->disable = 1;
         }
     }
     array_unshift($options, JHtml::_('select.option', '', ''));
     return $options;
 }
Example #6
0
	/**
	 * Load user form.
	 *
	 * @return void
	 */
	protected function before()
	{
		parent::before();

		$userParams = JComponentHelper::getParams('com_users');

		// Check if user is allowed to change his name.
		$this->changeUsername = $userParams->get('change_login_name', 1);

		// Check to see if Frontend User Params have been enabled.
		if ($userParams->get('frontend_userparams', 0))
		{
			JFactory::getLanguage()->load('com_users', JPATH_ADMINISTRATOR);

			JForm::addFormPath(JPATH_ROOT . '/components/com_users/models/forms');
			JForm::addFieldPath(JPATH_ROOT . '/components/com_users/models/fields');

			JPluginHelper::importPlugin('user');

			$registry = new JRegistry($this->user->params);
			$form = JForm::getInstance('com_users.profile', 'frontend');
			$data = new StdClass;
			$data->params = $registry->toArray();
			$dispatcher = JDispatcher::getInstance();
			$dispatcher->trigger('onContentPrepareForm', array($form, $data));

			$form->bind($data);
			$this->frontendForm = $form->getFieldset('params');
		}

		$this->headerText = JText::_('COM_KUNENA_PROFILE_EDIT_USER_TITLE');
	}
Example #7
0
 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a Error object.
  */
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $this->item = $this->get('Item');
     $this->print = $app->input->getBool('print');
     $this->secretkey = $app->input->getString('secretkey');
     $this->state = $this->get('State');
     $this->user = $user;
     $this->params = $this->state->get('params');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     // Check the view access to the request print.
     if ($user->get('guest')) {
         if (!empty($this->secretkey) && $this->secretkey == $this->item->secretkey) {
             // User requested diet print by secret key
         } else {
             JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
             return;
         }
     }
     // Convert body field to array.
     $registry = new JRegistry();
     $registry->loadString($this->item->body);
     $this->item->body = $registry->toArray();
     $this->item = (object) array_merge((array) $this->item, $this->item->body);
     $this->item = SibdietHelper::calculate($this->item);
     //Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $this->_prepareDocument();
     parent::display($tpl);
 }
Example #8
0
 /**
  * Display the view
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     SibdietHelper::addSubmenu('requestschecks');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $this->permissions = SibdietHelper::getUserPermissions();
     // Calculate profile refer No.
     foreach ($this->items as $item) {
         $item->referNo = SibdietHelper::getReferNo($item->profiles_id);
         // Convert the payment field to an array.
         $registry = new JRegistry();
         $registry->loadString($item->payment);
         $item->payment = $registry->toArray();
     }
     $this->addToolbar();
     $this->sidebar = JHtmlSidebar::render();
     if (in_array('requestschecks', $this->permissions)) {
         parent::display($tpl);
     }
 }
Example #9
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;
 }
Example #10
0
 /**
  * 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;
 }
Example #11
0
 /**
  * Method to get a single record.
  *
  * @param   integer  $pk  The id of the primary key.
  *
  * @return  mixed    Object on success, false on failure.
  *
  * @since   12.2
  */
 public function getItem($pk = null)
 {
     $item = parent::getItem($pk);
     $db = JFactory::getDbo();
     $model_table = JModelLegacy::getInstance("Table", "JDeveloperModel");
     if ($item->table) {
         $table = JModelLegacy::getInstance("Table", "JDeveloperModel")->getItem($item->table);
         $item->component_name = "com_" . JModelLegacy::getInstance("Component", "JDeveloperModel")->getItem($table->component)->name;
     }
     // Exists field in database?
     if ($model_table->isInstalled($item->table)) {
         $item->isInstalled = $this->dbColumnExists($item, "", true);
     } else {
         $item->isInstalled = false;
     }
     // Add formfield id
     $query = $db->getQuery(true)->select("id")->from("#__jdeveloper_formfields as ff")->where("ff.name = " . $db->quote($item->type));
     $item->formfield_id = (int) $db->setQuery($query)->loadResult();
     // Add formrule id
     $query = $db->getQuery(true)->select("id")->from("#__jdeveloper_formrules as fr")->where("fr.name = " . $db->quote($item->rule));
     $item->formrule_id = (int) $db->setQuery($query)->loadResult();
     // Load options
     $registry = new JRegistry();
     $registry->loadString($item->options);
     $item->options = $registry->toArray();
     // Load attributes
     $registry = new JRegistry();
     $registry->loadString($item->attributes);
     $item->attributes = $registry->toArray();
     return $item;
 }
Example #12
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];
 }
Example #13
0
 public function _getURL($user, $sizex, $sizey)
 {
     if (!$user->userid == 0) {
         $user = KunenaFactory::getUser($user->userid);
         $user = JsnHelper::getUser($user->userid);
         if ($sizex <= 50) {
             $avatar = JURI::root(true) . '/' . $user->getValue('avatar_mini');
         } else {
             $avatar = JURI::root(true) . '/' . $user->getValue('avatar');
         }
     } elseif ($this->params->get('guestavatar', "easyprofile") == "easyprofile") {
         $avatar = JUri::root(true) . '/components/com_jsn/assets/img/default.jpg';
     } else {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('params')->from('#__jsn_fields')->where('alias=\'avatar\'');
         $db->setQuery($query);
         $params = $db->loadResult();
         $registry = new JRegistry();
         $registry->loadString($params);
         $params = $registry->toArray();
         if ($params['image_defaultvalue'] != "") {
             $avatar = JUri::root(true) . '/' . $params['image_defaultvalue'];
         } else {
             $avatar = JUri::root(true) . '/components/com_jsn/assets/img/default.jpg';
         }
     }
     return $avatar;
 }
Example #14
0
 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;
 }
Example #15
0
	/**
	 * 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;
	}
Example #16
0
 /**
  * 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);
 }
Example #17
0
 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;
 }
 public function getItem($pk = null)
 {
     if ($item = parent::getItem($pk)) {
         $registry = new JRegistry();
         $registry->loadString($item->metadata);
         $item->metadata = $registry->toArray();
     }
     // Load associated contact items
     $app = JFactory::getApplication();
     $assoc = JLanguageAssociations::isEnabled();
     if ($assoc) {
         $item->associations = array();
         if ($item->id != null) {
             $associations = JLanguageAssociations::getAssociations('com_authorlist', '#__authorlist', 'com_authorlist.author', $item->id, 'id', '', '');
             foreach ($associations as $tag => $association) {
                 $item->associations[$tag] = $association->id;
             }
         }
     }
     // Load item tags
     if (!empty($item->id)) {
         $item->tags = new JHelperTags();
         $item->tags->getTagIds($item->id, 'com_authorlist.author');
     }
     return $item;
 }
Example #19
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)
 {
     $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;
 }
 /**
  * Convert a registry type object to a RokCommon_Registry
  * @static
  *
  * @param JRegistry $original The original registry type object to convert to a RokCommon_Registry
  * @return \RokCommon_Registry
  */
 public function convert($original)
 {
     $registry = new RokCommon_Registry();
     $original_values = $original->toArray();
     self::copyData($registry, $original_values);
     return $registry;
 }
Example #21
0
 public function getItem($itemId = null)
 {
     $itemId = (int) (!empty($itemId)) ? $itemId : $this->getState('article.id');
     // 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;
     }
     $properties = $table->getProperties(1);
     $value = JArrayHelper::toObject($properties, 'JObject');
     // Convert attrib field to Registry.
     $value->params = new JRegistry();
     $value->params->loadString($value->attribs);
     // Compute selected asset permissions.
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $asset = 'com_content.article.' . $value->id;
     // Check general edit permission first.
     if ($user->authorise('core.edit', $asset)) {
         $value->params->set('access-edit', true);
     } elseif (!empty($userId) && $user->authorise('core.edit.own', $asset)) {
         // Check for a valid user and that they are the owner.
         if ($userId == $value->created_by) {
             $value->params->set('access-edit', true);
         }
     }
     // Check edit state permission.
     if ($itemId) {
         // Existing item
         $value->params->set('access-change', $user->authorise('core.edit.state', $asset));
     } else {
         // New item.
         $catId = (int) $this->getState('article.catid');
         if ($catId) {
             $value->params->set('access-change', $user->authorise('core.edit.state', 'com_content.category.' . $catId));
             $value->catid = $catId;
         } else {
             $value->params->set('access-change', $user->authorise('core.edit.state', 'com_content'));
         }
     }
     $value->articletext = $value->introtext;
     if (!empty($value->fulltext)) {
         $value->articletext .= '<hr id="system-readmore" />' . $value->fulltext;
     }
     // Convert the metadata field to an array.
     $registry = new JRegistry();
     $registry->loadString($value->metadata);
     $value->metadata = $registry->toArray();
     if ($itemId) {
         $value->tags = new JHelperTags();
         $value->tags->getTagIds($value->id, 'com_content.article');
         $value->metadata['tags'] = $value->tags;
     }
     return $value;
 }
Example #22
0
 public function load()
 {
     $params = JComponentHelper::getComponent('com_files')->params;
     $registry = new JRegistry();
     $registry->loadIni($params);
     $this->setData($registry->toArray());
     return $this;
 }
 function installMessage()
 {
     $db = JFactory::getDBO();
     $lang = JFactory::getLanguage();
     $currentlang = $lang->getTag();
     $objectReadxmlDetail = new JSNISReadXmlDetails();
     $infoXmlDetail = $objectReadxmlDetail->parserXMLDetails();
     $langSupport = $infoXmlDetail['langs'];
     $registry = new JRegistry();
     $newStrings = array();
     $path = null;
     $realLang = null;
     $queries = array();
     if (array_key_exists($currentlang, $langSupport)) {
         $path = JLanguage::getLanguagePath(JPATH_BASE, $currentlang);
         $realLang = $currentlang;
     } else {
         $filepath = JPATH_ROOT . DS . 'administrator' . DS . 'language';
         $foldersLang = $this->getFolder($filepath);
         foreach ($foldersLang as $value) {
             if (in_array($value, $langSupport) == true) {
                 $path = JLanguage::getLanguagePath(JPATH_BASE, $value);
                 $realLang = $value;
                 break;
             }
         }
     }
     $filename = $path . DS . $realLang . '.com_imageshow.ini';
     $objJNSUtils = JSNISFactory::getObj('classes.jsn_is_utils');
     $content = $objJNSUtils->readFileToString($filename);
     if ($content) {
         $registry->loadString($content);
         $newStrings = $registry->toArray();
         if (count($newStrings)) {
             if (count($infoXmlDetail['menu'])) {
                 $queries[] = 'TRUNCATE TABLE #__jsn_imageshow_messages';
                 foreach ($infoXmlDetail['menu'] as $value) {
                     $index = 1;
                     while (isset($newStrings['MESSAGE_' . $value . '_' . $index . '_PRIMARY'])) {
                         $queries[] = 'INSERT INTO #__jsn_imageshow_messages (msg_screen, published, ordering) VALUES (\'' . $value . '\', 1, ' . $index . ')';
                         $index++;
                     }
                 }
             }
         }
         if (count($queries)) {
             foreach ($queries as $query) {
                 $query = trim($query);
                 if ($query != '') {
                     $db->setQuery($query);
                     $db->query();
                 }
             }
         }
     }
     return true;
 }
Example #24
0
 public function getItem($pk = null, $refresh = false, $emptyState = true)
 {
     if ($item = parent::getItem($pk, $refresh, $emptyState)) {
         $formdata = new JRegistry();
         $formdata->loadString($item->params);
         $item->data = $formdata->toArray('data');
     }
     return $item;
 }
 function installMessage()
 {
     $db =& JFactory::getDBO();
     $lang =& JFactory::getLanguage();
     $currentlang = $lang->getTag();
     $objectReadxmlDetail = new JSNISReadXmlDetails();
     $infoXmlDetail = $objectReadxmlDetail->parserXMLDetails();
     $langSupport = $infoXmlDetail['langs'];
     $registry = new JRegistry();
     $newStrings = array();
     $path = null;
     $realLang = null;
     $queries = array();
     if (array_key_exists($currentlang, $langSupport)) {
         $path = JLanguage::getLanguagePath(JPATH_BASE, $currentlang);
         $realLang = $currentlang;
     } else {
         $filepath = JPATH_ROOT . DS . 'administrator' . DS . 'language';
         $foldersLang = $this->getFolder($filepath);
         foreach ($foldersLang as $value) {
             if (in_array($value, $langSupport) == true) {
                 $path = JLanguage::getLanguagePath(JPATH_BASE, $value);
                 $realLang = $value;
                 break;
             }
         }
     }
     $filename = $path . DS . $realLang . '.com_imageshow.ini';
     $content = @file_get_contents($filename);
     if ($content) {
         $registry->loadINI($content);
         $newStrings = $registry->toArray();
         if (count($newStrings)) {
             if (count($infoXmlDetail['menu'])) {
                 $queries[] = 'TRUNCATE TABLE `#__imageshow_messages`';
                 foreach ($infoXmlDetail['menu'] as $value) {
                     $index = 1;
                     while (isset($newStrings['MESSAGE ' . $value . ' ' . $index . ' PRIMARY'])) {
                         $queries[] = 'INSERT INTO `#__imageshow_messages` (`msg_id`,`msg_screen`,`published`,`ordering`) VALUES (NULL, "' . $value . '", 1, ' . $index . ')';
                         $index++;
                     }
                 }
             }
         }
         if (count($queries)) {
             foreach ($queries as $query) {
                 $query = trim($query);
                 if ($query != '') {
                     $db->setQuery($query);
                     $db->query();
                 }
             }
         }
     }
     return true;
 }
Example #26
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 #27
0
 public function getItem($pk = null)
 {
     $item = parent::getItem($pk);
     if ($item->id) {
         $registry = new JRegistry();
         $registry->loadString($item->metadata);
         $item->metadata = $registry->toArray();
     }
     return $item;
 }
Example #28
0
 /**
  * 
  * get item override
  */
 public function getItem($pk = null)
 {
     $item = parent::getItem($pk);
     if (property_exists($item, "visual") && is_array($item->visual) == false) {
         $registry = new JRegistry();
         $registry->loadString($item->visual, 'JSON');
         $item->visual = $registry->toArray();
     }
     return $item;
 }
Example #29
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)
 {
     if ($item = parent::getItem($pk)) {
         // Convert the params field to an array.
         $registry = new JRegistry();
         $registry->loadString($item->attribs);
         $item->attribs = $registry->toArray();
     }
     return $item;
 }
Example #30
0
 protected function getInput()
 {
     $html = array();
     $selectTypes = array();
     $type = "checkbox";
     $attr = '';
     //var_dump($this);
     $value = $this->value;
     if (!is_array($value)) {
         // Convert the selections field to an array.
         $registry = new JRegistry();
         $registry->loadString($value);
         $value = $registry->toArray();
     }
     $doc = JFactory::getDocument();
     $doc->addScriptDeclaration("\n\t\twindow.addEvent('domready',function(){\n            \$\$('div.menu-options select').addEvent('mouseover',function(event){MenusSortable.detach();})\n            \$\$('div.menu-options select').addEvent('mouseout',function(event){MenusSortable.attach();})\n\t\t\tvar MenusSortable = new Sortables(\$('ul_" . $this->id . "'),{\n\t\t\t\tclone:true,\n\t\t\t\trevert: true,\n                preventDefault: true,\n\t\t\t\tonStart: function(el) {\n\t\t\t\t\tel.setStyle('background','#bbb');\n\t\t\t\t},\n\t\t\t\tonComplete: function(el) {\n\t\t\t\t\tel.setStyle('background','#eee');\n\t\t\t\t}\n\t\t\t});\n\t\t});");
     $i = 0;
     $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
     $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
     $attr .= ' ';
     $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
     $options = (array) $this->getOptions();
     $html = '<ul id="ul_' . $this->id . '" class="ul_sortable">';
     $this->currentItems = array_keys($value);
     uasort($options, array($this, 'myCompare'));
     foreach ($options as $option) {
         $selected = isset($this->value[$option->id]['checked']) ? ' checked="checked"' : '';
         $i++;
         $html .= '<li id="menu_' . $i . '">';
         $html .= '  <input type="' . $type . '" id="' . $this->id . '_' . $i . '" name="' . $this->name . '[' . $option->id . '][checked]' . '" ' . $attr . $selected . ' /><label for="' . $this->id . '_' . $i . '" class="menu_label">' . $option->name . '</label>';
         if ($option->type == "dropdown") {
             $html .= '  <div class="menu-options" id="menu_options_' . $i . '">';
             $selectTypes = array();
             $selectTypes[] = JHTML::_('select.option', 'dropdown', 'Dropdown-list');
             $selectTypes[] = JHTML::_('select.option', 'multiple', 'Multiple list');
             $selectTypes[] = JHTML::_('select.option', 'radio', 'Radio button');
             $selectTypes[] = JHTML::_('select.option', 'checkbox', 'Checkbox list');
             $html .= JHtml::_('select.genericlist', $selectTypes, $this->name . '[' . $option->id . '][type]', trim($attr), 'value', 'text', !empty($this->value[$option->id]) ? $this->value[$option->id] : '', $option->id);
             $html .= '</div>';
         }
         if ($option->type == "measurement") {
             $html .= '  <div class="menu-options" id="menu_options_' . $i . '">';
             $selectTypes = array();
             $selectTypes[] = JHTML::_('select.option', 'texrange', 'Value Range');
             $selectTypes[] = JHTML::_('select.option', 'select', 'Drop down-list');
             $html .= JHtml::_('select.genericlist', $selectTypes, $this->name . '[' . $option->id . '][type]', trim($attr), 'value', 'text', !empty($this->value[$option->id]) ? $this->value[$option->id] : '', $option->id);
             $html .= '<br/>';
             $html .= '<input type="text" title="' . JText::_('MOD_BT_PORTFOLIOFILTER_INPUTVALUE') . '" class="inputbox" name="' . $this->name . '[' . $option->id . '][value]' . '" value="' . (!empty($this->value[$option->id]['value']) ? $this->value[$option->id]['value'] : '') . '">';
             $html .= '</div>';
         }
         $html .= '</li>';
     }
     $html .= "</ul>";
     return $html;
 }