Author |
Message |
gator81
Worker
![Worker Worker](modules/Forums/images/ranks/3stars.gif)
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Jun 09, 2007
Posts: 172
|
Posted:
Sat Jan 10, 2009 2:32 pm |
|
I am sorry if this is not the right place to put this, please move to proper area please if it is not.
I have been looking for a "quote" module/block. The closest i have found so far is "GeekQuote" but i have not been able to get it to work.
I have seen some simple ones, but I liked this for the purpose of using the sql database.
Would someone be able to direct me to something that has already been done? or would it be a great project for someone? "hint, hint"
thank you for any help |
|
|
|
![](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:
Sat Jan 10, 2009 8:25 pm |
|
here's a simple random quotes block that uses no sql (easy to edit)
Only registered users can see links on this board! Get registered or login! |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
gator81
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sun Jan 11, 2009 8:34 pm |
|
that is a easy one to work with, but I guess I am looking for the sql version and admin setup. It seems to be faster and easier to have alot of input for the quotes.
The problem is that I have only found one that works with sql and I cannot get it to work ![Sad](modules/Forums/images/smiles/icon_sad.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jakec
Site Admin
![](modules/Forums/images/avatars/502a2d1345d88a86ddb4a.png)
Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom
|
Posted:
Mon Jan 12, 2009 2:22 am |
|
Is this for RN 2.3?
It could be that Geekquote is using the old SQL layer. Have a look at the code and see if $dbi is used anywhere. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
gator81
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Jan 12, 2009 1:39 pm |
|
I went though all the code that I could, and in modules\quotes\admin\index.php was this
Code:<?php
if (!defined('ADMIN_FILE')) {
die ("Access Denied");
}
define('NO_EDITOR', 1);
global $prefix, $db, $admin_file;
$querystr = "SELECT radminsuper, admlanguage FROM " .$prefix."_authors where aid='$aid'";
$result = sql_query($querystr, $dbi) or die ("invalied query");
list($radminsuper) = sql_fetch_row($result, $dbi);
$createsql = "CREATE TABLE IF NOT EXISTS ".$prefix."_quotes (
qid int(10) unsigned NOT NULL auto_increment,
quote text,
author varchar(150) NOT NULL default '',
PRIMARY KEY (qid)
) ENGINE=MyISAM";
$sql_query($createsql, $dbi);
if ($radminsuper==1)
{
/*********************************************************/
/* Quote Functions */
/*********************************************************/
function AddQuote () {
global $admin_file;
OpenTable();
echo "<center><font class=\"option\"><b>"._QUOTEADD."</b></font><br><br><br>"
."<form action=\"".$admin_file.".php\" method=\"post\">"
."<b>"._QUOTE.":</b><br>"
."<textarea wrap=\"virtual\" cols=\"100\" name=\"quote\" rows=\"10\"></textarea><br>"
."<b>"._AUTHOR.":</b> "
."<input type=\"text\" name=\"author\" size=\"50\" maxlength=\"255\"><br>"
."<input type=\"hidden\" name=\"op\" value=\"SaveQuote\">"
."<input type=\"submit\" value=\""._SAVE."\">"
."</form></center>";
CloseTable();
}
function EditQuote($qid) {
global $prefix, $db, $admin_file;
$qid = intval($qid);
$result = $db->sql_query("select quote, author from ".$prefix."_quotes where qid='$qid'");
list($quote, $author) = $db->sql_fetchrow($result);
include ("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>"._QUOTESADMIN."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<center><font class=\"option\"><b>"._EDITQUOTE."</b></font><br><br><br>"
."<form action=\"".$admin_file.".php\" method=\"post\">"
."<b>"._QUOTE.":</b><br>"
."<textarea wrap=\"virtual\" cols=\"100\" name=\"quote\" rows=\"10\">$quote</textarea><br>"
."<b>"._AUTHOR.":</b> "
."<input type=\"text\" name=\"author\" size=\"50\" maxlength=\"255\" value=\"$author\"><br>"
."<input type=\"hidden\" name=\"op\" value=\"SaveEditQuote\">"
."<input type=\"hidden\" name=\"qid\" value=\"$qid\">"
."<input type=\"submit\" value=\""._SAVE."\">"
."</form></center>";
CloseTable();
include("footer.php");
}
function DeleteQuote($qid) {
global $prefix, $db, $admin_file;
$qid = intval($qid);
$result = $db->sql_query("select quote, author from ".$prefix."_quotes where qid='$qid'");
list($quote, $author) = $db->sql_fetchrow($result);
include ("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>"._QUOTESADMIN."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<center><font class=\"option\"><b>"._DELETEQUOTE."</b></font><br>";
if (!$qid)
{
Header("Location: $admin_file.php?op=QuotesList");
}
else
{
echo "<br><br><b>"._WARNING.":</b> "._CONFIRMDELETE."<br><br>"
."<p align=\"left\"><b>$quote</b><br><i>-- $author</i></p><br><br>"
."<b>[ <a href=\"".$admin_file.".php?op=YesDelQuote&qid=$qid\">"._YESDELQUOTE."</a> | "
."<a href=\"".$admin_file.".php?op=QuotesList\">"._NODELQUOTE."</a> ]</b>";
}
echo "</center>";
CloseTable();
include("footer.php");
}
function YesDelQuote($qid) {
global $prefix, $db, $admin_file;
$qid = intval($qid);
$quotesql = "delete from ".$prefix."_quotes where qid='$qid'";
$result = $db->sql_query($quotesql);
if ($result)
{
Header("Location: ".$admin_file.".php?op=QuotesList");
}
else
{
include ("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>"._QUOTESADMIN."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<center><font class=\"content\"><b>Error: Not deleted.</b></font><br><br>";
echo "$quotesql";
echo "</center>";
CloseTable();
include("footer.php");
}
}
function SaveQuote($quote, $author) {
global $prefix, $db, $admin_file;
$quote = ereg_replace("'", "\'", $quote);
$author = ereg_replace("'", "\'", $author);
$quotesql = "insert into ".$prefix."_quotes (quote, author) values ('$quote', '$author')";
$result = $db->sql_query($quotesql);
if ($result) {
Header("Location: " . $admin_file . ".php?op=QuotesList");
}
else
{
include ("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>"._QUOTESADMIN."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<center><font class=\"content\"><b>Error: Not added.</b></font><br><br>";
echo "$quotesql";
echo "</center>";
CloseTable();
include("footer.php");
}
}
function SaveEditQuote($qid, $quote, $author) {
global $prefix, $db, $admin_file;
$quote = ereg_replace("'", "\'", $quote);
$author = ereg_replace("'", "\'", $author);
$qid = intval($qid);
$result = $db->sql_query("REPLACE into ".$prefix."_quotes (qid, quote, author) values ($qid, '$quote', '$author')");
if ($result) {
Header("Location: " . $admin_file . ".php?op=QuotesList");
}
else
{
include ("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>"._QUOTESADMIN."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<center><font class=\"content\"><b>Error: Not updated.</b></font><br><br>";
echo "</center>";
CloseTable();
include("footer.php");
}
}
function QuotesList() {
global $prefix, $db, $radminsuper, $bgcolor1, $bgcolor2, $admin_file;
$dummy = 0;
include ("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>"._QUOTESADMIN."</b></font></center>";
CloseTable();
echo "<br>";
AddQuote();
echo "<br>";
OpenTable();
$result = $db->sql_query("SELECT qid, quote, author FROM ".$prefix."_quotes order by qid ASC");
if($db->sql_numrows($result) == 0)
{
echo "<table width=\"100%\"><tr><td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._NOQUOTES."</b></td></tr></table>\n";
}
else
{
echo "<center><font class=\"content\"><b>"._QUOTELIST."</b></font>";
echo "<form action=\"".$admin_file.".php\" method=\"post\">";
echo "<table width=\"100%\" border=\"1\">";
echo "<tr><td bgcolor=\"$bgcolor2\"><b> "._QUOTEID." </b></td>";
echo "<td bgcolor=\"$bgcolor2\"><b><center> "._QUOTE." </center></b></td>";
echo "<td bgcolor=\"$bgcolor2\"><b><center> "._AUTHOR." </center></b></td>";
echo "<td bgcolor=\"$bgcolor2\"><b><center> "._FUNCTIONS." </center></b></td></tr>\n";
while (list($qid, $quote, $author) = $db->sql_fetchrow($result))
{
$qid = intval($qid);
echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><font class=\"content\">\n";
echo "$qid";
echo "</td><td bgcolor=\"$bgcolor1\" align=\"left\">";
echo "<a href=\"".$admin_file.".php?op=EditQuote&qid=$qid\">$quote</a>";
echo "</td><td bgcolor=\"$bgcolor1\" align=\"center\">";
if ($author == "") {
echo _NOAUTHOR;
} else {
echo "$author";
}
echo "</td><td bgcolor=\"$bgcolor1\" align=\"center\"><font class=\"content\"> <a href=\"".$admin_file.".php?op=EditQuote&qid=$qid\"><img src=\"images/edit.gif\" alt=\""._EDIT."\" title=\""._EDIT."\" border=\"0\" width=\"17\" height=\"17\"></a> <a href=\"".$admin_file.".php?op=DeleteQuote&qid=$qid\"><img src=\"images/delete.gif\" alt=\""._DELETE."\" title=\""._DELETE."\" border=\"0\" width=\"17\" height=\"17\"></a> </td></tr>\n";
$dummy++;
}
if ($dummy < 1) {
echo "<tr><td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._NOQUOTES."</b></form></td></tr></table>\n";
} else {
echo "</table></form>\n";
}
}
/* if ($radminsuper == 1) {
echo "<br><center>"
."[ <a href=\"".$admin_file.".php?op=subdelete\">"._DELETE."</a> ]"
."</center><br>";
}
*/
CloseTable();
include ("footer.php");
}
switch($op) {
case "EditQuote":
EditQuote($qid);
break;
case "DeleteQuote":
DeleteQuote($qid);
break;
case "YesDelQuote":
YesDelQuote($qid);
break;
case "AddQuote":
AddQuote();
break;
case "SaveQuote":
SaveQuote($quote, $author);
break;
case "SaveEditQuote":
SaveEditQuote($qid, $quote, $author);
break;
case "QuotesList":
QuotesList();
break;
}
} else {
include("header.php");
GraphicAdmin();
OpenTable();
echo "<center><b>"._ERROR."</b><br><br>You do not have administration permission for module \"$module_name\"</center>";
CloseTable();
include("footer.php");
}
?>
|
as you see up towards the top is the reference you asked about. But this is the only file that has that info, it has not been found in the rest of the code.
for more info:
I have it installed, and the block now shows a random quote, But in the admin area under blocks, when i click on the new block box i get an error, it actually comes up as another page.
Now I can go under modules and click on quote and it shows all the quotes on one page, but there is no editing anything.
here is a link to where I downloaded this, I have even sent the author an email and have not had a response for some time now.
thank you for any help
Only registered users can see links on this board! Get registered or login! |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jakec
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Jan 12, 2009 3:37 pm |
|
There is a sticky in these forums about how to fix the $dbi issue, this could be causing the problem with GeekQuotes. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
gator81
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Jan 12, 2009 5:56 pm |
|
I found the sticky you were talking about
Only registered users can see links on this board! Get registered or login!
and for testing purposes so far, I went in the admin.php file in the modules folder and removed the three references to $dbi, and went and reloaded the site and there was no difference
this
Code:if (!defined('ADMIN_FILE')) {
die ("Access Denied");
}
define('NO_EDITOR', 1);
global $prefix, $db, $admin_file;
$querystr = "SELECT radminsuper, admlanguage FROM " .$prefix."_authors where aid='$aid'";
$result = sql_query($querystr, $dbi) or die ("invalied query");
list($radminsuper) = sql_fetch_row($result, $dbi);
$createsql = "CREATE TABLE IF NOT EXISTS ".$prefix."_quotes (
qid int(10) unsigned NOT NULL auto_increment,
quote text,
author varchar(150) NOT NULL default '',
PRIMARY KEY (qid)
) ENGINE=MyISAM";
$sql_query($createsql, $dbi);
if ($radminsuper==1)
|
to this
Code:if (!defined('ADMIN_FILE')) {
die ("Access Denied");
}
define('NO_EDITOR', 1);
global $prefix, $db, $admin_file;
$querystr = "SELECT radminsuper, admlanguage FROM " .$prefix."_authors where aid='$aid'";
$result = sql_query($querystr) or die ("invalied query");
list($radminsuper) = sql_fetch_row($result);
$createsql = "CREATE TABLE IF NOT EXISTS ".$prefix."_quotes (
qid int(10) unsigned NOT NULL auto_increment,
quote text,
author varchar(150) NOT NULL default '',
PRIMARY KEY (qid)
) ENGINE=MyISAM";
$sql_query($createsql);
if ($radminsuper==1)if (!defined('ADMIN_FILE')) {
die ("Access Denied");
}
|
Now I guess the thing that is getting me is trying to make the compare with this type of line...it is there two times so i dont know if there is an issue.
this is from the original
Code:$sql_query($createsql, $dbi);
|
now in the faq it shows the old looks like this
Code:sql_query($sql, $dbi)
|
and the new line like this
Code:$db->sql_query($sql)
|
now the original uses the string $createsql....so should that whole line be replaced? or am i making it harder then what it should be? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
FireATST
RavenNuke(tm) Development Team
![](modules/Forums/images/avatars/1890b00a421a4615ecd23.jpg)
Joined: Jun 12, 2004
Posts: 654
Location: Ohio
|
Posted:
Mon Jan 12, 2009 8:24 pm |
|
See if this works for ya.....
if (!defined('ADMIN_FILE')) {
die ("Access Denied");
}
define('NO_EDITOR', 1);
global $prefix, $db, $admin_file;
$querystr = "SELECT radminsuper, admlanguage FROM " .$prefix."_authors where aid='$aid'";
$result =$db->sql_query($querystr) or die ("invalied query");
list($radminsuper) = sql_fetchrow($result);
$createsql = "CREATE TABLE IF NOT EXISTS ".$prefix."_quotes (
qid int(10) unsigned NOT NULL auto_increment,
quote text,
author varchar(150) NOT NULL default '',
PRIMARY KEY (qid)
) ENGINE=MyISAM";
$sql_query($createsql);
if ($radminsuper==1)if (!defined('ADMIN_FILE')) {
die ("Access Denied");
} |
|
|
![ICQ Number ICQ Number](themes/RavenIce/forums/images/lang_english/icon_icq_add.gif) |
![](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:
Mon Jan 12, 2009 8:33 pm |
|
$db->sql_query($createsql); |
_________________ "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) |
gator81
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Jan 12, 2009 9:12 pm |
|
this is the way it looks now
Code:if (!defined('ADMIN_FILE')) {
die ("Access Denied");
}
define('NO_EDITOR', 1);
global $prefix, $db, $admin_file;
$querystr = "SELECT radminsuper, admlanguage FROM " .$prefix."_authors where aid='$aid'";
$result = $db->sql_query($querystr) or die ("invalied query");
list($radminsuper) = sql_fetch_row($result);
$createsql = "CREATE TABLE IF NOT EXISTS ".$prefix."_quotes (
qid int(10) unsigned NOT NULL auto_increment,
quote text,
author varchar(150) NOT NULL default '',
PRIMARY KEY (qid)
) ENGINE=MyISAM";
$sql_query($createsql);
if ($radminsuper==1)if(1defined('ADMIN_FILE')0{
die("Access Denied");
{
|
again, it is working, but the admin features are not. I keep getting the 500 error. So far all of the changes that have been done, have shown no difference, I may need to reload the entire site to make sure.
while you are looking at this, if you dont want to dl and look at all of it, here is the block file code
Code:<?php
if (eregi("block-Quotes.php", $_SERVER['PHP_SELF']))
{
Header("Location: index.php");
die();
}
global $prefix, $db, $content;
$content = "";
mt_srand((double)microtime()*1000000);
$quotesql = "SELECT COUNT(qid) FROM ".$prefix."_quotes";
$result = $db->sql_query($quotesql);
if ($result)
{
list($count) = $db->sql_fetchrow($result);
}
else
{
$count = 0;
}
if ($count < 1)
{
$content .= "There aren't enough quotes in the database right now.";
}
else
{
$index = 1;
if ($count > 1)
{
$index = mt_rand(0, ($count - 1));
}
$quotesql = "SELECT quote, author FROM ".$prefix."_quotes ORDER BY qid LIMIT " . sprintf("%d", ($index - 1)) . ", 1";
$result = $db->sql_query($quotesql);
if ($result)
{
list($quote, $author) = $db->sql_fetchrow($result);
$content .= "<b>" . $quote . "</b>";
if ($author != "")
{
$content .= "<br><br>";
$content .= "-- " . $author;
}
}
else
{
$content .= "A database error has occurred.";
}
}
?>
|
and here is the links.php code, i am guessing this is where the admin box will go when clicked on
Code:<?php
if (!defined('ADMIN_FILE')) {
die ("Access Denied");
}
global $admin_file;
if ($radminsuper==1) {
adminmenu("".$admin_file.".php?op=QuotesList", "Quotes", "quotes.gif");
}
?>
|
I thank you all for the help with this. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
FireATST
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Jan 12, 2009 9:13 pm |
|
opps....thanks Palbin.....I did miss that one....lol |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Raven
Site Admin/Owner
![](modules/Forums/images/avatars/45030c033f18773153cd2.gif)
Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Mon Jan 12, 2009 11:00 pm |
|
A 500 error is an error in your .htaccess file. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Jan 12, 2009 11:04 pm |
|
gator81, you still didn't change what I said in my post above.
Either post a link to a download for this(preferable) or post the rest of admin file
I'm not sure if the problem I posted about above would cause it, but there is something really wrong if you are getting a 500 error. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
gator81
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jan 13, 2009 1:15 am |
|
I had posted the full .php file earlier in this thread, I had just shown the area that was in question to and had the &dbi info......so please go up this thread and you should see that one..
To help clarify this again....this is what I did so you know the steps I have done.
1. I copied the files over to ravennuke. I loaded the admin and added it to work in the modules. I checked and it was working but nothing was shown. I then loaded phpmyadmin and made sure the sql tables were there and then added an extra sql data that had alot of quotes already.
2. I then went back to home page and loaded the quotes that are now shown under modules and clicked them and another page loaded that had all the quotes that were just added.
3. at this time i went back to admin and added the block, for the lower right side. When i load the home page there is as box on the lower right side showing random quotes.
4. I go back to admin and there is a new block that says Qoutes. I am figureing that this is where I can administrator everything, so when i click on that i get the "http 500" error.
5. So far no matter what the changes that have been made, it still continues to give the error when i goto admin and click on quotes.
so thinking that it is also something to do with the block.php or to links.php I wanted to go ahead and add those in previous posts just to make sure.
Mabye there is something that is wrong there, that is causing the admin page not to load. I have been trying to compare code and check for any syntax errors, but have had no luck.
I know that you are trying to help me with info that I try to give, I am still being confused, i did put a link to where you could dl and maby it will do the same thing to you and with your expertize could troubleshoot it faster then anything.
this has been a learning experience, and again ty for all the help |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jakec
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jan 13, 2009 1:15 am |
|
Palbin, there is a link to the download 5th post down. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Raven
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jan 13, 2009 1:35 am |
|
Please be sure to recognize that the 500 error is a syntax or directive error in your .htaccess or Apache configuration file, regardless of the php code issues. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jan 13, 2009 6:39 am |
|
gator81, do you have an .htaccess file that is in the same directory as your admin file? If you do, delete it. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
gator81
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jan 13, 2009 9:33 am |
|
Palbin: if your are talking about modules/quotes/admin then there is no .htaccess file. If you are talking about ravennuke's admin folder then there is a .htaccess file, and I did back it up and delete the one that was there.
No change
I even reloaded the server and reloaded the sql server and no difference. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jan 13, 2009 10:22 am |
|
I don't have a great of understanding of htaccess other than just the basics of allow and deny or how sentinel uses it to protect the admin folder.
Maybe someone else can help ![Sad](modules/Forums/images/smiles/icon_sad.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
gator81
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jan 13, 2009 10:33 am |
|
I guess I am curious to know if someone else can get it to work for them? This would let me know if it is something more then me ![Smile](modules/Forums/images/smiles/icon_smile.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jan 13, 2009 10:56 am |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
gator81
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jan 13, 2009 1:38 pm |
|
I look forward to your results ![Smile](modules/Forums/images/smiles/icon_smile.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jakec
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jan 13, 2009 2:16 pm |
|
I started looking at this last night, but didn't get chance to finish it. It is working on my local install of RN 2.3
If I've missed anything Palbin please let me know.
The code below should replace all of the code in \modules\Quotes\admin\index.php
Code:<?php
if (!defined('ADMIN_FILE')) {
die ("Access Denied");
}
define('NO_EDITOR', 1);
global $prefix, $db, $admin_file;
$querystr = "SELECT radminsuper, admlanguage FROM " .$prefix."_authors where aid='$aid'";
$result = $db->sql_query($querystr) or die ("invalied query");
list($radminsuper) = $db->sql_fetchrow($result);
$createsql = "CREATE TABLE IF NOT EXISTS ".$prefix."_quotes (
qid int(10) unsigned NOT NULL auto_increment,
quote text,
author varchar(150) NOT NULL default '',
PRIMARY KEY (qid)
) ENGINE=MyISAM";
$db->sql_query($createsql);
if ($radminsuper==1)
{
/*********************************************************/
/* Quote Functions */
/*********************************************************/
function AddQuote () {
global $admin_file;
OpenTable();
echo "<center><font class=\"option\"><b>"._QUOTEADD."</b></font><br><br><br>"
."<form action=\"".$admin_file.".php\" method=\"post\">"
."<b>"._QUOTE.":</b><br>"
."<textarea wrap=\"virtual\" cols=\"100\" name=\"quote\" rows=\"10\"></textarea><br>"
."<b>"._AUTHOR.":</b> "
."<input type=\"text\" name=\"author\" size=\"50\" maxlength=\"255\"><br>"
."<input type=\"hidden\" name=\"op\" value=\"SaveQuote\">"
."<input type=\"submit\" value=\""._SAVE."\">"
."</form></center>";
CloseTable();
}
function EditQuote($qid) {
global $prefix, $db, $admin_file;
$qid = intval($qid);
$result = $db->sql_query("select quote, author from ".$prefix."_quotes where qid='$qid'");
list($quote, $author) = $db->sql_fetchrow($result);
include ("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>"._QUOTESADMIN."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<center><font class=\"option\"><b>"._EDITQUOTE."</b></font><br><br><br>"
."<form action=\"".$admin_file.".php\" method=\"post\">"
."<b>"._QUOTE.":</b><br>"
."<textarea wrap=\"virtual\" cols=\"100\" name=\"quote\" rows=\"10\">$quote</textarea><br>"
."<b>"._AUTHOR.":</b> "
."<input type=\"text\" name=\"author\" size=\"50\" maxlength=\"255\" value=\"$author\"><br>"
."<input type=\"hidden\" name=\"op\" value=\"SaveEditQuote\">"
."<input type=\"hidden\" name=\"qid\" value=\"$qid\">"
."<input type=\"submit\" value=\""._SAVE."\">"
."</form></center>";
CloseTable();
include("footer.php");
}
function DeleteQuote($qid) {
global $prefix, $db, $admin_file;
$qid = intval($qid);
$result = $db->sql_query("select quote, author from ".$prefix."_quotes where qid='$qid'");
list($quote, $author) = $db->sql_fetchrow($result);
include ("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>"._QUOTESADMIN."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<center><font class=\"option\"><b>"._DELETEQUOTE."</b></font><br>";
if (!$qid)
{
Header("Location: $admin_file.php?op=QuotesList");
}
else
{
echo "<br><br><b>"._WARNING.":</b> "._CONFIRMDELETE."<br><br>"
."<p align=\"left\"><b>$quote</b><br><i>-- $author</i></p><br><br>"
."<b>[ <a href=\"".$admin_file.".php?op=YesDelQuote&qid=$qid\">"._YESDELQUOTE."</a> | "
."<a href=\"".$admin_file.".php?op=QuotesList\">"._NODELQUOTE."</a> ]</b>";
}
echo "</center>";
CloseTable();
include("footer.php");
}
function YesDelQuote($qid) {
global $prefix, $db, $admin_file;
$qid = intval($qid);
$quotesql = "delete from ".$prefix."_quotes where qid='$qid'";
$result = $db->sql_query($quotesql);
if ($result)
{
Header("Location: ".$admin_file.".php?op=QuotesList");
}
else
{
include ("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>"._QUOTESADMIN."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<center><font class=\"content\"><b>Error: Not deleted.</b></font><br><br>";
echo "$quotesql";
echo "</center>";
CloseTable();
include("footer.php");
}
}
function SaveQuote($quote, $author) {
global $prefix, $db, $admin_file;
$quote = ereg_replace("'", "\'", $quote);
$author = ereg_replace("'", "\'", $author);
$quotesql = "insert into ".$prefix."_quotes (quote, author) values ('$quote', '$author')";
$result = $db->sql_query($quotesql);
if ($result) {
Header("Location: " . $admin_file . ".php?op=QuotesList");
}
else
{
include ("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>"._QUOTESADMIN."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<center><font class=\"content\"><b>Error: Not added.</b></font><br><br>";
echo "$quotesql";
echo "</center>";
CloseTable();
include("footer.php");
}
}
function SaveEditQuote($qid, $quote, $author) {
global $prefix, $db, $admin_file;
$quote = ereg_replace("'", "\'", $quote);
$author = ereg_replace("'", "\'", $author);
$qid = intval($qid);
$result = $db->sql_query("REPLACE into ".$prefix."_quotes (qid, quote, author) values ($qid, '$quote', '$author')");
if ($result) {
Header("Location: " . $admin_file . ".php?op=QuotesList");
}
else
{
include ("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>"._QUOTESADMIN."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<center><font class=\"content\"><b>Error: Not updated.</b></font><br><br>";
echo "</center>";
CloseTable();
include("footer.php");
}
}
function QuotesList() {
global $prefix, $db, $radminsuper, $bgcolor1, $bgcolor2, $admin_file;
$dummy = 0;
include ("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>"._QUOTESADMIN."</b></font></center>";
CloseTable();
echo "<br>";
AddQuote();
echo "<br>";
OpenTable();
$result = $db->sql_query("SELECT qid, quote, author FROM ".$prefix."_quotes order by qid ASC");
if($db->sql_numrows($result) == 0)
{
echo "<table width=\"100%\"><tr><td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._NOQUOTES."</b></td></tr></table>\n";
}
else
{
echo "<center><font class=\"content\"><b>"._QUOTELIST."</b></font>";
echo "<form action=\"".$admin_file.".php\" method=\"post\">";
echo "<table width=\"100%\" border=\"1\">";
echo "<tr><td bgcolor=\"$bgcolor2\"><b> "._QUOTEID." </b></td>";
echo "<td bgcolor=\"$bgcolor2\"><b><center> "._QUOTE." </center></b></td>";
echo "<td bgcolor=\"$bgcolor2\"><b><center> "._AUTHOR." </center></b></td>";
echo "<td bgcolor=\"$bgcolor2\"><b><center> "._FUNCTIONS." </center></b></td></tr>\n";
while (list($qid, $quote, $author) = $db->sql_fetchrow($result))
{
$qid = intval($qid);
echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><font class=\"content\">\n";
echo "$qid";
echo "</td><td bgcolor=\"$bgcolor1\" align=\"left\">";
echo "<a href=\"".$admin_file.".php?op=EditQuote&qid=$qid\">$quote</a>";
echo "</td><td bgcolor=\"$bgcolor1\" align=\"center\">";
if ($author == "") {
echo _NOAUTHOR;
} else {
echo "$author";
}
echo "</td><td bgcolor=\"$bgcolor1\" align=\"center\"><font class=\"content\"> <a href=\"".$admin_file.".php?op=EditQuote&qid=$qid\"><img src=\"images/edit.gif\" alt=\""._EDIT."\" title=\""._EDIT."\" border=\"0\" width=\"17\" height=\"17\"></a> <a href=\"".$admin_file.".php?op=DeleteQuote&qid=$qid\"><img src=\"images/delete.gif\" alt=\""._DELETE."\" title=\""._DELETE."\" border=\"0\" width=\"17\" height=\"17\"></a> </td></tr>\n";
$dummy++;
}
if ($dummy < 1) {
echo "<tr><td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._NOQUOTES."</b></form></td></tr></table>\n";
} else {
echo "</table></form>\n";
}
}
/* if ($radminsuper == 1) {
echo "<br><center>"
."[ <a href=\"".$admin_file.".php?op=subdelete\">"._DELETE."</a> ]"
."</center><br>";
}
*/
CloseTable();
include ("footer.php");
}
switch($op) {
case "EditQuote":
EditQuote($qid);
break;
case "DeleteQuote":
DeleteQuote($qid);
break;
case "YesDelQuote":
YesDelQuote($qid);
break;
case "AddQuote":
AddQuote();
break;
case "SaveQuote":
SaveQuote($quote, $author);
break;
case "SaveEditQuote":
SaveEditQuote($qid, $quote, $author);
break;
case "QuotesList":
QuotesList();
break;
}
} else {
include("header.php");
GraphicAdmin();
OpenTable();
echo "<center><b>"._ERROR."</b><br><br>You do not have administration permission for module \"$module_name\"</center>";
CloseTable();
include("footer.php");
}
?>
|
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
trunks
Worker
![Worker Worker](modules/Forums/images/ranks/3stars.gif)
![](modules/Forums/images/avatars/56a8bef0497128bc46ce3.jpg)
Joined: Oct 05, 2007
Posts: 152
Location: United Kingdom
|
Posted:
Tue Jan 13, 2009 3:30 pm |
|
It looks like from one of your previous posts when editing the $dbi you removed it completely? =/ |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jakec
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jan 13, 2009 3:51 pm |
|
Yes you are right it is not just a matter of finding and replacing $dbi.
The code I posted above works on my test site, so everything should be OK now. ![Very Happy](modules/Forums/images/smiles/icon_biggrin.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|