public function processPart($absolute_filename)
 {
     // Retrieve engine configuration data
     $config = AEFactory::getConfiguration();
     $address = trim($config->get('engine.postproc.email.address', ''));
     $subject = $config->get('engine.postproc.email.subject', '0');
     // Sanity checks
     if (empty($address)) {
         $this->setError('You have not set up a recipient\'s email address for the backup files');
         return false;
     }
     // Send the file
     $basename = basename($absolute_filename);
     AEUtilLogger::WriteLog(_AE_LOG_INFO, "Preparing to email {$basename} to {$address}");
     if (empty($subject)) {
         $subject = JText::_('AKEEBA_DEFAULT_EMAIL_SUBJECT');
     }
     $body = "Emailing {$basename}";
     AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Subject: {$subject}");
     AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Body: {$body}");
     $result = AEPlatform::getInstance()->send_email($address, $subject, $body, $absolute_filename);
     // Return the result
     if ($result !== true) {
         // An error occured
         $this->setError($result);
         // Notify that we failed
         return false;
     } else {
         // Return success
         AEUtilLogger::WriteLog(_AE_LOG_INFO, "Email sent successfully");
         return true;
     }
 }
 function __construct()
 {
     $useSVNSource = AEPlatform::getInstance()->get_platform_configuration_option('usesvnsource', 0);
     // Determine the appropriate update URL based on whether we're on Core or Professional edition
     AEPlatform::getInstance()->load_version_defines();
     if (!$useSVNSource) {
         $fname = 'http://nocdn.akeebabackup.com/updates/ab';
         $fname .= AKEEBA_PRO == 1 ? 'pro' : 'core';
         $fname .= '.ini';
     } else {
         $fname = 'http://www.akeebabackup.com/updates/ab';
         $fname .= AKEEBA_PRO == 1 ? 'pro' : 'core';
         $fname .= 'svn.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::getInstance()->get_platform_configuration_option('update_dlid', '');
     if (AKEEBA_PRO) {
         $this->_minStability = AEPlatform::getInstance()->get_platform_configuration_option('minstability', 'stable');
     } else {
         $this->_minStability = 'stable';
     }
     $this->_cacerts = dirname(__FILE__) . '/../akeeba/assets/cacert.pem';
     if (substr($this->_currentVersion, 0, 3) == 'svn') {
         $this->_versionStrategy = 'newest';
     }
 }
Beispiel #3
0
 /**
  * The default layout, shows a list of profiles
  *
  */
 function _default()
 {
     // Get reference to profiles model
     $model =& $this->getModel('profiles');
     // Load list of profiles
     $profiles = $model->getProfilesList();
     $this->assign('profiles', $profiles);
     // Get profile ID
     $profileid = AEPlatform::getInstance()->get_active_profile();
     $this->assign('profileid', $profileid);
     // Get profile name
     $model->setId($profileid);
     $profile_data = $model->getProfile();
     $this->assign('profilename', $profile_data->description);
     // Add toolbar buttons
     JToolBarHelper::back('AKEEBA_CONTROLPANEL', 'index.php?option=' . JRequest::getCmd('option'));
     JToolBarHelper::spacer();
     JToolBarHelper::addNew();
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         JToolBarHelper::custom('copy', 'copy.png', 'copy_f2.png', 'JLIB_HTML_BATCH_COPY', false);
     } else {
         JToolBarHelper::custom('copy', 'copy.png', 'copy_f2.png', 'Copy', false);
     }
     JToolBarHelper::spacer();
     JToolBarHelper::deleteList();
     JToolBarHelper::spacer();
 }
Beispiel #4
0
 /**
  * Fetches the authentication token from Dropbox.com, after you've run the
  * first step of the OAuth process.
  *
  * @return array
  */
 public function getauth()
 {
     $keys = $this->_getKeys();
     $api = new AEUtilDropbox();
     $api->setAppKeys($keys);
     $data = AEPlatform::getInstance()->get_flash_variable('dropbox.reqtoken', null);
     $reqToken = unserialize(base64_decode($data));
     $api->setReqToken($reqToken);
     $token = null;
     try {
         $api->setSignatureMethod('HMAC-SHA1');
         $api->getAccessToken();
         $token = true;
     } catch (Exception $e) {
         $api->setSignatureMethod('PLAINTEXT');
     }
     if (is_null($token)) {
         try {
             $token = $api->getAccessToken();
         } catch (Exception $e) {
             return array('error' => 'Did not receive token from Dropbox', 'token' => $e->getMessage());
         }
     }
     $token = $api->getToken();
     return array('error' => '', 'token' => $token);
 }
 public function download()
 {
     AEPlatform::getInstance()->load_configuration(AEPlatform::getInstance()->get_active_profile());
     $tag = JRequest::getCmd('tag', null);
     $filename = AEUtilLogger::logName($tag);
     @ob_end_clean();
     // In case some braindead plugin spits its own HTML
     header("Cache-Control: no-cache, must-revalidate");
     // HTTP/1.1
     header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
     // Date in the past
     header("Content-Description: File Transfer");
     header('Content-Type: text/plain');
     header('Content-Disposition: attachment; filename="Akeeba Backup Debug Log.txt"');
     echo "WARNING: Do not copy and paste lines from this file!\r\n";
     echo "You are supposed to ZIP and attach it in your support forum post.\r\n";
     echo "If you fail to do so, your support request will receive minimal priority.\r\n";
     echo "\r\n";
     echo "--- START OF RAW LOG --\r\n";
     @readfile($filename);
     // The at sign is necessary to skip showing PHP errors if the file doesn't exist or isn't readable for some reason
     echo "--- END OF RAW LOG ---\r\n";
     flush();
     JFactory::getApplication()->close();
 }
 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::getInstance()->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 . '/libraries');
         if ($defaultLibraries != $jlibdir) {
             // The path differs, add it here
             $this->filter_data['JPATH_LIBRARIES'] = $jlibdir;
         }
     } else {
         $this->filter_data = array();
     }
     parent::__construct();
 }
 public function display($tpl = null)
 {
     // Add toolbar buttons
     JToolBarHelper::title(JText::_('AKEEBA') . ': <small>' . JText::_('VIEWLOG') . '</small>', 'akeeba');
     JToolBarHelper::back('AKEEBA_CONTROLPANEL', 'index.php?option=' . JRequest::getCmd('option'));
     JToolBarHelper::spacer();
     $document = JFactory::getDocument();
     $document->addStyleSheet(JURI::base() . '../media/com_akeeba/theme/akeebaui.css?' . AKEEBAMEDIATAG);
     // Add live help
     AkeebaHelperIncludes::addHelp();
     // Get a list of log names
     if (!class_exists('AkeebaModelLog')) {
         JLoader::import('models.log', JPATH_COMPONENT_ADMINISTRATOR);
     }
     $model = new AkeebaModelLog();
     $this->assign('logs', $model->getLogList());
     $tag = JRequest::getCmd('tag', null);
     if (empty($tag)) {
         $tag = null;
     }
     $this->assign('tag', $tag);
     // Get profile ID
     $profileid = AEPlatform::getInstance()->get_active_profile();
     $this->assign('profileid', $profileid);
     // Get profile name
     if (!class_exists('AkeebaModelProfiles')) {
         JLoader::import('models.profiles', JPATH_COMPONENT_ADMINISTRATOR);
     }
     $model = new AkeebaModelProfiles();
     $model->setId($profileid);
     $profile_data = $model->getProfile();
     $this->assign('profilename', $profile_data->description);
     AkeebaHelperIncludes::includeMedia(false);
     parent::display($tpl);
 }
 /**
  * Database object constructor
  * @param	array	List of options used to configure the connection
  */
 public function __construct($options = array())
 {
     // Get best matching Akeeba Backup driver instance
     if (class_exists('JFactory')) {
         $db = JFactory::getDBO();
         switch ($db->name) {
             case 'mysql':
                 $driver = 'mysql';
                 break;
             case 'mysqli':
                 $driver = 'mysqli';
                 break;
             case 'sqlsrv':
             case 'mssql':
                 $driver = 'sqlsrv';
                 break;
             case 'sqlazure':
                 $driver = 'sqlsrv';
                 break;
             default:
                 $driver = '';
                 return;
                 // Brace yourself, this engine is going down crashing in flames.
                 break;
         }
         $options['connection'] = $db->getConnection();
         $driver = 'AEDriver' . ucfirst($driver);
     } else {
         $driver = AEPlatform::getInstance()->get_default_database_driver(false);
     }
     $this->dbo = new $driver($options);
     // Propagate errors
     $this->propagateFromObject($this->dbo);
 }
 public function __construct()
 {
     $this->object = 'dir';
     $this->subtype = 'content';
     $this->method = 'direct';
     $this->filter_name = 'PlatformSkipfiles';
     if (AEFactory::getKettenrad()->getTag() == 'restorepoint') {
         $this->enabled = false;
     }
     // We take advantage of the filter class magic to inject our custom filters
     $configuration = AEFactory::getConfiguration();
     $jreg = JFactory::getConfig();
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $tmpdir = $jreg->get('tmp_path');
     } else {
         $tmpdir = $jreg->getValue('config.tmp_path');
     }
     // Get the site's root
     if ($configuration->get('akeeba.platform.override_root', 0)) {
         $root = $configuration->get('akeeba.platform.newroot', '[SITEROOT]');
     } else {
         $root = '[SITEROOT]';
     }
     $this->filter_data[$root] = array(self::treatDirectory($configuration->get('akeeba.basic.output_directory')), self::treatDirectory($tmpdir), 'tmp', self::treatDirectory(JPATH_CACHE), self::treatDirectory(JPATH_ADMINISTRATOR . '/cache'), self::treatDirectory(JPATH_ROOT . '/cache'), 'cache', 'administrator/cache', self::treatDirectory(JPATH_ROOT . '/installation'), 'installation', self::treatDirectory(AEPlatform::getInstance()->get_site_root() . '/cache'), self::treatDirectory(AEPlatform::getInstance()->get_site_root() . '/administrator/cache'), 'administrator/components/com_akeeba/backup', self::treatDirectory(AEPlatform::getInstance()->get_site_root() . '/components/libraries/cmslib/cache'), 'components/libraries/cmslib/cache', 'logs');
     parent::__construct();
 }
 public function onAdd($tpl = null)
 {
     $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::getInstance()->get_active_profile();
     $this->assign('profileid', $profileid);
     // Get profile name
     $profileName = FOFModel::getTmpInstance('Profiles', 'AkeebaModel')->setId($profileid)->getItem()->description;
     $this->assign('profilename', $profileName);
     // Get the root URI for media files
     $this->assign('mediadir', AkeebaHelperEscape::escapeJS($media_folder . 'theme/'));
     // Are the settings secured?
     if (AEPlatform::getInstance()->get_platform_configuration_option('useencryption', -1) == 0) {
         $this->assign('securesettings', -1);
     } elseif (!AEUtilSecuresettings::supportsEncryption()) {
         $this->assign('securesettings', 0);
     } else {
         JLoader::import('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('config');
 }
Beispiel #11
0
 public function __construct()
 {
     // This is a directory inclusion filter.
     $this->object = 'db';
     $this->subtype = 'inclusion';
     $this->method = 'direct';
     $this->filter_name = 'PlatformSitedb';
     // Add a new record for the core Joomla! database
     // Get core database options
     $options = AEPlatform::getInstance()->get_platform_database_options();
     $host = $options['host'];
     $port = NULL;
     $socket = NULL;
     $targetSlot = substr(strstr($host, ":"), 1);
     if (!empty($targetSlot)) {
         // Get the port number or socket name
         if (is_numeric($targetSlot)) {
             $port = $targetSlot;
         } else {
             $socket = $targetSlot;
         }
         // Extract the host name only
         $host = substr($host, 0, strlen($host) - (strlen($targetSlot) + 1));
         // This will take care of the following notation: ":3306"
         if ($host == '') {
             $host = 'localhost';
         }
     }
     // This is the format of the database inclusion filters
     $entry = array('host' => $host, 'port' => is_null($socket) ? is_null($port) ? '' : $port : $socket, 'username' => $options['user'], 'password' => $options['password'], 'database' => $options['database'], 'prefix' => $options['prefix'], 'dumpFile' => 'joomla.sql', 'driver' => AEPlatform::getInstance()->get_default_database_driver(true));
     // We take advantage of the filter class magic to inject our custom filters
     $configuration =& AEFactory::getConfiguration();
     $this->filter_data['[SITEDB]'] = $entry;
     parent::__construct();
 }
 /**
  * Handle the apply task which saves settings and shows the editor again
  *
  */
 public function apply()
 {
     // CSRF prevention
     if (!JRequest::getVar(JUtility::getToken(), false, 'POST')) {
         JError::raiseError('403', JText::_(version_compare(JVERSION, '1.6.0', 'ge') ? 'JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN' : 'Request Forbidden'));
     }
     // Get the var array from the request
     $var = JRequest::getVar('var', array(), 'default', 'array');
     // Make it into Akeeba Engine array format
     $data = array();
     foreach ($var as $key => $value) {
         $data[$key] = $value;
     }
     // Forbid stupidly selecting the site's root as the output or temporary directory
     if (array_key_exists('akeeba.basic.output_directory', $data)) {
         $folder = $data['akeeba.basic.output_directory'];
         $folder = AEUtilFilesystem::translateStockDirs($folder, true, true);
         $check = AEUtilFilesystem::translateStockDirs('[SITEROOT]', true, true);
         if ($check == $folder) {
             JError::raiseWarning(503, JText::_('CONFIG_OUTDIR_ROOT'));
             $data['akeeba.basic.output_directory'] = '[DEFAULT_OUTPUT]';
         }
     }
     // Merge it
     $config = AEFactory::getConfiguration();
     $config->mergeArray($data, false, false);
     // Save configuration
     AEPlatform::getInstance()->save_configuration();
     $this->setRedirect(JURI::base() . 'index.php?option=' . JRequest::getCmd('option') . '&view=config', JText::_('CONFIG_SAVE_OK'));
 }
 public function import($file)
 {
     $directory = $this->getState('directory', '');
     $directory = AEUtilFilesystem::translateStockDirs($directory);
     // Find out how many parts there are
     $multipart = 0;
     $base = substr($file, 0, -4);
     $ext = substr($file, -3);
     $found = true;
     $total_size = @filesize($directory . '/' . $file);
     while ($found) {
         $multipart++;
         $newExtension = substr($ext, 0, 1) . sprintf('%02u', $multipart);
         $newFile = $directory . '/' . $base . '.' . $newExtension;
         $found = file_exists($newFile);
         if ($found) {
             $total_size += @filesize($newFile);
         }
     }
     $filetime = @filemtime($directory . '/' . $file);
     if (empty($filetime)) {
         $filetime = time();
     }
     // Create a new backup record
     $record = array('description' => JText::_('DISCOVER_LABEL_IMPORTEDDESCRIPTION'), 'comment' => '', 'backupstart' => date('Y-m-d H:i:s', $filetime), 'backupend' => date('Y-m-d H:i:s', $filetime + 1), 'status' => 'complete', 'origin' => 'backend', 'type' => 'full', 'profile_id' => 1, 'archivename' => $file, 'absolute_path' => $directory . '/' . $file, 'multipart' => $multipart, 'tag' => 'backend', 'filesexist' => 1, 'remote_filename' => '', 'total_size' => $total_size);
     $id = null;
     $id = AEPlatform::getInstance()->set_or_update_statistics($id, $record, $this);
 }
 public function onBrowse($tpl = null)
 {
     $model = $this->getModel();
     $task = $model->getState('browse_task', 'normal');
     // Add custom submenus
     $toolbar = FOFToolbar::getAnInstance($this->input->get('option', 'com_foobar', 'cmd'), $this->config);
     $toolbar->appendLink(JText::_('FILTERS_LABEL_NORMALVIEW'), JURI::base() . 'index.php?option=com_akeeba&view=dbef&task=normal', $task == 'normal');
     $toolbar->appendLink(JText::_('FILTERS_LABEL_TABULARVIEW'), JURI::base() . 'index.php?option=com_akeeba&view=dbef&task=tabular', $task == 'tabular');
     $media_folder = JURI::base() . '../media/com_akeeba/';
     // Get the root URI for media files
     $this->assign('mediadir', AkeebaHelperEscape::escapeJS($media_folder . 'theme/'));
     // Get a JSON representation of the available roots
     $model = $this->getModel();
     $root_info = $model->get_roots();
     $roots = array();
     if (!empty($root_info)) {
         // Loop all dir definitions
         foreach ($root_info as $def) {
             $roots[] = $def->value;
             $options[] = JHTML::_('select.option', $def->value, $def->text);
         }
     }
     $site_root = '[SITEDB]';
     $attribs = 'onchange="akeeba_active_root_changed();"';
     $this->assign('root_select', JHTML::_('select.genericlist', $options, 'root', $attribs, 'value', 'text', $site_root, 'active_root'));
     $this->assign('roots', $roots);
     switch ($task) {
         case 'normal':
         default:
             $this->setLayout('default');
             // Get a JSON representation of the database data
             $model = $this->getModel();
             $json = json_encode($model->make_listing($site_root));
             $this->assignRef('json', $json);
             break;
         case 'tabular':
             $this->setLayout('tabular');
             // Get a JSON representation of the tabular filter data
             $model = $this->getModel();
             $json = json_encode($model->get_filters($site_root));
             $this->assignRef('json', $json);
             break;
     }
     // Add live help
     AkeebaHelperIncludes::addHelp('dbef');
     // Get profile ID
     $profileid = AEPlatform::getInstance()->get_active_profile();
     $this->assign('profileid', $profileid);
     // Get profile name
     if (!class_exists('AkeebaModelProfiles')) {
         JLoader::import('models.profiles', JPATH_COMPONENT_ADMINISTRATOR);
     }
     $model = new AkeebaModelProfiles();
     $model->setId($profileid);
     $profile_data = $model->getProfile();
     $this->assign('profilename', $profile_data->description);
     return true;
 }
Beispiel #15
0
 public function onEdit($tpl = null)
 {
     $model = $this->getModel();
     $id = $model->getId();
     $record = AEPlatform::getInstance()->get_statistics($id);
     $this->record = $record;
     $this->record_id = $id;
     $this->setLayout('comment');
 }
Beispiel #16
0
	/**
	 * Returns a database connection object. It caches the created objects for future use.
	 * @param array $options Options to use when instanciating the database connection
	 * @return AEAbstractDriver
	 */
	public static function &getDatabase($options, $unset = false)
	{
		static $instances;

		if (!isset( $instances )) {
			$instances = array();
		}

		$signature = serialize( $options );

		if($unset)
		{
			if (!empty($instances[$signature]))
			{
				$db =& $instances[$signature];
				$db = null;
				unset($instances[$signature]);
			}
			$null = null;
			return $null;
		}

		if (empty($instances[$signature]))
		{
			$driver		= array_key_exists('driver', $options) 		? $options['driver']	: '';
			$select		= array_key_exists('select', $options)		? $options['select']	: true;
			$database	= array_key_exists('database', $options)	? $options['database']	: null;

			$driver = preg_replace('/[^A-Z0-9_\.-]/i', '', $driver);
			if(empty($driver))
			{
				// No driver specified; try to guess
				$default_signature = serialize( AEPlatform::get_platform_database_options() );
				if($signature == $default_signature)
				{
					$driver = AEPlatform::get_default_database_driver(true);
				}
				else
				{
					$driver = AEPlatform::get_default_database_driver(false);
				}
			}
			else
			{
				// Make sure a full driver name was given
				if(substr($driver,0,2) != 'AE') $driver = 'AEDriver'.ucfirst($driver);
			}

			$instance	= new $driver($options);

			$instances[$signature] = & $instance;
		}

		return $instances[$signature];
	}
Beispiel #17
0
 protected function _run()
 {
     if ($this->getState() == 'postrun') {
         AliceUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . " :: Already finished");
         $this->setStep('');
         $this->setSubstep('');
         return;
     } else {
         $this->setState('running');
     }
     // Load the version defines
     AEPlatform::getInstance()->load_version_defines();
     $registry = AliceFactory::getConfiguration();
     // Write log file's header
     AliceUtilLogger::WriteLog(_AE_LOG_INFO, "--------------------------------------------------------------------------------");
     AliceUtilLogger::WriteLog(_AE_LOG_INFO, "Alice Log Inspector and Correction of Errors " . AKEEBA_VERSION . ' (' . AKEEBA_DATE . ')');
     AliceUtilLogger::WriteLog(_AE_LOG_INFO, "What went wrong?");
     AliceUtilLogger::WriteLog(_AE_LOG_INFO, "--------------------------------------------------------------------------------");
     AliceUtilLogger::WriteLog(_AE_LOG_INFO, "--- System Information ---");
     AliceUtilLogger::WriteLog(_AE_LOG_INFO, "PHP Version        :" . PHP_VERSION);
     AliceUtilLogger::WriteLog(_AE_LOG_INFO, "PHP OS             :" . PHP_OS);
     AliceUtilLogger::WriteLog(_AE_LOG_INFO, "PHP SAPI           :" . PHP_SAPI);
     if (function_exists('php_uname')) {
         AliceUtilLogger::WriteLog(_AE_LOG_INFO, "OS Version         :" . php_uname('s'));
     }
     if (isset($_SERVER['SERVER_SOFTWARE'])) {
         $server = $_SERVER['SERVER_SOFTWARE'];
     } elseif ($sf = getenv('SERVER_SOFTWARE')) {
         $server = $sf;
     } else {
         $server = 'n/a';
     }
     AliceUtilLogger::WriteLog(_AE_LOG_INFO, "Web Server         :" . $server);
     $platformData = AEPlatform::getInstance()->getPlatformVersion();
     AliceUtilLogger::WriteLog(_AE_LOG_INFO, $platformData['name'] . " version    :" . $platformData['version']);
     if (isset($_SERVER['HTTP_USER_AGENT'])) {
         AliceUtilLogger::WriteLog(_AE_LOG_INFO, "User agent         :" . phpversion() <= "4.2.1" ? getenv("HTTP_USER_AGENT") : $_SERVER['HTTP_USER_AGENT']);
     }
     AliceUtilLogger::WriteLog(_AE_LOG_INFO, "Safe mode          :" . ini_get("safe_mode"));
     AliceUtilLogger::WriteLog(_AE_LOG_INFO, "Display errors     :" . ini_get("display_errors"));
     AliceUtilLogger::WriteLog(_AE_LOG_INFO, "Error reporting    :" . self::error2string());
     AliceUtilLogger::WriteLog(_AE_LOG_INFO, "Error display      :" . self::errordisplay());
     AliceUtilLogger::WriteLog(_AE_LOG_INFO, "Disabled functions :" . ini_get("disable_functions"));
     AliceUtilLogger::WriteLog(_AE_LOG_INFO, "open_basedir restr.:" . ini_get('open_basedir'));
     AliceUtilLogger::WriteLog(_AE_LOG_INFO, "Max. exec. time    :" . ini_get("max_execution_time"));
     AliceUtilLogger::WriteLog(_AE_LOG_INFO, "Memory limit       :" . ini_get("memory_limit"));
     if (function_exists("memory_get_usage")) {
         AliceUtilLogger::WriteLog(_AE_LOG_INFO, "Current mem. usage :" . memory_get_usage());
     }
     AliceUtilLogger::WriteLog(_AE_LOG_INFO, "--------------------------------------------------------------------------------");
     if (!version_compare(PHP_VERSION, '5.3.0', 'ge')) {
         AliceUtilLogger::WriteLog(_AE_LOG_WARNING, "You are using an outdated version of PHP. Akeeba Engine may not work properly. Please upgrade to PHP 5.3 or later.");
     }
     $this->setState('postrun');
 }
Beispiel #18
0
	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();
	}
Beispiel #19
0
 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;
 }
Beispiel #20
0
 public function onAdd($tpl = null)
 {
     // Get profile ID
     $profileid = AEPlatform::getInstance()->get_active_profile();
     $this->profileid = $profileid;
     // Get profile name
     $profileName = FOFModel::getTmpInstance('Profiles', 'AkeebaModel')->setId($profileid)->getItem()->description;
     $this->profilename = $profileName;
     // Get the CRON paths
     $this->croninfo = $this->getModel()->getPaths();
     // Add live help
     AkeebaHelperIncludes::addHelp('schedule');
 }
Beispiel #21
0
 /**
  * The default layout, shows a list of profiles
  *
  */
 function onBrowse($tpl = null)
 {
     // Get reference to profiles model
     $model = $this->getModel();
     // Get profile ID
     $profileid = AEPlatform::getInstance()->get_active_profile();
     $this->profileid = $profileid;
     // Get profile name
     $model->setId($profileid);
     $profile_data = $model->getProfile();
     $this->profilename = $profile_data->description;
     return parent::onBrowse($tpl);
 }
Beispiel #22
0
 public function onDisplay($tpl = null)
 {
     $model = $this->getModel();
     $task = $model->getState('task', 'components');
     // Add submenus (those nifty text links below the toolbar!)
     $toolbar = FOFToolbar::getAnInstance($this->input->get('option', 'com_foobar', 'cmd'), $this->config);
     $link = JURI::base() . '?option=com_akeeba&view=extfilter&task=components';
     $toolbar->appendLink(JText::_('EXTFILTER_COMPONENTS'), $link, $task == 'components');
     $link = JURI::base() . '?option=com_akeeba&view=extfilter&task=modules';
     $toolbar->appendLink(JText::_('EXTFILTER_MODULES'), $link, $task == 'modules');
     $link = JURI::base() . '?option=com_akeeba&view=extfilter&task=plugins';
     $toolbar->appendLink(JText::_('EXTFILTER_PLUGINS'), $link, $task == 'plugins');
     $link = JURI::base() . '?option=com_akeeba&view=extfilter&task=languages';
     $toolbar->appendLink(JText::_('EXTFILTER_LANGUAGES'), $link, $task == 'languages');
     $link = JURI::base() . '?option=com_akeeba&view=extfilter&task=templates';
     $toolbar->appendLink(JText::_('EXTFILTER_TEMPLATES'), $link, $task == 'templates');
     switch ($task) {
         case 'components':
             // Pass along the list of components
             $this->components = $model->getComponents();
             break;
         case 'modules':
             // Pass along the list of components
             $this->modules = $model->getModules();
             break;
         case 'plugins':
             // Pass along the list of components
             $this->plugins = $model->getPlugins();
             break;
         case 'templates':
             // Pass along the list of components
             $this->templates = $model->getTemplates();
             break;
         case 'languages':
             // Pass along the list of components
             $this->languages = $model->getLanguages();
             break;
     }
     $this->setLayout($task);
     // Add live help
     AkeebaHelperIncludes::addHelp('extfilter');
     // Get profile ID
     $profileid = AEPlatform::getInstance()->get_active_profile();
     $this->profileid = $profileid;
     // Get profile name
     $pmodel = FOFModel::getAnInstance('Profiles', 'AkeebaModel');
     $pmodel->setId($profileid);
     $profile_data = $pmodel->getItem();
     $this->profilename = $profile_data->description;
     return true;
 }
Beispiel #23
0
 /**
  * Sets or updates the statistics record of the current backup attempt
  *
  * @param array $data
  */
 public function setStatistics($data)
 {
     $ret = AEPlatform::getInstance()->set_or_update_statistics($this->statistics_id, $data, $this);
     if ($ret !== false) {
         if (!is_null($ret)) {
             $this->statistics_id = $ret;
         }
         $this->cached_data = array_merge($this->cached_data, $data);
         $result = true;
     } elseif ($ret === false) {
         $result = false;
     }
     return $result;
 }
 /**
  * Validates the data passed to the request.
  * @return mixed True if all is OK, an error string if something is wrong
  */
 function validateRequest()
 {
     // Does the ID exist?
     $this->setIDsFromRequest();
     $id = $this->getId();
     if (empty($id)) {
         return JText::_('RESTORE_ERROR_INVALID_RECORD');
     }
     // Is this a valid backup entry?
     $data = AEPlatform::getInstance()->get_statistics($id);
     if (empty($data)) {
         return JText::_('RESTORE_ERROR_INVALID_RECORD');
     }
     // Is this a complete backup?
     if ($data['status'] != 'complete') {
         return JText::_('RESTORE_ERROR_INVALID_RECORD');
     }
     // Is it a restoration point backup?
     if ($data['tag'] != 'restorepoint') {
         return JText::_('RESTORE_ERROR_NOT_AN_SRP');
     }
     $rawDataParts = explode("\n", $data['comment']);
     $this->info = json_decode($rawDataParts[1]);
     $this->info->srpdate = $data['backupstart'];
     // Load the profile ID (so that we can find out the output directory)
     $profile_id = $data['profile_id'];
     AEPlatform::getInstance()->load_configuration($profile_id);
     $path = $data['absolute_path'];
     $exists = @file_exists($path);
     if (!$exists) {
         // Let's try figuring out an alternative path
         $config = AEFactory::getConfiguration();
         $path = $config->get('akeeba.basic.output_directory', '') . '/' . $data['archivename'];
         $exists = @file_exists($path);
     }
     if (!$exists) {
         return JText::_('RESTORE_ERROR_ARCHIVE_MISSING');
     }
     $filename = basename($path);
     $lastdot = strrpos($filename, '.');
     $extension = strtoupper(substr($filename, $lastdot + 1));
     if (!in_array($extension, array('JPA', 'ZIP'))) {
         return JText::_('RESTORE_ERROR_INVALID_TYPE');
     }
     $this->data = $data;
     $this->path = $path;
     $this->extension = $extension;
     return true;
 }
 /**
  * Database object constructor
  * @param	array	List of options used to configure the connection
  */
 public function __construct($options)
 {
     // Get best matching Akeeba Backup driver instance
     if (class_exists('JFactory')) {
         $this->dbo = JFactory::getDBO();
     } else {
         $driver = AEPlatform::getInstance()->get_default_database_driver(false);
         $this->dbo = new $driver($options);
     }
     // Propagate errors
     $this->propagateFromObject($this->dbo);
     $this->nameQuote = '`';
     parent::__construct($options);
     $this->database = $options['database'];
 }
 public function getPaths()
 {
     $ret = (object) array('cli' => (object) array('supported' => false, 'path' => false), 'altcli' => (object) array('supported' => false, 'path' => false), 'frontend' => (object) array('supported' => false, 'path' => false), 'info' => (object) array('windows' => false, 'php_path' => false, 'root_url' => false, 'secret' => '', 'feenabled' => false));
     // Get the profile ID
     $profileid = AEPlatform::getInstance()->get_active_profile();
     // Get the absolute path to the site's root
     $absolute_root = rtrim(realpath(JPATH_ROOT), DIRECTORY_SEPARATOR);
     // Is this Windows?
     $ret->info->windows = DIRECTORY_SEPARATOR == '\\' || substr(strtoupper(PHP_OS), 0, 3) == 'WIN';
     // Get the pseudo-path to PHP CLI
     if ($ret->info->windows) {
         $ret->info->php_path = 'c:\\path\\to\\php.exe';
     } else {
         $ret->info->php_path = '/path/to/php';
     }
     // Get front-end backup secret key
     $ret->info->secret = AEUtilComconfig::getValue('frontend_secret_word', '');
     $ret->info->feenabled = AEUtilComconfig::getValue('frontend_enable', false);
     // Get root URL
     $ret->info->root_url = rtrim(AEUtilComconfig::getValue('siteurl', ''), '/');
     // Get information for CLI CRON script
     if (AKEEBA_PRO) {
         $ret->cli->supported = true;
         $ret->cli->path = $absolute_root . DIRECTORY_SEPARATOR . 'cli' . DIRECTORY_SEPARATOR . 'akeeba-backup.php';
         if ($profileid != 1) {
             $ret->cli->path .= ' --profile=' . $profileid;
         }
     }
     // Get information for alternative CLI CRON script
     if (AKEEBA_PRO) {
         $ret->altcli->supported = true;
         if (trim($ret->info->secret) && $ret->info->feenabled) {
             $ret->altcli->path = $absolute_root . DIRECTORY_SEPARATOR . 'cli' . DIRECTORY_SEPARATOR . 'akeeba-altbackup.php';
             if ($profileid != 1) {
                 $ret->altcli->path .= ' --profile=' . $profileid;
             }
         }
     }
     // Get information for front-end backup
     $ret->frontend->supported = true;
     if (trim($ret->info->secret) && $ret->info->feenabled) {
         $ret->frontend->path = 'index.php?option=com_akeeba&view=backup&key=' . urlencode($ret->info->secret);
         if ($profileid != 1) {
             $ret->frontend->path .= '&profile=' . $profileid;
         }
     }
     return $ret;
 }
Beispiel #27
0
	/**
	 * 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 = 'children';
     $this->method = 'direct';
     $this->filter_name = 'PlatformSkipdirs';
     // We take advantage of the filter class magic to inject our custom filters
     $configuration = AEFactory::getConfiguration();
     if (defined('AKEEBACLI')) {
         $tmpdir = AEUtilJconfig::getValue('tmp_path');
     } else {
         $jreg = JFactory::getConfig();
         $tmpdir = $jreg->getValue('config.tmp_path');
     }
     $this->filter_data['[SITEROOT]'] = array(self::treatDirectory($configuration->get('akeeba.basic.output_directory')), self::treatDirectory($tmpdir), self::treatDirectory(JPATH_CACHE), self::treatDirectory(JPATH_ADMINISTRATOR . '/cache'), self::treatDirectory(JPATH_ROOT . '/cache'), self::treatDirectory(JPATH_ROOT . '/installation'), self::treatDirectory(AEPlatform::getInstance()->get_site_root() . '/cache'), self::treatDirectory(AEPlatform::getInstance()->get_site_root() . '/administrator/cache'), 'administrator/components/com_akeeba/backup', self::treatDirectory(AEPlatform::getInstance()->get_site_root() . '/components/libraries/cmslib/cache'), 'logs');
     parent::__construct();
 }
Beispiel #29
0
/**
 * Loads the $class from a file in the directory $path, if and only if
 * the class name starts with $prefix. Will also try the plugins path
 * if the class is not present in the regular location.
 * @param string $class The class name
 * @param string $prefix The prefix to test
 * @param string $path The path to load the class from
 * @return bool True if we loaded the class
 */
function AliceLoadIfPrefix($class, $prefix, $path)
{
    // Find the root path of Akeeba's installation. Static so that we can save some CPU time.
    static $root;
    static $platformDirs = array();
    if (empty($root)) {
        if (defined('ALICEROOT')) {
            $root = ALICEROOT;
        } else {
            $root = dirname(__FILE__);
        }
    }
    if (empty($platformDirs)) {
        $platformDirs = AEPlatform::getInstance()->getPlatformDirectories();
    }
    if (strpos($class, $prefix) === 0) {
        $filename = strtolower(substr($class, strlen($prefix))) . '.php';
        // Try the plugins path
        $filePath = $root . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $path . DIRECTORY_SEPARATOR . $filename;
        if (file_exists($filePath)) {
            require_once $filePath;
            if (class_exists($class, false)) {
                return true;
            }
        }
        // Try the platform overrides
        foreach ($platformDirs as $dir) {
            $filePath = $dir . '/' . $path . '/' . $filename;
            if (file_exists($filePath)) {
                require_once $filePath;
                if (class_exists($class, false)) {
                    return true;
                }
            }
        }
        // Try the regular path
        $filePath = $root . DIRECTORY_SEPARATOR . $path . DIRECTORY_SEPARATOR . $filename;
        if (file_exists($filePath)) {
            require_once $filePath;
            if (class_exists($class, false)) {
                return true;
            }
        }
    }
    return false;
}
Beispiel #30
0
 function __construct()
 {
     $this->object = 'dir';
     $this->subtype = 'content';
     $this->method = 'api';
     if (AEFactory::getKettenrad()->getTag() != 'restorepoint') {
         $this->enabled = false;
     } else {
         $this->init();
     }
     // Make sure we exclude the current and default backup output directories
     $configuration = AEFactory::getConfiguration();
     if ($configuration->get('akeeba.platform.override_root', 0)) {
         $root = $configuration->get('akeeba.platform.newroot', '[SITEROOT]');
     } else {
         $root = '[SITEROOT]';
     }
     $this->filter_data[$root] = array(self::treatDirectory($configuration->get('akeeba.basic.output_directory')), 'administrator/components/com_akeeba/backup', self::treatDirectory(AEPlatform::getInstance()->get_site_root() . '/components/libraries/cmslib/cache'), 'components/libraries/cmslib/cache');
 }