function indexAuthorities()
 {
     global $msg, $dbh, $charset, $PMBusername;
     global $include_path;
     if (SESSrights & ADMINISTRATION_AUTH) {
         //remise a zero de la table au début
         pmb_mysql_query("truncate authorities_words_global_index", $dbh);
         pmb_mysql_query("truncate authorities_fields_global_index", $dbh);
         //AUTHORS
         $result .= "<h3>" . htmlentities($msg["nettoyage_reindex_authors"], ENT_QUOTES, $charset) . "</h3>";
         $query = pmb_mysql_query("SELECT author_id as id from authors", $dbh);
         if (pmb_mysql_num_rows($query)) {
             $indexation_authority = new indexation_authority($include_path . "/indexation/authorities/authors/champs_base.xml", "authorities", AUT_TABLE_AUTHORS);
             while ($row = pmb_mysql_fetch_object($query)) {
                 $indexation_authority->maj($row->id);
             }
             pmb_mysql_free_result($query);
         }
         $elts = pmb_mysql_query("SELECT count(1) FROM authors", $dbh);
         $count = pmb_mysql_result($elts, 0, 0);
         $result .= "" . htmlentities($msg["nettoyage_reindex_authors"], ENT_QUOTES, $charset) . " {$count} " . htmlentities($msg["nettoyage_res_reindex_authors"], ENT_QUOTES, $charset);
         //PUBLISHERS
         $result .= "<h3>" . htmlentities($msg["nettoyage_reindex_publishers"], ENT_QUOTES, $charset) . "</h3>";
         $query = pmb_mysql_query("SELECT ed_id as id from publishers", $dbh);
         if (pmb_mysql_num_rows($query)) {
             $indexation_authority = new indexation_authority($include_path . "/indexation/authorities/publishers/champs_base.xml", "authorities", AUT_TABLE_PUBLISHERS);
             while ($row = pmb_mysql_fetch_object($query)) {
                 $indexation_authority->maj($row->id);
             }
             pmb_mysql_free_result($query);
         }
         $elts = pmb_mysql_query("SELECT count(1) FROM publishers", $dbh);
         $count = pmb_mysql_result($elts, 0, 0);
         $result .= "" . htmlentities($msg["nettoyage_reindex_publishers"], ENT_QUOTES, $charset) . " {$count} " . htmlentities($msg["nettoyage_res_reindex_publishers"], ENT_QUOTES, $charset);
         //CATEGORIES
         $result .= "<h3>" . htmlentities($msg["nettoyage_reindex_categories"], ENT_QUOTES, $charset) . "</h3>";
         $req = "select distinct num_noeud as id from categories";
         $query = pmb_mysql_query($req, $dbh);
         if (pmb_mysql_num_rows($query)) {
             $indexation_authority = new indexation_authority($include_path . "/indexation/authorities/categories/champs_base.xml", "authorities", AUT_TABLE_CATEG);
             while ($row = pmb_mysql_fetch_object($query)) {
                 $indexation_authority->maj($row->id);
             }
             pmb_mysql_free_result($query);
         }
         $elts = pmb_mysql_query("SELECT count(distinct num_noeud) FROM categories", $dbh);
         $count = pmb_mysql_result($elts, 0, 0);
         $result .= "" . htmlentities($msg["nettoyage_reindex_categories"], ENT_QUOTES, $charset) . " {$count} " . htmlentities($msg["nettoyage_res_reindex_categories"], ENT_QUOTES, $charset);
         //COLLECTIONS
         $result .= "<h3>" . htmlentities($msg["nettoyage_reindex_collections"], ENT_QUOTES, $charset) . "</h3>";
         $query = pmb_mysql_query("SELECT collection_id as id from collections", $dbh);
         if (pmb_mysql_num_rows($query)) {
             $indexation_authority = new indexation_authority($include_path . "/indexation/authorities/collections/champs_base.xml", "authorities", AUT_TABLE_COLLECTIONS);
             while ($row = pmb_mysql_fetch_object($query)) {
                 $indexation_authority->maj($row->id);
             }
             pmb_mysql_free_result($query);
         }
         $elts = pmb_mysql_query("SELECT count(1) FROM collections", $dbh);
         $count = pmb_mysql_result($elts, 0, 0);
         $result .= "" . htmlentities($msg["nettoyage_reindex_collections"], ENT_QUOTES, $charset) . " {$count} " . htmlentities($msg["nettoyage_res_reindex_collections"], ENT_QUOTES, $charset);
         //SUBCOLLECTIONS
         $result .= "<h3>" . htmlentities($msg["nettoyage_reindex_sub_collections"], ENT_QUOTES, $charset) . "</h3>";
         $query = pmb_mysql_query("SELECT sub_coll_id as id from sub_collections", $dbh);
         if (pmb_mysql_num_rows($query)) {
             $indexation_authority = new indexation_authority($include_path . "/indexation/authorities/subcollections/champs_base.xml", "authorities", AUT_TABLE_SUB_COLLECTIONS);
             while ($row = pmb_mysql_fetch_object($query)) {
                 $indexation_authority->maj($row->id);
             }
             pmb_mysql_free_result($query);
         }
         $elts = pmb_mysql_query("SELECT count(1) FROM sub_collections", $dbh);
         $count = pmb_mysql_result($elts, 0, 0);
         $result .= "" . htmlentities($msg["nettoyage_reindex_sub_collections"], ENT_QUOTES, $charset) . " {$count} " . htmlentities($msg["nettoyage_res_reindex_sub_collections"], ENT_QUOTES, $charset);
         //SERIES
         $result .= "<h3>" . htmlentities($msg["nettoyage_reindex_series"], ENT_QUOTES, $charset) . "</h3>";
         $query = pmb_mysql_query("SELECT serie_id as id from series", $dbh);
         if (pmb_mysql_num_rows($query)) {
             $indexation_authority = new indexation_authority($include_path . "/indexation/authorities/series/champs_base.xml", "authorities", AUT_TABLE_SERIES);
             while ($row = pmb_mysql_fetch_object($query)) {
                 $indexation_authority->maj($row->id);
             }
             pmb_mysql_free_result($query);
         }
         $elts = pmb_mysql_query("SELECT count(1) FROM series", $dbh);
         $count = pmb_mysql_result($elts, 0, 0);
         $result .= "" . htmlentities($msg["nettoyage_reindex_series"], ENT_QUOTES, $charset) . " {$count} " . htmlentities($msg["nettoyage_res_reindex_series"], ENT_QUOTES, $charset);
         //DEWEY
         $result .= "<h3>" . htmlentities($msg["nettoyage_reindex_indexint"], ENT_QUOTES, $charset) . "</h3>";
         $query = pmb_mysql_query("SELECT indexint_id as id from indexint", $dbh);
         if (pmb_mysql_num_rows($query)) {
             $indexation_authority = new indexation_authority($include_path . "/indexation/authorities/indexint/champs_base.xml", "authorities", AUT_TABLE_INDEXINT);
             while ($row = pmb_mysql_fetch_object($query)) {
                 $indexation_authority->maj($row->id);
             }
             pmb_mysql_free_result($query);
         }
         $elts = pmb_mysql_query("SELECT count(1) FROM indexint", $dbh);
         $count = pmb_mysql_result($elts, 0, 0);
         $result .= "" . htmlentities($msg["nettoyage_reindex_indexint"], ENT_QUOTES, $charset) . " {$count} " . htmlentities($msg["nettoyage_res_reindex_indexint"], ENT_QUOTES, $charset);
         //TITRES_UNIFORMES
         $result .= "<h3>" . htmlentities($msg["nettoyage_reindex_titres_uniformes"], ENT_QUOTES, $charset) . "</h3>";
         $query = pmb_mysql_query("SELECT tu_id as id from titres_uniformes", $dbh);
         if (pmb_mysql_num_rows($query)) {
             $indexation_authority = new indexation_authority($include_path . "/indexation/authorities/titres_uniformes/champs_base.xml", "authorities", AUT_TABLE_TITRES_UNIFORMES);
             while ($row = pmb_mysql_fetch_object($query)) {
                 $indexation_authority->maj($row->id);
             }
             pmb_mysql_free_result($query);
         }
         $elts = pmb_mysql_query("SELECT count(1) FROM titres_uniformes", $dbh);
         $count = pmb_mysql_result($elts, 0, 0);
         $result .= "" . htmlentities($msg["nettoyage_reindex_titres_uniformes"], ENT_QUOTES, $charset) . " {$count} " . htmlentities($msg["nettoyage_res_reindex_titres_uniformes"], ENT_QUOTES, $charset);
         //AUTORITES PERSO
         $result .= "<h3>" . htmlentities($msg["nettoyage_reindex_authperso"], ENT_QUOTES, $charset) . "</h3>";
         $query = pmb_mysql_query("SELECT id_authperso_authority as id, authperso_authority_authperso_num from authperso_authorities", $dbh);
         if (pmb_mysql_num_rows($query)) {
             $id_authperso = 0;
             while ($row = pmb_mysql_fetch_object($query)) {
                 if (!$id_authperso || $id_authperso != $row->authperso_authority_authperso_num) {
                     $indexation_authperso = new indexation_authperso($include_path . "/indexation/authorities/authperso/champs_base.xml", "authorities", AUT_TABLE_AUTHPERSO, $row->authperso_authority_authperso_num);
                     $id_authperso = $row->authperso_authority_authperso_num;
                 }
                 $indexation_authperso->maj($row->id);
             }
             pmb_mysql_free_result($query);
         }
         $elts = pmb_mysql_query("SELECT count(1) FROM authperso_authorities", $dbh);
         $count = pmb_mysql_result($elts, 0, 0);
         $result .= "" . htmlentities($msg["nettoyage_reindex_authperso"], ENT_QUOTES, $charset) . " {$count} " . htmlentities($msg["nettoyage_res_reindex_authperso"], ENT_QUOTES, $charset);
     } else {
         $result .= sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername);
     }
     return $result;
 }
 function update_global_index($id)
 {
     global $dbh;
     global $include_path;
     $p_perso = new custom_parametres_perso("authperso", "authperso", $this->id);
     $mots_perso = $p_perso->get_fields_recherche($id);
     if ($mots_perso) {
         $infos_global .= $mots_perso . ' ';
         $infos_global_index .= strip_empty_words($mots_perso) . ' ';
     }
     $req = "update authperso_authorities set authperso_infos_global='" . addslashes($infos_global) . "', authperso_index_infos_global='" . addslashes(' ' . $infos_global_index) . "' where id_authperso_authority={$id}";
     pmb_mysql_query($req, $dbh);
     $indexation_authority = new indexation_authperso($include_path . "/indexation/authorities/authperso/champs_base.xml", "authorities", AUT_TABLE_AUTHPERSO, $this->id);
     $indexation_authority->maj($id);
 }
         // définition de l'état de la jauge
         $state = floor($start / ($count / $jauge_size));
         // mise à jour de l'affichage de la jauge
         print "<table border='0' align='center' width='{$jauge_size}' cellpadding='0'><tr><td class='jauge'>";
         print "<img src='../../images/jauge.png' width='{$state}' height='16'></td></tr></table>";
         // calcul pourcentage avancement
         $percent = floor($start / $count * 100);
         // affichage du % d'avancement et de l'état
         print "<div align='center'>{$percent}%</div>";
         $id_authperso = 0;
         while ($row = pmb_mysql_fetch_object($query)) {
             if (!$id_authperso || $id_authperso != $row->authperso_authority_authperso_num) {
                 $indexation_authperso = new indexation_authperso($include_path . "/indexation/authorities/authperso/champs_base.xml", "authorities", AUT_TABLE_AUTHPERSO, $row->authperso_authority_authperso_num);
                 $id_authperso = $row->authperso_authority_authperso_num;
             }
             $indexation_authperso->maj($row->id);
         }
         pmb_mysql_free_result($query);
         $next = $start + $lot;
         print "\n\t\t\t<form class='form-{$current_module}' name='current_state' action='./clean.php' method='post'>\n\t\t\t<input type='hidden' name='v_state' value=\"" . urlencode($v_state) . "\">\n\t\t\t<input type='hidden' name='spec' value=\"{$spec}\">\n\t\t\t<input type='hidden' name='start' value=\"{$next}\">\n\t\t\t<input type='hidden' name='count' value=\"{$count}\">\n\t\t\t<input type='hidden' name='index_quoi' value=\"AUTHPERSO\">\n\t\t\t</form>\n\t\t\t<script type=\"text/javascript\"><!--\n\t\t\tsetTimeout(\"document.forms['current_state'].submit()\",1000);\n\t\t\t-->\n\t\t\t</script>";
     } else {
         // mise à jour de l'affichage de la jauge
         print "<table border='0' align='center' width='{$table_size}' cellpadding='0'><tr><td class='jauge'>";
         print "<img src='../../images/jauge.png' width='{$jauge_size}' height='16'></td></tr></table>";
         print "<div align='center'>100%</div>";
         $v_state .= "<br /><img src=../../images/d.gif hspace=3>" . htmlentities($msg["nettoyage_reindex_authperso"], ENT_QUOTES, $charset) . " {$count} " . htmlentities($msg["nettoyage_res_reindex_authperso"], ENT_QUOTES, $charset);
         print "\n\t\t\t<form class='form-{$current_module}' name='current_state' action='./clean.php' method='post'>\n\t\t\t<input type='hidden' name='v_state' value=\"" . urlencode($v_state) . "\">\n\t\t\t<input type='hidden' name='spec' value=\"{$spec}\">\n\t\t\t<input type='hidden' name='start' value='0'>\n\t\t\t<input type='hidden' name='count' value='0'>\n\t\t\t<input type='hidden' name='index_quoi' value=\"FINI\">\n\t\t\t</form>\n\t\t\t<script type=\"text/javascript\"><!--\n\t\t\tsetTimeout(\"document.forms['current_state'].submit()\",1000);\n\t\t\t-->\n\t\t\t</script>";
     }
     break;
 case 'FINI':
     $spec = $spec - INDEX_AUTHORITIES;