function view_list() { global $now_date, $time_offset, $input, $lang; $title = $lang['rep_ad_view_title']; $html = "<div class='row'><div class='col-md-12'>"; $html = "<h2>{$lang['rep_ad_view_view']}</h2>"; $html .= "<p>{$lang['rep_ad_view_page']}</p>"; $html .= "<form action='staffpanel.php?tool=reputation_ad' name='list_form' method='post'>\n\t\t\t\t<input name='mode' value='list' type='hidden' />\n\t\t\t\t<input name='dolist' value='1' type='hidden' />"; $html .= "<table class='table table-bordered'>"; $html .= "<tr><td width='20%'>{$lang['rep_ad_view_for']}</td><td width='80%'><input type='text' name='leftfor' value='' size='35' maxlength='250' tabindex='1' /></td></tr>"; $html .= "<tr><td colspan='2'><div>{$lang['rep_ad_view_for_txt']}</div></td></tr>"; $html .= "<tr><td>{$lang['rep_ad_view_by']}</td><td><input type='text' name='leftby' value='' size='35' maxlength='250' tabindex='2' /></td></tr>"; $html .= "<tr><td colspan='2'><div>{$lang['rep_ad_view_by_txt']}</div></td></tr>"; $html .= "<tr><td>{$lang['rep_ad_view_start']}</td><td>\n\t\t<div>\n\t\t\t\t<span style='padding-right:5px; float:left;'>{$lang['rep_ad_view_month']}<br /><select name='start[month]' tabindex='3'>" . get_month_dropdown(1) . "</select></span>\n\t\t\t\t<span style='padding-right:5px; float:left;'>{$lang['rep_ad_view_day']}<br /><input type='text' name='start[day]' value='" . ($now_date['mday'] + 1) . "' size='4' maxlength='2' tabindex='3' /></span>\n\t\t\t\t<span>{{$lang['rep_ad_view_year']}}<br /><input type='text' name='start[year]' value='" . $now_date['year'] . "' size='4' maxlength='4' tabindex='3' /></span>\n\t\t\t</div></td></tr>"; $html .= "<tr><td class='tdrow2' colspan='2'><div class='desctext'>{{$lang['rep_ad_view_start_select']}}</div></td></tr>"; $html .= "<tr><td>{$lang['rep_ad_view_end']}</td><td>\n\t\t\t<div>\n\t\t\t\t<span style='padding-right:5px; float:left;'>{$lang['rep_ad_view_month']}<br /><select name='end[month]' class='textinput' tabindex='4'>" . get_month_dropdown() . "</select></span>\n\t\t\t\t<span style='padding-right:5px; float:left;'>{$lang['rep_ad_view_day']}<br /><input type='text' class='textinput' name='end[day]' value='" . $now_date['mday'] . "' size='4' maxlength='2' tabindex='4' /></span>\n\t\t\t\t<span>{$lang['rep_ad_view_year']}<br /><input type='text' class='textinput' name='end[year]' value='" . $now_date['year'] . "' size='4' maxlength='4' tabindex='4' /></span>\n\t\t\t</div></td></tr>"; $html .= "<tr><td class='tdrow2' colspan='2'><div class='desctext'>{$lang['rep_ad_view_end_select']}</div></td></tr>"; $html .= "<tr><td colspan='2' align='center'><input type='submit' value='{$lang['rep_ad_view_search']}' accesskey='s' class='btn' tabindex='5' /> <input type='reset' value='{$lang['rep_ad_view_reset']}' accesskey='r' class='btn' tabindex='6' /></td></tr>"; $html .= "</table></form>"; $html .= "</div></div>"; //echo $html; exit; // I hate work, but someone has to do it! if (isset($input['dolist'])) { $links = ""; $input['orderby'] = isset($input['orderby']) ? $input['orderby'] : ''; //$cond = ''; //experiment $who = isset($input['who']) ? (int) $input['who'] : 0; $user = isset($input['user']) ? $input['user'] : 0; $first = isset($input['page']) ? intval($input['page']) : 0; $cond = $who ? "r.whoadded=" . sqlesc($who) : ''; $start = isset($input['startstamp']) ? intval($input['startstamp']) : mktime(0, 0, 0, $input['start']['month'], $input['start']['day'], $input['start']['year']) + $time_offset; $end = isset($input['endstamp']) ? intval($input['endstamp']) : mktime(0, 0, 0, $input['end']['month'], $input['end']['day'] + 1, $input['end']['year']) + $time_offset; if (!$start) { $start = TIME_NOW - 3600 * 24 * 30; } if (!$end) { $end = TIME_NOW; } if ($start >= $end) { stderr($lang['rep_ad_view_err1'], $lang['rep_ad_view_err2']); } if (!empty($input['leftby'])) { $left_b = @sql_query("SELECT id FROM users WHERE username = "******"r.whoadded=" . $who; } if (!empty($input['leftfor'])) { $left_f = @sql_query("SELECT id FROM users WHERE username = "******" AND" : "") . " r.userid=" . $user; } if ($start) { $cond .= ($cond ? " AND" : "") . " r.dateadd >= {$start}"; } if ($end) { $cond .= ($cond ? " AND" : "") . " r.dateadd <= {$end}"; } switch ($input['orderby']) { case 'leftbyuser': $order = 'leftby.username'; $orderby = 'leftbyuser'; break; case 'leftforuser': $order = 'leftfor.username'; $orderby = 'leftforuser'; break; default: $order = 'r.dateadd'; $orderby = 'dateadd'; } $css = "style='font-weight: bold;color: #ffffff;background-color: #0055A4;padding: 5px;'"; $html = "<div class='row'><div class='col-md-12'><h2>{$lang['rep_ad_view_cmts']}</h2>"; $table_header = "<table class='table table-bordered'><tr {$css}>"; $table_header .= "<td width='5%'>{$lang['rep_ad_view_id']}</td>"; $table_header .= "<td width='20%'><a href='staffpanel.php?tool=reputation_ad&mode=list&dolist=1&who=" . intval($who) . "&user="******"&orderby=leftbyuser&startstamp={$start}&endstamp={$end}&page={$first}'>{$lang['rep_ad_view_by']}</a></td>"; $table_header .= "<td width='20%'><a href='staffpanel.php?tool=reputation_ad&mode=list&dolist=1&who=" . intval($who) . "&user="******"&orderby=leftforuser&startstamp={$start}&endstamp={$end}&page={$first}'>{$lang['rep_ad_view_for']}</a></td>"; $table_header .= "<td width='17%'><a href='staffpanel.php?tool=reputation_ad&mode=list&dolist=1&who=" . intval($who) . "&user="******"&orderby=date&startstamp={$start}&endstamp={$end}&page={$first}'>{$lang['rep_ad_view_date']}</a></td>"; $table_header .= "<td width='5%'>{$lang['rep_ad_view_point']}</td>"; $table_header .= "<td width='23%'>{$lang['rep_ad_view_reason']}</td>"; $table_header .= "<td width='10%'>{$lang['rep_ad_view_controls']}</td></tr>"; $html .= $table_header; // do the count for pager etc $query = sql_query("SELECT COUNT(*) AS cnt FROM reputation r WHERE {$cond}"); //echo_r($input); exit; $total = mysqli_fetch_assoc($query); if (!$total['cnt']) { $html .= "<tr><td colspan='7' align='center'>{$lang['rep_ad_view_none_found']}</td></tr>"; } // do the pager thang! $deflimit = 10; $links = "<span style=\"background: #F0F5FA; border: 1px solid #072A66;padding: 1px 3px 1px 3px;\">{$total['cnt']} {$lang['rep_ad_view_records']}</span>"; if ($total['cnt'] > $deflimit) { require_once INCL_DIR . 'pager_functions.php'; $links = pager_rep(array('count' => $total['cnt'], 'perpage' => $deflimit, 'start_value' => $first, 'url' => "staffpanel.php?tool=reputation_ad&mode=list&dolist=1&who=" . intval($who) . "&user="******"&orderby={$orderby}&startstamp={$start}&endstamp={$end}")); } // mofo query! $query = sql_query("SELECT r.*, p.topic_id, leftfor.id as leftfor_id, \n\t\t\t\t\t\t\t\t\tleftfor.username as leftfor_name, leftby.id as leftby_id, \n\t\t\t\t\t\t\t\t\tleftby.username as leftby_name \n\t\t\t\t\t\t\t\t\tFROM reputation r \n\t\t\t\t\t\t\t\t\tleft join posts p on p.id=r.postid \n\t\t\t\t\t\t\t\t\tleft join users leftfor on leftfor.id=r.userid \n\t\t\t\t\t\t\t\t\tleft join users leftby on leftby.id=r.whoadded \n\t\t\t\t\t\t\t\t\tWHERE {$cond} ORDER BY {$order} LIMIT {$first},{$deflimit}"); if (!mysqli_num_rows($query)) { stderr($lang['rep_ad_view_err3'], $lang['rep_ad_view_err5']); } while ($r = mysqli_fetch_assoc($query)) { $r['dateadd'] = date("M j, Y, g:i a", $r['dateadd']); $html .= "<tr><td>#{$r['reputationid']}</td>"; $html .= "<td><a href='userdetails.php?id={$r['leftby_id']}' target='_blank'>{$r['leftby_name']}</a></td>"; $html .= "<td><a href='userdetails.php?id={$r['leftfor_id']}' target='_blank'>{$r['leftfor_name']}</a></td>"; $html .= "<td>{$r['dateadd']}</td>"; $html .= "<td align='right'>{$r['reputation']}</td>"; $html .= "<td><a href='forums.php?action=viewtopic&topicid={$r['topic_id']}&page=p{$r['postid']}#{$r['postid']}' target='_blank'>" . htmlsafechars($r['reason']) . "</a></td>"; $html .= "<td><a href='staffpanel.php?tool=reputation_ad&mode=editrep&reputationid={$r['reputationid']}'><span class='btn'>{$lang['rep_ad_view_edit']}</span></a> <a href='reputation_ad.php?mode=dodelrep&reputationid={$r['reputationid']}'><span class='btn'>{$lang['rep_ad_view_delete']}</span></a></td></tr>"; } $html .= "</table>"; $html .= "<br /><div>{$links}</div>"; $html .= "</div></div>"; } html_out($html, $title); }
function view_list() { global $now_date, $time_offset, $input; $title = 'User Reputation Manager'; $html = "<h2>View Reputation Comments</h2>"; $html .= "<p>This page allows you to search for reputation comments left by / for specific users over the specified date range.</p>"; $html .= "<form action='staffpanel.php?tool=reputation_ad' name='list_form' method='post'>\n\t\t\t\t<input name='mode' value='list' type='hidden' />\n\t\t\t\t<input name='dolist' value='1' type='hidden' />"; $html .= "<table width='500px' cellpadding='5px'>"; $html .= "<tr><td width='20%'>Left For</td><td width='80%'><input type='text' name='leftfor' value='' size='35' maxlength='250' tabindex='1' /></td></tr>"; $html .= "<tr><td colspan='2'><div>To limit the comments left for a specific user, enter the username here. Leave this field empty to receive comments left for every user.</div></td></tr>"; $html .= "<tr><td>Left By</td><td><input type='text' name='leftby' value='' size='35' maxlength='250' tabindex='2' /></td></tr>"; $html .= "<tr><td colspan='2'><div>To limit the comments left by a specific user, enter the username here. Leave this field empty to receive comments left by every user.</div></td></tr>"; $html .= "<tr><td>Start Date</td><td>\n\t\t<div>\n\t\t\t\t<span style='padding-right:5px; float:left;'>Month<br /><select name='start[month]' tabindex='3'>" . get_month_dropdown(1) . "</select></span>\n\t\t\t\t<span style='padding-right:5px; float:left;'>Day<br /><input type='text' name='start[day]' value='" . ($now_date['mday'] + 1) . "' size='4' maxlength='2' tabindex='3' /></span>\n\t\t\t\t<span>Year<br /><input type='text' name='start[year]' value='" . $now_date['year'] . "' size='4' maxlength='4' tabindex='3' /></span>\n\t\t\t</div></td></tr>"; $html .= "<tr><td class='tdrow2' colspan='2'><div class='desctext'>Select a start date for this report. Select a month, day, and year. The selected statistic must be no older than this date for it to be included in the report.</div></td></tr>"; $html .= "<tr><td>End Date</td><td>\n\t\t\t<div>\n\t\t\t\t<span style='padding-right:5px; float:left;'>Month<br /><select name='end[month]' class='textinput' tabindex='4'>" . get_month_dropdown() . "</select></span>\n\t\t\t\t<span style='padding-right:5px; float:left;'>Day<br /><input type='text' class='textinput' name='end[day]' value='" . $now_date['mday'] . "' size='4' maxlength='2' tabindex='4' /></span>\n\t\t\t\t<span>Year<br /><input type='text' class='textinput' name='end[year]' value='" . $now_date['year'] . "' size='4' maxlength='4' tabindex='4' /></span>\n\t\t\t</div></td></tr>"; $html .= "<tr><td class='tdrow2' colspan='2'><div class='desctext'>Select an end date for this report. Select a month, day, and year. The selected statistic must not be newer than this date for it to be included in the report. You can use this setting in conjunction with the 'Start Date' setting to create a window of time for this report.</div></td></tr>"; $html .= "<tr><td colspan='2' align='center'><input type='submit' value='Search' accesskey='s' class='btn' tabindex='5' /> <input type='reset' value='Reset' accesskey='r' class='btn' tabindex='6' /></td></tr>"; $html .= "</table></form>"; //echo $html; exit; // I hate work, but someone has to do it! if (isset($input['dolist'])) { $links = ""; $input['orderby'] = isset($input['orderby']) ? $input['orderby'] : ''; //$cond = ''; //experiment $who = isset($input['who']) ? (int) $input['who'] : 0; $user = isset($input['user']) ? $input['user'] : 0; $first = isset($input['page']) ? intval($input['page']) : 0; $cond = $who ? "r.whoadded=" . sqlesc($who) : ''; $start = isset($input['startstamp']) ? intval($input['startstamp']) : mktime(0, 0, 0, $input['start']['month'], $input['start']['day'], $input['start']['year']) + $time_offset; $end = isset($input['endstamp']) ? intval($input['endstamp']) : mktime(0, 0, 0, $input['end']['month'], $input['end']['day'] + 1, $input['end']['year']) + $time_offset; if (!$start) { $start = TIME_NOW - 3600 * 24 * 30; } if (!$end) { $end = TIME_NOW; } if ($start >= $end) { stderr('Time', 'Start date is after the end date.'); } if (!empty($input['leftby'])) { $left_b = @sql_query("SELECT id FROM users WHERE username = "******"r.whoadded=" . $who; } if (!empty($input['leftfor'])) { $left_f = @sql_query("SELECT id FROM users WHERE username = "******" AND" : "") . " r.userid=" . $user; } if ($start) { $cond .= ($cond ? " AND" : "") . " r.dateadd >= {$start}"; } if ($end) { $cond .= ($cond ? " AND" : "") . " r.dateadd <= {$end}"; } switch ($input['orderby']) { case 'leftbyuser': $order = 'leftby.username'; $orderby = 'leftbyuser'; break; case 'leftforuser': $order = 'leftfor.username'; $orderby = 'leftforuser'; break; default: $order = 'r.dateadd'; $orderby = 'dateadd'; } $css = "style='font-weight: bold;color: #ffffff;background-color: #0055A4;padding: 5px;'"; $html = "<h2>Reputation Comments</h2>"; $table_header = "<table width='80%' cellpadding='5' border='1'><tr {$css}>"; $table_header .= "<td width='5%'>ID</td>"; $table_header .= "<td width='20%'><a href='staffpanel.php?tool=reputation_ad&mode=list&dolist=1&who=" . intval($who) . "&user="******"&orderby=leftbyuser&startstamp={$start}&endstamp={$end}&page={$first}'>Left By</a></td>"; $table_header .= "<td width='20%'><a href='staffpanel.php?tool=reputation_ad&mode=list&dolist=1&who=" . intval($who) . "&user="******"&orderby=leftforuser&startstamp={$start}&endstamp={$end}&page={$first}'>Left For</a></td>"; $table_header .= "<td width='17%'><a href='staffpanel.php?tool=reputation_ad&mode=list&dolist=1&who=" . intval($who) . "&user="******"&orderby=date&startstamp={$start}&endstamp={$end}&page={$first}'>Date</a></td>"; $table_header .= "<td width='5%'>Point</td>"; $table_header .= "<td width='23%'>Reason</td>"; $table_header .= "<td width='10%'>Controls</td></tr>"; $html .= $table_header; // do the count for pager etc $query = sql_query("SELECT COUNT(*) AS cnt FROM reputation r WHERE {$cond}"); //echo_r($input); exit; $total = mysqli_fetch_assoc($query); if (!$total['cnt']) { $html .= "<tr><td colspan='7' align='center'>No Matches Found!</td></tr>"; } // do the pager thang! $deflimit = 10; $links = "<span style=\"background: #F0F5FA; border: 1px solid #072A66;padding: 1px 3px 1px 3px;\">{$total['cnt']} Records</span>"; if ($total['cnt'] > $deflimit) { require_once INCL_DIR . 'pager_functions.php'; $links = pager_rep(array('count' => $total['cnt'], 'perpage' => $deflimit, 'start_value' => $first, 'url' => "staffpanel.php?tool=reputation_ad&mode=list&dolist=1&who=" . intval($who) . "&user="******"&orderby={$orderby}&startstamp={$start}&endstamp={$end}")); } // mofo query! $query = sql_query("SELECT r.*, p.topic_id, leftfor.id as leftfor_id, \n\t\t\t\t\t\t\t\t\tleftfor.username as leftfor_name, leftby.id as leftby_id, \n\t\t\t\t\t\t\t\t\tleftby.username as leftby_name \n\t\t\t\t\t\t\t\t\tFROM reputation r \n\t\t\t\t\t\t\t\t\tleft join posts p on p.id=r.postid \n\t\t\t\t\t\t\t\t\tleft join users leftfor on leftfor.id=r.userid \n\t\t\t\t\t\t\t\t\tleft join users leftby on leftby.id=r.whoadded \n\t\t\t\t\t\t\t\t\tWHERE {$cond} ORDER BY {$order} LIMIT {$first},{$deflimit}"); if (!mysqli_num_rows($query)) { stderr('DB ERROR', 'Nothing here'); } while ($r = mysqli_fetch_assoc($query)) { $r['dateadd'] = date("M j, Y, g:i a", $r['dateadd']); $html .= "<tr><td>#{$r['reputationid']}</td>"; $html .= "<td><a href='userdetails.php?id={$r['leftby_id']}' target='_blank'>{$r['leftby_name']}</a></td>"; $html .= "<td><a href='userdetails.php?id={$r['leftfor_id']}' target='_blank'>{$r['leftfor_name']}</a></td>"; $html .= "<td>{$r['dateadd']}</td>"; $html .= "<td align='right'>{$r['reputation']}</td>"; $html .= "<td><a href='forums.php?action=viewtopic&topicid={$r['topic_id']}&page=p{$r['postid']}#{$r['postid']}' target='_blank'>" . htmlsafechars($r['reason']) . "</a></td>"; $html .= "<td><a href='staffpanel.php?tool=reputation_ad&mode=editrep&reputationid={$r['reputationid']}'><span class='btn'>Edit</span></a> <a href='reputation_ad.php?mode=dodelrep&reputationid={$r['reputationid']}'><span class='btn'>Delete</span></a></td></tr>"; } $html .= "</table>"; $html .= "<br /><div>{$links}</div>"; } html_out($html, $title); }