function save($data) { // Get the previous configuration. if (is_object($data)) { $data = JArrayHelper::fromObject($data); } $prev = JTheFactoryHelper::getConfig(); $prev = JArrayHelper::fromObject($prev); $data = array_merge($prev, $data); $configfile = JTheFactoryAdminHelper::getConfigFile(); $config = new JRegistry('config'); $config->loadArray($data); jimport('joomla.filesystem.path'); jimport('joomla.filesystem.file'); jimport('joomla.client.helper'); // Get the new FTP credentials. $ftp = JClientHelper::getCredentials('ftp', true); // Attempt to make the file writeable if using FTP. if (!$ftp['enabled'] && JPath::isOwner($configfile) && !JPath::setPermissions($configfile, '0644')) { JError::raiseNotice(101, JText::_('FACTORY_SETTINGS_FILE_IS_NOT_WRITABLE')); } // Attempt to write the configuration file as a PHP class named JConfig. $configString = $config->toString('PHP', array('class' => ucfirst(APP_PREFIX) . "Config", 'closingtag' => false)); if (!JFile::write($configfile, $configString)) { JError::raiseWarning(101, JText::_('FACTORY_SETTINGS_FILE_WRITE_FAILED')); return false; } // Attempt to make the file unwriteable if using FTP. if (!$ftp['enabled'] && JPath::isOwner($configfile) && !JPath::setPermissions($configfile, '0444')) { JError::raiseNotice(101, JText::_('FACTORY_SETTINGS_FILE_IS_NOT_WRITABLE')); } return true; }
function Listing() { $app = JFactory::getApplication(); $filter_username = $app->getUserStateFromRequest(APP_EXTENSION . "_payments." . 'filter_username', 'filter_username', '', 'string'); $cfg = JTheFactoryHelper::getConfig(); $model = JModel::getInstance('Orders', 'JTheFactoryModel'); $rows = $model->getOrdersList($filter_username); $view = $this->getView('orders'); $view->assign('orders', $rows); $view->assign('filter_username', $filter_username); $view->assign('pagination', $model->get('pagination')); $view->assign('cfg', $cfg); $view->display('list'); }
function display() { jimport('joomla.form.form'); $form = JForm::getInstance('config', $this->formxml); $cfg = JTheFactoryHelper::getConfig(); $data = JArrayHelper::fromObject($cfg); $form->bind($data); $groups = JTheFactoryConfigHelper::getFieldGroups($this->formxml); JTheFactoryEventsHelper::triggerEvent('onDisplaySettings', array($form, $groups, $data)); $view = $this->getView('settings'); $view->assignRef('groups', $groups); $view->assignRef('form', $form); $view->assignRef('formxml', $this->formxml); $view->display(); }
function __construct() { $Itemid=JRequest::getInt('Itemid'); $my = JFactory::getUser(); // if (JDEBUG) $this->debugging= true; $this->assign('ROOT_HOST',JURI::root()); $this->assign('Itemid',$Itemid); $this->assign('option',JRequest::getWord('option')); $this->assign('task',JRequest::getCmd( 'task')); $this->assign('controller',JRequest::getCmd( 'controller')); $this->assign('is_logged_in',($my->id)?"1":"0"); $this->assign('joomlauser',$my); if (class_exists('JTheFactoryHelper')){ $cfg = JTheFactoryHelper::getConfig(); $this->assign('cfg',$cfg); } $this->register_modifier('translate',array($this,'smarty_translate')); $this->register_modifier('t',array($this,'smarty_translate')); $this->register_function('jtext', array($this,'smarty_function_jtext')); $this->register_function('infobullet',array($this, 'smarty_infobullet')); $this->register_function('positions',array($this,'smarty_positions')); $this->register_function('init_behavior',array($this,'smarty_init_behavior')); $this->register_function('import_js_file',array($this,'smarty_import_js_file')); $this->register_function('import_css_file',array($this,'smarty_import_css_file')); $this->register_block('import_js_block',array($this,'smarty_import_js_block')); $this->register_block('import_css_block',array($this,'smarty_import_css_block')); $this->register_function('startpane',array($this,'smarty_startpane')); $this->register_function('starttab',array($this,'smarty_starttab')); $this->register_function('endpane',array($this,'smarty_endpane')); $this->register_function('endtab',array($this,'smarty_endtab')); $this->template_dir= JPATH_COMPONENT_SITE.DS.'templates'.DS.'default'.DS; $this->compile_dir=AUCTION_TEMPLATE_CACHE; parent::__construct(); }
function display($tpl = null) { $db = JFactory::getDBO(); $db->setQuery("select * from #__bid_paysystems where enabled=1"); $gateways = $db->loadObjectList(); $db->setQuery("select * from #__bid_pricing where enabled=1"); $items = $db->loadObjectList(); $db->setQuery("select * from #__bid_cronlog where event='cron' order by logtime desc limit 1"); $log = $db->loadObject(); $cfg = JTheFactoryHelper::getConfig(); $this->assignref('gateways', $gateways); $this->assignref('items', $items); if ($log) { $this->assignref('latest_cron_time', $log->logtime); } else { $this->assign('latest_cron_time', JText::_('COM_BIDS_NEVER')); } $this->assignref('cfg', $cfg); parent::display($tpl); }
public function Cronjob_Info() { $cfg = JTheFactoryHelper::getConfig(); $db = JFactory::getDBO(); $db->setQuery("select * from #__bid_cronlog where event='cron' order by logtime desc limit 1"); $log = $db->loadObject(); $view = $this->getView('settingspanel'); $view->assignref('cfg', $cfg); $view->assignref('cronlog', $log); $view->display('cronsettings'); }
function setCurrentTheme($theme) { $MyApp = JTheFactoryApplication::getInstance(); $cfg = JTheFactoryHelper::getConfig(); $cfg->theme = $theme; JTheFactoryHelper::modelIncludePath('config'); $formxml = JPATH_ROOT . DS . "administrator" . DS . "components" . DS . APP_EXTENSION . DS . $MyApp->getIniValue('configxml'); $model = JModel::getInstance('Config', 'JTheFactoryModel', array('formxml' => $formxml)); $model->save($cfg); }