Author |
Message |
neralex
Site Admin
![](modules/Forums/images/avatars/201442295664a46e4575d46.jpg)
Joined: Aug 22, 2007
Posts: 1775
|
Posted:
Sat Jun 05, 2010 4:21 pm |
|
hey!
I have written the last articles from admin.php in a new function and have provided this with side figures. I have found an old script with a pulldown menu and side figures. Unfortunately, I do not get the menu to run. Do you maybe have an idea? And how can I format this the time stamp?
create allnews.php and move into the includes folder:
Code:<?php
/********************************************************************
/* Administration All News Function
/********************************************************************
/* Core Author Credits:
/* If you have any questions, comments, or if you find any bugs
/* please feel free to contact me:
/* Author: Ilir Fekaj
/* Contact: tebrino@hotmail.com
/* Created: July 01. 2003.
/* Modified: July 02. 2003.
/* Version: 1.0.1
/* If you like it, use it, you can also give me a credit.
/********************************************************************/
/* Re-Modified: Juny 05, 2010 by neralex for RavenNuke(tm)
/********************************************************************/
addCSSToHead('themes/allnews.css','file');
function allnews() {
global $language, $admin, $aid, $prefix, $user_prefix, $file, $db, $sitename, $admin_file, $bgcolor1;
include_once('header.php');
//Executing SQL For Today and Yesterday
$userCount = 0;
$userCount2 = 0;
$todayDST = date('I',time())*3600; // 2.2.0
$yesterdayDST = date('I',time()-86400)*3600; // 2.2.0
$Today = date('M d, Y',time()-$todayDST); // 2.2.0
$Yesterday = date('M d, Y',time()-86400-$yesterdayDST); // 2.2.0
$sql = 'SELECT user_regdate, COUNT(user_regdate) FROM '.$user_prefix.'_users where user_regdate IN(\''.$Today.'\', \''.$Yesterday.'\') GROUP BY user_regdate LIMIT 0,2';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
if ($row[0]==$Today) $userCount = $row[1];
elseif ($row[0]==$Yesterday) $userCount2 = $row[1];
}
// GraphicAdmin();
$aid = substr("$aid", 0,25);
$row = $db->sql_fetchrow($db->sql_query('SELECT radminsuper, admlanguage FROM '.$prefix.'_authors WHERE aid=\''.$aid.'\''));
$radminsuper = intval($row['radminsuper']);
$admlanguage = addslashes($row['admlanguage']);
$result = $db->sql_query('SELECT admins FROM '.$prefix.'_modules WHERE title=\'News\'');
$result2 = $db->sql_query('SELECT name FROM '.$prefix.'_authors WHERE aid=\''.$aid.'\'');
list($aidname) = $db->sql_fetchrow($result2);
$radminarticle = 0;
while (list($admins) = $db->sql_fetchrow($result)) {
$admins = explode(',', $admins);
$auth_user = 0;
for ($i=0; $i < sizeof($admins); $i++) {
if ($aidname == $admins[$i]) {
$auth_user = 1;
}
}
if ($auth_user == 1) {
$radminarticle = 1;
}
}
if (!empty($admlanguage)) {
$queryalang = 'WHERE alanguage=\''.$admlanguage.'\'';
} else {
$queryalang = '';
}
list($main_module) = $db->sql_fetchrow($db->sql_query('SELECT main_module from '.$prefix.'_main'));
OpenTable();
if (($radminarticle==1) OR ($radminsuper==1)) {
echo '<center>'
.'<form action="'.$admin_file.'.php" method="post">'
.'<table><tr><td>'
._STORYID.': <input type="text" name="sid" size="10" /></td>'
.'<td><select name="op">'
.'<option value="EditStory" selected="selected">'._EDIT.'</option>'
.'<option value="RemoveStory">'._DELETE.'</option>'
.'</select></td>'
.'<td><input type="submit" value="'._GO.'" /></td></tr></table>'
.'</form></center>';
}
CloseTable();
OpenTable();
// config-------------------------------------
$filename = "admin.php?op=allnews"; // name of this file
$option = array (5, 10, 25, 50, 100, 200);
$default = 25; // default number of records per page
$action = $_SERVER['PHP_SELF']; // if this doesn't work, enter the filename
$query = "SELECT sid, aid, title, time, topic, informant, alanguage, topicname FROM ".$prefix."_stories left join " .$prefix."_topics ON topicid=topic ". $queryalang." ORDER BY time DESC";
$sid = "$row->sid";
$counter = intval($row['s.counter']);
// end config---------------------------------
$opt_cnt = count ($option);
$go = $_GET['go'];
// paranoid
if ($go == "") {
$go = $default;
}
elseif (!in_array ($go, $option)) {
$go = $default;
}
elseif (!is_numeric ($go)) {
$go = $default;
}
$nol = $go;
$limit = "0, $nol";
$count = 1;
echo "<form name=\"form1\" id=\"form1\" method=\"get\" action=\"$action\">";
echo "<select name=\"go\" id=\"go\">";
for ($i = 0; $i <= $opt_cnt; $i ++) {
if ($option[$i] == $go) {
echo "<option value=\"".$option[$i]."\" selected=\"selected\">".$option[$i]."</option>";
} else {
echo "<option value=\"".$option[$i]."\">".$option[$i]." </option>";
}
}
echo "</select>";
echo "<input type=\"submit\" name=\"Submit\" id=\"Submit\" value=\"Go\" />";
echo "</form>";
// control query------------------------------
/* this query checks how many records you have in your table.
I created this query so we could be able to check if user is
trying to append number larger than the number of records
to the query string.*/
$off_sql = mysql_query ("$query") or die ("Error in query: $off_sql".mysql_error());
$off_pag = ceil (mysql_num_rows($off_sql) / $nol);
//--------------------------------------------
$off = $_GET['offset'];
//paranoid
if (get_magic_quotes_gpc() == 0) {
$off = addslashes ($off);
}
if (!is_numeric ($off)) {
$off = 1;
}
// this checks if user is trying to put something stupid in query string
if ($off > $off_pag) {
$off = 1;
}
if ($off == "1") {
$limit = "0, $nol";
}
elseif ($off <> "") {
for ($i = 0; $i <= ($off - 1) * $nol; $i ++) {
$limit = "$i, $nol";
$count = $i + 1;
}
}
echo "<div class='div02'>";
echo "<ul class='iprUL'>
<li class='iprLI'><a href=\"$filename&offset=$next&go=25\">25</a></li>
<li class='iprLI'><a href=\"$filename&offset=$next&go=50\">50</a></li>
<li class='iprLI'><a href=\"$filename&offset=$next&go=100\">100</a></li>
<li class='iprLI'><a href=\"$filename&offset=$next&go=200\">200</a></li>
</ul><br style='clear:both;' /><br />";
echo "</div>";
// Query to extract records from database.
$sql = mysql_query ("$query LIMIT $limit") or die ("Error in query: $sql".mysql_error());
while ($row = mysql_fetch_object($sql)) {
// EDIT ME. Edit the line below to match your own table. Just replace $row->url with $row->your_table_column
//echo "$count. ";
echo "<div class='div01'>\r";
echo "
<ul class='iprUL02'>
<li class='iprLI02'>
<ul class='iprUL03'>
<li class='iprid'>$row->sid</li>
<li class='iprtitle'><a href='modules.php?name=News&file=article&sid=$row->sid'>$row->title</a></li>
<li class='iprtopicname'>$row->topicname</li>
<li class='iprinformant'>$row->informant</li>
<li class='iprtime'>$row->time</li>";
if ($radminarticle == 1 OR $radminsuper == 1) {
if (($radminarticle==1) AND ($aid == $said) OR ($radminsuper==1)) {
echo "<li class='ipreditdel'><a href='".$admin_file.".php?op=EditStory&sid=$row->sid'>"._EDIT."</a></li>";
echo "<li class='ipreditdelspace'>-</li>";
echo "<li class='ipreditdel'><a href='".$admin_file.".php?op=RemoveStory&sid=$row->sid'>"._DELETE."</a></li>";
} else {
echo "<li class='iprnofunction'><i>NO FUNCTIONS HERE</i></li>";
}}
echo "</ul></li></ul><br style='clear:both;' />";
echo "</div>";
$count += 1;
}
echo "<br />";
echo "<div class='div01'>";
if ($off <> 1) {
$prev = $off - 1;
echo "[ < <a href=\"$filename&offset=$prev&go=$go\">prev</a> ]";
}
for ($i = 1; $i <= $off_pag; $i ++) {
if ($i == $off) {
echo "[<b> $i </b>] ";
} else {
echo "[ <a href=\"$filename&offset=$i&go=$go\">$i</a> ]";
}
}
if ($off < $off_pag) {
$next = $off + 1;
echo "[ <a href=\"$filename&offset=$next&go=$go\">next</a> > ]";
}
echo "<br /><br />";
echo "Page $off of $off_pag<br />";
echo "</div>";
CloseTable();
OpenTable();
$guest_online_num = intval($db->sql_numrows($db->sql_query('SELECT uname FROM '.$prefix.'_session WHERE guest=1')));
$member_online_num = intval($db->sql_numrows($db->sql_query('SELECT uname FROM '.$prefix.'_session WHERE guest=0')));
$who_online_num = $guest_online_num + $member_online_num;
$who_online = '<center><font class="option">'._WHOSONLINE.'</font><br /><br /><font class="content">'._CURRENTLY." $guest_online_num "._GUESTS." $member_online_num "._MEMBERS.'<br />';
echo $who_online.'<br />'
._BTD.': <b>'.$userCount.'</b> - '._BYD.': <b>'.$userCount2.'</b></font></center>';
CloseTable();
include_once('footer.php');
}
?>
|
create allnews.css and move into the themes folder:
Code:.div01 {margin:0 auto; width:840px;}
.div02 {margin:0 auto; width:160px;}
.iprUL {margin:0; padding:0; list-style:none;}
.iprLI {float:left; text-align:center; border:1px solid #666666; width:30px; display:inline; padding:2px; margin:2px; background-color:none;}
.iprLI a {display:block;}
.iprUL li:hover {background:#033;}
.iprUL02 {margin:0 auto; padding:0; list-style:none;}
.iprLI02 {margin:0; padding:0; float:left;}
.iprLI02:hover {float:left; background-color:#033; height:12px; width:100%;}
.iprUL03 {margin:0; padding:0; list-style:none;}
.ipreditdel {float:left; width:40px;}
.ipreditdelspace {float:left; width:10px; text-align:center;}
.iprnofunction {float:left; width:100px; text-align:center;}
.iprid {float:left; width:30px; text-align:left;}
.iprtitle {float:left; width:360px; text-align:left;}
.iprtopicname {float:left; width:120px; text-align:right;}
.iprinformant {float:left; width:100px; text-align:center;}
.iprtime {float:left; width:130px; text-align:left;}
.iprUL04 {margin:0; padding:0; list-style:none;}
|
edit admin.php:
search for:
add before:
Code:include("includes/allnews.php");
|
search for:
Code:case 'adminMain':
adminMain();
break;
|
after add:
Code:case 'allnews':
allnews();
break;
|
greetz! |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
neralex
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sat Jun 05, 2010 4:42 pm |
|
I have added a adminmenu into the admin-links of the news-module.
open modules/News/admin/links.php and add:
Code:adminmenu($admin_file.'.php?op=allnews', _LASTNEWS, 'stories.gif');
|
add _ALLNEWS to your lang-file in admin/language/:
Code:define('_ALLNEWS','All News');
|
![Cool](modules/Forums/images/smiles/icon_cool.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Raven
Site Admin/Owner
![](modules/Forums/images/avatars/45030c033f18773153cd2.gif)
Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Tue Jun 08, 2010 9:52 am |
|
Someone from our Team will check this out and let you know - Thanks! |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
Site Admin
![](modules/Forums/images/avatars/Dilbert/Dilbert_-_Dogbert_King.gif)
Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania
|
Posted:
Tue Jun 08, 2010 6:16 pm |
|
I took a look at it the other day, but it was taking to much time. I currently do not have the time to make this fully functional. Maybe one of the other staff members can take a look. |
_________________ "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jestrella
Moderator
![](modules/Forums/images/avatars/bea6a62d4db43637aa29d.jpg)
Joined: Dec 01, 2005
Posts: 593
Location: Santiago, Dominican Republic
|
Posted:
Tue Jun 08, 2010 7:14 pm |
|
Ok, let me dig into this... Will try to follow the steps given and then post again |
_________________ "For those whom have not reach the sky... Every mountain seems high"
Best Regards
Jonathan Estrella
http://about.me/jestrella04 |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jestrella
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Jun 10, 2010 8:44 am |
|
After doing all the steps you pointed I'm getting a bunch of undeclared indexes and/or variables. The thing is that you don't get the dropdown menu to work And how to format timestamp.
Well, first I need to get rid of all that undeclared indexes/variables and then try the dropdown thing, you can check official php's date function manual online at http://php.net/date
Will post back in a while... |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jestrella
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Jun 10, 2010 9:11 am |
|
I have not deeply review the code, but this is what I got right now, give it a try and if any problem post back...
Code:<?php
/********************************************************************
/* Administration All News Function
/********************************************************************
/* Core Author Credits:
/* If you have any questions, comments, or if you find any bugs
/* please feel free to contact me:
/* Author: Ilir Fekaj
/* Contact: tebrino@hotmail.com
/* Created: July 01. 2003.
/* Modified: July 02. 2003.
/* Version: 1.0.1
/* If you like it, use it, you can also give me a credit.
/********************************************************************/
/* Re-Modified: Juny 05, 2010 by neralex for RavenNuke(tm)
/********************************************************************/
addCSSToHead('themes/allnews.css','file');
function allnews() {
global $language, $admin, $aid, $prefix, $user_prefix, $file, $db, $sitename, $admin_file, $bgcolor1;
include_once('header.php');
//Executing SQL For Today and Yesterday
$userCount = 0;
$userCount2 = 0;
$todayDST = date('I',time())*3600; // 2.2.0
$yesterdayDST = date('I',time()-86400)*3600; // 2.2.0
$Today = date('M d, Y',time()-$todayDST); // 2.2.0
$Yesterday = date('M d, Y',time()-86400-$yesterdayDST); // 2.2.0
$sql = 'SELECT user_regdate, COUNT(user_regdate) FROM '.$user_prefix.'_users where user_regdate IN(\''.$Today.'\', \''.$Yesterday.'\') GROUP BY user_regdate LIMIT 0,2';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
if ($row[0]==$Today) $userCount = $row[1];
elseif ($row[0]==$Yesterday) $userCount2 = $row[1];
}
// GraphicAdmin();
$aid = substr("$aid", 0,25);
$row = $db->sql_fetchrow($db->sql_query('SELECT radminsuper, admlanguage FROM '.$prefix.'_authors WHERE aid=\''.$aid.'\''));
$radminsuper = intval($row['radminsuper']);
$admlanguage = addslashes($row['admlanguage']);
$result = $db->sql_query('SELECT admins FROM '.$prefix.'_modules WHERE title=\'News\'');
$result2 = $db->sql_query('SELECT name FROM '.$prefix.'_authors WHERE aid=\''.$aid.'\'');
list($aidname) = $db->sql_fetchrow($result2);
$radminarticle = 0;
while (list($admins) = $db->sql_fetchrow($result)) {
$admins = explode(',', $admins);
$auth_user = 0;
for ($i=0; $i < sizeof($admins); $i++) {
if ($aidname == $admins[$i]) {
$auth_user = 1;
}
}
if ($auth_user == 1) {
$radminarticle = 1;
}
}
if (!empty($admlanguage)) {
$queryalang = 'WHERE alanguage=\''.$admlanguage.'\'';
} else {
$queryalang = '';
}
list($main_module) = $db->sql_fetchrow($db->sql_query('SELECT main_module from '.$prefix.'_main'));
OpenTable();
if (($radminarticle==1) OR ($radminsuper==1)) {
echo '<center>'
.'<form action="'.$admin_file.'.php" method="post">'
.'<table><tr><td>'
._STORYID.': <input type="text" name="sid" size="10" /></td>'
.'<td><select name="op">'
.'<option value="EditStory" selected="selected">'._EDIT.'</option>'
.'<option value="RemoveStory">'._DELETE.'</option>'
.'</select></td>'
.'<td><input type="submit" value="'._GO.'" /></td></tr></table>'
.'</form></center>';
}
CloseTable();
OpenTable();
// config-------------------------------------
$filename = "admin.php?op=allnews"; // name of this file
$option = array (5, 10, 25, 50, 100, 200);
$default = 25; // default number of records per page
$action = $_SERVER['PHP_SELF']; // if this doesn't work, enter the filename
$query = "SELECT sid, aid, title, time, topic, informant, alanguage, topicname FROM ".$prefix."_stories left join " .$prefix."_topics ON topicid=topic ". $queryalang." ORDER BY time DESC";
//$sid = $row['sid'];
//$counter = intval($row['s.counter']);
// end config---------------------------------
$opt_cnt = count ($option);
$go = (isset($_GET['go'])) ? $_GET['go'] : '';
// paranoid
if ($go == "") {
$go = $default;
}
elseif (!in_array ($go, $option)) {
$go = $default;
}
elseif (!is_numeric ($go)) {
$go = $default;
}
$nol = $go;
$limit = "0, $nol";
$count = 1;
echo "<form name=\"form1\" id=\"form1\" method=\"get\" action=\"$admin_file.php\">";
echo "<select name=\"go\" id=\"go\">";
for ($i = 0; $i <= $opt_cnt; $i ++) {
if ($option[$i] == $go) {
echo "<option value=\"".$option[$i]."\" selected=\"selected\">".$option[$i]."</option>";
} else {
echo "<option value=\"".$option[$i]."\">".$option[$i]." </option>";
}
}
echo "</select>";
echo "<input type=\"submit\" value=\"Go\" />";
echo "<input type=\"hidden\" name=\"op\" value=\"allnews\" />";
echo "</form>";
// control query------------------------------
/* this query checks how many records you have in your table.
I created this query so we could be able to check if user is
trying to append number larger than the number of records
to the query string.*/
$off_sql = $db->sql_query($query) or die ("Error in query: $off_sql".mysql_error());
$off_pag = ceil ($db->sql_numrows($off_sql) / $nol);
//--------------------------------------------
$off = (isset($_GET['offset'])) ? $_GET['offset'] : 1;
//paranoid
if (get_magic_quotes_gpc() == 0) {
$off = addslashes ($off);
}
if (!is_numeric ($off)) {
$off = 1;
}
// this checks if user is trying to put something stupid in query string
if ($off > $off_pag) {
$off = 1;
}
if ($off == "1") {
$limit = "0, $nol";
}
elseif ($off <> "") {
for ($i = 0; $i <= ($off - 1) * $nol; $i ++) {
$limit = "$i, $nol";
$count = $i + 1;
}
}
if(!isset($next)) $next='';
echo "<div class='div02'>";
echo "<ul class='iprUL'>
<li class='iprLI'><a href=\"$filename&offset=$next&go=25\">25</a></li>
<li class='iprLI'><a href=\"$filename&offset=$next&go=50\">50</a></li>
<li class='iprLI'><a href=\"$filename&offset=$next&go=100\">100</a></li>
<li class='iprLI'><a href=\"$filename&offset=$next&go=200\">200</a></li>
</ul><br style='clear:both;' /><br />";
echo "</div>";
// Query to extract records from database.
$sql = mysql_query ("$query LIMIT $limit") or die ("Error in query: $sql".mysql_error());
while ($row = mysql_fetch_object($sql)) {
// EDIT ME. Edit the line below to match your own table. Just replace $row->url with $row->your_table_column
//echo "$count. ";
echo "<div class='div01'>\r";
echo "
<ul class='iprUL02'>
<li class='iprLI02'>
<ul class='iprUL03'>
<li class='iprid'>$row->sid</li>
<li class='iprtitle'><a href='modules.php?name=News&file=article&sid=$row->sid'>$row->title</a></li>
<li class='iprtopicname'>$row->topicname</li>
<li class='iprinformant'>$row->informant</li>
<li class='iprtime'>$row->time</li>";
if ($radminarticle == 1 OR $radminsuper == 1) {
if (($radminarticle==1) AND ($aid == $said) OR ($radminsuper==1)) {
echo "<li class='ipreditdel'><a href='".$admin_file.".php?op=EditStory&sid=$row->sid'>"._EDIT."</a></li>";
echo "<li class='ipreditdelspace'>-</li>";
echo "<li class='ipreditdel'><a href='".$admin_file.".php?op=RemoveStory&sid=$row->sid'>"._DELETE."</a></li>";
} else {
echo "<li class='iprnofunction'><i>NO FUNCTIONS HERE</i></li>";
}}
echo "</ul></li></ul><br style='clear:both;' />";
echo "</div>";
$count += 1;
}
echo "<br />";
echo "<div class='div01'>";
if ($off <> 1) {
$prev = $off - 1;
echo "[ < <a href=\"$filename&offset=$prev&go=$go\">prev</a> ]";
}
for ($i = 1; $i <= $off_pag; $i ++) {
if ($i == $off) {
echo "[<b> $i </b>] ";
} else {
echo "[ <a href=\"$filename&offset=$i&go=$go\">$i</a> ]";
}
}
if ($off < $off_pag) {
$next = $off + 1;
echo "[ <a href=\"$filename&offset=$next&go=$go\">next</a> > ]";
}
echo "<br /><br />";
echo "Page $off of $off_pag<br />";
echo "</div>";
CloseTable();
OpenTable();
$guest_online_num = intval($db->sql_numrows($db->sql_query('SELECT uname FROM '.$prefix.'_session WHERE guest=1')));
$member_online_num = intval($db->sql_numrows($db->sql_query('SELECT uname FROM '.$prefix.'_session WHERE guest=0')));
$who_online_num = $guest_online_num + $member_online_num;
$who_online = '<center><font class="option">'._WHOSONLINE.'</font><br /><br /><font class="content">'._CURRENTLY." $guest_online_num "._GUESTS." $member_online_num "._MEMBERS.'<br />';
echo $who_online.'<br />'
._BTD.': <b>'.$userCount.'</b> - '._BYD.': <b>'.$userCount2.'</b></font></center>';
CloseTable();
include_once('footer.php');
}
?>
|
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jestrella
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Jun 10, 2010 9:21 am |
|
The above is for /includes/allnews.php
BTW there's an issue with teh edit function of these forums, the nuke footer seems to be replacing the phpbb2 footer causing some havoc ![Razz](modules/Forums/images/smiles/icon_razz.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
spasticdonkey
RavenNuke(tm) Development Team
![](modules/Forums/images/avatars/48fb116845dfecf66294c.gif)
Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA
|
Posted:
Thu Jun 10, 2010 9:37 am |
|
jestrella wrote: | The above is for /includes/allnews.php
BTW there's an issue with teh edit function of these forums, the nuke footer seems to be replacing the phpbb2 footer causing some havoc |
I have had that happen as well.... I think it happens when you try to edit a post that includes a code example containing <?php |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Jun 10, 2010 10:23 am |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jestrella
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jun 15, 2010 5:51 pm |
|
neralex, Everything's fine? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
neralex
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jun 15, 2010 8:15 pm |
|
hi jestrella!
ithe pulldown works fine - many thx for your help!!! here a cleaned update of the allnews.php. i will try re-edit the date format in the next time...
Code:<?php
/********************************************************************
* Administration All News Function for RavenNuke(tm)
*********************************************************************
* Core Author Credits:
* If you have any questions, comments, or if you find any bugs
* please feel free to contact me:
* Author: Ilir Fekaj
* Contact: tebrino@hotmail.com
* Created: July 01. 2003.
* Modified: July 02. 2003.
* If you like it, use it, you can also give me a credit.
**********************************************************************
* Additional Credits
**********************************************************************
* Re-Modified: Juny 15, 2010 by neralex
* Submit Fix : June 10, 2010 by jestrella
* Version: 1.0.2
*********************************************************************/
addCSSToHead('themes/allnews.css','file');
function allnews() {
global $language, $admin, $aid, $prefix, $user_prefix, $file, $db, $sitename, $admin_file, $bgcolor1;
include_once('header.php');
//Executing SQL For Today and Yesterday
$userCount = 0;
$userCount2 = 0;
$todayDST = date('I',time())*3600; // 2.2.0
$yesterdayDST = date('I',time()-86400)*3600; // 2.2.0
$Today = date('M d, Y',time()-$todayDST); // 2.2.0
$Yesterday = date('M d, Y',time()-86400-$yesterdayDST); // 2.2.0
$sql = 'SELECT user_regdate, COUNT(user_regdate) FROM '.$user_prefix.'_users where user_regdate IN(\''.$Today.'\', \''.$Yesterday.'\') GROUP BY user_regdate LIMIT 0,2';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
if ($row[0]==$Today) $userCount = $row[1];
elseif ($row[0]==$Yesterday) $userCount2 = $row[1];
}
// GraphicAdmin();
$aid = substr("$aid", 0,25);
$row = $db->sql_fetchrow($db->sql_query('SELECT radminsuper, admlanguage FROM '.$prefix.'_authors WHERE aid=\''.$aid.'\''));
$radminsuper = intval($row['radminsuper']);
$admlanguage = addslashes($row['admlanguage']);
$result = $db->sql_query('SELECT admins FROM '.$prefix.'_modules WHERE title=\'News\'');
$result2 = $db->sql_query('SELECT name FROM '.$prefix.'_authors WHERE aid=\''.$aid.'\'');
list($aidname) = $db->sql_fetchrow($result2);
$radminarticle = 0;
while (list($admins) = $db->sql_fetchrow($result)) {
$admins = explode(',', $admins);
$auth_user = 0;
for ($i=0; $i < sizeof($admins); $i++) {
if ($aidname == $admins[$i]) {
$auth_user = 1;
}
}
if ($auth_user == 1) {
$radminarticle = 1;
}
}
if (!empty($admlanguage)) {
$queryalang = 'WHERE alanguage=\''.$admlanguage.'\'';
} else {
$queryalang = '';
}
OpenTable();
if (($radminarticle==1) OR ($radminsuper==1)) {
echo '<center>[ <a href="admin.php?op=adminStory"><b>New Story</b></a> ] [ <a href="admin.php"><b>Administration</b></a> ]</center><br />';
echo '<center>'
.'<form action="'.$admin_file.'.php" method="post">'
.'<table><tr><td>'
._STORYID.': <input type="text" name="sid" size="10" /></td>'
.'<td><select name="op">'
.'<option value="EditStory" selected="selected">'._EDIT.'</option>'
.'<option value="RemoveStory">'._DELETE.'</option>'
.'</select></td>'
.'<td><input type="submit" value="'._GO.'" /></td></tr></table>'
.'</form></center>';
}
CloseTable();
OpenTable();
// config-------------------------------------
$filename = "admin.php?op=allnews"; // name of this file
$option = array (5, 10, 25, 50, 100, 200);
$default = 25; // default number of records per page
$action = $_SERVER['PHP_SELF']; // if this doesn't work, enter the filename
$query = "SELECT sid, aid, title, time, topic, informant, alanguage, topicname FROM ".$prefix."_stories left join " .$prefix."_topics ON topicid=topic ". $queryalang." ORDER BY time DESC";
$sid = "$row->sid";
$counter = intval($row['s.counter']);
// end config---------------------------------
$opt_cnt = count ($option);
$go = $_GET['go'];
// paranoid
if ($go == "") {
$go = $default;
}
elseif (!in_array ($go, $option)) {
$go = $default;
}
elseif (!is_numeric ($go)) {
$go = $default;
}
$nol = $go;
$limit = "0, $nol";
$count = 1;
// jestrella issue June 10,2010
echo "<form name=\"form1\" id=\"form1\" method=\"get\" action=\"$admin_file.php\">";
echo "<select name=\"go\" id=\"go\">";
for ($i = 0; $i <= $opt_cnt; $i ++) {
if ($option[$i] == $go) {
echo "<option value=\"".$option[$i]."\" selected=\"selected\">".$option[$i]."</option>";
} else {
echo "<option value=\"".$option[$i]."\">".$option[$i]." </option>";
}
}
echo "</select>";
echo "<input type=\"submit\" value=\"Go\" />";
echo "<input type=\"hidden\" name=\"op\" value=\"allnews\" />";
echo "</form>";
// control query------------------------------
/* this query checks how many records you have in your table.
I created this query so we could be able to check if user is
trying to append number larger than the number of records
to the query string.*/
$off_sql = mysql_query ("$query") or die ("Error in query: $off_sql".mysql_error());
$off_pag = ceil (mysql_num_rows($off_sql) / $nol);
//--------------------------------------------
$off = $_GET['offset'];
//paranoid
if (get_magic_quotes_gpc() == 0) {
$off = addslashes ($off);
}
if (!is_numeric ($off)) {
$off = 1;
}
// this checks if user is trying to put something stupid in query string
if ($off > $off_pag) {
$off = 1;
}
if ($off == "1") {
$limit = "0, $nol";
}
elseif ($off <> "") {
for ($i = 0; $i <= ($off - 1) * $nol; $i ++) {
$limit = "$i, $nol";
$count = $i + 1;
}
}
echo "<div class='div02'>";
echo "<ul class='iprUL'>
<li class='iprLI'><a href=\"$flename&offset=$next&go=25\">25</a></li>
<li class='iprLI'><a href=\"$filename&offset=$next&go=50\">50</a></li>
<li class='iprLI'><a href=\"$filename&offset=$next&go=100\">100</a></li>
<li class='iprLI'><a href=\"$filename&offset=$next&go=200\">200</a></li>
</ul><br style='clear:both;' /><br />";
echo "</div>";
// Query to extract records from database.
$sql = mysql_query ("$query LIMIT $limit") or die ("Error in query: $sql".mysql_error());
while ($row = mysql_fetch_object($sql)) {
// EDIT ME. Edit the line below to match your own table. Just replace $row->url with $row->your_table_column
//echo "$count. ";
echo "<div class='div01'>";
echo "
<ul class='iprUL02'>
<li class='iprLI02'>
<ul class='iprUL03'>
<li class='iprid'>$row->sid</li>
<li class='iprtitle'><a href='modules.php?name=News&file=article&sid=$row->sid'>$row->title</a></li>
<li class='iprtopicname'>$row->topicname</li>
<li class='iprinformant'>$row->informant</li>
<li class='iprtime'>$row->time</li>";
if ($radminarticle == 1 OR $radminsuper == 1) {
if (($radminarticle==1) AND ($aid == $said) OR ($radminsuper==1)) {
echo "<li class='ipreditdel'><a href='".$admin_file.".php?op=EditStory&sid=$row->sid'>"._EDIT."</a></li>";
echo "<li class='ipreditdelspace'>-</li>";
echo "<li class='ipreditdel'><a href='".$admin_file.".php?op=RemoveStory&sid=$row->sid'>"._DELETE."</a></li>";
} else {
echo "<li class='iprnofunction'><i>NO FUNCTIONS HERE</i></li>";
}}
echo "</ul></li></ul><br style='clear:both;' />";
echo "</div>";
$count += 1;
}
echo "<br />";
echo "<div class='div01'>";
if ($off <> 1) {
$prev = $off - 1;
echo "[ < <a href=\"$filename&offset=$prev&go=$go\">prev</a> ]";
}
for ($i = 1; $i <= $off_pag; $i ++) {
if ($i == $off) {
echo "[<b> $i </b>] ";
} else {
echo "[ <a href=\"$filename&offset=$i&go=$go\">$i</a> ]";
}
}
if ($off < $off_pag) {
$next = $off + 1;
echo "[ <a href=\"$filename&offset=$next&go=$go\">next</a> > ]";
}
echo "<br /><br />";
echo "Page $off of $off_pag<br />";
echo "</div>";
CloseTable();
OpenTable();
$guest_online_num = intval($db->sql_numrows($db->sql_query('SELECT uname FROM '.$prefix.'_session WHERE guest=1')));
$member_online_num = intval($db->sql_numrows($db->sql_query('SELECT uname FROM '.$prefix.'_session WHERE guest=0')));
$who_online_num = $guest_online_num + $member_online_num;
$who_online = '<center><font class="option">'._WHOSONLINE.'</font><br /><br /><font class="content">'._CURRENTLY." $guest_online_num "._GUESTS." $member_online_num "._MEMBERS.'<br />';
echo $who_online.'<br />'
._BTD.': <b>'.$userCount.'</b> - '._BYD.': <b>'.$userCount2.'</b></font></center>';
CloseTable();
include_once('footer.php');
}
?>
|
and here a update for the allnews.css
Code:.div01 {margin:0 auto; width:840px;}
.div02 {margin:0 auto; width:160px;}
.iprUL {margin:0; padding:0; list-style:none;}
.iprLI {float:left; text-align:center; border:1px solid #666666; width:30px; display:inline; padding:2px; margin:2px; background-color:none;}
.iprLI a {display:block;}
.iprUL li:hover {background:#033;}
.iprUL02 {margin:0 auto; padding:0; list-style:none;}
.iprLI02 {margin:0; padding:0; float:left;}
.iprLI02:hover {float:left; background-color:#033; width:100%;}
.iprUL03 {margin:0; padding:0; list-style:none;}
.ipreditdel {float:left; width:40px;}
.ipreditdelspace {float:left; width:10px; text-align:center;}
.iprnofunction {float:left; width:100px; text-align:center;}
.iprid {float:left; width:30px; text-align:left;}
.iprtitle {float:left; width:400px; text-align:left;}
.iprtopicname {float:left; width:120px; text-align:right;}
.iprinformant {float:left; width:60px; text-align:center;}
.iprtime {float:left; width:130px; text-align:left;}
.iprUL04 {margin:0; padding:0; list-style:none;}
|
![RavensScripts](modules/Forums/images/smiles/ravensphpscripts.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jestrella
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jun 15, 2010 10:27 pm |
|
Great, don't hesitate to ask for help if you ever need it again... |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|