if ($addtable) { print_table_start($echobr, $width, $cellspacing, $clean_name . '_table', $border_collapse); } else { $tableadded = 0; } } // grab the counts of all users that have PMs function rpm_get_pm_users($totalpms) { global $db, $db_prefix; $res ="SELECT COUNT(`pm`.`recipient`) AS total, `pm`.`sender`, `pm`.`recipient`, `user`.`username`, `user`.`id` AS `userid` FROM `torrent_private_messages` AS `pm` INNER JOIN `torrent_users` AS `user` ON (`pm`.`recipient` = `user`.`id`) WHERE `pm`.`recipient` = `user`.`id` GROUP BY `pm`.`recipient` HAVING total = " . $totalpms . " ORDER BY `pm`.`recipient` DESC "; $pms=$db->sql_query($res) or btsqlerror($res); return $pms; } function rpm_print_footer() { } function rpm_get_all_pm_users() { global $db, $db_prefix; $totals = $db->sql_query(" SELECT COUNT(*) AS total FROM `" . $db_prefix . "_private_messages` GROUP BY `recipient` ORDER BY total DESC "); return $totals; } function rpm_get_pm($pmtextid) { global $db, $db_prefix; $get_pm = $db->sql_fetchrow($db->sql_query(" SELECT * FROM `" . $db_prefix . "_private_messages` WHERE `id` = " . $pmtextid . " ")); return $get_pm; } function print_description_row($text, $htmlise = false, $colspan = 2, $class = '', $align = '', $helpname = NULL) { global $stylevar;
// ####################### LIST USERS WITH X AMOUNT OF PMs ########################## if ( $_REQUEST['do'] == 'havepms' ) { // grab list of users that have PMs $havepms = rpm_get_pm_users($_REQUEST['totalpms']);
// if there are no PMs if (!$db->sql_numrows($havepms)) { rpm_print_stop_back('There are no PMs.'); die(); }
// show the list OpenTable(HACK_TITLE . ' - List Users With ' . $_REQUEST['totalpms'] . ' PMs'); print_form_header('', '', 0, 1, 'havepmsForm'); print_table_header('List of users with ' . $_REQUEST['totalpms'] . ' PMs'); while($pms = $db->sql_fetchrow($havepms)) { $link1 = THIS_SCRIPT . '.php?do=list&userid=' . $pms['userid']; $link2 = 'pm.php?op=send&to=' . $pms['userid']; $link3 = 'user.php?op=editprofile&id=' . $pms['userid']; $row = '<span style="float:right">[<a href="' . $link1 . '">Show All PMs</a>] '; $row .= '[<a href="' . $link2 . '">Send PM to User</a>] '; $row .= '[<a href="' . $link3 . '">Edit User</a>]</span>'; $row .= '<b>' . $pms['username'] . '</b>'; print_description_row($row); } print_table_footer(2, '<input class="button" value="Go Back" title="" tabindex="1" onclick="window.location=\'javascript:history.back(1)\';" type="button">'); CloseTable(); } // ####################### LIST ALL USERS WITH PMs ########################## if ($_REQUEST['do'] == 'allusershavepms') { // get array of PM counts $pmcounts = rpm_get_all_pm_users(); //die(print_r($pmcounts));
print_form_header('', '', 0, 1, 'allusershavepmsForm'); print_table_header('List Users With PMs');
// assign the counts $pmtotals = array(); while ($currentpmcount = $db->sql_fetchrow($pmcounts)) { $pmtotals["$currentpmcount[total]"]++; } // construct & display the rows foreach ($pmtotals AS $pmtotal => $totalusers) { if ($totalusers != 1) { $usertext = 'There are ' . $totalusers .' users'; } else { $usertext = 'There is ' . $totalusers .' user'; } $link = THIS_SCRIPT . '.php?do=havepms&totalpms=' . $pmtotal; $row = '<span style="float:right">[<a href="' . $link . '">List All Users</a>]</span>'; $row .= $usertext . ' with ' . $pmtotal . ' PMs' ; print_description_row($row); } print_table_footer(2, '<input class="button" value="Go Back" title="" tabindex="1" onclick="window.location=\'javascript:history.back(1)\';" type="button">'); } // ############################# READ PMs ################################# if ($_REQUEST['do'] == 'list') { // if no userid or username entered if (empty($_REQUEST['userid'])) { print('You need to enter a User ID or Username.'); }
// if it is a username if (!is_numeric($_REQUEST['userid'])) { // check the username exists and assign it $userid = rpm_username_exists($_REQUEST['userid']);
// if username does not exist if (empty($userid)) { print('User <b>' . $_REQUEST['userid'] . '</b> does not exist.' . $userid); die(); } } else // if userid { // if userid does not exist if (!rpm_user_exists($_REQUEST['userid'])) { print('User ID: <b>' . $_REQUEST['userid'] . '</b> does not exist.'); die(); }
// assign the userid $userid = $_REQUEST['userid']; }
// get all PMs for the user $pms = rpm_get_pms($userid);
// if there are no PMs if (empty($pms)) { print('User <b>' . $_REQUEST['userid'] . '</b> has no PMs.'); die(); }
// get the username $name = rpm_get_name($userid);
// seperate sent and recieved PMs $sent = array(); $received = array(); foreach ($pms AS $pm) { // seperate sent and recieved PMs (also takes into account user sending to self via to or bcc) if ($pm['sender'] == $userid) { $sent[] = $pm; } else { $received[] = $pm; } }
// if pmtext is not a number or number < 1 if (!is_numeric($_REQUEST['pmtextid']) OR $_REQUEST['pmtextid'] < 1) { print('Pmtextid must be a positive number.'); die(); }
// get the requested PM $pm = rpm_get_pm($_REQUEST['pmtextid']);
// PM does not exist if (empty($pm)) { print('Pmtextid <b>' . $_REQUEST['pmtextid'] . '</b> does not exist.'); die(); }
// get all userids for the users that still have the PM with pmtextid $userids = $db->sql_fetchrow($db->sql_query(" SELECT DISTINCT `sender` FROM `".$db_prefix."_private_messages` WHERE `id` = " . $_REQUEST['pmtextid'] . " "));
// If there are no userids then the PM does not exist (this handles the last x PMs) if (empty($userids)) { print(' <center>Pmtextid <b>' . $_REQUEST['pmtextid'] . '</b> has been deleted and can not be recovered. The non-existant entry will be automatically removed within the hour by the <b>Hourly Cleanup #2</b> scheduled task.</center> '); die(); }
// grab array of to and bcc users //$toarray = array_values(unserialize($pm['touserarray']));
// convert date to readable format $date = $pm['sent'];
// show PM contents print_form_header('', '', 0, 1, 'pmlistForm'); print_table_header('Private Message Text ID : ' . $pm['id'],2); print_label_row('<b>From:</b></b><dfn>Link goes to users Details.</dfn>', $pm['sender'] . ' (<a href = "user.php?op=profile&id=' . $pm['sender'] . '">userid: ' . $pm['sender'] . '</a>)'); if (is_array($toarray[0])) { print_label_row('<b>To:</b><dfn>Link(s) goes to users Details.</dfn>' , rpm_display_recipients_with_links($toarray[0])); } if (is_array($toarray[1])) { print_label_row('<b>BCC:</b></b><dfn>Link(s) goes to users Details.</dfn>' , rpm_display_recipients_with_links($toarray[1])); } print_label_row('<b>PM Title:</b>', $pm['subject']); print_label_row('<b>Date:</b>', $date);
$message = format_comment($pm['text'], false, true); parse_smiles($message); print_label_row('<b>Message:', '<div class="smallfont">' . $message . '</div>'); print_table_footer(2, '<input class="button" value="Go Back" title="" tabindex="1" onclick="window.location=\'javascript:history.back(1)\';" type="button">'); } // ############################### SEARCH ################################# if ($_REQUEST['do'] == 'search') { // if no search terms have been entered if (empty($_REQUEST['search'])) { rpm_print_stop_back('You must type in at least one word to search for.'); } // assign and make search terms safe $search_for = $_REQUEST['search'];
// see if any of the search terms is lower than the minimum length $words = explode(" ", $search_for); foreach ($words AS $current) { if (strlen($current) < MIN_SEARCH_WORD_LENGTH) { rpm_print_stop_back('At least one of your search terms was less than ' . MIN_SEARCH_WORD_LENGTH .' characters long.'); } }
// assign the type of match $match = $_REQUEST['match'];
// conduct the search $pms = rpm_search_pms($search_for, $match);
// format search words for display purposes switch ($match) { case 'exact': $search_words = str_replace(" ", " + ", $search_for); $search_wording = 'the exact text'; break;
case 'all': $search_words = str_replace(" ", " and ", $search_for); $search_wording = 'all of the following words'; break;
case 'atleastone': $search_words = str_replace(" ", " or ", $search_for); $search_wording = 'at least one of the following words'; break; }
// ########################### LATEST X PMs ############################### if ($_REQUEST['do'] == 'latest') { // if nothing entered or zero entered if (empty($_REQUEST['showlatest'])) { rpm_print_stop_back('Enter a positive number greater than 0.'); }
// if non-numeric or negative number entered if (!is_numeric($_REQUEST['showlatest']) OR $_REQUEST['showlatest'] < 1) { rpm_print_stop_back('Enter a positive number greater than 0.'); }
// get the PM list $pms = rpm_get_latest_pms($_REQUEST['showlatest']);
// if no PMs if (empty($pms)) { rpm_print_stop_back('There are no PMs to view.'); }
//$byuser = "WHERE username ='".escape($userid)."' OR name = '".escape($userid)."' OR clean_username = '".escape(strtolower($userid))."' OR id = ".escape($userid).""; //////////END PAGER/////////// $res = $db->sql_query("SELECT * FROM torrent_private_messages $byuser ORDER BY id DESC $limit") or sqlerr(__FILE__, __LINE__); if (empty($_REQUEST['do'])) {
I made a new file as you said but nothing shows in admin page...
Doesn't it wants another file for admin/items/ and a png file so that it shows at you admin.php?
joeroberts
15th June 2010 22:49
I did not make this to go in admin files only root
was just a quick little something I made just place a link to it in your nav bar or something like this
";
if(!eregi("phpBB.php",$_SERVER["PHP_SELF"]))
{
if ($donations){
include("./blocks/donation_block.php");
}
//include("blocks/shoutbox.php");
}
echo "
\n";
echo "
\n";
echo "
";
$sql_profile = "SELECT * FROM ".$db_prefix."_users where id = '".$user->id."' ;";
$res_profile = $db->sql_query($sql_profile);
$userrow = $db->sql_fetchrow($res_profile);
$db->sql_freeresult($res_profile);
// WARN things START
if ($user->user) {
if ($user->downloaded > 0){
include ("./ratiowarn.php");
}
}
$has_newpm = false;
$sql = "SELECT id FROM ".$db_prefix."_private_messages WHERE recipient = '".$user->id."' AND is_read = 'false' LIMIT 1;";
$res = $db->sql_query($sql) or btsqlerror($sql);
$pmcount = $db->sql_numrows($res);
$has_newpm = ($pmcount > 0) ? true : false;
$db->sql_freeresult($res);
if ($has_newpm)
{
print("
';
}
function help($name,$help,$title = "") {
echo "
if ($title != "") echo ",CAPTION, '".addslashes(str_replace(Array("\n","\""),Array("","'"),$title))."'";
echo ",FGCOLOR,'#ffffaa',CAPICON,'themes/pmbt/pics/help.png',SHADOW,SHADOWOPACITY,40,SHADOWCOLOR,'#000000',SHADOWX,2,SHADOWY,2,HAUTO,VAUTO);\" onmouseout=\"return nd();\" style=\"cursor:help\">".$name."";
}
?>
i want to replace the red line with something functional...only by admins that appears also in the theme!
joeroberts
12th August 2012 09:21
ok got a couple questions first off
#1 the file is named admin_pms.php rite?
#2 the file is located in the same location as your index.php rite?
#3 is the image for the new file in the root folder or is it in the theme pic folder?
#4 did you make sure the file has chmod 777 ?
PHP Code:
<?php if (eregi("main.php",$_SERVER["PHP_SELF"])) die ("You can't access this file directly");