»


Error

<!\ Erreur





OK

= $topic['posts']) showError ('Le numéro du premier post à extraire est invalide.'); else if (!is_numeric ($_POST['p2'])) { $options = ''; for ($i = min ($topic['posts'], $_GET['p1'] + 20); $i > $_GET['p1']; --$i) $options = '' . $options; showCadre ('Séparer un sujet', '
Topic à séparer : ' . htmlentities ($topic['title']) . '

Premier post : ./' . $_GET['p1'] . '

Dernier post : ./

Nouveau titre :

'); } else if ($_POST['p2'] < $_GET['p1'] || $_POST['p2'] >= $topic['posts']) showError ('Le numéro du dernier post à extraire est invalide.'); else { $p1 = $_GET['p1']; $p2 = $_POST['p2']; // Crée le nouveau topic mysql_query ('INSERT INTO topics (forum, title) VALUES (\'' . $topic['forum'] . '\', \'' . mysql_real_escape_string ($_POST['title']) . '\'') or die; $id = mysql_insert_id (); // Affecte les posts forkés au nouveau topic mysql_query ('UPDATE posts SET topic = \'' . $id . '\' WHERE topic = \'' . $topic['id'] . '\' AND num >= \'' . $p1 . '\' AND NUM <= \'' . $p2 . '\''); // Corrige la numérotation des posts dans le nouveau topic mysql_query ('UPDATE posts SET num = (num - ' . $p1 . ') WHERE topic = \'' . $id . '\''); // Corrige la numérotation des posts dans l'ancien topic mysql_query ('UPDATE posts SET num = (num - ' . ($p2 - $p1 + 1) . ') WHERE topic = \'' . $topic['id'] . '\' AND num > \'' . $p2 . '\''); // Corrige les infos sur le dernier post lu dans l'ancien topic mysql_query ('UPDATE last_post SET num = (num - ' . ($p2 - $p1 + 1) . ') WHERE topic = \'' . $topic['id'] . '\' AND num > \'' . $p2 . '\''); // FIXME: Post de Boo dans l'ancien topic pour prévenir du fork et fournir un lien vers le nouveau topic ? showCadre ('OK !', ' Topic séparé !
OK
'); } ?>