Esempio n. 1
0
 /**
  * 图片上传的处理函数
  *
  * @access public
  * @param
  *            array upload 包含上传的图片文件信息的数组
  * @param
  *            array dir 文件要上传在$this->data_dir下的目录名。如果为空图片放在则在$this->images_dir下以当月命名的目录下
  * @param
  *            array img_name 上传图片名称,为空则随机生成
  * @return mix 如果成功则返回文件名,否则返回false
  */
 public function UploadImage($upload, $dir = '', $img_name = '')
 {
     if (empty($dir)) {
         $dir = date('Ym');
         $dir = \yii::getAlias('@static') . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR;
     } else {
         $dir = \yii::getAlias('@static') . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR;
         if ($img_name) {
             $img_name = $dir . $img_name;
         }
     }
     if (!file_exists($dir)) {
         if (!$this->make_dir($dir)) {
             return false;
         }
     }
     if (empty($img_name)) {
         $img_name = $this->unique_name($dir);
         $img_name = $dir . $img_name . UtilD::get_filetype($upload['name']);
     }
     if (!UtilD::check_img_type($upload['type'])) {
         return false;
     }
     //允许上传的类型
     $allow_file_types = ['gif', 'jpg', 'jpeg', 'png', 'bmp', 'swf'];
     //'|GIF|JPG|JEPG|PNG|BMP|SWF|';
     if (!UtilD::check_file_type($upload['tmp_name'], $img_name, $allow_file_types)) {
         return false;
     }
     if ($this->move_file($upload, $img_name)) {
         return str_replace(\yii::getAlias('@static') . DIRECTORY_SEPARATOR, '', $img_name);
     } else {
         return false;
     }
 }
 public function actionView()
 {
     $radioId = Yii::app()->request->getParam("id", 0);
     $radioName = WapRadioModel::model()->findByPk($radioId)->name;
     $albumId = WapRadioModel::model()->getAlbumByRadio($radioId, "c2.id");
     $radioAvatar = RadioModel::model()->getAvatarUrl($radioId, 's1');
     $album = WapAlbumModel::model()->published()->findByPk($albumId);
     if (!$album) {
         $this->forward("/site/error", true);
     }
     $songsOfAlbum = WapSongModel::model()->getSongsOfAlbum($albumId);
     $artists = AlbumArtistModel::model()->getArtistsByAlbum($albumId);
     $phone = yii::app()->user->getState('msisdn');
     $errorCode = 'success';
     $errorDescription = '';
     $registerText = WapAlbumModel::model()->getCustomMetaData('REG_TEXT');
     ///meta tag
     $AlbumDetail = AlbumModel::model()->findByPk($albumId);
     $artistId = !empty($artists) ? $artists[0]->artist_id : $AlbumDetail->artist_id;
     $ArtistInfo = ArtistModel::model()->findByPk($artistId);
     $this->itemName = $AlbumDetail->name;
     $this->artist = $ArtistInfo->name;
     $this->thumb = AlbumModel::model()->getAvatarUrl($albumId, 's1');
     $this->url = URLHelper::buildFriendlyURL("album", $albumId, Common::makeFriendlyUrl($ArtistInfo->name));
     $this->description = strip_tags($AlbumDetail->description);
     //get other radio
     $parent_id = Yii::app()->params['horoscope']['parent_id'];
     $radioListOther = WapRadioModel::model()->getHoroscopes($parent_id);
     $this->render('detail', array('album' => $album, 'songsOfAlbum' => $songsOfAlbum, 'errorCode' => $errorCode, 'errorDescription' => $errorDescription, 'registerText' => $registerText, 'radioListOther' => $radioListOther, 'radioAvatar' => $radioAvatar));
 }
 /**
  * validate, if its actual user contacts sor actions:
  *  - editableSaver
  *  - ajaxCreate
  *  - delete
  * @return boolean
  */
 public static function isItSelfContact()
 {
     $ppcn_id = false;
     $action = Yii::app()->controller->action->id;
     switch (Yii::app()->controller->action->id) {
         //update
         case 'editableSaver':
             $ppcn_id = yii::app()->request->getParam('pk');
             //delete
         //delete
         case 'delete':
             if (!$ppcn_id) {
                 $ppcn_id = yii::app()->request->getParam('ppcn_id');
             }
             if (!$ppcn_id) {
                 return false;
             }
             $ppcn = PpcnPersonContact::model()->findByPk($ppcn_id);
             if (!$ppcn || $ppcn->ppcnPprs->pprs_id != Yii::app()->getModule('user')->user()->profile->person_id) {
                 return false;
             }
             break;
             //create
         //create
         case 'ajaxCreate':
             if (yii::app()->request->getParam('value') != Yii::app()->getModule('user')->user()->profile->person_id) {
                 return false;
             }
             break;
         default:
             return false;
             break;
     }
     return true;
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($idobservacion)
 {
     $model = new Observacionesdetalle();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Observacionesdetalle'])) {
         $model->attributes = $_POST['Observacionesdetalle'];
         $model->hidobservaciones = $idobservacion;
         $model->usuario = Yii::app()->user->name;
         $model->fecha = date("d-m-Y H:i:s");
         if ($model->save()) {
             $modeloinventario = Observaciones::model()->findByPk($idobservacion);
         }
         if (!$this->enviamail($modeloinventario, $model->comentario)) {
             echo "fallo";
             yii::app()->end();
         }
         $model->refresh();
         if (!empty($_GET['asDialog'])) {
             //Close the dialog, reset the iframe and update the grid
             echo CHtml::script("window.parent.\$('#cru-dialog1').dialog('close');\n\t\t\t\t\t\t\t\t\t\t\t\t\t                    window.parent.\$('#cru-frame1').attr('src','');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twindow.parent.\$.fn.yiiGridView.update('{$_GET['gridId']}');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t");
             Yii::app()->end();
         }
         $this->render('Confirma', array('id' => $model->id));
         Yii::app()->end();
         //$this->redirect(array('view','id'=>$model->id));
     }
     $this->layout = '//layouts/iframe';
     $this->render('create', array('model' => $model, 'idobservacion' => $idobservacion));
 }
Esempio n. 5
0
 public function init()
 {
     parent::init();
     // custom initialization code goes here
     \yii::configure($this, require __DIR__ . '/config.php');
     $this->params['maxPostCount'] = 50;
 }
 /**
  * Lists all Country models.
  * @return mixed
  */
 public function actionIndex()
 {
     yii::warning('yyy aaa ', __METHOD__);
     $searchModel = new CountrySearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
Esempio n. 7
0
 public function hayerrores($codocu)
 {
     if (count($_SESSION[self::NOMBRE_SESION][yii::app()->user->id][$codocu]) > 0) {
         return $_SESSION[self::NOMBRE_SESION][yii::app()->user->id][$codocu];
     }
     return null;
 }
Esempio n. 8
0
 /**
  * 记录管理员的操作内容
  *
  * @access  public
  * @param   string      $sn         数据的唯一值
  * @param   string      $action     操作的类型
  * @param   string      $content    操作的内容
  * @return  void
  */
 public static function admin_log($sn = '', $action, $content)
 {
     $log_info = \yii::t('log', $action) . \yii::t('log', $content) . ":" . Html::encode($sn);
     $time = time();
     $sql = "INSERT INTO " . self::tableName() . " (log_time,user_id,log_info,ip_address) " . " VALUES ('{$time}','" . \yii::$app->user->id . "','" . Html::encode($log_info) . "','" . \yii::$app->request->userIP . "')";
     return \yii::$app->getDb()->createCommand($sql)->execute();
 }
 private function getMainDependenciesConfig()
 {
     if (is_null($this->mainDependenciesConfig)) {
         $this->mainDependenciesConfig = (require \yii::getAlias("@appBuilder") . "/config/Dependencies.php");
     }
     return $this->mainDependenciesConfig;
 }
Esempio n. 10
0
 public function run()
 {
     if ($sourcetype == '') {
         $sourcetype = 37;
     }
     $connection = yii::app()->db;
     $tracked_userid = Yii::app()->session['login']['id'];
     $Criteria = new CDbCriteria();
     $Criteria->condition = "upload_sourceid = '" . $this->sourceid . "' AND tracked_userid ='" . $tracked_userid . "'and upload_sourcetype='" . $this->sourcetype . "' and view_status=0 and block_status=0";
     $Criteria->order = "note_id DESC";
     $note = Notess::model()->findAll($Criteria);
     foreach ($note as $notes) {
         $ids[] = $notes->tracker_userid;
     }
     $Criteria->join = 'join fn_users as t1	on t1.userid = t.tracker_userid ';
     $Criteria->join .= 'join fn_contentnote as t2 on t2.id = t.contentnote_id ';
     $Criteria->addInCondition('t.tracker_userid', $ids);
     //$Criteria->group = 't.tracker_userid';
     $Criteria->select = "t.*,t1.fname,t2.name";
     $note = Notess::model()->findAll($Criteria);
     $content_note = Contentnote::model()->findAll();
     //echo $content_note->contentnote_id;
     //print_r($content_note);
     /*SELECT t.*,t1.fname FROM `fn_notes` as t
     		join fn_users as t1 
     		on t1.userid  = t.tracker_userid
     		WHERE t.`tracker_userid` in (616,115)
     		group by t.`tracker_userid`*/
     //echo count($note);
     $this->render('_note', array('type' => $this->widgettype, 'i' => $this->i, 'sourceid' => $this->sourceid, 'userid' => $this->userid, 'uname' => $this->uname, 'sourcetype' => $this->sourcetype, 'notek' => $note, 'result' => $content_note));
 }
Esempio n. 11
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->iduser = yii::app()->user->id;
     }
     return parent::beforeSave();
 }
 /**
  * example:
  * $permissionName can be 
  * action
  * controller/action
  * module/controller/action
  * @param string $permissionName Permisssion Name
  * @return array Array of formated Data
  */
 protected function checkpermission($permissionName)
 {
     $return = [];
     $pm_list = explode('/', $permissionName);
     if (is_array($pm_list)) {
         $count = count($pm_list);
         switch ($count) {
             case 1:
                 if ($permissionName == \Yii::$app->controller->module->id) {
                     $return = ['module' => \Yii::$app->controller->module->id];
                 } else {
                     $return = ['module' => \Yii::$app->controller->module->id, 'controller' => \Yii::$app->controller->id, 'action' => $permissionName];
                 }
                 break;
             case 2:
                 $return = ['module' => \Yii::$app->controller->module->id, 'controller' => $pm_list[0], 'action' => $pm_list[1]];
                 break;
             case 3:
                 $controller = $pm_list[1];
                 $module = $pm_list[0];
                 $action = $pm_list[2];
                 $return = ['module' => $pm_list[0], 'controller' => $pm_list[1], 'action' => $pm_list[2]];
                 break;
         }
         \yii::trace(print_r($return, true));
     } else {
         $controller = \Yii::$app->controller;
         $module = $controller->module->id;
         $action = $permissionName;
         $return = ['module' => $module, 'controller' => $controller, 'action' => $action];
     }
     return $return;
 }
Esempio n. 13
0
 protected function renderContent()
 {
     yii::beginProfile('loc');
     $session = new CHttpSession();
     $session->open();
     $newCountry = $this->newCountry ? $this->newCountry : ($session['top-country'] ? $session['top-country'] : $this->defaultCountry);
     $session['top-country'] = $newCountry;
     $newCity = $this->newCity ? $this->newCity : ($session['top-city'] ? $session['top-city'] : $this->defaultCity);
     $session['top-location'] = $newCity;
     if ($newCountry == "international") {
         $country = 'international';
         $city = GeoCityApi::getCityByName($newCity);
         if ($city) {
             $cities = GeoCityApi::getTopPrioritiesInternational($city->id);
         } else {
             $cities = GeoCityApi::getTopPrioritiesInternational();
         }
     } else {
         $country = GeoCountryApi::getCountryByName($newCountry);
         $city = GeoCityApi::getCityByName($newCity);
         if ($country && $city) {
             $cities = GeoCityApi::getTopPrioritiesByCountry($country->id, $city->id);
         } elseif ($country) {
             $cities = GeoCityApi::getTopPrioritiesByCountry($country->id);
         }
     }
     if ($country && $cities) {
         $this->render('topLocation', array('city' => $city, 'country' => $country, 'current' => $this->current, 'cities' => $cities));
     }
     yii::endProfile('loc');
 }
Esempio n. 14
0
 public function actionUpdate()
 {
     $pictures = array();
     $lid = Yii::app()->request->getParam('lid');
     Until::isUpdateValid(array($lid), $this->companyId, $this);
     //0,表示企业任何时候都在云端更新。
     $criteria = new CDbCriteria();
     $criteria->with = 'productImg';
     $criteria->addCondition('t.lid=:lid and t.dpid=:dpid and t.delete_flag=0 ');
     $criteria->order = ' t.lid desc ';
     $criteria->params[':lid'] = $lid;
     $criteria->params[':dpid'] = $this->companyId;
     $model = Product::model()->find($criteria);
     if (Yii::app()->request->isPostRequest) {
         $postData = Yii::app()->request->getPost('productImg');
         if (ProductPicture::saveImg($this->companyId, $lid, $postData)) {
             Yii::app()->user->setFlash('success', yii::t('app', '修改成功'));
             $this->redirect(array('productImg/index', 'companyId' => $this->companyId));
         }
     }
     if (!empty($model->productImg)) {
         foreach ($model->productImg as $pic) {
             array_push($pictures, $pic->pic_path);
         }
     }
     $this->render('updateProductImg', array('model' => $model, 'pictures' => $pictures));
 }
Esempio n. 15
0
 public function actionSaveNew()
 {
     try {
         $channelName = Yii::app()->request->getParam('channelName');
         $contentType = Yii::app()->request->getParam('contentType');
         $channelType = Yii::app()->request->getParam('channelType');
         $channelIdentify = Yii::app()->request->getParam('channelIdentify');
         $pid = yii::app()->request->getParam('pid');
         $list = TSChannel::model()->findAll('Channel_Identify=:channelIdentify', array(':channelIdentify' => $channelIdentify));
         if (count($list) >= 1) {
             $result = array('flag' => 'ERROR', 'message' => '栏目标识符已经存在!');
             echo json_encode($result, JSON_UNESCAPED_UNICODE);
         } else {
             $model = new TSChannel();
             $model->Channel_Pid = $pid;
             $model->Channel_Is_Title = $contentType;
             $model->Channel_Is_Parent = $channelType == '0' ? 'true' : 'false';
             $model->Channel_Name = $channelName;
             $model->Channel_Is_Open = 'true';
             $model->Channel_Identify = $channelIdentify;
             $flag = $model->save();
             $result = array('flag' => 'SUCCESS', 'message' => '栏目添加成功!', 'newNodes' => array('id' => $model->Id, 'name' => $model->Channel_Name, 'pId' => $model->Channel_Pid, 'isParent' => $model->Channel_Is_Parent, 'open' => $model->Channel_Is_Open));
             echo json_encode($result, JSON_UNESCAPED_UNICODE);
         }
     } catch (Exception $e) {
         $result = array('flag' => 'Exception', 'message' => $e->getMessage());
         echo json_encode($result, JSON_UNESCAPED_UNICODE);
     }
 }
Esempio n. 16
0
 public function save()
 {
     $base = yii::getAlias("@app/config");
     $handle = fopen($base . "/smsdb.php", "w+");
     $content = "<?php\nreturn [\n    'class' => 'yii\\db\\Connection',\n    'dsn' => 'mysql:host={$this->host};port={$this->port};dbname={$this->dbname}',\n    'username' => '{$this->user}',\n    'password' => '{$this->pass}',\n    'charset' => 'utf8',\n];";
     fwrite($handle, $content);
 }
 public function actionAlarm()
 {
     $mes = $_REQUEST['ids'];
     $mes = json_decode($mes, true);
     $res = array();
     //获取的是一个RFID数组
     foreach ($mes as $key => $value) {
         $data = AsAsset::model()->findByPk($value);
         if (is_null($data)) {
             $res[] = array("id" => $value, "name" => 'null', "alarm" => 0);
         } else {
             if ($data['outPrm'] == 'y') {
                 if ($data['state'] == 'out') {
                     // echo "1";
                     $res[] = array("id" => $data['RFID'], "name" => $data['assetName'], "alarm" => 0);
                 } elseif ($data['state'] == 'in') {
                     // echo "2";
                     $res[] = array("id" => $data['RFID'], "name" => $data['assetName'], "alarm" => 1);
                     $mes = "RFID:" . $value . "原因:该商品显示在库存中";
                     yii::log($mes, "info", "alarm.log");
                     //将报警信息写入日志
                 }
             } else {
                 $mes = "RFID:" . $value . "原因:该商品不允许外借";
                 yii::log($mes, "info", "alarm.log");
                 $res[] = array("id" => $data['RFID'], "name" => $data['assetName'], "alarm" => 1);
             }
         }
     }
     //返回值的形式为RFID,assetName,alarm(1是报警,0是不报警)
     $res1 = json_encode($res);
     echo $res1;
 }
Esempio n. 18
0
 /**
  * User login
  */
 public function actionLogin()
 {
     if (!\Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     $userDriver = isset(\Yii::$app->params['user_driver']) == true && empty(\Yii::$app->params['user_driver']) == false ? strtolower(\Yii::$app->params['user_driver']) : 'local';
     if ($userDriver == 'ldap') {
         if (isset(\Yii::$app->params['ldap']) == false) {
             throw new \Exception(yii::t('walle', 'the login dirver configs does not defined', array('loginType' => \Yii::$app->params['user_driver'])));
         }
         if (is_array(\Yii::$app->params['ldap']) == false) {
             throw new \Exception(yii::t('walle', 'the login dirver configs parse error', array('loginType' => \Yii::$app->params['user_driver'])));
         }
         $model = new LdapLoginForm(\Yii::$app->params['ldap']);
         if ($model->load(Yii::$app->request->post()) && $model->login()) {
             return $this->goBack();
         } else {
             return $this->render('login', ['isLdapLigin' => true, 'model' => $model]);
         }
     } elseif ($userDriver == 'local') {
         $model = new LoginForm();
         if ($model->load(Yii::$app->request->post()) && $model->login()) {
             return $this->goBack();
         } else {
             return $this->render('login', ['isLdapLigin' => false, 'model' => $model]);
         }
     } else {
         throw new \Exception(yii::t('walle', 'login type could not support', array('loginType' => \Yii::$app->params['user_driver'])));
     }
 }
Esempio n. 19
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $pageSize = Yii::app()->request->getParam('pageSize', Yii::app()->params['pageSize']);
     Yii::app()->user->setState('pageSize', $pageSize);
     $model = new RejectModel('search');
     $model->unsetAttributes();
     // clear any default values
     //lay mang phone
     $phone = Yii::app()->request->getParam('phone');
     $phoneModel = RejectModel::model()->findByAttributes(array('phone' => $phone));
     if (empty($phoneModel)) {
         $model = new RejectModel();
         $model->phone = $phone;
         try {
             if ($model->save()) {
                 $message = yii::t('SpamModule', 'Success!');
             } else {
                 $message = yii::t('SpamModule', 'Insert fail');
             }
         } catch (Exception $exc) {
             echo $exc->getTrace();
         }
     } else {
         $message = yii::t('SpamModule', 'The number had exists');
     }
     echo $message;
 }
 public function actionAdd()
 {
     $shipping_id = (int) \yii::$app->request->get('shipping', 0);
     $sql = "SELECT shipping_name,shipping_code FROM " . Shipping::tableName() . " WHERE id={$shipping_id}";
     $shipping = \yii::$app->getDb()->createCommand($sql)->queryOne();
     $set_modules = 1;
     include_once \yii::getAlias('@ext') . '/shipping/' . $shipping['shipping_code'] . '.php';
     $fields = [];
     foreach ($modules[0]['configure'] as $key => $val) {
         $fields[$key]['name'] = $val['name'];
         $fields[$key]['value'] = $val['value'];
         $fields[$key]['label'] = \yii::t('shipping', $val['name']);
     }
     $count = count($fields);
     $fields[$count]['name'] = "freee_money";
     $fields[$count]['value'] = "0";
     $fields[$count]['label'] = \yii::t('shipping', 'free_money');
     //如果支持货到付款,则允许设置货到付款支付费用
     if ($modules[0]['cod']) {
         $count++;
         $fields[$count]['name'] = "pay_fee";
         $fields[$count]['value'] = "0";
         $fields[$count]['label'] = \yii::t('shipping', 'pay_fee');
     }
     $shipping_area['shipping_id'] = 0;
     $shipping_area['free_money'] = 0;
     return $this->render('shipping_area_info', ['shipping_area' => ['shipping_id' => $shipping_id, 'shipping_code' => $shipping['shipping_code']], 'fields' => $fields, 'form_action' => 'insert']);
 }
 public function renderHtmlInput($input_type_id, $options = [])
 {
     $field = $options['prefix_text'] . "&nbsp;";
     switch ($input_type_id) {
         case Types::$input_type['small_text']['id']:
             $field .= Html::textInput(sprintf('question_%s', $options['screening_question_id']), '', ['style' => 'width:60px']);
             break;
         case Types::$input_type['med_text']['id']:
             $field .= Html::textInput(sprintf('question_%s', $options['screening_question_id']), '', []);
             break;
         case Types::$input_type['large_text']['id']:
             $field .= Html::textInput(sprintf('question_%s', $options['screening_question_id']), '', ['style' => 'width:240px']);
             break;
         case Types::$input_type['date']['id']:
             $field = sprintf('');
             break;
         case Types::$input_type['radio']['id']:
             // Enable tristate behavior with custom indeterminate value, custom toggle icon, and a custom label for the indeterminate state.
             $options['tristate_option_id'] == Types::$boolean['true']['id'] ? $tristate = true : ($tristate = false);
             $field = Html::radioList(sprintf('question_%s', $options['screening_question_id']), Types::$boolean['null']['id'], [Types::$boolean['true']['description'] => Types::$boolean['true']['description'], Types::$boolean['false']['description'] => Types::$boolean['false']['description']], ['unselect' => Types::$boolean['null']['description'], 'separator' => '&nbsp;&nbsp;&nbsp;']);
             break;
         case Types::$input_type['text_agreement']['id']:
         case Types::$input_type['text_agreement']['id']:
             $field = Html::radioList(sprintf('question_%s', $options['screening_question_id']), Types::$boolean['null']['id'], [yii::t('app', 'Agree') => yii::t('app', 'Agree'), yii::t('app', 'Disagree') => yii::t('app', 'Disagree')], ['unselect' => Types::$boolean['null']['description'], 'separator' => '&nbsp;&nbsp;&nbsp;']);
             break;
             break;
         case Types::$input_type['image_overlay']['id']:
             $field = sprintf('image overlay');
             break;
     }
     $field .= "&nbsp;" . $options['suffix_text'];
     return $field;
 }
Esempio n. 22
0
 protected function renderContent()
 {
     yii::beginProfile('top-cities');
     $country = GeoCountryApi::getCountryByName($this->country);
     $cities = GeoCityApi::getTopPrioritiesByCountry($country->id);
     $this->render('topCities', array('cities' => $cities));
     yii::endProfile('top-cities');
 }
Esempio n. 23
0
 /**
  * @return mixed
  * @throws \yii\base\InvalidConfigException
  */
 public static function getService()
 {
     $class_name = static::className();
     if (!isset(static::$_services[$class_name]) || !static::$_services[$class_name] instanceof Service) {
         static::$_services[$class_name] = \yii::createObject($class_name);
     }
     return static::$_services[$class_name];
 }
 public function saveModel()
 {
     if (!$this->save()) {
         yii::app()->user->setFlash('error', CHtml::errorSummary($this));
         return false;
     }
     return true;
 }
Esempio n. 25
0
 public static function getURLForAuth($fbAPI)
 {
     define('FACEBOOK_SDK_V4_SRC_DIR', \yii::getAlias('@frontend/modules/socials/fb'));
     FacebookSession::setDefaultApplication($fbAPI['APPID'], $fbAPI['SECURITY_KEY']);
     $helper = new FacebookRedirectLoginHelper(\yii::$app->params['fbAPI']['redirectURL']);
     $loginUrl = $helper->getLoginUrl();
     return $loginUrl;
 }
Esempio n. 26
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->c_estado = '99';
         $this->idusertemp = yii::app()->user->id;
     }
     return parent::beforeSave();
 }
Esempio n. 27
0
 /**
  * 模块初始化
  */
 public function init()
 {
     parent::init();
     // custom initialization code goes here
     $config = ['components' => [], 'params' => ['name' => '肖红阳'], 'defaultRoute' => 'index', 'aliases' => ['@webName' => '网站管理后台', '@moduleViewPath' => '@app/modules/adminshop/views']];
     \yii::configure($this, $config);
     $this->ec_init();
 }
Esempio n. 28
0
 /**
  * 根据错误状态码解析错误提示信息
  * @param $code
  * @return string
  * @deprecate 转换到parseCode方法
  */
 private static function _parseCode($code)
 {
     include_once \yii::getAlias('@common/config/error.php');
     $lang = \yii::$app->language;
     include_once \yii::getAlias('@common/lang/' . $lang . '/error_message_lang.php');
     //待优化
     return isset($lang[$code]) ? $lang[$code] : null;
 }
 /**
  * Validates the password.
  * This method serves as the inline validation for password.
  *
  * @param string $attribute the attribute currently being validated
  * @param array $params the additional name-value pairs given in the rule
  */
 public function validatePassword($attribute, $params)
 {
     if (!$this->hasErrors()) {
         $user = $this->getUser();
         if (!$user || !$user->validatePassword($this->password)) {
             $this->addError($attribute, yii::t('adminlte', 'Incorrect username or password.'));
         }
     }
 }
Esempio n. 30
0
 public function actionCaseDetail()
 {
     $id = yii::app()->request->getParam('id');
     $article = TSArticle::model()->findByPk($id);
     $parentChannel = TSChannel::model()->find('Channel_Identify =:pChannelIden', array(':pChannelIden' => $article->Channel_Parent_Identify));
     $channel = TSChannel::model()->find('Channel_Identify =:channelIden', array("channelIden" => $article->Channel_Identify));
     $this->breadcrumbs = array($parentChannel->Channel_Name => $this->createUrl('show/cases'), $channel->Channel_Name => $this->createUrl('cases/caseForOne', array('id' => $article->Channel_Identify)), $article->Article_Title);
     $this->render('case_detail', array('article' => $article));
 }