本文整理汇总了PHP中AEFactory::getConfiguration方法的典型用法代码示例。如果您正苦于以下问题:PHP AEFactory::getConfiguration方法的具体用法?PHP AEFactory::getConfiguration怎么用?PHP AEFactory::getConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AEFactory
的用法示例。
在下文中一共展示了AEFactory::getConfiguration方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* 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'));
}
示例2: foreach
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;
}
示例3: apply
/**
* 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'));
}
示例4: is_excluded_by_api
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;
}
示例5: __construct
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();
}
示例6: display
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();
}
示例7: processPart
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;
}
}
示例8: init
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();
}
}
示例9: foreach
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;
}
示例10: scanFolder
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;
}
示例11: init
private function init()
{
// Fetch the configuration
$config = AEFactory::getConfiguration();
$this->params = (object)array(
'skiptables' => $config->get('core.filters.srp.skiptables', array())
);
}
示例12: onAdd
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;
}
示例13: init
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())
);
}
示例14: onBeforeBrowse
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;
}
示例15: processPart
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;
}