예제 #1
0
 public function actionIndex()
 {
     $areas = Area::getTops();
     $flashArr = Ads::getAllByPo('twindex', 'flash', '', 5);
     if (!empty($flashArr)) {
         foreach ($flashArr as $k => $val) {
             $_imgurl = zmf::uploadDirs($val['cTime'], 'site', $val['classify'], 600) . $val['filePath'];
             $flashArr[$k]['imgurl'] = $_imgurl;
         }
     }
     $this->pageTitle = zmf::config('sitename');
     $data = array('areas' => $areas, 'flashs' => $flashArr, 'posts' => $posts);
     $this->render('/index/index', $data);
 }
예제 #2
0
<?php

$topads = Ads::getAllByPo('sidebtn', 'img', '', 1);
if ($topads) {
    $_imgurl = zmf::uploadDirs($topads[0]['cTime'], 'site', $topads[0]['classify'], 'origin') . $topads[0]['filePath'];
    echo "<div class='col-xs-12 col-sm-12' style='margin-bottom:15px;'><img src='{$_imgurl}' class='img-responsive'/></div>";
}
?>
<div class="clearfix"></div>
<?php 
if ($type == 'travel') {
    ?>
<div class="col-xs-6 col-sm-6">
    <?php 
    echo CHtml::link('创建行程', array('travel/create'), array('class' => 'btn btn-success btn-block'));
    ?>
</div>
<?php 
} else {
    ?>
<div class="col-xs-6 col-sm-6">
    <?php 
    echo CHtml::link('写游记', array('posts/create'), array('class' => 'btn btn-success btn-block'));
    ?>
</div>
<div class="col-xs-6 col-sm-6">
    <?php 
    echo CHtml::link('我要提问', array('question/create'), array('class' => 'btn btn-default btn-block'));
    ?>
</div>
<?php 
예제 #3
0
파일: ads.php 프로젝트: ph7pal/wedding
<?php

$topads = Ads::getAllByPo($position, $type, $uid);
if (!empty($topads)) {
    Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . "/common/js/jquery.SuperSlide.2.1.1.js", CClientScript::POS_HEAD);
    ?>
<div id="slideBox" class="slideBox">
        <div class="hd">
            <ul>
                <?php 
    if (!empty($topads)) {
        ?>
                <?php 
        foreach ($topads as $key => $tmp) {
            ?>
    
                <li><?php 
            echo $key + 1;
            ?>
</li>
                <?php 
        }
        ?>
                           
                <?php 
    }
    ?>
            </ul>
        </div>
        <div class="bd">
                <ul>
예제 #4
0
 public function actionLogin($from = '')
 {
     if (!Yii::app()->user->isGuest) {
         $this->message(0, '您已登录,请勿重复操作');
     }
     if (!$from) {
         $from = 'login';
     }
     $bind = tools::val('bind', 't');
     $model = new LoginForm();
     //登录
     $modelUser = new Users();
     //注册
     if ($bind == 'weibo') {
         $strdata = zmf::getCookie('userWeiboData');
         //取出cookie中用户的微博信息
         if ($strdata) {
             $data = unserialize($strdata);
             $modelUser->truename = $data['screen_name'];
         }
     } elseif ($bind == 'qq') {
         $strdata = zmf::getCookie('userQQData');
         //取出cookie中用户的微博信息
         if ($strdata) {
             $data = unserialize($strdata);
             $modelUser->truename = $data['nickname'];
         }
     } elseif ($bind == 'weixin') {
         $strdata = zmf::getCookie('userWeixinData');
         //取出cookie中用户的微博信息
         if ($strdata) {
             $data = unserialize($strdata);
             $modelUser->truename = $data['nickname'];
         }
     }
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'users-addUser-form') {
         echo CActiveForm::validate($modelUser);
         Yii::app()->end();
     }
     //登录
     if (isset($_POST['LoginForm'])) {
         $from = 'login';
         $model->attributes = $_POST['LoginForm'];
         if ($model->validate()) {
             $hasBind = false;
             //判断是否绑定过微博
             if ($bind == 'weibo') {
                 $strdata = zmf::getCookie('userWeiboData');
                 //取出cookie中用户的微博信息
                 if (!$strdata) {
                     $model->addError('email', '未能获取微博绑定信息,请重试');
                 } else {
                     $binddata = unserialize($strdata);
                 }
                 //根据当前用户名获取他是否已经绑定过
                 $email = $_POST['LoginForm']['email'];
                 $validator = new CEmailValidator();
                 if ($validator->validateValue($email)) {
                     $user = Users::model()->find('email=:email', array(':email' => $email));
                 } else {
                     $user = Users::model()->find('truename=:truename', array(':truename' => $email));
                 }
                 if ($user) {
                     $bindInfo = UserSina::model()->findByPk($user['id']);
                     if ($bindInfo) {
                         $hasBind = true;
                     }
                     $binddata['uid'] = $user['id'];
                 }
             } elseif ($bind == 'qq') {
                 $strdata = zmf::getCookie('userQQData');
                 //取出cookie中用户的微博信息
                 if (!$strdata) {
                     $model->addError('email', '未能获取微博绑定信息,请重试');
                 } else {
                     $binddata = unserialize($strdata);
                 }
                 //根据当前用户名获取他是否已经绑定过
                 $email = $_POST['LoginForm']['email'];
                 $validator = new CEmailValidator();
                 if ($validator->validateValue($email)) {
                     $user = Users::model()->find('email=:email', array(':email' => $email));
                 } else {
                     $user = Users::model()->find('truename=:truename', array(':truename' => $email));
                 }
                 if ($user) {
                     $bindInfo = UserQq::model()->findByPk($user['id']);
                     if ($bindInfo) {
                         $hasBind = true;
                     }
                     $binddata['uid'] = $user['id'];
                 }
             } elseif ($bind == 'weixin') {
                 $strdata = zmf::getCookie('userWeixinData');
                 //取出cookie中用户的微博信息
                 if (!$strdata) {
                     $model->addError('email', '未能获取微信绑定信息,请重试');
                 } else {
                     $binddata = unserialize($strdata);
                 }
                 //根据当前用户名获取他是否已经绑定过
                 $email = $_POST['LoginForm']['email'];
                 $validator = new CEmailValidator();
                 if ($validator->validateValue($email)) {
                     $user = Users::model()->find('email=:email', array(':email' => $email));
                 } else {
                     $user = Users::model()->find('truename=:truename', array(':truename' => $email));
                 }
                 if ($user) {
                     $bindInfo = UserWeixin::model()->findByPk($user['id']);
                     if ($bindInfo) {
                         $hasBind = true;
                     }
                     $binddata['uid'] = $user['id'];
                 }
             }
             if ($hasBind) {
                 $model->addError('email', '该账号已绑定其他账号');
             } elseif ($model->login()) {
                 $arr = array('last_login_ip' => ip2long(Yii::app()->request->userHostAddress), 'last_login_time' => time());
                 Users::model()->updateByPk(Yii::app()->user->id, $arr);
                 Users::model()->updateCounters(array('login_count' => 1), ':id=id', array(':id' => Yii::app()->user->id));
                 if ($this->referer == '') {
                     $this->referer = array('users/index', 'id' => Yii::app()->user->id);
                 }
                 zmf::delCookie('checkWithCaptcha');
                 //微博绑定已有账号
                 if ($bind == 'weibo') {
                     UserSina::addCookie($binddata);
                 } elseif ($bind == 'qq') {
                     UserQq::addCookie($binddata);
                 } elseif ($bind == 'weixin') {
                     UserWeixin::addCookie($binddata);
                 }
                 $this->redirect($this->referer);
             }
         } else {
             zmf::setCookie('checkWithCaptcha', 1, 86400);
         }
     } elseif (isset($_POST['Users'])) {
         $from = 'reg';
         //注册
         if (UserAction::checkRegTimes()) {
             $this->message(0, '您今天的注册次数已用完');
         }
         $email = zmf::filterInput($_POST['Users']['email'], 't', 1);
         $truename = zmf::filterInput($_POST['Users']['truename'], 't', 1);
         $inputData = array('truename' => $truename, 'password' => $_POST['Users']['password'] != '' ? md5($_POST['Users']['password']) : '', 'email' => $email, 'cTime' => time(), 'register_time' => time(), 'last_login_time' => time(), 'groupid' => zmf::config('userDefaultGroup'), 'register_ip' => ip2long(Yii::app()->request->userHostAddress), 'last_login_ip' => ip2long(Yii::app()->request->userHostAddress));
         $modelUser->attributes = $inputData;
         if ($modelUser->validate()) {
             if ($modelUser->save()) {
                 $_model = new LoginForm();
                 $_model->email = $email;
                 $_model->password = $_POST['Users']['password'];
                 $_model->login();
                 if ($bind == 'weibo') {
                     $strdata = zmf::getCookie('userWeiboData');
                     //取出cookie中用户的微博信息
                     if ($strdata) {
                         $binddata = unserialize($strdata);
                         $binddata['uid'] = Yii::app()->user->id;
                         UserSina::addCookie($binddata);
                     }
                 } elseif ($bind == 'qq') {
                     $strdata = zmf::getCookie('userQQData');
                     //取出cookie中用户的微博信息
                     if ($strdata) {
                         $binddata = unserialize($strdata);
                         $binddata['uid'] = Yii::app()->user->id;
                         UserQq::addCookie($binddata);
                     }
                 } elseif ($bind == 'weixin') {
                     $strdata = zmf::getCookie('userWeixinData');
                     //取出cookie中用户的微信信息
                     if ($strdata) {
                         $binddata = unserialize($strdata);
                         $binddata['uid'] = Yii::app()->user->id;
                         UserWeixin::addCookie($binddata);
                     }
                 }
                 //登录成功后跳转到修改个人资料页面
                 $this->redirect(array('users/update', 'type' => 'info'));
             }
         }
     }
     if ($bind) {
         $this->loginTitle = '绑定已有账户';
         $this->regTitle = '完善资料';
     } else {
         $this->loginTitle = '登录';
         $this->regTitle = '注册';
     }
     if ($from == 'login') {
         $this->pageTitle = $this->loginTitle . ' - ' . zmf::config('sitename');
     } else {
         $this->pageTitle = $this->regTitle . ' - ' . zmf::config('sitename');
     }
     //登录页面的幻灯片
     $flashArr = Ads::getAllByPo('twindex', 'flash', '', 5);
     if (!empty($flashArr)) {
         foreach ($flashArr as $k => $val) {
             $_imgurl = zmf::uploadDirs($val['cTime'], 'site', $val['classify'], 600) . $val['filePath'];
             $flashArr[$k]['imgurl'] = $_imgurl;
         }
     }
     $this->render('login', array('model' => $model, 'modelUser' => $modelUser, 'from' => $from, 'flashs' => $flashArr));
 }