<?php

// 1.fix extra slash inserted in db before quotes in previous versions when magic_quotes was enabled
$query = "SELECT id, value FROM setting WHERE value LIKE '%\\&quot;%'";
$result = mysql_query($query) or die("ERROR (fixing quoting problem in the settings table (1)): $query");
while (list($id, $value) = mysql_fetch_row($result)) {
    $value = str_replace("\\&quot;", '&quot;', $value);
    $value = mysql_real_escape_string($value);
    $query2 = "UPDATE setting SET value = '$value' WHERE id=$id";
    $result2 = mysql_query($query2) or die("ERROR (fixing quoting problem in the settings table (2)): $query");
}

?>
