function get_all_users() { $link = open_database_connection(); $query = "SELECT * FROM users ORDER BY uid ASC"; $users = array(); if ($result = mysqli_query($link, $query)) { // fetch associative array while ($row = mysqli_fetch_assoc($result)) { $row['tags'] = get_user_tags($row['uid']); $row['equipments'] = get_user_equipments($row['uid']); $users[] = $row; } // free result set mysqli_free_result($result); } // close connection mysqli_close($link); return $users; }
function dashboard_action() { // needed to hide the menu $dashboard_active = true; // dealing with order form if (isset($_POST['client'])) { new_order($_POST); } // dealing with transfers if (intval($_POST['transfers']) > 0) { new_transfer($_POST['recipient'], $_POST['transfers'], $_POST); } // dealing with message form if (isset($_POST['message'])) { add_message($_POST['uid'], $_POST['message']); } // if order form is needed if (isset($_GET['uid'])) { // get all the snacks $snacks = get_visible_snacks(); $client = get_user_by_uid($_GET['uid']); $client['lastorder'] = get_last_order_timestamp_by_uid($client['uid']); $client['lastpayment'] = get_last_payment_by_uid($client['uid']); $client['tags'] = get_user_tags($client['uid']); $client['equipments'] = get_user_equipments($client['uid']); $client['jobs'] = get_jobs_by_uid($client['uid']); } else { $messages = get_all_messages(); $events = get_google_calendar_events(); $first_coffee = get_first_coffee(); $jobs = get_last_jobs(); } // get all the users $users = get_all_users_sorted_by_balance_descending(); require 'templates/dashboard.php'; }
$pager = get_pager('user.php', array('act' => $action), $record_count, $page, 5); $smarty->assign('comment_list', get_comment_list($user_id, $pager['size'], $pager['start'])); $smarty->assign('pager', $pager); $smarty->display('user_clips.dwt'); } elseif ($action == 'act_add_message') { include_once ROOT_PATH . 'includes/lib_clips.php'; $message = array('user_id' => $user_id, 'user_name' => $_SESSION['user_name'], 'user_email' => $_SESSION['email'], 'msg_type' => isset($_POST['msg_type']) ? intval($_POST['msg_type']) : 0, 'msg_title' => isset($_POST['msg_title']) ? trim($_POST['msg_title']) : '', 'msg_content' => isset($_POST['msg_content']) ? trim($_POST['msg_content']) : '', 'order_id' => empty($_POST['order_id']) ? 0 : intval($_POST['order_id']), 'upload' => isset($_FILES['message_img']['error']) && $_FILES['message_img']['error'] == 0 || !isset($_FILES['message_img']['error']) && isset($_FILES['message_img']['tmp_name']) && $_FILES['message_img']['tmp_name'] != 'none' ? $_FILES['message_img'] : array()); if (add_message($message)) { show_message($_LANG['add_message_success'], $_LANG['message_list_lnk'], 'user.php?act=message_list&order_id=' . $message['order_id'], 'info'); } else { $err->show($_LANG['message_list_lnk'], 'user.php?act=message_list'); } } elseif ($action == 'tag_list') { include_once ROOT_PATH . 'includes/lib_clips.php'; $good_id = isset($_GET['id']) ? intval($_GET['id']) : 0; $smarty->assign('tags', get_user_tags($user_id)); $smarty->assign('tags_from', 'user'); $smarty->display('user_clips.dwt'); } elseif ($action == 'act_del_tag') { include_once ROOT_PATH . 'includes/lib_clips.php'; $tag_words = isset($_GET['tag_words']) ? trim($_GET['tag_words']) : ''; delete_tag($tag_words, $user_id); ecs_header("Location: user.php?act=tag_list\n"); exit; } elseif ($action == 'booking_list') { include_once ROOT_PATH . 'includes/lib_clips.php'; $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; /* 获取缺货登记的数量 */ $sql = "SELECT COUNT(*) " . "FROM " . $ecs->table('booking_goods') . " AS bg, " . $ecs->table('goods') . " AS g " . "WHERE bg.goods_id = g.goods_id AND user_id = '{$user_id}'"; $record_count = $db->getOne($sql); $pager = get_pager('user.php', array('act' => $action), $record_count, $page);
function action_tag_list() { $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $user_id = $_SESSION['user_id']; include_once ROOT_PATH . 'includes/lib_clips.php'; $good_id = isset($_GET['id']) ? intval($_GET['id']) : 0; $smarty->assign('tags', get_user_tags($user_id)); $smarty->assign('tags_from', 'user'); $smarty->display('user_clips.dwt'); }
/** * 我的标签 */ public function tag_list() { $tags = get_user_tags($this->user_id); $this->assign('title', L('label_tag')); $this->assign('tags', $tags); $this->display('user_tag_list.dwt'); }
<?php // require 'page_top.html'; require '../config.php'; require '../db_lib.php'; $db = new db(); $report_name = 'user_tags.php'; require 'select_next_prev.php'; print '<h2>Top Tags in User Descriptions</h2>'; require '../get_user_tags.php'; $tags = get_user_tags($page * $results_per_page, $results_per_page); if (sizeof($tags)) { $tag_html = '<table><th align="left">Count</th><th align="left">Tag</th>'; foreach ($tags as $tag) { $tag_html .= '<tr><td style="width:60px">' . number_format($tag['cnt']) . '</td><td><a href="https://twitter.com/search?q=%23' . $tag['tag'] . '">' . $tag['tag'] . '</a></td></tr>'; } $tag_html .= '</table>'; print $tag_html; } else { print "No tags found"; } require 'page_bottom.html';