<?PHP
/************************************************************************/
/* DUNE by NPDS                                                         */
/* ===========================                                          */
/*                                                                      */
/* NPDS Copyright (c) 2002-2008 by Philippe Brunier                     */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/* MIGRATE DB from sable to EVOLUTION                                   */
/************************************************************************/
if (!function_exists("Mysql_Connexion")) {
   include ("mainfile.php");
}

include("header.php");
   echo "<p align=\"center\">Installation de NPDS SABLE EVOLUTION / Installing NPDS SABLE EVOLUTION<br /><br /></p>";

   // Evolution de Champs
   @sql_query("ALTER TABLE catagories CHANGE cat_title text");
   @sql_query("ALTER TABLE reviews_main CHANGE title text default NULL");

   // Migrate + Delete comments
   include ("modules/comments/article.conf.php");
   $result=sql_query("SELECT tid, sid, date, name, host_name, comment FROM comments ORDER by tid ASC");
   echo "<b>Migration Commentaires table Comments => Posts :</b><ul>";
   while(list($tid, $sid, $date, $name, $host_name, $comment)=sql_fetch_row($result)) {
      // l'article existe ?
      list($article_ok)=sql_fetch_row(sql_query("SELECT sid from stories where sid='$sid'"));
      if ($article_ok) {
         // le membre existe - sinon anonyme
         list($member_ok)=sql_fetch_row(sql_query("SELECT uid from users where uname='$name'"));
         if (!$member_ok) $member_ok=1; // <= anonyme
         // MAJ de la table POST
         $sql = "INSERT INTO posts (post_idH, topic_id, image, forum_id, poster_id, post_text, post_time, poster_ip, post_aff)
         VALUES ('0', '$sid', '', '$forum', '$member_ok', '".addslashes($comment)."', '$date', '$host_name', '1')";
         @sql_query($sql);
         echo "<li>SID article : $sid - Date : $date</li>";
         @sql_query("UPDATE users_status SET posts=posts+1 WHERE (uid='$uid')");
      }
      @sql_query("DELETE FROM comments WHERE tid='$tid'");
   }
   // ERASE table comments
   @sql_query("DROP TABLE comments");
   echo "</ul><br /><br />";

   // Delete links_votedata
   echo "<b>Supression table links_votedata</b>";
   @sql_query("DROP TABLE links_votedata");
   echo "<br /><br />";

   // Create metalang
   echo "<b>Cr&eacute;ation table metalang et chargement</b>";
   @sql_query("CREATE TABLE metalang (
      def varchar(50) NOT NULL default '',
      content text NOT NULL,
      type_meta varchar(4) NOT NULL default 'mot',
      type_uri char(1) NOT NULL default '-',
      uri varchar(255) default NULL,
      description text,
      obligatoire char(3) NOT NULL default '0',
      PRIMARY KEY  (def),
      KEY type_meta (type_meta)
      ) TYPE=MyISAM;");
   // Load metalang
   sql_query("INSERT INTO metalang VALUES ('Dev', 'Developpeur', 'mot', '-', NULL, NULL, '0')");
   sql_query("INSERT INTO metalang VALUES ('NPDS', '<a href=\"http://www.npds.org\" target=\"_blank\" alt=\"www.npds.org\">NPDS</a>', 'mot', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES (':-)', '\$cmd=MM_img(\"forum/smilies/icon_smile.gif\");', 'smil', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES (':-]', '\$cmd=MM_img(\"forum/smilies/icon_smile.gif\");', 'smil', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES (';-)', '\$cmd=MM_img(\"forum/smilies/icon_wink.gif\");', 'smil', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES (';-]', '\$cmd=MM_img(\"forum/smilies/icon_wink.gif\");', 'smil', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES (':-(', '\$cmd=MM_img(\"forum/smilies/icon_frown.gif\");', 'smil', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES (':-[', '\$cmd=MM_img(\"forum/smilies/icon_frown.gif\");', 'smil', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES ('8-)', '\$cmd=MM_img(\"forum/smilies/icon_cool.gif\");', 'smil', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES ('8-]', '\$cmd=MM_img(\"forum/smilies/icon_cool.gif\");', 'smil', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES (':-P', '\$cmd=MM_img(\"forum/smilies/icon_razz.gif\");', 'smil', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES (':-D', '\$cmd=MM_img(\"forum/smilies/icon_biggrin.gif\");', 'smil', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES (':=!', '\$cmd=MM_img(\"forum/smilies/yaisse.gif\");', 'smil', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES (':b', '\$cmd=MM_img(\"forum/smilies/icon_tongue.gif\");', 'smil', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES (':D', '\$cmd=MM_img(\"forum/smilies/icon_grin.gif\");', 'smil', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES (':#', '\$cmd=MM_img(\"forum/smilies/icon_ohwell.gif\");', 'smil', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES (':-o', '\$cmd=MM_img(\"forum/smilies/icon_eek.gif\");', 'smil', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES (':-?', '\$cmd=MM_img(\"forum/smilies/icon_confused.gif\");', 'smil', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES (':-|', '\$cmd=MM_img(\"forum/smilies/icon_mad.gif\");', 'smil', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES (':|', '\$cmd=MM_img(\"forum/smilies/icon_mad2.gif\");', 'smil', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES (':paf', '\$cmd=MM_img(\"forum/smilies/pafmur.gif\");', 'smil', '-', NULL, NULL, '1')");
   sql_query("INSERT INTO metalang VALUES ('dateL', '\$cmd=date(\"d/m/Y\");', 'meta', '-', NULL, '[french]Date longue JJ/MM/YYYY[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('heureC', '\$cmd=date(\"H:i\");', 'meta', '-', NULL, '[french]Heure courte HH:MM[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('heureL', '\$cmd=date(\"H:i:s\");', 'meta', '-', NULL, '[french]Heure longue HH:MM:SS[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('dateC', '\$cmd=date(\"d/m/y\");', 'meta', '-', NULL, '[french]Date longue JJ/MM[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!a/!', '&#92;', 'meta', '-', NULL, '[french]anti-slash[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!sc_infos_else!', '&nbsp;', 'meta', '-', NULL, '[french]affiche les informations de SuperCache[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!sc_infos!', '\$cmd=SC_infos();', 'meta', '-', NULL, '[french]affiche les informations de SuperCache[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!slogan!', '\$cmd=\$GLOBALS[\'slogan\'];', 'meta', '-', NULL, '[french]variable global \$slogan[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!bargif!', '\$cmd=\$GLOBALS[\'bargif\'];', 'meta', '-', NULL, '[french]variable global \$bargif[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!theme!', '\$cmd=\$GLOBALS[\'theme\'];', 'meta', '-', NULL, '[french]variable global \$sitename[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!sitename!', '\$cmd=\$GLOBALS[\'sitename\'];', 'meta', '-', NULL, '[french]variable global \$sitename[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!bgcolor1!', '\$cmd=\$GLOBALS[\'bgcolor1\'];', 'meta', '-', NULL, '[french]variable global \$bgcolor1 (ancien theme)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!bgcolor2!', '\$cmd=\$GLOBALS[\'bgcolor2\'];', 'meta', '-', NULL, '[french]variable global \$bgcolor2 (ancien theme)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!bgcolor3!', '\$cmd=\$GLOBALS[\'bgcolor3\'];', 'meta', '-', NULL, '[french]variable global \$bgcolor3 (ancien theme)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!bgcolor4!', '\$cmd=\$GLOBALS[\'bgcolor4\'];', 'meta', '-', NULL, '[french]variable global \$bgcolor4 (ancien theme)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!bgcolor5!', '\$cmd=\$GLOBALS[\'bgcolor5\'];', 'meta', '-', NULL, '[french]variable global \$bgcolor5 (ancien theme)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!bgcolor6!', '\$cmd=\$GLOBALS[\'bgcolor6\'];', 'meta', '-', NULL, '[french]variable global \$bgcolor6 (ancien theme)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!textcolor1!', '\$cmd=\$GLOBALS[\'textcolor1\'];', 'meta', '-', NULL, '[french]variable global \$textcolor1 (ancien theme)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!textcolor2!', '\$cmd=\$GLOBALS[\'textcolor2\'];', 'meta', '-', NULL, '[french]variable global \$textcolor2 (ancien theme)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!opentable!', '\$cmd=sub_opentable();', 'meta', '-', '', '[french]Appel la fonction OpenTable de NPDS[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!closetable!', '\$cmd=sub_closetable();', 'meta', '-', '', '[french]Appel la fonction CloseTable de NPDS[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('Scalcul', 'function MM_Scalcul(\$opex,\$premier,\$deuxieme) {\n   if (\$opex==\"+\") {\$tmp=\$premier+\$deuxieme;}\n   if (\$opex==\"-\") {\$tmp=\$premier-\$deuxieme;}\n   if (\$opex==\"*\") {\$tmp=\$premier*\$deuxieme;}\n   if (\$opex==\"/\") {\n      if (\$deuxieme==0) {\n         \$tmp=\"Division by zero !\";\n      } else {\n         \$tmp=\$premier/\$deuxieme;\n      }\n   }\n   return (\$tmp);\n}', 'meta', '-', NULL, '[french]Retourne la valeur du calcul : syntaxe Scalcul(op,nombre,nombre) ou op peut &ecirc;tre : + - * /[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!anti_spam!', 'function MM_anti_spam (\$arg) {\n   return(\"<a href=\\\\\"mailto:\".anti_spam(\$arg).\"\\\\\" class=\\\\\"NOIR\\\\\" target=\\\\\"_blank\\\\\">\".str_replace(\"@\",\"_\".translate(\"at\").\"_\",\$arg).\"</a>\");\n}', 'meta', '-', NULL, '[french]Encode un email et cr&eacute;e un &lta href=mailto ...&gtEmail&lt/a&gt[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!msg_foot!', 'function MM_msg_foot () {\n   global \$foot1, \$foot2, \$foot3, \$foot4;\n\n   if (\$foot1) \$MT_foot=stripslashes(\$foot1).\"<br />\";\n   if (\$foot2) \$MT_foot.=stripslashes(\$foot2).\"<br />\";\n   if (\$foot3) \$MT_foot.=stripslashes(\$foot3).\"<br />\";\n   if (\$foot4) \$MT_foot.=stripslashes(\$foot4);\n   return (aff_langue(\$MT_foot));\n}', 'meta', '-', NULL, '[french]Gestion des messages du footer du theme (les 4 pieds de page dans Admin / Pr&eacute;f&eacute;rences)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!date!', 'function MM_date () {\n   global \$locale, \$gmt;\n\n   setlocale (LC_TIME, aff_langue(\$locale));\n   \$MT_date=strftime(translate(\"daydate\"),time()+(\$gmt*3600));\n   return (\$MT_date);\n}', 'meta', '-', NULL, '[french]Date du jour - se base sur le format de daydate (fichier de traduction)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!banner!', 'function MM_banner () {\n   global \$banners, \$hlpfile;\n\n   if ((\$banners) and (!\$hlpfile)) {\n      ob_start();\n      include(\"banners.php\");\n      \$MT_banner=ob_get_contents();\n      ob_end_clean();\n   } else {\n      \$MT_banner=\"\";\n   }\n   return (\$MT_banner);\n}', 'meta', '-', NULL, '[french]Syst&egrave;me de banni&egrave;re[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!search_topics!', 'function MM_search_topics() {\n   global \$NPDS_Prefix;\n\n   \$MT_search_topics=\"<form action=\\\\\"search.php\\\\\" method=\\\\\"post\\\\\"><b>\".translate(\"Topics\").\" </b>\";\n   \$MT_search_topics.=\"<select class=\\\\\"TEXTBOX_STANDARD\\\\\" name=\\\\\"topic\\\\\"onChange=\'submit()\'>\" ;\n   \$MT_search_topics.=\"<option value=\\\\\"\\\\\">\".translate(\"All Topics\").\"</option>\\\\n\";\n\n   \$rowQ=Q_select(\"select topicid, topictext from \".\$NPDS_Prefix.\"topics order by topictext\", 86400);\n   while(list(,\$myrow) = each(\$rowQ)) {\n     \$MT_search_topics.=\"<option \$sel value=\\\\\"\$myrow[topicid]\\\\\">\".aff_langue(\$myrow[topictext]).\"</option>\\\\n\";\n   }\n   \$MT_search_topics.=\"</select></form>\";\n   return (\$MT_search_topics);\n}', 'meta', '-', NULL, '[french]Liste des Topic => Moteur de recherche interne (Combo)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!search!', 'function MM_search() {\n   \$MT_search=\"<form action=\\\\\"search.php\\\\\" method=\\\\\"post\\\\\"><b>\".translate(\"Search\").\"</b>\n   <input class=\\\\\"TEXTBOX_STANDARD\\\\\" type=\\\\\"name\\\\\" name=\\\\\"query\\\\\" size=\\\\\"10\\\\\"></form>\";\n   return (\$MT_search);\n}', 'meta', '-', NULL, '[french]Ligne de saisie => Moteur de recherche[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!member!', 'function MM_member() {\n   global \$cookie, \$anonymous;\n\n   \$username = \$cookie[1];\n   if (\$username==\"\") {\$username=\$anonymous;}\n   ob_start();Mess_Check_Mail(\$username);\n      \$MT_member=ob_get_contents();\n   ob_end_clean();\n   return (\$MT_member);\n}', 'meta', '-', NULL, '[french]Ligne Anonyme / membre gestion du compte / Message Interne (MI)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!nb_online!', 'function MM_nb_online() {\n   list(\$MT_nb_online, \$MT_whoim)=Who_Online();\n   return (\$MT_nb_online);\n}', 'meta', '-', NULL, '[french]Nombre de session active[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!whoim!', 'function MM_whoim() {\r\n   list(\$MT_nb_online, \$MT_whoim)=Who_Online();\r\n   return (\$MT_whoim);\r\n}', 'meta', '-', NULL, '[french]Affiche Qui est en ligne ? + message de bienvenue[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!membre_nom!', 'function MM_membre_nom() {\n   global \$NPDS_Prefix,\$cookie;\n\n   \$uname=arg_filter(\$cookie[1]);\n   \$MT_name=\"\";\n   \$rowQ = Q_select(\"select name from \".\$NPDS_Prefix.\"users where uname=\'\$uname\'\", 3600);\n   list(,\$myrow) = each(\$rowQ);\n   \$MT_name=\$myrow[name];\n   return (\$MT_name);\n}', 'meta', '-', NULL, '[french]R&eacute;cup&eacute;ration du nom du membre ou rien[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!membre_pseudo!', 'function MM_membre_pseudo() {\n   global \$cookie;\n\n   return (\$cookie[1]);\n}', 'meta', '-', NULL, '[french]Alias de !membre_nom![/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('blocID', 'function MM_blocID(\$arg) {\n  return(@oneblock(substr(\$arg,1), substr(\$arg,0,1).\"B\"));\n}', 'meta', '-', NULL, '[french]Fabrique un bloc R (droite) ou L (gauche) en s\'appuyant sur l\'ID (voir gestionnaire de blocs) pour incorporation / syntaxe : block(R1) ou block(L2)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!block!', 'function MM_block(\$arg) {\n   return (meta_lang(\"blocID(\$arg)\"));\n}', 'meta', '-', NULL, '[french]Alias de blocID()[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!leftblocs!', 'function MM_leftblocs() {\n   ob_start();\n      leftblocks();\n      \$M_Lblocs=ob_get_contents();\n   ob_end_clean();\n   return (\$M_Lblocs);\n}', 'meta', '-', NULL, '[french]Fabrique tous les blocs de gauche[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!rightblocs!', 'function MM_rightblocs() {\n   ob_start();\n      rightblocks();\n      \$M_Lblocs=ob_get_contents();\n   ob_end_clean();\n   return (\$M_Lblocs);\n}', 'meta', '-', NULL, '[french]Fabrique tous les blocs de droite[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('articleID', 'function MM_articleID(\$arg) {\n   global \$NPDS_Prefix;\n   global \$nuke_url;\n\n   \$arg = arg_filter(\$arg);\n   \$rowQ = Q_select(\"SELECT title FROM \".\$NPDS_Prefix.\"stories where sid=\'\$arg\'\", 3600);\n   list(,\$myrow) = each(\$rowQ);\n   return (\"<a href=\\\\\"\$nuke_url/article.php?sid=\$arg\\\\\" class=\\\\\"NOIR\\\\\">\$myrow[title]</a>\");\n}', 'meta', '-', NULL, '[french]R&eacute;cup&eacute;ration du titre et fabrication d\'une url pointant sur l\'article (ID)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!article!', 'function MM_article(\$arg) {\n   return (meta_lang(\"articleID(\$arg)\"));\n}', 'meta', '-', NULL, '[french]Alias d\'articleID[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('article_completID', 'function MM_article_completID(\$arg) {\n   if (\$arg>0) {\n      \$story_limit=1;\n      \$news_tab=prepa_aff_news(\"article\",\$arg,\"\");\n   } else {\n      \$news_tab=prepa_aff_news(\"index\",\"\",\"\");\n      \$story_limit=abs(\$arg)+1;\n   }\n   \$aid=unserialize(\$news_tab[\$story_limit][aid]);\n   \$informant=unserialize(\$news_tab[\$story_limit][informant]);\n   \$datetime=unserialize(\$news_tab[\$story_limit][datetime]);\n   \$title=unserialize(\$news_tab[\$story_limit][title]);\n   \$counter=unserialize(\$news_tab[\$story_limit][counter]);\n   \$topic=unserialize(\$news_tab[\$story_limit][topic]);\n   \$hometext=unserialize(\$news_tab[\$story_limit][hometext]);\n   \$notes=unserialize(\$news_tab[\$story_limit][notes]);\n   \$morelink=unserialize(\$news_tab[\$story_limit][morelink]);\n   \$topicname=unserialize(\$news_tab[\$story_limit][topicname]);\n   \$topicimage=unserialize(\$news_tab[\$story_limit][topicimage]);\n   \$topictext=unserialize(\$news_tab[\$story_limit][topictext]);\n   \$s_id=unserialize(\$news_tab[\$story_limit][id]);\n   if (\$aid) {\n      ob_start();\n         themeindex(\$aid, \$informant, \$datetime, \$title, \$counter, \$topic, \$hometext, \$notes, \$morelink, \$topicname, \$topicimage, \$topictext, \$s_id);\n         \$remp=ob_get_contents();\n      ob_end_clean();\n   } else {\n      \$remp=\"\";\n   }\n   return (\$remp);\n}', 'meta', '-', NULL, '[french]R&eacute;cup&eacute;ration de l\'article complet (ID) et themisation pour incorporation<br />si ID > 0   : l\'article publi&eacute; avec l\'ID indiqu&eacute;e<br />si ID = 0   : le dernier article publi&eacute;<br />si ID = -1  : l\'avant dernier ... jusqu\'&agrave; -9 (limite actuelle)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!article_complet!', 'function MM_article_complet(\$arg) {\n   return (meta_lang(\"article_completID(\$arg)\"));\n}', 'meta', '-', NULL, '[french]Alias de article_completID[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('headlineID', 'function MM_headlineID(\$arg) {\n   return (@headlines(\$arg,\"\"));\n}', 'meta', '-', NULL, '[french]R&eacute;cup&eacute;ration du canal RSS (ID) et fabrication d\'un retour pour affichage[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!headline!', 'function MM_headline(\$arg) {\n   return (meta_lang(\"headlineID(\$arg)\"));\n}', 'meta', '-', NULL, '[french]Alias de headlineID[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!list_mns!', 'function MM_list_mns() {\n   global \$NPDS_Prefix;\n\n   \$query=sql_query(\"SELECT uname FROM \".\$NPDS_Prefix.\"users WHERE mns=\'1\'\");\n   \$MT_mns=\"<table width=\\\\\"100%\\\\\">\";\n   while (list(\$uname)=sql_fetch_row(\$query)) {\n      \$rowcolor=tablos();\n      \$MT_mns.=\"<tr \$rowcolor><td><a href=\\\\\"minisite.php?op=\$uname\\\\\" target=\\\\\"_blank\\\\\" class=\\\\\"NOIR\\\\\">\$uname</a></td></tr>\";\n   }\n   \$MT_mns.=\"</table>\";\n   return (\$MT_mns);\n}', 'meta', '-', NULL, '[french]Affiche une liste de tout les membres poss&eacute;dant un minisite avec un lien vers ceux-ci[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!LastMember!', 'function MM_LastMember() {\n   global \$NPDS_Prefix;\n\n   \$query=sql_query(\"SELECT uname FROM \".\$NPDS_Prefix.\"users ORDER BY uid DESC LIMIT 0,1\");\n   \$result=sql_fetch_row(\$query);\n   return (\$result[0]);\n}', 'meta', '-', NULL, '[french]Renvoie le pseudo du dernier membre inscrit[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!edito!', 'function MM_edito() {\n   list(\$affich,\$M_edito)=fab_edito();\n   if ((!\$affich) or (\$M_edito==\"\")) {\n      \$M_edito=\"\";\n   }\n   return (\$M_edito);\n}', 'meta', '-', NULL, '[french]Fabrique et affiche l\'EDITO[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!edito-notitle!', '\$cmd=\"!edito-notitle!\";', 'meta', '-', NULL, '[french]Supprime le Titre EDITO et le premier niveau de tableau dans l\'edito (ce meta-mot n\'est actif que dans l\'Edito)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!langue!', '\$cmd=aff_local_langue(\"\",\"index.php\", \"choice_user_language\");', 'meta', '-', NULL, '[french]Fabrique une zone de selection des langues disponibles[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('groupe_text', 'function MM_groupe_text(\$arg) {\n   global \$user;\n\n   \$affich=false;\n   \$remp=\"\";\n   if (\$arg!=\"\") {\n      if (groupe_autorisation(\$arg, valid_group(\$user)))\n         \$affich=true;\n   } else {\n      if (\$user)\n         \$affich=true;\n   }\n   if (!\$affich) { \$remp=\"!delete!\"; }\n   return (\$remp);\n}', 'meta', '-', NULL, '[french]Test si le membre appartient aux(x) groupe(s) et n\'affiche que le texte encadr&eacute; par groupe_textID(ID_group) ... !/!<br />Si groupe_ID est nul, la v&eacute;rification portera simplement sur la qualit&eacute; de membre<br />Syntaxe : groupe_text(), groupe_text(10) ou groupe_textID(\"gp1,gp2,gp3\") ... !/![/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('no_groupe_text', 'function MM_no_groupe_text(\$arg) {\n   global \$user;\n\n   \$affich=true;\n   \$remp=\"\";\n   if (\$arg!=\"\") {\n      if (groupe_autorisation(\$arg, valid_group(\$user)))\n         \$affich=false;\n      if (!\$user)\n         \$affich=false;\n   } else {\n      if (\$user)\n         \$affich=false;\n   }\n   if (!\$affich) { \$remp=\"!delete!\"; }\n   return (\$remp);\n}', 'meta', '-', NULL, '[french]Forme de ELSE de groupe_text / Test si le membre n\'appartient pas aux(x) groupe(s) et n\'affiche que le texte encadr&eacute; par no_groupe_textID(ID_group) ... !/!<br />Si no_groupe_ID est nul, la v&eacute;rification portera sur qualit&eacute; d\'anonyme<br />Syntaxe : no_groupe_text(), no_groupe_text(10) ou no_groupe_textID(\"gp1,gp2,gp3\") ... !/![/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!note!', 'function MM_note() {\n   return (\"!delete!\");\n}', 'meta', '-', NULL, '[french]Permet de stocker une note en ligne qui ne sera jamais affich&eacute;e !note! .... !/![/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!note_admin!', 'function MM_note_admin() {\n   global \$admin;\n\n   if (!\$admin)\n      return (\"!delete!\");\n   else\n      return(\"<b>nota</b> : \");\n}', 'meta', '-', NULL, '[french]Permet de stocker une note en ligne qui ne sera affich&eacute;e que pour les administrateurs !note_admin! .... !/![/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!/!', '!\\\\/!', 'meta', '-', NULL, '[french]Termine LES meta-mot ENCADRANTS (!groupe_text!, !note!, !note_admin!, ...) : le fonctionnement est assez similaire &agrave; [langue] ...[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!debugON!', 'function MM_debugON() {\n   global \$NPDS_debug, \$NPDS_debug_str, \$NPDS_debug_time, \$NPDS_debug_cycle;\n\n   \$NPDS_debug_cycle=1;\n   \$NPDS_debug=true;\n   \$NPDS_debug_str=\"<br />\";\n   \$NPDS_debug_time=getmicrotime();\n   return (\"\");\n}', 'meta', '-', NULL, '[french]Active le mode debug[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!debugOFF!', 'function MM_debugOFF() {\n   global \$NPDS_debug, \$NPDS_debug_str, \$NPDS_debug_time, \$NPDS_debug_cycle;\n\n   \$time_end = getmicrotime();\n   \$NPDS_debug_str.=\"=> !DebugOFF!<br /><b>=> exec time for meta-lang : \".round(\$time_end - \$NPDS_debug_time, 4).\" / cycle(s) : \$NPDS_debug_cycle</b><br />\";\n   \$NPDS_debug=false;\n   echo \$NPDS_debug_str;\n   return (\"\");\n}', 'meta', '-', NULL, '[french]D&eacute;sactive le mode debug[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('forum_all', 'function MM_forum_all() {\n   include_once(\"functions.php\");\n   global \$NPDS_Prefix;\n\n   \$rowQ1=Q_Select (\"SELECT * FROM \".\$NPDS_Prefix.\"catagories ORDER BY cat_id\", 3600);\n   \$Xcontent=@forum(\$rowQ1);\n   return (\$Xcontent);\n}', 'meta', '-', NULL, '[french]Affiche toutes les categories et tous les forums (en fonction des droits)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('forum_categorie', 'function MM_forum_categorie(\$arg) {\n   include_once(\"functions.php\");\n   global \$NPDS_Prefix;\n\n   \$arg = arg_filter(\$arg);\n   \$bid_tab=explode(\",\",\$arg); \$sql=\"\";\n   foreach(\$bid_tab as \$cat) {\n      \$sql.=\"cat_id=\'\$cat\' OR \";\n   }\n   \$sql=substr(\$sql,0,-4);\n   \$rowQ1=Q_Select (\"SELECT * FROM \".\$NPDS_Prefix.\"catagories WHERE \$sql\", 3600);\n   \$Xcontent=@forum(\$rowQ1);\n   return (\$Xcontent);\n}', 'meta', '-', NULL, '[french]affiche la (les) categorie(s) XX (en fonction des droits) / liste de categories : \"XX,YY,ZZ\" [/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('forum_message', 'function MM_forum_message() {\n   include_once(\"functions.php\");\n   global \$subscribe, \$user;\n\n   if ((\$subscribe) and (\$user)) {\n      \$colspanX=8;\n   } else {\n      \$colspanX=7;\n   }\n   if (!\$user) {\n      \$ibid=\"<tr align=\\\\\"left\\\\\" class=\\\\\"LIGNB\\\\\">\";\n      \$ibid.=\"<td colspan=\\\\\"\$colspanX\\\\\" align=\\\\\"center\\\\\" style=\\\\\"font-size: 10px;\\\\\">\".translate(\"Join us ! As a registered user, cool stuff like : forum\'subscribing, special forums (hidden, members ...), post and read status, ... are avaliable.\").\"</td></tr>\";\n   }\n   if ((\$subscribe) and (\$user)) {\n      \$ibid=\"<tr align=\\\\\"left\\\\\" class=\\\\\"LIGNB\\\\\">\";\n      \$ibid.=\"<td colspan=\\\\\"\$colspanX\\\\\" align=\\\\\"center\\\\\" style=\\\\\"font-size: 10px;\\\\\">\".translate(\"Check a forum and click on button for receive an Email when a new submission is made in it.\").\"</td></tr>\";\n   }\n   return (\$ibid);\n}', 'meta', '-', NULL, '[french]Affiche les messages en pied de forum (devenez membre, abonnement ...)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('forum_recherche', 'function MM_forum_recherche() {\n   include_once(\"functions.php\");\n\n   \$Xcontent=@searchblock();\n   return (\$Xcontent);\n}', 'meta', '-', NULL, '[french]Affiche la zone de saisie du moteur de recherche des forums[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('forum_icones', 'function MM_forum_icones() {\n   include_once(\"functions.php\");\n\n   if (\$ibid=theme_image(\"forum/icons/red_folder.gif\")) {\$imgtmpR=\$ibid;} else {\$imgtmpR=\"images/forum/icons/red_folder.gif\";}\n   if (\$ibid=theme_image(\"forum/icons/folder.gif\")) {\$imgtmp=\$ibid;} else {\$imgtmp=\"images/forum/icons/folder.gif\";}\n   \$ibid=\"<img src=\\\\\"\$imgtmpR\\\\\" border=\\\\\"\\\\\" alt=\\\\\"\\\\\" /> = \".translate(\"New Posts since your last visit.\").\"<br />\";\n   \$ibid.=\"<img src=\\\\\"\$imgtmp\\\\\" border=\\\\\"\\\\\" alt=\\\\\"\\\\\" /> = \".translate(\"No New Posts since your last visit.\");\n   return (\$ibid);\n}', 'meta', '-', NULL, '[french]Affiche les icones + legendes decrivant les marqueurs des forums[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('forum_subscribeON', 'function MM_forum_subscribeON() {\n   include_once(\"functions.php\");\n   global \$subscribe, \$user;\n\n   \$ibid=\"\";\n   if ((\$subscribe) and (\$user)) {\n      \$ibid=\"<form action=\\\\\"forum.php\\\\\" method=\\\\\"post\\\\\">\";\n      \$ibid.=\"<input type=\\\\\"hidden\\\\\" name=\\\\\"op\\\\\" value=\\\\\"maj_subscribe\\\\\">\";\n   }\n   return (\$ibid);\n}', 'meta', '-', NULL, '[french]Ouvre la FORM de gestion des abonnements (attention a l\'imbrication de FORM)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('forum_bouton_subscribe', 'function MM_forum_bouton_subscribe() {\n   include_once(\"functions.php\");\n   global \$subscribe, \$user;\n\n   if ((\$subscribe) and (\$user)) {\n      return (\"<td align=\\\\\"center\\\\\" width=\\\\\"5%\\\\\" class=\\\\\"HEADER\\\\\"><input class=\\\\\"BOUTON_STANDARD\\\\\" type=\\\\\"submit\\\\\" name=\\\\\"Xsub\\\\\" value=\\\\\"\".translate(\"Ok\").\"\\\\\"></td>\");\n   } else {\n      return (\"\");\n   }\n}', 'meta', '-', NULL, '[french]Affiche la colonne avec le bouton de gestion des abonnements[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('forum_subscribeOFF', 'function MM_forum_subscribeOFF() {\n   include_once(\"functions.php\");\n   global \$subscribe, \$user;\n\n   \$ibid=\"\";\n   if ((\$subscribe) and (\$user)) {\n      \$ibid=\"</form>\";\n   }\n   return (\$ibid);\n}', 'meta', '-', NULL, '[french]Ferme la FORM de gestion des abonnements (attention a l\'imbrication de FORM)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('forum_subfolder', 'function MM_forum_subfolder(\$arg) {\r\n\r\n   \$forum=arg_filter(\$arg);\r\n   \$content=sub_forum_folder(\$forum);\r\n   return(\$content);\r\n}', 'meta', '-', '', '[french]Renvoie le gif permettant de savoir si de nouveaux messages sont disponibles dans le forum X<br />Syntaxe : sub_folder(X) ou X est le num&eacute;ro du forum[/french][english][/english]', '1')");
   sql_query("INSERT INTO metalang VALUES ('insert_flash', 'function MM_insert_flash(\$name,\$width,\$height,\$bgcol) {\n   return (\"<object codebase=\\\\\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflas\n   classid=\\\\\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\\\\\"\n   h.cab#version=6,0,0,0\\\\\" width=\\\\\"\".\$width.\"\\\\\"\n   height=\\\\\"\".\$height.\"\\\\\"\n   id=\\\\\"\".\$name.\"\\\\\" align=\\\\\"middle\\\\\">\n \n   <param name=\\\\\"allowScriptAccess\\\\\"\n   value=\\\\\"sameDomain\\\\\" />\n \n   <param name=\\\\\"movie\\\\\"\n   value=\\\\\"flash/\".\$name.\"\\\\\" />\n \n   <param name=\\\\\"quality\\\\\" value=\\\\\"high\\\\\" />\n   <param name=\\\\\"bgcolor\\\\\"\n   value=\\\\\"\".\$bgcol.\"\\\\\" />\n\n   <embed src=\\\\\"flash/\".\$name.\"\\\\\"\n   quality=\\\\\"high\\\\\" bgcolor=\\\\\"\".\$bgcol.\"\\\\\"\n   width=\\\\\"\".\$width.\"\\\\\"\n   height=\\\\\"\".\$height.\"\\\\\"\n   name=\\\\\"\".\$name.\"\\\\\" align=\\\\\"middle\\\\\"\n   allowScriptAccess=\\\\\"sameDomain\\\\\"\n   type=\\\\\"application/x-shockwave-flash\\\\\"\n   pluginspage=\\\\\"http://www.macromedia.com/go/getflashplayer\\\\\" />\n\n   </object>\");\n}', 'meta', '-', NULL, '[french]Insert un fichier flash (.swf) se trouvant dans un dossier \"flash\" de la racine du site. Syntaxe : insert_flash (nom du fichier.swf, largeur, hauteur, couleur fond : #XXYYZZ).[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!mailadmin!', '\$cmd=\"<a href=\\\\\"mailto:\".anti_spam(\$GLOBALS[\'adminmail\']).\"\\\\\" class=\\\\\"NOIR\\\\\" target=\\\\\"_blank\\\\\">\".str_replace(\"@\",\"_\".translate(\"at\").\"_\",\$GLOBALS[\'adminmail\']).\"</a>\";', 'meta', '-', NULL, '[french]Affiche un lien vers l\'adresse mail de l\'administrateur.[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!login!', 'function MM_login() {\n   \$boxstuff  = \"<form action=\\\\\"user.php\\\\\" method=\\\\\"post\\\\\">\";\n   \$boxstuff .= translate(\"Nickname\").\"<br />\";\n   \$boxstuff .= \"<input class=\\\\\"TEXTBOX_STANDARD\\\\\" type=\\\\\"text\\\\\" name=\\\\\"uname\\\\\" size=\\\\\"12\\\\\" maxlength=\\\\\"25\\\\\"><br />\";\n   \$boxstuff .= translate(\"Password\").\"<br />\";\n   \$boxstuff .= \"<input class=\\\\\"TEXTBOX_STANDARD\\\\\" type=\\\\\"password\\\\\" name=\\\\\"pass\\\\\" size=\\\\\"12\\\\\" maxlength=\\\\\"20\\\\\"><br />\";\n   \$boxstuff .= \"<input type=\\\\\"hidden\\\\\" name=\\\\\"op\\\\\" value=\\\\\"login\\\\\">\";\n   \$boxstuff .= \"<input class=\\\\\"BOUTON_STANDARD\\\\\" type=\\\\\"submit\\\\\" value=\\\\\"\".translate(\"Submit\").\"\\\\\">\";\n   \$boxstuff .= \"</form>\";\n   return (\$boxstuff);\n}', 'meta', '-', NULL, '[french]Affiche les champs de connexion au site.[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!connexion!', '\$cmd=meta_lang(\"!login!\");', 'meta', '-', NULL, '[french]Alias de !login![/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!administration!', 'function MM_administration() {\n   global \$admin;\n   if (\$admin) {\n      return(\"<a href=\\\\\"admin.php\\\\\">\".translate(\"Administration Tools\").\"</a>\");\n   } else {\n      return(\"\");\n   }\n}', 'meta', '-', NULL, '[french]Affiche un lien vers l\'administration du site uniquement si l\'on est connect&eacute; en tant qu\'admin[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('admin_infos', 'function MM_admin_infos(\$arg) {\n   global \$NPDS_Prefix;\n\n   \$arg = arg_filter(\$arg);\n   \$rowQ1 = Q_select (\"SELECT url, email FROM \".\$NPDS_Prefix.\"authors where aid=\'\$arg\'\", 86400);\n   list(,\$myrow) = each(\$rowQ1);\n   if (isset(\$myrow[url])) {\n      \$auteur=\"<a href=\\\\\"\$myrow[url]\\\\\">\$arg</a>\";\n   } elseif (isset(\$myrow[email])) {\n      \$auteur=\"<a href=\\\\\"mailto:\$myrow[email]\\\\\">\$arg</a>\";\n   } else {\n      \$auteur=\$arg;\n   }\n   return (\$auteur);\n}', 'meta', '-', NULL, '[french]Affiche le Nom ou le WWW ou le Mail de l\'administrateur / syntaxe : admin_infos(nom_de_admin)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('theme_img', 'function MM_theme_img(\$arg) {\n   return (MM_img(\$arg));\n}', 'meta', '-', NULL, '[french]Localise l\'image et affiche une ressource de type &lt;img src= / syntaxe : theme_img(forum/onglet.gif)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!logo!', '\$cmd=\"<img src=\\\\\"\".\$GLOBALS[\'site_logo\'].\"\\\\\" border=\\\\\"0\\\\\" alt=\\\\\"\\\\\">\";', 'meta', '-', NULL, '[french]Affiche le logo du site (admin/preferences).[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('rotate_img', 'function MM_rotate_img(\$arg) {\r\n   mt_srand((double)microtime()*1000000);\r\n   \$arg = arg_filter(\$arg);\r\n   \$tab_img=explode(\",\",\$arg);\r\n\r\nif (count(\$tab_img)>1) {\r\n   \$imgnum = mt_rand(0, count(\$tab_img)-1);\r\n} else if (count(\$tab_img)==1) {\r\n   \$imgnum = 0;\r\n} else {\r\n   \$imgnum = -1;\r\n}\r\nif (\$imgnum!=-1) {\r\n   \$Xcontent=\"<img src=\\\\\"\".\$tab_img[\$imgnum].\"\\\\\" border=\\\\\"0\\\\\" alt=\\\\\"\".\$tab_img[\$imgnum].\"\\\\\" title=\\\\\"\".\$tab_img[\$imgnum].\"\\\\\" />\";\r\n}\r\n   return (\$Xcontent);\r\n}', 'meta', '-', NULL, '[french]Affiche une image al&eacute;atoire - les images de la liste sont s&eacute;par&eacute;e par une virgule / syntaxe rotate_img(\"http://www.npds.org/users_private/user/1.gif,http://www.npds.org/users_private/user/2.gif, ...\")[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!sql_nbREQ!', 'function MM_sql_nbREQ() {\r\n   global \$sql_nbREQ;\r\n\r\n   return (\"SQL REQ : \$sql_nbREQ\");\r\n}', 'meta', '-', NULL, '[french]Affiche le nombre de requ&ecirc;te SQL pour la page courante[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('comment_system', 'function MM_comment_system (\$file_name,\$topic) {\r\n\r\nglobal \$NPDS_Prefix,\$anonpost,\$moderate,\$admin,\$user;\r\nob_start();   \r\n   if (file_exists(\"modules/comments/\$file_name.conf.php\")) {\r\n      include (\"modules/comments/\$file_name.conf.php\");\r\n      include (\"modules/comments/comments.php\");\r\n   }\r\n   \$output = ob_get_contents();\r\nob_end_clean();\r\nreturn (\$output);\r\n}', 'meta', '-', '', '[french]Permet de mettre en oeuvre un système de commentaire complet / la mise en oeuvre n&eacute;cessite :<br /> - un fichier dans modules/comments/xxxx.conf.php de la même structure que les autres<br /> - un appel coh&eacute;rent avec la configuration de ce fichier<br /><br />L\'appel est du type : comments(\$file_name, \$topic) - exemple comment_system(edito,1) - le fichier s\'appel donc edito.conf.php[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('top_stories', 'function MM_top_stories (\$arg) {\r\n   \$lugar=1;\r\n   \$content=\"\";\r\n\r\n   \$arg = arg_filter(\$arg);\r\n\r\n   \$xtab=news_aff(\"libre\",\"order by counter DESC limit 0, \".\$arg*2,0,\$arg*2);\r\n   \$story_limit=0;\r\n   while ((\$story_limit<\$arg) and (\$story_limit<sizeof(\$xtab))) {\r\n      \$rowcolor = tablos();\r\n      list(\$sid, \$catid, \$aid, \$title, \$time, \$hometext, \$bodytext, \$comments, \$counter) = \$xtab[\$story_limit];\r\n      \$story_limit++;\r\n      if(\$counter>0) {\r\n        \$content.=\"<tr \$rowcolor><td>\$lugar: <a href=\\\\\"article.php?sid=\$sid\\\\\" class=\\\\\"noir\\\\\">\".aff_langue(\$title).\"</a></td><td align=\\\\\"right\\\\\">\".wrh(\$counter).\" \".translate(\"times\").\"</td></tr>\";\r\n         \$lugar++;\r\n     }\r\n   }\r\n   return(\$content);\r\n}', 'meta', '-', '', '[french]Affiche le titre et un lien sur les Top x articles / syntaxe : top_stories(x)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('top_commented_stories', 'function MM_top_commented_stories (\$arg) {\r\n   \$lugar=1;\r\n   \$content=\"\";\r\n   \$arg = arg_filter(\$arg);\r\n\r\n   \$xtab=news_aff(\"libre\",\"order by comments DESC  limit 0, \".\$arg*2,0,\$arg*2);\r\n   \$story_limit=0;\r\n   while ((\$story_limit<\$arg) and (\$story_limit<sizeof(\$xtab))) {\r\n      \$rowcolor = tablos();\r\n      list(\$sid, \$catid, \$aid, \$title, \$time, \$hometext, \$bodytext, \$comments) = \$xtab[\$story_limit];\r\n      \$story_limit++;\r\n      if(\$comments>0) {\r\n         \$content.=\"<tr \$rowcolor><td>\$lugar: <a href=\\\\\"article.php?sid=\$sid\\\\\" class=\\\\\"noir\\\\\">\".aff_langue(\$title).\"</a></td><td align=\\\\\"right\\\\\">\".wrh(\$comments).\"</td></tr>\";\r\n         \$lugar++;\r\n      }\r\n   }\r\n\r\n  return(\$content);\r\n}', 'meta', '-', '', '[french]Affiche le titre et un lien sur les Top x articles les plus comment&eacute;s / syntaxe : top_commented_stories(x)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('top_categories', 'function MM_top_categories(\$arg) {\r\n   global \$NPDS_Prefix;\r\n   \$lugar=1;\r\n   \$content=\"\";\r\n   \$arg = arg_filter(\$arg);\r\n\r\n   \$result = sql_query(\"select catid, title, counter from \".\$NPDS_Prefix.\"stories_cat order by counter DESC limit 0,\$arg\");\r\n   while (list(\$catid, \$title, \$counter) = sql_fetch_row(\$result)) {\r\n      \$rowcolor = tablos();\r\n      if (\$counter>0) {\r\n         \$content.=\"<tr \$rowcolor><td>\$lugar: <a href=\\\\\"index.php?op=newindex&catid=\$catid\\\\\" class=\\\\\"noir\\\\\">\".aff_langue(\$title).\"</a></td><td align=\\\\\"right\\\\\">\".wrh(\$counter).\"</td></tr>\";\r\n         \$lugar++;\r\n      }\r\n   }\r\n   sql_free_result(\$result);\r\n\r\n   return(\$content);\r\n}', 'meta', '-', '', '[french]Affiche le titre et un lien sur les Top x cat&eacute;gories des articles / syntaxe : top_categories(x)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('top_sections', 'function MM_top_sections (\$arg) {\r\n   global \$NPDS_Prefix;\r\n   \$lugar=1;\r\n   \$content=\"\";\r\n   \$arg = arg_filter(\$arg);\r\n\r\n   \$result = sql_query(\"select artid, title, counter from \".\$NPDS_Prefix.\"seccont order by counter DESC limit 0,\$arg\");\r\n   while (list(\$artid, \$title, \$counter) = sql_fetch_row(\$result)) {\r\n      \$rowcolor = tablos();\r\n      \$content.=\"<tr \$rowcolor><td>\$lugar: <a href=\\\\\"sections.php?op=viewarticle&artid=\$artid\\\\\" class=\\\\\"noir\\\\\">\".aff_langue(\$title).\"</a></td><td align=\\\\\"right\\\\\">\".wrh(\$counter).\" \".translate(\"times\").\"</td></tr>\";\r\n      \$lugar++;\r\n   }\r\n   sql_free_result(\$result);\r\n  \r\n   return(\$content);\r\n}', 'meta', '-', '', '[french]Affiche le titre et un lien sur les Top x articles des rubriques / syntaxe : top_sections(x)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('top_reviews', 'function MM_top_reviews (\$arg) {\r\n   global \$NPDS_Prefix;\r\n   \$lugar=1;\r\n   \$content=\"\";\r\n   \$arg = arg_filter(\$arg);\r\n\r\n   \$result = sql_query(\"select id, title, hits from reviews order by hits DESC limit 0,\$arg\");\r\n   while (list(\$id, \$title, \$hits) = sql_fetch_row(\$result)) {\r\n      \$rowcolor = tablos();\r\n      if (\$hits>0) {\r\n         \$content.= \"<tr \$rowcolor><td>\$lugar: <a href=\\\\\"reviews.php?op=showcontent&id=\$id\\\\\" class=\\\\\"noir\\\\\">\$title</a></td><td align=right>\".wrh(\$hits).\" \".translate(\"times\").\"</td></tr>\";\r\n         \$lugar++;\r\n      }\r\n   }\r\n   sql_free_result(\$result);\r\n\r\n   return(\$content);\r\n}', 'meta', '-', '', '[french]Affiche le titre et un lien sur les Top x des critiques / syntaxe : top_reviews(x)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('top_authors', 'function MM_top_authors (\$arg) {\r\n   global \$NPDS_Prefix;\r\n   \$lugar=1;\r\n   \$content=\"\";\r\n   \$arg = arg_filter(\$arg);\r\n\r\n   \$result = sql_query(\"select aid, counter from authors order by counter DESC limit 0,\$arg\");\r\n   while (list(\$aid, \$counter) = sql_fetch_row(\$result)) {\r\n      \$rowcolor = tablos();\r\n      if (\$counter>0) {\r\n         \$content.=\"<tr \$rowcolor><td>\$lugar: <a href=\\\\\"search.php?query=&author=\$aid\\\\\" class=\\\\\"noir\\\\\">\$aid</a></td><td align=\\\\\"right\\\\\">\".wrh(\$counter).\"</td></tr>\";\r\n         \$lugar++;\r\n      }\r\n   }\r\n   sql_free_result(\$result);\r\n\r\n   return(\$content);\r\n}', 'meta', '-', '', '[french]Affiche le titre et un lien sur les Top x des auteurs / syntaxe : top_authors(x)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('top_polls', 'function MM_top_polls (\$arg) {\r\n   global \$NPDS_Prefix;\r\n   \$lugar=1;\r\n   \$content=\"\";\r\n   \$arg = arg_filter(\$arg);\r\n\r\n   \$result = sql_query(\"select pollID, pollTitle, voters from poll_desc order by voters DESC limit 0,\$arg\");\r\n   while (list(\$pollID, \$pollTitle, \$voters) = sql_fetch_row(\$result)) {\r\n      if (\$voters>0) {\r\n         \$rowcolor = tablos();\r\n         \$content.=\"<tr \$rowcolor><td>\$lugar: <a href=\\\\\"pollBooth.php?op=results&pollID=\$pollID\\\\\" class=\\\\\"noir\\\\\">\".aff_langue(\$pollTitle).\"</a></td><td align=\\\\\"right\\\\\">\".wrh(\$voters).\"</td></tr>\";\r\n         \$lugar++;\r\n      }\r\n   }\r\n   sql_free_result(\$result);\r\n\r\n   return(\$content);\r\n}', 'meta', '-', '', '[french]Affiche le titre et un lien sur les Top x des sondages / syntaxe : top_polls(x)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('top_storie_authors', 'function MM_top_storie_authors (\$arg) {\r\n   global \$NPDS_Prefix;\r\n   \$lugar=1;\r\n   \$content=\"\";\r\n   \$arg = arg_filter(\$arg);\r\n\r\n   \$result = sql_query(\"select uname, counter from users order by counter DESC limit 0,\$arg\");\r\n   while (list(\$uname, \$counter) = sql_fetch_row(\$result)) {\r\n      if (\$counter>0) {\r\n         \$rowcolor = tablos();\r\n         \$content.=\"<tr \$rowcolor><td>\$lugar: <a href=\\\\\"user.php?op=userinfo&uname=\$uname\\\\\" class=\\\\\"noir\\\\\">\$uname</a></td><td align=\\\\\"right\\\\\">\".wrh(\$counter).\"</td></tr>\";\r\n         \$lugar++;\r\n      }\r\n   }\r\n   sql_free_result(\$result);\r\n\r\n   return(\$content);\r\n}', 'meta', '-', '', '[french]Affiche le titre et un lien sur les Top x des auteurs de news (membres) / syntaxe : top_storie_authors(x)[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('^', '', 'docu', '-', NULL, '[french]Dans un texte quelconque, ^ &agrave; la fin d&#39;un mot permet de le prot&eacute;ger contre meta-lang / Ex : Dev Dev^ ne donne pas un r&eacute;sultat identique[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!N_publicateur!', '', 'them', '-', NULL, '[french]Sera remplac&eacute; par le nom de l&#39;administrateur ayant publi&eacute; l&#39;article / actif dans index-news.html et detail-news.html[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!N_emetteur!', '', 'them', '-', NULL, '[french]Sera remplac&eacute; par le nom de l&#39;auteur de l&#39;article / actif dans index-news.html et detail-news.html[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!N_date!', '', 'them', '-', NULL, '[french]Sera remplac&eacute; par la date de publication de l&#39;article / actif dans index-news.html et detail-news.html[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!N_titre!', '', 'them', '-', NULL, '[french]Sera remplac&eacute; par le titre de l&#39;article / actif dans index-news.html et detail-news.html[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!N_texte!', '', 'them', '-', NULL, '[french]Sera remplac&eacute; par le texte de l&#39;article / actif dans index-news.html et detail-news.html[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!N_id!', '', 'them', '-', NULL, '[french]Sera remplac&eacute; par le num&eacute;ro de l&#39;article / actif dans index-news.html et detail-news.html[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!N_sujet!', '', 'them', '-', NULL, '[french]Sera remplac&eacute; par un lien HTML et l&#39;image du sujet de l&#39;article / actif dans index-news.html et detail-news.html[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!N_note!', '', 'them', '-', NULL, '[french]Sera remplac&eacute; par le de la note de l&#39;article si elle existe / actif dans index-news.html et detail-news.html[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!N_nb_lecture!', '', 'them', '-', NULL, '[french]Sera remplac&eacute; par le nombre de lecture effective de l&#39;article / actif dans index-news.html et detail-news.html[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!N_suite!', '', 'them', '-', NULL, '[french]Sera remplac&eacute; par le lien HTML permettant de lire la suite de l&#39;article / actif dans index-news.html[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!N_previous_article!', '', 'them', '-', NULL, '[french]Sera remplac&eacute; par le lien HTML pointant sur l&#39;article pr&eacute;c&eacute;dent / actif detail-news.html[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!N_next_article!', '', 'them', '-', NULL, '[french]Sera remplac&eacute; par le lien HTML sur l&#39;article suivant / actif dans detail-news.html[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!B_title!', '', 'them', '-', NULL, '[french]Sera remplac&eacute; par le titre du bloc / actif dans bloc.html[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!B_content!', '', 'them', '-', NULL, '[french]Sera remplac&eacute; par par le contenu du bloc / actif dans bloc.html[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!B_class_title!', '', 'them', '-', NULL, '[french]Sera remplac&eacute; par la class CSS du titre - voir le gestionnaire de bloc de NPDS / actif dans bloc.html[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!B_class_content!', '', 'them', '-', NULL, '[french]Sera remplac&eacute; par la class CSS du contenu - voir le gestionnaire de bloc de NPDS  / actif dans bloc.html[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!editorial_content!', '', 'them', '-', NULL, '[french]Sera remplac&eacute; par le contenu de l&#39;Edito / actif que si editorial.html existe dans votre theme[/french]', '1')");
   sql_query("INSERT INTO metalang VALUES ('!PHP!', '', 'them', '-', NULL, '[french]Int&eacute;gration de code PHP \"noy&eacute;\" dans vos fichiers html de th&egrave;mes :<br />\r\n=> !PHP! commentaire vous permettant de trouver le php noy&eacute; -> in fine sera remplac&eacute; par \"\"<br />\r\n=> &lt;!--meta  doit pr&eacute;c&eacute;der votre code php -> in fine sera remplac&eacute; par \"\"<br />\r\n   => meta-->   doit suivre votre code php -> in fine sera remplac&eacute; par \"\"<br />\r\n<br />\r\n&nbsp;Exemple :<br />\r\n&nbsp;&nbsp;!PHP!&lt;!--meta<br />\r\n&nbsp;&nbsp;&lt;?PHP<br />\r\n&nbsp;&nbsp;&nbsp;&nbsp;global \$cookie;<br />\r\n&nbsp;&nbsp;&nbsp;&nbsp;\$username = \$cookie[1];<br />\r\n&nbsp;&nbsp;&nbsp;&nbsp;if (\$username == \"\") {<br />\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo \"Create an account\";<br />\r\n&nbsp;&nbsp;&nbsp;&nbsp;} else {<br />\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo \"Welcome : \$username\";<br />\r\n&nbsp;&nbsp;&nbsp;&nbsp;}<br />\r\n&nbsp;&nbsp;?><br />\r\n&nbsp;&nbsp;meta-->[/french]', '1')");
   echo "<br /><br />";

   // Migrate + Delete pollcomments
   include ("modules/comments/pollBoth.conf.php");
   $result=sql_query("SELECT tid, pollId, date, name, host_name, comment FROM pollcomments ORDER by tid ASC");
   echo "<b>Migration Commentaires table pollcomments => Posts :</b><ul>";
   while(list($tid, $pid, $date, $name, $host_name, $comment)=sql_fetch_row($result)) {
      // le sondage existe ?
      list($poll_ok)=sql_fetch_row(sql_query("SELECT pollId from poll_desc where pollID='$pid'"));
      if ($poll_ok) {
         // le membre existe - sinon anonyme
         list($member_ok)=sql_fetch_row(sql_query("SELECT uid from users where uname='$name'"));
         if (!$member_ok) $member_ok=1; // <= anonyme
         // MAJ de la table POST
         $sql = "INSERT INTO posts (post_idH, topic_id, image, forum_id, poster_id, post_text, post_time, poster_ip, post_aff)
         VALUES ('0', '$pid', '', '$forum', '$member_ok', '".addslashes($comment)."', '$date', '$host_name', '1')";
         @sql_query($sql);
         echo "<li>PID poll : $pid - Date : $date</li>";
         @sql_query("UPDATE users_status SET posts=posts+1 WHERE (uid='$uid')");
      }
      @sql_query("DELETE FROM pollcomments WHERE tid='$tid'");
   }
   // ERASE table pollcomments
   @sql_query("DROP TABLE pollcomments");
   echo "</ul><br /><br />";

   // Migrate + Delete reviews_comments
   include ("modules/comments/reviews.conf.php");
   $result=sql_query("SELECT cid, rid, userid, date, comments, score FROM reviews_comments ORDER by cid ASC");
   echo "<b>Migration Commentaires table reviews_comments => Posts :</b><ul>";
   while(list($cid, $rid, $name, $date, $comments, $score)=sql_fetch_row($result)) {
      // la critique existe ?
      list($review_ok)=sql_fetch_row(sql_query("SELECT id from reviews where id='$rid'"));
      if ($review_ok) {
         // le membre existe - sinon anonyme
         list($member_ok)=sql_fetch_row(sql_query("SELECT uid from users where uname='$name'"));
         if (!$member_ok) $member_ok=1; // <= anonyme
         $Xcomment="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"ligna\"><tr><td><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\" class=\"lignb\"><tr class=\"ligna\"><td width=\"40%\" align=\"center\"><b></b></td><td>&nbsp;</td></tr><tr class=\"ligna\"><td>Note de ce produit : </td><td><b>$score&nbsp;</b></td></tr><tr class=\"ligna\"><td>Votre Commentaire : </td><td><b>".addslashes($comments)."&nbsp;</b></td></tr><tr><td align=\"center\" colspan=\"2\"><br /></td></tr></table></td></tr></table>";
         // MAJ de la table POST
         $sql = "INSERT INTO posts (post_idH, topic_id, image, forum_id, poster_id, post_text, post_time, poster_ip, post_aff)
         VALUES ('0', '$rid', '', '$forum', '$member_ok', '$Xcomment', '$date', '', '1')";
         @sql_query($sql);
         echo "<li>RID review : $rid - Date : $date</li>";
         @sql_query("UPDATE users_status SET posts=posts+1 WHERE (uid='$uid')");
      }
      @sql_query("DELETE FROM reviews_comments WHERE tid='$cid'");
   }
   // ERASE table pollcomments
   @sql_query("DROP TABLE reviews_comments");
   echo "</ul><br /><br />";

   // Create admin files for f-manager
   $result=sql_query("select aid, radminfilem,radminsuper from ".$NPDS_Prefix."authors");
   echo "<b>Cr&eacute;ation des fichiers pour F-manager";
   while (list($aid, $radminfilem, $radminsuper) = sql_fetch_row($result)) {
      if ($radminfilem or $radminsuper)
         @copy("modules/f-manager/users/modele.admin.conf.php","modules/f-manager/users/".strtolower($aid).".conf.php");
   }
   echo "<br /><br />";

   SC_Clean();
   echo "<span class=\"ROUGE\"></li></ul>";

   echo ".: Installation termin&eacute;e / Install Ended :.";
   echo "<br /><br />.: <b>PENSEZ</b> à supprimer le fichier sable-evolution.php de la racine de votre site :.<br />.: <b>DEL</b> the sable-evolution.php file from the root of your web-site :.";
include("footer.php");
?>