/** * Default task; shows the initial page where the user selects a profile * and enters description and comment * */ public function onBeforeAdd() { $result = parent::onBeforeEdit(); if ($result) { // Push models to view $model = $this->getThisModel(); $view = $this->getThisView(); $view->setModel($model, true); $newProfile = $this->input->get('profileid', -10, 'int'); if (is_numeric($newProfile) && $newProfile > 0) { $this->_csrfProtection(); $session = JFactory::getSession(); $session->set('profile', $newProfile, 'akeeba'); AEPlatform::getInstance()->load_configuration($newProfile); } // Deactivate the menus JRequest::setVar('hidemainmenu', 1); // Push data to the model $model->setState('profile', $this->input->get('profileid', -10, 'int')); $model->setState('ajax', $this->input->get('ajax', '', 'cmd')); $model->setState('autostart', $this->input->get('autostart', 0, 'int')); if ($this->input instanceof FOFInput) { $srpinfo = array('tag' => $this->input->get('tag', 'backend', 'cmd'), 'type' => $this->input->get('type', '', 'cmd'), 'name' => $this->input->get('name', '', 'cmd'), 'group' => $this->input->get('group', '', 'cmd'), 'customdirs' => $this->input->get('customdirs', array(), 'array', 2), 'extraprefixes' => $this->input->get('extraprefixes', array(), 'array', 2), 'customtables' => $this->input->get('customtables', array(), 'array', 2), 'skiptables' => $this->input->get('skiptables', array(), 'array', 2), 'xmlname' => $this->input->get('xmlname', '', 'string')); } else { $srpinfo = array('tag' => $this->input->get('tag', 'backend', 'cmd'), 'type' => $this->input->get('type', '', 'cmd'), 'name' => $this->input->get('name', '', 'cmd'), 'group' => $this->input->get('group', '', 'cmd'), 'customdirs' => $this->input->get('customdirs', array(), 'array', 2), 'extraprefixes' => $this->input->get('extraprefixes', array(), 'array', 2), 'customtables' => $this->input->get('customtables', array(), 'array', 2), 'skiptables' => $this->input->get('skiptables', array(), 'array', 2), 'xmlname' => $this->input->get('xmlname', '', 'string')); } $model->setState('srpinfo', $srpinfo); $description = $this->input->get('description', null, 'string', 2); if (!empty($description)) { $model->setState('description', $description); } $comment = $this->input->get('comment', null, 'string', 2); if (!empty($comment)) { $model->setState('comment', $comment); } $model->setState('jpskey', $this->input->get('jpskey', '', 'raw', 2)); $model->setState('angiekey', $this->input->get('angiekey', '', 'raw', 2)); $model->setState('returnurl', $this->input->get('returnurl', '', 'raw', 2)); } return $result; }
/** * Default task; shows the initial page where the user selects a profile * and enters description and comment * */ public function onBeforeAdd() { $result = parent::onBeforeEdit(); if ($result) { // Push models to view $model = $this->getThisModel(); $view = $this->getThisView(); $view->setModel($model, true); $newProfile = $this->input->get('profileid', -10, 'int'); if (is_numeric($newProfile) && $newProfile > 0) { $this->_csrfProtection(); $session = JFactory::getSession(); $session->set('profile', $newProfile, 'akeeba'); Platform::getInstance()->load_configuration($newProfile); } // Deactivate the menus JRequest::setVar('hidemainmenu', 1); // Push data to the model $model->setState('profile', $this->input->get('profileid', -10, 'int')); $model->setState('ajax', $this->input->get('ajax', '', 'cmd')); $model->setState('autostart', $this->input->get('autostart', 0, 'int')); $description = $this->input->get('description', null, 'string', 2); if (!empty($description)) { $model->setState('description', $description); } $comment = $this->input->get('comment', null, 'html', 2); if (!empty($comment)) { $model->setState('comment', $comment); } $model->setState('jpskey', $this->input->get('jpskey', '', 'raw', 2)); $model->setState('angiekey', $this->input->get('angiekey', '', 'raw', 2)); $model->setState('returnurl', $this->input->get('returnurl', '', 'raw', 2)); $model->setState('backupid', $this->input->get('backupid', null, 'cmd')); } return $result; }
public function onBeforeEdit() { $result = parent::onBeforeEdit(); if ($result) { $session = JFactory::getSession(); $task = $session->get('buadmin.task', 'browse', 'akeeba'); $model = $this->getThisModel(); $id = $model->getId(); if ($id <= 0) { $this->setRedirect(JURI::base() . 'index.php?option=com_akeeba&view=buadmin&task=' . $task, JText::_('STATS_ERROR_INVALIDID'), 'error'); $result = false; } } return $result; }