예제 #1
0
	/**
	 * Implements the _prepare abstract method
	 *
	 */
	protected function _prepare()
	{
		// Load parameters (description and comment)
		$jpskey = '';
		if(!empty($this->_parametersArray))
		{
			$params = $this->_parametersArray;
			if( isset($params['description']) ) $this->description = $params['description'];
			if( isset($params['comment']) ) $this->comment = $params['comment'];
			if( isset($params['jpskey']) ) $jpskey = $params['jpskey'];
		}

		// Load configuration
		AEPlatform::load_configuration();

		// Initialize counters
		$registry =& AEFactory::getConfiguration();
		$registry->set('volatile.step_counter', 0);
		$registry->set('volatile.operation_counter', 0);
		if(!empty($jpskey)) $registry->set('engine.archiver.jps.key', $jpskey);


		// Initialize temporary storage
		AEUtilTempvars::reset();

		// Force load the tag
		$kettenrad =& AEFactory::getKettenrad();
		$tag = $kettenrad->getTag();

		// Push the comment and description in temp vars for use in the installer phase
		$registry->set('volatile.core.description', $this->description);
		$registry->set('volatile.core.comment', $this->comment);

		$this->setState('prepared');
	}
예제 #2
0
	/**
	 * Displays the Control Panel (main page)
	 * Accessible at index.php?option=com_akeeba
	 *
	 */
	public function display()
	{
		$registry =& AEFactory::getConfiguration();

		// Invalidate stale backups
		AECoreKettenrad::reset( array('global'=>true,'log'=>false) );

		// Just in case the reset() loaded a stale configuration...
		AEPlatform::load_configuration();
		
		// Let's make sure the temporary and output directories are set correctly and writable...
		$wizmodel = JModel::getInstance('Confwiz','AkeebaModel');
		$wizmodel->autofixDirectories();
		
		// Check if we need to toggle the settings encryption feature
		$model = JModel::getInstance('Cpanel','AkeebaModel');
		$model->checkSettingsEncryption();
		// Update the magic component parameters
		$model->updateMagicParameters();
		
		// Check the last installed version
		$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;
		}

		// Display the panel
		parent::display();
	}
예제 #3
0
파일: log.php 프로젝트: rkern21/videoeditor
	public function download()
	{
		AEPlatform::load_configuration(AEPlatform::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();
	}
예제 #4
0
	private function _setProfile()
	{
		// Set profile
		$profile = JRequest::getInt('profile', 1);
		if(!is_numeric($profile)) $profile = 1;
		$session =& JFactory::getSession();
		$session->set('profile', $profile, 'akeeba');
		// Reload registry
		$registry =& AEFactory::getConfiguration();
		AEPlatform::load_configuration();
	}
예제 #5
0
$profile_id = $session->get('profile', null, 'akeeba');
if(is_null($profile_id))
{
	// No profile is set in the session; use default profile
	$session->set('profile', 1, 'akeeba');
}

// Get the view and controller from the request, or set to default if they weren't set
JRequest::setVar('view', JRequest::getCmd('view','cpanel'));
JRequest::setVar('c', JRequest::getCmd('view','cpanel')); // Black magic: Get controller based on the selected view

// Load the factory
require_once JPATH_COMPONENT_ADMINISTRATOR.DS.'akeeba'.DS.'factory.php';
// Load the Akeeba Backup configuration and check user access permission
$registry =& AEFactory::getConfiguration();
AEPlatform::load_configuration();
unset($registry);

require_once JPATH_COMPONENT_ADMINISTRATOR.DS.'helpers'.DS.'includes.php';
require_once JPATH_COMPONENT_ADMINISTRATOR.DS.'helpers'.DS.'escape.php';

// Merge the default translation with the current translation
$jlang =& JFactory::getLanguage();
// Front-end translation
$jlang->load('com_akeeba', JPATH_SITE, 'en-GB', true);
$jlang->load('com_akeeba', JPATH_SITE, $jlang->getDefault(), true);
$jlang->load('com_akeeba', JPATH_SITE, null, true);
// Back-end translation
$jlang->load('com_akeeba', JPATH_ADMINISTRATOR, 'en-GB', true);
$jlang->load('com_akeeba', JPATH_ADMINISTRATOR, $jlang->getDefault(), true);
$jlang->load('com_akeeba', JPATH_ADMINISTRATOR, null, true);
예제 #6
0
	/**
	 * Loads the factory from the storage (if it exists) and returns a reference to the
	 * Kettenrad object.
	 * @param $tag string The backup tag to load
	 * @return AECoreKettenrad A reference to the Kettenrad object
	 */
	public static function &load($tag = null)
	{
		if(is_null($tag) && defined('AKEEBA_BACKUP_ORIGIN')) {
			$tag = AKEEBA_BACKUP_ORIGIN;
		}

		// In order to load anything, we need to have the correct profile loaded. Let's assume
		// that the latest backup record in this tag has the correct profile number set.
		$config =& AEFactory::getConfiguration();
		if( empty($config->activeProfile) )
		{
			// Only bother loading a configuration if none has been already loaded
			$statList = AEPlatform::get_statistics_list(0,1,array(
					array('field' => 'tag', 'value' => $tag)
				),array(
					'by' => 'id', 'order' => 'DESC'	
				)
			);
			if(is_array($statList)) {
				$stat = array_pop($statList);
				$profile = $stat['profile_id'];
				AEPlatform::load_configuration($profile);
			}
		}

		AEUtilLogger::openLog($tag);
		AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Kettenrad :: Attempting to load from database ($tag)");
		$serialized_factory = AEUtilTempvars::get($tag);
		if($serialized_factory !== false)
		{
			AEUtilLogger::WriteLog(_AE_LOG_DEBUG, " -- Loaded stored Akeeba Factory ($tag)");
			AEFactory::unserialize($serialized_factory);
		}
		else
		{
			// There is no serialized factory. Nuke the in-memory factory.
			AEUtilLogger::WriteLog(_AE_LOG_DEBUG, " -- Stored Akeeba Factory ($tag) not found - hard reset");
			AEFactory::nuke();
			AEPlatform::load_configuration();
		}
		unset($serialized_factory);
		return AEFactory::getKettenrad();
	}
예제 #7
0
파일: stw.php 프로젝트: rkern21/videoeditor
	private function createNewSTWProfile($copyfrom = null)
	{
		// Get the Profiles model and fetch the STW profile ID
		$m = JModel::getInstance('Profiles','AkeebaModel');
		$id = $this->getSTWProfileID();
		
		if($id != 0) {
			AEPlatform::load_configuration($id);
		}
		
		// Create a new profile
		$data = array(
			'id'			=> $id,
			'description'	=> $this->stwProfileName,
			'configuration'	=> '',
			'filters'		=> serialize(array())
		);

		// Inherit settings from another profile
		if( ($id != 0) && !empty($copyfrom) ) {
			$m->setId($copyfrom);
			if($m->checkID()) {
				$oldProfile = $m->getProfile();
				$data['configuration'] = $oldProfile->configuration;
				$data['filters'] = $oldProfile->filters;
			}
		}
		
		// Save the new/changed profile
		$m->setId($id);
		$result = $m->save($data);
		
		if($result) {
			// If the save was successful, switch the active profile
			$newRecord = $m->getSavedTable();
			$session =& JFactory::getSession();
			$session->set('profile', $newRecord->id, 'akeeba');
		}
		
		return $result;
	}
예제 #8
0
	/**
	 * 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?
		$id = $this->getId();
		if(empty($id))
		{
			return JText::_('RESTORE_ERROR_INVALID_RECORD');
		}

		// Is this a valid backup entry?
		$data = AEPlatform::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::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', '').DS.$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;
	}
예제 #9
0
	public function getPostProcessingEnginePerProfile()
	{
		// Cache the current profile
		$session =& JFactory::getSession();
		$currentProfileID = $session->get('profile', null, 'akeeba');
		
		$db =& $this->getDBO();
		$query = "SELECT id FROM ".$db->nameQuote('#__ak_profiles');
		$db->setQuery($query);
		$profiles = $db->loadResultArray();

		$engines = array();
		foreach($profiles as $profileID) {
			AEPlatform::load_configuration($profileID);
			$pConf = AEFactory::getConfiguration();
			$engines[$profileID] = $pConf->get('akeeba.advanced.proc_engine');
		}
		
		AEPlatform::load_configuration($currentProfileID);
		
		return $engines;
	}
예제 #10
0
	public function upload()
	{
		// Get the parameters
		$id = $this->getAndCheckId();
		$part = JRequest::getInt('part', 0);
		$frag = JRequest::getInt('frag', 0);

		// 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;
		}
		
		// Calculate the filenames
		$stat = AEPlatform::get_statistics($id);
		$local_filename = $stat['absolute_path'];
		$basename = basename($local_filename);
		$extension = strtolower(str_replace(".", "", strrchr($basename, ".")));
		
		if($part > 0) {
			$new_extension = substr($extension,0,1) . sprintf('%02u', $part); 
		} else {
			$new_extension = $extension;
		}
		
		$filename = $basename.'.'.$new_extension;
		$local_filename = substr($local_filename, 0, -strlen($extension)).$new_extension;
		
		// Load the post-processing engine
		AEPlatform::load_configuration($stat['profile_id']);
		$config = AEFactory::getConfiguration();
		
		$session = JFactory::getSession();
		$engine = null;
		if(!empty($savedEngine) && ($frag != -1)) {
			// If it's not the first fragment, try to revive the saved engine
			$savedEngine = $session->get('postproc_engine', null, 'akeeba');
			$engine = unserialize($savedEngine);
		}
		if(empty($engine)) {
			$engine_name = $config->get('akeeba.advanced.proc_engine');
			$engine = AEFactory::getPostprocEngine($engine_name);
		}
		
		// Start uploading
		$result = $engine->processPart($local_filename);
		switch($result) {
			case true:
				$part++;
				break;
			
			case 1:
				$frag++;
				$savedEngine = serialize($engine);
				$session->set('postproc_engine', null, 'akeeba');
				break;
			
			case false;
				$part = -1;
				return;
				break;
		}
		
		if(version_compare(JVERSION, '1.6.0', 'ge')) {
			$view = & $this->getView( 'upload', 'html', '', array('base_path' => $this->basePath));
		} else {
			$view = & $this->getView( 'upload', 'html', '', array( 'base_path'=>$this->_basePath));
		}

		if($part >= 0) {
			if($part < $stat['multipart']) {
				$view->setLayout('uploading');
				$view->assign('parts',$stat['multipart']);
				$view->assign('part', $part);
				$view->assign('frag', $frag);
				$view->assign('id', $id);
			} else {
				// Update stats with remote filename
				$remote_filename = $config->get('akeeba.advanced.proc_engine','').'://';
				$remote_filename .= $engine->remote_path;
				$data = array(
					'remote_filename'	=> $remote_filename
				);
				AEPlatform::set_or_update_statistics($id, $data, $engine);
				
				$view->setLayout('done');
			}
		} else {
			$view->setLayout('error');
		}
		$view->display();
	}
예제 #11
0
	/**
	 * Processes removing an entry and redirecting to list view
	 *
	 */
	public function remove()
	{
		// 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'));
		}
		
		// Capture active profile ID
		$session =& JFactory::getSession();
		$active_profile_id = $session->get('profile', null, 'akeeba');
		if(is_null($active_profile_id))
		{
			// No profile is set in the session; use default profile
			$session->set('profile', 1, 'akeeba');
			$active_profile_id = 1;
		}
		
		$model =& $this->getModel('profiles');

		// Capture profile to be deleted
		$id_list = $model->getAllIds();
		if(empty($id_list))
		{
			$message = JText::_('PROFILE_DELETE_ERROR');
			$type = 'error';
		}
		else
		{
			foreach($id_list as $deleted_profile)
			{
				$model->setId($deleted_profile);
				if($model->delete())
				{
					// Show a "SAVE OK" message
					$message = JText::_('PROFILE_DELETE_OK');
					$type = 'message';

					// If the deleted profile was the active profile, switch to default
					if($deleted_profile == $active_profile_id)
					{
						$this->_switchProfile(1);
						$configuration =& AEFactory::getConfiguration();
						AEPlatform::load_configuration(1);
					}
				}
				else
				{
					// Show message on failure
					$message = JText::_('PROFILE_DELETE_ERROR');
					$message .= ' ['.$model->getError().']';
					$type = 'error';
				}
			}
		}


		// Redirect
		$this->setRedirect('index.php?option='.JRequest::getCmd('option').'&view='.JRequest::getCmd('view'), $message, $type);
	}
예제 #12
0
	private function _apiUpdateCleanup($config) {
		$session =& JFactory::getSession();
		$session->set('profile', 1, 'akeeba');
		AEPlatform::load_configuration(1);
		$config = AEFactory::getConfiguration();
		$target = $config->get('remoteupdate.target', '');
		$tempdir = $config->get('remoteupdate.tempdir', '');
		
		$session = JFactory::getSession();
		$session->set('target', $target, 'liveupdate');
		$session->set('tempdir', $tempdir, 'liveupdate');
		
		require_once JPATH_ROOT.'/administrator/components/com_akeeba/liveupdate/liveupdate.php';
		require_once JPATH_ROOT.'/administrator/components/com_akeeba/liveupdate/classes/model.php';
		
		$model = new LiveupdateModel();
		$ret = $model->cleanup();
		
		jimport('joomla.filesystem.file');
		JFile::delete($target);

		$config->set('remoteupdate.target', null);
		$config->set('remoteupdate.tempdir', null);
		AEPlatform::save_configuration(1);

		return (object)array(
			'cleanup'	=> 1
		);
	}