• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP AEUtilFilesystem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中AEUtilFilesystem的典型用法代码示例。如果您正苦于以下问题:PHP AEUtilFilesystem类的具体用法?PHP AEUtilFilesystem怎么用?PHP AEUtilFilesystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了AEUtilFilesystem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: import

 public function import($file)
 {
     $directory = $this->getState('directory', '');
     $directory = AEUtilFilesystem::translateStockDirs($directory);
     // Find out how many parts there are
     $multipart = 0;
     $base = substr($file, 0, -4);
     $ext = substr($file, -3);
     $found = true;
     $total_size = @filesize($directory . '/' . $file);
     while ($found) {
         $multipart++;
         $newExtension = substr($ext, 0, 1) . sprintf('%02u', $multipart);
         $newFile = $directory . '/' . $base . '.' . $newExtension;
         $found = file_exists($newFile);
         if ($found) {
             $total_size += @filesize($newFile);
         }
     }
     $filetime = @filemtime($directory . '/' . $file);
     if (empty($filetime)) {
         $filetime = time();
     }
     // Create a new backup record
     $record = array('description' => JText::_('DISCOVER_LABEL_IMPORTEDDESCRIPTION'), 'comment' => '', 'backupstart' => date('Y-m-d H:i:s', $filetime), 'backupend' => date('Y-m-d H:i:s', $filetime + 1), 'status' => 'complete', 'origin' => 'backend', 'type' => 'full', 'profile_id' => 1, 'archivename' => $file, 'absolute_path' => $directory . '/' . $file, 'multipart' => $multipart, 'tag' => 'backend', 'filesexist' => 1, 'remote_filename' => '', 'total_size' => $total_size);
     $id = null;
     $id = AEPlatform::getInstance()->set_or_update_statistics($id, $record, $this);
 }
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:28,代码来源:discovers.php


示例2: __construct

 public function __construct()
 {
     $this->object = 'dir';
     $this->subtype = 'inclusion';
     $this->method = 'direct';
     // 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 = AEPlatform::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 = AEUtilFilesystem::TranslateWinPath($jlibdir);
         $defaultLibraries = AEUtilFilesystem::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();
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:34,代码来源:libraries.php


示例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'));
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:34,代码来源:config.php


示例4: unregisterAndDeleteTempFile

	/**
	 * Unregister and delete a temporary file
	 * @param $fileName The filename to unregister and delte
	 * @param $removePrefix The prefix to remove
	 */
	static function unregisterAndDeleteTempFile( $fileName, $removePrefix = false )
	{
		$configuration =& AEFactory::getConfiguration();

		if($removePrefix)
		{
			$fileName = str_replace( AEUtilFilesystem::TranslateWinPath($configuration->get('akeeba.basic.temporary_directory')) , '', $fileName);
			if( (substr($fileName, 0, 1) == '/') || (substr($fileName, 0, 1) == '\\') )
			{
				$fileName = substr($fileName, 1 );
			}
			if( (substr($fileName, -1) == '/') || (substr($fileName, -1) == '\\') )
			{
				$fileName = substr($fileName, 0, -1 );
			}
		}

		// We don't unregister the tempfile here, because on some systems (Windows &
		// servers on FastCGI) the files wouldn't get deleted.

		$file = $configuration->get('akeeba.basic.temporary_directory').DS.$fileName;
		AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "-- Removing temporary file $fileName" );
		$platform = strtoupper(PHP_OS);
		if( (substr($platform,0,6) == 'CYGWIN') || (substr($platform,0,3) == 'WIN') )
		{
			// On Windows we have to chwon() the file first to make it owned by Nobody
			AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "-- Windows hack: chowning $fileName" );
			@chown($file, 600);
		}
		return @self::nullifyAndDelete($file);
	}
开发者ID:rkern21,项目名称:videoeditor,代码行数:36,代码来源:tempfiles.php


示例5: 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;
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:59,代码来源:large.php


示例6: get_site_path

	private function get_site_path()
	{
		// FIX 1.1.0 $mosConfig_absolute_path may contain trailing slashes or backslashes incompatible with exclusion filters
		// FIX 1.2.2 Some hosts yield an empty string on realpath(JPATH_SITE)
		// FIX 2.2 On Windows, realpath might fail
		// FIX 2.4: Make an assumption (wild guess...)
		if( (JPATH_BASE == '/administrator') || (JPATH_ROOT == '') )
		{
			$this->setWarning("Your site's root is an empty string. I am trying a workaround.");
			$jpath_site_real = '/';
		}
		else
		{
			// Fix 2.4: Make sure that $jpath_site_real contains something even if realpath fails
			$jpath_site_real = @realpath(trim(JPATH_SITE));
			$jpath_site_real = ($jpath_site_real === false) ? trim(JPATH_SITE) : $jpath_site_real;
			$jpath_site_real = AEUtilFilesystem::TranslateWinPath($jpath_site_real);
		}

		if( $jpath_site_real == '' )
		{
			// The JPATH_SITE is resolved to an empty string; attempt a workaround

			// Windows hosts
			if(DIRECTORY_SEPARATOR == '\\')
			{
				if( (trim(JPATH_SITE) != '') && (trim(JPATH_SITE) != '\\') && (trim(JPATH_SITE) != '/'))
				{
					$this->setWarning("The site's root couldn't be normalized on a Windows host. Attempting workaround (filters might not work)");
					$jpath_site_real = JPATH_SITE; // Forcibly use the configured JPATH_SITE
				}
				else
				{
					$this->setWarning("The normalized path to your site's root seems to be an empty string; I will attempt a workaround (Windows host)");
					$jpath_site_real = '/'; // Start scanning from filesystem root (workaround mode)
				}
			}
			// *NIX hosts
			else
			{
				$this->setWarning("The normalized path to your site's root seems to be an empty string; I will attempt a workaround (*NIX host)");
				# Fix 2.1 Since JPATH_SITE is an empty string, shouldn't I begin scanning from the FS root, for crying out loud? What was I thinking putting JPATH_SITE there?
				$jpath_site_real = '/'; // Start scanning from filesystem root (workaround mode)
			}
		}

		// Fix 2.4.b1 : Add the trailing slash
		if( (substr($jpath_site_real,-1) != '/') && !empty($jpath_site_real) )
		{
			$jpath_site_real .= '/';
		}

		return $jpath_site_real;
	}
开发者ID:rkern21,项目名称:videoeditor,代码行数:54,代码来源:siteroot.php


示例7: 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;
 }
开发者ID:sillysachin,项目名称:teamtogether,代码行数:53,代码来源:azure.php


示例8: treatDirectory

 private static function treatDirectory($directory)
 {
     $site_root = AEUtilFilesystem::TrimTrailingSlash(AEUtilFilesystem::TranslateWinPath(JPATH_ROOT));
     $directory = AEUtilFilesystem::TrimTrailingSlash(AEUtilFilesystem::TranslateWinPath($directory));
     // Trim site root from beginning of directory
     if (substr($directory, 0, strlen($site_root)) == $site_root) {
         $directory = substr($directory, strlen($site_root));
         if (substr($directory, 0, 1) == '/') {
             $directory = substr($directory, 1);
         }
     }
     return $directory;
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:13,代码来源:skipdirs.php


示例9: unregisterAndDeleteTempFile

 /**
  * Unregister and delete a temporary file
  * @param $fileName The filename to unregister and delte
  * @param $removePrefix The prefix to remove
  */
 static function unregisterAndDeleteTempFile($fileName, $removePrefix = false)
 {
     $configuration = AEFactory::getConfiguration();
     if ($removePrefix) {
         $fileName = str_replace(AEUtilFilesystem::TranslateWinPath($configuration->get('akeeba.basic.output_directory')), '', $fileName);
         if (substr($fileName, 0, 1) == '/' || substr($fileName, 0, 1) == '\\') {
             $fileName = substr($fileName, 1);
         }
         if (substr($fileName, -1) == '/' || substr($fileName, -1) == '\\') {
             $fileName = substr($fileName, 0, -1);
         }
     }
     // Make sure this file is registered
     $configuration = AEFactory::getConfiguration();
     $tempFiles = $configuration->get('volatile.tempfiles', false);
     if ($tempFiles === false) {
         $tempFiles = array();
     } else {
         $tempFiles = @unserialize($tempFiles);
     }
     $found = false;
     if (!empty($tempFiles)) {
         $found = in_array($fileName, $tempFiles);
     }
     if (!$found) {
         return false;
     }
     $file = $configuration->get('akeeba.basic.output_directory') . '/' . $fileName;
     AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "-- Removing temporary file {$fileName}");
     $platform = strtoupper(PHP_OS);
     if (substr($platform, 0, 6) == 'CYGWIN' || substr($platform, 0, 3) == 'WIN') {
         // On Windows we have to chwon() the file first to make it owned by Nobody
         AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "-- Windows hack: chowning {$fileName}");
         @chown($file, 600);
     }
     $result = @self::nullifyAndDelete($file);
     // Make sure the file is removed before unregistering it
     if (!@file_exists($file)) {
         $aPos = array_search($fileName, $tempFiles);
         if ($aPos !== false) {
             unset($tempFiles[$aPos]);
             $configuration->set('volatile.tempfiles', serialize($tempFiles));
         }
     }
     return $result;
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:51,代码来源:tempfiles.php


示例10: saveEngineConfig

 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();
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:19,代码来源:configs.php


示例11: treatDirectory

 private static function treatDirectory($directory)
 {
     // Get the site's root
     $configuration = AEFactory::getConfiguration();
     if ($configuration->get('akeeba.platform.override_root', 0)) {
         $root = $configuration->get('akeeba.platform.newroot', '[SITEROOT]');
         if (stristr($root, '[')) {
             $root = AEUtilFilesystem::translateStockDirs($root);
         }
         $site_root = AEUtilFilesystem::TrimTrailingSlash(AEUtilFilesystem::TranslateWinPath($root));
     } else {
         $site_root = AEUtilFilesystem::TrimTrailingSlash(AEUtilFilesystem::TranslateWinPath(JPATH_ROOT));
     }
     $directory = AEUtilFilesystem::TrimTrailingSlash(AEUtilFilesystem::TranslateWinPath($directory));
     // Trim site root from beginning of directory
     if (substr($directory, 0, strlen($site_root)) == $site_root) {
         $directory = substr($directory, strlen($site_root));
         if (substr($directory, 0, 1) == '/') {
             $directory = substr($directory, 1);
         }
     }
     return $directory;
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:23,代码来源:skipfiles.php


示例12: display

 function display()
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.path');
     // Get the folder to browse
     $folder = JRequest::getString('folder', '');
     $processfolder = JRequest::getInt('processfolder', 0);
     if (empty($folder)) {
         $folder = '';
         $folder_raw = '';
         $isFolderThere = false;
         $isInRoot = false;
         $isOpenbasedirRestricted = false;
     } else {
         $stock_dirs = AEPlatform::getInstance()->get_stock_directories();
         arsort($stock_dirs);
         if ($processfolder == 1) {
             foreach ($stock_dirs as $find => $replace) {
                 $folder = str_replace($find, $replace, $folder);
             }
         }
         // Normalise name, but only if realpath() really, REALLY works...
         $old_folder = $folder;
         $folder = @realpath($folder);
         if ($folder === false) {
             $folder = $old_folder;
         }
         if (AEUtilFilesystem::folderExists($folder)) {
             $isFolderThere = true;
         } else {
             $isFolderThere = false;
         }
         JRequest::setVar('folder', $folder);
         // Check if it's a subdirectory of the site's root
         $isInRoot = strpos($folder, JPATH_SITE) === 0;
         // Check open_basedir restrictions
         $isOpenbasedirRestricted = AEUtilQuirks::checkOpenBasedirs($folder);
         // -- Get the meta form of the directory name, if applicable
         $folder_raw = $folder;
         foreach ($stock_dirs as $replace => $find) {
             $folder_raw = str_replace($find, $replace, $folder_raw);
         }
     }
     // Writable check and contents listing if it's in site root and not restricted
     if ($isFolderThere && !$isOpenbasedirRestricted) {
         // Get writability status
         $isWritable = is_writable($folder);
         // Get contained folders
         $subfolders = JFolder::folders($folder);
     } else {
         if ($isFolderThere && !$isOpenbasedirRestricted) {
             $isWritable = is_writable($folder);
         } else {
             $isWritable = false;
         }
         $subfolders = array();
     }
     // Get parent directory
     $pathparts = explode(DIRECTORY_SEPARATOR, $folder);
     if (is_array($pathparts)) {
         $path = '';
         foreach ($pathparts as $part) {
             $path .= empty($path) ? $part : DIRECTORY_SEPARATOR . $part;
             if (empty($part)) {
                 if (DIRECTORY_SEPARATOR != '\\') {
                     $path = DIRECTORY_SEPARATOR;
                 }
                 $part = DIRECTORY_SEPARATOR;
             }
             $crumb['label'] = $part;
             $crumb['folder'] = $path;
             $breadcrumbs[] = $crumb;
         }
         $junk = array_pop($pathparts);
         $parent = implode(DIRECTORY_SEPARATOR, $pathparts);
     } else {
         // Can't identify parent dir, use ourselves.
         $parent = $folder;
         $breadcrumbs = array();
     }
     $this->assign('folder', $folder);
     $this->assign('folder_raw', $folder_raw);
     $this->assign('parent', $parent);
     $this->assign('exists', $isFolderThere);
     $this->assign('inRoot', $isInRoot);
     $this->assign('openbasedirRestricted', $isOpenbasedirRestricted);
     $this->assign('writable', $isWritable);
     $this->assign('subfolders', $subfolders);
     $this->assign('breadcrumbs', $breadcrumbs);
     parent::display();
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:91,代码来源:view.html.php


示例13: 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::getInstance()->get_backup_origin() == 'backend') {
         return true;
     }
     $must_email = AEPlatform::getInstance()->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::getInstance()->get_platform_configuration_option('frontend_email_address', '');
     $email = trim($email);
     if (!empty($email)) {
         AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Using pre-defined list of emails");
         $emails = explode(',', $email);
     } else {
         AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Fetching list of Super Administrator emails");
         $emails = AEPlatform::getInstance()->get_administrator_emails();
     }
     if (!empty($emails)) {
         AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Creating email subject and body");
         // Fetch user's preferences
         $subject = trim(AEPlatform::getInstance()->get_platform_configuration_option('frontend_email_subject', ''));
         $body = trim(AEPlatform::getInstance()->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::getInstance()->get_active_profile();
         $profile_name = AEPlatform::getInstance()->get_profile_name($profile_number);
         $parts = AEUtilStatistics::get_all_filenames($stat, false);
         $stat = (object) $stat;
         $num_parts = $stat->multipart;
         // Non-split archives have a part count of 0
         if ($num_parts == 0) {
             $num_parts = 1;
         }
         $parts_list = '';
         if (!empty($parts)) {
             foreach ($parts as $file) {
                 $parts_list .= "\t" . basename($file) . "\n";
             }
         }
         // Get the remote storage status
         $remote_status = '';
         $post_proc_engine = AEFactory::getConfiguration()->get('akeeba.advanced.proc_engine');
         if (!empty($post_proc_engine) && $post_proc_engine != 'none') {
             if (empty($stat->remote_filename)) {
                 $remote_status = AEPlatform::getInstance()->translate('COM_AKEEBA_EMAIL_POSTPROCESSING_FAILED');
             } else {
                 $remote_status = AEPlatform::getInstance()->translate('COM_AKEEBA_EMAIL_POSTPROCESSING_SUCCESS');
             }
         }
         // Do we need a default subject?
         if (empty($subject)) {
             // Get the default subject
             $subject = AEPlatform::getInstance()->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::getInstance()->translate('EMAIL_BODY_OK');
             $info_source = AEPlatform::getInstance()->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);
             $body = str_replace('[REMOTESTATUS]', $remote_status, $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::getInstance()->send_email($email, $subject, $body);
         }
     } else {
         AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "No email recipients found! Skipping email.");
     }
     return true;
 }
开发者ID:01J,项目名称:topm,代码行数:95,代码来源:finalization.php


示例14: logName

 /**
  * Calculates the absolute path to the log file. Instead of using the path coming from
  * Akeeba Backup config, we will always use Joomla Tmp dir
  *
  * @param   string  $tag    The backup run's tag
  *
  * @return  string    The absolute path to the log file
  */
 public static function logName($tag = null)
 {
     if (empty($tag)) {
         $fileName = 'akeeba.log';
     } else {
         $fileName = "akeeba.{$tag}.log";
     }
     // Get log's file name
     return AEUtilFilesystem::TranslateWinPath(JPATH_ROOT . '/tmp' . DIRECTORY_SEPARATOR . $fileName);
 }
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:18,代码来源:logger.php


示例15: q203

 /**
  * Q203 - MED  - Default output directory in use
  *
  * @return bool
  */
 private static function q203()
 {
     $stock_dirs = AEPlatform::getInstance()->get_stock_directories();
     $registry =& AEFactory::getConfiguration();
     $outdir = $registry->get('akeeba.basic.output_directory');
     foreach ($stock_dirs as $macro => $replacement) {
         $outdir = str_replace($macro, $replacement, $outdir);
     }
     $default = $stock_dirs['[DEFAULT_OUTPUT]'];
     $outdir = AEUtilFilesystem::TranslateWinPath($outdir);
     $default = AEUtilFilesystem::TranslateWinPath($default);
     return $outdir == $default;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:18,代码来源:quirks.php


示例16: substr

 /**
  * Returns a listing of contained directories and files, as well as their
  * exclusion status
  * @param string $root The root directory
  * @param string $node The subdirectory to scan
  * @return array
  */
 private function &get_listing($root, $node)
 {
     // Initialize the absolute directory root
     $directory = substr($root, 0);
     // Replace stock directory tags, like [SITEROOT]
     $stock_dirs = AEPlatform::getInstance()->get_stock_directories();
     if (!empty($stock_dirs)) {
         foreach ($stock_dirs as $key => $replacement) {
             $directory = str_replace($key, $replacement, $directory);
         }
     }
     $directory = AEUtilFilesystem::TranslateWinPath($directory);
     // Clean and add the node
     $node = AEUtilFilesystem::TranslateWinPath($node);
     if ($node == '/') {
         $node = '';
     }
     // Just a dir. sep. is treated as no dir at all
     // Trim leading and trailing slashes
     $node = trim($node, '/');
     // Add node to directory
     if (!empty($node)) {
         $directory .= '/' . $node;
     }
     // Add any required trailing slash to the node to be used below
     if (!empty($node)) {
         $node .= '/';
     }
     // Get a filters instance
     $filters = AEFactory::getFilters();
     // Detect PHP 5.2.5or earlier, with broken json_decode implementation
     $phpversion = PHP_VERSION;
     $vparts = explode('.', $phpversion);
     if ($vparts[0] == 5 && $vparts[1] == 2 && $vparts[2] <= 5 || $vparts[0] == 5 && $vparts[1] == 1) {
         define('AKEEBA_SAFE_JSON', false);
         require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/jsonlib.php';
     } else {
         $test = '-test-';
         $tj = json_encode($test);
         $test = json_decode($test);
         if ($test == '-test-') {
             define('AKEEBA_SAFE_JSON', true);
         } else {
             define('AKEEBA_SAFE_JSON', false);
             require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/jsonlib.php';
         }
     }
     // Get a listing of folders and process it
     $folders = AEUtilScanner::getFolders($directory);
     asort($folders);
     $folders_out = array();
     if (!empty($folders)) {
         foreach ($folders as $folder) {
             $folder = AEUtilFilesystem::TranslateWinPath($folder);
             // Filter out files whose names result to an empty JSON representation
             if (AKEEBA_SAFE_JSON) {
                 $json_folder = json_encode($folder);
                 $folder = json_decode($json_folder);
             } else {
                 $jsonobj = new Akeeba_Services_JSON(0);
                 $json_folder = $jsonobj->encode($folder);
                 $folder = $jsonobj->decode($json_folder);
             }
             if (empty($folder)) {
                 continue;
             }
             $test = $node . $folder;
             $status = array();
             // Check dir/all filter (exclude)
             $result = $filters->isFilteredExtended($test, $root, 'dir', 'all', $byFilter);
             $status['directories'] = !$result ? 0 : ($byFilter == 'directories' ? 1 : 2);
             // Check dir/content filter (skip_files)
             $result = $filters->isFilteredExtended($test, $root, 'dir', 'content', $byFilter);
             $status['skipfiles'] = !$result ? 0 : ($byFilter == 'skipfiles' ? 1 : 2);
             // Check dir/children filter (skip_dirs)
             $result = $filters->isFilteredExtended($test, $root, 'dir', 'children', $byFilter);
             $status['skipdirs'] = !$result ? 0 : ($byFilter == 'skipdirs' ? 1 : 2);
             // Add to output array
             $folders_out[$folder] = $status;
         }
     }
     unset($folders);
     $folders = $folders_out;
     // Get a listing of files and process it
     $files = AEUtilScanner::getFiles($directory);
     asort($files);
     $files_out = array();
     if (!empty($files)) {
         foreach ($files as $file) {
             // Filter out files whose names result to an empty JSON representation
             if (AKEEBA_SAFE_JSON) {
                 $json_file = json_encode($file);
                 $file = json_decode($json_file);
//.........这里部分代码省略.........
开发者ID:01J,项目名称:topm,代码行数:101,代码来源:fsfilters.php


示例17: _getEngineSettings

 private function _getEngineSettings()
 {
     // Retrieve engine configuration data
     $config = AEFactory::getConfiguration();
     $email = trim($config->get('engine.postproc.sugarsync.email', ''));
     $password = trim($config->get('engine.postproc.sugarsync.password', ''));
     $directory = $config->get('volatile.postproc.directory', null);
     if (empty($directory)) {
         $directory = $config->get('engine.postproc.sugarsync.directory', 0);
     }
     // Sanity checks
     if (empty($email)) {
         $this->setWarning('You have not set up your SugarSync email address');
         return false;
     }
     if (empty($password)) {
         $this->setWarning('You have not set up your SugarSync password');
         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);
     return array('email' => $email, 'password' => $password, 'directory' => $directory);
 }
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:31,代码来源:sugarsync.php


示例18: updateMagicParameters

 /**
  * Update the cached live site's URL for the front-end backup feature (altbackup.php)
  * and the detected Joomla! libraries path
  */
 public function updateMagicParameters()
 {
     $component =& JComponentHelper::getComponent('com_akeeba');
     if (is_object($component->params) && $component->params instanceof JRegistry) {
         $params = $component->params;
     } else {
         $params = new JParameter($component->params);
     }
     $params->set('siteurl', str_replace('/administrator', '', JURI::base()));
     if (defined('JPATH_LIBRARIES')) {
         $params->set('jlibrariesdir', AEUtilFilesystem::TranslateWinPath(JPATH_LIBRARIES));
     } elseif (defined("JPATH_PLATFORM")) {
         $params->set('jlibrariesdir', AEUtilFilesystem::TranslateWinPath(JPATH_PLATFORM));
     }
     if (AKEEBA_JVERSION == '16') {
         // Joomla! 1.6
         $joomla16 = true;
         $params->set('jversion', '1.6');
     } else {
         // Joomla! 1.5
         $joomla16 = false;
         $params->set('jversion', '1.5');
     }
     $db =& JFactory::getDBO();
     $data = $params->toString();
     if ($joomla16) {
         // Joomla! 1.6
         $sql = 'UPDATE `#__extensions` SET `params` = ' . $db->Quote($data) . ' WHERE ' . "`element` = 'com_akeeba' AND `type` = 'component'";
     } else {
         // Joomla! 1.5
         $sql = 'UPDATE `#__components` SET `params` = ' . $db->Quote($data) . ' WHERE ' . "`option` = 'com_akeeba' AND `parent` = 0 AND `menuid` = 0";
     }
     $db->setQuery($sql);
     $db->query();
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:39,代码来源:cpanel.php


示例19: _addRemovePaths

 /**
  * Removes the $p_remove_dir from $p_filename, while prepending it with $p_add_dir.
  * Largely based on code from the pclZip library.
  *
  * @param   string  $p_filename    The absolute file name to treat
  * @param   string  $p_remove_dir  The path to remove
  * @param   string  $p_add_dir     The path to prefix the treated file name with
  *
  * @return  string  The treated file name
  */
 private final function _addRemovePaths($p_filename, $p_remove_dir, $p_add_dir)
 {
     $p_filename = AEUtilFilesystem::TranslateWinPath($p_filename);
     $p_remove_dir = $p_remove_dir == '' ? '' : AEUtilFilesystem::TranslateWinPath($p_remove_dir);
     //should fix corrupt backups, fix by nicholas
     if (!($p_remove_dir == "")) {
         if (substr($p_remove_dir, -1) != '/') {
             $p_remove_dir .= "/";
         }
         if (substr($p_filename, 0, 2) == "./" || substr($p_remove_dir, 0, 2) == "./") {
             if (substr($p_filename, 0, 2) == "./" && substr($p_remove_dir, 0, 2) != "./") {
                 $p_remove_dir = "./" . $p_remove_dir;
             }
             if (substr($p_filename, 0, 2) != "./" && substr($p_remove_dir, 0, 2) == "./") {
                 $p_remove_dir = substr($p_remove_dir, 2);
             }
         }
         $v_compare = $this->_PathInclusion($p_remove_dir, $p_filename);
         if ($v_compare > 0) {
             if ($v_compare == 2) {
                 $v_stored_filename = "";
             } else {
                 $v_stored_filename = substr($p_filename, function_exists('mb_strlen') ? mb_strlen($p_remove_dir, '8bit') : strlen($p_remove_dir));
             }
         }
     } else {
         $v_stored_filename = $p_filename;
     }
     if (!($p_add_dir == "")) {
         if (substr($p_add_dir, -1) == "/") {
             $v_stored_filename = $p_add_dir . $v_stored_filename;
         } else {
             $v_stored_filename = $p_add_dir . "/" . $v_stored_filename;
         }
     }
     return $v_stored_filename;
 }
开发者ID:Nileshsaini,项目名称:teamhead,代码行数:47,代码来源:archiver.php


示例20: _getSettings

 protected function _getSettings()
 {
     // Retrieve engine configuration data
     $config = AEFactory::getConfiguration();
     $token = trim($config->get('engine.postproc.dropbox.token', ''));
     $token_secret = trim($config->get('engine.postproc.dropbox.token_secret', ''));
     $token_uid = trim($config->get('engine.postproc.dropbox.uid', ''));
     $this->chunked = $config->get('engine.postproc.dropbox.chunk_upoad', true);
     $this->chunk_size = $config->get('engine.postproc.dropbox.chunk_upoad_size', 4);
     $this->directory = $config->get('volatile.postproc.directory', null);
     if (empty($this->directory)) {
         $this->directory = $config->get('engine.postproc.dropbox.directory', '');
     }
     // Sanity checks
     if (empty($token) || empty($token_secret) || empty($token_uid)) {
         $this->setError('You have not linked Akeeba Backup with your DropBox account');
         return false;
     }
     // Fix the directory name, if required
     if (!empty($this->directory)) {
         $this->directory = trim($this->directory);
         $this->directory = ltrim(AEUtilFilesystem::TranslateWinPath($this->directory), '/');
     } else {
         $this->directory = '';
     }
     // Parse tags
     $this->directory = AEUtilFilesystem::replace_archive_name_variables($this->directory);
     $config-> 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP AEUtilLogger类代码示例发布时间:2022-05-23
下一篇:
PHP AEPlatform类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap