chaosconundrum
New Member


Joined: Nov 15, 2004
Posts: 6
Location: MA, USA
|
Posted:
Mon Dec 13, 2004 5:53 am |
|
Please be easy on me - this is my first public posting of my code!
Although I know many of you have mentioned the desired use of a stand-alone waiting contents block (which I have also created), I prefer what I have done to the original build-in Administrator/Waiting block:
The block as I have rewritten it will dynamically display items based on what modules you have installed, and if there are any waiting items. If there aren't, then the info isn’t displayed, sections are skipped from processing, and the footprint of the admin block is drastically reduced.
My code (written with the windows platform in mind) will only show line items for what is actually pending. Anything with a 0 will be ommited. If there is _nothing_ waiting, there will be a small footnote at the bottom of the block letting you know there are indeed no waiting items.
Also, as part of regular admin links (such as a link to the admin.php), currently the code will look to see if you have installed Gallery, phpMyAdmin, and Sentinal. If yes to any of these, you will see an administrative link to that particular addon. If not, the item is not displayed.
At the top of the block code, I have centrally listed the location variables that you may need to change that link to these dynamic admin links. All underlying code depends on those variables being correct.
You first want to open mainfile.php, and find:
Code:function adminblock() {
|
Here is a looksee at the entire original code in the 7.6 mainfile.php that you will be replacing in its entirety:
Code:function adminblock() {
global $admin, $prefix, $db, $admin_file;
if (is_admin($admin)) {
$result = $db->sql_query("SELECT title, content FROM ".$prefix."_blocks WHERE bkey='admin'");
while ($row = $db->sql_fetchrow($result)) {
$content = "<font class=\"content\">$row[content]</font>";
themesidebox($row[title], $row[content]);
}
$title = ""._WAITINGCONT."";
$num = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_queue"));
$content = "<font class=\"content\">";
$content .= "<strong><big>·</big></strong> <a href=\"".$admin_file.".php?op=submissions\">"._SUBMISSIONS."</a>: $num<br>";
$num = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_reviews_add"));
$content .= "<strong><big>·</big></strong> <a href=\"".$admin_file.".php?op=reviews\">"._WREVIEWS."</a>: $num<br>";
$num = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_links_newlink"));
$brokenl = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_links_modrequest WHERE brokenlink='1'"));
$modreql = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_links_modrequest WHERE brokenlink='0'"));
$content .= "<strong><big>·</big></strong> <a href=\"".$admin_file.".php?op=Links\">"._WLINKS."</a>: $num<br>";
$content .= "<strong><big>·</big></strong> <a href=\"".$admin_file.".php?op=LinksListModRequests\">"._MODREQLINKS."</a>: $modreql<br>";
$content .= "<strong><big>·</big></strong> <a href=\"".$admin_file.".php?op=LinksListBrokenLinks\">"._BROKENLINKS."</a>: $brokenl<br>";
$num = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_downloads_newdownload"));
$brokend = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_downloads_modrequest WHERE brokendownload='1'"));
$modreqd = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_downloads_modrequest WHERE brokendownload='0'"));
$content .= "<strong><big>·</big></strong> <a href=\"".$admin_file.".php?op=downloads\">"._UDOWNLOADS."</a>: $num<br>";
$content .= "<strong><big>·</big></strong> <a href=\"".$admin_file.".php?op=DownloadsListModRequests\">"._MODREQDOWN."</a>: $modreqd<br>";
$content .= "<strong><big>·</big></strong> <a href=\"".$admin_file.".php?op=DownloadsListBrokenDownloads\">"._BROKENDOWN."</a>: $brokend<br></font>";
themesidebox($title, $content);
}
}
|
Now, replace it with this slightly more complex bit of code:
Code:function adminblock() {
// sweet admin block by ChaosConundrum of santeriasys.net
global $admin, $prefix, $db, $admin_file;
if (is_admin($admin)) {
$result = $db->sql_query("SELECT title FROM ".$prefix."_blocks WHERE bkey='admin'");
while ($row = $db->sql_fetchrow($result)) {$title = $row[title];}
$nukadmin = "admin.php"; // Location of PHP-Nuke Admin file
$phpmysql = "phpmyadmin/index.php"; // Location of phpMyAdmin
$sentinel = "admin/modules/sentinel.php"; // Location of Sentinal
$sentaddr = "$nukadmin?op=ABMain"; // Link to Sentinal Admin
$gallerya = "modules/gallery/setup/index.php"; // Link to Gallery Admin
$content = "<font class=\"content\">";
$num = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_queue"));
if ($num > 0) {
$content .= "<strong><big>·</big></strong> <a href=\"".$admin_file.".php?op=submissions\">"._SUBMISSIONS."</a>: $num<br>";
$showcount = $showcount+1;
}
$num = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_reviews_add"));
if ($num > 0) {
$content .= "<strong><big>·</big></strong> <a href=\"".$admin_file.".php?op=reviews\">"._WREVIEWS."</a>: $num<br>";
$showcount = $showcount+1;
}
$num = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_links_newlink"));
$brokenl = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_links_modrequest WHERE brokenlink='1'"));
$modreql = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_links_modrequest WHERE brokenlink='0'"));
if ($num > 0) {
$content .= "<strong><big>·</big></strong> <a href=\"".$admin_file.".php?op=Links\">"._WLINKS."</a>: $num<br>";
$showcount = $showcount+1;
}
if ($modreql > 0) {
$content .= "<strong><big>·</big></strong> <a href=\"".$admin_file.".php?op=LinksListModRequests\">"._MODREQLINKS."</a>: $modreql<br>";
$showcount = $showcount+1;
}
if ($brokenl > 0) {
$content .= "<strong><big>·</big></strong> <a href=\"".$admin_file.".php?op=LinksListBrokenLinks\">"._BROKENLINKS."</a>: $brokenl<br>";
$showcount = $showcount+1;
}
$num = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_downloads_newdownload"));
$brokend = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_downloads_modrequest WHERE brokendownload='1'"));
$modreqd = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_downloads_modrequest WHERE brokendownload='0'"));
if ($num > 0) {
$content .= "<strong><big>·</big></strong> <a href=\"".$admin_file.".php?op=downloads\">"._UDOWNLOADS."</a>: $num<br>";
$showcount = $showcount+1;
}
if ($modreqd > 0) {
$content .= "<strong><big>·</big></strong> <a href=\"".$admin_file.".php?op=DownloadsListModRequests\">"._MODREQDOWN."</a>: $modreqd<br>";
$showcount = $showcount+1;
}
if ($brokend > 0) {
$content .= "<strong><big>·</big></strong> <a href=\"".$admin_file.".php?op=DownloadsListBrokenDownloads\">"._BROKENDOWN."</a>: $brokend<br>";
$showcount = $showcount+1;
}
$content .= "<br>\n";
$content .= "<strong><big>·</big></strong> <a href=\"$nukadmin\">Admin Menu</a><br>\n";
if (file_exists("$phpmysql")) {
$content .= "<strong><big>·</big></strong> <a href=\"$phpmysql\" target=\"_blank\">MySQL Admin</a><br>\n";
}
if (file_exists("$sentinel")) {
$content .= "<strong><big>·</big></strong> <a href=\"$sentaddr\">Sentinel Admin</a><br>\n";
}
if (file_exists("$gallerya")) {
$content .= "<strong><big>·</big></strong> <a href=\"$gallerya\" target=\"_blank\">Gallery Admin</a><br>\n";
}
$content .= "
<strong><big>·</big></strong> <a href=\"$nukadmin?op=adminStory\">New Story</a><br>
<strong><big>·</big></strong> <a href=\"$nukadmin?op=logout\">Logout</a><br>
";
if ($showcount == 0) {
$content .= "<br><strong><big>·</big></strong> <i>No pending tasks</i>";
}
$content .= "</font>";
themesidebox($title, $content);
}
}
|
The box title and location will still be controllable from the Modules administration. The content via the Modules administration will no longer populate this box.
It serves me well, and keeps the appearance of my site nice and tight. I hope you enjoy it as well.
Please do keep the creator comment at the top of the code. It wont kill you to give me credit in its use and distribution. Also, please let me know if you add anything to the code, or have any ideas that you would like me to add! Following the basic structure I have provided, its pretty easy too add along just about anything else you want to dynamically display!
[CC] |
|
|
gsicard
Regular


Joined: May 21, 2003
Posts: 50
Location: Suffolk, VA USA
|
Posted:
Sun Jan 23, 2005 9:04 am |
|
Hi there,
could not find this block in downloads. Is it available or should I just use the code and make a block? |
_________________ Gary Sicard
www.molosserdogs.com
[img]http://www.molosserdogs.com/modules.php?name=Forums&file=signature.png[/img] |
|