本文整理汇总了PHP中AEPlatform::get_active_profile方法的典型用法代码示例。如果您正苦于以下问题:PHP AEPlatform::get_active_profile方法的具体用法?PHP AEPlatform::get_active_profile怎么用?PHP AEPlatform::get_active_profile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AEPlatform
的用法示例。
在下文中一共展示了AEPlatform::get_active_profile方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _default
/**
* The default layout, shows a list of profiles
*
*/
function _default()
{
// Get reference to profiles model
$model =& $this->getModel('profiles');
// Load list of profiles
$profiles = $model->getProfilesList();
$this->assign('profiles', $profiles);
// Get profile ID
$profileid = AEPlatform::get_active_profile();
$this->assign('profileid', $profileid);
// Get profile name
$model->setId($profileid);
$profile_data = $model->getProfile();
$this->assign('profilename', $profile_data->description);
// Add toolbar buttons
JToolBarHelper::back('AKEEBA_CONTROLPANEL', 'index.php?option='.JRequest::getCmd('option'));
JToolBarHelper::spacer();
JToolBarHelper::addNew();
if(version_compare(JVERSION, '1.6.0', 'ge')) {
JToolBarHelper::custom('copy', 'copy.png', 'copy_f2.png', 'JGLOBAL_BATCH_COPY', false);
} else {
JToolBarHelper::custom('copy', 'copy.png', 'copy_f2.png', 'Copy', false);
}
JToolBarHelper::spacer();
JToolBarHelper::deleteList();
JToolBarHelper::spacer();
}
示例2: display
function display()
{
// Toolbar buttons
JToolBarHelper::title(JText::_('AKEEBA').':: <small>'.JText::_('CONFIGURATION').'</small>','akeeba');
JToolBarHelper::preferences('com_akeeba', '500', '660');
JToolBarHelper::spacer();
JToolBarHelper::apply();
JToolBarHelper::save();
JToolBarHelper::cancel();
JToolBarHelper::spacer();
// Add references to scripts and CSS
AkeebaHelperIncludes::includeMedia(false);
$media_folder = JURI::base().'../media/com_akeeba/';
// Get a JSON representation of GUI data
$json = AkeebaHelperEscape::escapeJS(AEUtilInihelper::getJsonGuiDefinition(),'"\\');
$this->assignRef( 'json', $json );
// Get profile ID
$profileid = AEPlatform::get_active_profile();
$this->assign('profileid', $profileid);
// Get profile name
akimport('models.profiles',true);
$model = new AkeebaModelProfiles();
$model->setId($profileid);
$profile_data = $model->getProfile();
$this->assign('profilename', $profile_data->description);
// Get the root URI for media files
$this->assign( 'mediadir', AkeebaHelperEscape::escapeJS($media_folder.'theme/') );
// Are the settings secured?
if( AEPlatform::get_platform_configuration_option('useencryption', -1) == 0 ) {
$this->assign('securesettings', -1);
} elseif( !AEUtilSecuresettings::supportsEncryption() ) {
$this->assign('securesettings', 0);
} else {
jimport('joomla.filesystem.file');
$filename = JPATH_COMPONENT_ADMINISTRATOR.'/akeeba/serverkey.php';
if(JFile::exists($filename)) {
$this->assign('securesettings', 1);
} else {
$this->assign('securesettings', 0);
}
}
// Add live help
AkeebaHelperIncludes::addHelp();
parent::display();
}
示例3: download
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: is_excluded_by_api
protected function is_excluded_by_api($test, $root)
{
static $filter_switch;
static $last_backup;
if(is_null($filter_switch))
{
$config =& AEFactory::getConfiguration();
$filter_switch = AEUtilScripting::getScriptingParameter('filter.incremental',0);
$filter_switch = ($filter_switch == 1);
$last_backup = $config->get('volatile.filter.last_backup', null);
if(is_null($last_backup) && $filter_switch)
{
// Get a list of backups on this profile
$backups = AEPlatform::get_statistics_list(0, 0, AEPlatform::get_active_profile() );
// Find this backup's ID
$model =& AEFactory::getStatistics();
$id = $model->getId();
if(is_null($id)) $id = -1;
// Initialise
jimport('joomla.utilities.date');
$last_backup = time();
$now = $last_backup;
// Find the last time a successful backup with this profile was made
if(count($backups)) foreach($backups as $backup)
{
// Skip the current backup
if($backup['id'] == $id) continue;
// Skip non-complete backups
if($backup['status'] != 'complete') continue;
$jdate = new JDate($backup['backupstart']);
$backuptime = $jdate->toUnix();
$last_backup = $backuptime;
break;
}
if($last_backup == $now) {
// No suitable backup found; disable this filter
$config->set('volatile.scripting.incfile.filter.incremental',0);
$filter_switch = false;
} else {
// Cache the last backup timestamp
$config->set('volatile.filter.last_backup',$last_backup);
}
}
}
if(!$filter_switch) return false;
// Get the filesystem path for $root
$config =& AEFactory::getConfiguration();
$fsroot = $config->get('volatile.filesystem.current_root','');
$ds = ($fsroot == '') || ($fsroot == '/') ? '' : DS;
$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 last backup timestamp and exclude if it's older than the last backup
if($timestamp <= $last_backup) {
//AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Excluding $filename due to incremental backup restrictions");
return true;
}
// No match? Just include the file!
return false;
}
示例5: partsize
/**
* Creates a dummy file of a given size. Remember to give the filesize
* query parameter in bytes!
*/
public function partsize()
{
$timer = AEFactory::getTimer();
$blocks = JRequest::getInt('blocks', 1);
$model = JModel::getInstance('Confwiz','AkeebaModel');
$result = $model->createTempFile($blocks);
if($result) {
// Save the setting
if($blocks > 200) $blocks = 16383; // Over 25Mb = 2Gb minus 128Kb limit (safe setting for PHP not running on 64-bit Linux)
$profile_id = AEPlatform::get_active_profile();
$config = AEFactory::getConfiguration();
$config->set('engine.archiver.common.part_size', $blocks * 128 * 1024);
AEPlatform::save_configuration($profile_id);
}
// Enforce the min exec time
$timer->enforce_min_exec_time(false);
return $result;
}
示例6: _run
/**
* Implements the _run() abstract method
*/
protected function _run()
{
if( $this->getState() == 'postrun' )
{
AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__." :: Already finished");
$this->setStep('');
$this->setSubstep('');
return;
} else {
$this->setState('running');
}
// Load the version defines
AEPlatform::load_version_defines();
$registry =& AEFactory::getConfiguration();
// Write log file's header
AEUtilLogger::WriteLog(_AE_LOG_INFO, "--------------------------------------------------------------------------------");
AEUtilLogger::WriteLog(_AE_LOG_INFO, "Akeeba Backup ".AKEEBA_VERSION.' ('.AKEEBA_DATE.')');
AEUtilLogger::WriteLog(_AE_LOG_INFO, "Got backup?");
AEUtilLogger::WriteLog(_AE_LOG_INFO, "--------------------------------------------------------------------------------");
// PHP configuration variables are tried to be logged only for debug and info log levels
if ($registry->get('akeeba.basic.log_level') >= _AE_LOG_INFO ) {
AEUtilLogger::WriteLog(_AE_LOG_INFO, "--- System Information ---" );
if( function_exists('phpversion'))
AEUtilLogger::WriteLog(_AE_LOG_INFO, "PHP Version :" . phpversion() );
if(function_exists('php_uname'))
AEUtilLogger::WriteLog(_AE_LOG_INFO, "OS Version :" . php_uname('s') );
$db =& AEFactory::getDatabase();
AEUtilLogger::WriteLog(_AE_LOG_INFO, "DB Version :" . $db->getVersion() );
if (isset($_SERVER['SERVER_SOFTWARE'])) {
$server = $_SERVER['SERVER_SOFTWARE'];
} else if (($sf = getenv('SERVER_SOFTWARE'))) {
$server = $sf;
} else {
$server = 'n/a';
}
AEUtilLogger::WriteLog(_AE_LOG_INFO, "Web Server :" . $server );
if(function_exists('php_sapi_name'))
AEUtilLogger::WriteLog(_AE_LOG_INFO, "PHP Interface :" . php_sapi_name() );
AEPlatform::getPlatformVersion( $platform, $version );
AEUtilLogger::WriteLog(_AE_LOG_INFO, "$platform version :" . $version );
if(isset($_SERVER['HTTP_USER_AGENT']))
AEUtilLogger::WriteLog(_AE_LOG_INFO, "User agent :" . phpversion() <= "4.2.1" ? getenv( "HTTP_USER_AGENT" ) : $_SERVER['HTTP_USER_AGENT'] );
AEUtilLogger::WriteLog(_AE_LOG_INFO, "Safe mode :" . ini_get("safe_mode") );
AEUtilLogger::WriteLog(_AE_LOG_INFO, "Display errors :" . ini_get("display_errors") );
AEUtilLogger::WriteLog(_AE_LOG_INFO, "Error reporting :" . self::error2string() );
AEUtilLogger::WriteLog(_AE_LOG_INFO, "Error display :" . self::errordisplay() );
AEUtilLogger::WriteLog(_AE_LOG_INFO, "Disabled functions :" . ini_get("disable_functions") );
AEUtilLogger::WriteLog(_AE_LOG_INFO, "open_basedir restr.:" . ini_get('open_basedir') );
AEUtilLogger::WriteLog(_AE_LOG_INFO, "Max. exec. time :" . ini_get("max_execution_time") );
AEUtilLogger::WriteLog(_AE_LOG_INFO, "Memory limit :" . ini_get("memory_limit") );
if(function_exists("memory_get_usage"))
AEUtilLogger::WriteLog(_AE_LOG_INFO, "Current mem. usage :" . memory_get_usage() );
if(function_exists("gzcompress")) {
AEUtilLogger::WriteLog(_AE_LOG_INFO, "GZIP Compression : available (good)" );
} else {
AEUtilLogger::WriteLog(_AE_LOG_INFO, "GZIP Compression : n/a (no compression)" );
}
AEPlatform::log_platform_special_directories();
AEUtilLogger::WriteLog(_AE_LOG_INFO, "Output directory :" . $registry->get('akeeba.basic.output_directory') );
AEUtilLogger::WriteLog(_AE_LOG_INFO, "Temporary directory:" . $registry->get('akeeba.basic.temporary_directory') );
AEUtilLogger::WriteLog(_AE_LOG_INFO, "--------------------------------------------------------------------------------");
}
// Quirks reporting
$quirks = AEUtilQuirks::get_quirks(true);
if( !empty($quirks) )
{
AEUtilLogger::WriteLog(_AE_LOG_INFO, "Akeeba Backup has detected the following potential problems:" );
foreach($quirks as $q)
{
AEUtilLogger::WriteLog(_AE_LOG_INFO, '- '.$q['code'].' '.$q['description'].' ('.$q['severity'].')' );
}
AEUtilLogger::WriteLog(_AE_LOG_INFO, "You probably do not have to worry about them, but you should be aware of them." );
AEUtilLogger::WriteLog(_AE_LOG_INFO, "--------------------------------------------------------------------------------");
}
// Report profile ID
$profile_id = AEPlatform::get_active_profile();
AEUtilLogger::WriteLog(_AE_LOG_INFO, "Loaded profile #$profile_id");
// Get archive name
AEUtilFilesystem::get_archive_name($relativeArchiveName, $absoluteArchiveName);
// ==== Stats initialisation ===
$origin = AEPlatform::get_backup_origin(); // Get backup origin
$profile_id = AEPlatform::get_active_profile(); // Get active profile
$registry =& AEFactory::getConfiguration();
$backupType = $registry->get('akeeba.basic.backup_type');
AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Backup type is now set to '" . $backupType . "'");
// Substitute "variables" in the archive name
$description = AEUtilFilesystem::replace_archive_name_variables($this->description);
$comment = AEUtilFilesystem::replace_archive_name_variables($this->comment);
//.........这里部分代码省略.........
示例7: mail_administrators
/**
* Sends an email to the administrators
* @return bool
*/
private function mail_administrators()
{
$this->setStep('Processing emails to administrators');
$this->setSubstep('');
// Skip email for back-end backups
if(AEPlatform::get_backup_origin() == 'backend' ) return true;
$must_email = AEPlatform::get_platform_configuration_option('frontend_email_on_finish', 0) != 0;
if(!$must_email) return true;
AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Preparing to send e-mail to administrators");
$email = AEPlatform::get_platform_configuration_option('frontend_email_address', '');
$email = trim($email);
if( !empty($email) )
{
$emails = array($email);
}
else
{
$emails = AEPlatform::get_administrator_emails();
}
if(!empty($emails))
{
// Fetch user's preferences
$subject = trim(AEPlatform::get_platform_configuration_option('frontend_email_subject',''));
$body = trim(AEPlatform::get_platform_configuration_option('frontend_email_body',''));
// Get the statistics
$statistics =& AEFactory::getStatistics();
$stat = $statistics->getRecord();
$parts = AEUtilStatistics::get_all_filenames($stat, false);
$profile_number = AEPlatform::get_active_profile();
$profile_name = AEPlatform::get_profile_name($profile_number);
$parts = AEUtilStatistics::get_all_filenames($stat, false);
$stat = (object)$stat;
$num_parts = $stat->multipart;
if($num_parts == 0) $num_parts = 1; // Non-split archives have a part count of 0
$parts_list = '';
if(!empty($parts)) foreach($parts as $file) {
$parts_list .= "\t".basename($file)."\n";
}
// Do we need a default subject?
if(empty($subject)) {
// Get the default subject
$subject = AEPlatform::translate('EMAIL_SUBJECT_OK');
} else {
// Post-process the subject
$subject = AEUtilFilesystem::replace_archive_name_variables($subject);
}
// Do we need a default body?
if(empty($body)) {
$body = AEPlatform::translate('EMAIL_BODY_OK');
$info_source = AEPlatform::translate('EMAIL_BODY_INFO');
$body .= "\n\n" . sprintf($info_source, $profile_number, $num_parts) . "\n\n";
$body .= $parts_list;
} else {
// Post-process the body
$body = AEUtilFilesystem::replace_archive_name_variables($body);
$body = str_replace('[PROFILENUMBER]', $profile_number, $body);
$body = str_replace('[PROFILENAME]', $profile_name, $body);
$body = str_replace('[PARTCOUNT]', $num_parts, $body);
$body = str_replace('[FILELIST]', $parts_list, $body);
}
// Sometimes $body contains literal \n instead of newlines
$body = str_replace('\\n',"\n", $body);
foreach($emails as $email)
{
AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Sending email to $email");
AEPlatform::send_email($email, $subject, $body);
}
}
return true;
}