当前位置: 首页>>代码示例>>PHP>>正文


PHP UserUtil::getUserHeader方法代码示例

本文整理汇总了PHP中UserUtil::getUserHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP UserUtil::getUserHeader方法的具体用法?PHP UserUtil::getUserHeader怎么用?PHP UserUtil::getUserHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserUtil的用法示例。


在下文中一共展示了UserUtil::getUserHeader方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * 显示用户更改邮件和密码的界面
  * @param:  NULL
  * @return: NULL
  * @access: public
  */
 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']);
     //显示默认的头像
     $image_array = "";
     for ($i = 1; $i <= 37; $i++) {
         $image_array .= "<option value=" . $i . ">第" . $i . "个头像</option>\n";
     }
     $smarty->assign('image_options', $image_array);
     $smarty->display('userheader.tmpl');
 }
开发者ID:hylinux,项目名称:ltebbs,代码行数:83,代码来源:ShowUserHeader.class.php

示例2: run

 /**
  * 显示用户的控制面板
  */
 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']);
     $show_best = $this->getParameter('best');
     if ($show_best) {
         $show_best = 1;
     } else {
         $show_best = 0;
     }
     //取得导航栏菜单
     //开始检查帖子。
     $total_number = LayoutUtil::getTotalNumberTopicByUser($this->db, $user_name, $show_best);
     //求总公的页面
     $total_page = ceil($total_number / $this->page_number);
     //取得当前的页面
     $page = $this->getParameter('page');
     if (!$page || $page < 0) {
         $page = 1;
     }
     if ($page > $total_page && $total_page > 0) {
         $page = $total_page;
     }
     $begin_page = 1;
     $end_page = $total_page;
     if ($page <= 10 && $total_page >= 10) {
         $end_page = 10;
     } else {
         if ($page > 10) {
             if ($page % 10 == 0) {
                 //向前翻
                 $end_page = $page;
                 $begin_page = $end_page - 9;
//.........这里部分代码省略.........
开发者ID:hylinux,项目名称:ltebbs,代码行数:101,代码来源:ListMyTopic.class.php

示例3: run

 /**
  * 显示用户的短消息收件箱
  * @param:  NULL
  * @return: NULL
  * @access: public
  */
 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']);
     //求页数
     $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();
     $total_number = $rows['num'];
     //求总公的页面
     $total_page = ceil($total_number / $this->page_number);
     //取得当前的页面
     $page = $this->getParameter('page');
     if (!$page || $page < 0) {
         $page = 1;
     }
     if ($page > $total_page && $total_page > 0) {
         $page = $total_page;
     }
     $begin_page = 1;
     $end_page = $total_page;
     if ($page <= 10 && $total_page >= 10) {
         $end_page = 10;
     } else {
         if ($page > 10) {
             if ($page % 10 == 0) {
                 //向前翻
                 $end_page = $page;
//.........这里部分代码省略.........
开发者ID:hylinux,项目名称:ltebbs,代码行数:101,代码来源:InBox.class.php

示例4: run

 /**
  * 显示用户的控制面板
  */
 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 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']);
     ///拥有的短消息的数量
     $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']);
     //最新的5条短消息
     $sql = 'select a.id, a.user_id, b.user_name,a.send_user_id, ' . 'a.title, a.receive_time, a.is_read ' . ' from message_inbox as a, base_user_info as b  where a.send_user_id = b.id and a.user_id=? ' . ' order by a.id desc';
     $stmt = $this->db->prepare($sql);
     $res = $this->db->CacheSelectLimit(20, $stmt, 5, 1, array($user_id));
     $rows = $res->GetArray();
     $smarty->assign('msg', $rows);
     //最新5条发表的主题
     $subject_array = LayoutUtil::getSubjectInfoByUser($this->db, $user_name);
     $smarty->assign('subject', $subject_array);
     //最新参与的5条主题
     $reply_array = LayoutUtil::getReplyInfoByUser($this->db, $user_name);
     $smarty->assign('reply', $reply_array);
     //最新的5条收藏
     $favor_array = LayoutUtil::getSubjectInfoByFavor($this->db, $user_id);
     $smarty->assign('favor', $favor_array);
     $smarty->display('usercontrol.tmpl');
 }
开发者ID:hylinux,项目名称:ltebbs,代码行数:88,代码来源:ShowControl.class.php

示例5: run


//.........这里部分代码省略.........
     $smarty->assign('m', $m);
     if ($m) {
         $where_sql .= ' and ( group_dep = 1 or group_dep = 2 or group_dep = 3 ) ';
     }
     if (strlen($where_sql) > 0) {
         $where_sql = ' where 1 ' . $where_sql;
     }
     if ($m) {
         $smarty->assign('user_list_label', LU_MANAGER_LABEL);
     } else {
         $smarty->assign('user_list_label', LU_USER_LIST);
     }
     //求总的数量
     $sql = 'select count(*) as num from base_user_info ' . $where_sql;
     $res = $this->db->Execute($sql);
     $rows = $res->FetchRow();
     $total_number = $rows['num'];
     //求总公的页面
     $total_page = ceil($total_number / $this->page_number);
     //取得当前的页面
     $page = $this->getParameter('page');
     if (!$page || $page < 0) {
         $page = 1;
     }
     if ($page > $total_page && $total_page > 0) {
         $page = $total_page;
     }
     $begin_page = 1;
     $end_page = $total_page;
     if ($page <= 10 && $total_page >= 10) {
         $end_page = 10;
     } else {
         if ($page > 10) {
             if ($page % 10 == 0) {
                 //向前翻
                 $end_page = $page;
                 $begin_page = $end_page - 9;
             } else {
                 if ($page % 10 == 1) {
                     //向后翻
                     //确定开始的页数
                     $begin_page = $page;
                     if ($begin_page > $total_page) {
                         $begin_page = $page - 9;
                     }
                     if ($begin_page + 9 > $total_page) {
                         $end_page = $total_page;
                     } else {
                         $end_page = $begin_page + 9;
                     }
                 } else {
                     $num = $page % 10;
                     $pre_num = floor($page / 10);
                     $begin_page = $pre_num * 10 + 1;
                     $end_page = $begin_page + 9;
                 }
             }
         }
     }
     $nav_page_array = array();
     for ($i = $begin_page; $i <= $end_page; $i++) {
         array_push($nav_page_array, $i);
     }
     //帖子导航栏
     $smarty->assign('nav_page', $nav_page_array);
     //当前的页面
     $smarty->assign('now_page', $page);
     //共有的页面
     $smarty->assign('total_page', $total_page);
     //显示搜索结果
     //求出偏移
     $offset_number = ($page - 1) * $this->page_number;
     //求用户的情况
     $sql = 'select a.id, a.user_name, a.register_date, b.group_name, a.status from ' . '  base_user_info a join ' . ' sys_group b on a.group_dep = b.id ' . $where_sql . ' order by a.user_name asc ';
     $res = $this->db->SelectLimit($sql, $this->page_number, $offset_number);
     $temp_array = array();
     while ($rows = $res->FetchRow()) {
         $temp_sql = 'select count(*) as num from bbs_subject where author=?';
         $temp_sth = $this->db->Prepare($temp_sql);
         $temp_res = $this->db->Execute($temp_sth, array($rows['user_name']));
         $temp_rows = $temp_res->FetchRow();
         $topic_number = $temp_rows['num'];
         $temp_sql = 'select last_time from  user_last_time_logout where user_id=?  order by id desc';
         $temp_sth = $this->db->Prepare($temp_sql);
         $temp_res = $this->db->Execute($temp_sth, array($rows['id']));
         $temp_rows = $temp_res->FetchRow();
         $last_access_time = $temp_rows['last_time'];
         $temp_sql = 'select count(*) as num from black_list_by_user where user_name=?';
         $temp_sth = $this->db->Prepare($temp_sql);
         $temp_res = $this->db->Execute($temp_sth, array($rows['user_name']));
         $temp_rows = $temp_res->FetchRow();
         $was_added = $temp_rows['num'];
         //取得头像
         $user_header = UserUtil::getUserHeader($this->db, $rows['id']);
         $temp_array[] = array('id' => $rows['id'], 'name' => $rows['user_name'], 'group' => $rows['group_name'], 'register_date' => $rows['register_date'], 'topic_number' => $topic_number, 'last_access_time' => $last_access_time, 'header' => $user_header, 'status' => $rows['status'], 'was_add' => $was_added);
     }
     $smarty->assign('myuser', $temp_array);
     $smarty->display('adminshowuser.tmpl');
     return;
 }
开发者ID:hylinux,项目名称:ltebbs,代码行数:101,代码来源:ShowUser.class.php

示例6: run

 /**
  * 显示短消息的内容
  * @param:  NULL
  * @return: NULL
  * @access: public
  */
 public function run()
 {
     //读取用户传入的id
     $id = $this->getParameterFromGET('id');
     if (!$id) {
         $this->AlertAndBack(SR_ID_IS_EMPTY);
         return;
     }
     //求得用户的id
     $user_id = UserUtil::getUserId($this->db, $_SESSION['user']['name']);
     //验证id是否存在
     $sql = 'select count(*) as num from message_inbox where id=? and user_id=?';
     $sth = $this->db->Prepare($sql);
     $res = $this->db->Execute($sth, array($id, $user_id));
     $rows = $res->FetchRow();
     if (!$rows['num']) {
         $this->AlertAndBack(SR_ID_IS_NOT_EXISTS_OR_NOT_BELONE_USER);
         return;
     }
     $smarty = $this->getSmarty();
     $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']);
     //使得短消息成为已读
     $sql = 'update message_inbox set is_read = 1 where id=?';
     $sth = $this->db->Prepare($sql);
     $this->db->Execute($sth, array($id));
     //查询短消息的内容
     $sql = 'select a.title, a.send_user_id, a.receive_time, a.content, ' . ' b.user_name from message_inbox a ' . ' left join base_user_info b on a.send_user_id = b.id where a.id=?';
     $sth = $this->db->Prepare($sql);
     $res = $this->db->Execute($sth, array($id));
     $rows = $res->FetchRow();
//.........这里部分代码省略.........
开发者ID:hylinux,项目名称:ltebbs,代码行数:101,代码来源:ShowReceiveMsg.class.php

示例7: run

 /**
  * 显示用户发送短信的界面
  */
 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');
 }
开发者ID:hylinux,项目名称:ltebbs,代码行数:86,代码来源:ShowSend.class.php

示例8: run

 /**
  * 查看用户的个人信息
  * @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);
//.........这里部分代码省略.........
开发者ID:hylinux,项目名称:ltebbs,代码行数:101,代码来源:ViewUser.class.php

示例9: getTopicInfo

 /**
  * 取得帖子的信息
  * @param:  &$db
  * @param:  $id
  * @param:  $pre_page
  * @param:  $offset_page
  * @return: $topic_array 
  * @access: public
  * @static
  */
 public static function getTopicInfo(&$db, $id, $pre_page = 10, $offset_page = 0)
 {
     /*{{{*/
     $topic_array = array();
     $topic_status = self::getTopicStatus($db, $id);
     //如果显示第一页,则必须给出主题
     if ($offset_page == 0) {
         $sql = 'select title, express, author, content, post_date, is_edit, ' . ' edit_user, edit_time, subject_status, is_best, is_top from bbs_subject where id=?';
         $sth = $db->Prepare($sql);
         $res = $db->Execute($sth, array($id));
         $rows = $res->FetchRow();
         $posttime = set_locale_time($rows['post_date']);
         $user_name = $rows['author'];
         $user_id = UserUtil::getUserId($db, $user_name);
         $user_header = UserUtil::getUserHeader($db, $user_id);
         $user_info = UserUtil::getUserInfo($db, $user_id);
         $register_date = $user_info['register_date'];
         $user_level = $user_info['user_level'];
         $user_address = $user_info['user_hometown'];
         $user_topic_number = $user_info['user_topic'];
         $user_sign = ConvertString($user_info['user_sign'], ROOT_URL, IMAGE_URL . 'express/');
         $is_edit = 0;
         $edit_user = '';
         $edit_time = '';
         if ($rows['is_edit']) {
             $is_edit = 1;
             $edit_user = $rows['edit_user'];
             $edit_time = $rows['edit_time'];
         }
         $user_online = UserUtil::isOnline($db, $user_id);
         $user_can_be_edit = 0;
         if (!$_SESSION['user']['name']) {
             $user_can_be_edit = 0;
         } else {
             if (strtolower($_SESSION['user']['name']) == strtolower($user_name)) {
                 $user_can_be_edit = 1;
             } else {
                 if (strtolower($_SESSION['user']['name']) != strtolower($user_name)) {
                     //判断用户是否是这个版块的版主。
                     $dep = UserUtil::getUserDep($db, $_SESSION['user']['name']);
                     if ($dep == 1 || $dep == 2) {
                         $user_can_be_edit = 1;
                     } else {
                         if ($dep == 3) {
                             $temp_layout_id = self::getLayoutId($db, $id);
                             $user_can_be_edit = UserUtil::isThisLayoutAdmin($db, $id, $temp_layout_id, $_SESSION['user']['name']);
                         }
                     }
                 }
             }
         }
         //判断是否有附件
         //如果有附件,则使用代码替换
         $content = '';
         if ($topic_status == 2) {
             $content = TU_TOPIC_WAS_LOCKED;
         } else {
             $content = $rows['content'] . self::haveAttach($db, $id);
             if ($is_edit) {
                 $attach_string = TU_SUB_TITLE . $edit_user . TU_FROM . $edit_time . TU_EDIT;
                 $content .= "\n\n" . $attach_string;
             }
         }
         $title = $rows['title'];
         $title = htmlspecialchars($title);
         if ($rows['is_best']) {
             $title = "<font color=red>[" . BEST_LABEL . "]</font>" . $title;
         }
         if ($rows['is_top']) {
             $title = "<font color=red>[" . TOP_LABEL . "]</font>" . $title;
         }
         $topic_array[] = array('id' => $id, 'posttime' => $posttime, 'sort_number' => 1, 'user_name' => $user_name, 'user_id' => $user_id, 'user_header' => $user_header, 'user_sign' => $user_sign, 'register_date' => $register_date, 'user_level' => $user_level, 'user_address' => $user_address, 'user_topic_number' => $user_topic_number, 'title' => $title, 'content' => ConvertString($content, ROOT_URL, IMAGE_URL . 'express/'), 'online' => $user_online, 'can_be_edit' => $user_can_be_edit, 'is_topic' => 1, 'express' => $rows['express']);
         $pre_page = $pre_page - 1;
     } else {
         if ($offset_page >= 1) {
             $offset_page = $offset_page - 1;
         }
     }
     //再查回复的帖子
     $sql = 'select id, title, express,author, content, post_date, is_edit, edit_user, ' . ' edit_time, reply_status from bbs_reply where subject_id=? ' . ' order by id asc';
     $res = $db->SelectLimit($sql, $pre_page, $offset_page, array($id));
     while ($rows = $res->FetchRow()) {
         $posttime = set_locale_time($rows['post_date']);
         $sort_number = $sort_begin;
         $user_name = $rows['author'];
         $user_id = UserUtil::getUserId($db, $user_name);
         $user_header = UserUtil::getUserHeader($db, $user_id);
         $user_info = UserUtil::getUserInfo($db, $user_id);
         $register_date = $user_info['register_date'];
         $user_level = $user_info['user_level'];
//.........这里部分代码省略.........
开发者ID:hylinux,项目名称:ltebbs,代码行数:101,代码来源:TopicUtil.class.php

示例10: run

 /**
  * 显示用户更改基本资料界面
  * @param:  NULL
  * @return: NULL
  * @access: public
  */
 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']);
     //查询用户现在的邮件
     $sql = 'select user_email, public_user_email 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_email', $rows['user_email']);
     $smarty->assign('email_public', $rows['public_user_email']);
     //显示用户的头像
     $smarty->assign('user_header', UserUtil::getUserHeader($this->db, $user_id));
     //取得用户的性别
     $sql = 'select user_gender, user_hometown, year(user_birthday) as byear, ' . 'month(user_birthday) as bmonth, day(user_birthday) as bday, ' . 'user_website, public_website,public_birthday,' . 'user_qq, public_user_qq, user_msn,public_user_msn, ' . 'user_skype, public_user_skype,' . 'user_sign from base_user_info where id=?';
     $stmt = $this->db->prepare($sql);
     $res = $this->db->Execute($stmt, array($user_id));
     $rows = $res->FetchRow();
     $smarty->assign('user_gender', $rows['user_gender']);
     $smarty->assign('user_website', $rows['user_website']);
     $smarty->assign('public_birthday', $rows['public_birthday']);
     $smarty->assign('public_website', $rows['public_website']);
     $smarty->assign('user_hometown', $rows['user_hometown']);
     $smarty->assign('user_qq', $rows['user_qq']);
     $smarty->assign('public_user_qq', $rows['public_user_qq']);
     $smarty->assign('user_msn', $rows['user_msn']);
     $smarty->assign('public_user_msn', $rows['public_user_msn']);
     $smarty->assign('user_skype', $rows['user_skype']);
     $smarty->assign('public_user_skype', $rows['public_user_skype']);
     //使用fckeditor
     $fck = new FCKeditor("user_sign");
     $fck->BasePath = FCKEDITOR_BASEPATH;
     $fck->ToolbarSet = 'Basic';
     $fck->Height = '200';
     $fck->Value = get_magic_quotes_gpc() ? stripslashes($rows['user_sign']) : $rows['user_sign'];
     $fck->Width = '98%';
     $smarty->assign('fck', $fck);
     //年月日
     $year_option = '';
     for ($i = 1959; $i <= 1997; $i++) {
         $year_option .= "<option value='{$i}'";
         if ($rows['byear'] == $i) {
             $year_option .= ' selected ';
         }
         $year_option .= " >{$i}</option>\n";
     }
     $smarty->assign('birthday_year', $year_option);
     $month_option = '';
     for ($i = 1; $i <= 12; $i++) {
         $month_option .= "<option value='{$i}' ";
         if ($rows['bmonth'] == $i) {
             $month_option .= ' selected ';
         }
         $month_option .= ">{$i}</option>\n";
     }
     $smarty->assign('birthday_month', $month_option);
     $day_option = '';
     for ($i = 1; $i <= 31; $i++) {
         $day_option .= "<option value='{$i}'";
         if ($rows['bday'] == $i) {
             $day_option .= ' selected ';
         }
         $day_option .= ">{$i}</option>\n";
     }
     $smarty->assign('birthday_day', $day_option);
     //取得用户的扩展设置
     $sql = 'select user_lang, user_theme, user_whether_receive_email, receive_system_message ' . ' from user_setting where user_id=?';
     $stmt = $this->db->prepare($sql);
     $res = $this->db->Execute($stmt, array($user_id));
     $rows = $res->FetchRow();
     $smarty->assign('user_theme', $rows['user_theme']);
     $smarty->assign('receive_system_email', $rows['user_whether_receive_email']);
     $smarty->assign('receive_system_message', $rows['receive_system_message']);
     $smarty->display('showeditinfo.tmpl');
 }
开发者ID:hylinux,项目名称:ltebbs,代码行数:90,代码来源:ShowEditInfo.class.php


注:本文中的UserUtil::getUserHeader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。