Exemplo n.º 1
0
 public function init()
 {
     parent::init();
     /** @var $app CWebApplication */
     $app = Yii::app();
     $this->assetsUrl = $app->assetManager->publish(__DIR__ . '/assets');
     $this->viewPath = __DIR__ . '/views';
     /** @var $yiiTwigRenderer ETwigViewRenderer */
     $yiiTwigRenderer = Yii::app()->getComponent('viewRenderer');
     /** @var $twig_LoaderInterface Twig_Loader_Filesystem */
     $twig_LoaderInterface = $yiiTwigRenderer->getTwig()->getLoader();
     $twig_LoaderInterface->addPath($this->viewPath);
 }
Exemplo n.º 2
0
 function init()
 {
     parent::init();
     //为flash上传设置session
     $sessionName = session_name();
     if (isset($_GET[$sessionName]) && strlen($_GET[$sessionName]) > 0) {
         $_COOKIE[$sessionName] = $_GET[$sessionName];
     }
     //TODO:更详细的权限检查需要自己做
     if (Yii::app()->user->isGuest) {
         echo json_encode(array('state' => '没有权限'));
         Yii::app()->end();
     }
     Yii::import('ext.baiduUeditor.*');
     $this->_config = (require_once 'config.php');
     require_once 'Uploader.class.php';
 }