static function get($key, $default = null) { return a::get($_COOKIE, $key, $default); }
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'); }