Esempio n. 1
0
 function __construct()
 {
     parent::__construct();
     if (!uli()) {
         redirect();
     }
 }
Esempio n. 2
0
 function header($view)
 {
     //view同级下是否存在对应的header
     $header = $view . '_header';
     $viewPath = APPPATH . 'views/';
     $data['controller'] = $this->CI->router->fetch_class();
     if (uli()) {
         //获取用户信息
         lm('user_model');
         $data['userprofile'] = $this->CI->user_model->getUserProfileByIdArray(uid());
     }
     if (file_exists($viewPath . $header . '.php')) {
         lv($header, $data);
     } else {
         lv('header', $data);
     }
 }
Esempio n. 3
0
 function login()
 {
     if (uli()) {
         redirect('');
     }
     $this->data['title'] = "Login";
     //validate form input
     $this->form_validation->set_rules('username', '用户名', 'required|xss_clean');
     $this->form_validation->set_rules('password', '密码', 'required|xss_clean');
     if ($this->form_validation->run() == true) {
         //check to see if the user is logging in
         //check for "remember me"
         $remember = (bool) $this->input->post('remember');
         if ($this->ion_auth->login($this->input->post('username'), $this->input->post('password'), $remember)) {
             //if the login is successful
             //redirect them back to the home page
             $this->session->set_flashdata('message', $this->ion_auth->messages());
             $d = $this->session->userdata('d');
             if ($d) {
                 redirect($d);
             } else {
                 redirect('/', 'refresh');
             }
         } else {
             //if the login was un-successful
             //redirect them back to the login page
             $this->session->set_flashdata('message', $this->ion_auth->errors());
             redirect('auth/login', 'refresh');
             //use redirects instead of loading views for compatibility with MY_Controller libraries
         }
     } else {
         if (g('d')) {
             $this->session->set_userdata('d', g('d'));
         } else {
             $this->session->unset_userdata('d');
         }
         //the user is not logging in so display the login page
         //set the flash data error message if there is one
         $this->data['message'] = validation_errors() ? validation_errors() : $this->session->flashdata('message');
         $this->data['identity'] = array('name' => 'username', 'id' => 'username', 'type' => 'text', 'value' => $this->form_validation->set_value('identity'));
         $this->data['password'] = array('name' => 'password', 'id' => 'password', 'type' => 'password');
         $this->_render_page('auth/login', $this->data);
     }
 }
Esempio n. 4
0
/**
 * 投过标的、管理员、卖家可以看结果。
 * @param unknown_type $uid
 * @param unknown_type $did
 * @return boolean
 */
function canAccessDomainBidList($uid, $did)
{
    $CI =& get_instance();
    ll('ion_auth');
    if (!uli()) {
        return false;
    }
    if ($CI->ion_auth->is_admin()) {
        return true;
    }
    lm('domain_model');
    if ($CI->domain_model->isDomainBelongtoUser($did, $uid)) {
        return true;
    }
    lm('bid_model');
    if ($CI->bid_model->getUserDidDetailQuery($uid, $did)->num_rows() > 0) {
        return true;
    }
    return false;
}
Esempio n. 5
0
 function index()
 {
     if (!uli()) {
         redirect('auth/login');
     }
     $day = intval($this->uri->segment(3));
     if (empty($day) || $day <= 0 || $day > 7) {
         $day = 1;
     }
     $time = time();
     $pageStartDate = $time + 86400 * ($day - 1);
     $pageEndDate = 86400 + $pageStartDate;
     //首页放出所有域名,临时加上的
     if ($day == 1) {
         $pageEndDate = 604800 + $pageStartDate;
     }
     lm('domain_model');
     $data['day'] = $day;
     $data['todaySelling'] = $this->domain_model->getTodayDomainListArray(uid(), $pageStartDate, $pageEndDate);
     $data['todayOver'] = $this->domain_model->getTodayOverListArray($time);
     lfv('home/home_index', $data);
 }
Esempio n. 6
0
					<div class="six columns">
						<div class="row">
							<div class="six phone-two columns">
								<div id="logo">
									<a href="/" ><img src="<?php 
echo images();
?>
logo.png" alt="麦小米" /></a>
								</div>
							</div>
						</div>
					</div>
					<div class="six columns">
						<div class="user_box cf">
							<?php 
if (!uli()) {
    ?>
							<div class="user_info">
								<p class="sepH_a">
									<strong>未登录用户,不能出价</strong>
								</p>
								<span>
									<a href="<?php 
    if ($this->uri->segment(1) == 'auth') {
        echo site_url('auth/login');
    } else {
        echo site_url('auth/login?d=' . current_url());
    }
    ?>
" class="sep">登录</a> | <a href="<?php 
    echo site_url('auth/reg');
Esempio n. 7
0
echo date('Y-m-d H:i', element('deadline', $domain));
?>
</p>
						<?php 
if (element('deadline', $domain) < time() || uli() && uid() == element('uid', $domain)) {
    ?>
						<p class="sepH_c m_color">成交最低出价人数:<?php 
    echo element('bidlimit', $domain);
    ?>
</p>
						<?php 
}
?>
						<?php 
//卖家可以看到自己的米的保留价 或 域名因过了保留价流拍时,需要能看到保留价 结拍时管理员看到,买家看到。
if (uli() && uid() == element('uid', $domain) || !empty($bidReport) && is_admin() || uli() && !empty($bidReport) && element('uid1', $bidReport) == uid() || !empty($bidReport) && element('status', $bidReport) == DOMAIN_SELL_FAILED && element('failreason', $bidReport) == DOMAIN_BID_REPORT_FAILREASON_RESERVEPRICE) {
    ?>
						<p class="sepH_c m_color">保留价:<?php 
    echo element('reserveprice', $domain);
    ?>
</p>
						<?php 
}
?>
						<p class="sepH_c">悬赏奖金:<?php 
echo getPrizeForDomain($domain);
?>
</p>
						<p class="sepH_c">域名注册商:<?php 
echo element('register', $domain);
?>
Esempio n. 8
0
 function show()
 {
     $did = $this->uri->segment(3);
     if (is_numeric($did)) {
         lm('domain_model');
         $domain = $this->domain_model->getDomainAndBidCountByIdArray($did);
         if (!empty($domain)) {
             lm('bid_model');
             if (uli()) {
                 $userbid = $this->bid_model->getUserBidByUseridAndBidArray(uid(), $did);
                 $data['userbid'] = $userbid;
             }
             if (element('deadline', $domain) < time()) {
                 //已过期,判断是否需要生成结果报表
                 lm('bid_report_model');
                 lm('user_creditlocklog_model');
                 $domainBidlist = $this->bid_model->getDomainBidListQuery($did);
                 if ($this->bid_report_model->getDidReportQuery($did)->num_rows() < 1) {
                     $this->db->trans_start();
                     $this->bid_report_model->createBidReport($did, $domainBidlist, element('bidlimit', $domain));
                     $bidReport = $this->bid_report_model->getDidReportQuery($did)->row_array();
                     $reCalculateCreditLockUsers = array();
                     //如果拍卖成功,除了卖家和第一名的买家,其它人的信用额度要返还,流拍时,返还所有人的额度
                     if (element('status', $bidReport) == DOMAIN_SELL_FAILED) {
                         $this->user_creditlocklog_model->updateCreditlockLogIslockByDid($did, USER_CREDITLOCK_ISLOCK_FALSE);
                         foreach ($domainBidlist->result_array() as $biditem) {
                             $reCalculateCreditLockUsers[] = element('uid', $biditem);
                         }
                         //卖家不出价,上面的列表中没有,需要加上卖家;
                         $reCalculateCreditLockUsers[] = element('uid', $domain);
                     } else {
                         if (element('status', $bidReport) == DOMAIN_SELL_SUCCESSED) {
                             //除了卖家和买家(第一名)其它都解锁
                             $exceptUidArray = array(element('uid', $domain), element('uid1', $bidReport));
                             $this->user_creditlocklog_model->updateCreditlockLogIslockWithRange($did, array(), $exceptUidArray, USER_CREDITLOCK_ISLOCK_FALSE);
                             foreach ($domainBidlist->result_array() as $biditem) {
                                 if (element('uid', $biditem) != element('uid1', $bidReport)) {
                                     $reCalculateCreditLockUsers[] = element('uid', $biditem);
                                 }
                             }
                         }
                     }
                     foreach ($reCalculateCreditLockUsers as $tempUserId) {
                         $this->user_creditlocklog_model->updateUserProfileCreditLock($tempUserId);
                     }
                     //非流拍才需要处理
                     //系统 站内余额功能2013年7月3日0点(1372780800)上线,这之前不生成订单
                     if (element('pubdate', $bidReport) > 1372867200 && !empty($bidReport) && element('status', $bidReport) == DOMAIN_SELL_SUCCESSED && element('mark', $bidReport) == 0 && element('mark1', $bidReport) == 0) {
                         //生成订单处理业务
                         lm('domain_order_model');
                         //如果已生成就无需再生成
                         if ($this->domain_order_model->getDomainOrderQuery($did)->num_rows() < 1) {
                             //生成初始的order信息
                             $this->domain_order_model->addInitDomainOrder($domain, $bidReport);
                             $this->bid_report_model->updateDidReportOptStatus($did, DOMAIN_BID_REPORT_OPTSTATUS_UNDONE);
                         }
                     }
                     $this->db->trans_complete();
                 } else {
                     $bidReport = $this->bid_report_model->getDidReportQuery($did)->row_array();
                 }
                 $data['bidReport'] = $bidReport;
                 //出价列表被查了两次,需优化 TODO
                 $data['bidListArray'] = $this->bid_model->getDomainBidListArray($did);
             }
             lm('user_model');
             lm('bid_model');
             lm('page_model');
             $data['user'] = $this->user_model->getUserProfileByIdArray($domain['uid']);
             $data['userProfile'] = $this->user_model->getUserProfileByIdArray(uid());
             $data['relDomain'] = $this->domain_model->getUserRelDomainArray($domain['uid'], $did);
             $data['domain'] = $domain;
             lfv('domain/domain_show', $data);
         } else {
             redirect('');
         }
     } else {
         redirect('');
     }
 }