Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
chaosconundrum
New Member
New Member



Joined: Nov 15, 2004
Posts: 6
Location: MA, USA

PostPosted: Mon Dec 13, 2004 5:53 am Reply with quote

Please be easy on me - this is my first public posting of my code! Wink

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>&middot;</big></strong>&nbsp;<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>&middot;</big></strong>&nbsp;<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>&middot;</big></strong>&nbsp;<a href=\"".$admin_file.".php?op=Links\">"._WLINKS."</a>: $num<br>";
   $content .= "<strong><big>&middot;</big></strong>&nbsp;<a href=\"".$admin_file.".php?op=LinksListModRequests\">"._MODREQLINKS."</a>: $modreql<br>";
   $content .= "<strong><big>&middot;</big></strong>&nbsp;<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>&middot;</big></strong>&nbsp;<a href=\"".$admin_file.".php?op=downloads\">"._UDOWNLOADS."</a>: $num<br>";
   $content .= "<strong><big>&middot;</big></strong>&nbsp;<a href=\"".$admin_file.".php?op=DownloadsListModRequests\">"._MODREQDOWN."</a>: $modreqd<br>";
   $content .= "<strong><big>&middot;</big></strong>&nbsp;<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>&middot;</big></strong>&nbsp;<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>&middot;</big></strong>&nbsp;<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>&middot;</big></strong>&nbsp;<a href=\"".$admin_file.".php?op=Links\">"._WLINKS."</a>: $num<br>";
   $showcount = $showcount+1;
}
if ($modreql > 0) {
   $content .= "<strong><big>&middot;</big></strong>&nbsp;<a href=\"".$admin_file.".php?op=LinksListModRequests\">"._MODREQLINKS."</a>: $modreql<br>";
   $showcount = $showcount+1;
}
if ($brokenl > 0) {
   $content .= "<strong><big>&middot;</big></strong>&nbsp;<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>&middot;</big></strong>&nbsp;<a href=\"".$admin_file.".php?op=downloads\">"._UDOWNLOADS."</a>: $num<br>";
   $showcount = $showcount+1;
}
if ($modreqd > 0) {
   $content .= "<strong><big>&middot;</big></strong>&nbsp;<a href=\"".$admin_file.".php?op=DownloadsListModRequests\">"._MODREQDOWN."</a>: $modreqd<br>";
   $showcount = $showcount+1;
}
if ($brokend > 0) {
   $content .= "<strong><big>&middot;</big></strong>&nbsp;<a href=\"".$admin_file.".php?op=DownloadsListBrokenDownloads\">"._BROKENDOWN."</a>: $brokend<br>";
   $showcount = $showcount+1;
}
   $content .= "<br>\n";
   $content .=   "<strong><big>&middot;</big></strong>&nbsp;<a href=\"$nukadmin\">Admin Menu</a><br>\n";
if (file_exists("$phpmysql")) {
   $content .=   "<strong><big>&middot;</big></strong>&nbsp;<a href=\"$phpmysql\" target=\"_blank\">MySQL Admin</a><br>\n";
}
if (file_exists("$sentinel")) {
   $content .=   "<strong><big>&middot;</big></strong>&nbsp;<a href=\"$sentaddr\">Sentinel Admin</a><br>\n";
}
if (file_exists("$gallerya")) {
   $content .=   "<strong><big>&middot;</big></strong>&nbsp;<a href=\"$gallerya\" target=\"_blank\">Gallery Admin</a><br>\n";
}
   $content .=   "
         <strong><big>&middot;</big></strong>&nbsp;<a href=\"$nukadmin?op=adminStory\">New Story</a><br>
         <strong><big>&middot;</big></strong>&nbsp;<a href=\"$nukadmin?op=logout\">Logout</a><br>
         ";
if ($showcount == 0) {
   $content .= "<br><strong><big>&middot;</big></strong>&nbsp;<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]
 
View user's profile Send private message Visit poster's website
chaosconundrum







PostPosted: Sat Jan 15, 2005 2:05 am Reply with quote

This concept has been turned into a block. It will be posted in the downloads section shortly.
 
gsicard
Regular
Regular



Joined: May 21, 2003
Posts: 50
Location: Suffolk, VA USA

PostPosted: Sun Jan 23, 2005 9:04 am Reply with quote

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 [ Only registered users can see links on this board! Get registered or login! ]
[img]http://www.molosserdogs.com/modules.php?name=Forums&file=signature.png[/img] 
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
chaosconundrum







PostPosted: Sun Feb 06, 2005 12:48 am Reply with quote

It has been made into a block, along with some added improvements to it. I will be adding it to the downloads section within a day or two.

Sorry for the delay. I got sidetracked onother projects.

Feel free to contact me directly if you'd like. I found some flaws in my original posting, because the code was written initially for a windows-based install.

I have since cleaned up the code to be universally compatible. I didnt realize that *nix was so partial to proper case usage.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©