Commit abd8624b08c85d3ae0ad46261b2c92e18934750e
1 parent
57f57eda
added script to urldecode discussion comments
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2705 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
29 additions
and
0 deletions
sync/unDecodeComments.php
0 → 100644
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Script to remove urldecode and stripslashes from all comments | |
| 4 | + */ | |
| 5 | +require_once("../config/dmsDefaults.php"); | |
| 6 | +$sql = $default->db; | |
| 7 | +$query = "select id, body from discussion_comments"; | |
| 8 | +$sql->query($query); | |
| 9 | +echo "<pre>"; | |
| 10 | +while ($sql->next_record()) { | |
| 11 | + echo "found offending field=" . $sql->f("body") . "<br>"; | |
| 12 | + // update it | |
| 13 | + updateField($sql->f("id"), $sql->f("body")); | |
| 14 | +} | |
| 15 | +echo "</pre>"; | |
| 16 | + | |
| 17 | +function updateField($id, $value) { | |
| 18 | + global $default; | |
| 19 | + $sql = $default->db; | |
| 20 | + $value = urldecode($value); | |
| 21 | + $query = "update discussion_comments set body='$value' where id=$id"; | |
| 22 | + if ($sql->query($query)) { | |
| 23 | + echo "successful "; | |
| 24 | + } else { | |
| 25 | + echo "unsuccessful "; | |
| 26 | + } | |
| 27 | + echo "update query=$query<br>"; | |
| 28 | +} | |
| 29 | +?> | |
| 0 | 30 | \ No newline at end of file | ... | ... |