Esempio n. 1
0
 public function init()
 {
     parent::init();
     if (isset($_GET["src"]) && $_GET["src"] == "ads") {
         Yii::app()->session['src'] = 'ads';
     }
     //get userPhone
     if (Yii::app()->user->isGuest) {
         $identity = new UserIdentity(null, null);
         $type = 'autoLogin';
         if ($identity->userAuthenticate($type, $this->deviceOs)) {
             Yii::app()->user->login($identity);
         }
     }
     $this->userPhone = Yii::app()->user->getState('msisdn');
     $this->banners = WapBannerModel::getBanner('wap');
     //chk is subscribe
     if (!empty($this->userPhone)) {
         $this->isSub = WapUserSubscribeModel::model()->chkIsSubscribe($this->userPhone);
     }
     if (Yii::app()->user->getState('is3g') == 1) {
         $this->is3g = true;
     }
     $isTouch = $this->_isTouchLayout();
     if (!$isTouch) {
         $this->layout = 'application.views.wap.layouts.main';
     }
 }
 public function actionVerifyWifi()
 {
     $phone = $_SESSION['phoneverifyWifiEvent'];
     if ($phone) {
         $return = array('phone' => $phone, 'error' => 0, 'msg' => '');
         if (isset($_POST['code'])) {
             $userVerify = UserVerifyModel::model()->findByAttributes(array('msisdn' => $phone, 'action' => 'register_event83'));
             if (empty($userVerify) || $userVerify->verify_code != $_POST['code']) {
                 $return['error'] = 1;
                 $return['msg'] = "Mã xác nhận của Quý Khác không chính xác!";
             } else {
                 // Xác thực thành công
                 $userVerify->delete();
                 $isUserSub = WapUserSubscribeModel::model()->chkIsSubscribe($phone);
                 /* if(!$isUserSub){//chua da dang ky
                 				try{
                 					$bmUrl = yii::app()->params['bmConfig']['remote_wsdl'];
                 					$client = new SoapClient($bmUrl, array('trace' => 1));
                 					$params = array(
                 							'phone' => $phone,
                 							'package' => 'CHACHAFUN',
                 							'source' => 'wap',
                 							'promotion' => 0
                 					);
                 					$result = $client->__soapCall('userRegister', $params);
                 				}catch (Exception $e)
                 				{
                 					//
                 				}
                 			} */
                 $identity = new UserIdentity(null, null);
                 if ($identity->userAuthenticateWifi($phone)) {
                     Yii::app()->user->login($identity);
                 }
                 if ($isUserSub) {
                     $this->redirect('/event/play');
                     Yii::app()->end();
                 } else {
                     $this->redirect('/event');
                     Yii::app()->end();
                 }
             }
         }
         $this->render('verifyWifi', $return);
     } else {
         $this->redirect('/event/register');
     }
 }
Esempio n. 3
0
 public function run()
 {
     $this->detectDevice = new Mobile_Detect();
     $userSub = WapUserSubscribeModel::model()->getUserSubscribe(Yii::app()->user->getState('msisdn'));
     if (empty($userSub)) {
         $is_sub = 0;
     } else {
         $is_sub = 1;
     }
     if ($this->freeWifi) {
         $view = 'player_wifi';
     } else {
         $view = 'player';
     }
     $this->render("{$view}", array('is_sub' => $is_sub, 'errorCode' => $this->errorCode, 'errorText' => $this->errorText, 'autoPlay' => $this->autoPlay));
 }
Esempio n. 4
0
 public function init()
 {
     /* $log = new KLogger('log_view_error', KLogger::INFO);
     		$log->LogInfo("viewPath:".$this->getViewPath(), false);
     		$log->LogInfo("Action:".$this->getAction(), false); */
     $isTouch = $this->_isTouchLayout();
     if ($isTouch) {
         $this->deviceLayout = 'touch';
         $this->layout = 'application.views.touch.layouts.main';
         if (strpos(Yii::app()->params['base_url'], $_SERVER['HTTP_HOST']) === false) {
             $this->redirect(Yii::app()->params['base_url'] . Yii::app()->request->requestUri);
         }
     } else {
         $this->deviceLayout = 'default';
         //$this->layout = 'application.views.wap.default.layouts.main';
         $this->layout = 'application.modules.event.views.layouts.main';
         if (strpos(Yii::app()->params['base_url'], $_SERVER['HTTP_HOST']) === false) {
             $this->redirect(Yii::app()->params['base_url'] . Yii::app()->request->requestUri);
         }
     }
     parent::init();
     if ($isTouch) {
         //get userPhone
         if (Yii::app()->user->isGuest) {
             $identity = new UserIdentity(null, null);
             $type = 'autoLogin';
             if ($identity->userAuthenticate($type, $this->deviceOs)) {
                 Yii::app()->user->login($identity);
                 $this->userPhone = Yii::app()->user->getState('msisdn');
             }
         } else {
             $this->userPhone = Yii::app()->user->getState('msisdn');
         }
         $this->banners = BannerModel::getBanner('wap');
         $this->userName = Yii::app()->user->getState('username');
         //chk is subscribe
         if (!empty($this->userPhone)) {
             $this->isSub = WapUserSubscribeModel::model()->chkIsSubscribe($this->userPhone);
         }
     }
 }
Esempio n. 5
0
<?php

if ($this->isSub) {
    ?>
<!-- <div class="padB10">-->
<?php 
    $user = WapUserSubscribeModel::model()->getByPhone(yii::app()->user->getState('msisdn'));
    /* if($user){
    		echo '<div>Quý khách đang sử dụng gói cước <strong>'.PackageModel::model()->findByPk($user->package_id)->name.'</strong></div>';
    		echo '<div>Thời hạn sử dụng đến hết ngày:  <strong>'.date('d/m/Y', strtotime($user->expired_time)).'</strong></div>';
    	} */
    ?>
<!--</div>-->
<?php 
}
//if (empty($this->isSub)){
if ($packages) {
    ?>
	<ul class="song_list items-list">
    <?php 
    $i = 0;
    foreach ($packages as $pack) {
        $i++;
        ?>
        <li class="item <?php 
        if ($i == count($packages)) {
            echo 'last_item';
        }
        ?>
" style="padding: 10px 0">
			<table width="100%">
 public function actionView()
 {
     $is_3g = $this->is3g;
     if (Yii::app()->user->isGuest) {
         $this->redirect($this->createUrl("/account/login"));
         return;
     }
     $error = $error2 = $error_success = "";
     //$user_id = Yii::app()->user->id;
     $phone = yii::app()->user->getState('msisdn');
     $user = UserModel::model()->findByAttributes(array('phone' => $phone));
     $user_id = $user->id;
     $cri = new CDbCriteria();
     $cri->condition = " user_phone = {$phone} AND status=1";
     $user_sub = WapUserSubscribeModel::model()->find($cri);
     $user_extra = UserExtraModel::model()->findbyPK($user->id);
     $forcus = "";
     if (Yii::app()->request->isPostRequest) {
         if (isset($_POST['Profile'])) {
             $error = '';
             $forcus = '';
             $error_code = 0;
             if (empty($_POST['Profile']['username'])) {
                 $error = Yii::t("wap", "Họ tên không được để trống");
                 $forcus = "username";
                 $error_code = 1;
             }
             $playlist_name = ucwords($_POST['Profile']['username']);
             if (preg_match('/[\'\\/~`\\!@#\\$%\\^&\\*\\(\\)_\\-\\+=\\{\\}\\[\\]\\|;:"\\<\\>,\\.\\?\\\\]/', $playlist_name)) {
                 $error = Yii::t("wap", "Họ tên không được chứa ký tự đặc biệt");
                 $forcus = "username";
                 $error_code = 1;
             }
             if (!empty($_POST['Profile']['email']) && !EmailHelper::isEmailAddress($_POST['Profile']['email'])) {
                 $error = Yii::t("wap", "Email incorrect");
                 $forcus = "email";
                 $error_code = 1;
             }
             $birthday = implode('-', array_reverse(explode('/', $_POST['Profile_birthday'])));
             $date = DateTime::createFromFormat("Y-m-d", $birthday);
             if (!$date && !empty($_POST['Profile_birthday'])) {
                 $error = Yii::t("wap", "Date of birth incorrect!");
                 $forcus = "birthday";
                 $error_code = 1;
             }
             if ($error_code == 0) {
                 if (empty($user)) {
                     $password = Common::randomPassword(6);
                     $user = new UserModel();
                     $user->username = $_POST['Profile']['username'];
                     $user->password = $password["encoderPass"];
                     $user->fullname = Yii::app()->user->getState('msisdn');
                     $user->phone = Yii::app()->user->getState('msisdn');
                     $user->gender = 0;
                     $user->status = UserModel::ACTIVE;
                     $user->validate_phone = 1;
                     $user->created_time = date('Y-m-d H:i:s');
                     $user->updated_time = date('Y-m-d H:i:s');
                     $user->email = $_POST['Profile']['email'];
                     $user->address = $_POST['Profile']['address'];
                     $user->gender = (int) $_POST['Profile']['genre'];
                     $ret = $user->save();
                 } else {
                     $user->username = $_POST['Profile']['username'];
                     $user->email = $_POST['Profile']['email'];
                     $user->address = $_POST['Profile']['address'];
                     $user->gender = (int) $_POST['Profile']['genre'];
                     $ret = $user->save();
                 }
                 if ($ret) {
                     if (!empty($user_extra)) {
                         $user_extra->birthday = !empty($birthday) ? $birthday : new CDbExpression('NULL');
                         $user_extra->save();
                     } else {
                         $user_extra = new UserExtraModel();
                         $user_extra->user_id = $user_id;
                         $user_extra->birthday = !empty($birthday) ? $birthday : new CDbExpression('NULL');
                         $user_extra->save();
                     }
                     $error_success = "Cập nhật thành công";
                 } else {
                     $error = Yii::t("wap", "An error occurred. Please try again later.");
                 }
             }
         }
         if (isset($_POST['Profile2'])) {
             $post = $_POST['Profile2'];
             if (empty($post['password'])) {
                 $error2 = Yii::t("wap", "Please input old password");
                 $forcus = "password";
             } elseif ($user['password'] == Common::endcoderPassword($post['password'])) {
                 if (empty($post['password_new'])) {
                     $error2 = Yii::t("wap", "Please input new password");
                 } elseif ($post['password_new'] == $post['password_new_retype']) {
                     $lengPassword = strlen($post['password_new']);
                     if ($lengPassword < 6) {
                         $error2 = Yii::t("wap", "Password required more than 6 characters!");
                         $forcus = "password";
                     } else {
                         $user->password = Common::endcoderPassword($post['password_new']);
                         $ret = $user->save();
                         if ($ret) {
                             Yii::app()->user->setFlash('change_pass_status', Yii::t("wap", "Your password was successfully changed"));
                             $this->redirect($this->createUrl("/account/view"));
                         } else {
                             $error2 = Yii::t("wap", "An error occurred. Please try again later.");
                         }
                     }
                 } else {
                     $error2 = Yii::t("wap", "Repassword not match");
                     $forcus = "password_new_retype";
                 }
             } else {
                 $error2 = Yii::t("wap", "Old password not match");
                 $forcus = "password_new";
             }
         }
     }
     $this->render('view', compact('user', 'user_sub', 'user_extra', 'error', 'error2', 'forcus', 'error_success', 'is_3g'));
 }
Esempio n. 7
0
 public function userAuthenticateWifi($msisdn)
 {
     if ($msisdn) {
         // get user info from phone
         $user = UserModel::model()->findByAttributes(array("phone" => $msisdn));
         if ($user) {
             if (!empty($user->suggested_list)) {
                 $this->setState('_user', array('id' => $user->id, 'suggested_list' => $user->suggested_list));
             } else {
                 $this->setState('_user', array('phone' => $msisdn, 'suggested_list' => ""));
             }
         } else {
             $this->setState('_user', array('phone' => $msisdn, 'suggested_list' => ""));
         }
         $this->_msisdn = $msisdn;
         $this->setState('msisdn', $msisdn);
         $package = WapUserSubscribeModel::model()->getUserSubscribe($this->_msisdn);
         // get user_subscribe record by phone
         if ($package) {
             $packageObj = WapPackageModel::model()->findByPk($package->package_id);
             $this->setState('package', $packageObj->code);
         }
         self::_logDetectMSISDN($msisdn, 'wifi');
         $this->errorCode = self::ERROR_NONE;
     } else {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     }
     return !$this->errorCode;
 }
Esempio n. 8
0
 public function init()
 {
     // setup multi language
     self::_setupLanguage();
     // DETECT DEVICE
     $this->device = DeviceManager::getInstance();
     if (!isset(yii::app()->session['deviceId'])) {
         Yii::app()->session['deviceId'] = $this->device->getDeviceID();
         Yii::app()->session['device'] = $this->device->getInfo('model_name');
         Yii::app()->session['deviceOS'] = $this->device->getDeviceOs();
     }
     $this->deviceOs = Yii::app()->session['deviceOS'];
     // check user login
     if (Yii::app()->user->isGuest) {
         $identity = new UserIdentity(null, null);
         $type = 'autoLogin';
         if ($identity->userAuthenticate($type, $this->deviceOs)) {
             Yii::app()->user->login($identity);
         }
     }
     // get banners
     $this->banners = WapBannerModel::getBanner('wap');
     // reload package state if request
     if (isset($_REQUEST['reloadPackage']) && $_REQUEST['reloadPackage'] == 1) {
         $package = WapUserSubscribeModel::model()->getUserSubscribe(Yii::app()->user->getState('msisdn'));
         //get user_subscribe record by phone
         if ($package) {
             $packageObj = WapPackageModel::model()->findByPk($package->package_id);
             Yii::app()->user->setState('package', $packageObj->code);
         }
     }
     $this->promotion_realtime = WapUserSubscribeModel::model()->checkPromotion(Yii::app()->user->getState('msisdn'));
     if (!isset(Yii::app()->session['isPromotion']) || Yii::app()->session['isPromotion'] == '') {
         if (Yii::app()->user->getState('msisdn')) {
             //Yii::app()->session['isPromotion'] = WapUserSubscribeModel::model()->checkPromotion(Yii::app()->user->getState('msisdn'));
             Yii::app()->session['isPromotion'] = $this->promotion_realtime;
         } else {
             Yii::app()->session['isPromotion'] = "";
         }
     }
     $this->isPromotion = Yii::app()->session['isPromotion'];
     if (Yii::app()->user->getState('msisdn')) {
         $this->userSub = WapUserSubscribeModel::model()->getUserSubscribe(Yii::app()->user->getState('msisdn'));
     } else {
         $this->userSub = "";
     }
     Yii::app()->user->setState('userSub', $this->userSub);
     if (!Yii::app()->user->isGuest && $this->userSub == '') {
         $this->getPopup();
     }
     $this->getPopupKM();
     $this->getPopupCTKM();
     // load config from DB
     $wap_configs = Yii::app()->cache->get("WAP_CONFIG");
     if ($wap_configs === false) {
         $wap_configs = ConfigModel::model()->getConfig('', 'wap');
         Yii::app()->cache->set("WAP_CONFIG", $wap_configs, Yii::app()->params['cacheTime']);
     }
     if (!empty($wap_configs)) {
         foreach ($wap_configs as $key => $info) {
             $config_type = $info['type'];
             if ($config_type == "string") {
                 Yii::app()->params[$key] = $info['value'];
             }
             if ($config_type == "int") {
                 Yii::app()->params[$key] = intval($info['value']);
             }
             if ($config_type == "array") {
                 Yii::app()->params[$key] = unserialize($info['value']);
             }
         }
     }
     $this->updateCache();
     return parent::init();
 }
Esempio n. 9
0
    ?>
/touch/js/vplayer.js?v=1.0"></script>
<?php 
}
?>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
	var songObj = <?php 
echo CJSON::encode($this->song);
?>
;
	var chachaPlayer = new audioPlayer("audio",songObj);
	<?php 
//check is Subscribe, dùng chrome, android
$userSubs = WapUserSubscribeModel::model()->getUserSubscribe(Yii::app()->user->getState('msisdn'));
/* if ($userSubs):
	?>
	setTimeout(function() {
		chachaPlayer._play();
	},50);

	<?php endif;*/
?>
})
<?php 
if (Yii::app()->session['src'] == 'ads') {
    ?>
var ssid = '<?php 
    echo Yii::app()->session->sessionID;
    ?>