Seite 1 von 2

IMG-Tag nach Mod im Klartext

Verfasst: 22.09.2008 15:23
von Coren
Hallo zusammen!

Ich habe einen neuen BBCode eingefügt, was auch wunderbar geklappt hat (siehe hier).

Dann habe ich dieses Script durchlaufen lassen, damit auch alte Beiträge diesen neuen BBCode anwenden.

Dies hat auch wunderbar geklappt, doch dafür werden die IMG- und URL-Tags nun im Klartext angezeigt!

Auch ein weiterer Aufruf des Scriptes hat nichts gebracht.

Da ich mich mit PHP eher weniger auskenne wollte ich mal nachfragen, ob ich den Zustand rückgängig machen kann oder es irgendwie hinbekomme, dass sowohl die alten als auch der neue BBCode bei allen Beiträgen funktioniert.

Gruß, Coren

Verfasst: 22.09.2008 16:25
von Dr.Death
Sorry, das Problem ist dem Script Autor bereits bekannt ( http://startrekguide.com/community/view ... =40#p60984 ) aber noch nicht behoben.

Verfasst: 22.09.2008 17:24
von 4seven
hier scheint die lösung zu folgen..
http://startrekguide.com/community/view ... 265#p61265

ansonsten, vielleicht einen versuch wert..
[BETA] Admin Reparse BBCode 0.0.2
http://www.phpbb.com/community/viewtopi ... 45&start=0

basiert zwar auf dem gleichen script, scheint aber überarbeitet

Verfasst: 22.09.2008 20:58
von Coren
Also bei http://startrekguide.com/community/view ... 265#p61265 weis ich nicht genau, was ich tun muss, damit das Problem beseitigt wird.

Werde ich also wohl oder übel das Mod dafür installieren müssen.

Gebe bescheid, wenn es geklappt hat!

Verfasst: 22.09.2008 21:35
von Coren
Hat leider garnichts gebracht, das Mod =(

Verfasst: 22.09.2008 21:44
von 4seven
hier gibt es ein script, das mal jemandem im forum geholfen hat:

erstelle eine datei mit namen resync_bbcode.php
(möglichst mit notepad++) und folgendem inhalt im hauptverzeichnis deines forums:

Code: Alles auswählen

<?php
/**
* The file must be named resync_bbcode.php
*/

define('IN_PHPBB', true);
$phpbb_root_path = ((isset($phpbb_root_path)) ? $phpbb_root_path : './');
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('posting');

$start = intval(request_var('start', 0));
$limit = 200;

include($phpbb_root_path . 'includes/message_parser.' . $phpEx);

$bbcode_status   = ($config['allow_bbcode']) ? true : false;
$img_status      = ($bbcode_status) ? true : false;
$flash_status   = ($bbcode_status && $config['allow_post_flash']) ? true : false;

$sql = 'SELECT * FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t
   WHERE t.topic_id = p.topic_id
      ORDER BY p.post_id ASC
         LIMIT ' . $start . ', ' . $limit;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
   decode_message($row['post_text'], $row['bbcode_uid']);

   $message_parser = new parse_message();
   $message_parser->message = str_replace('"', '"', html_entity_decode($row['post_text']));
   $message_parser->parse((($bbcode_status) ? $row['enable_bbcode'] : false), (($config['allow_post_links']) ? $row['enable_magic_url'] : false), $row['enable_smilies'], $img_status, $flash_status, true, $config['allow_post_links']);

   if ($row['poll_title'] && $row['post_id'] == $row['topic_first_post_id'])
   {
      $row['poll_option_text'] = '';
      $sql = 'SELECT * FROM ' . POLL_OPTIONS_TABLE . ' WHERE topic_id = ' . $row['topic_id'];
      $result2 = $db->sql_query($sql);
      while ($row2 = $db->sql_fetchrow($result2))
      {
         $row['poll_option_text'] .= $row2['poll_option_text'] . "\n";
      }
      $db->sql_freeresult($result2);

      $poll = array(
         'poll_title'      => $row['poll_title'],
         'poll_length'      => $row['poll_length'],
         'poll_max_options'   => $row['poll_max_options'],
         'poll_option_text'   => $row['poll_option_text'],
         'poll_start'      => $row['poll_start'],
         'poll_last_vote'   => $row['poll_last_vote'],
         'poll_vote_change'   => $row['poll_vote_change'],
         'enable_bbcode'      => $row['enable_bbcode'],
         'enable_urls'      => $row['enable_magic_url'],
         'enable_smilies'   => $row['enable_smilies'],
         'img_status'      => $img_status
      );

      $message_parser->parse_poll($poll);
   }

   $sql_data = array(
      'post_text'         => $message_parser->message,
      'post_checksum'      => md5($message_parser->message),
      'bbcode_bitfield'   => $message_parser->bbcode_bitfield,
      'bbcode_uid'      => $message_parser->bbcode_uid,
   );

   $sql = 'UPDATE ' . POSTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_data) . '
      WHERE post_id = ' . $row['post_id'];
   $db->sql_query($sql);

   if ($row['poll_title'] && $row['post_id'] == $row['topic_first_post_id'])
   {
      $sql_data = array(
         'poll_title'      => str_replace($row['bbcode_uid'], $message_parser->bbcode_uid, $poll['poll_title']),
      );

      $sql = 'UPDATE ' . TOPICS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_data) . '
         WHERE topic_id = ' . $row['topic_id'];
      $db->sql_query($sql);

      $sql = 'SELECT * FROM ' . POLL_OPTIONS_TABLE . ' WHERE topic_id = ' . $row['topic_id'];
      $result2 = $db->sql_query($sql);
      while ($row2 = $db->sql_fetchrow($result2))
      {
         $sql_data = array(
            'poll_option_text'      => str_replace($row['bbcode_uid'], $message_parser->bbcode_uid, $row2['poll_option_text']),
         );

         $sql = 'UPDATE ' . POLL_OPTIONS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_data) . '
            WHERE topic_id = ' . $row['topic_id'] . '
            AND poll_option_id = ' . $row2['poll_option_id'];
         $db->sql_query($sql);
      }
   }
}

$sql = 'SELECT count(post_id) as post_cnt FROM ' . POSTS_TABLE;
$result = $db->sql_query($sql);
$cnt = $db->sql_fetchrow($result);

if ($cnt['post_cnt'] > ($start + $limit))
{
   meta_refresh(1, './resync_bbcode.' . $phpEx . '?start=' . ($start + $limit));
   trigger_error('The script is not finished yet, please wait.  Part ' . (($start + $limit) / $limit) . ' of ' . intval($cnt['post_cnt'] / $limit) . ' is finished.');
}
else
{
   trigger_error('Finished!');
}

?>

melde dich im forum als admin an (sperre das board besser)
und rufe die url auf http://www.dein_board.de/resync_bbcode.php

( quelle: http://www.ktuk.net/phpBB3/viewtopic.php?f=32&t=4432 )

alternative -> foren-backup zurückspielen -> alten spoiler behalten, bis eine lösung in sicht ist :-?

Verfasst: 22.09.2008 22:48
von Coren
Hi!

Das ist genau dasselbe Script, dass ich auch im Anfangsposting verlinkt habe und nicht funktioniert hat.

Ist wirklich doof, dass ich jetzt zurückspielen müsste. =I

Verfasst: 22.09.2008 23:09
von 4seven
blöd. die einzige möglichkeit, die ich noch sehe, ist die,
das script so umzuprogrammieren, das der img und url tag außen vor gelassen wird.
müsste doch möglich sein, hm..

zumal genau die beiden tags ja "narrensicher" sind
und im allgemeinen nicht verändert werden.

mal an die experten hier. möglich oder nicht?

falls ja, dann raus mit der sprache :wink:

Verfasst: 23.09.2008 00:35
von nickvergessen
So als Grund überlegung. man müsste ja theoretisch die Posts auch mit
http://area51.phpbb.com/docs/code/phpBB ... t_for_edit
als Edit umformulieren udn im gleichen Schritt wieder zurück in einen Speicherfähigen mit
http://area51.phpbb.com/docs/code/phpBB ... or_storage
dürfte zwar ziemlich auf die Performance des Scripts gehen, aber wenns funktioniert?

Verfasst: 23.09.2008 11:48
von Coren
Ich habe jetzt das Backup aufgespielt.

Leider kann ich mit den beiden Links zu phpbb.com wenig anfangen, da ich keine PHP-Erfahrung habe. =I