public function save() { $task = $this->getTask(); // get the Application Object $app = JFactory::getApplication(); // get the payment id $payment_id = $app->input->getInt('extension_id'); // if payment id exists if ($payment_id) { $data = $app->input->getArray($_POST); $paymentdata = array(); $paymentdata['extension_id'] = $payment_id; $registry = new JRegistry(); $registry->loadArray($data); $paymentdata['params'] = $registry->toString('JSON'); try { F0FTable::getAnInstance('Payment', 'J2StoreTable')->save($paymentdata); } catch (Exception $e) { $msg = $e->getMessage(); } switch ($task) { case 'apply': parent::apply(); break; case 'save': parent::save(); break; case 'savenew': parent::savenew(); break; } } }
public function execute($task) { if (in_array($task, array('add', 'edit', 'read'))) { $task = 'browse'; } parent::execute($task); }
public function execute($task) { if (!in_array($task, array('offline', 'online'))) { $task = 'browse'; } parent::execute($task); }
protected function onBeforeBrowse() { $db = JFactory::getDbo(); $config = J2Store::config(); $installation_complete = $config->get('installation_complete', 0); if (!$installation_complete) { //installation not completed JFactory::getApplication()->redirect('index.php?option=com_j2store&view=postconfig'); } //first check if the currency table has a default records at least. $rows = F0FModel::getTmpInstance('Currencies', 'J2StoreModel')->enabled(1)->getList(); if (count($rows) < 1) { //no records found. Dumb default data F0FModel::getTmpInstance('Currencies', 'J2StoreModel')->create_currency_by_code('USD', 'USD'); } //update schema $dbInstaller = new F0FDatabaseInstaller(array('dbinstaller_directory' => JPATH_ADMINISTRATOR . '/components/com_j2store/sql/xml')); $dbInstaller->updateSchema(); //update cart table $cols = $db->getTableColumns('#__j2store_carts'); $cols_to_delete = array('product_id', 'vendor_id', 'variant_id', 'product_type', 'product_options', 'product_qty'); foreach ($cols_to_delete as $key) { if (array_key_exists($key, $cols)) { $db->setQuery('ALTER TABLE #__j2store_carts DROP COLUMN ' . $key); try { $db->execute(); } catch (Exception $e) { echo $e->getMessage(); } } } return parent::onBeforeBrowse(); }
public function execute($task) { if (!in_array($task, array('overview', 'generate'))) { $task = 'overview'; } parent::execute($task); }
public function execute($task) { if ($task != 'step') { $task = 'browse'; } parent::execute($task); }
public function execute($task) { if (!in_array($task, array('save', 'apply'))) { $task = 'browse'; } parent::execute($task); }
public function onBeforeBrowse() { $result = parent::onBeforeBrowse(); if ($result) { $params = JComponentHelper::getParams('com_akeeba'); $model = $this->getThisModel(); $view = $this->getThisView(); /** @var AkeebaModelCpanels $model */ $view->setModel($model); $aeconfig = Factory::getConfiguration(); // Invalidate stale backups Factory::resetState(array('global' => true, 'log' => false, 'maxrun' => $params->get('failure_timeout', 180))); // Just in case the reset() loaded a stale configuration... Platform::getInstance()->load_configuration(); // Let's make sure the temporary and output directories are set correctly and writable... $wizmodel = F0FModel::getAnInstance('Confwiz', 'AkeebaModel'); $wizmodel->autofixDirectories(); // Check if we need to toggle the settings encryption feature $model->checkSettingsEncryption(); // Update the magic component parameters $model->updateMagicParameters(); // Run the automatic database check $model->checkAndFixDatabase(); // Run the automatic update site refresh /** @var AkeebaModelUpdates $updateModel */ $updateModel = F0FModel::getTmpInstance('Updates', 'AkeebaModel'); $updateModel->refreshUpdateSite(); } return $result; }
public function execute($task) { if (!in_array($task, array('protect', 'unprotect'))) { $task = 'browse'; } parent::execute($task); }
public function execute($task) { if (!in_array($task, array('save', 'cancel', 'downloaddat'))) { $task = 'browse'; } parent::execute($task); }
public function execute($task) { if (!in_array($task, array('purgesessions'))) { $task = 'browse'; } parent::execute($task); }
public function execute($task) { if (!in_array($task, array('change'))) { $task = 'browse'; } parent::execute($task); }
public function execute($task) { if (!in_array($task, array('read', 'cancel'))) { $task = 'read'; $this->input->set('task', 'read'); } parent::execute($task); }
public function execute($task) { if (!in_array($task, array('savedefaults', 'saveperms', 'saveapplyperms'))) { $task = 'browse'; } $this->getThisModel()->setState('task', $task); parent::execute($task); }
/** * Executes a given controller task. The onBefore<task> and onAfter<task> * methods are called automatically if they exist. * * @param string $task The task to execute, e.g. "browse" * * @throws Exception Exception thrown if the onBefore<task> returns false * * @return null|bool False on execution failure */ public function execute($task) { $validTasks = array('force', 'overview', 'startupdate', 'download', 'extract', 'install', 'cleanup'); if (!in_array($task, $validTasks)) { $task = 'overview'; } return parent::execute($task); }
public function copy() { $result = parent::copy(); if ($result) { JFactory::getApplication()->enqueueMessage(JText::_('COM_AKEEBASUBS_EMAILTEMPLATE_COPIED'), 'message'); } return $result; }
public function __construct($config = array()) { parent::__construct($config); $this->registerTask('getexpirations', 'browse'); $this->registerTask('renewals', 'browse'); $this->registerTask('vies', 'invoices'); $this->registerTask('vatmoss', 'invoices'); $this->cacheableTasks = array(); }
public function stepscan() { if (!$this->checkACL('admintools.security')) { JError::raiseError('403', JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN')); } $this->input->set('layout', 'scan'); $this->getThisView()->retarray = $this->getThisModel()->stepScan(); $this->getThisView()->setLayout('scan'); $this->layout = 'scan'; parent::display(false); }
public function execute($task) { // Only task browse and save are valid $allowedTasks = array('browse', 'save'); // Take browse as the default task if (!in_array($task, $allowedTasks)) { $task = 'browse'; } $this->input->set('task', $task, $this->input); parent::execute($task); }
public function execute($task) { $allowedTasks = array('browse', 'read', 'save'); if (in_array($task, array('edit', 'add'))) { $task = 'read'; } if (!in_array($task, $allowedTasks)) { return false; } $this->input->set('task', $task); return parent::execute($task); }
protected function onBeforeBrowse() { $result = parent::onBeforeBrowse(); if ($result) { F0FModel::getTmpInstance('Cpanels', 'AkeebasubsModel')->checkAndFixDatabase()->saveMagicVariables(); // Run the automatic update site refresh /** @var AkeebasubsModelUpdates $updateModel */ $updateModel = F0FModel::getTmpInstance('Updates', 'AkeebasubsModel'); $updateModel->refreshUpdateSite(); } return $result; }
public function onBeforeBrowse() { $result = parent::onBeforeBrowse(); if ($result) { $params = JComponentHelper::getParams('com_akeeba'); $model = $this->getThisModel(); $view = $this->getThisView(); /** @var AkeebaModelCpanels $model */ $view->setModel($model); $aeconfig = AEFactory::getConfiguration(); // Invalidate stale backups AECoreKettenrad::reset(array('global' => true, 'log' => false, 'maxrun' => $params->get('failure_timeout', 180))); // Just in case the reset() loaded a stale configuration... AEPlatform::getInstance()->load_configuration(); // Let's make sure the temporary and output directories are set correctly and writable... $wizmodel = F0FModel::getAnInstance('Confwiz', 'AkeebaModel'); $wizmodel->autofixDirectories(); // Check if we need to toggle the settings encryption feature $model->checkSettingsEncryption(); // Update the magic component parameters $model->updateMagicParameters(); // Run the automatic database check $model->checkAndFixDatabase(); // Run the automatic update site refresh /** @var AkeebaModelUpdates $updateModel */ $updateModel = F0FModel::getTmpInstance('Updates', 'AkeebaModel'); $updateModel->refreshUpdateSite(); // 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 . '/akeeba.lastversion.php')) { include_once JPATH_COMPONENT_ADMINISTRATOR . '/akeeba.lastversion.php'; if (defined('AKEEBA_LASTVERSIONCHECK')) { $versionLast = AKEEBA_LASTVERSIONCHECK; } } if (is_null($versionLast)) { $component = JComponentHelper::getComponent('com_akeeba'); if (is_object($component->params) && $component->params instanceof JRegistry) { $params = $component->params; } else { $params = new JParameter($component->params); } $versionLast = $params->get('lastversion', ''); } if (version_compare(AKEEBA_VERSION, $versionLast, 'ne') || empty($versionLast)) { $this->setRedirect('index.php?option=com_akeeba&view=postsetup'); return true; } } } return $result; }
public function browse() { if (parent::browse()) { $config = J2Store::config(); $complete = $config->get('installation_complete', 0); if ($complete) { JFactory::getApplication()->redirect('index.php?option=com_j2store&view=cpanel', JText::_('J2STORE_POSTCONFIG_STORE_SETUP_DONE_ALREADY')); } return true; } return false; }
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; }
public function onBeforeBrowse() { // Do we have an affiliate code? $affid = $this->input->getInt('affid', 0); if ($affid) { $session = JFactory::getSession(); $session->set('affid', $affid, 'com_akeebasubs'); } $params = JFactory::getApplication()->getPageParameters(); $ids = $params->get('ids', ''); if (is_array($ids) && !empty($ids)) { $ids = implode(',', $ids); if ($ids === '0') { $ids = ''; } } else { $ids = ''; } // Working around Progressive Caching $appInput = JFactory::getApplication()->input; if (!empty($ids)) { $appInput->set('ids', $ids); $appInput->set('_x_userid', JFactory::getUser()->id); } /** @var AkeebasubsModelTaxhelper $taxHelper */ $taxHelper = F0FModel::getTmpInstance('Taxhelper', 'AkeebasubsModel'); $taxParameters = $taxHelper->getTaxDefiningParameters(); $appInput->set('_akeebasubs_taxParameters', $taxParameters); $this->registerUrlParams(array('ids' => 'ARRAY', '_akeebasubs_taxParameters' => 'ARRAY', 'no_clear' => 'BOOL', '_x_userid' => 'INT', 'coupon' => 'STRING')); // Save a possible coupon code in the session $coupon = $this->input->getString('coupon'); if (!empty($coupon)) { $session = JFactory::getSession(); $session->set('coupon', $coupon, 'com_akeebasubs'); } // Continue parsing page options if (parent::onBeforeBrowse()) { $noClear = $this->input->getBool('no_clear', false); if (!$noClear) { $model = $this->getThisModel()->clearState()->clearInput()->savestate(0)->limit(0)->limitstart(0)->enabled(1)->only_once(1)->filter_order('ordering')->filter_order_Dir('ASC'); if (!empty($ids)) { $model->id($ids); } } $this->getThisModel()->access_user_id(JFactory::getUser()->id); return true; } else { return false; } }
public function execute($task) { $app = JFactory::getApplication(); $appTask = $app->input->getCmd('appTask', ''); $values = $app->input->getArray($_POST); // Check if we are in a report method view. If it is so, // Try lo load the report plugin controller (if any) if ($task == "view" && $appTask != '') { $model = $this->getModel('Apps'); $id = $app->input->getInt('id', '0'); if (!$id) { parent::execute($task); } $model->setId($id); // get the data // not using getItem here to enable ->checkout (which requires JTable object) $row = $model->getTable(); $row->load((int) $model->getId()); $element = $row->element; // The name of the App Controller should be the same of the $_element name, // without the tool_ prefix and with the first letter Uppercase, and should // be placed into a controller.php file inside the root of the plugin // Ex: tool_standard => J2StoreControllerToolStandard in tool_standard/controller.php $controllerName = str_ireplace('app_', '', $element); $controllerName = ucfirst($controllerName); $path = JPATH_SITE . '/plugins/j2store/'; $controllerPath = $path . $element . '/' . $element . '/controller.php'; if (file_exists($controllerPath)) { require_once $controllerPath; } else { $controllerName = ''; } $className = 'J2StoreControllerApp' . $controllerName; if ($controllerName != '' && class_exists($className)) { // Create the controller $controller = new $className(); // Add the view Path $controller->addViewPath($path); // Perform the requested task $controller->execute($appTask); // Redirect if set by the controller $controller->redirect(); } else { parent::execute($task); } } else { parent::execute($task); } }
/** * This runs before the browse() method. Return false to prevent executing * the method. * * @return bool */ public function onBeforeBrowse() { $result = parent::onBeforeBrowse(); if ($result) { // Get the current order by column $orderby = $this->getThisModel()->getState('filter_order', ''); // If it's not one of the allowed columns, force it to be the "ordering" column if (!in_array($orderby, array('todo_item_id', 'ordering', 'title', 'due'))) { $orderby = 'ordering'; } // Apply ordering and filter only the enabled items $this->getThisModel()->filter_order($orderby)->enabled(1); } return $result; }
protected function onBeforeApplySave(&$data) { $result = parent::onBeforeSave(); if ($result) { $subcustom = $this->input->get('subcustom', array(), 'array'); if (!array_key_exists('params', $data)) { $data['params'] = array(); } if (!array_key_exists('subcustom', $data['params'])) { $data['params']['subcustom'] = array(); } $data['params']['subcustom'] = array_merge($data['params']['subcustom'], $subcustom); } return $result; }
/** * ACL check before allowing someone to browse * * @return boolean True to allow the method to run */ protected function onBeforeBrowse() { if (parent::onBeforeBrowse()) { jimport('joomla.filesystem.file'); //make sure we have a default.php template $filename = 'default.php'; $tplpath = JPATH_ADMINISTRATOR . '/components/com_j2store/views/emailtemplate/tpls'; $defaultphp = $tplpath . '/default.php'; $defaulttpl = $tplpath . '/default.tpl'; if (!JFile::exists(JPath::clean($defaultphp))) { //file does not exist. so we need to rename JFile::copy($defaulttpl, $defaultphp); } return true; } return false; }
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(); // 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; } return $result; }