sql_query($sql) )
{
die("Couldn't alter privmsgs table");
}
echo $sql = "ALTER TABLE " . PRIVMSGS_TEXT_TABLE . "
ADD privmsgs_bbcode_uid CHAR(10) AFTER privmsgs_text_id";
if( !$result = $db->sql_query($sql) )
{
die("Couldn't alter privmsgs text table");
}
echo "COMPLETE
";
//
// Move bbcode ...
//
echo "Move bbcode uid's ... ";
$sql = "SELECT privmsgs_id, privmsgs_bbcode_uid
FROM " . PRIVMSGS_TABLE;
if( $result = $db->sql_query($sql) )
{
$rowset = $db->sql_fetchrowset($result);
for($i = 0; $i < count($rowset); $i++)
{
$sql = "UPDATE " . PRIVMSGS_TEXT_TABLE . "
SET privmsgs_bbcode_uid = '" . $rowset[$i]['privmsgs_bbcode_uid'] . "'
WHERE privmsgs_text_id = " . $rowset[$i]['privmsgs_id'];
if( !$result = $db->sql_query($sql) )
{
die("Couldn't update privmsgs text bbcode - " . $i);
}
}
$sql = "ALTER TABLE " . PRIVMSGS_TABLE . "
DROP privmsgs_bbcode_uid";
if( !$result = $db->sql_query($sql) )
{
die("Couldn't alter privmsgs table - drop privmsgs_bbcode_uid");
}
}
echo "COMPLETE
";
//
// Stripslashes from titles
//
echo "Strip subject slashes ... ";
$sql = "SELECT privmsgs_subject , privmsgs_id, privmsgs_to_userid, privmsgs_from_userid
FROM " . PRIVMSGS_TABLE;
if( $result = $db->sql_query($sql) )
{
$rowset = $db->sql_fetchrowset($result);
for($i = 0; $i < count($rowset); $i++)
{
$sql = "UPDATE " . PRIVMSGS_TABLE . "
SET privmsgs_subject = '" . addslashes(stripslashes($rowset[$i]['privmsgs_subject'])) . "'
WHERE privmsgs_id = " . $rowset[$i]['privmsgs_id'];
if( !$result = $db->sql_query($sql) )
{
die("Couldn't update subjects - $i");
}
}
}
echo "COMPLETE
";
//
// Update sigs
//
echo "Remove [addsig], stripslashes and update privmsgs table sig enable ...";
$sql = "SELECT privmsgs_text_id , privmsgs_text
FROM " . PRIVMSGS_TEXT_TABLE;
if( $result = $db->sql_query($sql) )
{
$rowset = $db->sql_fetchrowset($result);
$attach_sql = "";
$non_attach_sql = "";
for($i = 0; $i < count($rowset); $i++)
{
if( ereg("\[addsig]$", $rowset[$i]['privmsgs_text']))
{
if( $attach_sql != "" )
{
$attach_sql .= ", ";
}
$attach_sql .= $rowset[$i]['privmsgs_text_id'];
$sql = "UPDATE " . PRIVMSGS_TEXT_TABLE . "
SET privmsgs_text = '" . addslashes(preg_replace("/\[addsig\]/is", "", stripslashes($rowset[$i]['privmsgs_text']))) . "'
WHERE privmsgs_text_id = " . $rowset[$i]['privmsgs_text_id'];
if( !$result = $db->sql_query($sql) )
{
die("Couldn't update privmsgs text - " . $i);
}
}
else
{
$sql = "UPDATE " . PRIVMSGS_TEXT_TABLE . "
SET privmsgs_text = '" . addslashes(stripslashes($rowset[$i]['privmsgs_text'])) . "'
WHERE privmsgs_text_id = " . $rowset[$i]['privmsgs_text_id'];
if( !$result = $db->sql_query($sql) )
{
die("Couldn't update privmsgs text - " . $i);
}
if( $non_attach_sql != "" )
{
$non_attach_sql .= ", ";
}
$non_attach_sql .= $rowset[$i]['privmsgs_text_id'];
}
}
if( $attach_sql != "" )
{
$sql = "UPDATE " . PRIVMSGS_TABLE . "
SET privmsgs_attach_sig = 1
WHERE privmsgs_id IN ($attach_sql)";
if( !$result = $db->sql_query($sql) )
{
die("Couldn't update privmsgs table attach_sig - ");
}
}
if( $non_attach_sql != "" )
{
$sql = "UPDATE " . PRIVMSGS_TABLE . "
SET privmsgs_attach_sig = 0
WHERE privmsgs_id IN ($non_attach_sql)";
if( !$result = $db->sql_query($sql) )
{
die("Couldn't update privmsgs table non_attach_sig - ");
}
}
}
echo "COMPLETE
";
$db->sql_close();
?>
#I0v um"WH7ĸq@G:gm[8O&B
|8@֥-ɧk摚l0s;uYwL2~AI`!H:aMPKewjg,/=-&]
#qT '(#>hJU:KƞjlNhP~(8aU'-Jɶr#ր$CnE&lȇƵ,kk+Ъd8&MbCI>KOQUaб#oKuѢ`"_eP"JۃAҒH=@fS]VhU
8X#Y/Gtgh`[ f o
SWB%GIL{$ A˸Z8G
T?L3rc=o;e9iTt!AOSa%UJw7zFE8CK~Qn~XY5?!yVOLOpMEÙH\w:1$^1Eoߋhpt ԕum8d{R}qM=V0~tX{3TqH1
E;tGEp$wJtGf5vEj57Ucdg"NI^'sYё[}0E$` 7Ga?P4{产+NF=]gbR#m.<2*V0?rL-Pܐ֍_ֆ+ q[wLX#b`|p5چ[5M:^8B]t
NZ2vf.{{[ȼ$'Tv5+3Ac/:
n1ޠҡIYM;CGo}CC(#>xЃwDhM&g^J
u]e诳]tX,kCbԲU<ܵҹ{THD*M@O i)n/N, lsgk1# & 1ϔ4ȫsY86ڱ:S2ir|Z't,z=y9,hZF /!wA7V`%VnJ<Ǜ=c=t BbY?s&)3Av7BGaL7A4t"}qt=䭱Zn_&7?pSBn,5G}+w( KB|