1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
<?php
/* OpenDb - Open Media Lending Database
Copyright (C) 2001,2002 by Jason Pell
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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
If any of the tables exist, this is a good indication that
the installation has already occurred!
*/
function check_if_installed()
{
if( check_table("s_attribute_type") || check_table("s_attribute_type_lookup") ||
check_table("s_item_attribute_type") || check_table("s_item_type"))
{
return TRUE;
}
else
{
return FALSE;
}
}
if($CONFIG_VARS['patch.enable']===TRUE)
{
if($HTTP_VARS['op'] == "menu")
{
echo("<DIV ALIGN=\"CENTER\">");
echo("<FORM action=\"$PHP_SELF\" method=\"get\" target=\"main\">");
print_button("sqlfile", "Execute opendb.sql", check_if_installed());
echo("<br>");
echo("Preview SQL only<INPUT TYPE=\"checkbox\" name=\"preview\" value=\"true\">");
echo("<INPUT TYPE=\"hidden\" name=\"op\" value=\"result\">");
echo("<INPUT TYPE=\"hidden\" name=\"from\" value=\"".$HTTP_VARS['from']."\">");
echo("</FORM>");
echo("</DIV>");
}
else
{
if($HTTP_VARS['preview'] == "true")
print_sql_file($HTTP_VARS['from'], "opendb.sql");
else if(isset($HTTP_VARS['sqlfile']))
exec_sql_file($HTTP_VARS['from'], "opendb.sql");
}
}
?>
|