function userlogin() { global $INSTALLER09, $mc1, $CURBLOCK, $mood, $whereis; unset($GLOBALS["CURUSER"]); $dt = TIME_NOW; $ip = getip(); $nip = ip2long($ip); $ipf = $_SERVER['REMOTE_ADDR']; if (isset($CURUSER)) { return; } if (!$INSTALLER09['site_online'] || !get_mycookie('uid') || !get_mycookie('pass') || !get_mycookie('hashv')) { return; } $id = 0 + get_mycookie('uid'); if (!$id or strlen(get_mycookie('pass')) != 32 or get_mycookie('hashv') != hashit($id, get_mycookie('pass'))) { return; } // let's cache $CURUSER - pdq if (($row = $mc1->get_value('MyUser_' . $id)) === false) { // $row not found $user_fields = 'id, username, passhash, secret, passkey, email, status, added, ' . 'last_login, last_access, curr_ann_last_check, curr_ann_id, editsecret, privacy, stylesheet, ' . 'info, acceptpms, ip, class, override_class, language, avatar, av_w, av_h, ' . 'title, country, notifs, enabled, donor, warned, torrentsperpage, topicsperpage, ' . 'postsperpage, deletepms, savepms, reputation, time_offset, dst_in_use, auto_correct_dst, ' . 'show_shout, show_staffshout, shoutboxbg, chatpost, smile_until, vip_added, vip_until, ' . 'freeslots, free_switch, invites, invitedby, invite_rights, anonymous, uploadpos, forumpost, ' . 'downloadpos, immunity, leechwarn, disable_reason, clear_new_tag_manually, last_browse, sig_w, ' . 'sig_h, signatures, signature, forum_access, highspeed, hnrwarn, hit_and_run_total, donoruntil, ' . 'donated, total_donated, vipclass_before, parked, passhint, hintanswer, avatarpos, support, ' . 'supportfor, sendpmpos, invitedate, invitees, invite_on, subscription_pm, gender, anonymous_until, ' . 'viewscloud, tenpercent, avatars, offavatar, pirate, king, hidecur, ssluse, signature_post, forum_post, ' . 'avatar_rights, offensive_avatar, view_offensive_avatar, paranoia, google_talk, msn, aim, yahoo, website, ' . 'icq, show_email, parked_until, gotgift, hash1, suspended, bjwins, bjlosses, warn_reason, onirc, irctotal, ' . 'birthday, got_blocks, last_access_numb, onlinetime, pm_on_delete, commentpm, split, browser, hits, ' . 'comments, categorie_icon, reputation, perms, mood, got_moods, pms_per_page, show_pm_avatar, watched_user, game_access, browse_icons'; $res = sql_query("SELECT " . $user_fields . " " . "FROM users " . "WHERE id = " . sqlesc($id) . " " . "AND enabled='yes' " . "AND status = 'confirmed'") or sqlerr(__FILE__, __LINE__); if (mysqli_num_rows($res) == 0) { logoutcookie(); return; } $row = mysqli_fetch_assoc($res); // Do all ints and floats $row['id'] = (int) $row['id']; $row['added'] = (int) $row['added']; $row['last_login'] = (int) $row['last_login']; $row['last_access'] = (int) $row['last_access']; $row['curr_ann_last_check'] = (int) $row['curr_ann_last_check']; $row['curr_ann_id'] = (int) $row['curr_ann_id']; $row['stylesheet'] = (int) $row['stylesheet']; $row['class'] = (int) $row['class']; $row['override_class'] = (int) $row['override_class']; $row['av_w'] = (int) $row['av_w']; $row['av_h'] = (int) $row['av_h']; $row['country'] = (int) $row['country']; $row['warned'] = (int) $row['warned']; $row['torrentsperpage'] = (int) $row['torrentsperpage']; $row['topicsperpage'] = (int) $row['topicsperpage']; $row['postsperpage'] = (int) $row['postsperpage']; $row['reputation'] = (int) $row['reputation']; $row['time_offset'] = (double) $row['time_offset']; $row['dst_in_use'] = (int) $row['dst_in_use']; $row['auto_correct_dst'] = (int) $row['auto_correct_dst']; $row['chatpost'] = (int) $row['chatpost']; $row['smile_until'] = (int) $row['smile_until']; $row['vip_until'] = (int) $row['vip_until']; $row['freeslots'] = (int) $row['freeslots']; $row['free_switch'] = (int) $row['free_switch']; $row['invites'] = (int) $row['invites']; $row['invitedby'] = (int) $row['invitedby']; $row['anonymous'] = $row['anonymous']; $row['uploadpos'] = (int) $row['uploadpos']; $row['forumpost'] = (int) $row['forumpost']; $row['downloadpos'] = (int) $row['downloadpos']; $row['immunity'] = (int) $row['immunity']; $row['leechwarn'] = (int) $row['leechwarn']; $row['last_browse'] = (int) $row['last_browse']; $row['sig_w'] = (int) $row['sig_w']; $row['sig_h'] = (int) $row['sig_h']; $row['forum_access'] = (int) $row['forum_access']; $row['hit_and_run_total'] = (int) $row['hit_and_run_total']; $row['donoruntil'] = (int) $row['donoruntil']; $row['donated'] = (int) $row['donated']; $row['total_donated'] = (double) $row['total_donated']; $row['vipclass_before'] = (int) $row['vipclass_before']; $row['passhint'] = (int) $row['passhint']; $row['avatarpos'] = (int) $row['avatarpos']; $row['language'] = (int) $row['language']; $row['sendpmpos'] = (int) $row['sendpmpos']; $row['invitedate'] = (int) $row['invitedate']; $row['anonymous_until'] = (int) $row['anonymous_until']; $row['pirate'] = (int) $row['pirate']; $row['king'] = (int) $row['king']; $row['ssluse'] = (int) $row['ssluse']; $row['paranoia'] = (int) $row['paranoia']; $row['parked_until'] = (int) $row['parked_until']; $row['bjwins'] = (int) $row['bjwins']; $row['bjlosses'] = (int) $row['bjlosses']; $row['irctotal'] = (int) $row['irctotal']; $row['last_access_numb'] = (int) $row['last_access_numb']; $row['onlinetime'] = (int) $row['onlinetime']; $row['categorie_icon'] = (int) $row['categorie_icon']; $row['perms'] = (int) $row['perms']; $row['mood'] = (int) $row['mood']; $row['watched_user'] = (int) $row['watched_user']; $row['pms_per_page'] = (int) $row['pms_per_page']; $row['game_access'] = (int) $row['game_access']; $row['rep'] = get_reputation($row); $mc1->cache_value('MyUser_' . $id, $row, $INSTALLER09['expires']['curuser']); unset($res); } //== if (get_mycookie('pass') !== md5($row["passhash"] . $_SERVER["REMOTE_ADDR"])) { logoutcookie(); return; } // bans by djGrrr <3 pdq if (!isset($row['perms']) || !($row['perms'] & bt_options::PERMS_BYPASS_BAN)) { $banned = false; if (check_bans($ip, $reason)) { $banned = true; } else { if ($ip != $ipf) { if (check_bans($ipf, $reason)) { $banned = true; } } } if ($banned) { header('Content-Type: text/html; charset=utf-8'); echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <title>Forbidden</title> </head><body> <h1>403 Forbidden</h1>Unauthorized IP address! <p>Reason: <strong>' . htmlsafechars($reason) . '</strong></p> </body></html>'; die; } } // Allowed staff if ($row["class"] >= UC_STAFF) { $allowed_ID = $INSTALLER09['allowed_staff']['id']; if (!in_array((int) $row["id"], $allowed_ID, true)) { $msg = "Fake Account Detected: Username: "******"username"]) . " - UserID: " . (int) $row["id"] . " - UserIP : " . getip(); // Demote and disable sql_query("UPDATE users SET enabled = 'no', class = 0 WHERE id =" . sqlesc($row["id"])) or sqlerr(__FILE__, __LINE__); $mc1->begin_transaction('MyUser_' . $row['id']); $mc1->update_row(false, array('enabled' => 'no', 'class' => 0)); $mc1->commit_transaction($INSTALLER09['expires']['curuser']); $mc1->begin_transaction('user' . $row['id']); $mc1->update_row(false, array('enabled' => 'no', 'class' => 0)); $mc1->commit_transaction($INSTALLER09['expires']['user_cache']); write_log($msg); logoutcookie(); } } // user stats if (($stats = $mc1->get_value('userstats_' . $id)) === false) { $sql = sql_query('SELECT uploaded, downloaded, seedbonus FROM users WHERE id = ' . sqlesc($id)) or sqlerr(__FILE__, __LINE__); $stats = mysqli_fetch_assoc($sql); $stats['seedbonus'] = (double) $stats['seedbonus']; $stats['uploaded'] = (double) $stats['uploaded']; $stats['downloaded'] = (double) $stats['downloaded']; $ratio = $stats['downloaded'] > 0 ? $stats['uploaded'] / $stats['downloaded'] : 0; $stats['ratio'] = number_format($ratio, 2); $mc1->cache_value('userstats_' . $id, $stats, $INSTALLER09['expires']['u_stats']); // 5 mins } $row['seedbonus'] = $stats['seedbonus']; $row['uploaded'] = $stats['uploaded']; $row['downloaded'] = $stats['downloaded']; $row['ratio'] = $stats['ratio']; //== if (($ustatus = $mc1->get_value('userstatus_' . $id)) === false) { $sql2 = sql_query('SELECT * FROM ustatus WHERE userid = ' . sqlesc($id)); if (mysqli_num_rows($sql2)) { $ustatus = mysqli_fetch_assoc($sql2); } else { $ustatus = array('last_status' => '', 'last_update' => 0, 'archive' => ''); } $mc1->add_value('userstatus_' . $id, $ustatus, $INSTALLER09['expires']['u_status']); // 30 days } $row['last_status'] = $ustatus['last_status']; $row['last_update'] = $ustatus['last_update']; $row['archive'] = $ustatus['archive']; //== if ($row['ssluse'] > 1 && !isset($_SERVER['HTTPS']) && !defined('NO_FORCE_SSL')) { $INSTALLER09['baseurl'] = str_replace('http', 'https', $INSTALLER09['baseurl']); header('Location: ' . $INSTALLER09['baseurl'] . $_SERVER['REQUEST_URI']); exit; } // bitwise curuser bloks by pdq $blocks_key = 'blocks::' . $row['id']; if (($CURBLOCK = $mc1->get_value($blocks_key)) === false) { $c_sql = sql_query('SELECT * FROM user_blocks WHERE userid = ' . sqlesc($row['id'])) or sqlerr(__FILE__, __LINE__); if (mysqli_num_rows($c_sql) == 0) { sql_query('INSERT INTO user_blocks(userid) VALUES(' . sqlesc($row['id']) . ')'); header('Location: index.php'); die; } $CURBLOCK = mysqli_fetch_assoc($c_sql); $CURBLOCK['index_page'] = (int) $CURBLOCK['index_page']; $CURBLOCK['global_stdhead'] = (int) $CURBLOCK['global_stdhead']; $CURBLOCK['userdetails_page'] = (int) $CURBLOCK['userdetails_page']; $mc1->cache_value($blocks_key, $CURBLOCK, 0); } //== online time pdq, original code by superman $userupdate0 = 'onlinetime = onlinetime + 0'; $new_time = TIME_NOW - $row['last_access_numb']; $update_time = 0; if ($new_time < 300) { $userupdate0 = "onlinetime = onlinetime + " . $new_time; $update_time = $new_time; } $userupdate1 = "last_access_numb = " . TIME_NOW; //end online-time $update_time = $row['onlinetime'] + $update_time; if ($row['last_access'] != '0' and $row['last_access'] < TIME_NOW - 180) { sql_query("UPDATE users SET last_access=" . TIME_NOW . ", {$userupdate0}, {$userupdate1} WHERE id=" . sqlesc($row['id'])); $mc1->begin_transaction('MyUser_' . $row['id']); $mc1->update_row(false, array('last_access' => TIME_NOW, 'onlinetime' => $update_time, 'last_access_numb' => TIME_NOW)); $mc1->commit_transaction($INSTALLER09['expires']['curuser']); $mc1->begin_transaction('user' . $row['id']); $mc1->update_row(false, array('last_access' => TIME_NOW, 'onlinetime' => $update_time, 'last_access_numb' => TIME_NOW)); $mc1->commit_transaction($INSTALLER09['expires']['user_cache']); } //== if ($row['override_class'] < $row['class']) { $row['class'] = $row['override_class']; } // Override class and save in GLOBAL array below. $GLOBALS["CURUSER"] = $row; get_template(); $mood = create_moods(); }
$att_str = count(array_unique($likes)) . ' others like this'; } } } $wht = !empty($likes) && count(array_unique($likes)) > 0 && in_array($CURUSER['id'], $likes) ? 'unlike' : 'like'; // --------------- likes end------ $lpr = (int) $arr['last_post_read']; $postid = (int) $arr["id"]; $postadd = (int) $arr['added']; $posterid = (int) $arr['user_id']; $posticon = $arr["icon"] > 0 ? "<img src=\"{$INSTALLER09['pic_base_url']}post_icons/icon" . htmlsafechars($arr["icon"]) . ".gif\" style=\"padding-left:3px;\" alt=\"post icon\" title=\"post icon\" />" : " "; $added = get_date($arr['added'], 'DATE', 1, 0) . " GMT <font class='small'>(" . get_date($arr['added'], 'LONG', 1, 0) . ")</font>"; // ---- Get poster details $uploaded = mksize($arr['uploaded']); $downloaded = mksize($arr['downloaded']); $member_reputation = $arr['uusername'] != '' ? get_reputation($arr, 'posts', TRUE, $postid) : ''; $last_access = get_date($arr['last_access'], 'DATE', 1, 0); $Ratio = member_ratio($arr['uploaded'], $INSTALLER09['ratio_free'] ? '0' : $arr['downloaded']); if ($postid > $lpr && $postadd > TIME_NOW - $INSTALLER09['readpost_expiry']) { $newp = " <span class='badge btn btn-danger disabled' style='color:#fff'><b></b>NEW</b></span>"; } $moodname = isset($mood['name'][$arr['mood']]) ? htmlsafechars($mood['name'][$arr['mood']]) : 'is feeling neutral'; $moodpic = isset($mood['image'][$arr['mood']]) ? htmlsafechars($mood['image'][$arr['mood']]) : 'noexpression.gif'; $signature = $CURUSER['signatures'] == 'yes' ? format_comment($arr['signature']) : ''; $user_stuff = $arr; $user_stuff['id'] = (int) $arr['uid']; $postername = format_username($user_stuff, true); $width = '75'; $avatar = $CURUSER["avatars"] == "yes" ? $arr['p_anon'] == 'yes' && $CURUSER['class'] < UC_STAFF ? '<img style="max-width:' . $width . 'px;" src="' . $INSTALLER09['pic_base_url'] . 'anonymous_1.jpg" alt="avatar" />' : avatar_stuff($arr) : ""; $title2 = !empty($postername) ? empty($arr['title']) ? "(" . get_user_class_name($arr['class']) . ")" : "(" . htmlsafechars($arr['title']) . ")" : ''; $title = $arr['p_anon'] == 'yes' ? '<i>' . "Anonymous" . '</i>' : htmlsafechars($title2);
} //==End /* Flush all torrents mod */ if ($CURUSER['class'] >= UC_STAFF) { $un = $user["username"]; $HTMLOUT .= "<tr><td class='rowhead' width='1%'>{$lang['userdetails_flush']}</td><td align='left' width='99%'>" . ("{$lang['userdetails_flush1']}<a href='{$INSTALLER09['baseurl']}/staffpanel.php?tool=flush&action=flush&id={$id}'><b>" . htmlspecialchars($un) . "</b></a>\n") . "</td></tr>"; } $HTMLOUT .= "<tr><td class='rowhead' width='1%'>{$lang['userdetails_joined']}</td><td align='left' width='99%'>{$joindate}</td></tr>\r\n <tr><td class='rowhead'>{$lang['userdetails_seen']}</td><td align='left'>{$lastseen}</td></tr>"; //== Online time //if($user['onlinetime'] > 0) $onlinetime = time_return($user['onlinetime']); //else //$onlinetime = "This user has no online time recorded"; $HTMLOUT .= "<tr><td class='rowhead' width='1%'>Total Online</td><td align='left' width='99%'>{$onlinetime}</td></tr>"; // end $member_reputation = get_reputation($user, 'users'); $HTMLOUT .= "<tr><td class='rowhead' valign='top' align='right' width='1%'>{$lang['userdetails_rep']}</td><td align='left' width='99%'>{$member_reputation}<br />\r\n </td></tr>"; //==09 Birthday mod $age = $birthday = ''; if ($user['birthday'] != "0000-00-00") { $current = gmdate("Y-m-d", time()); list($year2, $month2, $day2) = explode('-', $current); $birthday = $user["birthday"]; $birthday = date("Y-m-d", strtotime($birthday)); list($year1, $month1, $day1) = explode('-', $birthday); if ($month2 < $month1) { $age = $year2 - $year1 - 1; } if ($month2 == $month1) { if ($day2 < $day1) { $age = $year2 - $year1 - 1;
function build_users_view($view) { global $mybb, $db, $cache, $lang, $user_view_fields, $page; $view_title = ''; if ($view['title']) { $title_string = "view_title_{$view['vid']}"; if ($lang->{$title_string}) { $view['title'] = $lang->{$title_string}; } $view_title .= " (" . htmlspecialchars_uni($view['title']) . ")"; } // Build the URL to this view if (!isset($view['url'])) { $view['url'] = "index.php?module=user-users"; } if (!is_array($view['conditions'])) { $view['conditions'] = unserialize($view['conditions']); } if (!is_array($view['fields'])) { $view['fields'] = unserialize($view['fields']); } if (!is_array($view['custom_profile_fields'])) { $view['custom_profile_fields'] = unserialize($view['custom_profile_fields']); } if (isset($mybb->input['username'])) { $view['conditions']['username'] = $mybb->input['username']; } if ($view['vid']) { $view['url'] .= "&vid={$view['vid']}"; } else { // If this is a custom view we need to save everything ready to pass it on from page to page global $admin_session; if (!$mybb->input['search_id']) { $search_id = md5(random_str()); $admin_session['data']['user_views'][$search_id] = $view; update_admin_session('user_views', $admin_session['data']['user_views']); $mybb->input['search_id'] = $search_id; } $view['url'] .= "&search_id=" . htmlspecialchars_uni($mybb->input['search_id']); } if (isset($mybb->input['username'])) { $view['url'] .= "&username="******"&", "&", $view['url'])) { update_admin_session('last_users_url', str_replace("&", "&", $view['url'])); } if (isset($view['conditions']['referrer'])) { $view['url'] .= "&action=referrers&uid=" . htmlspecialchars_uni($view['conditions']['referrer']); } // Do we not have any views? if (empty($view)) { return false; } $table = new Table(); // Build header for table based view if ($view['view_type'] != "card") { foreach ($view['fields'] as $field) { if (!$user_view_fields[$field]) { continue; } $view_field = $user_view_fields[$field]; $field_options = array(); if ($view_field['width']) { $field_options['width'] = $view_field['width']; } if ($view_field['align']) { $field_options['class'] = "align_" . $view_field['align']; } $table->construct_header($view_field['title'], $field_options); } $table->construct_header("<input type=\"checkbox\" name=\"allbox\" onclick=\"inlineModeration.checkAll(this);\" />"); // Create a header for the "select" boxes } $search_sql = '1=1'; // Build the search SQL for users // List of valid LIKE search fields $user_like_fields = array("username", "email", "website", "icq", "aim", "yahoo", "msn", "signature", "usertitle"); foreach ($user_like_fields as $search_field) { if (!empty($view['conditions'][$search_field]) && !$view['conditions'][$search_field . '_blank']) { $search_sql .= " AND u.{$search_field} LIKE '%" . $db->escape_string_like($view['conditions'][$search_field]) . "%'"; } else { if (!empty($view['conditions'][$search_field . '_blank'])) { $search_sql .= " AND u.{$search_field} != ''"; } } } // EXACT matching fields $user_exact_fields = array("referrer"); foreach ($user_exact_fields as $search_field) { if (!empty($view['conditions'][$search_field])) { $search_sql .= " AND u.{$search_field}='" . $db->escape_string($view['conditions'][$search_field]) . "'"; } } // LESS THAN or GREATER THAN $direction_fields = array("postnum"); foreach ($direction_fields as $search_field) { $direction_field = $search_field . "_dir"; if (isset($view['conditions'][$search_field]) && ($view['conditions'][$search_field] || $view['conditions'][$search_field] === '0') && $view['conditions'][$direction_field]) { switch ($view['conditions'][$direction_field]) { case "greater_than": $direction = ">"; break; case "less_than": $direction = "<"; break; default: $direction = "="; } $search_sql .= " AND u.{$search_field}{$direction}'" . $db->escape_string($view['conditions'][$search_field]) . "'"; } } // Registration searching $reg_fields = array("regdate"); foreach ($reg_fields as $search_field) { if (!empty($view['conditions'][$search_field]) && intval($view['conditions'][$search_field])) { $threshold = TIME_NOW - intval($view['conditions'][$search_field]) * 24 * 60 * 60; $search_sql .= " AND u.{$search_field} >= '{$threshold}'"; } } // IP searching $ip_fields = array("regip", "lastip"); foreach ($ip_fields as $search_field) { if (!empty($view['conditions'][$search_field])) { // IPv6 IP if (strpos($view['conditions'][$search_field], ":") !== false) { $view['conditions'][$search_field] = str_replace("*", "%", $view['conditions'][$search_field]); $ip_sql = "{$search_field} LIKE '" . $db->escape_string($view['conditions'][$search_field]) . "'"; } else { $ip_range = fetch_longipv4_range($view['conditions'][$search_field]); if (!is_array($ip_range)) { $ip_sql = "long{$search_field}='{$ip_range}'"; } else { $ip_sql = "long{$search_field} > '{$ip_range[0]}' AND long{$search_field} < '{$ip_range[1]}'"; } } $search_sql .= " AND {$ip_sql}"; } } // Post IP searching if (!empty($view['conditions']['postip'])) { // IPv6 IP if (strpos($view['conditions']['postip'], ":") !== false) { $view['conditions']['postip'] = str_replace("*", "%", $view['conditions']['postip']); $ip_sql = "ipaddress LIKE '" . $db->escape_string($view['conditions']['postip']) . "'"; } else { $ip_range = fetch_longipv4_range($view['conditions']['postip']); if (!is_array($ip_range)) { $ip_sql = "longipaddress='{$ip_range}'"; } else { $ip_sql = "longipaddress > '{$ip_range[0]}' AND longipaddress < '{$ip_range[1]}'"; } } $ip_uids = array(0); $query = $db->simple_select("posts", "uid", $ip_sql); while ($uid = $db->fetch_field($query, "uid")) { $ip_uids[] = $uid; } $search_sql .= " AND u.uid IN(" . implode(',', $ip_uids) . ")"; unset($ip_uids); } // Custom Profile Field searching if ($view['custom_profile_fields']) { $userfield_sql = '1=1'; foreach ($view['custom_profile_fields'] as $column => $input) { if (is_array($input)) { foreach ($input as $value => $text) { if ($value == $column) { $value = $text; } if ($value == $lang->na) { continue; } if (strpos($column, '_blank') !== false) { $column = str_replace('_blank', '', $column); $userfield_sql .= ' AND ' . $db->escape_string($column) . " != ''"; } else { $userfield_sql .= ' AND ' . $db->escape_string($column) . "='" . $db->escape_string($value) . "'"; } } } else { if (!empty($input)) { if ($input == $lang->na) { continue; } if (strpos($column, '_blank') !== false) { $column = str_replace('_blank', '', $column); $userfield_sql .= ' AND ' . $db->escape_string($column) . " != ''"; } else { $userfield_sql .= ' AND ' . $db->escape_string($column) . " LIKE '%" . $db->escape_string($input) . "%'"; } } } } if ($userfield_sql != '1=1') { $userfield_uids = array(0); $query = $db->simple_select("userfields", "ufid", $userfield_sql); while ($userfield = $db->fetch_array($query)) { $userfield_uids[] = $userfield['ufid']; } $search_sql .= " AND u.uid IN(" . implode(',', $userfield_uids) . ")"; unset($userfield_uids); } } // Usergroup based searching if (isset($view['conditions']['usergroup'])) { if (!is_array($view['conditions']['usergroup'])) { $view['conditions']['usergroup'] = array($view['conditions']['usergroup']); } foreach ($view['conditions']['usergroup'] as $usergroup) { $usergroup = intval($usergroup); if (!$usergroup) { continue; } switch ($db->type) { case "pgsql": case "sqlite": $additional_sql .= " OR ','||additionalgroups||',' LIKE '%,{$usergroup},%'"; break; default: $additional_sql .= "OR CONCAT(',',additionalgroups,',') LIKE '%,{$usergroup},%'"; } } $search_sql .= " AND (u.usergroup IN (" . implode(",", array_map('intval', $view['conditions']['usergroup'])) . ") {$additional_sql})"; } // COPPA users only? if (isset($view['conditions']['coppa'])) { $search_sql .= " AND u.coppauser=1 AND u.usergroup=5"; } // Extra SQL? if (isset($view['extra_sql'])) { $search_sql .= $view['extra_sql']; } // Lets fetch out how many results we have $query = $db->query("\n\t\tSELECT COUNT(u.uid) AS num_results\n\t\tFROM " . TABLE_PREFIX . "users u\n\t\tWHERE {$search_sql}\n\t"); $num_results = $db->fetch_field($query, "num_results"); // No matching results then return false if (!$num_results) { return false; } else { if (!$view['perpage']) { $view['perpage'] = 20; } $view['perpage'] = intval($view['perpage']); // Establish which page we're viewing and the starting index for querying // Establish which page we're viewing and the starting index for querying if (!isset($mybb->input['page'])) { $mybb->input['page'] = 1; } else { $mybb->input['page'] = intval($mybb->input['page']); } if ($mybb->input['page']) { $start = ($mybb->input['page'] - 1) * $view['perpage']; } else { $start = 0; $mybb->input['page'] = 1; } $from_bit = ""; if (isset($mybb->input['from']) && $mybb->input['from'] == "home") { $from_bit = "&from=home"; } switch ($view['sortby']) { case "regdate": case "lastactive": case "postnum": case "reputation": $view['sortby'] = $db->escape_string($view['sortby']); break; case "numposts": $view['sortby'] = "postnum"; break; case "warninglevel": $view['sortby'] = "warningpoints"; break; default: $view['sortby'] = "username"; } if ($view['sortorder'] != "desc") { $view['sortorder'] = "asc"; } $usergroups = $cache->read("usergroups"); // Fetch matching users $query = $db->query("\n\t\t\tSELECT u.*\n\t\t\tFROM " . TABLE_PREFIX . "users u\n\t\t\tWHERE {$search_sql}\n\t\t\tORDER BY {$view['sortby']} {$view['sortorder']}\n\t\t\tLIMIT {$start}, {$view['perpage']}\n\t\t"); $users = ''; while ($user = $db->fetch_array($query)) { $comma = $groups_list = ''; $user['view']['username'] = "******"index.php?module=user-users&action=edit&uid={$user['uid']}\">" . format_name($user['username'], $user['usergroup'], $user['displaygroup']) . "</a>"; $user['view']['usergroup'] = htmlspecialchars_uni($usergroups[$user['usergroup']]['title']); if ($user['additionalgroups']) { $additional_groups = explode(",", $user['additionalgroups']); foreach ($additional_groups as $group) { $groups_list .= $comma . htmlspecialchars_uni($usergroups[$group]['title']); $comma = $lang->comma; } } if (!$groups_list) { $groups_list = $lang->none; } $user['view']['additionalgroups'] = "<small>{$groups_list}</small>"; $user['view']['email'] = "<a href=\"mailto:" . htmlspecialchars_uni($user['email']) . "\">" . htmlspecialchars_uni($user['email']) . "</a>"; $user['view']['regdate'] = my_date($mybb->settings['dateformat'], $user['regdate']) . ", " . my_date($mybb->settings['timeformat'], $user['regdate']); $user['view']['lastactive'] = my_date($mybb->settings['dateformat'], $user['lastactive']) . ", " . my_date($mybb->settings['timeformat'], $user['lastactive']); // Build popup menu $popup = new PopupMenu("user_{$user['uid']}", $lang->options); $popup->add_item($lang->edit_profile_and_settings, "index.php?module=user-users&action=edit&uid={$user['uid']}"); $popup->add_item($lang->ban_user, "index.php?module=user-banning&uid={$user['uid']}#username"); if ($user['usergroup'] == 5) { if ($user['coppauser']) { $popup->add_item($lang->approve_coppa_user, "index.php?module=user-users&action=activate_user&uid={$user['uid']}&my_post_key={$mybb->post_code}{$from_bit}"); } else { $popup->add_item($lang->approve_user, "index.php?module=user-users&action=activate_user&uid={$user['uid']}&my_post_key={$mybb->post_code}{$from_bit}"); } } $popup->add_item($lang->delete_user, "index.php?module=user-users&action=delete&uid={$user['uid']}&my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->user_deletion_confirmation}')"); $popup->add_item($lang->show_referred_users, "index.php?module=user-users&action=referrers&uid={$user['uid']}"); $popup->add_item($lang->show_ip_addresses, "index.php?module=user-users&action=ipaddresses&uid={$user['uid']}"); $popup->add_item($lang->show_attachments, "index.php?module=forum-attachments&results=1&username="******"-"; } if ($mybb->settings['enablewarningsystem'] != 0 && $usergroups[$user['usergroup']]['canreceivewarnings'] != 0) { $warning_level = round($user['warningpoints'] / $mybb->settings['maxwarningpoints'] * 100); if ($warning_level > 100) { $warning_level = 100; } $user['view']['warninglevel'] = get_colored_warning_level($warning_level); } if ($user['avatar'] && !stristr($user['avatar'], 'http://')) { $user['avatar'] = "../{$user['avatar']}"; } if ($view['view_type'] == "card") { $scaled_avatar = fetch_scaled_avatar($user, 80, 80); } else { $scaled_avatar = fetch_scaled_avatar($user, 34, 34); } if (!$user['avatar']) { $user['avatar'] = "styles/{$page->style}/images/default_avatar.gif"; } $user['view']['avatar'] = "<img src=\"" . htmlspecialchars_uni($user['avatar']) . "\" alt=\"\" width=\"{$scaled_avatar['width']}\" height=\"{$scaled_avatar['height']}\" />"; if ($view['view_type'] == "card") { $users .= build_user_view_card($user, $view, $i); } else { build_user_view_table($user, $view, $table); } } // If card view, we need to output the results if ($view['view_type'] == "card") { $table->construct_cell($users); $table->construct_row(); } } if (!isset($view['table_id'])) { $view['table_id'] = "users_list"; } $switch_view = "<div class=\"float_right\">"; $switch_url = $view['url']; if ($mybb->input['page'] > 0) { $switch_url .= "&page=" . intval($mybb->input['page']); } if ($view['view_type'] != "card") { $switch_view .= "<strong>{$lang->table_view}</strong> | <a href=\"{$switch_url}&type=card\" style=\"font-weight: normal;\">{$lang->card_view}</a>"; } else { $switch_view .= "<a href=\"{$switch_url}&type=table\" style=\"font-weight: normal;\">{$lang->table_view}</a> | <strong>{$lang->card_view}</strong>"; } $switch_view .= "</div>"; // Do we need to construct the pagination? if ($num_results > $view['perpage']) { $pagination = draw_admin_pagination($mybb->input['page'], $view['perpage'], $num_results, $view['url'] . "&type={$view['view_type']}"); $search_class = "float_right"; $search_style = ""; } else { $search_class = ''; $search_style = "text-align: right;"; } $search_action = $view['url']; // stop &username= in the query string if ($view_upos = strpos($search_action, '&username='******'post', 'search_form', 0, '', true); $built_view = $search->construct_return; $built_view .= "<div class=\"{$search_class}\" style=\"padding-bottom: 3px; margin-top: -9px; {$search_style}\">"; $built_view .= $search->generate_hidden_field('action', 'search') . "\n"; if (isset($view['conditions']['username'])) { $default_class = ''; $value = $view['conditions']['username']; } else { $default_class = "search_default"; $value = $lang->search_for_user; } $built_view .= $search->generate_text_box('username', $value, array('id' => 'search_keywords', 'class' => "{$default_class} field150 field_small")) . "\n"; $built_view .= "<input type=\"submit\" class=\"search_button\" value=\"{$lang->search}\" />\n"; if ($view['popup']) { $built_view .= " <div style=\"display: inline\">{$view['popup']}</div>\n"; } $built_view .= "<script type='text/javascript'>\n\t\tvar form = document.getElementById('search_form');\n\t\tform.onsubmit = function() {\n\t\t\tvar search = document.getElementById('search_keywords');\n\t\t\tif(search.value == '' || search.value == '" . addcslashes($lang->search_for_user, "'") . "')\n\t\t\t{\n\t\t\t\tsearch.focus();\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tvar search = document.getElementById('search_keywords');\n\t\tsearch.onfocus = function()\n\t\t{\n\t\t\tif(this.value == '" . addcslashes($lang->search_for_user, "'") . "')\n\t\t\t{\n\t\t\t\t\$(this).removeClassName('search_default');\n\t\t\t\tthis.value = '';\n\t\t\t}\n\t\t}\n\t\tsearch.onblur = function()\n\t\t{\n\t\t\tif(this.value == '')\n\t\t\t{\n\t\t\t\t\$(this).addClassName('search_default');\n\t\t\t\tthis.value = '" . addcslashes($lang->search_for_user, "'") . "';\n\t\t\t}\n\t\t}\n\t\t// fix the styling used if we have a different default value\n\t\tif(search.value != '" . addcslashes($lang->search_for_user, "'") . "')\n\t\t{\n\t\t\t\$(search).removeClassName('search_default');\n\t\t}\n\t\t</script>\n"; $built_view .= "</div>\n"; // Autocompletion for usernames $built_view .= ' <script type="text/javascript" src="../jscripts/autocomplete.js?ver=140"></script> <script type="text/javascript"> <!-- new autoComplete("search_keywords", "../xmlhttp.php?action=get_users", {valueSpan: "username"}); // --> </script>'; $built_view .= $search->end(); if (isset($pagination)) { $built_view .= $pagination; } if ($view['view_type'] != "card") { $checkbox = ''; } else { $checkbox = "<input type=\"checkbox\" name=\"allbox\" onclick=\"inlineModeration.checkAll(this)\" /> "; } $built_view .= $table->construct_html("{$switch_view}<div>{$checkbox}{$lang->users}{$view_title}</div>", 1, "", $view['table_id']); if (isset($pagination)) { $built_view .= $pagination; } $built_view .= ' <script type="text/javascript" src="' . $mybb->settings['bburl'] . '/jscripts/inline_moderation.js?ver=1400"></script> <form action="index.php?module=user-users" method="post"> <input type="hidden" name="my_post_key" value="' . $mybb->post_code . '" /> <input type="hidden" name="action" value="inline_edit" /> <div class="float_right"><span class="smalltext"><strong>' . $lang->inline_edit . '</strong></span> <select name="inline_action" class="inline_select"> <option value="multiactivate">' . $lang->inline_activate . '</option> <option value="multiban">' . $lang->inline_ban . '</option> <option value="multiusergroup">' . $lang->inline_usergroup . '</option> <option value="multidelete">' . $lang->inline_delete . '</option> <option value="multiprune">' . $lang->inline_prune . '</option> </select> <input type="submit" class="button" name="go" value="' . $lang->go . ' (0)" id="inline_go" /> <input type="button" onclick="javascript:inlineModeration.clearChecked();" value="' . $lang->clear . '" class="button" /> </div> </form> <br style="clear: both;" /> <script type="text/javascript"> <!-- var go_text = "' . $lang->go . '"; var all_text = "1"; var inlineType = "user"; var inlineId = "acp"; // --> </script>'; return $built_view; }
function commenttable($rows, $variant = 'torrent') { require_once INCL_DIR . 'html_functions.php'; global $CURUSER, $TBDEV; $lang = load_language('torrenttable_functions'); $htmlout = ''; $count = 0; $variant_options = array('torrent' => 'details', 'request' => 'viewrequests'); if (isset($variant_options[$variant])) { $locale_link = $variant_options[$variant]; } else { return; } $extra_link = $variant == 'request' ? '&type=request' : ''; $htmlout .= begin_main_frame(); $htmlout .= begin_frame(); foreach ($rows as $row) { $htmlout .= "<p class='sub'>#{$row["id"]} {$lang["commenttable_by"]} "; if (isset($row["username"])) { if ($row['anonymous'] == 'yes') { $htmlout .= ($CURUSER['class'] >= UC_MODERATOR ? 'Anonymous - Posted by: <b>' . htmlspecialchars($row['username']) . '</b> ID: ' . $row['user'] . '' : 'Anonymous') . ' '; } else { $title = $row["title"]; if ($title == "") { $title = get_user_class_name($row["class"]); } else { $title = htmlspecialchars($title); } $htmlout .= "<a name='comm{$row["id"]}' href='userdetails.php?id={$row["user"]}'><b>" . htmlspecialchars($row["username"]) . "</b></a>" . ($row["donor"] == "yes" ? "<img src='{$TBDEV['pic_base_url']}star.gif' alt='" . $lang["commenttable_donor_alt"] . "' />" : "") . ($row["warned"] == "yes" ? "<img src=" . "'{$TBDEV['pic_base_url']}warned.gif' alt='" . $lang["commenttable_warned_alt"] . "' />" : "") . " ({$title})\n"; } } else { $htmlout .= "<a name='comm{$row["id"]}'><i>(" . $lang["commenttable_orphaned"] . ")</i></a>\n"; } $htmlout .= get_date($row['added'], ''); $htmlout .= ($row["user"] == $CURUSER["id"] || $CURUSER["class"] >= UC_STAFF ? "- [<a href='comment.php?action=edit&cid=" . $row['id'] . $extra_link . "&tid=" . $row[$variant] . "'>" . $lang["commenttable_edit"] . "</a>]" : "") . ($CURUSER["class"] >= UC_VIP ? " - [<a href='report.php?type=Comment&id=" . $row['id'] . "'>Report this Comment</a>]" : "") . ($CURUSER["class"] >= UC_STAFF ? " - [<a href='comment.php?action=delete&cid=" . $row['id'] . $extra_link . "&tid=" . $row[$variant] . "'>" . $lang["commenttable_delete"] . "</a>]" : "") . ($row["editedby"] && $CURUSER["class"] >= UC_STAFF ? "- [<a href='comment.php?action=vieworiginal&cid=" . $row['id'] . $extra_link . "&tid=" . $row[$variant] . "'>" . $lang["commenttable_view_original"] . "</a>]" : "") . "</p>\n"; $avatar = $CURUSER["avatars"] == "all" ? htmlspecialchars($row["avatar"]) : ($CURUSER["avatars"] == "some" && $row["offavatar"] == "no" ? htmlspecialchars($row["avatar"]) : ""); if (!$avatar) { $avatar = "{$TBDEV['pic_base_url']}forumicons/default_avatar.gif"; } $text = format_comment($row["text"]); if ($row["editedby"]) { $text .= "<p><font size='1' class='small'>" . $lang["commenttable_last_edited_by"] . " <a href='userdetails.php?id={$row['editedby']}'><b>{$row['username']}</b></a> " . $lang["commenttable_last_edited_at"] . " " . get_date($row['editedat'], 'DATE') . "</font></p>\n"; } $htmlout .= begin_table(true); $htmlout .= "<tr valign='top'>\n"; $htmlout .= "<td align='center' width='150' style='padding: 0px'><img width='{$row['av_w']}' height='{$row['av_h']}' src='{$avatar}' alt='' /><br />" . get_reputation($row, 'comments') . "</td>\n"; $htmlout .= "<td class='text'>{$text}</td>\n"; $htmlout .= "</tr>\n"; $htmlout .= end_table(); } $htmlout .= end_frame(); $htmlout .= end_main_frame(); return $htmlout; }
$HTMLOUT .= tr("Rating", getRate($id, "torrent"), 1); $HTMLOUT .= tr("{$lang['details_last_seeder']}", "{$lang['details_last_activity']}" . get_date($l_a['lastseed'], '', 0, 1)); $HTMLOUT .= tr("{$lang['details_size']}", mksize($torrents["size"]) . " (" . number_format($torrents["size"]) . " {$lang['details_bytes']})"); $HTMLOUT .= tr("{$lang['details_added']}", get_date($torrents['added'], "{$lang['details_long']}")); $HTMLOUT .= tr("{$lang['details_views']}", (int) $torrents["views"]); $HTMLOUT .= tr("{$lang['details_hits']}", (int) $torrents["hits"]); $XBT_Or_Default = XBT_TRACKER == true ? 'snatches_xbt.php?id=' : 'snatches.php?id='; $HTMLOUT .= tr("{$lang['details_snatched']}", $torrents["times_completed"] > 0 ? "<a href='{$INSTALLER09["baseurl"]}/{$XBT_Or_Default}{$id}'>{$torrents['times_completed']} {$lang['details_times']}</a>" : "0 {$lang['details_times']}", 1); $HTMLOUT .= "<tr><td class='rowhead'>Status update</td><td><input type='button' onclick='status_showbox(\"{$CURUSER['username']} is viewing details for torrent {$INSTALLER09['baseurl']}/details.php?id=" . (int) $torrents['id'] . "\")' value='do it!'/></td></tr>"; $HTMLOUT .= "</table>\n<table align='center' class='table table-bordered span9'>"; //==Report Torrent Link $HTMLOUT .= tr("Report Torrent", "<form action='report.php?type=Torrent&id={$id}' method='post'><input class='btn btn-primary' type='submit' name='submit' value='Report This Torrent' /> <strong><em class='label label-primary'>For breaking the <a href='rules.php'>rules</a></em></strong></form>", 1); //== Tor Reputation by pdq if ($torrent_cache['rep']) { $torrents = array_merge($torrents, $torrent_cache['rep']); $member_reputation = get_reputation($torrents, 'torrents', $torrents['anonymous']); $HTMLOUT .= '<tr> <td class="heading" valign="top" align="right" width="1%">Reputation</td> <td align="left" width="99%">' . $member_reputation . ' (counts towards uploaders Reputation)<br /></td> </tr>'; } //==Anonymous $rowuser = isset($torrents['username']) ? "<a href='userdetails.php?id=" . (int) $torrents['owner'] . "'><b>" . htmlsafechars($torrents['username']) . "</b></a>" : "{$lang['details_unknown']}"; $uprow = $torrents['anonymous'] == 'yes' ? ($CURUSER['class'] < UC_STAFF && $torrents['owner'] != $CURUSER['id'] ? '' : $rowuser . ' - ') . "<i>{$lang['details_anon']}</i>" : $rowuser; if ($owned) { $uprow .= " {$spacer}<{$editlink}><b>{$lang['details_edit']}</b></a>"; } $HTMLOUT .= tr("Upped by", $uprow, 1); //==pdq's Torrent Moderation if ($CURUSER['class'] >= UC_STAFF) { if (!empty($torrents['checked_by'])) {
function StatusBar() { global $CURUSER, $INSTALLER09, $lang, $rep_is_on, $mc1, $msgalert; if (!$CURUSER) { return ""; } $upped = mksize($CURUSER['uploaded']); $downed = mksize($CURUSER['downloaded']); //==Memcache unread pms $PMCount = 0; $unread1 = $mc1->get_value('inbox_new_sb_' . $CURUSER['id']); if ($unread1 === false) { $res1 = sql_query("SELECT COUNT(id) FROM messages WHERE receiver='" . $CURUSER['id'] . "' AND unread = 'yes' AND location='1'") or sqlerr(__LINE__, __FILE__); list($PMCount) = mysql_fetch_row($res1); $PMCount = (int) $PMCount; $unread1 = $mc1->cache_value('inbox_new_sb_' . $CURUSER['id'], $PMCount, $INSTALLER09['expires']['unread']); } $inbox = $unread1 == 1 ? "{$unread1} {$lang['gl_msg_singular']}" : "{$unread1} {$lang['gl_msg_plural']}"; //==Memcache peers $MyPeersCache = $mc1->get_value('MyPeers_' . $CURUSER['id']); if ($MyPeersCache == false) { $seed['yes'] = $seed['no'] = 0; $seed['conn'] = 3; $r = sql_query("select count(id) as count, seeder, connectable FROM peers WHERE userid=" . $CURUSER['id'] . " group by seeder"); while ($a = mysql_fetch_assoc($r)) { $key = $a['seeder'] == 'yes' ? 'yes' : 'no'; $seed[$key] = number_format(0 + $a['count']); $seed['conn'] = $a['connectable'] == 'no' ? 1 : 2; } $mc1->cache_value('MyPeers_' . $CURUSER['id'], $seed, $INSTALLER09['expires']['MyPeers_']); unset($r, $a); } else { $seed = $MyPeersCache; } // for display connectable 1 / 2 / 3 if (!empty($seed['conn'])) { switch ($seed['conn']) { case 1: $connectable = "<img src='{$INSTALLER09['pic_base_url']}notcon.png' alt='Not Connectable' title='Not Connectable' />"; break; case 2: $connectable = "<img src='{$INSTALLER09['pic_base_url']}yescon.png' alt='Connectable' title='Connectable' />"; break; default: $connectable = "N/A"; } } else { $connectable = 'N/A'; } //////////// REP SYSTEM ///////////// $member_reputation = get_reputation($CURUSER); ////////////// REP SYSTEM END ////////// $usrclass = ""; if ($CURUSER['override_class'] != 255) { $usrclass = " <b>(" . get_user_class_name($CURUSER['class']) . ")</b> "; } else { if ($CURUSER['class'] >= UC_STAFF) { $usrclass = " <a href='./setclass.php'><b>(" . get_user_class_name($CURUSER['class']) . ")</b></a> "; } } $StatusBar = ''; $StatusBar = "\r\n <!-- Installer09 Source - Print Statusbar/User Menu -->\r\n <script type='text/javascript'>\r\n //<![CDATA[\r\n function showSlidingDiv(){\r\n \$('#slidingDiv').animate({'height': 'toggle'}, { duration: 1000 });\r\n }\r\n //]]>\r\n </script>\r\n <div id='base_header_fly'>\r\n <div id='base_usermenu'>{$lang['gl_msg_welcome']}, " . format_username($CURUSER) . "<span class='base_usermenu_arrow'><a href='#' onclick='showSlidingDiv(); return false;'><img src='templates/1/images/usermenu_arrow.png' alt='' /></a></span></div>\r\n <div id='slidingDiv'>\r\n <div class='slide_head'>:: Personal Stats</div>\r\n <div class='slide_a'>User Class</div><div class='slide_b'>{$usrclass}</div>\r\n <div class='slide_c'>Reputation</div><div class='slide_d'>{$member_reputation}</div>\r\n <div class='slide_a'>Invites</div><div class='slide_b'><a href='./invite.php'>{$CURUSER['invites']}</a></div>\r\n <div class='slide_c'>Bonus Points</div><div class='slide_d'><a href='./mybonus.php'>{$CURUSER['seedbonus']}</a></div>\r\n <div class='slide_head'>:: Torrent Stats</div>\r\n <div class='slide_a'>Share Ratio</div><div class='slide_b'>" . member_ratio($CURUSER['uploaded'], $CURUSER['downloaded']) . "</div>\r\n <div class='slide_c'>Uploaded</div><div class='slide_d'>{$upped}</div>\r\n <div class='slide_a'>Downloaded</div><div class='slide_b'>{$downed}</div>\r\n <div class='slide_c'>Uploading Files</div><div class='slide_d'>{$seed['yes']}</div>\r\n <div class='slide_a'>Downloading Files</div><div class='slide_b'>{$seed['no']}</div>\r\n <div class='slide_c'>Connectable</div><div class='slide_d'>{$connectable}</div>\r\n <div class='slide_head'>:: Games & Playhouse</div>\r\n <div class='slide_a'>Play Blackjack</div><div class='slide_b'><a href='./blackjack.php'>Play here</a></div>\r\n <div class='slide_c'>Play Casino</div><div class='slide_d'><a href='./casino.php'>Play here</a></div>\r\n <div class='slide_head'>:: Information</div>\r\n <div class='slide_a'>Contact Staff</div><div class='slide_b'><a href='./contactstaff.php'>Send Message</a></div>\r\n <div class='slide_c'>Change Theme</div><div class='slide_d'><a href='#' onclick='themes();'>Click here</a></div>\r\n <div class='slide_a'>Radio</div><div class='slide_b'><a href='#' onclick='radio();'>Click here</a></div>\r\n <div class='slide_c'>Donate us</div><div class='slide_d'><a href='./donate.php'>Click here</a></div>\r\n <div class='slide_a'>Torrent Freak News</div><div class='slide_b'><a href='./rsstfreak.php'>Click here</a></div>\r\n " . (isset($CURUSER) && $CURUSER['class'] <= UC_VIP ? "\r\n <div class='slide_c'>Uploader App</div><div class='slide_d'><a href='uploadapp.php'>Send Application</a></div>" : "") . "\r\n " . (isset($CURUSER) && $CURUSER['got_blocks'] == 'yes' ? "\r\n <div class='slide_head'>:: Site Config</div>\r\n <div class='slide_a'>My Blocks</div><div class='slide_b'><a href='./user_blocks.php'>Click here</a></div>" : "") . "\r\n </div>\r\n <div id='base_icons'>\r\n <ul class='um_menu'>\r\n <li><a href='messages.php'><img src='templates/1/images/main.jpg' alt='' title='Your Private Messages' /></a></li>\r\n <li><a href='usercp.php'><img src='templates/1/images/settings.jpg' alt='Settings' title='Personal Settings' /></a></li>\r\n " . (isset($CURUSER) && $CURUSER['class'] >= UC_STAFF ? "<li><a href='staffpanel.php'><img src='templates/1/images/staff.png' alt='Staff' title='Staffpanel' /></a></li>" : "") . "\r\n <li><a href='logout.php'><img src='templates/1/images/signout.jpg' alt='Logout' title='SignOut' /></a></li>\r\n </ul>\r\n </div>\r\n </div>"; return $StatusBar; }
$percent = $mybb->user['postnum'] * 100 / $posts; $percent = round($percent, 2); } $colspan = 2; $lang->posts_day = $lang->sprintf($lang->posts_day, my_number_format($perday), $percent); $regdate = my_date('relative', $mybb->user['regdate']); $useravatar = format_avatar($mybb->user['avatar'], $mybb->user['avatardimensions'], '100x100'); eval("\$avatar = \"" . $templates->get("usercp_currentavatar") . "\";"); $usergroup = htmlspecialchars_uni($groupscache[$mybb->user['usergroup']]['title']); if ($mybb->user['usergroup'] == 5 && $mybb->settings['regtype'] != "admin") { eval("\$usergroup .= \"" . $templates->get("usercp_resendactivation") . "\";"); } // Make reputations row $reputations = ''; if ($mybb->usergroup['usereputationsystem'] == 1 && $mybb->settings['enablereputation'] == 1) { $reputation_link = get_reputation($mybb->user['reputation']); eval("\$reputation = \"" . $templates->get("usercp_reputation") . "\";"); } $latest_warnings = ''; if ($mybb->settings['enablewarningsystem'] != 0 && $mybb->settings['canviewownwarning'] != 0) { if ($mybb->settings['maxwarningpoints'] < 1) { $mybb->settings['maxwarningpoints'] = 10; } $warning_level = round($mybb->user['warningpoints'] / $mybb->settings['maxwarningpoints'] * 100); if ($warning_level > 100) { $warning_level = 100; } if ($mybb->user['warningpoints'] > $mybb->settings['maxwarningpoints']) { $mybb->user['warningpoints'] = $mybb->settings['maxwarningpoints']; } if ($warning_level > 0) {
function StatusBar() { global $CURUSER, $TBDEV, $lang, $rep_is_on, $mc; if (!$CURUSER) { return ""; } $upped = mksize($CURUSER['uploaded']); $downed = mksize($CURUSER['downloaded']); $ratio = $CURUSER['downloaded'] > 0 ? $CURUSER['uploaded'] / $CURUSER['downloaded'] : 0; $ratio = number_format($ratio, 2); $color = get_ratio_color($ratio); if ($color) { $ratio = "<font color='{$color}'>{$ratio}</font>"; } $res1 = @sql_query("SELECT count(id) FROM messages WHERE receiver=" . $CURUSER["id"] . " AND unread='yes'") or sqlerr(__LINE__, __FILE__); $arr1 = mysql_fetch_row($res1); $unread = $arr1[0]; $inbox = $unread == 1 ? "{$unread} {$lang['gl_msg_singular']}" : "{$unread} {$lang['gl_msg_plural']}"; $res2 = @sql_query("SELECT seeder, count(*) AS pCount FROM peers WHERE userid=" . $CURUSER['id'] . " GROUP BY seeder") or sqlerr(__LINE__, __FILE__); $seedleech = array('yes' => '0', 'no' => '0'); while ($row = mysql_fetch_assoc($res2)) { if ($row['seeder'] == 'yes') { $seedleech['yes'] = $row['pCount']; } else { $seedleech['no'] = $row['pCount']; } } /////////////// REP SYSTEM ///////////// $member_reputation = get_reputation($CURUSER); ////////////// REP SYSTEM END ////////// $usrclass = ""; if ($CURUSER['override_class'] != 255) { $usrclass = " <b>(" . get_user_class_name($CURUSER['class']) . ")</b> "; } else { if ($CURUSER['class'] >= UC_STAFF) { $usrclass = " <a href='./setclass.php'><b>(" . get_user_class_name($CURUSER['class']) . ")</b></a> "; } } $StatusBar = ''; $StatusBar = "" . "<div style='float:left; width:500px;'>\r\n {$lang['gl_msg_welcome']}, \r\n\t\t" . format_username($CURUSER) . " {$usrclass} | \r\n Ratio: {$ratio}" . " | Upload: {$upped}" . "<br />\r\n Bonus: <a href='./mybonus.php'>{$CURUSER['seedbonus']}</a> | Invites: <a href='./invite.php'>{$CURUSER['invites']}</a> | \r\n\t\tMailbox: <a href='./messages.php'>{$inbox}</a></div>\r\n <div>" . "</div>"; return $StatusBar; }
function commenttable($rows) { global $CURUSER, $HTTP_SERVER_VARS; // === get smilie based on ratio begin_main_frame(); begin_frame(); $count = 0; foreach ($rows as $row) { $querie = sql_query("SELECT anonymous FROM comments WHERE id =" . unsafeChar($row['id']) . ""); $arraya = mysql_fetch_assoc($querie); echo "<p class=sub>#" . safeChar($row["id"]) . " by "; $title = !empty($row["title"]) ? $row["title"] : get_user_class_name($row["class"]); if ($arraya['anonymous'] == 'no' && isset($row["username"])) { $username = $row["username"]; $ratres = sql_query("SELECT uploaded, downloaded from users where username='******'"); $rat = mysql_fetch_array($ratres); if ($rat["downloaded"] > 0) { $ratio = $rat['uploaded'] / $rat['downloaded']; $ratio = number_format($ratio, 3); $color = get_ratio_color($ratio); if ($color) { $ratio = "<font color={$color}>" . safeChar($ratio) . " " . get_user_ratio_image($ratio) . "</font>"; } } else { if ($rat["uploaded"] > 0) { $ratio = "Inf."; } else { $ratio = "---"; } } echo "<a name=comm" . $row["id"] . " href=userdetails.php?id=" . safeChar($row["user"]) . "><b>" . safeChar($row["username"]) . "</b></a> " . $title . " " . ($row["donor"] == "yes" ? "<img src=pic/star.gif alt='Donor'>" : "") . ($row["warned"] == "yes" ? "<img src=" . "/pic/warned.gif alt=\"Warned\">" : "") . " Ratio: {$ratio}\n"; } else { if (!isset($row["username"])) { echo "<a name=\"comm" . $row["id"] . "\"><i>(orphaned)</i></a>\n"; } else { if ($arraya['anonymous'] == 'yes') { echo "<a name=\"comm" . $row["id"] . "\"><font color=blue><b>Anonymous</b></font></a>\n"; } } } echo " at " . display_date_time($row["added"]) . " GMT" . ($row["user"] == $CURUSER["id"] || get_user_class() >= UC_MODERATOR ? "- [<a href=comment.php?action=edit&cid={$row['id']}>" . 'Edit' . "</a>] " : "") . (get_user_class() >= UC_VIP ? " - [<a href=report.php?type=Comment&id={$row['id']}>Report this Comment</a>]" : "") . (get_user_class() >= UC_MODERATOR ? "- [<a href=comment.php?action=delete&cid={$row['id']}>" . 'Delete' . "</a>]" : "") . ($row["editedby"] && get_user_class() >= UC_MODERATOR ? " - [<a href=comment.php?action=vieworiginal&cid={$row['id']}>" . 'View_original' . "</a>]" : "") . "</p>\n"; $resa = sql_query("SELECT owner, anonymous FROM torrents WHERE owner = {$row['user']}"); $array = mysql_fetch_assoc($resa); if ($row['anonymous'] == 'yes' && $row['user'] == $array['owner']) { $avatar = "/pic/default_avatar.gif"; } else { $avatar = $CURUSER["avatars"] == "yes" ? safeChar($row["avatar"]) : ""; } if (!$avatar) { $avatar = "/pic/default_avatar.gif"; } begin_table(true); echo "<tr valign=top>\n"; echo "<td align=center width=100 style='padding: 0px'><img width=100 src={$avatar}><br />" . get_reputation($row, 'comments') . "</td>\n"; echo "<td class=text>" . format_comment($row["text"]) . "</td>\n"; echo "</tr>\n"; end_table(); } end_frame(); end_main_frame(); }
<tr><td class="forum_head_dark" align="left" width="100"> <img src="' . $INSTALLER09['pic_base_url'] . 'forums/topic_normal.gif" alt="Topic" title="Topic" /> Author</td> <td class="forum_head_dark" align="left" colspan="2"> Topic: ' . $topic_name . ' [ Read ' . $views . ' times ] </td></tr> <tr><td class="three" align="left" colspan="3">Topic rating: ' . getRate($topic_id, "topic") . '</td></tr> <tr><td class="three" align="left" colspan="3">' . $topic_users . '</td></tr>'; //=== lets start the loop \o/ while ($arr = mysqli_fetch_assoc($res)) { //=== change colors $colour = ++$colour % 2; $class = $colour == 0 ? 'one' : 'two'; $class_alt = $colour == 0 ? 'two' : 'one'; $moodname = isset($mood['name'][$arr['mood']]) ? htmlsafechars($mood['name'][$arr['mood']]) : 'is feeling neutral'; $moodpic = isset($mood['image'][$arr['mood']]) ? htmlsafechars($mood['image'][$arr['mood']]) : 'noexpression.gif'; $post_icon = $arr['icon'] !== '' ? '<img src="' . $INSTALLER09['pic_base_url'] . 'smilies/' . htmlsafechars($arr['icon']) . '.gif" alt="icon" title="icon" /> ' : '<img src="' . $INSTALLER09['pic_base_url'] . 'forums/topic_normal.gif" alt="icon" title="icon" /> '; $post_title = $arr['post_title'] !== '' ? ' <span style="font-weight: bold; font-size: x-small;">' . htmlsafechars($arr['post_title'], ENT_QUOTES) . '</span>' : ''; $stafflocked = $arr["staff_lock"] == 1 ? "<img src='{$INSTALLER09['pic_base_url']}locked.gif' border='0' alt='Post Locked' title='Post Locked' />" : ""; $member_reputation = $arr['username'] != '' ? get_reputation($arr, 'posts') : ''; $edited_by = ''; if ($arr['edit_date'] > 0) { $res_edited = sql_query('SELECT username FROM users WHERE id=' . sqlesc($arr['edited_by'])); $arr_edited = mysqli_fetch_assoc($res_edited); //== Anonymous if ($arr['anonymous'] == 'yes') { if ($CURUSER['class'] < UC_STAFF && $arr['user_id'] != $CURUSER['id']) { $edited_by = '<br /><br /><br /><span style="font-weight: bold; font-size: x-small;">Last edited by Anonymous at ' . get_date($arr['edit_date'], '') . ' GMT ' . ($arr['edit_reason'] !== '' ? ' </span>[ Reason: ' . htmlsafechars($arr['edit_reason']) . ' ] <span style="font-weight: bold; font-size: x-small;">' : '') . ' ' . ($CURUSER['class'] >= UC_STAFF && $arr['post_history'] !== '' ? ' <a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php?action=view_post_history&post_id=' . (int) $arr['post_id'] . '&forum_id=' . $forum_id . '&topic_id=' . $topic_id . '">read post history</a></span><br />' : '</span>'); } else { $edited_by = '<br /><br /><br /><span style="font-weight: bold; font-size: x-small;">Last edited by Anonymous [<a class="altlink" href="userdetails.php?id=' . (int) $arr['edited_by'] . '">' . htmlsafechars($arr_edited['username']) . '</a>] at ' . get_date($arr['edit_date'], '') . ' GMT ' . ($arr['edit_reason'] !== '' ? ' </span>[ Reason: ' . htmlsafechars($arr['edit_reason']) . ' ] <span style="font-weight: bold; font-size: x-small;">' : '') . ' ' . ($CURUSER['class'] >= UC_STAFF && $arr['post_history'] !== '' ? ' <a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php?action=view_post_history&post_id=' . (int) $arr['post_id'] . '&forum_id=' . $forum_id . '&topic_id=' . $topic_id . '">read post history</a></span><br />' : '</span>'); }
function StatusBar() { global $CURUSER, $TBDEV, $lang, $mc; if (!$CURUSER) { return "<p align='center'>Yeah Yeah!</p>"; } $upped = mksize($CURUSER['uploaded']); $downed = mksize($CURUSER['downloaded']); $ratio = $CURUSER['downloaded'] > 0 ? $CURUSER['uploaded'] / $CURUSER['downloaded'] : 0; $ratio = number_format($ratio, 2); $color = get_ratio_color($ratio); if ($color) { $ratio = "<font color='{$color}'>{$ratio}</font>"; } $res1 = @sql_query("SELECT count(id) FROM messages WHERE receiver=" . $CURUSER["id"] . " AND unread='yes'") or sqlerr(__LINE__, __FILE__); $arr1 = mysql_fetch_row($res1); $unread = $arr1[0]; $inbox = $unread == 1 ? "{$unread} {$lang['gl_msg_singular']}" : "{$unread} {$lang['gl_msg_plural']}"; $res2 = @sql_query("SELECT seeder, count(*) AS pCount FROM peers WHERE userid=" . $CURUSER['id'] . " GROUP BY seeder") or sqlerr(__LINE__, __FILE__); $seedleech = array('yes' => '0', 'no' => '0'); while ($row = mysql_fetch_assoc($res2)) { if ($row['seeder'] == 'yes') { $seedleech['yes'] = $row['pCount']; } else { $seedleech['no'] = $row['pCount']; } } /////////////// REP SYSTEM ///////////// $member_reputation = get_reputation($CURUSER); ////////////// REP SYSTEM END ////////// $usrclass = ""; if ($CURUSER['override_class'] != 255) { $usrclass = " <b>(" . get_user_class_name($CURUSER['class']) . ")</b> "; } elseif ($CURUSER['class'] >= UC_STAFF) { $usrclass = " <a href='./setclass.php'><b>(" . get_user_class_name($CURUSER['class']) . ")</b></a> "; } $StatusBar = ''; $StatusBar = "<div id='statusbar'>\r\n {$lang['gl_msg_welcome']}, " . format_username($CURUSER) . " {$usrclass} {$member_reputation}\r\n\t\t |"; if (!$TBDEV['coins']) { $StatusBar .= "\r\n\t\t Invites: <a href='./invite.php'>{$CURUSER['invites']}</a>\r\n\t\t | {$lang['gl_uploaded']}: {$upped} |"; } if ($TBDEV['coins']) { $StatusBar .= " | {$lang['gl_coins']}:<a href='{$TBDEV['baseurl']}/coins.php'>{$CURUSER['coins']}</a> "; } $StatusBar .= " <a href='./messages.php'>{$inbox}</a> | [<a href='./logout.php'><b>{$lang['gl_logout']}</b></a>] \r\n </div>"; return $StatusBar; }
function userlogin() { global $INSTALLER09, $mc1, $CURBLOCK; unset($GLOBALS["CURUSER"]); $dt = time(); $ip = getip(); $nip = ip2long($ip); if (isset($CURUSER)) { return; } require_once INCL_DIR . 'user_functions.php'; require_once CACHE_DIR . 'bans_cache.php'; if (count($bans) > 0) { foreach ($bans as $k) { if ($nip >= $k['first'] && $nip <= $k['last']) { header("HTTP/1.0 403 Forbidden"); print "<html><body><h1>403 Forbidden</h1>Unauthorized IP address.</body></html>\n"; exit; } } unset($bans); } if (!$INSTALLER09['site_online'] || !get_mycookie('uid') || !get_mycookie('pass') || !get_mycookie('hashv')) { return; } $id = 0 + get_mycookie('uid'); if (!$id or strlen(get_mycookie('pass')) != 32 or get_mycookie('hashv') != hashit($id, get_mycookie('pass'))) { return; } // ==Retro's Announcement mod $prefix = '09skan'; /** let's cache $CURUSER - pdq **/ $row = $mc1->get_value('MyUser_' . $id); if ($row === false) { // $row not found $res = sql_query("SELECT " . $prefix . ".*, ann_main.subject AS curr_ann_subject, ann_main.body AS curr_ann_body, s.last_status, s.last_update, s.archive FROM users AS " . $prefix . " LEFT JOIN announcement_main AS ann_main " . "ON ann_main.main_id = " . $prefix . ".curr_ann_id LEFT JOIN ustatus as s ON s.userid = " . $prefix . ".id WHERE " . $prefix . ".id = {$id} AND " . $prefix . ".enabled='yes' AND " . $prefix . ".status = 'confirmed'") or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($res) == 0) { logoutcookie(); return; } $row = mysql_fetch_assoc($res); //== Do all ints and floats $row['id'] = (int) $row['id']; $row['added'] = (int) $row['added']; $row['last_login'] = (int) $row['last_login']; $row['last_access'] = (int) $row['last_access']; $row['curr_ann_last_check'] = (int) $row['curr_ann_last_check']; $row['curr_ann_id'] = (int) $row['curr_ann_id']; $row['stylesheet'] = (int) $row['stylesheet']; $row['class'] = (int) $row['class']; $row['override_class'] = (int) $row['override_class']; $row['av_w'] = (int) $row['av_w']; $row['av_h'] = (int) $row['av_h']; $row['uploaded'] = (double) $row['uploaded']; $row['downloaded'] = (double) $row['downloaded']; $row['country'] = (int) $row['country']; $row['warned'] = (int) $row['warned']; $row['torrentsperpage'] = (int) $row['torrentsperpage']; $row['topicsperpage'] = (int) $row['topicsperpage']; $row['postsperpage'] = (int) $row['postsperpage']; $row['reputation'] = (int) $row['reputation']; $row['time_offset'] = (double) $row['time_offset']; $row['dst_in_use'] = (int) $row['dst_in_use']; $row['auto_correct_dst'] = (int) $row['auto_correct_dst']; $row['chatpost'] = (int) $row['chatpost']; $row['smile_until'] = (int) $row['smile_until']; $row['seedbonus'] = (double) $row['seedbonus']; $row['vip_until'] = (int) $row['vip_until']; $row['freeslots'] = (int) $row['freeslots']; $row['free_switch'] = (int) $row['free_switch']; $row['invites'] = (int) $row['invites']; $row['invitedby'] = (int) $row['invitedby']; $row['anonymous'] = $row['anonymous']; $row['uploadpos'] = (int) $row['uploadpos']; $row['forumpost'] = (int) $row['forumpost']; $row['downloadpos'] = (int) $row['downloadpos']; $row['immunity'] = (int) $row['immunity']; $row['leechwarn'] = (int) $row['leechwarn']; $row['last_browse'] = (int) $row['last_browse']; $row['sig_w'] = (int) $row['sig_w']; $row['sig_h'] = (int) $row['sig_h']; $row['forum_access'] = (int) $row['forum_access']; $row['hit_and_run_total'] = (int) $row['hit_and_run_total']; $row['donoruntil'] = (int) $row['donoruntil']; $row['donated'] = (int) $row['donated']; $row['total_donated'] = (double) $row['total_donated']; $row['vipclass_before'] = (int) $row['vipclass_before']; $row['passhint'] = (int) $row['passhint']; $row['avatarpos'] = (int) $row['avatarpos']; $row['sendpmpos'] = (int) $row['sendpmpos']; $row['invitedate'] = (int) $row['invitedate']; $row['anonymous_until'] = (int) $row['anonymous_until']; $row['pirate'] = (int) $row['pirate']; $row['king'] = (int) $row['king']; $row['ssluse'] = (int) $row['ssluse']; $row['paranoia'] = (int) $row['paranoia']; $row['parked_until'] = (int) $row['parked_until']; $row['bjwins'] = (int) $row['bjwins']; $row['bjlosses'] = (int) $row['bjlosses']; $row['irctotal'] = (int) $row['irctotal']; $row['last_access_numb'] = (int) $row['last_access_numb']; $row['onlinetime'] = (int) $row['onlinetime']; $ratio = $row['downloaded'] > 0 ? $row['uploaded'] / $row['downloaded'] : 0; $row['ratio'] = number_format($ratio, 2); $row['rep'] = get_reputation($row); $mc1->cache_value('MyUser_' . $id, $row, $INSTALLER09['expires']['curuser']); // set $Cache unset($res); } if (get_mycookie('pass') !== md5($row["passhash"] . $_SERVER["REMOTE_ADDR"])) { return; } //==Allowed staff if ($row["class"] >= UC_STAFF) { $allowed_ID = $INSTALLER09['allowed_staff']['id']; if (!in_array((int) $row["id"], $allowed_ID, true)) { $msg = "Fake Account Detected: Username: "******"username"] . " - UserID: " . $row["id"] . " - UserIP : " . getip(); /** Demote and disable **/ sql_query("UPDATE users SET enabled = 'no', class = 0 WHERE id =" . sqlesc($row["id"]) . "") or sqlerr(__FILE__, __LINE__); write_log($msg); autoshout($msg); logoutcookie(); } } // If curr_ann_id > 0 but curr_ann_body IS NULL, then force a refresh if ($row['curr_ann_id'] > 0 and $row['curr_ann_body'] == NULL) { $row['curr_ann_id'] = 0; $row['curr_ann_last_check'] = '0'; } // If elapsed > 10 minutes, force a announcement refresh. if ($row['curr_ann_last_check'] != '0' and $row['curr_ann_last_check'] < time($dt) - 600) { $row['curr_ann_last_check'] = '0'; } if ($row['curr_ann_id'] == 0 and $row['curr_ann_last_check'] == '0') { // Force an immediate check... $query = sprintf('SELECT m.*,p.process_id FROM announcement_main AS m ' . 'LEFT JOIN announcement_process AS p ON m.main_id = p.main_id ' . 'AND p.user_id = %s ' . 'WHERE p.process_id IS NULL ' . 'OR p.status = 0 ' . 'ORDER BY m.main_id ASC ' . 'LIMIT 1', sqlesc($row['id'])); $result = sql_query($query); if (mysql_num_rows($result)) { // Main Result set exists $ann_row = mysql_fetch_assoc($result); $query = $ann_row['sql_query']; // Ensure it only selects... if (!preg_match('/\\ASELECT.+?FROM.+?WHERE.+?\\z/', $query)) { die; } // The following line modifies the query to only return the current user // row if the existing query matches any attributes. $query .= ' AND u.id = ' . sqlesc($row['id']) . ' LIMIT 1'; $result = sql_query($query); if (mysql_num_rows($result)) { // Announcement valid for member $row['curr_ann_id'] = $ann_row['main_id']; // Create two row elements to hold announcement subject and body. $row['curr_ann_subject'] = $ann_row['subject']; $row['curr_ann_body'] = $ann_row['body']; // Create additional set for main UPDATE query. $add_set = ', curr_ann_id = ' . sqlesc($ann_row['main_id']); $status = 2; } else { // Announcement not valid for member... $add_set = ', curr_ann_last_check = ' . sqlesc($dt); $status = 1; } // Create or set status of process if ($ann_row['process_id'] === NULL) { // Insert Process result set status = 1 (Ignore) $query = sprintf('INSERT INTO announcement_process (main_id, ' . 'user_id, status) VALUES (%s, %s, %s)', sqlesc($ann_row['main_id']), sqlesc($row['id']), sqlesc($status)); } else { // Update Process result set status = 2 (Read) $query = sprintf('UPDATE announcement_process SET status = %s ' . 'WHERE process_id = %s', sqlesc($status), sqlesc($ann_row['process_id'])); } sql_query($query); } else { // No Main Result Set. Set last update to now... $add_set = ', curr_ann_last_check = ' . sqlesc($dt); } unset($result); unset($ann_row); } if ($row['ssluse'] > 1 && !isset($_SERVER['HTTPS']) && !defined('NO_FORCE_SSL')) { $INSTALLER09['baseurl'] = str_replace('http', 'https', $INSTALLER09['baseurl']); header('Location: ' . $INSTALLER09['baseurl'] . $_SERVER['REQUEST_URI']); exit; } //== bitwise curuser bloks by pdq $blocks_key = 'blocks::' . $row['id']; $CURBLOCK = $mc1->get_value($blocks_key); if ($CURBLOCK === false) { $c_sql = sql_query('SELECT * FROM user_blocks WHERE userid = ' . $row['id']) or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($c_sql) == 0) { sql_query('INSERT INTO user_blocks(userid) VALUES(' . $row['id'] . ')'); header('Location: index.php'); die; } $CURBLOCK = mysql_fetch_assoc($c_sql); $CURBLOCK['index_page'] = (int) $CURBLOCK['index_page']; $CURBLOCK['global_stdhead'] = (int) $CURBLOCK['global_stdhead']; $mc1->cache_value($blocks_key, $CURBLOCK, 0); } //== online time pdq $userupdate0 = 'onlinetime = onlinetime + 0'; $new_time = TIME_NOW - $row['last_access_numb']; if ($new_time < 300) { $userupdate0 = "onlinetime = onlinetime + " . $new_time; } $userupdate1 = "last_access_numb = " . TIME_NOW; //end online-time $add_set = isset($add_set) ? $add_set : ''; if ($row['ip'] !== $ip) { sql_query("UPDATE users SET last_access=" . TIME_NOW . ", {$userupdate0}, {$userupdate1}, ip=" . sqlesc($ip) . $add_set . " WHERE id=" . $row['id']); // or die(mysql_error()); $mc1->delete_value('MyUser_' . $row['id']); } elseif ($row['last_access'] != '0' and $row['last_access'] < time($dt) - 180) { sql_query("UPDATE users SET last_access=" . TIME_NOW . ", {$userupdate0}, {$userupdate1}, ip=" . sqlesc($ip) . $add_set . " WHERE id=" . $row['id']); // or die(mysql_error()); $mc1->delete_value('MyUser_' . $row['id']); } //== if ($row['override_class'] < $row['class']) { $row['class'] = $row['override_class']; } // Override class and save in GLOBAL array below. $GLOBALS["CURUSER"] = $row; get_template(); }
function StatusBar() { global $CURUSER, $TBDEV, $lang, $rep_is_on, $mc, $msgalert; if (!$CURUSER) { return "<p align='center'>Yeah Yeah!</p>"; } if (!$TBDEV['coins']) { $upped = mksize($CURUSER['uploaded']); $downed = mksize($CURUSER['downloaded']); $ratio = $CURUSER['downloaded'] > 0 ? $CURUSER['uploaded'] / $CURUSER['downloaded'] : 0; $ratio = number_format($ratio, 2); $color = get_ratio_color($ratio); if ($color) { $ratio = "<font color='{$color}'>{$ratio}</font>"; } } $res1 = @sql_query("SELECT count(id) FROM messages WHERE receiver=" . $CURUSER["id"] . " AND unread='yes'") or sqlerr(__LINE__, __FILE__); $arr1 = mysql_fetch_row($res1); $unread = $arr1[0]; $inbox = $unread == 1 ? "{$unread} {$lang['gl_msg_singular']}" : "{$unread} {$lang['gl_msg_plural']}"; $res2 = @sql_query("SELECT seeder, count(*) AS pCount FROM peers WHERE userid=" . $CURUSER['id'] . " GROUP BY seeder") or sqlerr(__LINE__, __FILE__); $seedleech = array('yes' => '0', 'no' => '0'); while ($row = mysql_fetch_assoc($res2)) { if ($row['seeder'] == 'yes') { $seedleech['yes'] = $row['pCount']; } else { $seedleech['no'] = $row['pCount']; } } //==Rep system $member_reputation = get_reputation($CURUSER); ////////////// REP SYSTEM END ////////// if ($CURUSER['class'] < UC_VIP && $TBDEV['max_slots']) { $ratioq = $CURUSER['downloaded'] > 0 ? $CURUSER['uploaded'] / $CURUSER['downloaded'] : 1; if ($ratioq < 0.95) { switch (true) { case $ratioq < 0.5: $max = 2; break; case $ratioq < 0.65: $max = 3; break; case $ratioq < 0.8: $max = 5; break; case $ratioq < 0.95: $max = 10; break; default: $max = 10; } } else { switch ($CURUSER['class']) { case UC_USER: $max = 20; break; case UC_POWER_USER: $max = 30; break; default: $max = 99; } } } else { $max = 999; } $usrclass = ""; if ($CURUSER['override_class'] != 255) { $usrclass = " <b>(" . get_user_class_name($CURUSER['class']) . ")</b> "; } elseif ($CURUSER['class'] >= UC_MODERATOR) { $usrclass = " <a href='./setclass.php'><b>(" . get_user_class_name($CURUSER['class']) . ")</b></a>"; } $StatusBar = ''; $StatusBar = "{$lang['gl_msg_welcome']}, \r\n\t\t" . format_username($CURUSER) . " {$usrclass} {$member_reputation} [<a href='logout.php'><b>{$lang['gl_logout']}</b></a>]"; if (!$TBDEV['coins']) { $StatusBar .= "<br />{$lang['gl_ratio']}:{$ratio}" . " | {$lang['gl_uploaded']} {$upped}" . " | {$lang['gl_downloaded']} {$downed}<br />"; } if ($TBDEV['coins']) { $StatusBar .= " {$lang['gl_coins']}:<a href='./coins.php'>{$CURUSER['coins']} </a>| "; } $StatusBar .= "{$lang['gl_invite']} <a href='./invite.php'>{$CURUSER['invites']}</a> |" . "\r\n\t\tBonus <a href='./mybonus.php'>{$CURUSER['seedbonus']}</a> " . "\r\n\t\t<br /><a href='./messages.php'>{$inbox}</a> |\r\n\t\t {$lang['gl_act_torrents']}: <img alt='{$lang['gl_seed_torrents']}' title='{$lang['gl_seed_torrents']}' src='{$TBDEV['pic_base_url']}up.png' /> {$seedleech['yes']}" . " <img alt='{$lang['gl_leech_torrents']}' title='{$lang['gl_leech_torrents']}' src='{$TBDEV['pic_base_url']}dl.png' /> " . ($TBDEV['max_slots'] ? "<a title='I have " . $max . " Download Slots'>{$seedleech['no']}/" . $max . "</a>" : $seedleech['no']) . "\r\n\t\t<br /><br /><br />\r\n <b><a href='./chat.php'>{$lang['gl_chat']}</a> \r\n | <a href='./rules.php'>{$lang['gl_rules']}</a> | <a href='./faq.php'>{$lang['gl_faq']}</a> \r\n | <a href='./usercp.php'>{$lang['gl_profile']}</a> | <a href='./donate.php'><span style='color:#1573b9'>{$lang['gl_donate']}</span></a> | <a href='./bet.php'><span style='color:#1573b9'>{$lang['gl_bet']}</span></a> | <a href='./contactstaff.php'><span style='color:red'>{$lang['gl_help']}</span></a> |</b>"; return $StatusBar; }
} $s .= "</select>\n"; $s .= "<input type=\"submit\" value=\"Vote!\" />"; $s .= "</form>\n"; } } $s .= "</td></tr></table>"; $HTMLOUT .= tr("Rating", $s, 1); $HTMLOUT .= tr("{$lang['details_last_seeder']}", "{$lang['details_last_activity']}" . get_date($row['lastseed'], '', 0, 1)); $HTMLOUT .= tr("{$lang['details_size']}", mksize($row["size"]) . " (" . number_format($row["size"]) . "{$lang['details_bytes']})"); $HTMLOUT .= tr("{$lang['details_added']}", get_date($row['added'], "{$lang['details_long']}")); $HTMLOUT .= tr("{$lang['details_views']}", $row["views"]); $HTMLOUT .= tr("{$lang['details_hits']}", $row["hits"]); $HTMLOUT .= tr("{$lang['details_snatched']}", $row["times_completed"] > 0 ? "<a href='./snatches.php?id={$id}'>{$row['times_completed']} {$lang['details_times']}</a>" : "0 {$lang['details_times']}", 1); //==Reputation $member_reputation = get_reputation($row, 'torrents'); $HTMLOUT .= "<tr><td class='rowhead' valign='top' align='right' width='1%'>Torrent<br/>{$lang['details_rep']}</td><td align='left' width='99%'>\r\n {$member_reputation} (counts towards uploaders Reputation)<br />\r\n </td></tr>"; //==Anonymous if ($row['anonymous'] == 'yes') { if ($CURUSER['class'] < UC_UPLOADER) { $uprow = "<i>Anonymous</i>"; } else { $uprow = "<i>Anonymous</i> (<a href='userdetails.php?id={$row['owner']}'><b>{$row['username']}</b></a>)"; } } else { $uprow = isset($row["username"]) ? "<a href='./userdetails.php?id=" . $row["owner"] . "'><b>" . htmlspecialchars($row["username"]) . "</b></a>" : "<i>{$lang['details_unknown']}</i>"; } if ($owned) { $uprow .= " {$spacer}<{$editlink}><b>{$lang['details_edit']}</b></a>"; } $HTMLOUT .= tr("Upped by", $uprow, 1);
begin_frame(); $res = sql_query("SELECT p.id, p.added, p.userid, p.added, p.body, p.editedby, p.editedat,p.posticon, u.id as uid, u.username as uusername, u.class, u.avatar, u.donor, u.title, u.mood, u.reputation, u.country, u.enabled, u.warned, u.uploaded, u.downloaded, u.signature, u.last_access, (SELECT COUNT(id) FROM posts WHERE userid = u.id) AS posts_count, u2.username as u2_username " . ($use_attachment_mod ? ", at.id as at_id, at.filename as at_filename, at.postid as at_postid, at.size as at_size, at.downloads as at_downloads, at.owner as at_owner " : "") . ", (SELECT lastpostread FROM readposts WHERE userid = " . sqlesc((int) $CURUSER['id']) . " AND topicid = p.topicid LIMIT 1) AS lastpostread " . "FROM posts AS p " . "LEFT JOIN users AS u ON p.userid = u.id " . ($use_attachment_mod ? "LEFT JOIN attachments AS at ON at.postid = p.id " : "") . "LEFT JOIN users AS u2 ON u2.id = p.editedby " . "WHERE p.topicid = " . sqlesc($topicid) . " ORDER BY id LIMIT {$offset}, {$perpage}") or sqlerr(__FILE__, __LINE__); $pc = mysql_num_rows($res); $pn = 0; while ($arr = mysql_fetch_assoc($res)) { ++$pn; $lpr = $arr['lastpostread']; $postid = (int) $arr["id"]; $postadd = $arr['added']; $posterid = (int) $arr['userid']; $posticon = $arr["posticon"] > 0 ? "<img src=\"pic/post_icons/icon" . $arr["posticon"] . ".gif\" style=\"padding-left:3px;\" title=\"post icon\" />" : " "; $added = $arr['added'] . " GMT <font class=small>(" . get_elapsed_time(sql_timestamp_to_unix_timestamp($arr['added'])) . ")</font>"; // ---- Get poster details $uploaded = prefixed($arr['uploaded']); $downloaded = prefixed($arr['downloaded']); $member_reputation = $arr['uusername'] != '' ? get_reputation($arr) : ''; $last_access = $arr['last_access']; if ($arr['downloaded'] > 0) { $ratio = $arr['uploaded'] / $arr['downloaded']; $color = get_ratio_color($ratio); $ratio = number_format($ratio, 3); if ($color) { $ratio = "<font color={$color}>" . $ratio . "</font>"; } } else { if ($arr['uploaded'] > 0) { $ratio = "∞"; } else { $ratio = "---"; } }
/** |--------------------------------------------------------------------------| | https://github.com/Bigjoos/ | |--------------------------------------------------------------------------| | Licence Info: GPL | |--------------------------------------------------------------------------| | Copyright (C) 2010 U-232 V4 | |--------------------------------------------------------------------------| | A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon. | |--------------------------------------------------------------------------| | Project Leaders: Mindless,putyn. | |--------------------------------------------------------------------------| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ ( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e ) \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ */ function commenttable($rows, $variant = 'torrent') { require_once INCL_DIR . 'html_functions.php'; require_once INCL_DIR . 'add_functions.php'; global $CURUSER, $INSTALLER09, $mood, $mc1; $lang = load_language('torrenttable_functions'); $htmlout = ''; $count = 0; $variant_options = array('torrent' => 'details', 'request' => 'viewrequests'); if (isset($variant_options[$variant])) { $locale_link = $variant_options[$variant]; } else { return; } $extra_link = $variant == 'request' ? '&type=request' : ($variant == 'offer' ? '&type=offer' : ''); $htmlout .= begin_main_frame(); $htmlout .= begin_frame(); foreach ($rows as $row) { $moodname = isset($mood['name'][$row['mood']]) ? htmlsafechars($mood['name'][$row['mood']]) : 'is feeling neutral'; $moodpic = isset($mood['image'][$row['mood']]) ? htmlsafechars($mood['image'][$row['mood']]) : 'noexpression.gif'; $htmlout .= "<p class='sub'>#{$row["id"]} {$lang["commenttable_by"]} "; // --------------- likes start------ $att_str = ''; if (!empty($row['user_likes'])) { $likes = explode(',', $row['user_likes']); } else { $likes = ''; } if (!empty($likes) && count(array_unique($likes)) > 0) { if (in_array($CURUSER['id'], $likes)) { if (count($likes) == 1) { $att_str = jq('You like this'); } elseif (count(array_unique($likes)) > 1) { $att_str = jq('You and ') . (count(array_unique($likes)) - 1 == '1' ? '1 other person likes this' : count($likes) - 1 . 'others like this'); } } elseif (!in_array($CURUSER['id'], $likes)) { if (count(array_unique($likes)) == 1) { $att_str = '1 other person likes this'; } elseif (count(array_unique($likes)) > 1) { $att_str = count(array_unique($likes)) . ' others like this'; } } } $wht = !empty($likes) && count(array_unique($likes)) > 0 && in_array($CURUSER['id'], $likes) ? 'unlike' : 'like'; // --------------- likes end------ if (isset($row["username"])) { if ($row['anonymous'] == 'yes') { //$htmlout.= '/*<![CDATA[*/'; $htmlout .= ($CURUSER['class'] >= UC_STAFF ? 'Anonymous - Posted by: <b>' . htmlsafechars($row['username']) . '</b> ID: ' . (int) $row['user'] . '' : 'Anonymous') . ' '; } else { $title = $row["title"]; if ($title == "") { $title = get_user_class_name($row["class"]); } else { $title = htmlsafechars($title); } $username = htmlsafechars($row['username']); $avatar1 = $row['anonymous'] == 'yes' ? "<img src=\\'{$INSTALLER09['pic_base_url']}anonymous_1.jpg\\' width=\\'150\\' height=\\'150\\' border=\\'0\\' alt=\\'Avatar\\' title=\\'Avatar\\' />" : "<img src=\\'" . htmlsafechars($row['avatar']) . "\\' width=\\'150\\' height=\\'150\\' border=\\'0\\' alt=\\'Avatar\\' title=\\'Avatar\\' />"; if (!$avatar1) { $avatar1 = "{$INSTALLER09['pic_base_url']}default_avatar.gif"; } $htmlout .= "<a name='comm" . (int) $row["id"] . "' onmouseover=\"Tip('<b>{$username}</b><br />{$avatar1}');\" onmouseout=\"UnTip();\" href='userdetails.php?id=" . (int) $row["user"] . "'><b>" . htmlsafechars($row["username"]) . "</b></a>" . ($row["donor"] == "yes" ? "<img src='{$INSTALLER09['pic_base_url']}star.gif' alt='" . $lang["commenttable_donor_alt"] . "' />" : "") . ($row["warned"] == "yes" ? "<img src='{$INSTALLER09['pic_base_url']}warned.gif' alt='" . $lang["commenttable_warned_alt"] . "' />" : "") . " ({$title})\n"; $htmlout .= '<a href="javascript:;" onclick="PopUp(\'usermood.php\',\'Mood\',530,500,1,1);"> <span class="tool"><img src="' . $INSTALLER09['pic_base_url'] . 'smilies/' . $moodpic . '" alt="' . $moodname . '" border="0" /> <span class="tip">' . ($row['anonymous'] == 'yes' ? '<i>Anonymous</i>' : htmlsafechars($row['username'])) . ' ' . $moodname . ' !</span></span></a>'; } } else { $htmlout .= "<a name='comm" . (int) $row["id"] . "'><i>(" . $lang["commenttable_orphaned"] . ")</i></a>\n"; } $htmlout .= get_date($row['added'], ''); $htmlout .= ($row["user"] == $CURUSER["id"] || $CURUSER["class"] >= UC_STAFF ? "- [<a href='comment.php?action=edit&cid=" . (int) $row['id'] . $extra_link . "&tid=" . $row[$variant] . "'>" . $lang["commenttable_edit"] . "</a>]" : "") . ($CURUSER["class"] >= UC_VIP ? " - [<a href='report.php?type=Comment&id=" . (int) $row['id'] . "'>Report this Comment</a>]" : "") . ($CURUSER["class"] >= UC_STAFF ? " - [<a href='comment.php?action=delete&cid=" . (int) $row['id'] . $extra_link . "&tid=" . $row[$variant] . "'>" . $lang["commenttable_delete"] . "</a>]" : "") . ($row["editedby"] && $CURUSER["class"] >= UC_STAFF ? "- [<a href='comment.php?action=vieworiginal&cid=" . (int) $row['id'] . $extra_link . "&tid=" . $row[$variant] . "'>" . $lang["commenttable_view_original"] . "</a>]" : "") . "\n\t\t\n\t\t <span id='mlike' data-com='" . (int) $row["id"] . "' class='comment {$wht}'>[" . ucfirst($wht) . "]</span><span class='tot-" . (int) $row["id"] . "' data-tot='" . (!empty($likes) && count(array_unique($likes)) > 0 ? count(array_unique($likes)) : '') . "'> {$att_str}</span></p>\n"; $avatar = $row['anonymous'] == "yes" ? "{$INSTALLER09['pic_base_url']}anonymous_1.jpg" : htmlsafechars($row["avatar"]); if (!$avatar) { $avatar = "{$INSTALLER09['pic_base_url']}default_avatar.gif"; } $text = format_comment($row["text"]); if ($row["editedby"]) { $text .= "<p><font size='1' class='small'>" . $lang["commenttable_last_edited_by"] . " <a href='userdetails.php?id=" . (int) $row['editedby'] . "'><b>" . htmlsafechars($row['edit_name']) . "</b></a> " . $lang["commenttable_last_edited_at"] . " " . get_date($row['editedat'], 'DATE') . "</font></p>\n"; } $htmlout .= begin_table(true); $htmlout .= "<tr valign='top'>\n"; $htmlout .= "<td align='center' width='150' style='padding: 0px'><img width='150' height='150' src='{$avatar}' alt='' /><br />" . get_reputation($row, 'comments') . "</td>\n"; $htmlout .= "<td class='text'>{$text}</td>\n"; $htmlout .= "</tr>\n"; $htmlout .= end_table(); //$htmlout.= '/*]]>*/'; } $htmlout .= end_frame(); $htmlout .= end_main_frame(); return $htmlout; }
$forumpermissions[$post['fid']] = forum_permissions($post['fid']); } // Make sure we can view this post if (isset($forumpermissions[$post['fid']]['canonlyviewownthreads']) && $forumpermissions[$post['fid']]['canonlyviewownthreads'] == 1 && $post['uid'] != $mybb->user['uid']) { continue; } $post_reputation[$post['pid']] = $post; } } $reputation_votes = ''; foreach ($reputation_cache as $reputation_vote) { // Get the reputation for the user who posted this comment if ($reputation_vote['adduid'] == 0) { $reputation_vote['user_reputation'] = 0; } $reputation_vote['user_reputation'] = get_reputation($reputation_vote['user_reputation'], $reputation_vote['adduid']); // Format the username of this poster if (!$reputation_vote['username']) { $reputation_vote['username'] = $lang->na; $reputation_vote['user_reputation'] = ''; } else { $reputation_vote['username'] = format_name($reputation_vote['username'], $reputation_vote['user_usergroup'], $reputation_vote['user_displaygroup']); $reputation_vote['username'] = build_profile_link($reputation_vote['username'], $reputation_vote['uid']); $reputation_vote['user_reputation'] = "({$reputation_vote['user_reputation']})"; } $vote_reputation = (int) $reputation_vote['reputation']; // This is a negative reputation if ($vote_reputation < 0) { $status_class = "trow_reputation_negative"; $vote_type_class = "reputation_negative"; $vote_type = $lang->negative;
function StatusBar() { global $CURUSER, $INSTALLER09, $lang, $rep_is_on, $mc1, $msgalert; if (!$CURUSER) { return ""; } $upped = mksize($CURUSER['uploaded']); $downed = mksize($CURUSER['downloaded']); //==Memcache unread pms $PMCount = 0; if (($unread1 = $mc1->get_value('inbox_new_sb_' . $CURUSER['id'])) === false) { $res1 = sql_query("SELECT COUNT(id) FROM messages WHERE receiver=" . sqlesc($CURUSER['id']) . " AND unread = 'yes' AND location = '1'") or sqlerr(__LINE__, __FILE__); list($PMCount) = mysqli_fetch_row($res1); $PMCount = (int) $PMCount; $unread1 = $mc1->cache_value('inbox_new_sb_' . $CURUSER['id'], $PMCount, $INSTALLER09['expires']['unread']); } $inbox = $unread1 == 1 ? "{$unread1} {$lang['gl_msg_singular']}" : "{$unread1} {$lang['gl_msg_plural']}"; //==Memcache peers if (XBT_TRACKER == true) { if (($MyPeersXbtCache = $mc1->get_value('MyPeers_XBT_' . $CURUSER['id'])) === false) { $seed['yes'] = $seed['no'] = 0; $seed['conn'] = 3; $r = sql_query("SELECT COUNT(uid) AS `count`, `left`, `active`, `connectable` FROM `xbt_files_users` WHERE uid= " . sqlesc($CURUSER['id']) . " GROUP BY `left`") or sqlerr(__LINE__, __FILE__); while ($a = mysqli_fetch_assoc($r)) { $key = $a['left'] == 0 ? 'yes' : 'no'; $seed[$key] = number_format(0 + $a['count']); $seed['conn'] = $a['connectable'] == 0 ? 1 : 2; } $mc1->cache_value('MyPeers_XBT_' . $CURUSER['id'], $seed, $INSTALLER09['expires']['MyPeers_xbt_']); unset($r, $a); } else { $seed = $MyPeersXbtCache; } // for display connectable 1 / 2 / 3 if (!empty($seed['conn'])) { switch ($seed['conn']) { case 1: $connectable = "<img src='{$INSTALLER09['pic_base_url']}notcon.png' alt='{$lang['gl_not_connectable']}' title='{$lang['gl_not_connectable']}' />"; break; case 2: $connectable = "<img src='{$INSTALLER09['pic_base_url']}yescon.png' alt='{$lang['gl_connectable']}' title='{$lang['gl_connectable']}' />"; break; default: $connectable = "{$lang['gl_na_connectable']}"; } } else { $connectable = $lang['gl_na_connectable']; } } else { if (($MyPeersCache = $mc1->get_value('MyPeers_' . $CURUSER['id'])) === false) { $seed['yes'] = $seed['no'] = 0; $seed['conn'] = 3; $r = sql_query("SELECT COUNT(id) AS count, seeder, connectable FROM peers WHERE userid=" . sqlesc($CURUSER['id']) . " GROUP BY seeder"); while ($a = mysqli_fetch_assoc($r)) { $key = $a['seeder'] == 'yes' ? 'yes' : 'no'; $seed[$key] = number_format(0 + $a['count']); $seed['conn'] = $a['connectable'] == 'no' ? 1 : 2; } $mc1->cache_value('MyPeers_' . $CURUSER['id'], $seed, $INSTALLER09['expires']['MyPeers_']); unset($r, $a); } else { $seed = $MyPeersCache; } // for display connectable 1 / 2 / 3 if (!empty($seed['conn'])) { switch ($seed['conn']) { case 1: $connectable = "<img src='{$INSTALLER09['pic_base_url']}notcon.png' alt='{$lang['gl_not_connectable']}' title='{$lang['gl_not_connectable']}' />"; break; case 2: $connectable = "<img src='{$INSTALLER09['pic_base_url']}yescon.png' alt='{$lang['gl_connectable']}' title='{$lang['gl_connectable']}' />"; break; default: $connectable = "{$lang['gl_na_connectable']}"; } } else { $connectable = $lang['gl_na_connectable']; } } if (($Achievement_Points = $mc1->get_value('user_achievement_points_' . $CURUSER['id'])) === false) { $Sql = sql_query("SELECT users.id, users.username, usersachiev.achpoints, usersachiev.spentpoints FROM users LEFT JOIN usersachiev ON users.id = usersachiev.id WHERE users.id = " . sqlesc($CURUSER['id'])) or sqlerr(__FILE__, __LINE__); $Achievement_Points = mysqli_fetch_assoc($Sql); $Achievement_Points['id'] = (int) $Achievement_Points['id']; $Achievement_Points['achpoints'] = (int) $Achievement_Points['achpoints']; $Achievement_Points['spentpoints'] = (int) $Achievement_Points['spentpoints']; $mc1->cache_value('user_achievement_points_' . $CURUSER['id'], $Achievement_Points, 0); } $member_reputation = get_reputation($CURUSER); $usrclass = ""; if ($CURUSER['override_class'] != 255) { $usrclass = " <b>(" . get_user_class_name($CURUSER['class']) . ")</b> "; } else { if ($CURUSER['class'] >= UC_STAFF) { $usrclass = " <a href='./setclass.php'><b>(" . get_user_class_name($CURUSER['class']) . ")</b></a> "; } } $StatusBar = $clock = ''; $StatusBar .= "\n <!-- U-232 Source - Print Statusbar/User Menu -->\n <script type='text/javascript'>\n //<![CDATA[\n function showSlidingDiv(){\n \$('#slidingDiv').animate({'height': 'toggle'}, { duration: 1000 });\n }\n //]]>\n </script>\n <div id='base_usermenu'>" . format_username($CURUSER) . " <span id='clock'>{$clock}</span> <span class='base_usermenu_arrow'><a href='#' onclick='showSlidingDiv(); return false;'><i class='icon-chevron-down'></i></a></span></div>\n <div id='slidingDiv'>\n <div class='slide_head'>{$lang['gl_pstats']}</div>\n " . (isset($CURUSER) && $CURUSER['class'] < UC_STAFF ? "<div class='slide_a'>{$lang['gl_uclass']}</div><div class='slide_b'><b>(" . get_user_class_name($CURUSER['class']) . ")</b></div>" : "<div class='slide_a'>{$lang['gl_uclass']}</div><div class='slide_b'>{$usrclass}</div>") . "\n <div class='slide_c'>{$lang['gl_rep']}</div><div class='slide_d'>{$member_reputation}</div>\n <div class='slide_a'>{$lang['gl_invites']}</div><div class='slide_b'><a href='./invite.php'>{$CURUSER['invites']}</a></div>\n <div class='slide_c'>{$lang['gl_karma']}</div><div class='slide_d'><a href='./mybonus.php'>{$CURUSER['seedbonus']}</a></div>\n <div class='slide_a'>{$lang['gl_achpoints']}</div><div class='slide_b'><a href='./achievementhistory.php?id={$CURUSER['id']}'>" . (int) $Achievement_Points['achpoints'] . "</a></div>\n <div class='slide_head'>{$lang['gl_tstats']}</div>\n <div class='slide_a'>{$lang['gl_shareratio']}</div><div class='slide_b'>" . member_ratio($CURUSER['uploaded'], $INSTALLER09['ratio_free'] ? "0" : $CURUSER['downloaded']) . "</div>"; if ($INSTALLER09['ratio_free']) { $StatusBar .= "<div class='slide_c'>{$lang['gl_uploaded']}</div><div class='slide_d'>{$upped}</div>"; } else { $StatusBar .= "<div class='slide_c'>{$lang['gl_uploaded']}</div><div class='slide_d'>{$upped}</div>\n <div class='slide_a'>{$lang['gl_downloaded']}</div><div class='slide_b'>{$downed}</div>"; } $StatusBar .= "<div class='slide_c'>{$lang['gl_seed_torrents']}</div><div class='slide_d'>{$seed['yes']}</div>\n <div class='slide_a'>{$lang['gl_leech_torrents']}</div><div class='slide_b'>{$seed['no']}</div>\n <div class='slide_c'>{$lang['gl_connectable']}</div><div class='slide_d'>{$connectable}</div>\n " . (isset($CURUSER) && $CURUSER['got_blocks'] == 'yes' ? "<div class='slide_head'>{$lang['gl_userblocks']}</div><div class='slide_a'>{$lang['gl_myblocks']}</div><div class='slide_b'><a href='./user_blocks.php'>{$lang['gl_click']}</a></div>" : "") . "\n " . (isset($CURUSER) && $CURUSER['got_moods'] == 'yes' ? "<div class='slide_c'>{$lang['gl_myunlocks']}</div><div class='slide_d'><a href='./user_unlocks.php'>{$lang['gl_click']}</a></div>" : "") . "\n </div>"; $StatusBar .= '<script type="text/javascript"> //<![CDATA[ function refrClock(){ var d=new Date(); var s=d.getSeconds(); var m=d.getMinutes(); var h=d.getHours(); var day=d.getDay(); var date=d.getDate(); var month=d.getMonth(); var year=d.getFullYear(); var am_pm; if (s<10) {s="0" + s} if (m<10) {m="0" + m} if (h>12) {h-=12;am_pm = "Pm"} else {am_pm="Am"} if (h<10) {h="0" + h} document.getElementById("clock").innerHTML=h + ":" + m + ":" + s + " " + am_pm; setTimeout("refrClock()",1000); } refrClock(); //]]> </script>'; return $StatusBar; }
/** * Build a post bit * * @param array $post The post data * @param int $post_type The type of post bit we're building (1 = preview, 2 = pm, 3 = announcement, else = post) * @return string The built post bit */ function build_postbit($post, $post_type = 0) { global $db, $altbg, $theme, $mybb, $postcounter, $profile_fields; global $titlescache, $page, $templates, $forumpermissions, $attachcache; global $lang, $ismod, $inlinecookie, $inlinecount, $groupscache, $fid; global $plugins, $parser, $cache, $ignored_users, $hascustomtitle; $hascustomtitle = 0; // Set default values for any fields not provided here foreach (array('pid', 'aid', 'pmid', 'posturl', 'button_multiquote', 'subject_extra', 'attachments', 'button_rep', 'button_warn', 'button_purgespammer', 'button_pm', 'button_pubkey', 'button_reply_pm', 'button_replyall_pm', 'button_forward_pm', 'button_delete_pm', 'replink', 'warninglevel') as $post_field) { if (empty($post[$post_field])) { $post[$post_field] = ''; } } // Set up the message parser if it doesn't already exist. if (!$parser) { require_once MYBB_ROOT . "inc/class_parser.php"; $parser = new postParser(); } if (!function_exists("purgespammer_show")) { require_once MYBB_ROOT . "inc/functions_user.php"; } $unapproved_shade = ''; if (isset($post['visible']) && $post['visible'] == 0 && $post_type == 0) { $altbg = $unapproved_shade = 'unapproved_post'; } elseif (isset($post['visible']) && $post['visible'] == -1 && $post_type == 0) { $altbg = $unapproved_shade = 'unapproved_post deleted_post'; } elseif ($altbg == 'trow1') { $altbg = 'trow2'; } else { $altbg = 'trow1'; } $post['fid'] = $fid; switch ($post_type) { case 1: // Message preview global $forum; $parser_options['allow_html'] = $forum['allowhtml']; $parser_options['allow_mycode'] = $forum['allowmycode']; $parser_options['allow_smilies'] = $forum['allowsmilies']; $parser_options['allow_imgcode'] = $forum['allowimgcode']; $parser_options['allow_videocode'] = $forum['allowvideocode']; $parser_options['me_username'] = $post['username']; $parser_options['filter_badwords'] = 1; $id = 0; break; case 2: // Private message global $message, $pmid; $idtype = 'pmid'; $parser_options['allow_html'] = $mybb->settings['pmsallowhtml']; $parser_options['allow_mycode'] = $mybb->settings['pmsallowmycode']; $parser_options['allow_smilies'] = $mybb->settings['pmsallowsmilies']; $parser_options['allow_imgcode'] = $mybb->settings['pmsallowimgcode']; $parser_options['allow_videocode'] = $mybb->settings['pmsallowvideocode']; $parser_options['me_username'] = $post['username']; $parser_options['filter_badwords'] = 1; $id = $pmid; break; case 3: // Announcement global $announcementarray, $message; $parser_options['allow_html'] = $announcementarray['allowhtml']; $parser_options['allow_mycode'] = $announcementarray['allowmycode']; $parser_options['allow_smilies'] = $announcementarray['allowsmilies']; $parser_options['allow_imgcode'] = 1; $parser_options['allow_videocode'] = 1; $parser_options['me_username'] = $post['username']; $parser_options['filter_badwords'] = 1; $id = $announcementarray['aid']; break; default: // Regular post global $forum, $thread, $tid; $oldforum = $forum; $id = (int) $post['pid']; $idtype = 'pid'; $parser_options['allow_html'] = $forum['allowhtml']; $parser_options['allow_mycode'] = $forum['allowmycode']; $parser_options['allow_smilies'] = $forum['allowsmilies']; $parser_options['allow_imgcode'] = $forum['allowimgcode']; $parser_options['allow_videocode'] = $forum['allowvideocode']; $parser_options['filter_badwords'] = 1; if (!$post['username']) { $post['username'] = $lang->guest; } if ($post['userusername']) { $parser_options['me_username'] = $post['userusername']; } else { $parser_options['me_username'] = $post['username']; } break; } if (!$postcounter) { // Used to show the # of the post if ($page > 1) { if (!$mybb->settings['postsperpage'] || (int) $mybb->settings['postsperpage'] < 1) { $mybb->settings['postsperpage'] = 20; } $postcounter = $mybb->settings['postsperpage'] * ($page - 1); } else { $postcounter = 0; } $post_extra_style = "border-top-width: 0;"; } elseif ($mybb->input['mode'] == "threaded") { $post_extra_style = "border-top-width: 0;"; } else { $post_extra_style = "margin-top: 5px;"; } if (!$altbg) { // Define the alternate background colour if this is the first post $altbg = "trow1"; } $postcounter++; // Format the post date and time using my_date //$post['postdate'] = my_date('relative', $post['dateline']); $post['postdate'] = date('Y-m-d', $post['dateline']); // Dont want any little 'nasties' in the subject $post['subject'] = $parser->parse_badwords($post['subject']); // Pm's have been htmlspecialchars_uni()'ed already. if ($post_type != 2) { $post['subject'] = htmlspecialchars_uni($post['subject']); } if (empty($post['subject'])) { $post['subject'] = ' '; } $post['author'] = $post['uid']; $post['subject_title'] = $post['subject']; // Get the usergroup if ($post['userusername']) { if (!$post['displaygroup']) { $post['displaygroup'] = $post['usergroup']; } $usergroup = $groupscache[$post['displaygroup']]; } else { $usergroup = $groupscache[1]; } if (!is_array($titlescache)) { $cached_titles = $cache->read("usertitles"); if (!empty($cached_titles)) { foreach ($cached_titles as $usertitle) { $titlescache[$usertitle['posts']] = $usertitle; } } if (is_array($titlescache)) { krsort($titlescache); } unset($usertitle, $cached_titles); } // Work out the usergroup/title stuff $post['groupimage'] = ''; if (!empty($usergroup['image'])) { $language = $mybb->settings['bblanguage']; if (!empty($mybb->user['language'])) { $language = $mybb->user['language']; } $usergroup['image'] = str_replace("{lang}", $language, $usergroup['image']); $usergroup['image'] = str_replace("{theme}", $theme['imgdir'], $usergroup['image']); eval("\$post['groupimage'] = \"" . $templates->get("postbit_groupimage") . "\";"); if ($mybb->settings['postlayout'] == "classic") { $post['groupimage'] .= "<br />"; } } if ($post['userusername']) { // This post was made by a registered user $post['username'] = $post['userusername']; $post['profilelink_plain'] = get_profile_link($post['uid']); $post['username_formatted'] = format_name($post['username'], $post['usergroup'], $post['displaygroup']); $post['profilelink'] = build_profile_link($post['username_formatted'], $post['uid']); if (trim($post['usertitle']) != "") { $hascustomtitle = 1; } if ($usergroup['usertitle'] != "" && !$hascustomtitle) { $post['usertitle'] = $usergroup['usertitle']; } elseif (is_array($titlescache) && !$usergroup['usertitle']) { reset($titlescache); foreach ($titlescache as $key => $titleinfo) { if ($post['postnum'] >= $key) { if (!$hascustomtitle) { $post['usertitle'] = $titleinfo['title']; } $post['stars'] = $titleinfo['stars']; $post['starimage'] = $titleinfo['starimage']; break; } } } $post['usertitle'] = htmlspecialchars_uni($post['usertitle']); if ($usergroup['stars']) { $post['stars'] = $usergroup['stars']; } if (empty($post['starimage'])) { $post['starimage'] = $usergroup['starimage']; } if ($post['starimage'] && $post['stars']) { // Only display stars if we have an image to use... $post['starimage'] = str_replace("{theme}", $theme['imgdir'], $post['starimage']); $post['userstars'] = ''; for ($i = 0; $i < $post['stars']; ++$i) { eval("\$post['userstars'] .= \"" . $templates->get("postbit_userstar", 1, 0) . "\";"); } $post['userstars'] .= "<br />"; } $postnum = $post['postnum']; $post['postnum'] = my_number_format($post['postnum']); $post['threadnum'] = my_number_format($post['threadnum']); // Determine the status to show for the user (Online/Offline/Away) /* $timecut = TIME_NOW - $mybb->settings['wolcutoff']; if($post['lastactive'] > $timecut && ($post['invisible'] != 1 || $mybb->usergroup['canviewwolinvis'] == 1) && $post['lastvisit'] != $post['lastactive']) { eval("\$post['onlinestatus'] = \"".$templates->get("postbit_online")."\";"); } else { if($post['away'] == 1 && $mybb->settings['allowaway'] != 0) { eval("\$post['onlinestatus'] = \"".$templates->get("postbit_away")."\";"); } else { eval("\$post['onlinestatus'] = \"".$templates->get("postbit_offline")."\";"); } } */ // Show as always offline eval("\$post['onlinestatus'] = \"" . $templates->get("postbit_offline") . "\";"); $post['useravatar'] = ''; if (isset($mybb->user['showavatars']) && $mybb->user['showavatars'] != 0 || $mybb->user['uid'] == 0) { $useravatar = format_avatar($post['avatar'], $post['avatardimensions'], $mybb->settings['postmaxavatarsize']); eval("\$post['useravatar'] = \"" . $templates->get("postbit_avatar") . "\";"); } $post['button_find'] = ''; if ($mybb->usergroup['cansearch'] == 1) { eval("\$post['button_find'] = \"" . $templates->get("postbit_find") . "\";"); } if ($mybb->settings['enablepms'] == 1 && $post['receivepms'] != 0 && $mybb->usergroup['cansendpms'] == 1 && my_strpos("," . $post['ignorelist'] . ",", "," . $mybb->user['uid'] . ",") === false) { //eval("\$post['button_pm'] = \"".$templates->get("postbit_pm")."\";"); } $post['button_rep'] = ''; if ($post_type != 3 && $mybb->settings['enablereputation'] == 1 && $mybb->settings['postrep'] == 1 && $mybb->usergroup['cangivereputations'] == 1 && $usergroup['usereputationsystem'] == 1 && ($mybb->settings['posrep'] || $mybb->settings['neurep'] || $mybb->settings['negrep']) && $post['uid'] != $mybb->user['uid'] && $post['visible'] == 1) { if (!$post['pid']) { $post['pid'] = 0; } eval("\$post['button_rep'] = \"" . $templates->get("postbit_rep_button") . "\";"); } if ($post['website'] != "" && !is_member($mybb->settings['hidewebsite']) && $usergroup['canchangewebsite'] == 1) { $post['website'] = htmlspecialchars_uni($post['website']); eval("\$post['button_www'] = \"" . $templates->get("postbit_www") . "\";"); } else { $post['button_www'] = ""; } if ($post['hideemail'] != 1 && $mybb->usergroup['cansendemail'] == 1) { eval("\$post['button_email'] = \"" . $templates->get("postbit_email") . "\";"); } else { $post['button_email'] = ""; } $post['userregdate'] = $lang->na; //my_date($mybb->settings['regdateformat'], $post['regdate']); // Work out the reputation this user has (only show if not announcement) if ($post_type != 3 && $usergroup['usereputationsystem'] != 0 && $mybb->settings['enablereputation'] == 1) { $post['userreputation'] = get_reputation($post['reputation'], $post['uid']); eval("\$post['replink'] = \"" . $templates->get("postbit_reputation") . "\";"); } // Showing the warning level? (only show if not announcement) if ($post_type != 3 && $mybb->settings['enablewarningsystem'] != 0 && $usergroup['canreceivewarnings'] != 0 && ($mybb->usergroup['canwarnusers'] != 0 || $mybb->user['uid'] == $post['uid'] && $mybb->settings['canviewownwarning'] != 0)) { if ($mybb->settings['maxwarningpoints'] < 1) { $mybb->settings['maxwarningpoints'] = 10; } $warning_level = round($post['warningpoints'] / $mybb->settings['maxwarningpoints'] * 100); if ($warning_level > 100) { $warning_level = 100; } $warning_level = get_colored_warning_level($warning_level); // If we can warn them, it's not the same person, and we're in a PM or a post. if ($mybb->usergroup['canwarnusers'] != 0 && $post['uid'] != $mybb->user['uid'] && ($post_type == 0 || $post_type == 2)) { eval("\$post['button_warn'] = \"" . $templates->get("postbit_warn") . "\";"); $warning_link = "warnings.php?uid={$post['uid']}"; } else { $post['button_warn'] = ''; $warning_link = "usercp.php"; } eval("\$post['warninglevel'] = \"" . $templates->get("postbit_warninglevel") . "\";"); } if ($post_type != 3 && $post_type != 1 && purgespammer_show($post['postnum'], $post['usergroup'], $post['uid'])) { eval("\$post['button_purgespammer'] = \"" . $templates->get('postbit_purgespammer') . "\";"); } // Display profile fields on posts - only if field is filled in if (is_array($profile_fields)) { foreach ($profile_fields as $field) { $fieldfid = "fid{$field['fid']}"; if (!empty($post[$fieldfid])) { $post['fieldvalue'] = ''; $post['fieldname'] = htmlspecialchars_uni($field['name']); $thing = explode("\n", $field['type'], "2"); $type = trim($thing[0]); $useropts = explode("\n", $post[$fieldfid]); if (is_array($useropts) && ($type == "multiselect" || $type == "checkbox")) { foreach ($useropts as $val) { if ($val != '') { eval("\$post['fieldvalue_option'] .= \"" . $templates->get("postbit_profilefield_multiselect_value") . "\";"); } } if ($post['fieldvalue_option'] != '') { eval("\$post['fieldvalue'] .= \"" . $templates->get("postbit_profilefield_multiselect") . "\";"); } } else { $field_parser_options = array("allow_html" => $field['allowhtml'], "allow_mycode" => $field['allowmycode'], "allow_smilies" => $field['allowsmilies'], "allow_imgcode" => $field['allowimgcode'], "allow_videocode" => $field['allowvideocode'], "filter_badwords" => 1); if ($customfield['type'] == "textarea") { $field_parser_options['me_username'] = $post['username']; } else { $field_parser_options['nl2br'] = 0; } if ($mybb->user['showimages'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestimages'] != 1 && $mybb->user['uid'] == 0) { $field_parser_options['allow_imgcode'] = 0; } $post['fieldvalue'] = $parser->parse_message($post[$fieldfid], $field_parser_options); } eval("\$post['profilefield'] .= \"" . $templates->get("postbit_profilefield") . "\";"); } } } eval("\$post['user_details'] = \"" . $templates->get("postbit_author_user") . "\";"); } else { // Message was posted by a guest or an unknown user $post['profilelink'] = format_name($post['username'], 1); if ($usergroup['usertitle']) { $post['usertitle'] = $usergroup['usertitle']; } else { $post['usertitle'] = $lang->guest; } $post['usertitle'] = htmlspecialchars_uni($post['usertitle']); $usergroup['title'] = $lang->na; $post['userregdate'] = $lang->na; $post['postnum'] = $lang->na; $post['button_profile'] = ''; $post['button_email'] = ''; $post['button_www'] = ''; $post['signature'] = ''; $post['button_pm'] = $lang->na; $post['button_find'] = ''; $post['onlinestatus'] = ''; $post['replink'] = ''; eval("\$post['user_details'] = \"" . $templates->get("postbit_author_guest") . "\";"); } $post['button_edit'] = ''; $post['button_quickdelete'] = ''; $post['button_quickrestore'] = ''; $post['button_quote'] = ''; $post['button_quickquote'] = ''; $post['button_report'] = ''; $post['button_reply_pm'] = ''; $post['button_replyall_pm'] = ''; $post['button_forward_pm'] = ''; $post['button_delete_pm'] = ''; // For private messages, fetch the reply/forward/delete icons if ($post_type == 2 && $post['pmid']) { global $replyall; eval("\$post['button_reply_pm'] = \"" . $templates->get("postbit_reply_pm") . "\";"); eval("\$post['button_forward_pm'] = \"" . $templates->get("postbit_forward_pm") . "\";"); eval("\$post['button_delete_pm'] = \"" . $templates->get("postbit_delete_pm") . "\";"); if ($replyall == true) { eval("\$post['button_replyall_pm'] = \"" . $templates->get("postbit_replyall_pm") . "\";"); } } $post['editedmsg'] = ''; if (!$post_type) { // Figure out if we need to show an "edited by" message if ($post['edituid'] != 0 && $post['edittime'] != 0 && $post['editusername'] != "" && ($mybb->settings['showeditedby'] != 0 && $usergroup['cancp'] == 0 || $mybb->settings['showeditedbyadmin'] != 0 && $usergroup['cancp'] == 1)) { //$post['editdate'] = my_date('relative', $post['edittime']); $post['editdate'] = $lang->na; $post['editnote'] = $lang->sprintf($lang->postbit_edited, $post['editdate']); $post['editedprofilelink'] = build_profile_link($post['editusername'], $post['edituid']); $editreason = ""; if ($post['editreason'] != "") { $post['editreason'] = $parser->parse_badwords($post['editreason']); $post['editreason'] = htmlspecialchars_uni($post['editreason']); eval("\$editreason = \"" . $templates->get("postbit_editedby_editreason") . "\";"); } eval("\$post['editedmsg'] = \"" . $templates->get("postbit_editedby") . "\";"); } $time = TIME_NOW; if (is_moderator($fid, "caneditposts") || $forumpermissions['caneditposts'] == 1 && $mybb->user['uid'] == $post['uid'] && $thread['closed'] != 1 && $mybb->usergroup['edittimelimit'] == 0 && $mybb->user['uid'] != 0) { eval("\$post['button_edit'] = \"" . $templates->get("postbit_edit") . "\";"); } // Quick Delete button $can_delete_thread = $can_delete_post = 0; if ($mybb->user['uid'] == $post['uid'] && $thread['closed'] == 0) { if ($forumpermissions['candeletethreads'] == 1 && $postcounter == 1) { $can_delete_thread = 1; } else { if ($forumpermissions['candeleteposts'] == 1 && $postcounter != 1) { $can_delete_post = 1; } } } $postbit_qdelete = $postbit_qrestore = ''; if ($mybb->user['uid'] != 0) { if ((is_moderator($fid, "candeleteposts") || is_moderator($fid, "cansoftdeleteposts") || $can_delete_post == 1) && $postcounter != 1) { $postbit_qdelete = $lang->postbit_qdelete_post; $display = ''; if ($post['visible'] == -1) { $display = "none"; } eval("\$post['button_quickdelete'] = \"" . $templates->get("postbit_quickdelete") . "\";"); } else { if ((is_moderator($fid, "candeletethreads") || is_moderator($fid, "cansoftdeletethreads") || $can_delete_thread == 1) && $postcounter == 1) { $postbit_qdelete = $lang->postbit_qdelete_thread; $display = ''; if ($post['visible'] == -1) { $display = "none"; } eval("\$post['button_quickdelete'] = \"" . $templates->get("postbit_quickdelete") . "\";"); } } // Restore Post if (is_moderator($fid, "canrestoreposts") && $postcounter != 1) { $display = "none"; if ($post['visible'] == -1) { $display = ''; } $postbit_qrestore = $lang->postbit_qrestore_post; eval("\$post['button_quickrestore'] = \"" . $templates->get("postbit_quickrestore") . "\";"); } else { if (is_moderator($fid, "canrestorethreads") && $postcounter == 1) { $display = "none"; if ($post['visible'] == -1) { $display = ""; } $postbit_qrestore = $lang->postbit_qrestore_thread; eval("\$post['button_quickrestore'] = \"" . $templates->get("postbit_quickrestore") . "\";"); } } } // Inline moderation stuff if ($ismod) { if (isset($mybb->cookies[$inlinecookie]) && my_strpos($mybb->cookies[$inlinecookie], "|" . $post['pid'] . "|")) { $inlinecheck = "checked=\"checked\""; $inlinecount++; } else { $inlinecheck = ""; } eval("\$post['inlinecheck'] = \"" . $templates->get("postbit_inlinecheck") . "\";"); if ($post['visible'] == 0) { $invisiblepost = 1; } } else { $post['inlinecheck'] = ""; } $post['postlink'] = get_post_link($post['pid'], $post['tid']); $post_number = my_number_format($postcounter); eval("\$post['posturl'] = \"" . $templates->get("postbit_posturl") . "\";"); global $forum, $thread; if ($forum['open'] != 0 && ($thread['closed'] != 1 || is_moderator($forum['fid'], "canpostclosedthreads")) && ($thread['uid'] == $mybb->user['uid'] || $forumpermissions['canonlyreplyownthreads'] != 1)) { eval("\$post['button_quote'] = \"" . $templates->get("postbit_quote") . "\";"); } if ($forumpermissions['canpostreplys'] != 0 && ($thread['uid'] == $mybb->user['uid'] || $forumpermissions['canonlyreplyownthreads'] != 1) && ($thread['closed'] != 1 || is_moderator($fid, "canpostclosedthreads")) && $mybb->settings['multiquote'] != 0 && $forum['open'] != 0 && !$post_type) { eval("\$post['button_multiquote'] = \"" . $templates->get("postbit_multiquote") . "\";"); } if ($mybb->user['uid'] != "0") { eval("\$post['button_report'] = \"" . $templates->get("postbit_report") . "\";"); } } elseif ($post_type == 3) { if ($mybb->usergroup['canmodcp'] == 1 && $mybb->usergroup['canmanageannounce'] == 1 && is_moderator($fid, "canmanageannouncements")) { eval("\$post['button_edit'] = \"" . $templates->get("announcement_edit") . "\";"); eval("\$post['button_quickdelete'] = \"" . $templates->get("announcement_quickdelete") . "\";"); } } $post['iplogged'] = ''; $show_ips = $mybb->settings['logip']; //$ipaddress = my_inet_ntop($db->unescape_binary($post['ipaddress'])); $ipaddress = '127.0.0.1'; // Show post IP addresses... PMs now can have IP addresses too as of 1.8! if ($post_type == 2) { $show_ips = $mybb->settings['showpmip']; } if (!$post_type || $post_type == 2) { if ($show_ips != "no" && !empty($post['ipaddress'])) { if ($show_ips == "show") { eval("\$post['iplogged'] = \"" . $templates->get("postbit_iplogged_show") . "\";"); } else { if ($show_ips == "hide" && (is_moderator($fid, "canviewips") || $mybb->usergroup['issupermod'])) { $action = 'getip'; if ($post_type == 2) { $action = 'getpmip'; } eval("\$post['iplogged'] = \"" . $templates->get("postbit_iplogged_hiden") . "\";"); } } } } if (isset($post['smilieoff']) && $post['smilieoff'] == 1) { $parser_options['allow_smilies'] = 0; } if ($mybb->user['showimages'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestimages'] != 1 && $mybb->user['uid'] == 0) { $parser_options['allow_imgcode'] = 0; } if ($mybb->user['showvideos'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestvideos'] != 1 && $mybb->user['uid'] == 0) { $parser_options['allow_videocode'] = 0; } // If we have incoming search terms to highlight - get it done. if (!empty($mybb->input['highlight'])) { $parser_options['highlight'] = $mybb->input['highlight']; $post['subject'] = $parser->highlight_message($post['subject'], $parser_options['highlight']); } $post['message'] = $parser->parse_message($post['message'], $parser_options); // Validate key $keyinfo = user_key_info($post['uid']); $post['signstatus']; if ($keyinfo['status'] == "OK") { $post['signstatus'] = "<span style=\"color: #07a407;\" title=\"Fingerprint: {$keyinfo['fingerprint']}\">✓ podpisano przez {$post['profilelink']}</span>"; } // Jid link $ujid = user_jid($post['uid']); $post['jidlink'] = $ujid; // User key $post['userpubkey'] = $keyinfo['key']; if ($keyinfo['key'] != "") { eval("\$post['button_pubkey'] = \"" . $templates->get("postbit_pubkey") . "\";"); } else { $post['button_pubkey']; } $post['attachments'] = ''; if ($mybb->settings['enableattachments'] != 0) { get_post_attachments($id, $post); } if (isset($post['includesig']) && $post['includesig'] != 0 && $post['username'] && $post['signature'] != "" && ($mybb->user['uid'] == 0 || $mybb->user['showsigs'] != 0) && ($post['suspendsignature'] == 0 || $post['suspendsignature'] == 1 && $post['suspendsigtime'] != 0 && $post['suspendsigtime'] < TIME_NOW) && $usergroup['canusesig'] == 1 && ($usergroup['canusesigxposts'] == 0 || $usergroup['canusesigxposts'] > 0 && $postnum > $usergroup['canusesigxposts']) && !is_member($mybb->settings['hidesignatures'])) { $sig_parser = array("allow_html" => $mybb->settings['sightml'], "allow_mycode" => $mybb->settings['sigmycode'], "allow_smilies" => $mybb->settings['sigsmilies'], "allow_imgcode" => $mybb->settings['sigimgcode'], "me_username" => $post['username'], "filter_badwords" => 1); if ($usergroup['signofollow']) { $sig_parser['nofollow_on'] = 1; } if ($mybb->user['showimages'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestimages'] != 1 && $mybb->user['uid'] == 0) { $sig_parser['allow_imgcode'] = 0; } $post['signature'] = $parser->parse_message($post['signature'], $sig_parser); eval("\$post['signature'] = \"" . $templates->get("postbit_signature") . "\";"); } else { $post['signature'] = ""; } $icon_cache = $cache->read("posticons"); if (isset($post['icon']) && $post['icon'] > 0 && $icon_cache[$post['icon']]) { $icon = $icon_cache[$post['icon']]; $icon['path'] = htmlspecialchars_uni($icon['path']); $icon['path'] = str_replace("{theme}", $theme['imgdir'], $icon['path']); $icon['name'] = htmlspecialchars_uni($icon['name']); eval("\$post['icon'] = \"" . $templates->get("postbit_icon") . "\";"); } else { $post['icon'] = ""; } $post_visibility = $ignore_bit = ''; switch ($post_type) { case 1: // Message preview $post = $plugins->run_hooks("postbit_prev", $post); break; case 2: // Private message $post = $plugins->run_hooks("postbit_pm", $post); break; case 3: // Announcement $post = $plugins->run_hooks("postbit_announcement", $post); break; default: // Regular post $post = $plugins->run_hooks("postbit", $post); // Is this author on the ignore list of the current user? Hide this post if (is_array($ignored_users) && $post['uid'] != 0 && isset($ignored_users[$post['uid']]) && $ignored_users[$post['uid']] == 1) { $ignored_message = $lang->sprintf($lang->postbit_currently_ignoring_user, $post['username']); eval("\$ignore_bit = \"" . $templates->get("postbit_ignored") . "\";"); $post_visibility = "display: none;"; } break; } if ($mybb->settings['postlayout'] == "classic") { eval("\$postbit = \"" . $templates->get("postbit_classic") . "\";"); } else { eval("\$postbit = \"" . $templates->get("postbit") . "\";"); } $GLOBALS['post'] = ""; return $postbit; }
function StatusBar() { global $CURUSER, $INSTALLER09, $lang, $rep_is_on, $mc1, $msgalert; if (!$CURUSER) { return ""; } $upped = mksize($CURUSER['uploaded']); $downed = mksize($CURUSER['downloaded']); $connectable = ""; if ($CURUSER['class'] < UC_VIP && $INSTALLER09['max_slots']) { $ratioq = $CURUSER['downloaded'] > 0 ? $CURUSER['uploaded'] / $CURUSER['downloaded'] : 1; if ($ratioq < 0.95) { switch (true) { case $ratioq < 0.5: $max = 2; break; case $ratioq < 0.65: $max = 3; break; case $ratioq < 0.8: $max = 5; break; case $ratioq < 0.95: $max = 10; break; default: $max = 10; } } else { switch ($CURUSER['class']) { case UC_USER: $max = 20; break; case UC_POWER_USER: $max = 30; break; default: $max = 99; } } } else { $max = 999; } //==Memcache unread pms $PMCount = 0; if (($unread1 = $mc1->get_value('inbox_new_sb_' . $CURUSER['id'])) === false) { $res1 = sql_query("SELECT COUNT(id) FROM messages WHERE receiver=" . sqlesc($CURUSER['id']) . " AND unread = 'yes' AND location = '1'") or sqlerr(__LINE__, __FILE__); list($PMCount) = mysqli_fetch_row($res1); $PMCount = (int) $PMCount; $unread1 = $mc1->cache_value('inbox_new_sb_' . $CURUSER['id'], $PMCount, $INSTALLER09['expires']['unread']); } $inbox = $unread1 == 1 ? "{$unread1} {$lang['gl_msg_singular']}" : "{$unread1} {$lang['gl_msg_plural']}"; //==Memcache peers if (XBT_TRACKER == true) { if (($MyPeersXbtCache = $mc1->get_value('MyPeers_XBT_' . $CURUSER['id'])) === false) { $seed['yes'] = $seed['no'] = 0; $seed['conn'] = 3; $r = sql_query("SELECT COUNT(uid) AS `count`, `left`, `active`, `connectable` FROM `xbt_files_users` WHERE uid= " . sqlesc($CURUSER['id']) . " AND `left` = 0 AND `active` = 1") or sqlerr(__LINE__, __FILE__); while ($a = mysqli_fetch_assoc($r)) { $key = $a['left'] == 0 ? 'yes' : 'no'; $seed[$key] = number_format(0 + $a['count']); $seed['conn'] = $a['connectable'] == 0 ? 1 : 2; } $mc1->cache_value('MyPeers_XBT_' . $CURUSER['id'], $seed, $INSTALLER09['expires']['MyPeers_xbt_']); unset($r, $a); } else { $seed = $MyPeersXbtCache; } } else { if (($MyPeersCache = $mc1->get_value('MyPeers_' . $CURUSER['id'])) === false) { $seed['yes'] = $seed['no'] = 0; $seed['conn'] = 3; $r = sql_query("SELECT COUNT(id) AS count, seeder, connectable FROM peers WHERE userid=" . sqlesc($CURUSER['id']) . " GROUP BY seeder"); while ($a = mysqli_fetch_assoc($r)) { $key = $a['seeder'] == 'yes' ? 'yes' : 'no'; $seed[$key] = number_format(0 + $a['count']); $seed['conn'] = $a['connectable'] == 'no' ? 1 : 2; } $mc1->cache_value('MyPeers_' . $CURUSER['id'], $seed, $INSTALLER09['expires']['MyPeers_']); unset($r, $a); } else { $seed = $MyPeersCache; } } // for display connectable 1 / 2 / 3 if (!empty($seed['conn'])) { switch ($seed['conn']) { case 1: $connectable = "<img src='{$INSTALLER09['pic_base_url']}notcon.png' alt='Not Connectable' title='Not Connectable' />"; break; case 2: $connectable = "<img src='{$INSTALLER09['pic_base_url']}yescon.png' alt='Connectable' title='Connectable' />"; break; default: $connectable = "N/A"; } } else { $connectable = 'N/A'; } if (($Achievement_Points = $mc1->get_value('user_achievement_points_' . $CURUSER['id'])) === false) { $Sql = sql_query("SELECT users.id, users.username, usersachiev.achpoints, usersachiev.spentpoints FROM users LEFT JOIN usersachiev ON users.id = usersachiev.id WHERE users.id = " . sqlesc($CURUSER['id'])) or sqlerr(__FILE__, __LINE__); $Achievement_Points = mysqli_fetch_assoc($Sql); $Achievement_Points['id'] = (int) $Achievement_Points['id']; $Achievement_Points['achpoints'] = (int) $Achievement_Points['achpoints']; $Achievement_Points['spentpoints'] = (int) $Achievement_Points['spentpoints']; $mc1->cache_value('user_achievement_points_' . $CURUSER['id'], $Achievement_Points, 0); } //$hitnruns = ($CURUSER['hit_and_run_total'] > 0 ? $CURUSER['hit_and_run_total'] : '0'); //{$lang['gl_hnr']}: <a href='".$INSTALLER09['baseurl']."/hnr.php?id=".$CURUSER['id']."'>{$hitnruns}</a> $member_reputation = get_reputation($CURUSER); $usrclass = $StatusBar = ""; if ($CURUSER['override_class'] != 255) { $usrclass = " <b>[" . get_user_class_name($CURUSER['class']) . "]</b> "; } else { if ($CURUSER['class'] >= UC_STAFF) { $usrclass = " <a href='" . $INSTALLER09['baseurl'] . "/setclass.php'><b>[" . get_user_class_name($CURUSER['class']) . "]</b></a> "; } } $StatusBar .= "<div class='text-center'>Welcome " . format_username($CURUSER) . "" . (isset($CURUSER) && $CURUSER['class'] < UC_STAFF ? "[" . get_user_class_name($CURUSER['class']) . "]" : $usrclass) . "" . ($INSTALLER09['max_slots'] ? "{$lang['gl_act_torrents']}: <img alt='{$lang['gl_seed_torrents']}' title='{$lang['gl_seed_torrents']}' src='{$INSTALLER09['pic_base_url']}up.png' /> " . intval($seed['yes']) . "" . " <img alt='{$lang['gl_leech_torrents']}' title='{$lang['gl_leech_torrents']}' src='{$INSTALLER09['pic_base_url']}dl.png' /> " . ($INSTALLER09['max_slots'] ? "<a title='I have " . $max . " Download Slots'>" . intval($seed['no']) . "/" . $max . "</a>" : intval($seed['no'])) . "" : "") . " {$lang['gl_achpoints']} <a href='./achievementhistory.php?id={$CURUSER['id']}'>" . (int) $Achievement_Points['achpoints'] . "</a> {$lang['gl_karma']}: <a href='" . $INSTALLER09['baseurl'] . "/mybonus.php'>{$CURUSER['seedbonus']}</a> {$lang['gl_invites']}: <a href='" . $INSTALLER09['baseurl'] . "/invite.php'>{$CURUSER['invites']}</a> {$lang['gl_rep']}:{$member_reputation} {$lang['gl_shareratio']} " . member_ratio($CURUSER['uploaded'], $INSTALLER09['ratio_free'] ? '0' : $CURUSER['downloaded']); if ($INSTALLER09['ratio_free']) { $StatusBar .= " {$lang['gl_uploaded']}:" . $upped; } else { $StatusBar .= " {$lang['gl_uploaded']}:{$upped} {$lang['gl_downloaded']}:{$downed} {$lang['gl_connectable']} {$connectable}"; } $StatusBar .= "</div>"; return $StatusBar; }
function StatusBar() { global $CURUSER, $TBDEV, $lang, $rep_is_on, $mc; if (!$CURUSER) { return ""; } if (!$TBDEV['coins']) { $upped = mksize($CURUSER['uploaded']); $downed = mksize($CURUSER['downloaded']); $ratio = $CURUSER['downloaded'] > 0 ? $CURUSER['uploaded'] / $CURUSER['downloaded'] : 0; $ratio = number_format($ratio, 2); $color = get_ratio_color($ratio); if ($color) { $ratio = "<font color='{$color}'>{$ratio}</font>"; } } $res1 = @sql_query("SELECT count(id) FROM messages WHERE receiver=" . $CURUSER["id"] . " AND unread='yes'") or sqlerr(__LINE__, __FILE__); $arr1 = mysql_fetch_row($res1); $unread = $arr1[0]; $inbox = $unread == 1 ? "{$unread} {$lang['gl_msg_singular']}" : "{$unread} {$lang['gl_msg_plural']}"; $res2 = @sql_query("SELECT seeder, count(*) AS pCount FROM peers WHERE userid=" . $CURUSER['id'] . " GROUP BY seeder") or sqlerr(__LINE__, __FILE__); $seedleech = array('yes' => '0', 'no' => '0'); while ($row = mysql_fetch_assoc($res2)) { if ($row['seeder'] == 'yes') { $seedleech['yes'] = $row['pCount']; } else { $seedleech['no'] = $row['pCount']; } } /////////////// REP SYSTEM ///////////// $member_reputation = get_reputation($CURUSER); ////////////// REP SYSTEM END ////////// if ($CURUSER['class'] < UC_VIP && $TBDEV['max_slots']) { $ratioq = $CURUSER['downloaded'] > 0 ? $CURUSER['uploaded'] / $CURUSER['downloaded'] : 1; if ($ratioq < 0.95) { switch (true) { case $ratioq < 0.5: $max = 2; break; case $ratioq < 0.65: $max = 3; break; case $ratioq < 0.8: $max = 5; break; case $ratioq < 0.95: $max = 10; break; default: $max = 10; } } else { switch ($CURUSER['class']) { case UC_USER: $max = 20; break; case UC_POWER_USER: $max = 30; break; default: $max = 99; } } } else { $max = 999; } $usrclass = ""; if ($CURUSER['override_class'] != 255) { $usrclass = " <b>(" . get_user_class_name($CURUSER['class']) . ")</b> "; } elseif ($CURUSER['class'] >= UC_MODERATOR) { $usrclass = " <a href='{$TBDEV['baseurl']}/setclass.php'><b>(" . get_user_class_name($CURUSER['class']) . ")</b></a> "; } $StatusBar = ''; $StatusBar = "<tr>" . "<td colspan='2' style='padding: 2px;'>" . "<div id='statusbar'>" . "<div style='float:left;color:black;'>{$lang['gl_msg_welcome']}, \n\t\t" . format_username($CURUSER) . " {$usrclass} \n\t\t" . " {$member_reputation}" . " | Invites: <a href='{$TBDEV['baseurl']}/invite.php'>{$CURUSER['invites']}</a> |" . "\n\t\t Bonus: <a href='{$TBDEV['baseurl']}/mybonus.php'>{$CURUSER['seedbonus']}</a> | <a href='logout.php'>[{$lang['gl_logout']}]</a>"; if (!$TBDEV['coins']) { $StatusBar .= "\n\t\t<br />{$lang['gl_ratio']}:{$ratio}" . " | {$lang['gl_uploaded']}:{$upped}" . " | {$lang['gl_downloaded']}:{$downed}"; } if ($TBDEV['coins']) { $StatusBar .= " | {$lang['gl_coins']}:<a href='{$TBDEV['baseurl']}/coins.php'>{$CURUSER['coins']}</a> "; } $StatusBar .= " | {$lang['gl_act_torrents']}: <img alt='{$lang['gl_seed_torrents']}' title='{$lang['gl_seed_torrents']}' src='{$TBDEV['pic_base_url']}up.png' /> {$seedleech['yes']}" . " <img alt='{$lang['gl_leech_torrents']}' title='{$lang['gl_leech_torrents']}' src='{$TBDEV['pic_base_url']}dl.png' /> " . ($TBDEV['max_slots'] ? "<a title='I have " . $max . " Download Slots'>{$seedleech['no']}/" . $max . "</a>" : $seedleech['no']) . "</div>" . "<div><p style='text-align:right;'>" . date(DATE_RFC822) . "<br />" . "<a href='./messages.php'>{$inbox}</a></p></div>" . "</div></td></tr>"; return $StatusBar; }
<tr><td class="forum_head_dark" align="left" width="100"> <img src="' . $INSTALLER09['pic_base_url'] . 'forums/topic_normal.gif" alt="' . $lang['fe_topic'] . '" title="' . $lang['fe_topic'] . '" /> ' . $lang['fe_author'] . '</td> <td class="forum_head_dark" align="left" colspan="2"> ' . $lang['fe_topic'] . ': ' . $topic_name . ' [ ' . $lang['fe_read'] . ' ' . $views . ' ' . $lang['fe_times'] . ' ] </td></tr> <tr><td class="three" align="left" colspan="3">' . $lang['fe_topic_rating'] . ': ' . getRate($topic_id, "topic") . '</td></tr> <tr><td class="three" align="left" colspan="3">' . $topic_users . '</td></tr>'; //=== lets start the loop \o/ while ($arr = mysqli_fetch_assoc($res)) { //=== change colors $colour = ++$colour % 2; $class = $colour == 0 ? 'one' : 'two'; $class_alt = $colour == 0 ? 'two' : 'one'; $moodname = isset($mood['name'][$arr['mood']]) ? htmlsafechars($mood['name'][$arr['mood']]) : 'is feeling neutral'; $moodpic = isset($mood['image'][$arr['mood']]) ? htmlsafechars($mood['image'][$arr['mood']]) : 'noexpression.gif'; $post_icon = $arr['icon'] !== '' ? '<img src="' . $INSTALLER09['pic_base_url'] . 'smilies/' . htmlsafechars($arr['icon']) . '.gif" alt="icon" title="icon" /> ' : '<img src="' . $INSTALLER09['pic_base_url'] . 'forums/topic_normal.gif" alt="icon" title="icon" /> '; $post_title = $arr['post_title'] !== '' ? ' <span style="font-weight: bold; font-size: x-small;">' . htmlsafechars($arr['post_title'], ENT_QUOTES) . '</span>' : ''; $stafflocked = $arr["staff_lock"] == 1 ? "<img src='{$INSTALLER09['pic_base_url']}locked.gif' border='0' alt='" . $lang['fe_post_locked'] . "' title='" . $lang['fe_post_locked'] . "' />" : ""; $member_reputation = $arr['username'] != '' ? get_reputation($arr, 'posts', TRUE, (int) $arr['post_id']) : ''; $edited_by = ''; if ($arr['edit_date'] > 0) { $res_edited = sql_query('SELECT username FROM users WHERE id=' . sqlesc($arr['edited_by'])); $arr_edited = mysqli_fetch_assoc($res_edited); //== Anonymous if ($arr['anonymous'] == 'yes') { if ($CURUSER['class'] < UC_STAFF && $arr['user_id'] != $CURUSER['id']) { $edited_by = '<br /><br /><br /><span style="font-weight: bold; font-size: x-small;">' . $lang['vmp_last_edit_by_anony'] . ' at ' . get_date($arr['edit_date'], '') . ' GMT ' . ($arr['edit_reason'] !== '' ? ' </span>[ ' . $lang['fe_reason'] . ': ' . htmlsafechars($arr['edit_reason']) . ' ] <span style="font-weight: bold; font-size: x-small;">' : '') . ' ' . ($CURUSER['class'] >= UC_STAFF && $arr['post_history'] !== '' ? ' <a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php?action=view_post_history&post_id=' . (int) $arr['post_id'] . '&forum_id=' . $forum_id . '&topic_id=' . $topic_id . '">' . $lang['fe_read_post_history'] . '</a></span><br />' : '</span>'); } else { $edited_by = '<br /><br /><br /><span style="font-weight: bold; font-size: x-small;">' . $lang['vmp_last_edit_by_anony'] . ' [<a class="altlink" href="userdetails.php?id=' . (int) $arr['edited_by'] . '">' . htmlsafechars($arr_edited['username']) . '</a>] at ' . get_date($arr['edit_date'], '') . ' GMT ' . ($arr['edit_reason'] !== '' ? ' </span>[ ' . $lang['fe_reason'] . ': ' . htmlsafechars($arr['edit_reason']) . ' ] <span style="font-weight: bold; font-size: x-small;">' : '') . ' ' . ($CURUSER['class'] >= UC_STAFF && $arr['post_history'] !== '' ? ' <a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php?action=view_post_history&post_id=' . (int) $arr['post_id'] . '&forum_id=' . $forum_id . '&topic_id=' . $topic_id . '">' . $lang['fe_read_post_history'] . '</a></span><br />' : '</span>'); }
} $timeonline = $lang->timeonline_hidden; } // Reset the background colours to keep it inline $alttrow = 'trow1'; // Build Referral $referrals = ''; if ($mybb->settings['usereferrals'] == 1) { $bg_color = alt_trow(); eval("\$referrals = \"" . $templates->get("member_profile_referrals") . "\";"); } // Fetch the reputation for this user $reputation = ''; if ($memperms['usereputationsystem'] == 1 && $displaygroup['usereputationsystem'] == 1 && $mybb->settings['enablereputation'] == 1) { $bg_color = alt_trow(); $reputation = get_reputation($memprofile['reputation']); // If this user has permission to give reputations show the vote link $vote_link = ''; if ($mybb->usergroup['cangivereputations'] == 1 && $memprofile['uid'] != $mybb->user['uid'] && ($mybb->settings['posrep'] || $mybb->settings['neurep'] || $mybb->settings['negrep'])) { eval("\$vote_link = \"" . $templates->get("member_profile_reputation_vote") . "\";"); } eval("\$reputation = \"" . $templates->get("member_profile_reputation") . "\";"); } $warning_level = ''; if ($mybb->settings['enablewarningsystem'] != 0 && $memperms['canreceivewarnings'] != 0 && ($mybb->usergroup['canwarnusers'] != 0 || $mybb->user['uid'] == $memprofile['uid'] && $mybb->settings['canviewownwarning'] != 0)) { $bg_color = alt_trow(); if ($mybb->settings['maxwarningpoints'] < 1) { $mybb->settings['maxwarningpoints'] = 10; } $warning_level = round($memprofile['warningpoints'] / $mybb->settings['maxwarningpoints'] * 100); if ($warning_level > 100) {
function StatusBar() { global $CURUSER, $TBDEV, $lang; if (!$CURUSER) { return "<tr><td colspan='2'>Yeah Yeah!</td></tr>"; } $upped = mksize($CURUSER['uploaded']); $downed = mksize($CURUSER['downloaded']); $ratio = $CURUSER['downloaded'] > 0 ? $CURUSER['uploaded'] / $CURUSER['downloaded'] : 0; $ratio = number_format($ratio, 2); $IsDonor = ''; if ($CURUSER['donor'] == "yes") { $IsDonor = "<img src='pic/star.gif' alt='donor' title='donor' />"; } $warn = ''; if ($CURUSER['warned'] == "yes") { $warn = "<img src='pic/warned.gif' alt='warned' title='warned' />"; } $res1 = @mysql_query("SELECT COUNT(*) FROM messages WHERE receiver=" . $CURUSER["id"] . " AND unread='yes'") or sqlerr(__LINE__, __FILE__); $arr1 = mysql_fetch_row($res1); $unread = $arr1[0]; $inbox = $unread == 1 ? "{$unread} {$lang['gl_msg_singular']}" : "{$unread} {$lang['gl_msg_plural']}"; $res2 = @mysql_query("SELECT seeder, COUNT(*) AS pCount FROM peers WHERE userid=" . $CURUSER['id'] . " GROUP BY seeder") or sqlerr(__LINE__, __FILE__); $seedleech = array('yes' => '0', 'no' => '0'); while ($row = mysql_fetch_assoc($res2)) { if ($row['seeder'] == 'yes') { $seedleech['yes'] = $row['pCount']; } else { $seedleech['no'] = $row['pCount']; } } /////////////// REP SYSTEM ///////////// //$CURUSER['reputation'] = 49; $member_reputation = get_reputation($CURUSER, 1); ////////////// REP SYSTEM END ////////// $StatusBar = ''; $StatusBar = "<tr>" . "<td colspan='2' style='padding: 2px;'>" . "<div id='statusbar'>" . "<div style='float:left;color:black;'>{$lang['gl_msg_welcome']}, <a href='userdetails.php?id={$CURUSER['id']}'>{$CURUSER['username']}</a>" . "{$IsDonor}{$warn} [<a href='logout.php'>{$lang['gl_logout']}</a>] {$member_reputation}\r\n\t\t<br />{$lang['gl_ratio']}:{$ratio}" . " {$lang['gl_uploaded']}:{$upped}" . " {$lang['gl_downloaded']}:{$downed}" . " {$lang['gl_act_torrents']}: <img alt='{$lang['gl_seed_torrents']}' title='{$lang['gl_seed_torrents']}' src='pic/arrowup.gif' /> {$seedleech['yes']}" . " <img alt='{$lang['gl_leech_torrents']}' title='{$lang['gl_leech_torrents']}' src='pic/arrowdown.gif' /> {$seedleech['no']}</div>" . "<div><p style='text-align:right;'>" . date(DATE_RFC822) . "<br />" . "<a href='messages.php'>{$inbox}</a></p></div>" . "</div></td></tr>"; return $StatusBar; }
/** * Build a post bit * * @param array The post data * @param int The type of post bit we're building (1 = preview, 2 = pm, 3 = announcement, else = post) * @return string The built post bit */ function build_postbit($post, $post_type = 0) { global $db, $altbg, $theme, $mybb, $postcounter; global $titlescache, $page, $templates, $forumpermissions, $attachcache; global $lang, $ismod, $inlinecookie, $inlinecount, $groupscache, $fid; global $plugins, $parser, $cache, $ignored_users, $hascustomtitle; $hascustomtitle = 0; // Set default values for any fields not provided here foreach (array('subject_extra', 'attachments', 'button_rep', 'button_warn', 'button_reply_pm', 'button_replyall_pm', 'button_forward_pm', 'button_delete_pm') as $post_field) { if (empty($post[$post_field])) { $post[$post_field] = ''; } } // Set up the message parser if it doesn't already exist. if (!$parser) { require_once MYBB_ROOT . "inc/class_parser.php"; $parser = new postParser(); } $unapproved_shade = ''; if ($post['visible'] == 0 && $post_type == 0) { $altbg = $unapproved_shade = 'trow_shaded'; } elseif ($altbg == 'trow1') { $altbg = 'trow2'; } else { $altbg = 'trow1'; } $post['fid'] = $fid; switch ($post_type) { case 1: // Message preview global $forum; $parser_options['allow_html'] = $forum['allowhtml']; $parser_options['allow_mycode'] = $forum['allowmycode']; $parser_options['allow_smilies'] = $forum['allowsmilies']; $parser_options['allow_imgcode'] = $forum['allowimgcode']; $parser_options['allow_videocode'] = $forum['allowvideocode']; $parser_options['me_username'] = $post['username']; $parser_options['filter_badwords'] = 1; $id = 0; break; case 2: // Private message global $message, $pmid; $parser_options['allow_html'] = $mybb->settings['pmsallowhtml']; $parser_options['allow_mycode'] = $mybb->settings['pmsallowmycode']; $parser_options['allow_smilies'] = $mybb->settings['pmsallowsmilies']; $parser_options['allow_imgcode'] = $mybb->settings['pmsallowimgcode']; $parser_options['allow_videocode'] = $mybb->settings['pmsallowvideocode']; $parser_options['me_username'] = $post['username']; $parser_options['filter_badwords'] = 1; $id = $pmid; break; case 3: // Announcement global $announcementarray, $message; $parser_options['allow_html'] = $announcementarray['allowhtml']; $parser_options['allow_mycode'] = $announcementarray['allowmycode']; $parser_options['allow_smilies'] = $announcementarray['allowsmilies']; $parser_options['allow_imgcode'] = 1; $parser_options['allow_videocode'] = 1; $parser_options['me_username'] = $post['username']; $parser_options['filter_badwords'] = 1; break; default: // Regular post global $forum, $thread, $tid; $oldforum = $forum; $id = intval($post['pid']); $parser_options['allow_html'] = $forum['allowhtml']; $parser_options['allow_mycode'] = $forum['allowmycode']; $parser_options['allow_smilies'] = $forum['allowsmilies']; $parser_options['allow_imgcode'] = $forum['allowimgcode']; $parser_options['allow_videocode'] = $forum['allowvideocode']; $parser_options['filter_badwords'] = 1; if (!$post['username']) { $post['username'] = $lang->guest; } if ($post['userusername']) { $parser_options['me_username'] = $post['userusername']; } else { $parser_options['me_username'] = $post['username']; } break; } // Sanatize our custom profile fields for use in templates, if people choose to use them foreach ($post as $post_field => $field_value) { if (substr($post_field, 0, 3) != 'fid') { continue; } $post[$post_field] = htmlspecialchars_uni($field_value); } if (!$postcounter) { // Used to show the # of the post if ($page > 1) { if (!$mybb->settings['postsperpage'] || (int) $mybb->settings['postsperpage'] < 1) { $mybb->settings['postsperpage'] = 20; } $postcounter = $mybb->settings['postsperpage'] * ($page - 1); } else { $postcounter = 0; } $post_extra_style = "border-top-width: 0;"; } elseif ($mybb->input['mode'] == "threaded") { $post_extra_style = "border-top-width: 0;"; } else { $post_extra_style = "margin-top: 5px;"; } if (!$altbg) { // Define the alternate background colour if this is the first post $altbg = "trow1"; } $postcounter++; // Format the post date and time using my_date $post['postdate'] = my_date($mybb->settings['dateformat'], $post['dateline']); $post['posttime'] = my_date($mybb->settings['timeformat'], $post['dateline']); // Dont want any little 'nasties' in the subject $post['subject'] = $parser->parse_badwords($post['subject']); // Pm's have been htmlspecialchars_uni()'ed already. if ($post_type != 2) { $post['subject'] = htmlspecialchars_uni($post['subject']); } if (empty($post['subject'])) { $post['subject'] = ' '; } $post['author'] = $post['uid']; // Get the usergroup if ($post['userusername']) { if (!$post['displaygroup']) { $post['displaygroup'] = $post['usergroup']; } $usergroup = $groupscache[$post['displaygroup']]; } else { $usergroup = $groupscache[1]; } if (!is_array($titlescache)) { $cached_titles = $cache->read("usertitles"); if (!empty($cached_titles)) { foreach ($cached_titles as $usertitle) { $titlescache[$usertitle['posts']] = $usertitle; } } if (is_array($titlescache)) { krsort($titlescache); } unset($usertitle, $cached_titles); } // Work out the usergroup/title stuff $post['groupimage'] = ''; if (!empty($usergroup['image'])) { $language = $mybb->settings['bblanguage']; if (!empty($mybb->user['language'])) { $language = $mybb->user['language']; } $usergroup['image'] = str_replace("{lang}", $language, $usergroup['image']); $usergroup['image'] = str_replace("{theme}", $theme['imgdir'], $usergroup['image']); eval("\$post['groupimage'] = \"" . $templates->get("postbit_groupimage") . "\";"); if ($mybb->settings['postlayout'] == "classic") { $post['groupimage'] .= "<br />"; } } if ($post['userusername']) { // This post was made by a registered user $post['username'] = $post['userusername']; $post['profilelink_plain'] = get_profile_link($post['uid']); $post['username_formatted'] = format_name($post['username'], $post['usergroup'], $post['displaygroup']); $post['profilelink'] = build_profile_link($post['username_formatted'], $post['uid']); if (trim($post['usertitle']) != "") { $hascustomtitle = 1; } if ($usergroup['usertitle'] != "" && !$hascustomtitle) { $post['usertitle'] = $usergroup['usertitle']; } elseif (is_array($titlescache) && !$usergroup['usertitle']) { reset($titlescache); foreach ($titlescache as $key => $titleinfo) { if ($post['postnum'] >= $key) { if (!$hascustomtitle) { $post['usertitle'] = $titleinfo['title']; } $post['stars'] = $titleinfo['stars']; $post['starimage'] = $titleinfo['starimage']; break; } } } if ($usergroup['stars']) { $post['stars'] = $usergroup['stars']; } if (empty($post['starimage'])) { $post['starimage'] = $usergroup['starimage']; } if ($post['starimage'] && $post['stars']) { // Only display stars if we have an image to use... $post['starimage'] = str_replace("{theme}", $theme['imgdir'], $post['starimage']); $post['userstars'] = ''; for ($i = 0; $i < $post['stars']; ++$i) { $post['userstars'] .= "<img src=\"" . $post['starimage'] . "\" border=\"0\" alt=\"*\" />"; } $post['userstars'] .= "<br />"; } $postnum = $post['postnum']; $post['postnum'] = my_number_format($post['postnum']); // Determine the status to show for the user (Online/Offline/Away) $timecut = TIME_NOW - $mybb->settings['wolcutoff']; if ($post['lastactive'] > $timecut && ($post['invisible'] != 1 || $mybb->usergroup['canviewwolinvis'] == 1) && $post['lastvisit'] != $post['lastactive']) { eval("\$post['onlinestatus'] = \"" . $templates->get("postbit_online") . "\";"); } else { if ($post['away'] == 1 && $mybb->settings['allowaway'] != 0) { eval("\$post['onlinestatus'] = \"" . $templates->get("postbit_away") . "\";"); } else { eval("\$post['onlinestatus'] = \"" . $templates->get("postbit_offline") . "\";"); } } if ($post['avatar'] != "" && ($mybb->user['showavatars'] != 0 || !$mybb->user['uid'])) { $post['avatar'] = htmlspecialchars_uni($post['avatar']); $avatar_dimensions = explode("|", $post['avatardimensions']); if ($avatar_dimensions[0] && $avatar_dimensions[1]) { list($max_width, $max_height) = explode("x", my_strtolower($mybb->settings['postmaxavatarsize'])); if ($avatar_dimensions[0] > $max_width || $avatar_dimensions[1] > $max_height) { require_once MYBB_ROOT . "inc/functions_image.php"; $scaled_dimensions = scale_image($avatar_dimensions[0], $avatar_dimensions[1], $max_width, $max_height); $avatar_width_height = "width=\"{$scaled_dimensions['width']}\" height=\"{$scaled_dimensions['height']}\""; } else { $avatar_width_height = "width=\"{$avatar_dimensions[0]}\" height=\"{$avatar_dimensions[1]}\""; } } eval("\$post['useravatar'] = \"" . $templates->get("postbit_avatar") . "\";"); $post['avatar_padding'] = "padding-right: 10px;"; } else { $post['useravatar'] = ''; $post['avatar_padding'] = ''; } eval("\$post['button_find'] = \"" . $templates->get("postbit_find") . "\";"); if ($mybb->settings['enablepms'] == 1 && $post['receivepms'] != 0 && $mybb->usergroup['cansendpms'] == 1 && my_strpos("," . $post['ignorelist'] . ",", "," . $mybb->user['uid'] . ",") === false) { eval("\$post['button_pm'] = \"" . $templates->get("postbit_pm") . "\";"); } if ($post_type != 3 && $mybb->settings['enablereputation'] == 1 && $mybb->settings['postrep'] == 1 && $mybb->usergroup['cangivereputations'] == 1 && $usergroup['usereputationsystem'] == 1 && ($mybb->settings['posrep'] || $mybb->settings['neurep'] || $mybb->settings['negrep']) && $post['uid'] != $mybb->user['uid']) { if (!$post['pid']) { $post['pid'] = 0; } eval("\$post['button_rep'] = \"" . $templates->get("postbit_rep_button") . "\";"); } if ($post['website'] != "") { $post['website'] = htmlspecialchars_uni($post['website']); eval("\$post['button_www'] = \"" . $templates->get("postbit_www") . "\";"); } else { $post['button_www'] = ""; } if ($post['hideemail'] != 1 && $mybb->usergroup['cansendemail'] == 1) { eval("\$post['button_email'] = \"" . $templates->get("postbit_email") . "\";"); } else { $post['button_email'] = ""; } $post['userregdate'] = my_date($mybb->settings['regdateformat'], $post['regdate']); // Work out the reputation this user has (only show if not announcement) if ($post_type != 3 && $usergroup['usereputationsystem'] != 0 && $mybb->settings['enablereputation'] == 1) { $post['userreputation'] = get_reputation($post['reputation'], $post['uid']); eval("\$post['replink'] = \"" . $templates->get("postbit_reputation") . "\";"); } // Showing the warning level? (only show if not announcement) if ($post_type != 3 && $mybb->settings['enablewarningsystem'] != 0 && $usergroup['canreceivewarnings'] != 0 && ($mybb->usergroup['canwarnusers'] != 0 || $mybb->user['uid'] == $post['uid'] && $mybb->settings['canviewownwarning'] != 0)) { $warning_level = round($post['warningpoints'] / $mybb->settings['maxwarningpoints'] * 100); if ($warning_level > 100) { $warning_level = 100; } $warning_level = get_colored_warning_level($warning_level); // If we can warn them, it's not the same person, and we're in a PM or a post. if ($mybb->usergroup['canwarnusers'] != 0 && $post['uid'] != $mybb->user['uid'] && ($post_type == 0 || $post_type == 2)) { eval("\$post['button_warn'] = \"" . $templates->get("postbit_warn") . "\";"); $warning_link = "warnings.php?uid={$post['uid']}"; } else { $warning_link = "usercp.php"; } eval("\$post['warninglevel'] = \"" . $templates->get("postbit_warninglevel") . "\";"); } eval("\$post['user_details'] = \"" . $templates->get("postbit_author_user") . "\";"); } else { // Message was posted by a guest or an unknown user $post['profilelink'] = format_name($post['username'], 1); if ($usergroup['usertitle']) { $post['usertitle'] = $usergroup['usertitle']; } else { $post['usertitle'] = $lang->guest; } $usergroup['title'] = $lang->na; $post['userregdate'] = $lang->na; $post['postnum'] = $lang->na; $post['button_profile'] = ''; $post['button_email'] = ''; $post['button_www'] = ''; $post['signature'] = ''; $post['button_pm'] = ''; $post['button_find'] = ''; $post['onlinestatus'] = ''; $post['replink'] = ''; eval("\$post['user_details'] = \"" . $templates->get("postbit_author_guest") . "\";"); } $post['button_edit'] = ''; $post['button_quickdelete'] = ''; $post['button_quote'] = ''; $post['button_quickquote'] = ''; $post['button_report'] = ''; // For private messages, fetch the reply/forward/delete icons if ($post_type == 2 && $post['pmid']) { global $replyall; eval("\$post['button_reply_pm'] = \"" . $templates->get("postbit_reply_pm") . "\";"); eval("\$post['button_forward_pm'] = \"" . $templates->get("postbit_forward_pm") . "\";"); eval("\$post['button_delete_pm'] = \"" . $templates->get("postbit_delete_pm") . "\";"); if ($replyall == true) { eval("\$post['button_replyall_pm'] = \"" . $templates->get("postbit_replyall_pm") . "\";"); } } if (!$post_type) { // Figure out if we need to show an "edited by" message $post['editedmsg'] = ''; if ($post['edituid'] != 0 && $post['edittime'] != 0 && $post['editusername'] != "" && ($mybb->settings['showeditedby'] != 0 && $usergroup['cancp'] == 0 || $mybb->settings['showeditedbyadmin'] != 0 && $usergroup['cancp'] == 1)) { $post['editdate'] = my_date($mybb->settings['dateformat'], $post['edittime']); $post['edittime'] = my_date($mybb->settings['timeformat'], $post['edittime']); $post['editnote'] = $lang->sprintf($lang->postbit_edited, $post['editdate'], $post['edittime']); $post['editedprofilelink'] = build_profile_link($post['editusername'], $post['edituid']); eval("\$post['editedmsg'] = \"" . $templates->get("postbit_editedby") . "\";"); } if ((is_moderator($fid, "caneditposts") || $forumpermissions['caneditposts'] == 1 && $mybb->user['uid'] == $post['uid']) && $mybb->user['uid'] != 0) { eval("\$post['button_edit'] = \"" . $templates->get("postbit_edit") . "\";"); } // Quick Delete button $can_delete = 0; if ($mybb->user['uid'] == $post['uid']) { if ($forumpermissions['candeletethreads'] == 1 && $postcounter == 1) { $can_delete = 1; } else { if ($forumpermissions['candeleteposts'] == 1 && $postcounter != 1) { $can_delete = 1; } } } if ((is_moderator($fid, "candeleteposts") || $can_delete == 1) && $mybb->user['uid'] != 0) { eval("\$post['button_quickdelete'] = \"" . $templates->get("postbit_quickdelete") . "\";"); } // Inline moderation stuff if ($ismod) { if (isset($mybb->cookies[$inlinecookie]) && my_strpos($mybb->cookies[$inlinecookie], "|" . $post['pid'] . "|")) { $inlinecheck = "checked=\"checked\""; $inlinecount++; } else { $inlinecheck = ""; } eval("\$post['inlinecheck'] = \"" . $templates->get("postbit_inlinecheck") . "\";"); if ($post['visible'] == 0) { $invisiblepost = 1; } } else { $post['inlinecheck'] = ""; } $post['postlink'] = get_post_link($post['pid'], $post['tid']); eval("\$post['posturl'] = \"" . $templates->get("postbit_posturl") . "\";"); global $forum, $thread; if ($forum['open'] != 0 && ($thread['closed'] != 1 || is_moderator($forum['fid']))) { eval("\$post['button_quote'] = \"" . $templates->get("postbit_quote") . "\";"); } if ($forumpermissions['canpostreplys'] != 0 && ($thread['closed'] != 1 || is_moderator($fid)) && $mybb->settings['multiquote'] != 0 && $forum['open'] != 0 && !$post_type) { eval("\$post['button_multiquote'] = \"" . $templates->get("postbit_multiquote") . "\";"); } if ($mybb->user['uid'] != "0") { eval("\$post['button_report'] = \"" . $templates->get("postbit_report") . "\";"); } if ($mybb->settings['logip'] != "no") { if ($mybb->settings['logip'] == "show") { eval("\$post['iplogged'] = \"" . $templates->get("postbit_iplogged_show") . "\";"); } else { if ($mybb->settings['logip'] == "hide" && is_moderator($fid, "canviewips")) { eval("\$post['iplogged'] = \"" . $templates->get("postbit_iplogged_hiden") . "\";"); } else { $post['iplogged'] = ""; } } } else { $post['iplogged'] = ""; } } elseif ($post_type == 3) { if ($mybb->usergroup['issupermod'] == 1 || is_moderator($fid)) { eval("\$post['button_edit'] = \"" . $templates->get("announcement_edit") . "\";"); eval("\$post['button_quickdelete'] = \"" . $templates->get("announcement_quickdelete") . "\";"); } } if ($post['smilieoff'] == 1) { $parser_options['allow_smilies'] = 0; } // If we have incoming search terms to highlight - get it done. if (!empty($mybb->input['highlight'])) { $parser_options['highlight'] = $mybb->input['highlight']; $post['subject'] = $parser->highlight_message($post['subject'], $parser_options['highlight']); } $post['message'] = $parser->parse_message($post['message'], $parser_options); get_post_attachments($id, $post); if ($post['includesig'] != 0 && $post['username'] && $post['signature'] != "" && ($mybb->user['uid'] == 0 || $mybb->user['showsigs'] != 0) && ($post['suspendsignature'] == 0 || $post['suspendsignature'] == 1 && $post['suspendsigtime'] != 0 && $post['suspendsigtime'] < TIME_NOW) && $usergroup['canusesig'] == 1 && ($usergroup['canusesigxposts'] == 0 || $usergroup['canusesigxposts'] > 0 && $postnum > $usergroup['canusesigxposts'])) { $sig_parser = array("allow_html" => $mybb->settings['sightml'], "allow_mycode" => $mybb->settings['sigmycode'], "allow_smilies" => $mybb->settings['sigsmilies'], "allow_imgcode" => $mybb->settings['sigimgcode'], "me_username" => $post['username'], "filter_badwords" => 1); if ($usergroup['signofollow']) { $sig_parser['nofollow_on'] = 1; } $post['signature'] = $parser->parse_message($post['signature'], $sig_parser); eval("\$post['signature'] = \"" . $templates->get("postbit_signature") . "\";"); } else { $post['signature'] = ""; } $icon_cache = $cache->read("posticons"); if ($post['icon'] > 0 && $icon_cache[$post['icon']]) { $icon = $icon_cache[$post['icon']]; $icon['path'] = htmlspecialchars_uni($icon['path']); $icon['name'] = htmlspecialchars_uni($icon['name']); $post['icon'] = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" style=\"vertical-align: middle;\" /> "; } else { $post['icon'] = ""; } $post_visibility = ''; switch ($post_type) { case 1: // Message preview $post = $plugins->run_hooks("postbit_prev", $post); break; case 2: // Private message $post = $plugins->run_hooks("postbit_pm", $post); break; case 3: // Announcement $post = $plugins->run_hooks("postbit_announcement", $post); break; default: // Regular post $post = $plugins->run_hooks("postbit", $post); // Is this author on the ignore list of the current user? Hide this post $ignore_bit = ''; if (is_array($ignored_users) && $post['uid'] != 0 && isset($ignored_users[$post['uid']]) && $ignored_users[$post['uid']] == 1) { $ignored_message = $lang->sprintf($lang->postbit_currently_ignoring_user, $post['username']); eval("\$ignore_bit = \"" . $templates->get("postbit_ignored") . "\";"); $post_visibility = "display: none;"; } break; } if ($mybb->settings['postlayout'] == "classic") { eval("\$postbit = \"" . $templates->get("postbit_classic") . "\";"); } else { eval("\$postbit = \"" . $templates->get("postbit") . "\";"); } $GLOBALS['post'] = ""; return $postbit; }
function get_reputation_at_rank($fid, $standing, $race) { $reputation = get_reputation($fid, $standing, $race); return reputation_at_rank($reputation); }