Script de migration CoolForum vers PHPBB

Aspects techniques, mode d'emploi, services
Avatar de l’utilisateur
webmasters
Administrateur
Messages : 232
Inscription : 03 novembre 2010, 20:02

Re: Script de migration CoolForum vers PHPBB

Message par webmasters » 03 mars 2015, 14:05

Bonjour,
je pense que c'est parce que le schéma de votre base de données est resté en v 0.8.1 alors que le script a été fait pour la v 0.8.4.

Si vous voulez, je peux regarder mais il faudrait nous envoyer un export de votre base ou nous donner un accès à votre base.

Contact depuis cette page (http://www.clubalpin-idf.com/ecrire/) pour la suite des échanges si vous souhaitez donner ces informations,
Les webmasters

nay-seven
Messages : 1
Inscription : 03 mars 2015, 09:07

Re: Script de migration CoolForum vers PHPBB

Message par nay-seven » 03 mars 2015, 09:17

Bonjour à tous,
désolé de déterrer ce message et de m'inscrire sur ce forum pour ça, mais je cherche de l'aide sur ce script.
je dois migrer un coolforum qui date de 10 ans (et resté en v.0.8.1 beta ...) vers php 5 et ce script peux vraiment me sauver ( merci beaucoup aux créateurs)

j'ai commencé à tester les 2 versions de ce post, mais dans les 2 cas, il ne créé qu'une partie des sql, les post, users groups et users sont ok à priori
Le sql forum, topics et topics posted restent à 0 octets...

j'ai des erreurs du type

Code : Tout sélectionner

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/nayseven/www/importCoolForum v2.php on line 52
table forums : 0 ligne(s)
voila, si quelqu'un a une idée je suis preneur ;)

Avatar de l’utilisateur
webmasters
Administrateur
Messages : 232
Inscription : 03 novembre 2010, 20:02

Re: Script de migration CoolForum vers PHPBB

Message par webmasters » 05 novembre 2011, 13:42

Tout est dans le titre !
Lorsque nous avons migré l'ancien forum (Coolforum, qui a cessé de progresser et n'était pas adapté à la nouvelle formule d'hébergement du site web) vers le nouveau (PHPBB), curieusement, nous nous sommes rendus compte qu'il n'existait nulle part de "mode d'emploi" pour les sites qui avaient un forum Coolforum et qui tôt ou tard souhaiteraient migrer vers PHPBB.
Nous avons souhaité partager notre travail et donner la possibilité à ceux qui était confrontés au même transfert de leur base de données, un outil pour le faire, ce post est là pour cela et se trouve facilement pour qui recherche cette information sur le web où nous mêmes l'avons vainement cherchée à l'époque.

Pascal
Même pas mal aux pieds
Messages : 28
Inscription : 04 septembre 2008, 11:36

Re: Script de migration CoolForum vers PHPBB

Message par Pascal » 05 novembre 2011, 13:03

Peut-on nous expliquer ce qu'est ce charabia ?

Avatar de l’utilisateur
webmasters
Administrateur
Messages : 232
Inscription : 03 novembre 2010, 20:02

Re: Script de migration CoolForum vers PHPBB

Message par webmasters » 04 novembre 2011, 18:32

Voici le script amélioré pour prendre en compte les sondages :

Code : Tout sélectionner

<?php
$host = "xxx"; // serveur hôte
$user = "xxx"; // nom utilisateur
$pass = "xxx"; // mot de passe de connexion
$bdd  = "xxx"; // nom de la base de données

$connexion = mysql_connect($host, $user, $pass);
mysql_select_db($bdd, $connexion);

// table temporaire de premiers messages par topic
mysql_query("drop table if exists tmp_postopic");
mysql_query("create table if not exists tmp_postopic (
idTopic int(11) NOT NULL,
idFirstPost int(11) NOT NULL,
PRIMARY KEY (idTopic), KEY idFirstPost (idFirstPost)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs");
mysql_query("insert into tmp_postopic(idTopic, idFirstPost)
select idtopic, CF_firstPost.idPost
from CF_topics, (select min(idpost) as idPost, parent from CF_posts group by parent) as CF_firstPost
where CF_topics.idtopic = CF_firstPost.parent");

// table temporaire de sondage
mysql_query("drop table if exists tmp_sondage");
mysql_query("create table if not exists tmp_sondage (
id int(11) NOT NULL AUTO_INCREMENT,
idTopic int(11) NOT NULL,
`date` int(11) NOT NULL DEFAULT '0',
question text COLLATE latin1_general_ci NOT NULL,
choix text COLLATE latin1_general_ci NOT NULL,
rep text COLLATE latin1_general_ci NOT NULL,
votants text COLLATE latin1_general_ci NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs");
mysql_query("insert into tmp_sondage(id, idTopic, date, question, choix, rep, votants)
select id, idTopic, CF_poll.date, question, choix, rep, votants
from CF_poll, CF_topics
where id = poll");

// forum
$index = 1;
$requete = "";
$resultat = mysql_query("select forumid, forumtitle, forumcomment, forumtopic, forumposts, lastTopic.sujet, lastTopic.idderpost, lastTopic.userid, lastTopic.derposter, lastTopic.datederrep
from CF_forums,
(
select CF_topics.idforum, sujet, idderpost, userid, derposter, datederrep as datederrep
from CF_topics, CF_user, (select idforum, max(idderpost) as maxpost from CF_topics group by idforum) as lastPost
where CF_topics.derposter = CF_user.login
and idderpost in (lastPost.maxpost)
) as lastTopic
where forumid = idforum
order by forumid asc");
while ($ligne = mysql_fetch_assoc($resultat)) {
 $requete .= sprintf("insert into phpbb_forums(forum_id, left_id, right_id, forum_name, forum_desc, forum_posts, forum_topics, forum_topics_real, forum_last_post_id, forum_last_poster_id, forum_last_post_subject, forum_last_post_time, forum_last_poster_name, forum_type, prune_days) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, 1, 7);\n",
 $ligne["forumid"], 2 * $index - 1, 2 * $index, getDBParam($ligne["forumtitle"]), getDBParam($ligne["forumcomment"]), $ligne["forumposts"], $ligne["forumtopic"],
 $ligne["forumtopic"] , $ligne["idderpost"], shiftUser($ligne["userid"]), getDBParam($ligne["sujet"]), $ligne["datederrep"], getDBParam($ligne["derposter"]));
 $index++;
}
$session = fopen("forum.sql", "w");
fwrite($session, $requete);
fclose($session);
echo "table forums : ".($index - 1). " ligne(s)<br/>";

// topic & topics_posted
$index = 1;
$requete = "";
$requete2 = "";
$resultat = mysql_query("select CF_topics.idtopic, idforum, sujet, CF_topics.date as date, nbrep, nbvues, datederrep, derposter, idderpost, pseudo, userid, idFirstPost, tmp_sondage.date as dateSondage, question
from (CF_topics, CF_user, tmp_postopic) left join tmp_sondage
on (tmp_sondage.idTopic = CF_topics.idtopic)
where login = derposter and
tmp_postopic.idTopic = CF_topics.idtopic
order by CF_topics.idtopic asc");
while ($ligne = mysql_fetch_assoc($resultat)) {
 $sondage = (trim($ligne["question"]) != "");
 $requete .= sprintf("insert into phpbb_topics(topic_id, forum_id, topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_replies_real, topic_first_post_id, topic_first_poster_name, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_last_post_subject, topic_last_post_time, topic_last_view_time, poll_title, poll_start, poll_length, poll_max_options, poll_last_vote, poll_vote_change) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, 1, %s, 0);\n",
 $ligne["idtopic"],
 $ligne["idforum"],
 getDBParam($ligne["sujet"]),
 shiftUser($ligne["userid"]),
 $ligne["date"],
 $ligne["nbvues"],
 $ligne["nbrep"],
 $ligne["nbrep"],
 $ligne["idFirstPost"],
 getDBParam($ligne["pseudo"]),
 $ligne["idderpost"],
 shiftUser($ligne["userid"]),
 getDBParam($ligne["derposter"]),
 getDBParam($ligne["sujet"]),
 $ligne["datederrep"],
 $ligne["datederrep"],
 getDBParam($ligne["question"]),
 (($sondage)?$ligne["dateSondage"]:0),
 (($sondage)?1296000:0),
 (($sondage)?($ligne["dateSondage"] + 1209600):0));
 $requete2 .= sprintf("insert ignore into phpbb_topics_posted(user_id, topic_id, topic_posted) values (%s, %s, 1);\n",
 shiftUser($ligne["userid"]),
 $ligne["idtopic"]);
 $index++;
}
$session = fopen("topic.sql", "w");
fwrite($session, $requete);
fclose($session);
echo "table topics : ".($index - 1). " ligne(s)<br/>";
$session = fopen("topics_posted.sql", "w");
fwrite($session, $requete2);
fclose($session);
echo "table topics_posted : ".($index - 1). " ligne(s)<br/>";

//users & user_group
$index = 1;
$requete = "";
$requete2 = "";
$resultat = mysql_query("select userid, login, registerdate, usermail, lastpost, usermsg
from CF_user
order by userid asc");
while ($ligne = mysql_fetch_assoc($resultat)) {
 $requete .= sprintf("insert into phpbb_users(user_id, group_id, user_permissions, user_ip, user_regdate, username, username_clean, user_password, user_email, user_email_hash, user_posts, user_lang, user_timezone, user_dst) values (%s, 2, 0x3030303030303030303036787271656977770a716c633470693030303030300a716c617135323030303030300a716c633470693030303030300a716c633470693030303030300a716c63347069303030303030, '127.0.0.1', %s, %s, %s, 'zzzzzzzzzzzzzzzzzzzzzz', %s, %s, %s, 'fr', '1.0', 1);\n",
 shiftUser($ligne["userid"]), $ligne["registerdate"], getDBParam($ligne["login"]),
 getDBParam(strtolower(trim(preg_replace('# {2,}#', ' ', preg_replace('#(?:[\x00-\x1F\x7F]+|(?:\xC2[\x80-\x9F])+)#', '', $ligne["login"]))))), getDBParam($ligne["usermail"]), sprintf('%u', crc32(strtolower($ligne["usermail"]))).strlen($ligne["usermail"]), $ligne["usermsg"]);
 $requete2 .= sprintf("insert into phpbb_user_group(user_id, group_id, user_pending) values (%s, 2, 0);\n", shiftUser($ligne["userid"]));
 $index++;
}
$session = fopen("user.sql", "w");
fwrite($session, $requete);
fclose($session);
echo "table users : ".($index - 1). " ligne(s)<br/>";
$session = fopen("user_group.sql", "w");
fwrite($session, $requete2);
fclose($session);
echo "table user_group : ".($index - 1). " ligne(s)<br/>";

//posts
$index = 1;
$requete = "";
$resultat = mysql_query("select idpost, idforum, sujet, date, parent, msg, pseudo, postip, userid
from CF_posts, CF_user
where login = pseudo
order by idPost asc");
while ($ligne = mysql_fetch_assoc($resultat)) {
 $message = transformeBalise($ligne["msg"]);
 $requete .= sprintf("insert into phpbb_posts(post_id, topic_id, forum_id, poster_id, poster_ip, post_time, post_subject, post_text, post_checksum, bbcode_bitfield, bbcode_uid) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, '/4A=', '2eax45kp');\n",
 $ligne["idpost"], $ligne["parent"], $ligne["idforum"], shiftUser($ligne["userid"]),
 getDBParam($ligne["postip"]), $ligne["date"], getDBParam($ligne["sujet"]), getDBParam($message), getDBParam(md5($message)));
 $index++;
}
$session = fopen("posts.sql", "w");
fwrite($session, $requete);
fclose($session);
echo "table posts : ".($index - 1). " ligne(s)<br/>";

//poll_options & poll_votes
$index = 1;
$index2 = 1;
$requete = "";
$requete2 = "";
$resultat = mysql_query("select id, idTopic, date, question, choix, rep, votants
from tmp_sondage");
while ($ligne = mysql_fetch_assoc($resultat)) {
 $tChoix = explode(" >> ", $ligne["choix"]);
 $tReponse = explode(" >> ", $ligne["rep"]);
 for ($i = 0; $i < count($tChoix); $i++) {
  $requete .= sprintf("insert into phpbb_poll_options(poll_option_id, topic_id, poll_option_text, poll_option_total) values (%s, %s, %s, %s);\n",
$i + 1, $ligne["idTopic"], getDBParam($tChoix[$i]), $tReponse[$i]);
  for ($j = 0; $j < $tReponse[$i]; $j++) {
   $requete2 .= sprintf("insert into phpbb_poll_votes(topic_id, poll_option_id, vote_user_id, vote_user_ip) values (%s, %s, 2, '127.0.0.1');\n",
   $ligne["idTopic"],
   $i + 1);
   $index2++;
  }
  $index++;
 }
}
$session = fopen("poll_options.sql", "w");
fwrite($session, $requete);
fclose($session);
echo "table poll_options : ".($index - 1). " ligne(s)<br/>";
$session = fopen("poll_votes.sql", "w");
fwrite($session, $requete2);
fclose($session);
echo "table poll_votes : ".($index2 - 1). " ligne(s)<br/>";

mysql_query("drop table if exists tmp_postopic");
mysql_query("drop table if exists tmp_sondage");

function getDBParam($valeur)
{
 if (get_magic_quotes_gpc()) $valeur = stripslashes($valeur);
 return "'".mysql_real_escape_string($valeur)."'";
}
function shiftUser($idUser) // pour ne pas écraser les users existants dans phpbb :  à adapter
{
 $retour = ($idUser <= 53) ? $idUser + 4349 : $idUser;
 return $retour;
}
function transformeBalise($message)
{
 $retour = $message;
 $retour = str_replace("<br>", "", $retour);
 $retour = str_replace("<br />", "", $retour);
 $retour = str_replace("\r", "", $retour);
 $retour = str_replace("[bold]", "[b:2eax45kp]", $retour);
 $retour = str_replace("[/bold]", "[/b:2eax45kp]", $retour);
 $retour = str_replace("[under]", "[u:2eax45kp]", $retour);
 $retour = str_replace("[/under]", "[/u:2eax45kp]", $retour);
 $retour = str_replace("[ita]", "[i:2eax45kp]", $retour);
 $retour = str_replace("[/ita]", "[/i:2eax45kp]", $retour);
 $retour = str_replace("[center]", "", $retour);
 $retour = str_replace("[/center]", "", $retour);
 $retour = str_replace("[middle]", "", $retour);
 $retour = str_replace("[/middle]", "", $retour);
 $retour = str_replace("[left]", "", $retour);
 $retour = str_replace("[/left]", "", $retour);
 $retour = str_replace("[right]", "", $retour);
 $retour = str_replace("[/right]", "", $retour);
 $retour = str_replace("[quote]", "[quote:2eax45kp]", $retour);
 $retour = str_replace("[/quote]", "[/quote:2eax45kp]", $retour);
 $retour = str_replace("[quote4]", "", $retour);
 $retour = str_replace("[/quote4]", "", $retour);
 $retour = str_replace("[quote5]", "", $retour);
 $retour = str_replace("[/quote5]", "", $retour);
 $retour = str_replace("[quote6]", "", $retour);
 $retour = str_replace("[/quote6]", "", $retour);
 $retour = str_replace("[code]", "[code:2eax45kp]", $retour);
 $retour = str_replace("
", "[/code:2eax45kp]", $retour);
$retour = str_replace("[mail]", "", $retour);
$retour = str_replace("[/mail]", "", $retour);
$retour = str_replace("[img]", "[img:2eax45kp]", $retour);
$retour = str_replace("[/img]", "[/img:2eax45kp]", $retour);
$retour = preg_replace("#\[font=(.*?)\]#s", "", $retour);
$retour = str_replace("[/font]", "", $retour);
$retour = str_replace("[/url]", ")", $retour);
$retour = preg_replace("#\#s", "[url:2eax45kp]$1[/url:2eax45kp] (", $retour);
$retour = preg_replace("#\[color=(.*?)\]#s", "[color=$1:2eax45kp]", $retour);
$retour = str_replace("[/color]", "[/color:2eax45kp]", $retour);
$retour = preg_replace("#\[size=(.*?)\]#se", "'[size='.ajusteSize('$1').':2eax45kp]'", $retour);
$retour = str_replace("[/size]", "[/size:2eax45kp]", $retour);
$retour = str_replace("::)", "<!-- s:) --><img src=\"{SMILIES_PATH}/icon_e_smile.gif\" alt=\":)\" title=\"Smile\" /><!-- s:) -->", $retour);
$retour = str_replace("::(", "<!-- s:( --><img src=\"{SMILIES_PATH}/icon_e_sad.gif\" alt=\":(\" title=\"Sad\" /><!-- s:( -->", $retour);
$retour = str_replace("::o", "<!-- s:o --><img src=\"{SMILIES_PATH}/icon_e_surprised.gif\" alt=\":o\" title=\"Surprised\" /><!-- s:o -->", $retour);
$retour = str_replace("::D", "<!-- s:D --><img src=\"{SMILIES_PATH}/icon_e_biggrin.gif\" alt=\":D\" title=\"Very Happy\" /><!-- s:D -->", $retour);
$retour = str_replace(":;)", "<!-- s;) --><img src=\"{SMILIES_PATH}/icon_e_wink.gif\" alt=\";)\" title=\"Wink\" /><!-- s;) -->", $retour);
$retour = str_replace("::P", "<!-- s:P --><img src=\"{SMILIES_PATH}/icon_razz.gif\" alt=\":P\" title=\"Razz\" /><!-- s:P -->", $retour);
$retour = str_replace(":angry:", "<!-- s:x --><img src=\"{SMILIES_PATH}/icon_mad.gif\" alt=\":x\" title=\"Mad\" /><!-- s:x -->", $retour);
$retour = str_replace(":lol:", "<!-- s:lol: --><img src=\"{SMILIES_PATH}/icon_lol.gif\" alt=\":lol:\" title=\"Laughing\" /><!-- s:lol: -->", $retour);
$retour = str_replace(":crazy:", "<!-- s:roll: --><img src=\"{SMILIES_PATH}/icon_rolleyes.gif\" alt=\":roll:\" title=\"Rolling Eyes\" /><!-- s:roll: -->", $retour);
$retour = str_replace(":sun:", "<!-- s8-) --><img src=\"{SMILIES_PATH}/icon_cool.gif\" alt=\"8-)\" title=\"Cool\" /><!-- s8-) -->", $retour);
$retour = str_replace(":what:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":gne:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":baille:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":toufou:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":corne:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":pilote:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":invis:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":fuk:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":sleep:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":cry:", "<!-- s:cry: --><img src=\"{SMILIES_PATH}/icon_cry.gif\" alt=\":cry:\" title=\"Crying or Very Sad\" /><!-- s:cry: -->", $retour);
$retour = str_replace(":bomb:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":saint:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":cgeant:", "<!-- s:mrgreen: --><img src=\"{SMILIES_PATH}/icon_mrgreen.gif\" alt=\":mrgreen:\" title=\"Mr. Green\" /><!-- s:mrgreen: -->", $retour);
$retour = str_replace(":sherlock:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":diabolo:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":gnagnagna:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":saut2:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":jesors:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":groupies:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":jedi:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":kado:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":couteau:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":nanana:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":petelefeu:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":manif:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":smurf1:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":smurf2:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":smurf3:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":hello:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":marteau:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":pendu:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":grincheux:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":ange:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":fete:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":love:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":dance:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":merci:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":ambulance:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":question:", "<!-- s:?: --><img src=\"{SMILIES_PATH}/icon_question.gif\" alt=\":?:\" title=\"Question\" /><!-- s:?: -->", $retour);
$retour = str_replace(":noel:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":pongide:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":miammiam:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":chut:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":nul:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":bandana:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":mortderire:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":bebe:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":yaisse:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":bijour:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":anniv:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":spider:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":pardon:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":sherlock:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":bocal:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":palmier:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":cachecache:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":titanic:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":cartonrouge:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":aahh:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":snif1:", "<!-- s:cry: --><img src=\"{SMILIES_PATH}/icon_cry.gif\" alt=\":cry:\" title=\"Crying or Very Sad\" /><!-- s:cry: -->", $retour);
$retour = str_replace(":snif2:", "<!-- s:cry: --><img src=\"{SMILIES_PATH}/icon_cry.gif\" alt=\":cry:\" title=\"Crying or Very Sad\" /><!-- s:cry: -->", $retour);
$retour = str_replace(":snif3:", "<!-- s:cry: --><img src=\"{SMILIES_PATH}/icon_cry.gif\" alt=\":cry:\" title=\"Crying or Very Sad\" /><!-- s:cry: -->", $retour);
$retour = str_replace(":boulet:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":brave:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":bug:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":censure:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":chapeau:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":clap:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":devil:", "<!-- s:twisted: --><img src=\"{SMILIES_PATH}/icon_twisted.gif\" alt=\":twisted:\" title=\"Twisted Evil\" /><!-- s:twisted: --> ", $retour);
$retour = str_replace(":dub:", "<!-- s:oops: --><img src=\"{SMILIES_PATH}/icon_redface.gif\" alt=\":oops:\" title=\"Embarrassed\" /><!-- s:oops: -->", $retour);
$retour = str_replace(":register:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":fouet:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":fury:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":help:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":squatte:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":interroge:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":joker:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":point:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":pompom:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":siffle:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":smack:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":sorti:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":wub:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
return $retour;
}
function ajusteSize($size)
{
$retour = 100;
switch($size) {
case 1:
$retour = 100;
break;
case 2:
$retour = 112;
break;
case 3:
$retour = 125;
break;
case 4:
$retour = 137;
break;
case 5:
$retour = 150;
break;
case 6:
$retour = 162;
break;
case 7:
$retour = 175;
break;
case 8:
$retour = 187;
break;
case 9:
$retour = 200;
break;
}
return $retour;
}
?>[/code]

Pour importer des base volumineuses, utilisez ce script : [url]http://www.ozerov.de/bigdump/
.

Les webmasters.

rataka

Re: Script de migration CoolForum vers PHPBB

Message par rataka » 07 juillet 2011, 21:47

la migration de coolforum vers phpbb s'est déroulée sans problème majeur.
99 % de transfert correct.
Un grand merci à Manu ;)

Avatar de l’utilisateur
webmasters
Administrateur
Messages : 232
Inscription : 03 novembre 2010, 20:02

Re: Script de migration CoolForum vers PHPBB

Message par webmasters » 24 juin 2011, 18:34

Comme vu en privé, il est nécessaire d'avoir MySQL v5 minimum,
Les webmasters.

rataka

Re: Script de migration CoolForum vers PHPBB

Message par rataka » 23 juin 2011, 10:52

bonjour,

je viens d'utiliser votre scipt pour migrer coolforum vers php.
J'ai créé le fichier importcoolforum
je l'ai lancé
j'ai obtenu la page de résultat comme quoi il y a eu création de 6 fichiers
forums importés
topics importés
topics_posted importés
572 users importés
572 user_group importés
8943 posts importés

mais après, je ne vois pas ce qu'il faut faire, je ne retrouve pas ces fichiers ??
y avait-il autre chose à complèter dans le script à part dans le début les codes adresse, user et mdp.

merci
mail privé pour plus de rapidité rataka@free.fr

Avatar de l’utilisateur
webmasters
Administrateur
Messages : 232
Inscription : 03 novembre 2010, 20:02

Script de migration CoolForum vers PHPBB

Message par webmasters » 07 novembre 2010, 01:19

A toutes fins utiles, nous donnons ici le script de migration de CoolForum 0.8.4 vers PHPBB 3.x.

Ce script n'est pas complet, il se contente de migrer les forums, les utilisateurs, les topics et les posts.
En particulier, il ne prend pas en compte :
- les avatars
- les messages privés
- les annonces
- les sondages
- les modérateurs
car nous n'en faisions pas un grand usage.

Le script présenté provoque quelques imperfections avec certaines mises en page (faites un tour sur les forums pour vous en rendre compte) mais cela reste limité.

Les mots de passe ne sont pas repris de CoolForum et les utilisateurs devront demander le renvoi d'un nouveau mot de passe.

Le code :

Code : Tout sélectionner

<?php
$host	= "xxx"; // serveur hôte
$user	= "xxx";	// nom d'utilisateur
$pass	= "xxx";	// mot de passe de connexion
$bdd	= "xxx";	// nom de la base de données

$connexion = mysql_connect($host, $user, $pass);
mysql_select_db($bdd, $connexion);

// table temporaire de premiers messages par topic
mysql_query("drop table if exists postopic");
mysql_query("create table if not exists postopic (
  idTopic int(11) NOT NULL,
  idFirstPost int(11) NOT NULL,
  PRIMARY KEY (idTopic), KEY idFirstPost (idFirstPost)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs");
mysql_query("insert into postopic(idTopic, idFirstPost) 
select idtopic, CF_firstPost.idPost 
from CF_topics, (select min(idpost) as idPost, parent from CF_posts group by parent) as CF_firstPost
where CF_topics.idtopic = CF_firstPost.parent");

// forum
$index = 1;
$requete = "";
$resultat = mysql_query("select forumid, forumtitle, forumcomment, forumtopic, forumposts, lastTopic.sujet, lastTopic.idderpost, lastTopic.userid, lastTopic.derposter, lastTopic.datederrep
from CF_forums, 
(
select CF_topics.idforum, sujet, idderpost, userid, derposter, datederrep as datederrep
from CF_topics, CF_user, (select idforum, max(idderpost) as maxpost from CF_topics group by idforum) as lastPost
where CF_topics.derposter = CF_user.login
and idderpost in (lastPost.maxpost)
) as lastTopic
where forumid = idforum
order by forumid asc");
while ($ligne = mysql_fetch_assoc($resultat)) {
	$requete .= sprintf("insert into forums(forum_id, left_id, right_id, forum_name, forum_desc, forum_posts, forum_topics, forum_topics_real, forum_last_post_id, forum_last_poster_id, forum_last_post_subject, forum_last_post_time, forum_last_poster_name, forum_type, prune_days) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, 1, 7);\n", 
$ligne["forumid"], 2 * $index - 1, 2 * $index, getDBParam($ligne["forumtitle"]), getDBParam($ligne["forumcomment"]), $ligne["forumposts"], $ligne["forumtopic"], 
$ligne["forumtopic"] , $ligne["idderpost"], shiftUser($ligne["userid"]), getDBParam($ligne["sujet"]), $ligne["datederrep"], getDBParam($ligne["derposter"]));
	$index++;
}
$session = fopen("forum.sql", "w");
fwrite($session, $requete);
fclose($session);
echo $index. " forums importés<br/>";

// topic & topics_posted
$index = 1;
$requete = "";
$requete2 = "";
$resultat = mysql_query("select CF_topics.idtopic, idforum, sujet, date, nbrep, nbvues, datederrep, derposter, idderpost, pseudo, userid, idFirstPost
from CF_topics, CF_user, postopic
where login = derposter and
postopic.idTopic = CF_topics.idtopic
order by CF_topics.idtopic asc");
while ($ligne = mysql_fetch_assoc($resultat)) {
	$requete .= sprintf("insert into topics(topic_id, forum_id, topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_replies_real, topic_first_post_id, topic_first_poster_name, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_last_post_subject, topic_last_post_time, topic_last_view_time) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);\n", 
$ligne["idtopic"], $ligne["idforum"], getDBParam($ligne["sujet"]), shiftUser($ligne["userid"]), 
$ligne["date"], $ligne["nbvues"], $ligne["nbrep"], $ligne["nbrep"], $ligne["idFirstPost"], getDBParam($ligne["pseudo"]), $ligne["idderpost"], 
shiftUser($ligne["userid"]), getDBParam($ligne["derposter"]), 
getDBParam($ligne["sujet"]), $ligne["datederrep"], $ligne["datederrep"]);
	$requete2 .= sprintf("insert ignore into topics_posted(user_id, topic_id, topic_posted) values (%s, %s, 1);\n", shiftUser($ligne["userid"]), $ligne["idtopic"]);
	$index++;
}
$session = fopen("topic.sql", "w");
fwrite($session, $requete);
fclose($session);
echo $index. " topics importés<br/>";
$session = fopen("topics_posted.sql", "w");
fwrite($session, $requete2);
fclose($session);
echo $index. " topics_posted importés<br/>";

//users & user_group
$index = 1;
$requete = "";
$requete2 = "";
$resultat = mysql_query("select userid, login, registerdate, usermail, lastpost, usermsg
from CF_user
order by userid asc");
while ($ligne = mysql_fetch_assoc($resultat)) {
	$requete .= sprintf("insert into users(user_id, group_id, user_permissions, user_ip, user_regdate, username, username_clean, user_password, user_email, user_email_hash, user_posts, user_lang, user_timezone, user_dst) values (%s, 2, 0x3030303030303030303036787271656977770a716c633470693030303030300a716c617135323030303030300a716c633470693030303030300a716c633470693030303030300a716c63347069303030303030, '127.0.0.1', %s, %s, %s, 'zzzzzzzzzzzzzzzzzzzzzz', %s, %s, %s, 'fr', '1.0', 1);\n", 
shiftUser($ligne["userid"]), $ligne["registerdate"], getDBParam($ligne["login"]), 
getDBParam(strtolower(trim(preg_replace('# {2,}#', ' ', preg_replace('#(?:[\x00-\x1F\x7F]+|(?:\xC2[\x80-\x9F])+)#', '', $ligne["login"]))))), getDBParam($ligne["usermail"]), sprintf('%u', crc32(strtolower($ligne["usermail"]))).strlen($ligne["usermail"]), $ligne["usermsg"]);
	$requete2 .= sprintf("insert into user_group(user_id, group_id, user_pending) values (%s, 2, 0);\n", shiftUser($ligne["userid"]));
	$index++;
}
$session = fopen("user.sql", "w");
fwrite($session, $requete);
fclose($session);
echo $index. " users importés<br/>";
$session = fopen("user_group.sql", "w");
fwrite($session, $requete2);
fclose($session);
echo $index. " user_group importés<br/>";

//posts
$index = 1;
$requete = "";
$resultat = mysql_query("select idpost, idforum, sujet, date, parent, msg, pseudo, postip, userid
from CF_posts, CF_user
where login = pseudo
order by idPost asc");
while ($ligne = mysql_fetch_assoc($resultat)) {
	$message = transformeBalise($ligne["msg"]);
	$requete .= sprintf("insert into posts(post_id, topic_id, forum_id, poster_id, poster_ip, post_time, post_subject, post_text, post_checksum, bbcode_bitfield, bbcode_uid) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, '/4A=', '2eax45kp');\n", 
$ligne["idpost"], $ligne["parent"], $ligne["idforum"], shiftUser($ligne["userid"]), 
getDBParam($ligne["postip"]), $ligne["date"], getDBParam($ligne["sujet"]), getDBParam($message), getDBParam(md5($message)));
	$index++;
}
$session = fopen("posts.sql", "w");
fwrite($session, $requete);
fclose($session);
echo $index. " posts importés<br/>";

mysql_query("drop table if exists postopic");

function getDBParam($valeur)
{
	if (get_magic_quotes_gpc()) $valeur = stripslashes($valeur);
	return "'".mysql_real_escape_string($valeur)."'";
}
function shiftUser($idUser) // pour ne pas écraser les users existants dans phpbb :  à adapter
{
	$retour = $idUser;
	switch ($idUser) {
		case 1:
			$retour = 53;
			break;
		case 7:
			$retour = 54;
			break;
		case 32:
			$retour = 55;
			break;
	}
	return $retour;
}
function transformeBalise($message)
{
	$retour = $message;
	$retour = str_replace("<br>", "", $retour);
	$retour = str_replace("<br />", "", $retour);
	$retour = str_replace("\r", "", $retour);
	$retour = str_replace("[bold]", "[b:2eax45kp]", $retour);
	$retour = str_replace("[/bold]", "[/b:2eax45kp]", $retour);
	$retour = str_replace("[under]", "[u:2eax45kp]", $retour);
	$retour = str_replace("[/under]", "[/u:2eax45kp]", $retour);
	$retour = str_replace("[ita]", "[i:2eax45kp]", $retour);
	$retour = str_replace("[/ita]", "[/i:2eax45kp]", $retour);
	$retour = str_replace("[center]", "", $retour);
	$retour = str_replace("[/center]", "", $retour);
	$retour = str_replace("[middle]", "", $retour);
	$retour = str_replace("[/middle]", "", $retour);
	$retour = str_replace("[left]", "", $retour);
	$retour = str_replace("[/left]", "", $retour);
	$retour = str_replace("[right]", "", $retour);
	$retour = str_replace("[/right]", "", $retour);
	$retour = str_replace("[quote]", "[quote:2eax45kp]", $retour);
	$retour = str_replace("[/quote]", "[/quote:2eax45kp]", $retour);
	$retour = str_replace("[quote4]", "", $retour);
	$retour = str_replace("[/quote4]", "", $retour);
	$retour = str_replace("[quote5]", "", $retour);
	$retour = str_replace("[/quote5]", "", $retour);
	$retour = str_replace("[quote6]", "", $retour);
	$retour = str_replace("[/quote6]", "", $retour);
	$retour = str_replace("[code]", "[code:2eax45kp]", $retour);
	$retour = str_replace("
", "[/code:2eax45kp]", $retour);
$retour = str_replace("[mail]", "", $retour);
$retour = str_replace("[/mail]", "", $retour);
$retour = str_replace("[img]", "[img:2eax45kp]", $retour);
$retour = str_replace("[/img]", "[/img:2eax45kp]", $retour);
$retour = preg_replace("#\[font=(.*?)\]#s", "", $retour);
$retour = str_replace("[/font]", "", $retour);
$retour = str_replace("[/url]", ")", $retour);
$retour = preg_replace("#\[url=(.*?)\]#s", "[url:2eax45kp]$1[/url:2eax45kp] (", $retour);
$retour = preg_replace("#\[color=(.*?)\]#s", "[color=$1:2eax45kp]", $retour);
$retour = str_replace("[/color]", "[/color:2eax45kp]", $retour);
$retour = preg_replace("#\[size=(.*?)\]#se", "'[size='.ajusteSize('$1').':2eax45kp]'", $retour);
$retour = str_replace("[/size]", "[/size:2eax45kp]", $retour);
$retour = str_replace("::)", "<!-- s:) --><img src=\"{SMILIES_PATH}/icon_e_smile.gif\" alt=\":)\" title=\"Smile\" /><!-- s:) -->", $retour);
$retour = str_replace("::(", "<!-- s:( --><img src=\"{SMILIES_PATH}/icon_e_sad.gif\" alt=\":(\" title=\"Sad\" /><!-- s:( -->", $retour);
$retour = str_replace("::o", "<!-- s:o --><img src=\"{SMILIES_PATH}/icon_e_surprised.gif\" alt=\":o\" title=\"Surprised\" /><!-- s:o -->", $retour);
$retour = str_replace("::D", "<!-- s:D --><img src=\"{SMILIES_PATH}/icon_e_biggrin.gif\" alt=\":D\" title=\"Very Happy\" /><!-- s:D -->", $retour);
$retour = str_replace(":;)", "<!-- s;) --><img src=\"{SMILIES_PATH}/icon_e_wink.gif\" alt=\";)\" title=\"Wink\" /><!-- s;) -->", $retour);
$retour = str_replace("::P", "<!-- s:P --><img src=\"{SMILIES_PATH}/icon_razz.gif\" alt=\":P\" title=\"Razz\" /><!-- s:P -->", $retour);
$retour = str_replace(":angry:", "<!-- s:x --><img src=\"{SMILIES_PATH}/icon_mad.gif\" alt=\":x\" title=\"Mad\" /><!-- s:x -->", $retour);
$retour = str_replace(":lol:", "<!-- s:lol: --><img src=\"{SMILIES_PATH}/icon_lol.gif\" alt=\":lol:\" title=\"Laughing\" /><!-- s:lol: -->", $retour);
$retour = str_replace(":crazy:", "<!-- s:roll: --><img src=\"{SMILIES_PATH}/icon_rolleyes.gif\" alt=\":roll:\" title=\"Rolling Eyes\" /><!-- s:roll: -->", $retour);
$retour = str_replace(":sun:", "<!-- s8-) --><img src=\"{SMILIES_PATH}/icon_cool.gif\" alt=\"8-)\" title=\"Cool\" /><!-- s8-) -->", $retour);
$retour = str_replace(":what:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":gne:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":baille:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":toufou:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":corne:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":pilote:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":invis:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":fuk:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":sleep:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":cry:", "<!-- s:cry: --><img src=\"{SMILIES_PATH}/icon_cry.gif\" alt=\":cry:\" title=\"Crying or Very Sad\" /><!-- s:cry: -->", $retour);
$retour = str_replace(":bomb:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":saint:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":cgeant:", "<!-- s:mrgreen: --><img src=\"{SMILIES_PATH}/icon_mrgreen.gif\" alt=\":mrgreen:\" title=\"Mr. Green\" /><!-- s:mrgreen: -->", $retour);
$retour = str_replace(":sherlock:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":diabolo:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":gnagnagna:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":saut2:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":jesors:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":groupies:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":jedi:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":kado:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":couteau:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":nanana:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":petelefeu:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":manif:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":smurf1:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":smurf2:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":smurf3:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":hello:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":marteau:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":pendu:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":grincheux:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":ange:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":fete:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":love:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":dance:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":merci:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":ambulance:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":question:", "<!-- s:?: --><img src=\"{SMILIES_PATH}/icon_question.gif\" alt=\":?:\" title=\"Question\" /><!-- s:?: -->", $retour);
$retour = str_replace(":noel:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":pongide:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":miammiam:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":chut:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":nul:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":bandana:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":mortderire:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":bebe:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":yaisse:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":bijour:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":anniv:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":spider:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":pardon:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":sherlock:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":bocal:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":palmier:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":cachecache:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":titanic:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":cartonrouge:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":aahh:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":snif1:", "<!-- s:cry: --><img src=\"{SMILIES_PATH}/icon_cry.gif\" alt=\":cry:\" title=\"Crying or Very Sad\" /><!-- s:cry: -->", $retour);
$retour = str_replace(":snif2:", "<!-- s:cry: --><img src=\"{SMILIES_PATH}/icon_cry.gif\" alt=\":cry:\" title=\"Crying or Very Sad\" /><!-- s:cry: -->", $retour);
$retour = str_replace(":snif3:", "<!-- s:cry: --><img src=\"{SMILIES_PATH}/icon_cry.gif\" alt=\":cry:\" title=\"Crying or Very Sad\" /><!-- s:cry: -->", $retour);
$retour = str_replace(":boulet:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":brave:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":bug:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":censure:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":chapeau:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":clap:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":devil:", "<!-- s:twisted: --><img src=\"{SMILIES_PATH}/icon_twisted.gif\" alt=\":twisted:\" title=\"Twisted Evil\" /><!-- s:twisted: --> ", $retour);
$retour = str_replace(":dub:", "<!-- s:oops: --><img src=\"{SMILIES_PATH}/icon_redface.gif\" alt=\":oops:\" title=\"Embarrassed\" /><!-- s:oops: -->", $retour);
$retour = str_replace(":register:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":fouet:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":fury:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":help:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":squatte:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":interroge:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":joker:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":point:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":pompom:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":siffle:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":smack:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":sorti:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
$retour = str_replace(":wub:", "<!-- s:| --><img src=\"{SMILIES_PATH}/icon_neutral.gif\" alt=\":|\" title=\"Neutral\" /><!-- s:| -->", $retour);
return $retour;
}
function ajusteSize($size)
{
$retour = 100;
switch($size) {
case 1:
$retour = 100;
break;
case 2:
$retour = 112;
break;
case 3:
$retour = 125;
break;
case 4:
$retour = 137;
break;
case 5:
$retour = 150;
break;
case 6:
$retour = 162;
break;
case 7:
$retour = 175;
break;
case 8:
$retour = 187;
break;
case 9:
$retour = 200;
break;
}
return $retour;
}
?>[/code]

Copier ce script dans un fichier importCoolForum.php de votre site et lancer-le. Il va générer dans le répertoire du fichier 6 fichiers .sql que vous devrez importer dans votre base phpbb.

Un autre point de vigilance : dans la table users de PHPBB, il y a un index "unique" sur le champ username_clean.
Il est conseillé de supprimer cet index avant l'import du fichier user.sql et de le remettre ensuite. Il se peut que vous ayez une erreur sur un doublon de username_clean, dans ce cas, modifiez un de doublons à la main avant de réactiver l'index.

N'hésitez pas à adapter ce code à vos besoins, vous pouvez poster les différents versions sur ce fil,
Les webmasters.

Répondre