Clan Adverts

Admin last 10 articles

Description: This hack will modfiy your admin.php to show the last 10 articles and list the rest by title.
Version: 1.0
Added on: 30 April 2007
Author: Floppy
Difficulty Level: Very Easy
Views: 1069
Rating: 5.5 (2 Votes)
Detailed ProfileView Comments (1)

Preview
CLICK HERE FOR IMAGE

Open admin.php

Find

Code:
OpenTable();
    echo "<center><b>"._LAST." 5 "._ARTICLES."</b></center><br>";
    $result6 = $db->sql_query("SELECT sid, aid, title, time, topic, informant, alanguage FROM ".$prefix."_stories $queryalang ORDER BY time DESC LIMIT 0,5");
    echo "<center><table border=\"1\" width=\"100%\" bgcolor=\"$bgcolor1\">";
    while (list($sid, $aid, $title, $time, $topic, $informant, $alanguage) = $db->sql_fetchrow($result6)) {
      $sid = intval($sid);
      $said = substr($aid, 0,25);
      list($topicname) = $db->sql_fetchrow($db->sql_query("SELECT topicname FROM ".$prefix."_topics WHERE topicid='$topic'"));
      if (empty($alanguage)) {
          $alanguage = ""._ALL."";
      }
      formatTimestamp($time);
      echo "<tr><td align=\"right\"><b>$sid</b>"
          ."</td><td align=\"left\" width=\"100%\"><a href=\"modules.php?name=News&file=article&sid=$sid\">$title</a>"
          ."</td><td align=\"center\">$alanguage"
          ."</td><td align=\"right\">$topicname";
      if ($radminarticle == 1 OR $radminsuper == 1) {
          if (($radminarticle==1) AND ($aid == $said) OR ($radminsuper==1)) {
            echo "</td><td align=\"right\" nowrap>(<a href=\"".$admin_file.".php?op=EditStory&sid=$sid\">"._EDIT."</a>-<a href=\"".$admin_file.".php?op=RemoveStory&sid=$sid\">"._DELETE."</a>)"
                ."</td></tr>";
          } else {
            echo "</td><td align=\"right\" nowrap><font class=\"content\"><i>("._NOFUNCTIONS.")</i></font>"
                ."</td></tr>";
          }
      } else {
          echo "</td></tr>";
      }
    }
    echo "</table>";
    if (($radminarticle==1) OR ($radminsuper==1)) {
   echo "<center>"
       ."<form action=\"".$admin_file.".php\" method=\"post\">"
       .""._STORYID.": <input type=\"text\" NAME=\"sid\" SIZE=\"10\">"
       ."<select name=\"op\">"
       ."<option value=\"EditStory\" SELECTED>"._EDIT."</option>"
       ."<option value=\"RemoveStory\">"._DELETE."</option>"
       ."</select>"
       ."<input type=\"submit\" value=\""._GO."\">"
       ."</form></center>";
      }
    CloseTable();
    }
   
    include("footer.php");
}


Replace with

Code:
OpenTable();
    echo "<center><b>"._LAST." 10 "._ARTICLES."</b></center><br>";
    $result6 = $db->sql_query("SELECT sid, aid, title, time, topic, informant, alanguage FROM ".$prefix."_stories $queryalang ORDER BY time DESC LIMIT 0,10");
    echo "<center><table border=\"1\" width=\"100%\" bgcolor=\"$bgcolor1\">";
    while (list($sid, $aid, $title, $time, $topic, $informant, $alanguage) = $db->sql_fetchrow($result6)) {
      $sid = intval($sid);
      $said = substr($aid, 0,25);
      list($topicname) = $db->sql_fetchrow($db->sql_query("SELECT topicname FROM ".$prefix."_topics WHERE topicid='$topic'"));
      if (empty($alanguage)) {
          $alanguage = ""._ALL."";
      }
      formatTimestamp($time);
      echo "<tr><td align=\"right\"><b>$sid</b>"
          ."</td><td align=\"left\"><a href=\"modules.php?name=News&file=article&sid=$sid\">$title</a>"
          ."</td><td align=\"center\">$alanguage"
          ."</td><td align=\"center\">$topicname";
      if ($radminarticle == 1 OR $radminsuper == 1) {
          if (($radminarticle==1) AND ($aid == $said) OR ($radminsuper==1)) {
            echo "</td><td align=\"center\" nowrap>(<a href=\"".$admin_file.".php?op=EditStory&sid=$sid\">"._EDIT."</a>-<a href=\"".$admin_file.".php?op=RemoveStory&sid=$sid\">"._DELETE."</a>)"
                ."</td></tr>";
          } else {
            echo "</td><td align=\"center\" nowrap><font class=\"content\"><i>("._NOFUNCTIONS.")</i></font>"
                ."</td></tr>";
          }
      } else {
          echo "</td></tr>";
      }
    }
    echo "</table>";
    if (($radminarticle==1) OR ($radminsuper==1)) {
   echo "<center>"
       ."<form action=\"".$admin_file.".php\" method=\"post\">";
       $countnews = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_stories"));
       $result6 = $db->sql_query("SELECT sid, aid, title, time, topic, informant, alanguage FROM ".$prefix."_stories $queryalang ORDER BY time DESC LIMIT 11, $countnews");
       echo "Story Title: <select name=\"sid\">";
      while (list($sid, $aid, $title, $time, $topic, $informant, $alanguage) = $db->sql_fetchrow($result6)) {
         echo "<option value=\"$sid\">$title</option>";
      }
       echo "</select>  ";
       echo "<select name=\"op\">"
       ."<option value=\"EditStory\" SELECTED>"._EDIT."</option>"
       ."<option value=\"RemoveStory\">"._DELETE."</option>"
       ."</select>  "
       ."<input type=\"submit\" value=\""._GO."\">"
       ."</form></center>";
      }
    CloseTable();
    }