Quote:
Originally Posted by tommaso
Thanks dwilkinsjr, I will continue on your version with the part of uninstall.
|
I'm not sure what you mean about the uninstall part but here is a much cleaner and properly encoded script.
The code is bellow but it may be easier to grab it from
http://public.dwilkinsjr.com/pixelpo...bout_text.phps
PHP Code:
<?php
/*
About Text AddOn - Version 1.01
Last update: 05/16/2007
First version: 05/11/2007
Written by: Tommaso Carullo - tom|at|tomsights|dot|net - www.tomsights.net
Refined by: Dwilkinsjr - dwilkinsjr|at|dwilkinsjr|dot|com - www.dwilkinsjr.com
Requires Pixelpost version 1.5 or newer
CHANGE LOG:
05/15/2007: Fixed the problem about data types (thanks to Sentinel, www.digitalview.at)
05/11/2007: First test emission, it works but have an open issue on data type of about fields
License: http://www.gnu.org/copyleft/gpl.html
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
$addon_name = "<a name=\"ATA\"></a>About Text Addon";
$addon_version = "1.01";
$addon_description = "Type the text to be displayed with <ABOUT_TEXT> or <ABOUT_TEXT_ALT> tags.<br />\n";
$addon_description .= "<p>Created by <a href='http://www.tomsights.net'>Tommaso Carullo</a> Refined by <a href='http://www.dwilkinsjr.com'>Dwilkinsjr</a></p>\n";
global $pixelpost_db_prefix;
### create the about text table to store the about text information
@mysql_query("CREATE TABLE IF NOT EXISTS `".$pixelpost_db_prefix."abouttxt` (`id` INT NOT NULL AUTO_INCREMENT,PRIMARY KEY(id),`about_txt` TEXT NOT NULL,`about_txt_alt` TEXT NOT NULL)");
if($_POST['action'] == "update_abouttxt") {
### query the about text database and pullout all the rows
$cquery = @mysql_query("SELECT * FROM `".$pixelpost_db_prefix."abouttxt`");
$abouttxt = @mysql_fetch_array($cquery);
### add slashes to special chars like ' and "
$about_txt = addslashes($_POST['about_txt']);
### add slashes to special chars like ' and "
$about_txt_alt = addslashes($_POST['about_txt_alt']);
### check if an id is currently present within the about text database
if($abouttxt['id'] != '') {
### we have an id so we can simply update the current row
@mysql_query("UPDATE `".$pixelpost_db_prefix."abouttxt` SET `about_txt` = '".$about_txt."', `about_txt_alt` = '".$about_txt_alt."'");
} else { ### if we made it down here, there is no id present in the database, we need to use the insert statement
@mysql_query("INSERT INTO `".$pixelpost_db_prefix."abouttxt` (`about_txt`, `about_txt_alt`) VALUES('".$about_txt."','".$about_txt_alt."')");
}
}
### query the about text database again and pullout all the rows
$cquery = @mysql_query("SELECT * FROM `".$pixelpost_db_prefix."abouttxt`");
$abouttxt = @mysql_fetch_array($cquery);
### remove those slashes we previously added for viewing
$about = $abouttxt['about_txt'];
$about = stripslashes($about);
### remove those slashes we previously added for viewing
$about_alt = $abouttxt['about_txt_alt'];
$about_alt = stripslashes($about_alt);
### lets output our form
$addon_description .= "\n<form name=\"abouttxtaddon\" id=\"formATA\" method=\"post\" action=\"#ATA\">\n";
$addon_description .= "<input name=\"action\" type=\"hidden\" value=\"update_abouttxt\" />\n\n";
$addon_description .= "<table border=\"0\" cellspacing=\"2\" cellpadding=\"3\">\n";
$addon_description .= " <tr>\n";
$addon_description .= " <td align=\"left\" valign=\"middle\"> About Main Lang:</td>\n";
$addon_description .= " </tr>\n";
$addon_description .= " <tr>\n";
$addon_description .= " <td align=\"center\" valign=\"middle\"><textarea name=\"about_txt\" id=\"about_txt\" rows=\"3\" cols=\"30\">".$about."</textarea></td>\n";
$addon_description .= " </tr>\n";
$addon_description .= " <tr>\n";
$addon_description .= " <td></td>\n";
$addon_description .= " </tr>\n";
$addon_description .= " <tr>\n";
$addon_description .= " <td align=\"left\" valign=\"middle\"> About Alternative Lang:</td>\n";
$addon_description .= " </tr>\n";
$addon_description .= " <tr>\n";
$addon_description .= " <td align=\"center\" valign=\"middle\"><textarea name=\"about_txt_alt\" id=\"about_txt_alt\" rows=\"3\" cols=\"30\">".$about_alt."</textarea></td>\n";
$addon_description .= " </tr>\n";
$addon_description .= " <tr>\n";
$addon_description .= " <td align=\"right\" valign=\"middle\"><input type=\"submit\" name=\"Submit\" value=\"Submit\" /></td>\n";
$addon_description .= " </tr>\n";
$addon_description .= "</table>\n\n";
$addon_description .= "</form>\n\n";
### finally, our template tags
$tpl = str_replace("<ABOUT_TEXT>",$about,$tpl);
$tpl = str_replace("<ABOUT_TEXT_ALT>",$about_alt,$tpl);
?>