コード例 #1
0
 /**
  *  run this action
  *  @param:  NULL
  *  @return: NULL
  *  @access: public
  */
 public function run()
 {
     //取得参数
     $id = $this->getParameterFromGET('id');
     if (!$id) {
         $this->AlertAndBack(USER_IS_EMPTY);
         return;
     }
     //检查用户名是否存在
     $sql = 'select count(*) as num from base_user_info where id=?';
     $sth = $this->db->Prepare($sql);
     $res = $this->db->Execute($sth, array($id));
     $rows = $res->FetchRow();
     if (!$rows['num']) {
         $this->AlertAndBack(USER_IS_NOT_EXISTS);
         return;
     }
     $name = UserUtil::getUserNameById($this->db, $id);
     //检查用户是否已经在黑名单中
     $sql = 'select count(*) as num from black_list_by_user where lower(user_name)=?';
     $sth = $this->db->Prepare($sql);
     $res = $this->db->Execute($sth, array(strtolower($name)));
     $rows = $res->FetchRow();
     if ($rows['num']) {
         $this->AlertAndBack(USER_HAD_BEEN_ADDED);
         return;
     }
     $sql = 'insert into black_list_by_user (user_name) values (?)';
     $sth = $this->db->Prepare($sql);
     $this->db->Execute($sth, array($name));
     $this->AlertAndBack(USER_HAD_BEEN_SUCCESS_ADDED);
     return;
 }
コード例 #2
0
ファイル: ShowSend.class.php プロジェクト: hylinux/ltebbs
 /**
  * 显示用户发送短信的界面
  */
 public function run()
 {
     //求得用户的id
     $user_id = UserUtil::getUserId($this->db, $_SESSION['user']['name']);
     $smarty = $this->getSmarty();
     $user_name = $_SESSION['user']['name'];
     $smarty->assign('view_user_name', $user_name);
     //用户的所在组
     $sql = 'select b.group_name from base_user_info as a join sys_group as b on ' . ' a.group_dep = b.id where a.id=?';
     $sth = $this->db->Prepare($sql);
     $res = $this->db->Execute($sth, array($user_id));
     $rows = $res->FetchRow();
     $smarty->assign('user_roles', $rows['group_name']);
     $user_header = UserUtil::getUserHeader($this->db, $user_id);
     $smarty->assign('head_url', $user_header);
     //查询新的短消息的数量
     $sql = 'select count(*) as num from message_inbox where user_id=? and is_read = 0 ';
     $sth = $this->db->Prepare($sql);
     $res = $this->db->Execute($sth, array($user_id));
     $rows = $res->FetchRow();
     $smarty->assign('new_message_label', $rows['num']);
     //共有短消息数
     $sql = 'select count(*) as num from message_inbox where user_id=? ';
     $sth = $this->db->Prepare($sql);
     $res = $this->db->Execute($sth, array($user_id));
     $rows = $res->FetchRow();
     $smarty->assign('total_message_number', $rows['num']);
     //取得用户注册时间
     $sql = 'select register_date from base_user_info where id=?';
     $stmt = $this->db->prepare($sql);
     $res = $this->db->CacheExecute(60 * 60, $stmt, array($user_id));
     $rows = $res->FetchRow();
     $smarty->assign('user_register_date', $rows['register_date']);
     //取得用户最后的登录时间
     $sql = 'SELECT from_unixtime(last_time) as lastlogout FROM `user_last_time_logout` where user_id=?';
     $stmt = $this->db->prepare($sql);
     $res = $this->db->CacheExecute(60 * 60, $stmt, array($user_id));
     $rows = $res->FetchRow();
     $smarty->assign('user_last_logout', $rows['lastlogout']);
     //发表的主题数
     $sql = 'select count(*) as num from bbs_subject where author = ?';
     $stmt = $this->db->Prepare($sql);
     $res = $this->db->CacheExecute(10, $stmt, array($user_name));
     $rows = $res->FetchRow();
     $smarty->assign('all_topic_number', $rows['num']);
     //参与的帖子数
     $sql = 'select count(*) as num from bbs_reply where author=?';
     $stmt = $this->db->Prepare($sql);
     $res = $this->db->CacheExecute(10, $stmt, array($user_name));
     $rows = $res->FetchRow();
     $smarty->assign('all_reply_number', $rows['num']);
     ///拥有的短消息的数量
     $sql = 'select count(*) as num from message_inbox where user_id=?';
     $stmt = $this->db->prepare($sql);
     $res = $this->db->CacheExecute(20, $stmt, array($user_id));
     $rows = $res->FetchRow();
     $number_inbox = $rows['num'];
     $sql = 'select count(*) as num from message_outbox where user_id=?';
     $stmt = $this->db->prepare($sql);
     $res = $this->db->CacheExecute(20, $stmt, array($user_id));
     $rows = $res->FetchRow();
     $smarty->assign('message_all_number', $number_inbox + $rows['num']);
     //拥有的收藏数
     $sql = 'select count(*) as num from favor where user_id=?';
     $stmt = $this->db->prepare($sql);
     $res = $this->db->CacheExecute(10, $stmt, array($user_id));
     $rows = $res->FetchRow();
     $smarty->assign('favor_amount', $rows['num']);
     $fck = new FCKeditor("content");
     $fck->BasePath = FCKEDITOR_BASEPATH;
     $fck->ToolbarSet = 'Basic';
     $fck->Height = '400';
     $fck->Width = '98%';
     $smarty->assign('fck', $fck);
     //检查用户是否传入了id
     //如果传入了id,则为其预填需要
     //发送的的用户名
     $send_user_id = $this->getParameter('id');
     $send_user_name = UserUtil::getUserNameById($this->db, $send_user_id);
     $smarty->assign('send_user_name', $send_user_name);
     $smarty->assign('backurl', $this->getParameter('backurl'));
     $smarty->display('showsend.tmpl');
 }
コード例 #3
0
ファイル: ViewUser.class.php プロジェクト: hylinux/ltebbs
 /**
  * 查看用户的个人信息
  * @param:  NULL
  * @return: NULL
  * @access: public
  */
 public function run()
 {
     //取得用户的id
     $user_id = $this->getParameterFromGET('id');
     if (!$user_id && $user_id != 0) {
         $this->AlertAndBack(VU_USER_ID_IS_EMPTY);
         return;
     }
     if ($user_id == 0) {
         $this->AlertAndBack(VU_USER_IS_SYSTEM);
         return;
     }
     if (!UserUtil::isExists($this->db, $user_id)) {
         $this->AlertAndBack(VU_USER_IS_NOT_EXISTS);
         return;
     }
     $smarty = $this->getSmarty();
     //back url
     $back_url = 'index.php?module=user&action=view&id=' . $user_id;
     $back_url = base64_encode($back_url);
     $smarty->assign('backurl', $back_url);
     //assign user id
     $smarty->assign('user_id', $user_id);
     //用户名
     $user_name = UserUtil::getUserNameById($this->db, $user_id);
     $smarty->assign('view_user_name', $user_name);
     //用户所在的组
     $sql = 'select b.group_name from base_user_info as a join sys_group as b on ' . ' a.group_dep = b.id where a.id=?';
     $sth = $this->db->Prepare($sql);
     $res = $this->db->Execute($sth, array($user_id));
     $rows = $res->FetchRow();
     $smarty->assign('user_roles', $rows['group_name']);
     //判断用户是否在线
     $sql = 'select count(*) as num from online_user where user_name =? ';
     $sth = $this->db->Prepare($sql);
     $res = $this->db->Execute($sth, array($user_name));
     $rows = $res->FetchRow();
     if ($rows['num']) {
         $smarty->assign('user_is_online', 1);
     } else {
         $smarty->assign('user_is_online', 0);
     }
     //求用户的头像
     $user_header = UserUtil::getUserHeader($this->db, $user_id);
     $smarty->assign('head_url', $user_header);
     $sql = 'select user_gender,user_birthday, public_birthday, user_email, public_user_email, ' . 'user_website, public_website, register_date, user_icq, public_user_icq, user_AIM, ' . 'public_user_AIM, user_msn, public_user_msn, user_yahoo, public_user_yahoo,user_skype, ' . ' public_user_skype, user_qq, public_user_qq, user_hometown, user_favor, user_sign ' . ' from base_user_info where id=?';
     $sth = $this->db->Prepare($sql);
     $res = $this->db->Execute($sth, array($user_id));
     $rows = $res->FetchRow();
     //性别
     $smarty->assign('user_sex', $rows['user_gender']);
     //生日
     if ($rows['public_birthday']) {
         $smarty->assign('user_birthday', $rows['user_birthday']);
     } else {
         $smarty->assign('user_birthday', VU_NOT_PUBLIC);
     }
     //电子邮件
     if ($rows['public_user_email']) {
         $smarty->assign('user_email', $rows['user_email']);
     } else {
         $smarty->assign('user_email', VU_NOT_PUBLIC);
     }
     //个人网站
     if ($rows['public_website']) {
         $smarty->assign('user_website', $rows['user_website']);
     } else {
         $smarty->assign('user_website', VU_NOT_PUBLIC);
     }
     //注册日期
     $smarty->assign('user_register_date', $rows['register_date']);
     //ICQ
     if ($rows['public_user_icq']) {
         $smarty->assign('user_icq', $rows['user_icq']);
     } else {
         $smarty->assign('user_icq', VU_NOT_PUBLIC);
     }
     //AIM
     if ($rows['public_user_AIM']) {
         $smarty->assign('user_aim', $rows['user_AIM']);
     } else {
         $smarty->assign('user_aim', VU_NOT_PUBLIC);
     }
     //MSN
     if ($rows['public_user_msn']) {
         $smarty->assign('user_msn', $rows['user_msn']);
     } else {
         $smarty->assign('user_msn', VU_NOT_PUBLIC);
     }
     //Yahoo
     if ($rows['public_user_yahoo']) {
         $smarty->assign('user_yahoo', $rows['user_yahoo']);
     } else {
         $smarty->assign('user_yahoo', VU_NOT_PUBLIC);
     }
     //skype
     if ($rows['public_user_skype']) {
         $smarty->assign('user_skype', $rows['user_skype']);
     } else {
         $smarty->assign('user_skype', VU_NOT_PUBLIC);
     }
     //QQ
     if ($rows['public_user_qq']) {
         $smarty->assign('user_qq', $rows['user_qq']);
     }
     //hometown
     $smarty->assign('user_home_town', $rows['user_hometown']);
     //user favor
     $smarty->assign('user_favor', $rows['user_favor']);
     //user sign
     $smarty->assign('user_sign', ConvertString($rows['user_sign'], ROOT_URL, IMAGE_URL . 'express/'));
     //用户的发帖数
     $topic_number = UserUtil::getUserCreateTopicNumber($this->db, $user_id);
     $smarty->assign('user_topic_number', $topic_number);
     $smarty->display('viewuser.tmpl');
 }