Exemplo n.º 1
0
 protected function onAdd($tpl = null)
 {
     /** @var AkeebaModelCpanels $model */
     $model = $this->getModel();
     $aeconfig = Factory::getConfiguration();
     // Load the helper classes
     $this->loadHelper('utils');
     $this->loadHelper('status');
     $statusHelper = AkeebaHelperStatus::getInstance();
     // Load the model
     if (!class_exists('AkeebaModelStatistics')) {
         JLoader::import('models.statistics', JPATH_COMPONENT_ADMINISTRATOR);
     }
     $statmodel = new AkeebaModelStatistics();
     $this->profileid = $model->getProfileID();
     // Active profile ID
     $this->profilelist = $model->getProfilesList();
     // List of available profiles
     $this->statuscell = $statusHelper->getStatusCell();
     // Backup status
     $this->detailscell = $statusHelper->getQuirksCell();
     // Details (warnings)
     $this->statscell = $statmodel->getLatestBackupDetails();
     $this->fixedpermissions = $model->fixMediaPermissions();
     // Fix media/com_akeeba permissions
     $this->needsdlid = $model->needsDownloadID();
     $this->needscoredlidwarning = $model->mustWarnAboutDownloadIDInCore();
     $this->extension_id = $model->getState('extension_id', 0, 'int');
     // Should I ask for permission to display desktop notifications?
     JLoader::import('joomla.application.component.helper');
     $this->desktop_notifications = \Akeeba\Engine\Util\Comconfig::getValue('desktop_notifications', '0') ? 1 : 0;
     $this->statsIframe = F0FModel::getTmpInstance('Stats', 'AkeebaModel')->collectStatistics(true);
     return $this->onDisplay($tpl);
 }
Exemplo n.º 2
0
	function display()
	{
		$selfhealModel = JModel::getInstance('Selfheal','AkeebaModel');
		$schemaok = $selfhealModel->healSchema();
		$this->assign('schemaok', $schemaok);		
		
		$registry =& AEFactory::getConfiguration();
		// Set the toolbar title; add a help button
		JToolBarHelper::title(JText::_('AKEEBA').':: <small>'.JText::_('AKEEBA_CONTROLPANEL').'</small>','akeeba');
		//JToolBarHelper::preferences('com_akeeba', '500', '660');

		if($schemaok) {
			// Add submenus (those nifty text links below the toolbar!)
			// -- Configuration
			$link = JURI::base().'index.php?option='.JRequest::getCmd('option').'&view=config';
			JSubMenuHelper::addEntry(JText::_('CONFIGURATION'), $link);

			// -- Backup Now
			$link = JURI::base().'index.php?option='.JRequest::getCmd('option').'&view=backup';
			JSubMenuHelper::addEntry(JText::_('BACKUP'), $link);
			// -- Administer Backup Files
			$link = JURI::base().'index.php?option='.JRequest::getCmd('option').'&view=buadmin';
			JSubMenuHelper::addEntry(JText::_('BUADMIN'), $link);
			// -- View log
			$link = JURI::base().'index.php?option='.JRequest::getCmd('option').'&view=log';
			JSubMenuHelper::addEntry(JText::_('VIEWLOG'), $link);

			// Load the helper classes
			$this->loadHelper('utils');
			$this->loadHelper('status');
			$statusHelper = AkeebaHelperStatus::getInstance();

			// Load the model
			akimport('models.statistics', true);
			$model =& $this->getModel();
			$statmodel = new AkeebaModelStatistics();

			$this->assign('icondefs', $model->getIconDefinitions()); // Icon definitions
			$this->assign('profileid', $model->getProfileID()); // Active profile ID
			$this->assign('profilelist', $model->getProfilesList()); // List of available profiles
			$this->assign('statuscell', $statusHelper->getStatusCell() ); // Backup status
			$this->assign('newscell', $statusHelper->getNewsCell() ); // News
			$this->assign('detailscell', $statusHelper->getQuirksCell() ); // Details (warnings)
			$this->assign('statscell', $statmodel->getLatestBackupDetails() );

			$this->assign('fixedpermissions', $model->fixMediaPermissions() ); // Fix media/com_akeeba permissions
			
			// Add live help
			AkeebaHelperIncludes::addHelp();
		}
		
		// Add references to CSS and JS files
		AkeebaHelperIncludes::includeMedia(false);

		parent::display();
	}
Exemplo n.º 3
0
 protected function onAdd($tpl = null)
 {
     /** @var AkeebaModelCpanels $model */
     $model = $this->getModel();
     /**
     		$selfhealModel = F0FModel::getTmpInstance('Selfheal','AkeebaModel');
     		$schemaok = $selfhealModel->healSchema();
     		/**/
     $schemaok = true;
     $this->schemaok = $schemaok;
     $aeconfig = AEFactory::getConfiguration();
     if ($schemaok) {
         // Load the helper classes
         $this->loadHelper('utils');
         $this->loadHelper('status');
         $statusHelper = AkeebaHelperStatus::getInstance();
         // Load the model
         if (!class_exists('AkeebaModelStatistics')) {
             JLoader::import('models.statistics', JPATH_COMPONENT_ADMINISTRATOR);
         }
         $statmodel = new AkeebaModelStatistics();
         $this->icondefs = $model->getIconDefinitions();
         // Icon definitions
         $this->profileid = $model->getProfileID();
         // Active profile ID
         $this->profilelist = $model->getProfilesList();
         // List of available profiles
         $this->statuscell = $statusHelper->getStatusCell();
         // Backup status
         $this->detailscell = $statusHelper->getQuirksCell();
         // Details (warnings)
         $this->statscell = $statmodel->getLatestBackupDetails();
         $this->fixedpermissions = $model->fixMediaPermissions();
         // Fix media/com_akeeba permissions
         $this->update_plugin = $model->isUpdatePluginEnabled();
         $this->needsdlid = $model->needsDownloadID();
         $this->needscoredlidwarning = $model->mustWarnAboutDownloadIDInCore();
         $this->hasPostInstallationMessages = $model->hasPostInstallMessages();
         $this->extension_id = $model->getState('extension_id', 0, 'int');
         // Add live help
         AkeebaHelperIncludes::addHelp('cpanel');
         $this->statsIframe = F0FModel::getTmpInstance('Stats', 'AkeebaModel')->collectStatistics(true);
     }
     return $this->onDisplay($tpl);
 }
 protected function onAdd($tpl = null)
 {
     // Used in FOF 1.x where the behaviour was kinda clunky
     $model = $this->getModel();
     /**
     		$selfhealModel = FOFModel::getTmpInstance('Selfheal','AkeebaModel');
     		$schemaok = $selfhealModel->healSchema();
     		**/
     $schemaok = true;
     $this->schemaok = $schemaok;
     $aeconfig = AEFactory::getConfiguration();
     if ($schemaok) {
         // Load the helper classes
         $this->loadHelper('utils');
         $this->loadHelper('status');
         $statusHelper = AkeebaHelperStatus::getInstance();
         // Load the model
         if (!class_exists('AkeebaModelStatistics')) {
             JLoader::import('models.statistics', JPATH_COMPONENT_ADMINISTRATOR);
         }
         $statmodel = new AkeebaModelStatistics();
         //$model->applyJoomlaExtensionUpdateChanges();
         $this->icondefs = $model->getIconDefinitions();
         // Icon definitions
         $this->profileid = $model->getProfileID();
         // Active profile ID
         $this->profilelist = $model->getProfilesList();
         // List of available profiles
         $this->statuscell = $statusHelper->getStatusCell();
         // Backup status
         $this->detailscell = $statusHelper->getQuirksCell();
         // Details (warnings)
         $this->statscell = $statmodel->getLatestBackupDetails();
         $this->fixedpermissions = $model->fixMediaPermissions();
         // Fix media/com_akeeba permissions
         $this->needsdlid = $model->needsDownloadID();
         $this->needscoredlidwarning = $model->mustWarnAboutDownloadIDInCore();
         // Add live help
         AkeebaHelperIncludes::addHelp('cpanel');
     }
     return $this->onDisplay($tpl);
 }
Exemplo n.º 5
0
 /**
  * This mess of a code is probably not one of my highlights in my code
  * writing career. It's logically organized, badly architectured but I can
  * still maintain it - and it works!
  */
 public function onAdd($tpl = null)
 {
     /** @var AkeebaModelBackups $model */
     $model = $this->getModel();
     // Load the Status Helper
     if (!class_exists('AkeebaHelperStatus')) {
         JLoader::import('helpers.status', JPATH_COMPONENT_ADMINISTRATOR);
     }
     $helper = AkeebaHelperStatus::getInstance();
     // Determine default description
     JLoader::import('joomla.utilities.date');
     $jregistry = JFactory::getConfig();
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $tzDefault = $jregistry->get('offset');
     } else {
         $tzDefault = $jregistry->getValue('config.offset');
     }
     $user = JFactory::getUser();
     $tz = $user->getParam('timezone', $tzDefault);
     $dateNow = new JDate('now', $tz);
     $default_description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->format(JText::_('DATE_FORMAT_LC2'), true);
     $default_description = AkeebaHelperEscape::escapeJS($default_description, "'");
     $backup_description = $model->getState('description', $default_description);
     $comment = $model->getState('comment', '');
     // Get a potential return URL
     $returnurl = $model->getState('returnurl');
     if (empty($returnurl)) {
         $returnurl = '';
     }
     // If a return URL is set *and* the profile's name is "Site Transfer
     // Wizard", we are running the Site Transfer Wizard
     if (!class_exists('AkeebaModelProfiles')) {
         JLoader::import('models.profiles', JPATH_COMPONENT_ADMINISTRATOR);
     }
     /** @var AkeebaModelCpanels $cpanelmodel */
     $cpanelmodel = F0FModel::getAnInstance('Cpanels', 'AkeebaModel');
     $profilemodel = new AkeebaModelProfiles();
     $profilemodel->setId($cpanelmodel->getProfileID());
     $profile_data = $profilemodel->getProfile();
     $isSTW = $profile_data->description == 'Site Transfer Wizard (do not rename)' && !empty($returnurl);
     $this->isSTW = $isSTW;
     // Get the domain details from scripting facility
     $registry = Factory::getConfiguration();
     $tag = $model->getState('tag');
     $script = $tag == 'restorepoint' ? 'full' : $registry->get('akeeba.basic.backup_type', 'full');
     $scripting = Factory::getEngineParamsProvider()->loadScripting();
     $domains = array();
     if (!empty($scripting)) {
         foreach ($scripting['scripts'][$script]['chain'] as $domain) {
             $description = JText::_($scripting['domains'][$domain]['text']);
             $domain_key = $scripting['domains'][$domain]['domain'];
             if ($isSTW && $domain_key == 'Packing') {
                 $description = JText::_('BACKUP_LABEL_DOMAIN_PACKING_STW');
             }
             $domains[] = array($domain_key, $description);
         }
     }
     $json_domains = AkeebaHelperEscape::escapeJS(json_encode($domains), '"\\');
     // Get the maximum execution time and bias
     $maxexec = $registry->get('akeeba.tuning.max_exec_time', 14) * 1000;
     $bias = $registry->get('akeeba.tuning.run_time_bias', 75);
     // Check if the output directory is writable
     $quirks = Factory::getConfigurationChecks()->getDetailedStatus();
     $unwritableOutput = array_key_exists('001', $quirks);
     // Pass on data
     $this->haserrors = !$helper->status;
     $this->hasquirks = $helper->hasQuirks();
     $this->quirks = $helper->getQuirksCell(!$helper->status);
     $this->description = $backup_description;
     $this->default_descr = $default_description;
     $this->comment = $comment;
     $this->domains = $json_domains;
     $this->maxexec = $maxexec;
     $this->bias = $bias;
     $this->useiframe = $registry->get('akeeba.basic.useiframe', 0) ? 'true' : 'false';
     $this->returnurl = $returnurl;
     $this->unwritableoutput = $unwritableOutput;
     if ($registry->get('akeeba.advanced.archiver_engine', 'jpa') == 'jps') {
         $this->showjpskey = 1;
         $this->jpskey = $registry->get('engine.archiver.jps.key', '');
     } else {
         $this->showjpskey = 0;
     }
     if (AKEEBA_PRO) {
         $this->showangiekey = 1;
         $this->angiekey = $registry->get('engine.installer.angie.key', '');
     } else {
         $this->showangiekey = 0;
         $this->angiekey = '';
     }
     $this->autostart = $model->getState('autostart');
     // Pass on profile info
     $this->profileid = $cpanelmodel->getProfileID();
     // Active profile ID
     $this->profilelist = $cpanelmodel->getProfilesList();
     // List of available profiles
     // Pass on state information pertaining to SRP
     $this->srpinfo = $model->getState('srpinfo');
     // Add live help
     AkeebaHelperIncludes::addHelp('backup');
     // Set the toolbar title
     if ($this->srpinfo['tag'] == 'restorepoint') {
         $subtitle = JText::_('AKEEBASRP');
     } elseif ($isSTW) {
         $subtitle = JText::_('SITETRANSFERWIZARD');
     } else {
         $subtitle = JText::_('BACKUP');
     }
     JToolBarHelper::title(JText::_('AKEEBA') . ':: <small>' . $subtitle . '</small>', 'akeeba');
     return true;
 }
Exemplo n.º 6
0
 /**
  * This mess of a code is probably not one of my highlights in my code
  * writing career. It's logically organized, badly architectured but I can
  * still maintain it - and it works!
  */
 public function onAdd($tpl = null)
 {
     AkeebaStrapper::addJSfile('media://com_akeeba/js/backup.js');
     /** @var AkeebaModelBackups $model */
     $model = $this->getModel();
     // Load the Status Helper
     if (!class_exists('AkeebaHelperStatus')) {
         JLoader::import('helpers.status', JPATH_COMPONENT_ADMINISTRATOR);
     }
     $helper = AkeebaHelperStatus::getInstance();
     // Determine default description
     JLoader::import('joomla.utilities.date');
     $jregistry = JFactory::getConfig();
     $tzDefault = $jregistry->get('offset');
     $user = JFactory::getUser();
     $tz = $user->getParam('timezone', $tzDefault);
     $dateNow = new JDate('now', $tz);
     $default_description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->format(JText::_('DATE_FORMAT_LC2'), true);
     $default_description = AkeebaHelperEscape::escapeJS($default_description, "'");
     $backup_description = $model->getState('description', $default_description);
     $comment = $model->getState('comment', '');
     // Get a potential return URL
     $returnurl = $model->getState('returnurl');
     if (empty($returnurl)) {
         $returnurl = '';
     }
     // Only allow internal URLs for the redirection
     if (!JUri::isInternal($returnurl)) {
         $returnurl = '';
     }
     // If a return URL is set *and* the profile's name is "Site Transfer
     // Wizard", we are running the Site Transfer Wizard
     if (!class_exists('AkeebaModelProfiles')) {
         JLoader::import('models.profiles', JPATH_COMPONENT_ADMINISTRATOR);
     }
     /** @var AkeebaModelCpanels $cpanelmodel */
     $cpanelmodel = F0FModel::getAnInstance('Cpanels', 'AkeebaModel');
     $profilemodel = new AkeebaModelProfiles();
     $profilemodel->setId($cpanelmodel->getProfileID());
     $profile_data = $profilemodel->getProfile();
     // Get the domain details from scripting facility
     $registry = Factory::getConfiguration();
     $tag = $model->getState('tag');
     $script = $registry->get('akeeba.basic.backup_type', 'full');
     $scripting = Factory::getEngineParamsProvider()->loadScripting();
     $domains = array();
     if (!empty($scripting)) {
         foreach ($scripting['scripts'][$script]['chain'] as $domain) {
             $description = JText::_($scripting['domains'][$domain]['text']);
             $domain_key = $scripting['domains'][$domain]['domain'];
             $domains[] = array($domain_key, $description);
         }
     }
     $json_domains = AkeebaHelperEscape::escapeJS(json_encode($domains), '"\\');
     // Get the maximum execution time and bias
     $maxexec = $registry->get('akeeba.tuning.max_exec_time', 14) * 1000;
     $bias = $registry->get('akeeba.tuning.run_time_bias', 75);
     // Check if the output directory is writable
     $quirks = Factory::getConfigurationChecks()->getDetailedStatus();
     $unwritableOutput = array_key_exists('001', $quirks);
     // Pass on data
     $this->haserrors = !$helper->status;
     $this->hasquirks = $helper->hasQuirks();
     $this->quirks = $helper->getQuirksCell(!$helper->status);
     $this->description = $backup_description;
     $this->default_descr = $default_description;
     $this->comment = $comment;
     $this->domains = $json_domains;
     $this->maxexec = $maxexec;
     $this->bias = $bias;
     $this->useiframe = $registry->get('akeeba.basic.useiframe', 0) ? 'true' : 'false';
     $this->returnurl = $returnurl;
     $this->unwritableoutput = $unwritableOutput;
     if ($registry->get('akeeba.advanced.archiver_engine', 'jpa') == 'jps') {
         $this->showjpskey = 1;
         $this->jpskey = $registry->get('engine.archiver.jps.key', '');
     } else {
         $this->showjpskey = 0;
     }
     if (AKEEBA_PRO) {
         $this->showangiekey = 1;
         $this->angiekey = $registry->get('engine.installer.angie.key', '');
     } else {
         $this->showangiekey = 0;
         $this->angiekey = '';
     }
     $this->autostart = $model->getState('autostart');
     // Pass on profile info
     $this->profileid = $cpanelmodel->getProfileID();
     // Active profile ID
     $this->profilelist = $cpanelmodel->getProfilesList();
     // List of available profiles
     // Should I ask for permission to display desktop notifications?
     JLoader::import('joomla.application.component.helper');
     $this->desktop_notifications = \Akeeba\Engine\Util\Comconfig::getValue('desktop_notifications', '0') ? 1 : 0;
     // Set the toolbar title
     $subtitle = JText::_('BACKUP');
     JToolBarHelper::title(JText::_('AKEEBA') . ':: <small>' . $subtitle . '</small>', 'akeeba');
     return true;
 }
Exemplo n.º 7
0
 /**
  * This mess of a code is probably not one of my highlights in my code
  * writing career. It's logically organized, badly architectured but I can
  * still maintain it - and it works!
  */
 function display()
 {
     // Add some buttons
     JToolBarHelper::back('AKEEBA_CONTROLPANEL', 'index.php?option=' . JRequest::getCmd('option'));
     JToolBarHelper::spacer();
     // Load the Status Helper
     if (!class_exists('AkeebaHelperStatus')) {
         JLoader::import('helpers.status', JPATH_COMPONENT_ADMINISTRATOR);
     }
     $helper =& AkeebaHelperStatus::getInstance();
     // Determine default description
     jimport('joomla.utilities.date');
     $jregistry =& JFactory::getConfig();
     $tzDefault = $jregistry->getValue('config.offset');
     $user =& JFactory::getUser();
     $tz = $user->getParam('timezone', $tzDefault);
     if (AKEEBA_JVERSION == '16') {
         $dateNow = new JDate('now', $tz);
         $backup_description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->format(JText::_('DATE_FORMAT_LC2'), true);
     } else {
         $dateNow = new JDate();
         $dateNow->setOffset($tz);
         $backup_description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->toFormat(JText::_('DATE_FORMAT_LC2'));
     }
     $backup_description = AkeebaHelperEscape::escapeJS($backup_description, "'");
     $default_description = $backup_description;
     $backup_description = JRequest::getVar('description', $default_description);
     $comment = JRequest::getVar('comment', '', 'default', 'none', 2);
     // Get a potential return URL
     $returnurl = JRequest::getVar('returnurl', null);
     if (empty($returnurl)) {
         $returnurl = '';
     }
     // If a return URL is set *and* the profile's name is "Site Transfer
     // Wizard", we are running the Site Transfer Wizard
     if (!class_exists('AkeebaModelProfiles')) {
         JLoader::import('models.profiles', JPATH_COMPONENT_ADMINISTRATOR);
     }
     if (!class_exists('AkeebaModelCpanel')) {
         JLoader::import('models.cpanel', JPATH_COMPONENT_ADMINISTRATOR);
     }
     $cpanelmodel = new AkeebaModelCpanel();
     $profilemodel = new AkeebaModelProfiles();
     $profilemodel->setId($cpanelmodel->getProfileID());
     $profile_data = $profilemodel->getProfile();
     $isSTW = $profile_data->description == 'Site Transfer Wizard (do not rename)' && !empty($returnurl);
     $this->assign('isSTW', $isSTW);
     // Get the domain details from scripting facility
     $registry =& AEFactory::getConfiguration();
     $script = $registry->get('akeeba.basic.backup_type', 'full');
     $scripting = AEUtilScripting::loadScripting();
     $domains = array();
     if (!empty($scripting)) {
         foreach ($scripting['scripts'][$script]['chain'] as $domain) {
             $description = JText::_($scripting['domains'][$domain]['text']);
             $domain_key = $scripting['domains'][$domain]['domain'];
             if ($isSTW && $domain_key == 'Packing') {
                 $description = JText::_('BACKUP_LABEL_DOMAIN_PACKING_STW');
             }
             $domains[] = array($domain_key, $description);
         }
     }
     $json_domains = AkeebaHelperEscape::escapeJS(json_encode($domains), '"\\');
     // Get the maximum execution time and bias
     $maxexec = $registry->get('akeeba.tuning.max_exec_time', 14) * 1000;
     $bias = $registry->get('akeeba.tuning.run_time_bias', 75);
     // Check if the output directory is writable
     $quirks = AEUtilQuirks::get_quirks();
     $unwritableOutput = array_key_exists('001', $quirks);
     // Pass on data
     $this->assign('haserrors', !$helper->status);
     $this->assign('hasquirks', $helper->hasQuirks());
     $this->assign('quirks', $helper->getQuirksCell(!$helper->status));
     $this->assign('description', $backup_description);
     $this->assign('comment', $comment);
     $this->assign('domains', $json_domains);
     $this->assign('maxexec', $maxexec);
     $this->assign('bias', $bias);
     $this->assign('useiframe', $registry->get('akeeba.basic.useiframe', 0) ? 'true' : 'false');
     $this->assign('returnurl', $returnurl);
     $this->assign('unwritableoutput', $unwritableOutput);
     if ($registry->get('akeeba.advanced.archiver_engine', 'jpa') == 'jps') {
         $this->assign('showjpskey', 1);
         $this->assign('jpskey', $registry->get('engine.archiver.jps.key', ''));
     } else {
         $this->assign('showjpskey', 0);
     }
     $this->assign('autostart', JRequest::getInt('autostart', 0));
     // Pass on profile info
     $this->assign('profileid', $cpanelmodel->getProfileID());
     // Active profile ID
     $this->assign('profilelist', $cpanelmodel->getProfilesList());
     // List of available profiles
     // Pass on state information pertaining to SRP
     $srpinfo = array('tag' => JRequest::getCmd('tag', 'backend'), 'type' => JRequest::getCmd('type', ''), 'name' => JRequest::getCmd('name', ''), 'group' => JRequest::getCmd('group', ''), 'customdirs' => JRequest::getVar('customdirs', array(), 'default', 'array', 2), 'extraprefixes' => JRequest::getVar('extraprefixes', array(), 'default', 'array', 2), 'customtables' => JRequest::getVar('customtables', array(), 'default', 'array', 2), 'xmlname' => JRequest::getString('xmlname', ''));
     $this->assign('srpinfo', $srpinfo);
     // Add references to CSS and JS files
     AkeebaHelperIncludes::includeMedia(false);
     // Add live help
     AkeebaHelperIncludes::addHelp();
     // Set the toolbar title
     if ($srpinfo['tag'] == 'restorepoint') {
         $subtitle = JText::_('AKEEBASRP');
     } elseif ($isSTW) {
         $subtitle = JText::_('SITETRANSFERWIZARD');
     } else {
         $subtitle = JText::_('BACKUP');
     }
     JToolBarHelper::title(JText::_('AKEEBA') . ':: <small>' . $subtitle . '</small>', 'akeeba');
     parent::display(JRequest::getCmd('tpl', null));
 }