function _initialize()
 {
     parent::_initialize();
     $site_options = get_site_options();
     $this->assign($site_options);
     $ucenter_syn = C("UCENTER_ENABLED");
     if ($ucenter_syn) {
         if (!isset($_SESSION["user"])) {
             if (!empty($_COOKIE['thinkcmf_auth']) && $_COOKIE['thinkcmf_auth'] != "logout") {
                 $thinkcmf_auth = sp_authcode($_COOKIE['thinkcmf_auth'], "DECODE");
                 $thinkcmf_auth = explode("\t", $thinkcmf_auth);
                 $auth_username = $thinkcmf_auth[1];
                 $users_model = M('Users');
                 $where['user_login'] = $auth_username;
                 $user = $users_model->where($where)->find();
                 if (!empty($user)) {
                     $is_login = true;
                     $_SESSION["user"] = $user;
                 }
             }
         } else {
         }
     }
     if (sp_is_user_login()) {
         $this->assign("user", sp_get_current_user());
     }
 }
 function is_login()
 {
     if (sp_is_user_login()) {
         $this->ajaxReturn(array("status" => 1, "user" => sp_get_current_user()));
     } else {
         $this->ajaxReturn(array("status" => 0, "info" => "此用户未登录!"));
     }
 }
 function index()
 {
     if (sp_is_user_login()) {
         //已经登录时直接跳到首页
         redirect(__ROOT__ . "/");
     } else {
         $this->display(":register");
     }
 }
 function bang($type = "")
 {
     if (sp_is_user_login()) {
         empty($type) && $this->error('参数错误');
         //加载ThinkOauth类并实例化一个对象
         import("ThinkOauth");
         $sns = \ThinkOauth::getInstance($type);
         //跳转到授权页面
         $_SESSION['oauth_bang'] = 1;
         redirect($sns->getRequestCodeURL());
     } else {
         $this->error("您还没有登录!");
     }
 }
 function _initialize()
 {
     parent::_initialize();
     $site_options = get_site_options();
     $this->assign($site_options);
     $ucenter_syn = C("UCENTER_ENABLED");
     if ($ucenter_syn) {
         if (!isset($_SESSION["user"])) {
             if (!empty($_COOKIE['thinkcmf_auth']) && $_COOKIE['thinkcmf_auth'] != "logout") {
                 $thinkcmf_auth = sp_authcode($_COOKIE['thinkcmf_auth'], "DECODE");
                 $thinkcmf_auth = explode("\t", $thinkcmf_auth);
                 $auth_username = $thinkcmf_auth[1];
                 $users_model = M('Member');
                 $where['user_login'] = $auth_username;
                 $user = $users_model->where($where)->find();
                 if (!empty($user)) {
                     $is_login = true;
                     $_SESSION["user"] = $user;
                 }
             }
         } else {
         }
     }
     if (sp_is_user_login()) {
         $this->assign("user", sp_get_current_user());
     } else {
         if (isset($_COOKIE['user_login'])) {
             $users_model = M('Member');
             $where['user_login'] = $_COOKIE['user_login'];
             $user = $users_model->where($where)->find();
             //echo $_COOKIE['user_auth'];echo '<br>';echo md5($result['user_pass'].'iloveyouhmvpoint');die;
             if (md5($user['user_pass'] . 'iloveyouhmvpoint') == $_COOKIE['user_auth']) {
                 $_SESSION['user'] = $user;
             }
         }
     }
     // 热搜
     $top_hot_search = M('Ad')->where('ad_content="top_hot_search"')->limit(7)->select();
     $this->assign('top_hot_search', $top_hot_search);
     $cart = A('Order/Cart')->cart();
     $this->assign('cartNum', count($cart['cart']));
 }
 public function pay()
 {
     $payId = intval(I("get.id"));
     if (!$payId) {
         $this->error('数据传入失败!');
     }
     if (!sp_is_user_login()) {
         $_SESSION['login_http_referer'] = U("Server/Index/pay", array("id" => $payId));
         $this->error('请先登录!', U("user/login/index"));
     }
     $payInfo = $this->order_model->where(array("id" => $payId))->find();
     if (!$payInfo) {
         $this->error('订单不存在!', U("/"));
     }
     $current_user = sp_get_current_user();
     if ($payInfo['user_id'] != $current_user['id']) {
         $this->error('只能支付自己的订单', U("Server/Order/index"));
     }
     $server = $this->servers_model->where(array('id' => $payInfo['server_id'], 'status' => 1, "isdel" => 0))->find();
     if (!$server) {
         $this->error("服务器不存在或已停运,不可购买!", U("Server/Order/index"));
     }
     if ($payInfo["status"] == 0) {
         $this->error('订单已经被删除!', U("/"));
     } else {
         if ($payInfo["status"] == 2) {
             $this->error('订单已经支付!', U("/"));
         }
     }
     $server_sell = $this->serversell_model->where('id=' . $payInfo['month'])->find();
     $this->assign('payMethod', $this->order_model->payMethod);
     ////后期需要扩展支付接口地方
     $this->assign("server", $server);
     $this->assign("User", $current_user);
     $this->assign('server_sell', $server_sell);
     $this->assign($payInfo);
     $this->display();
 }
       	<?php 
$effected_id = "";
$filetpl = "<a href='\$href' target='\$target'>\$label</a>";
$foldertpl = "<a href='\$href' target='\$target' class='dropdown-toggle' data-toggle='dropdown' data-hover='dropdown'>\$label <b class='caret'></b></a>";
$ul_class = "dropdown-menu";
$li_class = "";
$style = "nav";
$showlevel = 6;
$dropdown = 'dropdown';
echo sp_get_menu("main", $effected_id, $filetpl, $foldertpl, $ul_class, $li_class, $style, $showlevel, $dropdown);
?>
		
		<ul class="nav pull-right" id="main-menu-left">
			<li class="dropdown">
			<?php 
if (sp_is_user_login()) {
    ?>
<a class="dropdown-toggle user" data-toggle="dropdown" href="#">
	            <?php 
    if (empty($user['avatar'])) {
        ?>
<img src="/tpl/wctf//Public/images/headicon.png" class="headicon"/>
	            <?php 
    } else {
        ?>
	            <img src="<?php 
        echo sp_get_user_avatar_url($user['avatar']);
        ?>
" class="headicon"/><?php 
    }
    ?>
 function apply()
 {
     //        $this->redirect("User/Login/index");
     if (!sp_is_user_login()) {
         $this->redirect("User/Login/index");
         exit;
     }
     if (!isset($_GET['id'])) {
         $this->error('职位不存在');
         exit;
     }
     $id = intval($_GET['id']);
     $data = M("Jobs")->find($id);
     if (!$data) {
         $this->error('职位不存在');
         exit;
     }
     //我的简历
     $uid = $this->user['id'];
     $resume = M("Resume")->where("uid={$uid}")->order('refreshtime desc')->select();
     $this->assign('resume', $resume);
     $this->assign('job', $data);
     $this->display();
 }