Code: Alles auswählen
<?php
// Datei: phpDbUpdate.php
// author: studentl (c)2006
define('IN_PHPBB', true);
$phpbb_root_path = './';
// Load Configuration
include($phpbb_root_path . "extension.inc");
include($phpbb_root_path . "config." . $phpEx);
include($phpbb_root_path . "includes/db." . $phpEx);
$sql = "SELECT post_id, bbcode_uid, post_text FROM " . $table_prefix . "posts_text WHERE `post_text` LIKE '%[quote=%]%'";
$result = $db->sql_query($sql);
while (($row =mysql_fetch_array($result)))
{
$row['post_text'] = str_replace("\n", "<br />",$row['post_text']);
$row['post_text'] = str_replace('[quote="' , '[quote:' . $row['bbcode_uid'] . '="', $row['post_text'] );
$row['post_text'] = str_replace('"]' , '"]', $row['post_text'] );
$row['post_text'] = str_replace("[/quote]", "[/quote:" . $row['bbcode_uid'] . "]", $row['post_text'] );
$name='';
$name = substring_between($row['post_text'], '[quote=', ']');
if (name != '')
$row['post_text'] = str_replace('[quote=' . $name . ']' , '[quote:' . $row['bbcode_uid'] . '="' . $name . '"]', $row['post_text'] );
$sql = 'UPDATE `' . $table_prefix . 'posts_text` SET `post_text`=\'' . $row['post_text'] . '\' WHERE `post_id` = ' . $row['post_id'] . ';';
$db->sql_query($sql);
}
echo 'Alle Datenbankoperationen erfolgreich durchgeführt!';
//function to get a substring between between two other substrings
function substring_between($haystack,$start,$end) {
if (strpos($haystack,$start) === false || strpos($haystack,$end) === false) {
return false;
} else {
$start_position = strpos($haystack,$start)+strlen($start);
$end_position = 0;
while ($end_position < $start_position)
$end_position = strpos($haystack,$end);
return substr($haystack,$start_position,$end_position-$start_position);
}
}
?>
danach sollte alles wieder gehen.
mfg
studentl