Archived
1
0

+ added UPGRADE feature - Package Manager shows an error for some file - ignore that!

! It's because PM checks mods against current file. Upgrade works by removing old changes from current file and applying new changes - which can't be applied as long as the old changes are still there - that's why PM shows that error.
+ more configuration variables in sboxDB.php
+ made background and text color of sbox theme-dependent. Alternating colors can be specified in settings for bright and dark themes - should work for all themes where there's a properly set windowbg2-class
* rewrote uninstall-code to SMF-package-sdk-example
This commit is contained in:
mbirth
2006-09-05 09:43:37 +00:00
parent 093eb52301
commit 7be9d6d99a
8 changed files with 295 additions and 224 deletions
+32 -86
View File
@@ -1,96 +1,42 @@
<?php
/******************************************************************************
* sbox_remove.php *
*******************************************************************************
* SMF: Simple Machines Forum - SMF Shoutbox MOD *
* Open-Source Project Inspired by Zef Hemel (zef@zefhemel.com) *
* =========================================================================== *
* Software Version: 1.04 *
* Software originally by: ? *
* Ported to SMF by: Deep, most code stolen from Matthew Wolf (Grudge) *
* Support, News, Updates at: http://www.simplemachines.org *
*******************************************************************************
* This program is free software; you may redistribute it and/or modify it *
* under the terms of the provided license as published by Lewis Media. *
* *
* This program is distributed in the hope that it is and will be useful, *
* but WITHOUT ANY WARRANTIES; without even any implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* See the "license.txt" file for details of the Simple Machines license. *
* The latest version can always be found at http://www.simplemachines.org. *
******************************************************************************/
/*******************************************************************************
This is a simplified script to remove settings from SMF.
echo'
<html>
<head>
<title>SMF DataBase Editor - Ultimate Shoutbox</title>
</head>
<body bgcolor="#FFFFFF">
<center>
<table border="0" cellspacing="1" cellpadding="4" bgcolor="#000000" width="90%">
<tr>
<th bgcolor="#34699E"><font color="#FFFFFF">SMF DB Editor - SMF-Shoutbox MOD - SQL UNINSTALL</font></th>
</tr>';
ATTENTION: If you are trying to UNINSTALL this package, please access
it directly, with a URL like the following:
http://www.yourdomain.tld/forum/sbox_remove.php (or similar.)
if (!isset($_REQUEST['sa']))
{
echo'
<tr>
<td bgcolor="#FFFFFF" align="center">
<font size="2"><a href="sbox_remove.php?sa=doit&man=yes">Click here to start shoutbox uninstallation</font></a><br /</td></tr></table>
';
}
else
{
echo '</table>';
================================================================================
if ((isset($_REQUEST['man'])) || (!isset($db_name)))
{
require_once (dirname(realpath($_SERVER['SCRIPT_FILENAME'])) . "/Settings.php");
$dbcon = mysql_connect($db_server, $db_user, $db_passwd);
mysql_select_db($db_name);
}
This script can be used to remove settings from the database for use
with SMF's $modSettings array. It is meant to be run either from the
package manager or directly by URL.
$error=0;
$shoutChunkSize = 350;
$timeLimitThreshold = 10;
$self = &$_SERVER['PHP_SELF'];
$start_time = time();
// Now time to make the new table
$result = mysql_query("DROP TABLE {$db_prefix}sbox_content;");
if (!$result)
{
echo "<font color=red>Error removing shoutbox table. SQL Error: ".mysql_error()."</font><BR />";
$error++;
}
else
echo "<font color=green>Shoutbox table deleted!</font><BR />";
*******************************************************************************/
$result = mysql_query("DELETE FROM {$db_prefix}settings WHERE variable LIKE 'sbox_%';");
if(!$result)
{
echo "<font color=red>Settings: ".mysql_error().".</font><br />";
$error++;
}
else
echo "<font color=green>Settings removed correctly!</font><br />";
// Type the settings prefix here
$mod_settings_prefix = 'sbox_';
$done = 1;
/******************************************************************************/
// Result
if (isset($done))
{
echo "</td></tr></table>";
if($error==0)
echo "<P>Downgrade of SQL was successfull.";
elseif ($error==1)
echo "<P>There was <B>one</B> error when downgrading your SQL.";
elseif ($error>1)
echo "<P>There were <B>$error</B> errors when downgrading your SQL.";
}
}
echo '</body></html>';
// If SSI.php is in the same place as this file, and SMF isn't defined, this is being run standalone.
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');
// Hmm... no SSI.php and no SMF?
elseif (!defined('SMF'))
die('<b>Error:</b> Cannot uninstall - please verify you put this in the same place as SMF\'s index.php.');
// drop table if it exists. Should make SMF-update 1.1rc2 -> 1.1rc3 easier.
$result = db_query("DROP TABLE `{$db_prefix}sbox_content`", __FILE__, __LINE__);
// Uh-oh spaghetti-oh!
if ($result === false)
echo '<b>Error:</b> Table drop failed!<br />';
$result = db_query("DELETE FROM `{$db_prefix}settings` WHERE variable LIKE '{$mod_settings_prefix}%'", __FILE__, __LINE__);
// Uh-oh spaghetti-oh!
if ($result === false)
echo '<b>Error:</b> Settings removal failed!<br />';
?>