示例#1
0
 protected function module_get_info($username = '')
 {
     //first check for that what type of user info you want
     if ($username == '') {
         //you want user information that now in loged in
         if ($this->is_logedin()) {
             $id = $this->validator->get_id('USERS_LOGIN');
             if (db\orm::count('users', 'login_key = ?', array($id)) != 0) {
                 return db\orm::findOne('users', 'login_key = ?', array($id));
             }
         } else {
             //user is guest
             return null;
         }
     } else {
         //check for username and return back information if exists
         if (db\orm::count('users', 'username = ?', array($username)) != 0) {
             return db\orm::findOne('users', 'login_key = ?', array($username));
         } else {
             //username not found
             return 0;
         }
     }
 }