コード例 #1
0
 function init()
 {
     /* Load the config */
     try {
         $config = new Core_Config();
     } catch (Exception $e) {
         throw $e;
     }
     Zend_Registry::set('config', $config);
     $config->init();
     Core_Common::raiseMemoryLimitIfNecessary();
     /* Load the database */
     try {
         $db = Core_Db::getInstance();
     } catch (Exception $e) {
         throw $e;
     }
     Zend_Registry::set('db', $db);
     /* Load the plugins */
     $moduleManager = Core_ModuleManager::getInstance();
     $moduleManager->loadModules();
     Core_Common::createAccessObject();
     /* Load the events */
     Core_PostEvent('FrontController.initAuthenticationObject');
     try {
         $authAdapter = Zend_Registry::get('auth');
     } catch (Exception $e) {
         throw new Exception("Authentication object cannot be found in the Registry. Maybe the Login plugin is not activated?\n                    <br />You can activate the plugin by adding:<br />\n                    <code>Plugins[] = Login</code><br />\n                    under the <code>[Plugins]</code> section in your config/config.inc.php");
     }
     Zend_Registry::get('access')->reloadAccess($authAdapter);
     $moduleManager->postLoadModules();
 }
コード例 #2
0
 */
require_once LIB_DIR . 'config.php';
require_once LIB_DIR . 'helper.php';
require_once LIB_DIR . 'pdo.class.php';
require_once QBOX_SDK_DIR . 'rs.php';
require_once QBOX_SDK_DIR . 'fileop.php';
require_once QBOX_SDK_DIR . 'client/rs.php';
require_once QBOX_SDK_DIR . 'authtoken.php';
/**
 * 设置错误报告级别
 */
error_reporting($config['error']['reporting']);
/**
 * 初始化数据库连接句柄
 */
$db = Core_Db::getInstance($config["db"]);
/**
 * 配置七牛云存储密钥信息
 */
$QBOX_ACCESS_KEY = $config["qbox"]["access_key"];
$QBOX_SECRET_KEY = $config["qbox"]["secret_key"];
/**
 * 初始化 OAuth Client Transport
 */
$client = QBox_OAuth2_NewClient();
/**
 * 初始化 Qbox Reource Service Transport
 */
$bucket = $config["qbox"]["bucket"];
$rs = QBox_RS_NewService($client, $bucket);
$upToken = QBox_MakeAuthToken(array('expiresIn' => 3600));