protected function _prepare() { Factory::getLog()->log(LogLevel::DEBUG, __CLASS__ . " :: Processing parameters"); // Get the DB connection parameters if (is_array($this->_parametersArray)) { $driver = array_key_exists('driver', $this->_parametersArray) ? $this->_parametersArray['driver'] : 'mysql'; $host = array_key_exists('host', $this->_parametersArray) ? $this->_parametersArray['host'] : ''; $port = array_key_exists('port', $this->_parametersArray) ? $this->_parametersArray['port'] : ''; $username = array_key_exists('username', $this->_parametersArray) ? $this->_parametersArray['username'] : ''; $username = array_key_exists('user', $this->_parametersArray) ? $this->_parametersArray['user'] : $username; $password = array_key_exists('password', $this->_parametersArray) ? $this->_parametersArray['password'] : ''; $database = array_key_exists('database', $this->_parametersArray) ? $this->_parametersArray['database'] : ''; $prefix = array_key_exists('prefix', $this->_parametersArray) ? $this->_parametersArray['prefix'] : ''; } if ($driver == 'mysql' && !function_exists('mysql_connect')) { $driver = 'mysqli'; } $options = array('driver' => $driver, 'host' => $host . ($port != '' ? ':' . $port : ''), 'user' => $username, 'password' => $password, 'database' => $database, 'prefix' => is_null($prefix) ? '' : $prefix); $db = Factory::getDatabase($options); $driverType = $db->getDriverType(); if ($driverType == 'mssql') { $driverType = 'sqlsrv'; } $className = '\\Akeeba\\Engine\\Dump\\Reverse\\' . ucfirst($driverType); Factory::getLog()->log(LogLevel::DEBUG, __CLASS__ . " :: Instanciating new reverse engineering database dump engine {$className}"); if (!class_exists($className, true)) { $this->setState('error', 'Akeeba Engine does not have a reverse engineering dump engine for ' . $driverType . ' databases'); } else { $this->_engine = new $className(); $this->_engine->setup($this->_parametersArray); $this->_engine->callStage('_prepare'); $this->setState($this->_engine->getState(), $this->_engine->getError()); $this->propagateFromObject($this->_engine); } }
/** * Execute the JSON API task * * @param array $parameters The parameters to this task * * @return mixed * * @throws \RuntimeException In case of an error */ public function execute(array $parameters = array()) { // Get the passed configuration values $defConfig = array('profile' => -1, 'engineconfig' => array()); $defConfig = array_merge($defConfig, $parameters); $profile = (int) $defConfig['profile']; $data = $defConfig['engineconfig']; if (empty($profile)) { throw new \RuntimeException('Invalid profile ID', 404); } // 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 = Factory::getFilesystemTools()->translateStockDirs($folder, true, true); $check = Factory::getFilesystemTools()->translateStockDirs('[SITEROOT]', true, true); if ($check == $folder) { $data['akeeba.basic.output_directory'] = '[DEFAULT_OUTPUT]'; } } // Merge it $config = Factory::getConfiguration(); $protectedKeys = $config->getProtectedKeys(); $config->resetProtectedKeys(); $config->mergeArray($data, false, false); $config->setProtectedKeys($protectedKeys); // Save configuration return Platform::getInstance()->save_configuration($profile); }
public function onBrowse($tpl = null) { AkeebaStrapper::addJSfile('media://com_akeeba/js/fsfilter.js'); $model = $this->getModel(); $task = $model->getState('browse_task', 'normal'); // Add custom submenus $toolbar = F0FToolbar::getAnInstance($this->input->get('option', 'com_foobar', 'cmd'), $this->config); $toolbar->appendLink(JText::_('FILTERS_LABEL_NORMALVIEW'), JUri::base() . 'index.php?option=com_akeeba&view=fsfilter&task=normal', $task == 'normal'); $toolbar->appendLink(JText::_('FILTERS_LABEL_TABULARVIEW'), JUri::base() . 'index.php?option=com_akeeba&view=fsfilter&task=tabular', $task == 'tabular'); $media_folder = JUri::base() . '../media/com_akeeba/'; // Get the root URI for media files $this->mediadir = AkeebaHelperEscape::escapeJS($media_folder . 'theme/'); // Get a JSON representation of the available roots $filters = Factory::getFilters(); $root_info = $filters->getInclusions('dir'); $roots = array(); $options = array(); if (!empty($root_info)) { // Loop all dir definitions foreach ($root_info as $dir_definition) { if (is_null($dir_definition[1])) { // Site root definition has a null element 1. It is always pushed on top of the stack. array_unshift($roots, $dir_definition[0]); } else { $roots[] = $dir_definition[0]; } $options[] = JHTML::_('select.option', $dir_definition[0], $dir_definition[0]); } } $site_root = $roots[0]; $attribs = 'onchange="akeeba.Fsfilters.activeRootChanged();"'; $this->root_select = JHTML::_('select.genericlist', $options, 'root', $attribs, 'value', 'text', $site_root, 'active_root'); $this->roots = $roots; switch ($task) { case 'normal': default: $this->setLayout('default'); // Get a JSON representation of the directory data $model = $this->getModel(); $json = json_encode($model->make_listing($site_root, array(), '')); $this->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->json = $json; break; } // Get profile ID $profileid = Platform::getInstance()->get_active_profile(); $this->profileid = $profileid; // Get profile name $pmodel = F0FModel::getAnInstance('Profiles', 'AkeebaModel'); $pmodel->setId($profileid); $profile_data = $pmodel->getItem(); $this->profilename = $this->escape($profile_data->description); return true; }
protected function _prepare() { Factory::getLog()->log(LogLevel::DEBUG, __CLASS__ . " :: Processing parameters"); $options = null; // Get the DB connection parameters if (is_array($this->_parametersArray)) { $driver = array_key_exists('driver', $this->_parametersArray) ? $this->_parametersArray['driver'] : 'mysql'; $host = array_key_exists('host', $this->_parametersArray) ? $this->_parametersArray['host'] : ''; $port = array_key_exists('port', $this->_parametersArray) ? $this->_parametersArray['port'] : ''; $username = array_key_exists('username', $this->_parametersArray) ? $this->_parametersArray['username'] : ''; $username = array_key_exists('user', $this->_parametersArray) ? $this->_parametersArray['user'] : $username; $password = array_key_exists('password', $this->_parametersArray) ? $this->_parametersArray['password'] : ''; $database = array_key_exists('database', $this->_parametersArray) ? $this->_parametersArray['database'] : ''; $prefix = array_key_exists('prefix', $this->_parametersArray) ? $this->_parametersArray['prefix'] : ''; $options = array('driver' => $driver, 'host' => $host . ($port != '' ? ':' . $port : ''), 'user' => $username, 'password' => $password, 'database' => $database, 'prefix' => is_null($prefix) ? '' : $prefix); } $db = Factory::getDatabase($options); $driverType = $db->getDriverType(); $className = '\\Akeeba\\Engine\\Dump\\Native\\' . ucfirst($driverType); // Check if we have a native dump driver if (!class_exists($className, true)) { Factory::getLog()->log(LogLevel::DEBUG, __CLASS__ . " :: Native database dump engine {$className} not found; trying Reverse Engineering instead"); // Native driver nor found, I will try falling back to reverse engineering $className = '\\Akeeba\\Engine\\Dump\\Reverse\\' . ucfirst($driverType); } if (!class_exists($className, true)) { $this->setState('error', 'Akeeba Engine does not have a native dump engine for ' . $driverType . ' databases'); } else { Factory::getLog()->log(LogLevel::DEBUG, __CLASS__ . " :: Instanciating new native database dump engine {$className}"); $this->_engine = new $className(); $this->_engine->setup($this->_parametersArray); $this->_engine->callStage('_prepare'); $this->setState($this->_engine->getState(), $this->_engine->getError()); } }
/** * Get the information for the latest backup * * @return array|null An array of backup record information or null if there is no usable backup for site transfer */ public function getLatestBackupInformation() { // Initialise $ret = null; $db = Factory::getDatabase(); /** @var AkeebaModelStatistics $model */ $model = F0FModel::getTmpInstance('Statistics', 'AkeebaModel'); $model->savestate(0); $model->setState('limitstart', 0); $model->setState('limit', 1); $backups = $model->getStatisticsListWithMeta(false, null, $db->qn('id') . ' DESC'); // No valid backups? No joy. if (empty($backups)) { return $ret; } // Get the latest backup $backup = array_shift($backups); // If it's not stored on the server (e.g. remote backup), no joy. if ($backup['meta'] != 'ok') { return $ret; } // If it's not a full site backup, no joy. if ($backup['type'] != 'full') { return $ret; } return $backup; }
public function onAdd($tpl = null) { $media_folder = JUri::base() . '../media/com_akeeba/'; // Get a JSON representation of GUI data $json = AkeebaHelperEscape::escapeJS(Factory::getEngineParamsProvider()->getJsonGuiDefinition(), '"\\'); $this->json = $json; // Get profile ID $profileid = Platform::getInstance()->get_active_profile(); $this->profileid = $profileid; // Get profile name $profileName = F0FModel::getTmpInstance('Profiles', 'AkeebaModel')->setId($profileid)->getItem()->description; $this->profilename = $profileName; // Get the root URI for media files $this->mediadir = AkeebaHelperEscape::escapeJS($media_folder . 'theme/'); // Are the settings secured? if (Platform::getInstance()->get_platform_configuration_option('useencryption', -1) == 0) { $this->securesettings = -1; } elseif (!Factory::getSecureSettings()->supportsEncryption()) { $this->securesettings = 0; } else { JLoader::import('joomla.filesystem.file'); $filename = JPATH_COMPONENT_ADMINISTRATOR . '/engine/serverkey.php'; if (JFile::exists($filename)) { $this->securesettings = 1; } else { $this->securesettings = 0; } } // Add live help AkeebaHelperIncludes::addHelp('config'); }
public function __construct() { $this->object = 'dir'; $this->subtype = 'inclusion'; $this->method = 'direct'; $this->filter_name = 'Libraries'; // 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 = Platform::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 = Factory::getFilesystemTools()->TranslateWinPath($jlibdir); $defaultLibraries = Factory::getFilesystemTools()->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(); }
protected function onAdd($tpl = null) { /** @var AkeebaModelCpanels $model */ $model = $this->getModel(); $aeconfig = Factory::getConfiguration(); // Load the helper classes $this->loadHelper('utils'); $this->loadHelper('status'); $statusHelper = AkeebaHelperStatus::getInstance(); // Load the model if (!class_exists('AkeebaModelStatistics')) { JLoader::import('models.statistics', JPATH_COMPONENT_ADMINISTRATOR); } $statmodel = new AkeebaModelStatistics(); $this->profileid = $model->getProfileID(); // Active profile ID $this->profilelist = $model->getProfilesList(); // List of available profiles $this->statuscell = $statusHelper->getStatusCell(); // Backup status $this->detailscell = $statusHelper->getQuirksCell(); // Details (warnings) $this->statscell = $statmodel->getLatestBackupDetails(); $this->fixedpermissions = $model->fixMediaPermissions(); // Fix media/com_akeeba permissions $this->needsdlid = $model->needsDownloadID(); $this->needscoredlidwarning = $model->mustWarnAboutDownloadIDInCore(); $this->extension_id = $model->getState('extension_id', 0, 'int'); // Should I ask for permission to display desktop notifications? JLoader::import('joomla.application.component.helper'); $this->desktop_notifications = \Akeeba\Engine\Util\Comconfig::getValue('desktop_notifications', '0') ? 1 : 0; $this->statsIframe = F0FModel::getTmpInstance('Stats', 'AkeebaModel')->collectStatistics(true); return $this->onDisplay($tpl); }
/** * Execute the JSON API task * * @param array $parameters The parameters to this task * * @return mixed * * @throws \RuntimeException In case of an error */ public function execute(array $parameters = array()) { // Get the passed configuration values $defConfig = array('backup_id' => 0); $defConfig = array_merge($defConfig, $parameters); $backup_id = (int) $defConfig['backup_id']; // Get the basic statistics $record = Platform::getInstance()->get_statistics($backup_id); // Get a list of filenames $backup_stats = Platform::getInstance()->get_statistics($backup_id); // Backup record doesn't exist if (empty($backup_stats)) { throw new \RuntimeException('Invalid backup record identifier', 404); } $filenames = Factory::getStatistics()->get_all_filenames($record); if (empty($filenames)) { // Archives are not stored on the server or no files produced $record['filenames'] = array(); } else { $filedata = array(); $i = 0; // Get file sizes per part foreach ($filenames as $file) { $i++; $size = @filesize($file); $size = is_numeric($size) ? $size : 0; $filedata[] = array('part' => $i, 'name' => basename($file), 'size' => $size); } // Add the file info to $record['filenames'] $record['filenames'] = $filedata; } return $record; }
/** * Execute the JSON API task * * @param array $parameters The parameters to this task * * @return mixed * * @throws \RuntimeException In case of an error */ public function execute(array $parameters = array()) { $filter = \JFilterInput::getInstance(); // Get the passed configuration values $defConfig = array('profile' => null, 'tag' => AKEEBA_BACKUP_ORIGIN, 'backupid' => null); $defConfig = array_merge($defConfig, $parameters); $profile = $filter->clean($defConfig['profile'], 'int'); $tag = $filter->clean($defConfig['tag'], 'cmd'); $backupid = $filter->clean($defConfig['backupid'], 'cmd'); // Set the active profile $session = $this->container->session; // Try to set the profile from the setup parameters if (!empty($profile)) { $profile = max(1, $profile); // Make sure $profile is a positive integer >= 1 $session->set('profile', $profile); define('AKEEBA_PROFILE', $profile); } /** @var \Akeeba\Backup\Site\Model\Backup $model */ $model = $this->container->factory->model('Backup')->tmpInstance(); $model->setState('tag', $tag); $model->setState('backupid', $backupid); $array = $model->stepBackup(false); if ($array['Error'] != '') { throw new \RuntimeException('A backup error has occurred: ' . $array['Error'], 500); } // BackupID contains the numeric backup record ID. backupid contains the backup id (usually in the form id123) $statistics = Factory::getStatistics(); $array['BackupID'] = $statistics->getId(); // Remote clients expect a boolean, not an integer. $array['HasRun'] = $array['HasRun'] === 0; return $array; }
protected function is_excluded_by_api($test, $root) { static $from_datetime; $config = Factory::getConfiguration(); if (is_null($from_datetime)) { $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 onBeforeBrowse() { $result = parent::onBeforeBrowse(); if ($result) { $params = JComponentHelper::getParams('com_akeeba'); $model = $this->getThisModel(); $view = $this->getThisView(); /** @var AkeebaModelCpanels $model */ $view->setModel($model); $aeconfig = Factory::getConfiguration(); // Invalidate stale backups Factory::resetState(array('global' => true, 'log' => false, 'maxrun' => $params->get('failure_timeout', 180))); // Just in case the reset() loaded a stale configuration... Platform::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(); } return $result; }
protected function scanFolder($folder, &$position, $forFolders = true, $threshold_key = 'dir', $threshold_default = 50) { $registry = Factory::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 ? Factory::getFilesystemTools()->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; }
/** * Performs one more step of dumping database data * * @return void */ protected function stepDatabaseDump() { // We do not create any dump file, we will simply include the whole database file inside the backup Factory::getLog()->log(LogLevel::INFO, "SQLite database detected, no SQL dump files will be created."); $this->setState('postrun'); $this->setStep(''); $this->setSubstep(''); }
public function onAdd($tpl = null) { $aeconfig = Factory::getConfiguration(); // Load the Configuration Wizard Javascript file AkeebaStrapper::addJSfile('media://com_akeeba/js/confwiz.js'); $this->setLayout('wizard'); return true; }
function __construct() { $this->object = 'dbobject'; $this->subtype = 'content'; $this->method = 'api'; if (Factory::getKettenrad()->getTag() == 'restorepoint') { $this->enabled = false; } }
/** * Execute the JSON API task * * @param array $parameters The parameters to this task * * @return mixed * * @throws \RuntimeException In case of an error */ public function execute(array $parameters = array()) { // Get the passed configuration values $defConfig = array('tag' => 'remote'); $defConfig = array_merge($defConfig, $parameters); $tag = (int) $defConfig['tag']; $filename = Factory::getLog()->getLogFilename($tag); return file_get_contents($filename); }
public function __construct() { $this->object = 'file'; $this->subtype = 'all'; $this->method = 'regex'; $this->filter_name = 'Regexfilesext'; $extensions = Factory::getConfiguration()->get('akeeba.basic.file_extensions', 'php|phps|php3|inc'); $extensions = str_replace('.', '\\.', $extensions); $this->filter_data['[SITEROOT]'] = array("!#\\.(" . $extensions . ")\$#"); parent::__construct(); }
public function __construct() { $this->object = 'file'; $this->subtype = 'all'; $this->method = 'direct'; $this->filter_name = 'Excludefiles'; // We take advantage of the filter class magic to inject our custom filters $allFiles = explode('|', Factory::getConfiguration()->get('akeeba.basic.exclude_files')); $this->filter_data['[SITEROOT]'] = array_unique($allFiles); parent::__construct(); }
public function onStep($tpl = null) { $this->setLayout('step'); $kettenrad = Factory::getKettenrad(); $array = $kettenrad->getStatusArray(); $model = $this->getModel(); $key = $model->getState('key', ''); $this->array = $array; $this->key = $key; return true; }
public function echoRawLog() { $tag = $this->getState('tag', ''); 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(Factory::getLog()->getLogFilename($tag)); // 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"; }
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 = Factory::getConfiguration(); // Invalidate stale backups Factory::resetState(array('global' => true, 'log' => false, 'maxrun' => $params->get('failure_timeout', 180))); // Just in case the reset() loaded a stale configuration... Platform::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 JRegistry($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 __construct($config = array()) { parent::__construct($config); // Load the Akeeba Engine autoloader define('AKEEBAENGINE', 1); require_once JPATH_ADMINISTRATOR . '/components/com_admintools/engine/Autoloader.php'; // Load the platform \Akeeba\Engine\Platform::addPlatform('filescan', JPATH_ADMINISTRATOR . '/components/com_admintools/platform/Filescan'); // Load the engine configuration \Akeeba\Engine\Platform::getInstance()->load_configuration(1); $this->aeconfig = \Akeeba\Engine\Factory::getConfiguration(); }
function __construct() { $this->object = 'dir'; $this->subtype = 'content'; $this->method = 'api'; $this->filter_name = 'SRPSkipFiles'; if (Factory::getKettenrad()->getTag() != 'restorepoint') { $this->enabled = false; } else { $this->filter_data = array(); $this->init(); } }
function __construct() { $this->object = 'dir'; $this->subtype = 'content'; $this->method = 'direct'; if (empty($this->filter_name)) { $this->filter_name = strtolower(basename(__FILE__, '.php')); } if (Factory::getKettenrad()->getTag() == 'restorepoint') { $this->enabled = false; } parent::__construct(); }
/** * Output the raw text log file to the standard output * * @return void */ public function echoRawLog() { $tag = $this->getState('tag', ''); 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, we will be unable to provide efficient support.\r\n"; echo "\r\n"; echo "--- START OF RAW LOG --\r\n"; // The at sign (silence operator) is necessary to prevent PHP showing a warning if the file doesn't exist or // isn't readable for any reason. @readfile(Factory::getLog()->getLogFilename($tag)); echo "--- END OF RAW LOG ---\r\n"; }
private static function loadConfig() { $db = Factory::getDatabase(); $sql = $db->getQuery(true)->select($db->qn('params'))->from($db->qn('#__extensions'))->where($db->qn('element') . " = " . $db->q('com_akeeba')); $db->setQuery($sql); $config_ini = $db->loadResult(); // OK, Joomla! 1.6 stores values JSON-encoded so, what do I do? Right! $config_ini = json_decode($config_ini, true); if (is_null($config_ini) || empty($config_ini)) { $config_ini = array(); } return $config_ini; }
function __construct() { if (!defined('_JEXEC')) { $this->enabled = false; return; } $this->object = 'file'; $this->subtype = 'all'; $this->method = 'api'; $this->filter_name = 'SRPFiles'; if (Factory::getKettenrad()->getTag() != 'restorepoint') { $this->enabled = false; } else { $this->init(); } }
/** * Execute the JSON API task * * @param array $parameters The parameters to this task * * @return mixed * * @throws \RuntimeException In case of an error */ public function execute(array $parameters = array()) { // Get the passed configuration values $defConfig = array('profile' => 0); $defConfig = array_merge($defConfig, $parameters); $profile = (int) $defConfig['profile']; if ($profile <= 0) { $profile = 1; } // Set the active profile $session = $this->container->session; $session->set('profile', $profile); // Load the configuration Platform::getInstance()->load_configuration($profile); return Factory::getEngineParamsProvider()->getJsonGuiDefinition(); }
public function __construct() { $this->object = 'dir'; $this->subtype = 'all'; $this->method = 'direct'; $this->filter_name = 'Excludefolders'; // Get the site's root $configuration = Factory::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(); }