PHP Web Host - Quality Web Hosting For All PHP Applications Sign up for PayPal and start accepting credit card payments instantly
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
gator81
Worker
Worker


Joined: Jun 09, 2007
Posts: 108

PostPosted: Sat Jan 10, 2009 2:32 pm Reply with quote Back to top

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
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team


Joined: Dec 02, 2006
Posts: 1364
Location: Texas, USA

PostPosted: Sat Jan 10, 2009 8:25 pm Reply with quote Back to top

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 to the forums!
View user's profile Send private message
gator81
Worker
Worker


Joined: Jun 09, 2007
Posts: 108

PostPosted: Sun Jan 11, 2009 8:34 pm Reply with quote Back to top

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
View user's profile Send private message
jakec
Site Admin


Joined: Feb 06, 2006
Posts: 3038
Location: United Kingdom

PostPosted: Mon Jan 12, 2009 2:22 am Reply with quote Back to top

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.
View user's profile Send private message
gator81
Worker
Worker


Joined: Jun 09, 2007
Posts: 108

PostPosted: Mon Jan 12, 2009 1:39 pm Reply with quote Back to top

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&amp;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>&nbsp;"._QUOTEID."&nbsp;</b></td>";
         echo "<td bgcolor=\"$bgcolor2\"><b><center>&nbsp;"._QUOTE."&nbsp;</center></b></td>";
         echo "<td bgcolor=\"$bgcolor2\"><b><center>&nbsp;"._AUTHOR."&nbsp;</center></b></td>";
         echo "<td bgcolor=\"$bgcolor2\"><b><center>&nbsp;"._FUNCTIONS."&nbsp;</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&amp;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\">&nbsp;<a href=\"".$admin_file.".php?op=EditQuote&amp;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&amp;qid=$qid\"><img src=\"images/delete.gif\" alt=\""._DELETE."\" title=\""._DELETE."\" border=\"0\" width=\"17\" height=\"17\"></a>&nbsp;</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 to the forums!
View user's profile Send private message
jakec
Site Admin


Joined: Feb 06, 2006
Posts: 3038
Location: United Kingdom

PostPosted: Mon Jan 12, 2009 3:37 pm Reply with quote Back to top

There is a sticky in these forums about how to fix the $dbi issue, this could be causing the problem with GeekQuotes.
View user's profile Send private message
gator81
Worker
Worker


Joined: Jun 09, 2007
Posts: 108

PostPosted: Mon Jan 12, 2009 5:56 pm Reply with quote Back to top

I found the sticky you were talking about
Only registered users can see links on this board!
Get registered or login to the forums!


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?
View user's profile Send private message
FireATST
RavenNuke(tm) Development Team


Joined: Jun 12, 2004
Posts: 633
Location: Ohio

PostPosted: Mon Jan 12, 2009 8:24 pm Reply with quote Back to top

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");
}
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2456
Location: Pittsburgh, Pennsylvania

PostPosted: Mon Jan 12, 2009 8:33 pm Reply with quote Back to top

$db->sql_query($createsql);
View user's profile Send private message
gator81
Worker
Worker


Joined: Jun 09, 2007
Posts: 108

PostPosted: Mon Jan 12, 2009 9:12 pm Reply with quote Back to top

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.
View user's profile Send private message
FireATST
RavenNuke(tm) Development Team


Joined: Jun 12, 2004
Posts: 633
Location: Ohio

PostPosted: Mon Jan 12, 2009 9:13 pm Reply with quote Back to top

opps....thanks Palbin.....I did miss that one....lol
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Mon Jan 12, 2009 11:00 pm Reply with quote Back to top

A 500 error is an error in your .htaccess file.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2456
Location: Pittsburgh, Pennsylvania

PostPosted: Mon Jan 12, 2009 11:04 pm Reply with quote Back to top

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 Smile

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.
View user's profile Send private message
gator81
Worker
Worker


Joined: Jun 09, 2007
Posts: 108

PostPosted: Tue Jan 13, 2009 1:15 am Reply with quote Back to top

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
View user's profile Send private message
jakec
Site Admin


Joined: Feb 06, 2006
Posts: 3038
Location: United Kingdom

PostPosted: Tue Jan 13, 2009 1:15 am Reply with quote Back to top

Palbin, there is a link to the download 5th post down.
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Tue Jan 13, 2009 1:35 am Reply with quote Back to top

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.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2456
Location: Pittsburgh, Pennsylvania

PostPosted: Tue Jan 13, 2009 6:39 am Reply with quote Back to top

gator81, do you have an .htaccess file that is in the same directory as your admin file? If you do, delete it.
View user's profile Send private message
gator81
Worker
Worker


Joined: Jun 09, 2007
Posts: 108

PostPosted: Tue Jan 13, 2009 9:33 am Reply with quote Back to top

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 Sad

I even reloaded the server and reloaded the sql server and no difference.
View user's profile Send private message
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2456
Location: Pittsburgh, Pennsylvania

PostPosted: Tue Jan 13, 2009 10:22 am Reply with quote Back to top

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
View user's profile Send private message
gator81
Worker
Worker


Joined: Jun 09, 2007
Posts: 108

PostPosted: Tue Jan 13, 2009 10:33 am Reply with quote Back to top

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
View user's profile Send private message
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2456
Location: Pittsburgh, Pennsylvania

PostPosted: Tue Jan 13, 2009 10:56 am Reply with quote Back to top

I'll try it tonight.
View user's profile Send private message
gator81
Worker
Worker


Joined: Jun 09, 2007
Posts: 108

PostPosted: Tue Jan 13, 2009 1:38 pm Reply with quote Back to top

I look forward to your results Smile
View user's profile Send private message
jakec
Site Admin


Joined: Feb 06, 2006
Posts: 3038
Location: United Kingdom

PostPosted: Tue Jan 13, 2009 2:16 pm Reply with quote Back to top

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&amp;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>&nbsp;"._QUOTEID."&nbsp;</b></td>";
         echo "<td bgcolor=\"$bgcolor2\"><b><center>&nbsp;"._QUOTE."&nbsp;</center></b></td>";
         echo "<td bgcolor=\"$bgcolor2\"><b><center>&nbsp;"._AUTHOR."&nbsp;</center></b></td>";
         echo "<td bgcolor=\"$bgcolor2\"><b><center>&nbsp;"._FUNCTIONS."&nbsp;</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&amp;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\">&nbsp;<a href=\"".$admin_file.".php?op=EditQuote&amp;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&amp;qid=$qid\"><img src=\"images/delete.gif\" alt=\""._DELETE."\" title=\""._DELETE."\" border=\"0\" width=\"17\" height=\"17\"></a>&nbsp;</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");
}


?>
View user's profile Send private message
trunks
Worker
Worker


Joined: Oct 05, 2007
Posts: 152
Location: United Kingdom

PostPosted: Tue Jan 13, 2009 3:30 pm Reply with quote Back to top

It looks like from one of your previous posts when editing the $dbi you removed it completely? =/
View user's profile Send private message Visit poster's website MSN Messenger
jakec
Site Admin


Joined: Feb 06, 2006
Posts: 3038
Location: United Kingdom

PostPosted: Tue Jan 13, 2009 3:51 pm Reply with quote Back to top

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
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum