Пример #1
3
 protected function prepareDisplay($preconfig)
 {
     if (JCck::getConfig_Param('debug', 0)) {
         jimport('joomla.error.profiler');
         $profiler = new JProfiler();
     }
     $app = JFactory::getApplication();
     $this->form = $this->get('Form');
     $this->option = $app->input->get('option', '');
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     $option = $this->option;
     $params = new JRegistry();
     $view = $this->getName();
     $isNew = 1;
     $live = '';
     $lives = array();
     $variation = '';
     jimport('cck.base.form.form');
     include_once JPATH_LIBRARIES_CCK . '/base/form/form_inc.php';
     if (isset($config['id'])) {
         JFactory::getSession()->set('cck_hash_seblod_form', JApplication::getHash($id . '|' . $type->name . '|' . $config['id']));
     }
     $this->config =& $config;
     $this->data =& $data;
     $this->id =& $id;
     $this->isNew =& $isNew;
     $this->params =& $params;
     $this->stage =& $stage;
     $this->type =& $type;
     $title = isset($type->title) ? $type->title : '';
     $name = isset($type->name) ? $type->name : '';
     $this->addToolbar($title, $name);
 }
Пример #2
2
 public function getInput()
 {
     jimport('joomla.filesystem.file');
     $mainframe = JFactory::getApplication();
     if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_joomailermailchimpintegration/libraries/MCAPI.class.php')) {
         $mainframe->enqueueMessage(JText::_('JM_PLEASE_INSTALL_JOOMLAMAILER'), 'error');
         $mainframe->redirect('index.php');
     }
     $listId = $this->form->getValue('listid', 'params');
     require_once JPATH_ADMINISTRATOR . '/components/com_joomailermailchimpintegration/libraries/MCAPI.class.php';
     $params = JComponentHelper::getParams('com_joomailermailchimpintegration');
     $MCapi = $params->get('params.MCapi');
     $api = new joomlamailerMCAPI($MCapi);
     $interests = $api->listInterestGroupings($listId);
     $options = array();
     if ($interests) {
         foreach ($interests as $interest) {
             if ($interest['form_field'] != 'hidden') {
                 $groups = array();
                 foreach ($interest['groups'] as $ig) {
                     $groups[] = $ig['name'];
                 }
                 $groups = implode('####', $groups);
                 $options[] = array('id' => $interest['id'] . ';' . $interest['form_field'] . ';' . $interest['name'] . ';' . $groups, 'name' => $interest['name']);
             }
         }
     }
     if (count($options)) {
         return JHtml::_('select.genericlist', $options, 'jform[params][interests][]', 'multiple="multiple"', 'id', 'name', $this->value, $this->id);
     } else {
         return JText::_('JM_NO_INTEREST_GROUPS');
     }
 }
 public function delete()
 {
     // Check for request forgeries
     JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
     // Get items to remove from the request.
     $cid = JFactory::getApplication()->input->get('cid', array(), 'array');
     if (!is_array($cid) || count($cid) < 1) {
         JLog::add(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), JLog::WARNING, 'jerror');
     } else {
         // Get the model.
         $model = $this->getModel();
         // Make sure the item ids are integers
         jimport('joomla.utilities.arrayhelper');
         JArrayHelper::toInteger($cid);
         // Remove the items.
         if ($model->delete($cid)) {
             $this->setMessage(JText::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid)));
         } else {
             $this->setMessage($model->getError());
         }
     }
     $version = new JVersion();
     if ($version->isCompatible('3.0')) {
         // Invoke the postDelete method to allow for the child class to access the model.
         $this->postDeleteHook($model, $cid);
     }
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
 }
 /**
  * @dataProvider getVarData
  * @covers JRequest::getVar
  * @covers JRequest::_cleanVar
  * @covers JRequest::_stripSlashesRecursive
  */
 public function testGetVarFromDataSet($name, $default, $hash, $type, $mask, $expect, $filterCalls)
 {
     jimport('joomla.environment.request');
     $filter = JFilterInput::getInstance();
     $filter->mockReset();
     if (count($filterCalls)) {
         foreach ($filterCalls as $info) {
             $filter->mockSetUp($info[0], $info[1], $info[2], $info[3]);
         }
     }
     /*
      * Get the variable and check the value.
      */
     $actual = JRequest::getVar($name, $default, $hash, $type, $mask);
     $this->assertEquals($expect, $actual, 'Non-cached getVar');
     /*
      * Repeat the process to check caching (the JFilterInput mock should not
      * get called unless the default is being used).
      */
     $actual = JRequest::getVar($name, $default, $hash, $type, $mask);
     $this->assertEquals($expect, $actual, 'Cached getVar');
     if (($filterOK = $filter->mockTearDown()) !== true) {
         $this->fail('JFilterInput not called as expected:' . print_r($filterOK, true));
     }
 }
 public function setUp()
 {
     //require_once dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))).'/bootstrap.php';
     jimport('joomla.cache.cache');
     require_once dirname(dirname(__FILE__)) . '/storage/JCacheStorageMock.php';
     require_once dirname(__FILE__) . '/JCacheControllerCallback.helper.php';
 }
Пример #6
0
 function display()
 {
     jimport('joomla.application.module.helper');
     $module =& JModuleHelper::getModule('mod_login');
     $module = JModuleHelper::renderModule($module, array('style' => 'rounded', 'id' => 'section-box'));
     echo $module;
 }
Пример #7
0
 function start($name, $options = array())
 {
     $ret = '';
     if ($this->mode == 'pane') {
         jimport('joomla.html.pane');
         if (!empty($this->options)) {
             $options = array_merge($options, $this->options);
         }
         $this->tabs = JPane::getInstance('tabs', $options);
         $ret .= $this->tabs->startPane($name);
     } elseif ($this->mode == 'tabs') {
         if (!empty($this->options)) {
             $options = array_merge($options, $this->options);
         }
         $ret .= JHtml::_('tabs.start', $name, $options);
     } else {
         $this->name = $name;
         if ($this->options == null) {
             $this->options = $options;
         } else {
             $this->options = array_merge($this->options, $options);
         }
     }
     return $ret;
 }
Пример #8
0
 function displayItems()
 {
     $model = $this->getModel('logs');
     $lists = $model->getvar();
     $filter_order = $lists['filter_order'];
     $filter_order_Dir = $lists['filter_order_Dir'];
     $limit = $lists['limit'];
     $limitstart = $lists['limitstart'];
     $search = $lists['search'];
     $search = JString::strtolower($search);
     $where = $model->getWhereClause($lists);
     //echo $where;
     //order by
     $orderby = '  ORDER BY ' . $filter_order . ' ' . $filter_order_Dir;
     $total = $model->getItems($where, 1);
     //limit
     if ($limit > $total) {
         $limitstart = 0;
     }
     if ($limit == 0) {
         $limit = $total;
     }
     $limited = "  LIMIT " . $limitstart . ',' . $limit;
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $lists['limitstart'], $lists['limit']);
     $items = $model->getItems($where, 0, $orderby, $limited);
     $this->assign('items', $items);
     $this->assign('lists', $lists);
     $this->assign('pageNav', $pageNav);
 }
Пример #9
0
	static public function detectIntegration($name, $best = false) {
		jimport ( 'joomla.filesystem.folder' );
		$dir = dirname ( __FILE__ );
		$folders = JFolder::folders ( $dir );
		$list = array ();
		require_once "$dir/$name.php";
		foreach ( $folders as $integration ) {
			$file = "$dir/$integration/$name.php";
			if (is_file ( $file )) {
				require_once $file;
				$obj = self::_initialize ( $name, $integration );
				$priority = 0;
				if ($obj)
					$priority = $obj->priority;
				if ($obj !== false) $list [$integration] = $priority;
				unset ( $obj );
			}
		}
		if ($best) {
			// Return best choice
			arsort ( $list );
			reset ( $list );
			return key ( $list );
		}
		// Return associative list of all options
		return $list;
	}
Пример #10
0
 /**
  * Return JSON encoded data for Statistic page
  */
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $params = $app->getParams();
     jimport('joomla.environment.request');
     /* validating request */
     $guild_id = $params->get('guild_id', '0');
     $groups = $params->get('allowed_groups');
     $by_chars = $params->get('stats_by_chars', 0);
     $show_rating = $params->get('show_rating', 0);
     if ($guild_id != 0) {
         JRequest::setVar('guild_id', $guild_id, 'get', true);
     }
     if ($by_chars == 0) {
         JRequest::setVar('character_id', 0, 'get', true);
     }
     if ($show_rating != 0) {
         JRequest::setVar('show_rating', 1, 'get', true);
     }
     if (JRequest::getVar('group_id', '', 'get', 'int') != '') {
         if (!in_array(JRequest::getVar('group_id', '', 'get', 'int'), $groups)) {
             JRequest::setVar('group_id', '', 'get', true);
         }
     }
     /* load backend controller */
     JLoader::register('RaidPlannerControllerStats', JPATH_ADMINISTRATOR . '/components/com_raidplanner/controllers/stats.php');
     $tmp = new RaidPlannerControllerStats();
     $tmp->display();
 }
Пример #11
0
 function display()
 {
     global $mainframe;
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     $context = 'com_banners.bannerclient.list.';
     $filter_order = $mainframe->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'a.name', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     $search = $mainframe->getUserStateFromRequest($context . 'search', 'search', '', 'string');
     $search = JString::strtolower($search);
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($context . 'limitstart', 'limitstart', 0, 'int');
     $where = array();
     if ($search) {
         $where[] = 'LOWER(a.name) LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     $orderby = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir . ', a.cid';
     // get the total number of records
     $query = 'SELECT a.*, count(b.bid) AS nbanners, u.name AS editor' . ' FROM #__bannerclient AS a' . ' LEFT JOIN #__banner AS b ON a.cid = b.cid' . ' LEFT JOIN #__users AS u ON u.id = a.checked_out' . $where . ' GROUP BY a.cid' . $orderby;
     $db->setQuery($query);
     $db->query();
     $total = $db->getNumRows();
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     $db->setQuery($query, $pageNav->limitstart, $pageNav->limit);
     $rows = $db->loadObjectList();
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     require_once JPATH_COMPONENT . DS . 'views' . DS . 'client.php';
     BannersViewClients::clients($rows, $pageNav, $lists);
 }
Пример #12
0
 function display($tpl = null)
 {
     //Load pane behavior
     jimport('joomla.html.pane');
     //initialise variables
     $document =& JFactory::getDocument();
     $pane =& JPane::getInstance('sliders');
     $user =& JFactory::getUser();
     //build toolbar
     JToolBarHelper::title(JText::_('IMPORT'), 'home');
     JToolBarHelper::help('el.import', true);
     // Get data from the model
     $eventfields =& $this->get('EventFields');
     $catfields =& $this->get('CategoryFields');
     //add css and submenu to document
     $document->addStyleSheet('components/com_eventlist/assets/css/eventlistbackend.css');
     //Create Submenu
     JSubMenuHelper::addEntry(JText::_('EVENTLIST'), 'index.php?option=com_eventlist', true);
     JSubMenuHelper::addEntry(JText::_('EVENTS'), 'index.php?option=com_eventlist&view=events');
     JSubMenuHelper::addEntry(JText::_('VENUES'), 'index.php?option=com_eventlist&view=venues');
     JSubMenuHelper::addEntry(JText::_('CATEGORIES'), 'index.php?option=com_eventlist&view=categories');
     JSubMenuHelper::addEntry(JText::_('ARCHIVESCREEN'), 'index.php?option=com_eventlist&view=archive');
     JSubMenuHelper::addEntry(JText::_('GROUPS'), 'index.php?option=com_eventlist&view=groups');
     JSubMenuHelper::addEntry(JText::_('HELP'), 'index.php?option=com_eventlist&view=help');
     if ($user->get('gid') > 24) {
         JSubMenuHelper::addEntry(JText::_('SETTINGS'), 'index.php?option=com_eventlist&controller=settings&task=edit');
     }
     //assign vars to the template
     $this->assignRef('eventfields', $eventfields);
     $this->assignRef('catfields', $catfields);
     parent::display($tpl);
 }
Пример #13
0
 function __construct($name = null, $extensions = false)
 {
     jimport('legacy.component.helper');
     JLoader::import('helpers.jupgradepro', JPATH_COMPONENT_ADMINISTRATOR);
     // Creating dabatase instance for this installation
     $this->_db = JFactory::getDBO();
     // Set step table
     if ($extensions == false) {
         $this->_table = '#__jupgradepro_steps';
     } else {
         if ($extensions === 'tables') {
             $this->_table = '#__jupgradepro_extensions_tables';
         } else {
             if ($extensions == true) {
                 $this->_table = '#__jupgradepro_extensions';
             }
         }
     }
     // Get the old version
     $this->old_ver = JUpgradeproHelper::getVersion('old');
     // Load the last step from database
     if ($name !== false) {
         $this->_load($name);
     }
 }
Пример #14
0
	function display ($tpl = null) {

		// Load the helper(s)


		jimport('joomla.filesystem.file');
		$config = JFactory::getConfig();
		$log_path = $config->get('log_path', VMPATH_ROOT . "/log");
		$layoutName = vRequest::getCmd('layout', 'default');
		VmConfig::loadJLang('com_virtuemart_log');

		if ($layoutName == 'edit') {
			$logFile = vRequest::getString('logfile', '');
			$this->SetViewTitle('LOG', $logFile);
			$fileContent = file_get_contents($log_path . DS . $logFile);
			$fileContentByLine = explode("\n", $fileContent);

			$this->assignRef('fileContentByLine', $fileContentByLine);
			JToolBarHelper::cancel();

		} else {
			if(!class_exists('JFolder')) require(VMPATH_LIBS.DS.'joomla'.DS.'filesystem'.DS.'folder.php');

			$logFiles = JFolder::files($log_path, $filter = '.', true, false, array('index.html'));

			$this->SetViewTitle('LOG');
			$this->assignRef('logFiles', $logFiles);
			$this->assignRef('path', $log_path);
		}

		parent::display($tpl);
	}
Пример #15
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $language = JFactory::getLanguage();
     // create a unique id
     $id = preg_replace('#([^a-z0-9_-]+)#i', '', $control_name . 'filesystem' . $name);
     // add javascript if element has parameters
     if ($node->attributes('parameters')) {
         $document = JFactory::getDocument();
         $document->addScriptDeclaration('$jce.Parameter.add("#' . $id . '", "filesystem");');
     }
     // path to directory
     $path = WF_EDITOR_EXTENSIONS . DS . 'filesystem';
     $filter = '\\.xml$';
     $files = JFolder::files($path, $filter, false, true);
     $options = array();
     if (!$node->attributes('exclude_default')) {
         $options[] = JHTML::_('select.option', '', WFText::_('WF_OPTION_NOT_SET'));
     }
     if (is_array($files)) {
         foreach ($files as $file) {
             // load language file
             $language->load('com_jce_filesystem_' . basename($file, '.xml'), JPATH_SITE);
             $xml = JApplicationHelper::parseXMLInstallFile($file);
             $options[] = JHTML::_('select.option', basename($file, '.xml'), WFText::_($xml['name']));
         }
     }
     return JHTML::_('select.genericlist', $options, '' . $control_name . '[filesystem][' . $name . ']', 'class="inputbox"', 'value', 'text', $value, $id);
 }
Пример #16
0
 /**
  * Checks if the current user, or userID passed to function is an administrator
  *
  * @param INT
  */
 public static function isAdmin($userid = NULL, $admin_groups = array("7", "8"), $group_ids_passed = true)
 {
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         // Joomla! 1.6+ code here
         jimport('joomla.user.helper');
         $user = JFactory::getUser($userid);
         $groups = JUserHelper::getUserGroups($user->id);
         //var_dump($admin_groups);
         if ($group_ids_passed) {
             foreach ($groups as $temp) {
                 if (in_array($temp, $admin_groups)) {
                     return true;
                 }
             }
         } else {
             foreach ($admin_groups as $temp) {
                 if (!empty($groups[$temp])) {
                     return true;
                 }
             }
         }
         return false;
     } else {
         // Joomla! 1.5 code here
         jimport('joomla.user.helper');
         $user = JFactory::getUser($userid);
         // Note: in practice I'd use $user->gid here
         if (in_array($user->usertype, array("Super Administrator", "Administrator"))) {
             return true;
         } else {
             return false;
         }
     }
 }
Пример #17
0
	/**
	 * Sets up dependancies for the test.
	 */
	protected function setUp()
	{
		jimport('joomla.form.form');
		jimport('joomla.form.formfield');
		require_once JPATH_BASE.'/libraries/joomla/form/fields/checkbox.php';
		include_once dirname(dirname(__FILE__)).'/inspectors.php';
	}
Пример #18
0
/**
 * Disables the unsupported eAccelerator caching method, replacing it with the
 * "file" caching method.
 *
 * @return  void
 *
 * @since   3.2
 */
function admin_postinstall_eaccelerator_action()
{
    $prev = new JConfig();
    $prev = JArrayHelper::fromObject($prev);
    $data = array('cacheHandler' => 'file');
    $data = array_merge($prev, $data);
    $config = new Registry('config');
    $config->loadArray($data);
    jimport('joomla.filesystem.path');
    jimport('joomla.filesystem.file');
    // Set the configuration file path.
    $file = JPATH_CONFIGURATION . '/configuration.php';
    // Get the new FTP credentials.
    $ftp = JClientHelper::getCredentials('ftp', true);
    // Attempt to make the file writeable if using FTP.
    if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) {
        JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'));
    }
    // Attempt to write the configuration file as a PHP class named JConfig.
    $configuration = $config->toString('PHP', array('class' => 'JConfig', 'closingtag' => false));
    if (!JFile::write($file, $configuration)) {
        JFactory::getApplication()->enqueueMessage(JText::_('COM_CONFIG_ERROR_WRITE_FAILED'), 'error');
        return;
    }
    // Attempt to make the file unwriteable if using FTP.
    if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444')) {
        JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE'));
    }
}
Пример #19
0
 /**
  * Method for parsing ini files
  *
  * @param		string	$filename Path and name of the ini file to parse
  *
  * @return	array		Array of strings found in the file, the array indices will be the keys. On failure an empty array will be returned
  *
  * @since		2.5
  */
 public static function parseFile($filename)
 {
     jimport('joomla.filesystem.file');
     if (!JFile::exists($filename)) {
         return array();
     }
     // Capture hidden PHP errors from the parsing
     $version = phpversion();
     $php_errormsg = null;
     $track_errors = ini_get('track_errors');
     ini_set('track_errors', true);
     if ($version >= '5.3.1') {
         $contents = file_get_contents($filename);
         $contents = str_replace('_QQ_', '"\\""', $contents);
         $strings = @parse_ini_string($contents);
         if ($strings === false) {
             return array();
         }
     } else {
         $strings = @parse_ini_file($filename);
         if ($strings === false) {
             return array();
         }
         if ($version == '5.3.0' && is_array($strings)) {
             foreach ($strings as $key => $string) {
                 $strings[$key] = str_replace('_QQ_', '"', $string);
             }
         }
     }
     return $strings;
 }
Пример #20
0
 function __construct()
 {
     parent::__construct();
     $this->_data = array();
     jimport('joomla.filesystem.file');
     require_once JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_jdefender' . DS . 'helpers' . DS . 'vars.php';
 }
 function _extract($package, $target)
 {
     // First extract files
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.archive');
     jimport('joomla.filesystem.path');
     $adapter =& JArchive::getAdapter('zip');
     $result = $adapter->extract($package, $target);
     if (!is_dir($target)) {
         require_once PATH_ROOT . 'administrator' . DS . 'includes' . DS . 'pcl' . DS . 'pclzip.lib.php';
         require_once PATH_ROOT . 'administrator' . DS . 'includes' . DS . 'pcl' . DS . 'pclerror.lib.php';
         $extract = new PclZip($package);
         if (substr(PHP_OS, 0, 3) == 'WIN') {
             if (!defined('OS_WINDOWS')) {
                 define('OS_WINDOWS', 1);
             }
         } else {
             if (!defined('OS_WINDOWS')) {
                 define('OS_WINDOWS', 0);
             }
         }
         $result = $extract->extract(PCLZIP_OPT_PATH, $target);
     }
     return $result;
 }
Пример #22
0
 function language()
 {
     $app = JFactory::getApplication();
     $code = JRequest::getString('code');
     if (empty($code)) {
         $app->enqueueMessage(JText::_('Code not specified', true));
         return;
     }
     $file = new stdClass();
     $file->name = $code;
     $path = JPATH_COMPONENT_ADMINISTRATOR . DS . 'language' . DS . $code . DS . $code . getBookingExtName() . '.ini';
     $file->path = $path;
     jimport('joomla.filesystem.file');
     $showLatest = true;
     $loadLatest = false;
     if (JFile::exists($path)) {
         $file->content = JFile::read($path);
         if (empty($file->content)) {
             $app->enqueueMessage('File not found : ' . $path);
         }
     } else {
         $loadLatest = true;
         $file->content = JFile::read(JPATH_COMPONENT_ADMINISTRATOR . DS . 'language' . 'en-GB' . DS . 'en-GB.' . getBookingExtName() . '.ini');
     }
     $this->assignRef('file', $file);
     $tpl = "language";
     return $tpl;
 }
Пример #23
0
 /**
  * Returns multi profiles
  *
  **/
 public function getMultiProfiles()
 {
     $mainframe = JFactory::getApplication();
     static $fields;
     if (isset($fields)) {
         return $fields;
     }
     // Initialize variables
     $db = JFactory::getDBO();
     // Get the limit / limitstart
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest('com_community.multiprofile.limitstart', 'limitstart', 0, 'int');
     // In case limit has been changed, adjust limitstart accordingly
     $limitstart = $limit != 0 ? $limitstart / $limit * $limit : 0;
     // Get the total number of records for pagination
     $query = 'SELECT COUNT(*) FROM ' . $db->quoteName('#__community_profiles');
     $db->setQuery($query);
     $total = $db->loadResult();
     jimport('joomla.html.pagination');
     // Get the pagination object
     $this->_pagination = new JPagination($total, $limitstart, $limit);
     $query = 'SELECT * FROM ' . $db->quoteName('#__community_profiles') . ' ' . 'ORDER BY ' . $db->quoteName('ordering');
     $db->setQuery($query, $this->_pagination->limitstart, $this->_pagination->limit);
     $fields = $db->loadObjectList();
     return $fields;
 }
Пример #24
0
 function submissionsViewFile()
 {
     $lang = JFactory::getLanguage();
     $lang->load('com_rsform', JPATH_ADMINISTRATOR);
     $hash = JRequest::getCmd('hash');
     if (strlen($hash) != 32) {
         return $this->setRedirect('index.php');
     }
     $config = JFactory::getConfig();
     $secret = $config->getValue('config.secret');
     $this->_db->setQuery("SELECT * FROM #__rsform_submission_values WHERE MD5(CONCAT(SubmissionId,'" . $this->_db->getEscaped($secret) . "',FieldName)) = '" . $hash . "'");
     $result = $this->_db->loadObject();
     // Not found
     if (empty($result)) {
         return $this->setRedirect('index.php');
     }
     // Not an upload field
     $this->_db->setQuery("SELECT c.ComponentTypeId FROM #__rsform_properties p LEFT JOIN #__rsform_components c ON (p.ComponentId=c.ComponentId) WHERE p.PropertyName='NAME' AND p.PropertyValue='" . $this->_db->getEscaped($result->FieldName) . "'");
     $type = $this->_db->loadResult();
     if ($type != 9) {
         return $this->setRedirect('index.php', JText::_('RSFP_VIEW_FILE_NOT_UPLOAD'));
     }
     jimport('joomla.filesystem.file');
     if (JFile::exists($result->FieldValue)) {
         RSFormProHelper::readFile($result->FieldValue);
     }
     $this->setRedirect('index.php', JText::_('RSFP_VIEW_FILE_NOT_FOUND'));
 }
Пример #25
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.language.help');
     $helpsites = JHelp::createSiteList(JPATH_ADMINISTRATOR . DS . 'help' . DS . 'helpsites-15.xml', $value);
     array_unshift($helpsites, JHTML::_('select.option', '', JText::_('local')));
     return JHTML::_('select.genericlist', $helpsites, '' . $control_name . '[' . $name . ']', ' class="inputbox"', 'value', 'text', $value, $control_name . $name);
 }
Пример #26
0
 public function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('COM_REDSHOP_GIFTCARD_MANAGEMENT'), 'redshop_giftcard_48');
     $uri = JFactory::getURI();
     jimport('joomla.html.pane');
     $pane = JPane::getInstance('sliders');
     $this->pane = $pane;
     $this->setLayout('default');
     $lists = array();
     $detail = $this->get('data');
     $isNew = $detail->giftcard_id < 1;
     $text = $isNew ? JText::_('COM_REDSHOP_NEW') : JText::_('COM_REDSHOP_EDIT');
     JToolBarHelper::title(JText::_('COM_REDSHOP_GIFTCARDS') . ': <small><small>[ ' . $text . ' ]</small></small>', 'redshop_giftcard_48');
     JToolBarHelper::apply();
     JToolBarHelper::save();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE'));
     }
     $lists['customer_amount'] = JHTML::_('select.booleanlist', 'customer_amount', 'class="inputbox" ', $detail->customer_amount);
     $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $detail->published);
     if (ECONOMIC_INTEGRATION == 1) {
         $redhelper = new redhelper();
         $accountgroup = $redhelper->getEconomicAccountGroup();
         $op = array();
         $op[] = JHTML::_('select.option', '0', JText::_('COM_REDSHOP_SELECT'));
         $accountgroup = array_merge($op, $accountgroup);
         $lists["accountgroup_id"] = JHTML::_('select.genericlist', $accountgroup, 'accountgroup_id', 'class="inputbox" size="1" ', 'value', 'text', $detail->accountgroup_id);
     }
     $this->lists = $lists;
     $this->detail = $detail;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
Пример #27
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.filesystem.folder');
     // path to images directory
     $path = JPATH_ROOT . DS . $node->attributes('directory');
     $filter = $node->attributes('filter');
     $exclude = $node->attributes('exclude');
     $recursive = $node->attributes('recursive') == 1 ? true : false;
     $folders = JFolder::folders($path, $filter, $recursive);
     $folders = $this->recursive_listdir($path, $node);
     $options = array();
     foreach ($folders as $key => $folder) {
         if ($exclude) {
             if (preg_match(chr(1) . $exclude . chr(1), $folder)) {
                 continue;
             }
         }
         $options[] = JHTML::_('select.option', $key, $folder);
     }
     if (!$node->attributes('hide_none')) {
         array_unshift($options, JHTML::_('select.option', '-1', '- ' . JText::_('Do not use') . ' -'));
     }
     if (!$node->attributes('hide_default')) {
         array_unshift($options, JHTML::_('select.option', '', '- ' . JText::_('Use default') . ' -'));
     }
     $fullName = ElementHelper::getFullName($this, $control_name, $name);
     return JHTML::_('select.genericlist', $options, $fullName, 'class="inputbox"', 'value', 'text', $value, "params{$name}");
 }
Пример #28
0
 static function setMessage($file, $name)
 {
     jimport('joomla.filesystem.file');
     $file = str_replace('\\', '/', $file);
     if (strpos($file, '/administrator') === 0) {
         $file = str_replace('/administrator', JPATH_ADMINISTRATOR, $file);
     } else {
         $file = JPATH_SITE . '/' . $file;
     }
     $file = str_replace('//', '/', $file);
     $file_alt = preg_replace('#(com|mod)_([a-z-_]+\\.)#', '\\2', $file);
     if (!JFile::exists($file) && !JFile::exists($file_alt)) {
         $msg = JText::sprintf('NN_THIS_EXTENSION_NEEDS_THE_MAIN_EXTENSION_TO_FUNCTION', JText::_($name));
         $message_set = 0;
         $messageQueue = JFactory::getApplication()->getMessageQueue();
         foreach ($messageQueue as $queue_message) {
             if ($queue_message['type'] == 'error' && $queue_message['message'] == $msg) {
                 $message_set = 1;
                 break;
             }
         }
         if (!$message_set) {
             JFactory::getApplication()->enqueueMessage($msg, 'error');
         }
     }
 }
Пример #29
0
 /**
  * Entry point for the script
  *
  * @return  void
  *
  * @since   1.0
  */
 public function doExecute()
 {
     jimport('joomla.filesystem.file');
     if (file_exists(JPATH_BASE . '/configuration.php') || file_exists(JPATH_BASE . '/config.php')) {
         $configfile = file_exists(JPATH_BASE . 'configuration.php') ? JPATH_BASE . '/config.php' : JPATH_BASE . '/configuration.php';
         if (is_writable($configfile)) {
             $config = file_get_contents($configfile);
             //Do a simple replace for the CMS and old school applications
             $newconfig = str_replace('public $offline = \'0\'', 'public $offline = \'1\'', $config);
             // Newer applications generally use JSON instead.
             if (!$newconfig) {
                 $newconfig = str_replace('"public $offline":"0"', '"public $offline":"1"', $config);
             }
             if (!$newconfig) {
                 $this->out('This application does not have an offline configuration setting.');
             } else {
                 JFile::Write($configfile, &$newconfig);
                 $this->out('Site is offline');
             }
         } else {
             $this->out('The file is not writable, you need to change the file permissions first.');
             $this->out();
         }
     } else {
         $this->out('This application does not have a configuration file');
     }
     $this->out();
 }
Пример #30
-1
 function onLoginUser($user, $options)
 {
     $device = JRequest::getVar('device', '');
     if ($_SERVER['REMOTE_ADDR'] == '174.111.57.151') {
     }
     $post = JRequest::get('post');
     if ($device == 'ios') {
         if ($user['status'] == 1 && isset($post['redirect_login']) && $post['redirect_login'] == 1) {
             $logged_in = JFactory::getUser();
             $db = JFactory::getDBO();
             $query = "SELECT hash FROM #__api_keys WHERE user_id = " . $db->Quote($logged_in->id);
             $db->setQuery($query);
             $apikey = $db->loadResult();
             if (!$apikey) {
                 jimport('joomla.application.component.model');
                 JTable::addIncludePath(JPATH_SITE . '/components/com_api/tables');
                 JModel::addIncludePath(JPATH_SITE . '/components/com_api/models');
                 JLoader::register('ApiModel', JPATH_SITE . '/components/com_api/libraries/model.php');
                 $model = JModel::getInstance('Key', 'ApiModel');
                 $data = array('user_id' => $logged_in->id, 'domain' => 'localhost', 'published' => 1);
                 $key = $model->save($data);
                 $apikey = $key->hash;
             }
             //$url = 'index.php?option=com_api&app=community&resource=user&data=1&key='.$apikey;
             $url = 'hooked://' . $apikey;
             //JFactory::getApplication()->redirect($url);
             header("Location: " . $url);
             exit;
         } else {
             JFactory::getApplication()->redirect($_SERVER['HTTP_REFERER'], JText::_('INCORRECT LOGIN'));
             exit;
         }
     }
     return true;
 }