Changeset 151 for trunk/action.php
- Timestamp:
- Mar 12, 2009, 11:47:40 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/action.php
r71 r151 8 8 $Table = $TranslationTree[$GroupId]['TablePrefix']; 9 9 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; else $Action = ''; 10 11 12 if(($Action == 'dbkit') and Licence(LICENCE_ADMIN)) 13 { 14 echo ('<form action="?action=dbkit" method="post">'); 15 echo('Najít: <input type="text" name="find" /><br />'); 16 echo('Nahradit: <input type="text" name="replace" /><br />'); 17 echo('<input type="submit" value="Najít/nahradit" /><br />'); 18 echo('</form>'); 19 20 if (array_key_exists('find',$_POST)) { 21 echo ('Začínám nahrazovat: <br />'); 22 $find = $_POST['find']; 23 $replace = $_POST['replace']; 24 25 foreach($TranslationTree as $Group) { 26 $Table = $Group['TablePrefix']; 27 echo ($Table.' '); 28 29 $sql = 'SELECT * FROM '.$Table.' WHERE (Language <> 0) AND ('; 30 foreach($Group['Items'] as $Item) { 31 if($Item['Column'] != '') $sql .= '`'.$Item['Column'].'` LIKE "%'.$find.'%" OR '; 32 } 33 $sql = substr($sql,0,strlen($sql)-4); 34 $sql .= ')'; 35 36 $ID = $Database->SQLCommand($sql); 37 while ($Line = mysql_fetch_assoc($ID)) { 38 $sql = 'UPDATE '.$Table; 39 foreach($Group['Items'] as $Item) { 40 $Column_text = addslashes(str_replace($find,$replace,$Line[$Item['Column']])); 41 $sql .= ' SET '.$Item['Column'].' = "'.$Column_text.'"'; 42 } 43 $sql .= ' WHERE ID = '.$Line['ID']; 44 $Database->SQLCommand($sql); 45 echo ('.'); 46 } 47 48 echo (' <strong>Hotovo</strong> <br />'); 49 if (mysql_num_rows($ID) > 0) { 50 WriteLog('Použita oprava DB ovlivněno '.mysql_num_rows($ID).' řádků z tabulky '.$Table, 4); 51 echo (' Použita oprava DB ovlivněno '.mysql_num_rows($ID).' řádků z tabulky '.$Table.'<br />'); 52 } 53 } 54 } 55 } 56 10 57 11 58 if(($Action == 'delete') and Licence(LICENCE_MODERATOR))
Note:
See TracChangeset
for help on using the changeset viewer.