Пример #1
28
 public function init()
 {
     //csrf状态
     Yii::$app->request->enableCsrfValidation = $this->csrf;
     Yii::$app->request->enableCookieValidation = $this->csrf;
     //当前目录
     $this->currentPath = dirname(__FILE__);
     return parent::init();
 }
Пример #2
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!empty($this->data)) {
         $this->data = call_user_func($this->data);
     }
 }
Пример #3
0
 /**
  * Check if action has valid findModel method
  */
 public function init()
 {
     parent::init();
     if (!is_callable($this->findModel)) {
         throw new InvalidConfigException('findModel must be set');
     }
 }
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (empty($this->modelClass)) {
         throw new InvalidConfigException('The "modelClass" property must be set.');
     }
 }
 /**
  * @throws InvalidConfigException
  */
 public function init()
 {
     parent::init();
     if (!is_callable($this->outputFunction)) {
         throw new InvalidConfigException('outputFunction must be callable');
     }
 }
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->modelClass == null) {
         throw new InvalidConfigException('Param "modelClass" must be contain model name with namespace.');
     }
 }
Пример #7
0
 public function init()
 {
     parent::init();
     if (!$this->model) {
         throw new InvalidParamException('model不能为null');
     }
 }
Пример #8
0
 public function init()
 {
     //close csrf
     Yii::$app->request->enableCsrfValidation = false;
     //默认设置
     // $this->php_path =  dirname(__FILE__) . '/';
     $this->php_path = $_SERVER['DOCUMENT_ROOT'] . '/';
     $this->php_url = '/';
     //根目录路径,可以指定绝对路径,比如 /var/www/attached/
     $this->root_path = $this->php_path . 'upload/';
     //根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
     $this->root_url = $this->php_url . 'upload/';
     //图片扩展名
     //            $ext_arr = ['gif', 'jpg', 'jpeg', 'png', 'bmp'],
     //文件保存目录路径
     $this->save_path = $this->php_path . 'upload/';
     //文件保存目录URL
     $this->save_url = $this->php_url . 'upload/';
     //定义允许上传的文件扩展名
     //            $ext_arr = array(
     //                'image' => array('gif', 'jpg', 'jpeg', 'png', 'bmp'),
     //                'flash' => array('swf', 'flv'),
     //                'media' => array('swf', 'flv', 'mp3', 'wav', 'wma', 'wmv', 'mid', 'avi', 'mpg', 'asf', 'rm', 'rmvb'),
     //                'file' => array('doc', 'docx', 'xls', 'xlsx', 'ppt', 'htm', 'html', 'txt', 'zip', 'rar', 'gz', 'bz2'),
     //            ),
     //最大文件大小
     $this->max_size = 1000000;
     $this->save_path = realpath($this->save_path) . '/';
     //load config file
     parent::init();
 }
Пример #9
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (empty($this->callable)) {
         throw new InvalidParamException('Param "callable" can not be empty.');
     }
 }
 /**
  * @inheritdoc
  * @throws InvalidConfigException
  */
 public function init()
 {
     if (!isset($this->ownerLinkTable, $this->className)) {
         throw new InvalidConfigException('"ownerLinkTable" and "className" attributes cannot be null');
     }
     parent::init();
 }
Пример #11
0
 /**
  * @inheritdoc
  * @throws InvalidConfigException
  */
 public function init()
 {
     parent::init();
     if ($this->modelClass == null) {
         throw new InvalidConfigException('Property "modelClass" must be contain model class name.');
     }
 }
 /**
  * @inheritdoc
  * @throws \yii\base\InvalidConfigException
  */
 public function init()
 {
     if ($this->modelClass === null) {
         throw new InvalidConfigException('"modelClass" cannot be empty.');
     }
     parent::init();
 }
 /**
  * @inheritdoc
  * @throws InvalidConfigException
  */
 public function init()
 {
     if (!isset($this->ownerRelation, $this->ownerTable, $this->searchClass, $this->view)) {
         throw new InvalidConfigException('"searchClass", "ownerRelation", "ownerTable" and "view" attributes cannot be null');
     }
     parent::init();
 }
Пример #14
0
 public function init()
 {
     parent::init();
     $this->controller->enableCsrfValidation = false;
     Yii::$app->response->setStatusCode(200);
     Yii::$app->response->format = \yii\web\Response::FORMAT_RAW;
     Yii::$app->response->headers->set('Content-Type', 'application/xml; charset=utf-8');
 }
Пример #15
0
 public function init()
 {
     //close csrf
     Yii::$app->request->enableCsrfValidation = false;
     Yii::$app->response->format = Response::FORMAT_JSON;
     $this->driver = Yii::$app->request->get('driver', 'local');
     parent::init();
 }
Пример #16
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     $this->api = \Yii::$app->get($this->componentName);
     if (!$this->api instanceof Api) {
         throw new InvalidConfigException('Invalid PerfectMoney component configuration');
     }
     parent::init();
 }
Пример #17
0
 /**
  * @inheritdoc
  * @throws InvalidConfigException
  */
 public function init()
 {
     parent::init();
     if (empty($this->gridId) || empty($this->gridManager)) {
         throw new InvalidConfigException('Property "gridId" and "gridManager" must be specified.');
     }
     $this->gridManager = Instance::ensure($this->gridManager, 'bupy7\\grid\\interfaces\\ManagerInterface');
 }
Пример #18
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!empty($this->defaultValues)) {
         $this->defaultValues = call_user_func($this->defaultValues);
         $this->assignDefaultValues();
     }
 }
Пример #19
0
 public function init()
 {
     $this->currentPath = dirname(__FILE__);
     Yii::$app->request->enableCsrfValidation = false;
     Yii::$app->request->enableCookieValidation = true;
     $this->config = array_merge(['uploadDir' => date('Y/m/d'), 'webroot' => Yii::getAlias('@webroot')], $this->config);
     parent::init();
 }
Пример #20
0
 public function init()
 {
     parent::init();
     foreach ($this->allowedRoutes as &$allowedRoute) {
         $allowedRoute = ltrim(Yii::getAlias($allowedRoute), '/');
     }
     return $this->controller->redirect(Yii::$app->request->getReferrer());
 }
Пример #21
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->targetDirectory = Yii::getAlias($this->targetDirectory);
     if (is_callable($this->fileName)) {
         $this->fileName = call_user_func($this->fileName, $this);
     }
 }
Пример #22
0
 /**
  * Disabling CSRF validation
  */
 public function init()
 {
     Yii::$app->request->enableCsrfValidation = false;
     if (!is_array($this->sizeList)) {
         throw new Exception("Please, set sizeList array!");
     }
     parent::init();
 }
 public function init()
 {
     parent::init();
     if ($this->wechat !== null) {
         $this->wechat = Instance::ensure($this->wechat, Common::className());
     } else {
         throw new InvalidConfigException("Cache must be turned on");
     }
 }
Пример #24
0
 public function init()
 {
     \Yii::$app->request->enableCsrfValidation = false;
     //        $_config_json = file_get_contents(__DIR__.'assets/php/config.json');
     //        $_config = json_decode($_config_json, true);
     $_config = (require __DIR__ . '/config.php');
     $this->config = ArrayHelper::merge($_config, $this->config);
     parent::init();
 }
 public function init()
 {
     include_once dirname(__FILE__) . '/OssManager.php';
     Yii::$app->request->enableCsrfValidation = false;
     Yii::$app->request->enableCookieValidation = true;
     $this->config = array_merge(['uploadDir' => date('Y/m/d'), 'webroot' => Yii::getAlias('@webroot')], $this->config);
     $this->oss_article = new OssManager($this->config['bucket'], $this->config['access_id'], $this->config['access_key'], $this->config['end_point']);
     parent::init();
 }
Пример #26
0
 /**
  * Initializes the action and ensures the temp path exists.
  */
 public function init()
 {
     parent::init();
     Yii::$app->response->format = Response::FORMAT_JSON;
     $this->tempPath = Yii::getAlias($this->tempPath);
     if (!is_dir($this->tempPath)) {
         FileHelper::createDirectory($this->tempPath, $this->dirMode, true);
     }
 }
Пример #27
0
 public function init()
 {
     //close csrf
     Yii::$app->request->enableCsrfValidation = false;
     //默认设置
     $_config = (require __DIR__ . '/config.php');
     $this->config = ArrayHelper::merge($_config, $this->config);
     parent::init();
 }
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (empty($this->basePath)) {
         throw new InvalidParamException('Param "basePath" can not be empty.');
     }
     if (empty($this->baseUrl)) {
         throw new InvalidParamException('Param "baseUrl" can not be empty.');
     }
 }
 public function init()
 {
     parent::init();
     if (!isset($this->activeRecordClassName)) {
         throw new InvalidConfigException("You must specify the activeRecordClassName");
     }
     if (!isset($this->orderColumn)) {
         throw new InvalidConfigException("You must specify the orderColumn");
     }
 }
Пример #30
-1
 public function init()
 {
     parent::init();
     Yii::$app->request->enableCsrfValidation = false;
     $_config = (require __DIR__ . '/config.php');
     $this->config = ArrayHelper::merge($_config, $this->config);
     //        print_r($this->config);die;
 }