/** * Initialises the archiver class, seeding the remote installation * from an existent installer's JPA archive. * * @param string $sourceJPAPath Absolute path to an installer's JPA archive * @param string $targetArchivePath Absolute path to the generated archive (ignored in this class) * @param array $options A named key array of options (optional) * @access public */ public function initialize($targetArchivePath, $options = array()) { AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . " :: new instance"); $registry = AEFactory::getConfiguration(); $this->_host = $registry->get('engine.archiver.directsftp.host', ''); $this->_port = $registry->get('engine.archiver.directsftp.port', '22'); $this->_user = $registry->get('engine.archiver.directsftp.user', ''); $this->_pass = $registry->get('engine.archiver.directsftp.pass', ''); $this->_privkey = $registry->get('engine.archiver.directsftp.privkey', ''); $this->_pubkey = $registry->get('engine.archiver.directsftp.pubkey', ''); $this->_initdir = $registry->get('engine.archiver.directsftp.initial_directory', ''); if (isset($options['host'])) { $this->_host = $options['host']; } if (isset($options['port'])) { $this->_port = $options['port']; } if (isset($options['user'])) { $this->_user = $options['user']; } if (isset($options['pass'])) { $this->_pass = $options['pass']; } if (isset($options['privkey'])) { $this->_privkey = $options['privkey']; } if (isset($options['pubkey'])) { $this->_pubkey = $options['pubkey']; } if (isset($options['initdir'])) { $this->_initdir = $options['initdir']; } $this->connect_ok = $this->_connectSFTP(); AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . " :: SFTP connection status: " . ($this->connect_ok ? 'success' : 'FAIL')); }
public function &getExtraSQL($root) { $empty = ''; if ($root != '[SITEDB]') { return $empty; } $sql = ''; $db = AEFactory::getDatabase(); $this->getFilters(null); // Forcibly reload the filter data // Loop all components and add SQL statements if (!empty($this->filter_data)) { foreach ($this->filter_data as $type => $items) { if (!empty($items)) { // Make sure that DB only backups get the correct prefix $configuration = AEFactory::getConfiguration(); $abstract = AEUtilScripting::getScriptingParameter('db.abstractnames', 1); if ($abstract) { $prefix = '#__'; } else { $prefix = $db->getPrefix(); } foreach ($items as $item) { $client = $type == 'frontend' ? 0 : 1; $sql .= 'DELETE FROM ' . $db->quoteName($prefix . 'modules_menu') . ' WHERE ' . $db->quoteName('moduleid') . ' IN (' . 'SELECT ' . $db->quoteName('id') . ' FROM ' . $db->quoteName($prefix . 'modules') . ' WHERE ' . '(' . $db->quoteName('module') . ' = ' . $db->Quote($item) . ')' . ' AND (' . $db->quoteName('client_id') . ' = ' . $db->Quote($client) . ')' . ");\n"; $sql .= 'DELETE FROM ' . $db->quoteName($prefix . 'modules') . ' WHERE ' . '(' . $db->quoteName('module') . ' = ' . $db->Quote($item) . ')' . ' AND (' . $db->quoteName('client_id') . ' = ' . $db->Quote($client) . ')' . ";\n"; $sql .= 'DELETE FROM ' . $db->quoteName($prefix . 'extensions') . ' WHERE ' . $db->quoteName('element') . ' = ' . $db->Quote($item) . " AND " . $db->quoteName('type') . ' = ' . $db->Quote('module') . ";\n"; } } } } return $sql; }
/** * 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')); }
protected function is_excluded_by_api($test, $root) { static $from_datetime; $config =& AEFactory::getConfiguration(); if (is_null($from_datetime) && $filter_switch) { $user_setting = $config->get('core.filters.dateconditional.start'); $from_datetime = strtotime($user_setting); } // Get the filesystem path for $root $fsroot = $config->get('volatile.filesystem.current_root', ''); $ds = $fsroot == '' || $fsroot == '/' ? '' : DIRECTORY_SEPARATOR; $filename = $fsroot . $ds . $test; // Get the timestamp of the file $timestamp = @filemtime($filename); // If we could not get this information, include the file in the archive if ($timestamp === false) { return false; } // Compare it with the user-defined minimum timestamp and exclude if it's older than that if ($timestamp <= $from_datetime) { return true; } // No match? Just include the file! return false; }
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(); }
function display() { $registry =& AEFactory::getConfiguration(); // Set the toolbar title JToolBarHelper::title(JText::_('AKEEBA').':: <small>'.JText::_('SITETRANSFERWIZARD').'</small>','akeeba'); JToolBarHelper::back('AKEEBA_CONTROLPANEL', 'index.php?option='.JRequest::getCmd('option')); // Add references to CSS and JS files AkeebaHelperIncludes::includeMedia(false); // Add live help AkeebaHelperIncludes::addHelp(); $model = $this->getModel(); $task = JRequest::getCmd('task','default'); switch($task) { case 'step1': case 'default': default: $cpanelmodel = JModel::getInstance('Cpanel','AkeebaModel'); $this->assign('profilelist', $cpanelmodel->getProfilesList()); $this->assign('stw_profile_id', $model->getSTWProfileID()); break; case 'step2': $this->assignRef('opts', $model->getTransferSettings()); break; case 'step3': break; } parent::display(); }
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; } }
protected function init() { // Fetch the configuration $config = AEFactory::getConfiguration(); $this->params = (object) array('type' => $config->get('core.filters.srp.type', 'component'), 'group' => $config->get('core.filters.srp.group', 'group'), 'name' => $config->get('core.filters.srp.name', 'name'), 'customdirs' => $config->get('core.filters.srp.customdirs', array()), 'customfiles' => $config->get('core.filters.srp.customfiles', array()), 'langfiles' => $config->get('core.filters.srp.langfiles', array())); $this->alloweddirs = array(); // Process custom directories if (is_array($this->params->customdirs)) { foreach ($this->params->customdirs as $dir) { $dir = $this->treatDirectory($dir); $this->alloweddirs[] = $dir; } } // Process custom files if (is_array($this->params->customfiles)) { foreach ($this->params->customfiles as $file) { $dir = dirname($file); $dir = $this->treatDirectory($dir); if (!in_array($dir, $this->strictalloweddirs)) { $this->strictalloweddirs[] = $dir; } if (!in_array($dir, $this->alloweddirs)) { $this->alloweddirs[] = $dir; } } } $this->alloweddirs[] = 'language'; $this->alloweddirs[] = 'administrator/language'; // Process core directorires switch ($this->params->type) { case 'component': $this->alloweddirs[] = 'components/com_' . $this->params->name; $this->alloweddirs[] = 'administrator/components/com_' . $this->params->name; $this->alloweddirs[] = 'media/com_' . $this->params->name; $this->alloweddirs[] = 'media/' . $this->params->name; break; case 'plugin': // This is required for Joomla! 1.5 compatibility $this->alloweddirs[] = 'plugins/' . $this->params->group; // This is required for Joomla! 1.6 compatibility $this->alloweddirs[] = 'plugins/' . $this->params->group . '/' . $this->params->name; break; case 'module': if ($this->params->group == 'admin') { $this->alloweddirs[] = 'administrator/modules/mod_' . $this->params->name; } else { $this->alloweddirs[] = 'modules/mod_' . $this->params->name; } break; case 'template': if ($this->params->group == 'admin') { $this->alloweddirs[] = 'administrator/templates/' . $this->params->name; } else { $this->alloweddirs[] = 'templates/' . $this->params->name; } break; default: $this->alloweddirs = array(); } }
public function &getExtraSQL($root) { $empty = ''; if ($root != '[SITEDB]') { return $empty; } $sql = ''; $db = AEFactory::getDatabase(); $this->getFilters(null); // Forcibly reload the filter data // Loop all components and add SQL statements if (!empty($this->filter_data)) { foreach ($this->filter_data as $type => $items) { if (!empty($items)) { // Make sure that DB only backups get the correct prefix $configuration = AEFactory::getConfiguration(); $abstract = AEUtilScripting::getScriptingParameter('db.abstractnames', 1); if ($abstract) { $prefix = '#__'; } else { $prefix = $db->getPrefix(); } foreach ($items as $item) { if (!$this->joomla16) { $sql .= 'DELETE FROM ' . $db->quoteName($prefix . 'components') . ' WHERE ' . $db->quoteName('option') . ' = ' . $db->Quote($item) . ";\n"; } else { $sql .= 'DELETE FROM ' . $db->quoteName($prefix . 'extensions') . ' WHERE ' . $db->quoteName('element') . ' = ' . $db->Quote($item) . " AND " . $db->quoteName('type') . ' = ' . $db->Quote('component') . ";\n"; } $sql .= 'DELETE FROM ' . $db->quoteName($prefix . 'menu') . ' WHERE ' . $db->quoteName('type') . ' = ' . $db->Quote('component') . ' AND ' . $db->quoteName('link') . ' LIKE ' . $db->Quote('%option=' . $item . '%') . ";\n"; } } } } return $sql; }
protected function scanFolder($folder, &$position, $forFolders = true, $threshold_key = 'dir', $threshold_default = 50) { $registry = AEFactory::getConfiguration(); // Initialize variables $arr = array(); $false = false; if (!is_dir($folder) && !is_dir($folder . '/')) { return $false; } try { $di = new DirectoryIterator($folder); } catch (Exception $e) { $this->setWarning('Unreadable directory ' . $folder); return $false; } if (!$di->valid()) { $this->setWarning('Unreadable directory ' . $folder); return $false; } if (!empty($position)) { $di->seek($position); if ($di->key() != $position) { $position = null; return $arr; } } $counter = 0; $maxCounter = $registry->get("engine.scan.large.{$threshold_key}_threshold", $threshold_default); while ($di->valid()) { if ($di->isDot()) { $di->next(); continue; } if ($di->isDir() != $forFolders) { $di->next(); continue; } $ds = $folder == '' || $folder == '/' || @substr($folder, -1) == '/' || @substr($folder, -1) == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR; $dir = $folder . $ds . $di->getFilename(); $data = _AKEEBA_IS_WINDOWS ? AEUtilFilesystem::TranslateWinPath($dir) : $dir; if ($data) { $counter++; $arr[] = $data; } if ($counter == $maxCounter) { break; } else { $di->next(); } } // Determine the new value for the position $di->next(); if ($di->valid()) { $position = $di->key() - 1; } else { $position = null; } return $arr; }
private function init() { // Fetch the configuration $config = AEFactory::getConfiguration(); $this->params = (object)array( 'skiptables' => $config->get('core.filters.srp.skiptables', array()) ); }
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(); }
public function onAdd($tpl = null) { $aeconfig = AEFactory::getConfiguration(); // Load the Configuration Wizard Javascript file AkeebaStrapper::addJSfile('media://com_akeeba/js/confwiz.js'); // Add live help AkeebaHelperIncludes::addHelp('confwiz'); $this->setLayout('wizard'); return true; }
private function init() { // Fetch the configuration $config = AEFactory::getConfiguration(); $this->params = (object)array( 'name' => $config->get('core.filters.srp.name', 'name'), 'extraprefixes' => $config->get('core.filters.srp.extraprefixes', array()), 'customtables' => $config->get('core.filters.srp.customtables', array()), 'skiptables' => $config->get('core.filters.srp.skiptables', array()) ); }
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; }
public function processPart($absolute_filename, $upload_as = null) { // Retrieve engine configuration data $config = AEFactory::getConfiguration(); $account = trim($config->get('engine.postproc.azure.account', '')); $key = trim($config->get('engine.postproc.azure.key', '')); $container = $config->get('engine.postproc.azure.container', 0); $directory = $config->get('volatile.postproc.directory', null); if (empty($directory)) { $directory = $config->get('engine.postproc.azure.directory', 0); } // Sanity checks if (empty($account)) { $this->setWarning('You have not set up your Windows Azure account name'); return false; } if (empty($key)) { $this->setWarning('You have not set up your Windows Azure key'); return false; } if (empty($container)) { $this->setWarning('You have not set up your Windows Azure container'); return false; } // Fix the directory name, if required if (!empty($directory)) { $directory = trim($directory); $directory = ltrim(AEUtilFilesystem::TranslateWinPath($directory), '/'); } else { $directory = ''; } // Parse tags $directory = AEUtilFilesystem::replace_archive_name_variables($directory); $config->set('volatile.postproc.directory', $directory); // Calculate relative remote filename $filename = basename($absolute_filename); if (!empty($directory) && $directory != '/') { $filename = $directory . '/' . $filename; } // Store the absolute remote path in the class property $this->remote_path = $filename; // Connect and send try { $blob = new AEUtilAzure(AEUtilAzureStorage::URL_CLOUD_BLOB, $account, $key); $policyNone = new AEUtilAzureNoRetryPolicy(); $blob->setRetryPolicy($policyNone); $blob->putBlob($container, $filename, $absolute_filename); } catch (Exception $e) { $this->setWarning($e->getMessage()); return false; } return true; }
/** * Returns an array with domain keys and domain class names for the current * backup type. The idea is that shifting this array walks through the backup * process. When the array is empty, the backup is done. * @return array */ public static function getDomainChain() { $configuration = AEFactory::getConfiguration(); $script = $configuration->get('akeeba.basic.backup_type', 'full'); $scripting = self::loadScripting(); $domains = $scripting['domains']; $keys = $scripting['scripts'][$script]['chain']; $result = array(); foreach ($keys as $domain_key) { $result[] = array('domain' => $domains[$domain_key]['domain'], 'class' => $domains[$domain_key]['class']); } return $result; }
public function onBrowse($tpl = null) { $media_folder = JURI::base() . '../media/com_akeeba/'; $model = $this->getModel(); $directory = $model->getState('directory', ''); if (empty($directory)) { $config = AEFactory::getConfiguration(); $this->directory = $config->get('akeeba.basic.output_directory', '[DEFAULT_OUTPUT]'); } else { $this->directory = ''; } AkeebaHelperIncludes::addHelp('discover'); return true; }
/** * 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; }
function display() { $registry =& AEFactory::getConfiguration(); // Set the toolbar title JToolBarHelper::title(JText::_('AKEEBA') . ':: <small>' . JText::_('AKEEBA_CONFWIZ') . '</small>', 'akeeba'); JToolBarHelper::back('AKEEBA_CONTROLPANEL', 'index.php?option=' . JRequest::getCmd('option')); // Add references to CSS and JS files AkeebaHelperIncludes::includeMedia(false); // Load the Configuration Wizard Javascript file $document = JFactory::getDocument(); $document->addScript(JURI::base() . '../media/com_akeeba/js/confwiz.js'); // Add live help AkeebaHelperIncludes::addHelp(); $this->setLayout('wizard'); parent::display(); }
public function __construct() { // This is a directory inclusion filter. $this->object = 'dir'; $this->subtype = 'inclusion'; $this->method = 'direct'; $this->filter_name = 'PlatformSiteroot'; // Directory inclusion format: // array(real_directory, add_path) $add_path = null; // A null add_path means that we dump this dir's contents in the archive's root // We take advantage of the filter class magic to inject our custom filters $configuration =& AEFactory::getConfiguration(); $this->filter_data[] = array('[SITEROOT]', $add_path); parent::__construct(); }
/** * Returns the fully qualified path to the storage file * @return unknown_type */ public static function get_storage_filename($tag = null) { static $basepath = null; if (self::getStorageEngine() == 'db') { return empty($tag) ? 'storage' : $tag; } else { if (is_null($basepath)) { $registry =& AEFactory::getConfiguration(); $basepath = $registry->get('akeeba.basic.output_directory') . DIRECTORY_SEPARATOR; } if (empty($tag)) { $tag = 'storage'; } return $basepath . 'akeeba_' . $tag . '.php'; } }
public function __construct() { $this->object = 'dir'; $this->subtype = 'all'; $this->method = 'direct'; $this->filter_name = 'PlatformFolders'; // Get the site's root $configuration = AEFactory::getConfiguration(); if ($configuration->get('akeeba.platform.override_root', 0)) { $root = $configuration->get('akeeba.platform.newroot', '[SITEROOT]'); } else { $root = '[SITEROOT]'; } // We take advantage of the filter class magic to inject our custom filters $this->filter_data[$root] = array('awstats', 'cgi-bin'); parent::__construct(); }
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(); }
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); }
function __construct() { $this->object = 'file'; $this->subtype = 'all'; $this->method = 'regex'; if (empty($this->filter_name)) { $this->filter_name = strtolower(basename(__FILE__, '.php')); } parent::__construct(); // Get the site's root $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('#/Thumbs.db$#', '#^Thumbs.db$#', '#/.DS_Store$#i', '#^.DS_Store$#i'); }
/** * 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(); }
function getLogFiles() { $configuration = AEFactory::getConfiguration(); $outdir = $configuration->get('akeeba.basic.output_directory'); $files = AEUtilScanner::getFiles($outdir); $ret = array(); if (!empty($files) && is_array($files)) { foreach ($files as $filename) { $basename = basename($filename); if (substr($basename, 0, 7) == 'akeeba.' && substr($basename, -4) == '.log' && $basename != 'akeeba.log') { $tag = str_replace('akeeba.', '', str_replace('.log', '', $basename)); if (!empty($tag)) { $ret[] = $tag; } } } } return $ret; }
public function saveEngineConfig() { $data = $this->getState('engineconfig', array()); // 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(); }
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 ( // Output & temp directory of the component self::treatDirectory($configuration->get('akeeba.basic.output_directory')), self::treatDirectory($configuration->get('akeeba.basic.temporary_directory')), // Joomla! temporary directory self::treatDirectory($tmpdir), // Joomla! front- and back-end cache, as reported by Joomla! self::treatDirectory(JPATH_CACHE), self::treatDirectory(JPATH_ADMINISTRATOR.DS.'cache'), self::treatDirectory(JPATH_ROOT.DS.'cache'), // This is not needed except on sites running SVN or beta releases self::treatDirectory(JPATH_ROOT.DS.'installation'), // Joomla! front- and back-end cache, as calculated by us (redundancy, for funky server setups) self::treatDirectory( AEPlatform::get_site_root().DS.'cache' ), self::treatDirectory( AEPlatform::get_site_root().DS.'administrator'.DS.'cache'), 'administrator/components/com_akeeba/backup', // MyBlog's cache self::treatDirectory( AEPlatform::get_site_root().DS.'components'.DS.'libraries'.DS.'cmslib'.DS.'cache' ), // The logs directory 'logs' ); parent::__construct(); }