<?PHP
/**
* Quote Module Installer
*
* This installer makes sure an admin is authenticated
* and checks whether the module is installed or not
* before installing. This file is included by index.php
*
* @author Edward Ritter, hide@address.com
* @version $Id: quotes_install.inc.php,v 1.1 2002/09/03 19:33:02 esritter Exp $
* @module quotes
* @package phpWebSite
*/
/* security check */
global $PHP_SELF;
if (substr_count ($PHP_SELF,"/mod/")) {
$inc_prefix = "../../";
} else if (substr_count ($PHP_SELF,"mod.php") ||
substr_count ($PHP_SELF,"admin.php")) {
$inc_prefix = "./";
} else {
$inc_prefix = "../";
}
include_once ($inc_prefix . 'modsecurity.php');
include ($inc_prefix . 'config.php');
if (!check_internal_call()) {
html_header_location("$phpws_url");
}
/* end security check */
if ($ready == 1) {
// Add module to modules table
$result = mysql_query ("INSERT INTO " . $table_prefix ."modules VALUES
('', '$module_long_name', 'mod.php?mod=$modname', '$module_icon',
'$modname', '$block_display_position', '". $modname . "_block.php',
'$admin_only', '$user_only', '" . $modname . "_admin', '$misc_info')");
if (!$result) {
$box_content .= "Error writing to modules table:<br />" . mysql_error();
if (mysql_errno() == 1050) {
$box_content .= "<br /><p>You have already installed the $modname module</p>";
}
}
// creates mod_quotes table containing quotes and authors
$result = mysql_query ("CREATE TABLE " . $table_prefix ."mod_quotes (
qid int(10) unsigned DEFAULT '0' NOT NULL auto_increment, quote text,
author varchar(150) NOT NULL, PRIMARY KEY (qid)) TYPE=ISAM PACK_KEYS=1");
if (!$result) {
$box_content .= "Error creating mod_quotes table:<br />" . mysql_error();
}
} else {
$box_content .= "<div class=\"type4\">Please read the module's
release notes before continuing.</div>\n
<div align=\"center\"><form action=\"mod.php\" method=\"post\">\n
<input type=\"hidden\" name=\"mod\" value=\"$modname\" />\n
<input type=\"hidden\" name=\"op\" value=\"install\" />\n
<input type=\"hidden\" name=\"ready\" value=\"1\" />\n
<textarea name=\"readme\" cols=\"60\" rows=\"15\">\n";
$readme = file ("./mod/$modname/README");
$readme = implode ("",$readme);
$box_content .= "$readme</textarea>
<input type=\"submit\" value=\"Install $module_long_name\" /></form></div>";
}
?>