function display() { // Toolbar buttons JToolBarHelper::title(JText::_('AKEEBA').':: <small>'.JText::_('CONFIGURATION').'</small>','akeeba'); JToolBarHelper::preferences('com_akeeba', '500', '660'); JToolBarHelper::spacer(); JToolBarHelper::apply(); JToolBarHelper::save(); JToolBarHelper::cancel(); JToolBarHelper::spacer(); // Add references to scripts and CSS AkeebaHelperIncludes::includeMedia(false); $media_folder = JURI::base().'../media/com_akeeba/'; // Get a JSON representation of GUI data $json = AkeebaHelperEscape::escapeJS(AEUtilInihelper::getJsonGuiDefinition(),'"\\'); $this->assignRef( 'json', $json ); // Get profile ID $profileid = AEPlatform::get_active_profile(); $this->assign('profileid', $profileid); // Get profile name akimport('models.profiles',true); $model = new AkeebaModelProfiles(); $model->setId($profileid); $profile_data = $model->getProfile(); $this->assign('profilename', $profile_data->description); // Get the root URI for media files $this->assign( 'mediadir', AkeebaHelperEscape::escapeJS($media_folder.'theme/') ); // Are the settings secured? if( AEPlatform::get_platform_configuration_option('useencryption', -1) == 0 ) { $this->assign('securesettings', -1); } elseif( !AEUtilSecuresettings::supportsEncryption() ) { $this->assign('securesettings', 0); } else { jimport('joomla.filesystem.file'); $filename = JPATH_COMPONENT_ADMINISTRATOR.'/akeeba/serverkey.php'; if(JFile::exists($filename)) { $this->assign('securesettings', 1); } else { $this->assign('securesettings', 0); } } // Add live help AkeebaHelperIncludes::addHelp(); parent::display(); }
/** * Do the server options allow us to use settings encryption? * @return bool */ public static function supportsEncryption() { // Do we have the encypt.php plugin? $filename = dirname(__FILE__).'/../utils/encrypt.php'; if(!file_exists($filename)) return false; // Did the user intentionally disable settings encryption? $useEncryption = AEPlatform::get_platform_configuration_option('useencryption', -1); if($useEncryption == 0) return false; // Do we have base64_encode/_decode required for encryption? if(!function_exists('base64_encode') || !function_exists('base64_decode')) return false; // Pre-requisites met. We can encrypt and decrypt! return true; }
public function __construct() { $this->object = 'dir'; $this->subtype = 'inclusion'; $this->method = 'direct'; // FIXME This filter doesn't work very well on many live hosts. Disabled for now. parent::__construct(); return; if(empty($this->filter_name)) $this->filter_name = strtolower(basename(__FILE__,'.php')); // Get the saved library path and compare it to the default $jlibdir = AEPlatform::get_platform_configuration_option('jlibrariesdir', ''); if(empty($jlibdir)) { if(defined('JPATH_LIBRARIES')) { $jlibdir = JPATH_LIBRARIES; } elseif(defined('JPATH_PLATFORM')) { $jlibdir = JPATH_PLATFORM; } else { $jlibdir = false; } } if($jlibdir !== false) { $jlibdir = AEUtilFilesystem::TranslateWinPath($jlibdir); $defaultLibraries = AEUtilFilesystem::TranslateWinPath(JPATH_SITE.DS.'libraries'); if($defaultLibraries != $jlibdir) { // The path differs, add it here $this->filter_data['JPATH_LIBRARIES'] = $jlibdir; } } else { $this->filter_data = array(); } parent::__construct(); }
function __construct() { $useSVNSource = AEPlatform::get_platform_configuration_option('usesvnsource', 0); // Determine the appropriate update URL based on whether we're on Core or Professional edition AEPlatform::load_version_defines(); $fname = 'https://www.akeebabackup.com/updates/ab'; $fname .= (AKEEBA_PRO == 1) ? 'pro' : 'core'; if($useSVNSource) $fname .= 'svn'; $fname .= '.ini'; $this->_updateURL = $fname; $this->_extensionTitle = 'Akeeba Backup '.(AKEEBA_PRO == 1 ? 'Professional' : 'Core'); $this->_requiresAuthorization = (AKEEBA_PRO == 1); $this->_currentVersion = AKEEBA_VERSION; $this->_currentReleaseDate = AKEEBA_DATE; parent::__construct(); $this->_downloadID = AEPlatform::get_platform_configuration_option('update_dlid', ''); $this->_minStability = AEPlatform::get_platform_configuration_option('minstability', 'alpha'); $this->_cacerts = dirname(__FILE__).'/../akeeba/assets/cacert.pem'; }
/** * Check that the user has sufficient permissions, or die in error * */ private function _checkPermissions() { // Is frontend backup enabled? $febEnabled = AEPlatform::get_platform_configuration_option('frontend_enable',0) != 0; if(!$febEnabled) { $message = JText::_('ERROR_NOT_ENABLED'); $this->setRedirect(JURI::base().'index.php?option=com_akeeba&view=light&format=raw', $message, 'error'); return false; } // Is the key good? $key = JRequest::getVar('key'); $validKey=AEPlatform::get_platform_configuration_option('frontend_secret_word',''); $validKeyTrim = trim($validKey); if( ($key != $validKey) || (empty($validKeyTrim)) ) { $message = JText::_('ERROR_INVALID_KEY'); $this->setRedirect(JURI::base().'index.php?option=com_akeeba&view=light&format=raw', $message, 'error'); return false; } return true; }
/** * Check that the user has sufficient permissions, or die in error * */ private function _checkPermissions() { // Is frontend backup enabled? $febEnabled = AEPlatform::get_platform_configuration_option('frontend_enable', 0) != 0; if(!$febEnabled) { @ob_end_clean(); echo '403 '.JText::_('ERROR_NOT_ENABLED'); flush(); JFactory::getApplication()->close(); } // Is the key good? $key = JRequest::getVar('key'); $validKey=AEPlatform::get_platform_configuration_option('frontend_secret_word',''); $validKeyTrim = trim($validKey); if( ($key != $validKey) || (empty($validKeyTrim)) ) { @ob_end_clean(); echo '403 '.JText::_('ERROR_INVALID_KEY'); flush(); JFactory::getApplication()->close(); } }
/** * Checks if we should enable settings encryption and applies the change */ public function checkSettingsEncryption() { // Do we have a key file? jimport('joomla.filesystem.file'); $filename = JPATH_COMPONENT_ADMINISTRATOR.'/akeeba/serverkey.php'; if(JFile::exists($filename)) { // We have a key file. Do we need to disable it? if(AEPlatform::get_platform_configuration_option('useencryption', -1) == 0) { // User asked us to disable encryption. Let's do it. $this->disableSettingsEncryption(); } } else { if(!AEUtilSecuresettings::supportsEncryption()) return; if(AEPlatform::get_platform_configuration_option('useencryption', -1) != 0) { // User asked us to enable encryption (or he left us with the default setting!). Let's do it. $this->enableSettingsEncryption(); } } }
/** * Returns the current host name * @return string */ public static function get_host() { if(defined('AKEEBACLI')) { require_once JPATH_ROOT.DS.'libraries'.DS.'joomla'.DS.'environment'.DS.'uri.php'; $url = AEPlatform::get_platform_configuration_option('siteurl',''); $oURI = new JURI($url); return $oURI->getHost(); } $uri =& JURI::getInstance(); return $uri->getHost(); }
/** * Sends an email to the administrators * @return bool */ private function mail_administrators() { $this->setStep('Processing emails to administrators'); $this->setSubstep(''); // Skip email for back-end backups if(AEPlatform::get_backup_origin() == 'backend' ) return true; $must_email = AEPlatform::get_platform_configuration_option('frontend_email_on_finish', 0) != 0; if(!$must_email) return true; AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Preparing to send e-mail to administrators"); $email = AEPlatform::get_platform_configuration_option('frontend_email_address', ''); $email = trim($email); if( !empty($email) ) { $emails = array($email); } else { $emails = AEPlatform::get_administrator_emails(); } if(!empty($emails)) { // Fetch user's preferences $subject = trim(AEPlatform::get_platform_configuration_option('frontend_email_subject','')); $body = trim(AEPlatform::get_platform_configuration_option('frontend_email_body','')); // Get the statistics $statistics =& AEFactory::getStatistics(); $stat = $statistics->getRecord(); $parts = AEUtilStatistics::get_all_filenames($stat, false); $profile_number = AEPlatform::get_active_profile(); $profile_name = AEPlatform::get_profile_name($profile_number); $parts = AEUtilStatistics::get_all_filenames($stat, false); $stat = (object)$stat; $num_parts = $stat->multipart; if($num_parts == 0) $num_parts = 1; // Non-split archives have a part count of 0 $parts_list = ''; if(!empty($parts)) foreach($parts as $file) { $parts_list .= "\t".basename($file)."\n"; } // Do we need a default subject? if(empty($subject)) { // Get the default subject $subject = AEPlatform::translate('EMAIL_SUBJECT_OK'); } else { // Post-process the subject $subject = AEUtilFilesystem::replace_archive_name_variables($subject); } // Do we need a default body? if(empty($body)) { $body = AEPlatform::translate('EMAIL_BODY_OK'); $info_source = AEPlatform::translate('EMAIL_BODY_INFO'); $body .= "\n\n" . sprintf($info_source, $profile_number, $num_parts) . "\n\n"; $body .= $parts_list; } else { // Post-process the body $body = AEUtilFilesystem::replace_archive_name_variables($body); $body = str_replace('[PROFILENUMBER]', $profile_number, $body); $body = str_replace('[PROFILENAME]', $profile_name, $body); $body = str_replace('[PARTCOUNT]', $num_parts, $body); $body = str_replace('[FILELIST]', $parts_list, $body); } // Sometimes $body contains literal \n instead of newlines $body = str_replace('\\n',"\n", $body); foreach($emails as $email) { AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Sending email to $email"); AEPlatform::send_email($email, $subject, $body); } } return true; }
private function serverKey() { static $key = null; if(is_null($key)) { $key = AEPlatform::get_platform_configuration_option('frontend_secret_word', ''); } return $key; }