當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。