function init() { if(!union::getconfig('enabled')) { echo '<script type="text/javascript">alert("'.lang('推广联盟未开启,转让会员中心!').'")</script>'; front::refresh(url::create('user/index')); } $user=''; if(cookie::get('login_username') &&cookie::get('login_password')) { $user=new user(); $user=$user->getrow(array('username'=>cookie::get('login_username'))); } if(!is_array($user) &&front::$act != 'into'&&front::$act != 'login'&&front::$act != 'register'&&front::$act != 'login_js'&&front::$act != 'login_success'&&front::$act != 'getpass'&&front::$act != 'edit'){ front::redirect(url::create('user/login')); }else{ if (is_array($user) && cookie::get('login_password') == front::cookie_encode($user['password'])) { $this->view->user = $user; $this->view->usergroupid = $user['groupid']; $obj = new usergroup(); $this->roles = $obj->getrow(array('groupid'=>$this->view->usergroupid)); } } $this->_user=new user; $this->view->form = $this->_user->get_form(); $this->view->field = $this->_user->getFields(); $this->view->primary_key=$this->_user->primary_key; $this->view->data = $this->view->user; $this->_union = new union(); $this->view->uniondata = $this->_union->getrow(array('userid'=>$this->view->data['userid'])); if(!$this->view->uniondata &&front::$act != 'register'&&front::$act != 'into') { echo '<script type="text/javascript">alert("'.lang('未申请账号,转入联盟申请页面!').'");window.location.href="'.url::create('union/register').'";</script>'; //front::refresh(url::create('union/register')); } $this->_pagesize=config::get('manage_pagesize'); }
function init() { $this->archive = new archive(); $this->category = category::getInstance(); $this->view->category = $this->category->category; if (front::get('page')) $page = front::get('page'); else $page = 1; $this->view->page = $page; front::check_type($page); $_catpage = category::categorypages(front::get('catid')); if ($_catpage) { $this->pagesize = $_catpage; } else { $this->pagesize = config::get('list_pagesize'); } front::check_type($this->pagesize); $announcement = new announcement(); $this->view->announcements = $announcement->getrows(null, 10); $this->view->usergroupid = 1000; front::check_type(cookie::get('login_username'), 'safe'); front::check_type(cookie::get('login_password'), 'safe'); $this->view->showarchive = archive::getInstance()->getrow(front::get('aid')); $addcontentuser = new user(); $addcontentuser = $addcontentuser->getrow(array('userid' => $this->view->showarchive['userid'])); if (is_array($addcontentuser)) { $this->view->adduser = $addcontentuser; } if (cookie::get('login_username') && cookie::get('login_password')) { $user = new user(); $user = $user->getrow(array('username' => cookie::get('login_username'))); if (is_array($user) && cookie::get('login_password') == front::cookie_encode($user['password'])) { $this->view->user = $user; $this->view->usergroupid = $user['groupid']; $obj = new usergroup(); $this->roles = $obj->getrow(array('groupid'=>$this->view->usergroupid)); } } }
function getPrices($price) { if (cookie::get('login_username') && cookie::get('login_password')) { $user = new user(); $user = $user->getrow(array('username' => cookie::get('login_username'))); if (is_array($user) && cookie::get('login_password') == front::cookie_encode($user['password'])) { $obj = new usergroup(); $roles = $obj->getrow(array('groupid' => $user['groupid'])); } } if ($roles['discount'] != 0) { $newprice = $price * $roles['discount'] * 0.1; }else{ $newprice = $price; } return array('oldprice'=>$price,'price'=>$newprice,'groupname'=>$roles['name']); }