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


PHP PhpFox::getService方法代码示例

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


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

示例1: process

 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     //DROPBOX
     //Request Unlink Dropbox Acount
     if ($this->request()->get('unlink')) {
         Phpfox::getService('backuprestore.dropboxfront')->unlink_account();
         $this->isAccess = null;
         $page = $_SERVER['HTTP_REFERER'];
         $sec = "0";
         header("Refresh: {$sec}; url={$page}");
     }
     $canCall = false;
     if (!$this->request()->get('db_authorize')) {
         $this->dropbox = PhpFox::getService('backuprestore.dropboxfront');
         $canCall = true;
     }
     $dbauthorize = array();
     if ($canCall) {
         $dbauthorize['Url'] = $this->dropbox->get_authorize_url();
         if ($this->dropbox->is_authorized()) {
             //User Dropbox info
             $dbaccount_info = $this->dropbox->get_account_info();
             $dbaccount_details = array('account_owner' => $dbaccount_info->display_name, 'used_space' => round(($dbaccount_info->quota_info->quota - ($dbaccount_info->quota_info->normal + $dbaccount_info->quota_info->shared)) / 1073741824, 1), 'quota' => round($dbaccount_info->quota_info->quota / 1073741824, 1));
             $dbaccount_details['used_percent'] = round($dbaccount_details['used_space'] / $dbaccount_details['quota'] * 100, 0);
             $this->authorized['dropbox'] = 1;
         } else {
             if ($this->request()->get('continue')) {
                 if (!$this->dropbox->is_authorized()) {
                     $dbauthorize['error_not_authorized'] = 'yes';
                 }
                 $dbauthorize['submitbutton'] = 'Authorize';
             }
         }
     }
     //Request Authorize Dropbox Account
     if ($this->request()->get('db_authorize')) {
         $dbauthorize['submitbutton'] = 'Continue';
     }
     $this->template()->assign(array('dbauthorize' => $dbauthorize, 'DBADetails' => !empty($dbaccount_details) ? $dbaccount_details : null, 'authorized' => $this->authorized));
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:43,代码来源:dropbox.class.php

示例2: _import

 private function _import()
 {
     Phpfox::getLib('phpfox.process')->import(Phpfox::getLib('xml.parser')->parse(PHPFOX_DIR_XML . 'version' . PHPFOX_XML_SUFFIX));
     PhpFox::getService('core.country.process')->importForInstall(Phpfox::getLib('xml.parser')->parse(PHPFOX_DIR_XML . 'country' . PHPFOX_XML_SUFFIX));
     // $this->_pass();
     /*
     $this->_oTpl->assign(array(
     	'sMessage' => 'Imports complete...',
     	'sNext' => $this->_step('language')
     ));
     */
     return ['message' => 'Importing language package', 'next' => 'language'];
 }
开发者ID:nima7r,项目名称:phpfox-dist,代码行数:13,代码来源:installer.class.php

示例3: __construct

 public function __construct()
 {
     require_once 'module/backuprestore/Dropbox/API.php';
     require_once 'module/backuprestore/Dropbox/OAuth/Consumer/ConsumerAbstract.class.php';
     require_once 'module/backuprestore/Dropbox/OAuth/Consumer/Curl.class.php';
     $this->btdbsett = PhpFox::getService('backuprestore.backuprestore');
     if (!extension_loaded('curl')) {
         Phpfox_Error::set(Phpfox::getPhrase('testsearch.curl_not_loaded_message'));
     }
     $this->oauth = new Backuprestore_Dropbox_OAuth_Consumer_Curl($this->app_key, $this->app_secret);
     if ($dbarray = $this->btdbsett->getBTDBSettingByName('dropbox_tokens')) {
         $this->tokens = unserialize(array_shift($dbarray));
     }
     //Convert array to stdClass for the new API
     if ($this->tokens && is_array($this->tokens['access'])) {
         $accessToken = new stdClass();
         $accessToken->oauth_token = $this->tokens['access']["token"];
         $accessToken->oauth_token_secret = $this->tokens['access']["token_secret"];
         $this->tokens['access'] = $accessToken;
         $this->tokens['state'] = 'access';
     }
     try {
         $this->init();
         //If we are in the access state and are still not authorized then unlink and re init
         if ($this->tokens['state'] == 'access' && !$this->is_authorized()) {
             throw new Exception();
         }
     } catch (Exception $e) {
         $this->unlink_account();
         $this->init();
     }
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:32,代码来源:dropboxfront.class.php

示例4: process

 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     //DROPBOX
     $canCall = false;
     if (!$this->request()->get('db_authorize')) {
         $this->dropbox = PhpFox::getService('backuprestore.dropboxfront');
         $canCall = true;
     }
     $dbauthorize = array();
     if ($canCall) {
         $dbauthorize['Url'] = $this->dropbox->get_authorize_url();
         if ($this->dropbox->is_authorized()) {
             //User Dropbox info
             $dbaccount_info = $this->dropbox->get_account_info();
             $dbaccount_details = array('account_owner' => $dbaccount_info->display_name, 'used_space' => round(($dbaccount_info->quota_info->quota - ($dbaccount_info->quota_info->normal + $dbaccount_info->quota_info->shared)) / 1073741824, 1), 'quota' => round($dbaccount_info->quota_info->quota / 1073741824, 1));
             $dbaccount_details['used_percent'] = round($dbaccount_details['used_space'] / $dbaccount_details['quota'] * 100, 0);
             $this->authorized['dropbox'] = 1;
         } else {
             if ($this->request()->get('continue')) {
                 if (!$this->dropbox->is_authorized()) {
                     $dbauthorize['error_not_authorized'] = 'yes';
                 }
                 $dbauthorize['submitbutton'] = 'Authorize';
             }
         }
     }
     //Request Authorize Dropbox Account
     if ($this->request()->get('db_authorize')) {
         $dbauthorize['submitbutton'] = 'Continue';
     }
     //Google DRIVE
     $gdrive = PhpFox::getService('backuprestore.googledrivefront');
     $tokens = $gdrive->getAccessTokens();
     //Check Google drive User Authorization
     if ($gdrive->is_authorized()) {
         //User Google Drive info
         try {
             if (isset($tokens)) {
                 $drive = $gdrive->buildService($tokens);
                 $gdrive_info = $gdrive->getAcountInfo($drive);
                 $this->authorized['gdrive'] = 1;
             }
         } catch (Exception $e) {
             throw $e;
         }
     }
     // Google Drive Authorize
     if ($this->request()->get('gd_authorize')) {
         if (!$gdrive->initClientKeys()) {
             $this->url()->forward($this->url()->makeUrl('admincp.backuprestore.gdrivesett'), 'In order to use Google Drive Service fill below requirements');
         }
         try {
             $gdrive->gdrive_auth_request();
         } catch (Exception $e) {
             Phpfox::addMessage($e->getMessage());
         }
     }
     $this->template()->assign(array('dbauthorize' => $dbauthorize, 'gdrive_info' => !empty($gdrive_info) ? $gdrive_info : null, 'DBADetails' => !empty($dbaccount_details) ? $dbaccount_details : null, 'authorized' => $this->authorized));
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:62,代码来源:authorize.class.php

示例5: process

 public function process()
 {
     $this->googledrive = PhpFox::getService('backuprestore.googledrivefront');
     $this->btdbsett = PhpFox::getService('backuprestore.backuprestore');
     //Clients deny for Application Register
     if (isset($_GET['error'])) {
         $this->url()->forward($this->url()->makeUrl('backuprestore.continue'), Phpfox::getPhrase('backuprestore.gd_auth_deny'));
     }
     //Get Access Tokens usung authorization code returnedfrom Google API
     if (isset($_GET['code'])) {
         try {
             $this->tokens['access_token'] = $this->googledrive->exchangeCode($_GET['code']);
             if (!empty($this->tokens['access_token'])) {
                 $this->btdbsett->addBTDBSetting('googledrive_tokens', serialize(json_decode($this->tokens['access_token'], true)));
             }
             //Redirct to main page
             $this->url()->forward($this->url()->makeUrl('admincp.backuprestore.destination'), Phpfox::getPhrase('backuprestore.gd_register_complete'));
         } catch (Exception $e) {
             $e->getMessage();
         }
     }
     //Insert GDrive client keys
     if ($aVals = $this->request()->getArray('val')) {
         if (empty($aVals['gdrive_clientid'])) {
             return Phpfox_Error::set(Phpfox::getPhrase('backuprestore.please_insert_your_application_client_id'));
         }
         if (empty($aVals['gdrive_clientsecret'])) {
             return Phpfox_Error::set(Phpfox::getPhrase('backuprestore.please_insert_your_application_client_secret_key'));
         }
         if (Phpfox_Error::isPassed()) {
             if ($gdrive = Phpfox::getService('backuprestore.process')->addGDriveKeys($aVals)) {
                 $this->url()->send('admincp.backuprestore.gdrivesett', null, Phpfox::getPhrase('backuprestore.changes_successfully_saved'));
             }
         }
     }
     //Values from DB for edit
     $gdkeys = Phpfox::getService('backuprestore.backuprestore')->getBTDBSettingByName('gdclient_keys');
     if (!empty($gdkeys)) {
         $gdkeys = unserialize(array_shift($gdkeys));
         $this->template()->assign('aForms', $gdkeys);
     }
     $this->template()->assign(array('redirect_url' => 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'support_page' => $this->url()->makeUrl('admincp.backuprestore.gdrivesupp')));
     $this->template()->setBreadcrumb(Phpfox::getPhrase('backuprestore.google_drive'), $this->url()->makeUrl('admincp.backuprestore.gdrivesett'))->setHeader(array('btdbstyles.css' => 'module_backuprestore', 'scripts.js' => 'module_backuprestore'));
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:44,代码来源:gdrivesett.class.php

示例6: __construct

 public function __construct()
 {
     require_once 'module/backuprestore/Google/Google_Client.php';
     require_once 'module/backuprestore/Google/contrib/Google_DriveService.php';
     require_once 'module/backuprestore/Google/contrib/Google_Oauth2Service.php';
     $this->btdbsett = PhpFox::getService('backuprestore.backuprestore');
     if (!$this->initClientKeys()) {
         return;
         // Phpfox::addMessage('Error');
     }
     $this->client = new Google_Client();
     $this->client->setApplicationName(Phpfox::getPhrase('backuprestore.phpfox_backup_into_cloud'));
     $this->client->setScopes($this->SCOPES);
     try {
         $this->init();
         //If we are in the access state and are still not authorized then unlink and re init
         if (!$this->is_authorized()) {
             throw new Exception();
         }
     } catch (Exception $e) {
         //Phpfox::addMessage(Phpfox::getPhrase('backuprestore.google_drive_error_when_requesting_access_token')); //re authorize user
     }
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:23,代码来源:googledrivefront.class.php

示例7: process

 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     // Google Drive Authorize
     if ($this->request()->get('gd_authorize')) {
         if (!PhpFox::getService('backuprestore.googledrivefront')->initClientKeys()) {
             $this->url()->forward($this->url()->makeUrl('admincp.backuprestore.gdrivesett'), 'In order to use Google Drive Service fill below requirements');
         }
         try {
             PhpFox::getService('backuprestore.googledrivefront')->gdrive_auth_request();
         } catch (Exception $e) {
             Phpfox::addMessage($e->getMessage());
         }
     }
     // Google Drive Unauthorize
     if ($this->request()->get('gd_unauthorize')) {
         try {
             Phpfox::getService('backuprestore.googledrivefront')->gdrive_auth_revoke();
         } catch (Exception $re) {
         }
     }
     $gdrive = PhpFox::getService('backuprestore.googledrivefront');
     $tokens = $gdrive->getAccessTokens();
     //Check Google drive User Authorization
     if ($gdrive->is_authorized()) {
         //User Google Drive info
         try {
             if (isset($tokens)) {
                 $drive = $gdrive->buildService($tokens);
                 $gdrive_info = $gdrive->getAcountInfo($drive);
                 $this->authorized['gdrive'] = 1;
             }
         } catch (Exception $e) {
             throw $e;
         }
     }
     $this->template()->assign(array('gdrive_info' => !empty($gdrive_info) ? $gdrive_info : null, 'authorized' => $this->authorized));
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:40,代码来源:gdrive.class.php

示例8: __construct

 public function __construct()
 {
     $this->_sTable = Phpfox::getT('backuprestore');
     $this->btcsett = PhpFox::getService('backuprestore.backuprestore');
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:5,代码来源:services.class.php

示例9: process

 public function process()
 {
     error_reporting(E_ALL);
     $dbname = Phpfox::getParam(array('db', 'name'));
     $user = Phpfox::getParam(array('db', 'user'));
     $pass = Phpfox::getParam(array('db', 'pass'));
     $host = Phpfox::getParam(array('db', 'host'));
     $process = Phpfox::getService('backuprestore.process');
     $backuprestore = Phpfox::getService('backuprestore.backuprestore');
     Phpfox::getLib('database')->freeResult();
     $aItems = Phpfox::getLib('database')->getTableStatus();
     $iSize = 0;
     $iOverhead = 0;
     foreach ($aItems as $iKey => $aItem) {
         $iSize += $aItem['Data_length'];
         $iOverhead += $aItem['Data_free'];
         $aItems[$iKey]['Name'] = $aItems[$iKey]['Name'];
     }
     if ($this->request()->get('save_settings')) {
         $aTables = $this->request()->getArray('tables');
         $sql_file_name = $process->generate_unique_key(15);
         if (!is_dir('file/tmpDatabaseRestore/')) {
             @mkdir('file/tmpDatabaseRestore/', 0777);
             @chmod('file/tmpDatabaseRestore/', 0777);
         }
         $sql_file_name = "file/tmpDatabaseRestore/" . $sql_file_name;
         if ($aTables) {
             $process->backup_tables($sql_file_name . '.sql', $host, $user, $pass, $dbname, $aTables, $sql_file_name);
         }
         $process->backup();
     }
     $gdriveAuthError = false;
     $dropboxAuthError = false;
     $emptyServices = false;
     $savedpath = $backuprestore->getBTDBSettingByName('selected_services');
     if ($savedpath['setting_value'] == '') {
         $emptyServices = true;
     } else {
         $backupsettings = unserialize($savedpath['setting_value']);
         $dropbox = PhpFox::getService('backuprestore.dropboxfront');
         //Google DRIVE
         $gdrive = PhpFox::getService('backuprestore.googledrivefront');
         $tokens = $gdrive->getAccessTokens();
         if (isset($backupsettings['gdrive']) && $backupsettings['gdrive']) {
             if (!$gdrive->is_authorized()) {
                 $gdriveAuthError = true;
             } else {
                 $gdriveAuthError = false;
             }
         }
         if (isset($backupsettings['dropbox']) && $backupsettings['dropbox']) {
             if (!$dropbox->is_authorized()) {
                 $dropboxAuthError = true;
             } else {
                 $dropboxAuthError = false;
             }
         }
     }
     $this->template()->assign(array('aItems' => $aItems, 'iSize' => $iSize, 'gdriveAuthError' => $gdriveAuthError, 'dropboxAuthError' => $dropboxAuthError, 'emptyServices' => $emptyServices, 'authErrorUrl' => $this->url()->makeUrl('admincp.backuprestore.destination'), 'iOverhead' => $iOverhead, 'iCnt' => count($aItems)));
     $this->template()->setBreadcrumb(Phpfox::getPhrase('backuprestore.take_backup_content'), $this->url()->makeUrl('admincp.backuprestore.backup'))->setHeader(array('btdbstyles.css' => 'module_backuprestore', 'jqueryFileTree.css' => 'module_backuprestore', 'manage_filetree.js' => 'module_backuprestore', 'jqueryFileTree.js' => 'module_backuprestore', 'scripts.js' => 'module_backuprestore'));
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:61,代码来源:backup.class.php

示例10: test

 public function test()
 {
     //Retrive Google DRive saved tokens from DB
     if ($savedtokens = PhpFox::getService('backuprestore.backuprestore')->getBTDBSettingByName('googledrive_tokens')) {
         $savedtokens = json_encode(unserialize(array_shift($savedtokens)));
     }
     $savedtokens = json_decode($savedtokens, true);
     $params = array('refresh_token' => $savedtokens['refresh_token'], 'client_id' => $this->ClientId, 'client_secret' => $this->ClientSecret, 'grant_type' => 'refresh_token');
     $mReturn = Phpfox::getLib('request')->send('https://accounts.google.com/o/oauth2/token', $params);
     $result = json_decode($mReturn, true);
     $result['created'] = Phpfox::getTime();
     //var_dump($result);
     if (isset($result['access_token'])) {
         $this->client->setAccessToken($mReturn);
         try {
             if ($newtokens = $this->client->getAccessToken()) {
                 $tekens = json_decode($newtokens, true);
                 $tekens['created'] = Phpfox::getTime();
                 $newtokens = json_encode($tekens);
                 $userinfo = $this->getUserInfo($newtokens);
                 $emailAddress = $userinfo->getEmail();
                 $userId = $userinfo->getId();
                 echo $emailAddress . "<br>" . $userId;
                 $service = $this->buildService($newtokens);
                 $abc = $this->getAcountInfo($service);
             }
         } catch (Exception $abc) {
             $abc->getMessage();
         }
     }
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:31,代码来源:googledriveauth.class.php

示例11: deleteDropboxFile

 private function deleteDropboxFile($key, $folder)
 {
     if ($folder) {
         $folder = trim($folder, '/');
         $folder = trim($folder, '\\');
         $folder = "/" . $folder . "/";
     } else {
         $folder = '/';
     }
     $dropbox = PhpFox::getService('backuprestore.dropboxfront');
     if ($dropbox->deleteFile($folder . $key)) {
         return true;
     }
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:14,代码来源:process.class.php


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