This mod was posted in the premium section Aug 17, 2008 so since it has been there long enough I though I would move it to the normal members section.
This is a Staff Navigation Block. Only your staff will see this block. It uses the links for V.2.04 so you may need to add some links to match it to your inks.
SQL:
This is a Staff Navigation Block. Only your staff will see this block. It uses the links for V.2.04 so you may need to add some links to match it to your inks.
SQL:
CREATE TABLE `staffnavigate` (
`id` bigint(20) NOT NULL auto_increment,
`link` varchar(100) NOT NULL default '',
`name` varchar(100) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `staffnavigate`
--
INSERT INTO `staffnavigate` VALUES(1, 'admincp.php?action=avatars', 'Avatar Log');
INSERT INTO `staffnavigate` VALUES(2, 'admincp.php?action=backups', 'Backups');
INSERT INTO `staffnavigate` VALUES(3, 'admincp.php?action=bannedtorrents', 'Banned Torrents');
INSERT INTO `staffnavigate` VALUES(4, 'admincp.php?action=blocks&do=view', 'Blocks');
INSERT INTO `staffnavigate` VALUES(5, 'admincp.php?action=cheats', 'Detect Possible Cheaters');
INSERT INTO `staffnavigate` VALUES(6, 'admincp.php?action=emailbans', 'Email Bans');
INSERT INTO `staffnavigate` VALUES(7, 'faq-manage.php', 'FAQ');
INSERT INTO `staffnavigate` VALUES(8, 'admincp.php?action=freetorrents', 'Free Leech Torrents');
INSERT INTO `staffnavigate` VALUES(9, 'admincp.php?action=lastcomm', 'Latest Comments');
INSERT INTO `staffnavigate` VALUES(10, 'admincp.php?action=masspm', 'Mass PM');
INSERT INTO `staffnavigate` VALUES(11, 'admincp.php?action=messagespy', 'Message Spy');
INSERT INTO `staffnavigate` VALUES(12, 'admincp.php?action=news&do=view', 'News');
INSERT INTO `staffnavigate` VALUES(13, 'admincp.php?action=peers', 'Peers List');
INSERT INTO `staffnavigate` VALUES(14, 'admincp.php?action=polls&do=view', 'Polls');
INSERT INTO `staffnavigate` VALUES(15, 'admincp.php?action=reports&do=view', 'Reports');
INSERT INTO `staffnavigate` VALUES(16, 'admincp.php?action=rules&do=view', 'Rules');
INSERT INTO `staffnavigate` VALUES(17, 'admincp.php?action=sitelog', 'Site Log');
INSERT INTO `staffnavigate` VALUES(18, 'teams-create.php', 'Teams');
INSERT INTO `staffnavigate` VALUES(19, 'admincp.php?action=categories&do=view', 'Torrent Categories');
INSERT INTO `staffnavigate` VALUES(20, 'admincp.php?action=torrentmanage', 'Torrents');
INSERT INTO `staffnavigate` VALUES(21, 'admincp.php?action=torrentlangs&do=view', 'Torrent Languages');
INSERT INTO `staffnavigate` VALUES(22, 'admincp.php?action=groups&do=view', 'User Groups');
INSERT INTO `staffnavigate` VALUES(23, 'admincp.php?action=users', 'Users');
INSERT INTO `staffnavigate` VALUES(24, 'admincp.php?action=warned', 'Warned Users');
INSERT INTO `staffnavigate` VALUES(25, 'admincp.php?action=whoswhere', 'Who\'s Where');
INSERT INTO `staffnavigate` VALUES(26, 'admincp.php?action=style', 'Theme Management');
INSERT INTO `staffnavigate` VALUES(27, 'admincp.php?action=censor', 'Word Censor');
add in functions.php:
function staffnavigatelist() {
$ret = array();
$res = mysql_query("SELECT id, link, name FROM staffnavigate ORDER BY id ASC");
while ($row = mysql_fetch_array($res))
$ret[] = $row;
return $ret;
}
make a new file called staffnavigate_block.php and put this inside:
<?
if (!$site_config["MEMBERSONLY"] || $CURUSER && $CURUSER["control_panel"]=="yes") {
begin_block("" . STAFFCP . "");
?>
<center>
<form>
<select name="staffnavigate" onChange="location = options[selectedIndex].value">
<option value="0">Please Select</option>
<?
$staffnavigate = staffnavigatelist();
$staffnavigatedropdown = "";
foreach ($staffnavigate as $staffnavigate) {
$staffnavigatedropdown .= "<option value=\"" . $staffnavigate["link"] . "\"";
if ($staffnavigate["id"] == $_GET["navigate"])
$staffnavigatedropdown .= " selected=\"selected\"";
$staffnavigatedropdown .= ">" . htmlspecialchars($staffnavigate["name"]) . "</option>\n";
}
?>
<?= $staffnavigatedropdown ?>
</select>
<input type="hidden">
</form>
</center>
<?
end_block();
}
?>
now find in admincp.php:
<td align="center"><a href=admincp.php?action=censor><img src="images/admin/censor.png" border=0 width=32 height=32><BR>Word Censor</a><BR></td>
add after:
<td align="center"><a href=admincp.php?action=staffnavigatelinks><img src="images/admin/external.gif" border=0 width=32 height=32><BR>Staff<BR>Navigation Links</a><BR></td>
now add at the end of admincp.php:
#======================================================================#
# Staff Navigation Links
#======================================================================#
if ($action == "staffnavigatelinks") {
if ($CURUSER["class"] < "15"){
show_error_msg("Error","Sorry you do not have the rights to view this page!",1);
}
if ($_GET["id"] != ""){
$id = $_GET["id"];
mysql_query("DELETE FROM staffnavigate WHERE id= $id") or sqlerr(__FILE__, __LINE__);
}
stdhead("Staff Navigation Links");
navmenu();
begin_frame("Staff Navigation Links");
?>
<CENTER><table align=center cellpadding="0" cellspacing="0" class="table_table" width="100%" border="1">
<tr>
<td class=table_head align=center>ID</td>
<td class=table_head align=center>Link</td>
<td class=table_head align=center>Name</td>
<td class=table_head align=center>Delete</td>
</tr>
<?
$res=mysql_query("SELECT id,link,name FROM staffnavigate ORDER BY id ASC") or sqlerr();
while($row=mysql_fetch_array($res)){
extract ($row);
$id=$row["id"];
$link=$row["link"];
$name=$row["name"];
echo "<tr><td class=table_col1>$id</td><td class=table_col1>$link</td><td class=table_col1>$name</td><td class=table_col1><a href='admincp.php?action=staffnavigatelinks&id=$id'>Delete</a></td></tr>\n";
}
echo "</table></CENTER>\n";
end_frame();
if ($_SERVER["REQUEST_METHOD"] == "POST"){
if ($_POST["link"] == "" || $_POST["name"] == "")
show_error_msg("Error", "missing form data.");
$name = $_POST["name"];
$link = $_POST["link"];
mysql_query("INSERT INTO staffnavigate (link, name) VALUES('$link', '$name')") or sqlerr(__FILE__, __LINE__);
}
begin_frame("Add Links");
?>
<form method="post" action=admincp.php?action=staffnavigatelinks>
<? begin_table(TRUE); ?>
<div align=center>
<br><font size=3><b>Example Link: admincp.php?action=avatars</b></font><br>
<br></div><br>
<tr><td class="tableb">Link:</td><td class="tablea"><input type="text" name="link" size="60"></td></tr>
<tr><td class="tableb">Name:</td><td class="tablea"><input type="text" name="name" size="60"></td></tr>
<tr><td class="tablea" colspan="2" style="text-align:center"><input type="submit" value="Okay" class="btn"></td></tr>
<? end_table(); ?>
</form>
<?
end_frame();
stdfoot();
}
#======================================================================#
# END Staff Navigation Links
#======================================================================#