>>  Site Map >>  Forums >>  Blocks 7x

Forum module - topics in forum:



Blocks 7x - Discussions regarding PHP-Nuke Blocks. 7x



Custom Admin Block and additions

I have downloded a mod, which works fine, but I wish to add other things.

I have already modded it to suit my needs in it's current form..

Code: :
<?php

/********************************************************/
/* Admin Login Block                                    */
/* By: NukeScripts Network (webmaster@nukescripts.net)  */
/* http://www.nukescripts.net                           */
/* Copyright © 2000-2005 by NukeScripts Network         */
/********************************************************/

if (stristr($_SERVER['PHP_SELF'], "block-Admin_Login.php") || stristr($_SERVER['SCRIPT_NAME'], "block-Admin_Login.php")) { Header("Location: index.php"); }
$content = "";
global $admin, $prefix, $db, $gfx_chk, $admin_file;;
if(is_admin($admin)) {
    $content .= "<b><a href=\"admin.php?op=adminMain\">"._AL_ADMINMENU."</a>:</b>\n";
    $content .= "<table border=0 cellpadding=0 cellspacing=0>\n";
    $content .= "<tr><form method=\"post\" action=\"admin.php\">\n";
    $content .= "<td><select name=\"op\" width=40>\n";
    $content .= "<OPTION VALUE=\"adminStory\">"._AL_ADDSTORY."</OPTION>\n";
    $content .= "<OPTION VALUE=\"BlocksAdmin\">"._AL_BLOCKS."</OPTION>\n";
    $content .= "<OPTION VALUE=\"content\">"._AL_CONTENT."</OPTION>\n";
    $content .= "<OPTION VALUE=\"downloads\">"._AL_DOWNLOADS."</OPTION>\n";
    $content .= "<OPTION VALUE=\"forums\">"._AL_FORUM."</OPTION>\n";
    $content .= "<OPTION VALUE=\"modules\">"._AL_MODULES."</OPTION>\n";
    $content .= "<OPTION VALUE=\"optimize\">"._AL_OPTIMIZEDB."</OPTION>\n";
    $content .= "<OPTION VALUE=\"Links\">"._AL_WEBLINKS."</OPTION>\n";
    $content .= "<OPTION VALUE=\"logout\">"._AL_LOGOUT."</OPTION>\n";
    $content .= "</SELECT><input type='submit' value='"._AL_GO."'></td>\n";
    $content .= "</form></tr>\n";
    $content .= "</table>\n";
   $content .= "<hr><br>\n";

>>>>>> ADD TO HERE <<<<<<

} else {
    mt_srand ((double)microtime()*1000000);
    $maxran = 1000000;
    $random_num = mt_rand(0, $maxran);
    $content .= "<b><font color=red>Caution:</font> Non Admins will be banned!</b><p>\n";
    $content .= "<table border=0 cellpadding=0 cellspacing=0>\n";
    $content .= "<tr><form action=\"admin.php\" method=\"post\">\n";
    $content .= "<td>"._AL_ADMIN.": <input type=\"text\" name=\"aid\" size=\"10\" maxlength=\"25\"><br>\n";
    $content .= ""._AL_PASS.": <input type=\"password\" name=\"pwd\" size=\"10\" maxlength=\"20\"><br>\n";
    if (extension_loaded("gd") AND ($gfx_chk == 1 OR $gfx_chk == 5 OR $gfx_chk == 6 OR $gfx_chk == 7)) {
   $content .= ""._AL_CODE.": <img src='index.php?gfx=gfx&random_num=$random_num' border='1' height='20' width='77' alt='"._AL_CODE."' title='"._AL_CODE."'><br>";
   $content .= ""._AL_TYPECODE.": <input type=\"text\" NAME=\"gfx_check\" SIZE=\"7\" MAXLENGTH=\"6\"><br>";
        $content .= "<input type=\"hidden\" NAME=\"random_num\" value=\"$random_num\">";
    }
    $content .= "<input type=\"hidden\" name=\"op\" value=\"login\">\n";
    $content .= "<input type=\"submit\" value=\""._AL_LOGIN."\">\n\n";
    $content .= "</td>\n";
    $content .= "</form></tr>\n";
    $content .= "</table>\n";
}

?>


I wish to add the 'waiting content' stuff fromt he original admin panel, which I found in the mainfile.php file

Code: :
function adminblock() {
   global $admin, $prefix, $db, $admin_file;
   if (is_admin($admin)) {
           $sql = "SELECT title, content FROM ".$prefix."_blocks WHERE bkey='admin'";
      $result = $db->sql_query($sql);
      while (list($title, $content) = $db->sql_fetchrow($result)) {
         $content = filter($content);
         $title = filter($title, "nohtml");
         $content = "<span class=\"content\">".$content."</span>";
         themesidebox($title, $content);
      }
      $title = _WAITINGCONT;
      $num = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_queue"));
      $content = "<span 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></span>";
      themesidebox($title, $content);
   }
}


Now, if I add it as is, obviously it go's completely wrong (right hand blocks disappear)

I wish to have the info located under the HR bar, in the same block.

All my attempts have failed Sad

Help would be appriciated.






The normal admin block is html based anyway and not a file.... use the link that is in there and you should be ok






ok, I see what you're saying, but yaknow the bit that is like:

Submission: 0
Broken Downloads: 0

I would like that bit, that's the only bit I'm after..

So it would need the connection to the DB bit, but I can't seem to get it going myself, I've tried, it didn't like the way I did it.. heh






Waiting Submissions:

Code: :
$content .= "<strong><big>&middot;</big></strong>&nbsp;<a href=\"".$admin_file.".php?op=submissions\">"._SUBMISSIONS."</a>: $num<br>";


Broken Downloads:

Code: :
$content .= "<strong><big>&middot;</big></strong>&nbsp;<a href=\"".$admin_file.".php?op=DownloadsListBrokenDownloads\">"._BROKENDOWN."</a>: $brokend<br></span>";







Ahh.. right..

Thought it would still need the DB connection stuff also..

I'll give it a go.. thanx






Quote: :

just changing the $brokend bit?..


no - leave it exactly as it is.






Kewl, worked fine.. thanx




Attention! You are currently viewing sitemap page!
We strongly suggest to look at original content

Search from web

Valid HTML 4.01 Valid CSS