function start($cachable = false, $urlparams = false) { $model = $this->getThisModel(); $model->setState('restorationstep', 1); $message = $model->validateRequest(); if ($message !== true) { $this->setRedirect('index.php?option=com_akeeba&view=buadmin', $message, 'error'); $this->redirect(); return true; } $model->setState('jps_key', $this->input->get('jps_key', '', 'cmd')); $model->setState('procengine', $this->input->get('procengine', 'direct', 'cmd')); $model->setState('ftp_host', $this->input->get('ftp_host', '', 'none', 2)); $model->setState('ftp_port', $this->input->get('ftp_port', 21, 'int')); $model->setState('ftp_user', $this->input->get('ftp_user', '', 'none', 2)); $model->setState('ftp_pass', $this->input->get('ftp_pass', '', 'none', 2)); $model->setState('ftp_root', $this->input->get('ftp_root', '', 'none', 2)); $model->setState('tmp_path', $this->input->get('tmp_path', '', 'none', 2)); $model->setState('ftp_ssl', $this->input->get('usessl', 'false', 'cmd') == 'true'); $model->setState('ftp_pasv', $this->input->get('passive', 'true', 'cmd') == 'true'); $status = $model->createRestorationINI(); if ($status === false) { $this->setRedirect('index.php?option=com_akeeba&view=buadmin', JText::_('RESTORE_ERROR_CANT_WRITE'), 'error'); $this->redirect(); return true; } parent::display($cachable, $urlparams); }
/** * Fetches a complete backup set from a remote storage location to the local (server) * storage so that the user can download or restore it. */ public function dltoserver() { // Get the parameters $id = $this->getAndCheckId(); $part = $this->input->get('part', -1, 'int'); $frag = $this->input->get('frag', -1, 'int'); // Check the ID if ($id === false) { $url = 'index.php?option=com_akeeba&view=remotefiles&tmpl=component&task=listactions&id=' . $id; $this->setRedirect($url, JText::_('REMOTEFILES_ERR_INVALIDID'), 'error'); return true; } $model = $this->getThisModel(); $model->setState('id', $id); $model->setState('part', $part); $model->setState('frag', $frag); $result = $model->downloadToServer(); if ($result['finished']) { $url = 'index.php?option=com_akeeba&view=remotefiles&tmpl=component&task=listactions&id=' . $id; $this->setRedirect($url, JText::_('REMOTEFILES_LBL_JUSTFINISHED')); return true; } elseif ($result['error']) { $url = 'index.php?option=com_akeeba&view=remotefiles&tmpl=component&task=listactions&id=' . $id; $this->setRedirect($url, $result['error'], 'error'); return true; } else { parent::display(false, false); } }
/** * Fetches a complete backup set from a remote storage location to the local (server) * storage so that the user can download or restore it. */ public function dltoserver($cachable = false, $urlparams = false) { $s3bucket = $this->input->get('s3bucket', null, 'none', 2); // Get the parameters $model = $this->getThisModel(); if ($s3bucket) { $model->setState('s3bucket', $s3bucket); } $model->getS3Credentials(); $model->setS3Credentials($model->getState('s3access'), $model->getState('s3secret')); // Set up the model's state $part = $this->input->getInt('part', -999); if ($part >= -1) { JFactory::getApplication()->setUserState('com_akeeba.s3import.part', $part); } $frag = $this->input->getInt('frag', -999); if ($frag >= -1) { JFactory::getApplication()->setUserState('com_akeeba.s3import.frag', $frag); } $step = $this->input->getInt('step', -999); if ($step >= -1) { JFactory::getApplication()->setUserState('com_akeeba.s3import.step', $step); } $result = $model->downloadToServer(); if ($result === true) { // Part(s) downloaded successfully. Render the view. parent::display(); } elseif ($result === false) { // Part did not download. Redirect to initial page with an error. $this->setRedirect('index.php?option=com_akeeba&view=s3import', $model->getError(), 'error'); } else { // All done. Redirect to intial page with a success message. $this->setRedirect('index.php?option=com_akeeba&view=s3import', JText::_('S3IMPORT_MSG_IMPORTCOMPLETE')); } }
function start($cachable = false, $urlparams = false) { // CSRF prevention if ($this->csrfProtection) { $this->_csrfProtection(); } $model = $this->getThisModel(); $model->setState('restorestep', 1); $message = $model->validateRequest(); if ($message !== true) { $this->setRedirect('index.php?option=com_akeeba&view=buadmin', $message, 'error'); $this->redirect(); return true; } $model->setState('procengine', $this->input->get('procengine', 'direct', 'cmd')); $model->setState('ftp_host', $this->input->get('ftp_host', '', 'none', 2)); $model->setState('ftp_port', $this->input->get('ftp_port', 21, 'int')); $model->setState('ftp_user', $this->input->get('ftp_user', '', 'none', 2)); $model->setState('ftp_pass', $this->input->get('ftp_pass', '', 'none', 2)); $model->setState('ftp_root', $this->input->get('ftp_root', '', 'none', 2)); $model->setState('tmp_path', $this->input->get('tmp_path', '', 'none', 2)); $model->setState('ftp_ssl', $this->input->get('usessl', 'false', 'cmd') == 'true'); $model->setState('ftp_pasv', $this->input->get('passive', 'true', 'cmd') == 'true'); $status = $model->setRestorationParameters(); parent::display($cachable, $urlparams); }
public function iframe($cachable = false, $urlparams = false) { $tag = $this->input->get('tag', null, 'cmd'); if (empty($tag)) { $tag = null; } $model = $this->getThisModel(); $model->setState('tag', $tag); Platform::getInstance()->load_configuration(Platform::getInstance()->get_active_profile()); parent::display(); flush(); JFactory::getApplication()->close(); }
public function display($cachable = false, $urlparams = false) { $folder = $this->input->get('folder', '', 'string'); $processfolder = $this->input->get('processfolder', 0, 'int'); $model = $this->getThisModel(); $model->setState('folder', $folder); $model->setState('processfolder', $processfolder); $model->makeListing(); parent::display(); /* @ob_end_flush(); flush(); JFactory::getApplication()->close(); */ }
/** * Discovers JPA, JPS and ZIP files in the selected profile's directory and * lets you select them for inclusion in the import process. */ public function discover() { // CSRF prevention if (!$this->csrfProtection) { $this->_csrfProtection(); } $directory = $this->input->get('directory', '', 'string'); if (empty($directory)) { $url = 'index.php?option=com_akeeba&view=discover'; $msg = JText::_('DISCOVER_ERROR_NODIRECTORY'); $this->setRedirect($url, $msg, 'error'); return true; } $model = $this->getThisModel(); $model->setState('directory', $directory); parent::display(); }
/** * Apply the site transfer settings, test the connection, upload a test file * and show the last step's page. */ public function step3($cachable = false, $urlparams = false) { $model = $this->getThisModel(); $model->setState('stwstep', 3); $model->setState('method', $this->input->get('method', 'ftp', 'cmd')); $model->setState('hostname', $this->input->get('hostname', '', 'none', 2)); $model->setState('port', $this->input->get('port', '', 'int')); $model->setState('username', $this->input->get('username', '', 'none', 2)); $model->setState('password', $this->input->get('password', '', 'none', 2)); $model->setState('directory', $this->input->get('directory', '', 'none', 2)); $model->setState('passive', $this->input->get('passive', false, 'bool')); $model->setState('livesite', $this->input->get('livesite', '', 'none', 2)); $result = $model->applyTransferSettings(); if ($result != true) { $url = 'index.php?option=com_akeeba&view=stw&task=step2&method=none'; $this->setRedirect($url, $result, 'error'); return true; } parent::display($cachable, $urlparams); }
/** * Downloads the backup file of a specific backup attempt, * if it's available * */ public function download() { $model = $this->getThisModel(); $id = $model->getId(); $part = $this->input->get('part', -1, 'int'); if ($this->input instanceof F0FInput) { $cid = $this->input->get('cid', array(), 'array'); } else { $cid = $this->input->get('cid', array(), 'array'); } if (empty($id)) { if (is_array($cid) && !empty($cid)) { $id = $cid[0]; } else { $id = -1; } } if ($id <= 0) { $session = JFactory::getSession(); $task = $session->get('buadmin.task', 'browse', 'akeeba'); $this->setRedirect(JURI::base() . 'index.php?option=com_akeeba&view=buadmin&task=' . $task, JText::_('STATS_ERROR_INVALIDID'), 'error'); parent::display(); return true; } $stat = AEPlatform::getInstance()->get_statistics($id); $allFilenames = AEUtilStatistics::get_all_filenames($stat); // Check single part files if (count($allFilenames) == 1 && $part == -1) { $filename = array_shift($allFilenames); } elseif (count($allFilenames) > 0 && count($allFilenames) > $part && $part >= 0) { $filename = $allFilenames[$part]; } else { $filename = null; } if (is_null($filename) || empty($filename) || !@file_exists($filename)) { $session = JFactory::getSession(); $task = $session->get('buadmin.task', 'browse', 'akeeba'); $this->setRedirect(JURI::base() . 'index.php?option=com_akeeba&view=buadmin&task=' . $task, JText::_('STATS_ERROR_INVALIDDOWNLOAD'), 'error'); parent::display(); return true; } else { // For a certain unmentionable browser -- Thank you, Nooku, for the tip if (function_exists('ini_get') && function_exists('ini_set')) { if (ini_get('zlib.output_compression')) { ini_set('zlib.output_compression', 'Off'); } } // Remove php's time limit -- Thank you, Nooku, for the tip if (function_exists('ini_get') && function_exists('set_time_limit')) { if (!ini_get('safe_mode')) { @set_time_limit(0); } } $basename = @basename($filename); $filesize = @filesize($filename); $extension = strtolower(str_replace(".", "", strrchr($filename, "."))); while (@ob_end_clean()) { } @clearstatcache(); // Send MIME headers header('MIME-Version: 1.0'); header('Content-Disposition: attachment; filename="' . $basename . '"'); header('Content-Transfer-Encoding: binary'); header('Accept-Ranges: bytes'); switch ($extension) { case 'zip': // ZIP MIME type header('Content-Type: application/zip'); break; default: // Generic binary data MIME type header('Content-Type: application/octet-stream'); break; } // Notify of filesize, if this info is available if ($filesize > 0) { header('Content-Length: ' . @filesize($filename)); } // Disable caching header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Expires: 0"); header('Pragma: no-cache'); flush(); if ($filesize > 0) { // If the filesize is reported, use 1M chunks for echoing the data to the browser $blocksize = 1048756; //1M chunks $handle = @fopen($filename, "r"); // Now we need to loop through the file and echo out chunks of file data if ($handle !== false) { while (!@feof($handle)) { echo @fread($handle, $blocksize); @ob_flush(); flush(); } } if ($handle !== false) { @fclose($handle); } } else { // If the filesize is not reported, hope that readfile works @readfile($filename); } exit(0); } }
/** * Templates task, shows all non-core templates */ function templates($cachable = false, $urlparams = false) { $this->getThisView()->setLayout('templates'); $this->getThisView()->assign('task', 'templates'); parent::display($cachable, $urlparams); }
/** * Display the main list * */ public function browse($cachable = false, $urlparams = false) { parent::display($cachable, $urlparams); }
public function start($cachable = false, $urlparams = false) { $id = $this->getAndCheckId(); // Check the backup stat ID if ($id === false) { $url = 'index.php?option=com_akeeba&view=upload&tmpl=component&task=cancelled&id=' . $id; $this->setRedirect($url, JText::_('AKEEBA_TRANSFER_ERR_INVALIDID'), 'error'); return true; } $view = $this->getThisView(); $view->done = 0; $view->error = 0; $view->id = $id; $view->setLayout('default'); parent::display($cachable, $urlparams); }
public function browse($cachable = false, $urlparams = false) { $task = $this->input->get('task', 'normal', 'cmd'); $this->getThisModel()->setState('browse_task', $task); parent::display($cachable, $urlparams); }
/** * Default task, shows the wizard interface * * @param bool $cachable Is this a cacheable view? * @param array $urlparams URL parameters for caching. False to let FOF figure it out by itself. */ public function wizard($cachable = false, $urlparams = false) { parent::display($cachable, $urlparams); }