当前位置: 首页>>代码示例>>PHP>>正文


PHP Engine\Platform类代码示例

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


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

示例1: __construct

 public function __construct($message = null, $code = 500, Exception $previous = null)
 {
     if (empty($message)) {
         $message = Platform::getInstance()->translate('COM_AKEEBA_CONFIG_ERR_DECRYPTION');
     }
     parent::__construct($message, $code, $previous);
 }
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:7,代码来源:DecryptionException.php

示例2: execute

 /**
  * 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' => 0, 'name' => '', 'connection' => array(), 'test' => true);
     $defConfig = array_merge($defConfig, $parameters);
     $profile = $filter->clean($defConfig['profile'], 'int');
     $name = $filter->clean($defConfig['name'], 'string');
     $connection = $filter->clean($defConfig['connection'], 'array');
     $test = $filter->clean($defConfig['test'], 'bool');
     // We need a valid profile ID
     if ($profile <= 0) {
         $profile = 1;
     }
     if (empty($connection) || !isset($connection['host']) || !isset($connection['driver']) || !isset($connection['database']) || !isset($connection['user']) || !isset($connection['password'])) {
         throw new \RuntimeException('Connection information missing or incomplete', 500);
     }
     // Set the active profile
     $session = $this->container->session;
     $session->set('profile', $profile);
     // Load the configuration
     Platform::getInstance()->load_configuration($profile);
     /** @var MultipleDatabases $model */
     $model = $this->container->factory->model('MultipleDatabases')->tmpInstance();
     if ($test) {
         $result = $model->test($connection);
         if (!$result['status']) {
             throw new \RuntimeException('Connection test failed: ' . $result['message'], 500);
         }
     }
     return $model->setFilter($name, $connection);
 }
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:41,代码来源:SetIncludedDB.php

示例3: onBrowse

 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;
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:60,代码来源:view.html.php

示例4: _checkPermissions

 /**
  * Check that the user has sufficient permissions, or die in error
  *
  */
 private function _checkPermissions()
 {
     // Is frontend backup enabled?
     $febEnabled = Platform::getInstance()->get_platform_configuration_option('failure_frontend_enable', 0) != 0;
     // Is the Secret Key strong enough?
     $validKey = Platform::getInstance()->get_platform_configuration_option('frontend_secret_word', '');
     if (!\Akeeba\Engine\Util\Complexify::isStrongEnough($validKey, false)) {
         $febEnabled = false;
     }
     if (!$febEnabled) {
         @ob_end_clean();
         echo '403 ' . JText::_('ERROR_NOT_ENABLED');
         flush();
         JFactory::getApplication()->close();
     }
     // Is the key good?
     $key = $this->input->get('key', '', 'none', 2);
     $validKeyTrim = trim($validKey);
     if ($key != $validKey || empty($validKeyTrim)) {
         @ob_end_clean();
         echo '403 ' . JText::_('ERROR_INVALID_KEY');
         flush();
         JFactory::getApplication()->close();
     }
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:29,代码来源:check.php

示例5: __construct

 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();
 }
开发者ID:esorone,项目名称:efcpw,代码行数:35,代码来源:Libraries.php

示例6: execute

 /**
  * 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);
 }
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:37,代码来源:SaveConfiguration.php

示例7: 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 = 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;
 }
开发者ID:kidaa30,项目名称:lojinha,代码行数:30,代码来源:cpanel.php

示例8: onAdd

 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');
 }
开发者ID:ForAEdesWeb,项目名称:AEW2,代码行数:31,代码来源:view.html.php

示例9: execute

 /**
  * 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' => 0, 'root' => '[SITEROOT]');
     $defConfig = array_merge($defConfig, $parameters);
     $profile = $filter->clean($defConfig['profile'], 'int');
     $root = $filter->clean($defConfig['root'], 'string');
     // We need a valid profile ID
     if ($profile <= 0) {
         $profile = 1;
     }
     // We need a root
     if (empty($root)) {
         throw new \RuntimeException('Unknown database root', 500);
     }
     // Set the active profile
     $session = $this->container->session;
     $session->set('profile', $profile);
     // Load the configuration
     Platform::getInstance()->load_configuration($profile);
     /** @var RegExFileFilters $model */
     $model = $this->container->factory->model('RegExFileFilters')->tmpInstance();
     return $model->get_regex_filters($root);
 }
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:34,代码来源:GetRegexFSFilters.php

示例10: execute

 /**
  * 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' => 0, 'uuid' => '');
     $defConfig = array_merge($defConfig, $parameters);
     $profile = $filter->clean($defConfig['profile'], 'int');
     $uuid = $filter->clean($defConfig['uuid'], 'string');
     // We need a valid profile ID
     if ($profile <= 0) {
         $profile = 1;
     }
     // We need a uuid
     if (empty($uuid)) {
         throw new \RuntimeException('UUID is required', 500);
     }
     // Set the active profile
     $session = $this->container->session;
     $session->set('profile', $profile);
     // Load the configuration
     Platform::getInstance()->load_configuration($profile);
     /** @var IncludeFolders $model */
     $model = $this->container->factory->model('IncludeFolders')->tmpInstance();
     return $model->remove($uuid);
 }
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:34,代码来源:RemoveIncludedDirectory.php

示例11: onBeforeMain

 /**
  * Default task; shows the initial page where the user selects a profile and enters description and comment
  */
 protected function onBeforeMain()
 {
     // Did the user ask to switch the active profile?
     $newProfile = $this->input->get('profileid', -10, 'int');
     if (is_numeric($newProfile) && $newProfile > 0) {
         $this->csrfProtection();
         $this->container->session->set('profile', $newProfile, 'akeeba');
         /**
          * DO NOT REMOVE!
          *
          * The Model will only try to load the configuration after nuking the factory. This causes Profile 1 to be
          * loaded first. Then it figures out it needs to load a different profile and it does – but the protected keys
          * are NOT replaced, meaning that certain configuration parameters are not replaced. Most notably, the chain.
          * This causes backups to behave weirdly. So, DON'T REMOVE THIS UNLESS WE REFACTOR THE MODEL.
          */
         Platform::getInstance()->load_configuration($newProfile);
     }
     // Deactivate the menus
     \JFactory::getApplication()->input->set('hidemainmenu', 1);
     /** @var \Akeeba\Backup\Admin\Model\Backup $model */
     $model = $this->getModel();
     // Push data to the model
     $model->setState('profile', $this->input->get('profileid', -10, 'int'));
     $model->setState('description', $this->input->get('description', '', 'string', 2));
     $model->setState('comment', $this->input->get('comment', '', 'html', 2));
     $model->setState('ajax', $this->input->get('ajax', '', 'cmd'));
     $model->setState('autostart', $this->input->get('autostart', 0, 'int'));
     $model->setState('jpskey', $this->input->get('jpskey', '', 'raw', 2));
     $model->setState('angiekey', $this->input->get('angiekey', '', 'raw', 2));
     $model->setState('returnurl', $this->input->get('returnurl', '', 'raw', 2));
     $model->setState('backupid', $this->input->get('backupid', null, 'cmd'));
 }
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:35,代码来源:Backup.php

示例12: download

 /**
  * Download the log file as a text file
  *
  * @return  void
  */
 public function download()
 {
     Platform::getInstance()->load_configuration(Platform::getInstance()->get_active_profile());
     $tag = $this->input->get('tag', null, 'cmd');
     if (empty($tag)) {
         $tag = null;
     }
     $asAttachment = $this->input->getBool('attachment', true);
     @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');
     if ($asAttachment) {
         header('Content-Disposition: attachment; filename="Akeeba Backup Debug Log.txt"');
     }
     /** @var LogModel $model */
     $model = $this->getModel();
     $model->setState('tag', $tag);
     $model->echoRawLog();
     flush();
     $this->container->platform->closeApplication();
 }
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:31,代码来源:Log.php

示例13: __construct

 /**
  * Creates the push messaging object
  */
 public function __construct()
 {
     $pushPreference = Platform::getInstance()->get_platform_configuration_option('push_preference', '0');
     $apiKey = Platform::getInstance()->get_platform_configuration_option('push_apikey', '');
     // No API key? No push messages are enabled, so no point continuing really...
     if (empty($apiKey)) {
         $pushPreference = 0;
     }
     // We use a switch in case we add support for more push APIs in the future. The push_preference platform
     // option will tell us which service to use. In that case we'll have to refactor this class, but the public
     // API will remain the same.
     switch ($pushPreference) {
         default:
         case 0:
             $this->enabled = false;
             break;
         case 1:
             try {
                 $this->connector = new Connector($apiKey);
                 $this->connector->getDevices();
             } catch (\Exception $e) {
                 Factory::getLog()->warning('Push messages cannot be sent. Error received when trying to establish PushBullet connection:' . $e->getMessage());
                 $this->enabled = false;
             }
             break;
     }
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:30,代码来源:PushMessages.php

示例14: execute

 /**
  * 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;
 }
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:42,代码来源:GetBackupInfo.php

示例15: execute

 /**
  * 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' => 0, 'root' => '[SITEROOT]', 'subdirectory' => '');
     $defConfig = array_merge($defConfig, $parameters);
     $profile = $filter->clean($defConfig['profile'], 'int');
     $root = $filter->clean($defConfig['root'], 'string');
     $subdirectory = $filter->clean($defConfig['subdirectory'], 'path');
     $crumbs = array();
     // We need a valid profile ID
     if ($profile <= 0) {
         $profile = 1;
     }
     // We need a root
     if (empty($root)) {
         throw new \RuntimeException('Unknown filesystem root', 500);
     }
     // Get the subdirectory and explode it to its parts
     if (!empty($subdirectory)) {
         $subdirectory = trim($subdirectory, '/');
     }
     if (!empty($subdirectory)) {
         $crumbs = explode('/', $subdirectory);
     }
     // Set the active profile
     $session = $this->container->session;
     $session->set('profile', $profile);
     // Load the configuration
     Platform::getInstance()->load_configuration($profile);
     /** @var FileFilters $model */
     $model = $this->container->factory->model('FileFilters')->tmpInstance();
     return $model->make_listing($root, $crumbs);
 }
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:43,代码来源:GetFSEntities.php


注:本文中的Akeeba\Engine\Platform类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。