Пример #1
0
 public function duplicate($recursive, $num_parent = 0)
 {
     global $dbh;
     if (!$num_parent) {
         $num_parent = $this->num_parent;
     }
     //on place la nouvelle rubrique à la fin par défaut
     $query = "SELECT id_section FROM cms_sections WHERE section_num_parent=" . addslashes($num_parent);
     $result = pmb_mysql_query($query, $dbh);
     if ($result) {
         $order = ",section_order = '" . (pmb_mysql_num_rows($result) + 1) . "' ";
     } else {
         $order = ",section_order = 1";
     }
     $insert = "insert into cms_sections set\r\n\t\tsection_title = '" . addslashes($this->title) . "',\r\n\t\tsection_resume = '" . addslashes($this->resume) . "',\n\t\tsection_logo = '" . addslashes($this->logo->data) . "',\r\n\t\tsection_publication_state ='" . addslashes($this->publication_state) . "',\r\n\t\tsection_start_date = '" . addslashes($this->start_date) . "',\r\n\t\tsection_end_date = '" . addslashes($this->end_date) . "',\r\n\t\tsection_num_parent = '" . addslashes($num_parent) . "' ,\r\n\t\tsection_num_type = '" . $this->num_type . "' ,\r\n\t\tsection_creation_date=sysdate() " . $order;
     pmb_mysql_query($insert, $dbh);
     $id = pmb_mysql_insert_id();
     //au tour des descripteurs...
     for ($i = 0; $i < count($this->descriptors); $i++) {
         $rqt = "insert into cms_sections_descriptors set num_section = '" . $id . "', num_noeud = '" . $this->descriptors[$i] . "',section_descriptor_order='" . $i . "'";
         pmb_mysql_query($rqt, $dbh);
     }
     //on crée la nouvelle instance
     $new_section = new cms_section($id);
     //enfin les éléments du type de contenu
     $types = new cms_editorial_types("section");
     $types->duplicate_type_form($this->num_type, $id, $this->id);
     $new_section->maj_indexation();
     $new_section->documents_linked = $this->documents_linked;
     $new_section->save_documents();
     //audit
     audit::insert_creation(AUDIT_EDITORIAL_SECTION, $id);
     if ($recursive) {
         //on duplique les rubriques enfants
         $query = "select id_section from cms_sections where section_num_parent = " . $this->id . " order by section_order";
         $result = pmb_mysql_query($query, $dbh);
         if ($result && pmb_mysql_num_rows($result)) {
             while ($row = pmb_mysql_fetch_object($result)) {
                 $child = new cms_section($row->id_section);
                 $child->duplicate($recursive, $id);
             }
         }
         //on duplique les articles enfants
         $query = "select id_article from cms_articles where num_section = " . $this->id . " order by article_order";
         $result = pmb_mysql_query($query, $dbh);
         if ($result && pmb_mysql_num_rows($result)) {
             while ($row = pmb_mysql_fetch_object($result)) {
                 $article = new cms_article($row->id_article);
                 $article->duplicate($id);
             }
         }
     }
 }
Пример #2
0
        }
        $state .= "px";
        // mise à jour de l'affichage de la jauge
        print "<table border='0' align='center' width='{$jauge_size}' cellpadding='0'><tr><td class='jauge' width='100%'>";
        print "<img src='../../images/jauge.png' width='{$state}' height='16px'></td></tr></table>";
        // calcul pourcentage avancement
        $percent = floor(($start + $start_2) / $count * 100);
        if ($percent > 100) {
            $percent = 50;
        }
        // affichage du % d'avancement et de l'état
        print "<div align='center'>{$percent}%</div>";
        while ($row = mysql_fetch_assoc($query)) {
            // permet de charger la bonne langue, mot vide...
            $section = new cms_section($row['id_section']);
            $info = $section->maj_indexation();
        }
        mysql_free_result($query);
        $next = $start + $lot;
        print "\n\t\t<form class='form-{$current_module}' name='current_state' action='./clean.php' method='post'>\n\t\t<input type='hidden' name='v_state' value=\"" . urlencode($v_state) . "\">\n\t\t<input type='hidden' name='spec' value=\"{$spec}\">\n\t\t<input type='hidden' name='start' value=\"{$start}\">\n\t\t<input type='hidden' name='start_2' value=\"{$next}\">\n\t\t<input type='hidden' name='count' value=\"{$count}\">\n\t\t</form>\n\t\t<script type=\"text/javascript\"><!--\n\t\tsetTimeout(\"document.forms['current_state'].submit()\",1000);\n\t\t-->\n\t\t</script>";
    } else {
        $spec = $spec - INDEX_CMS;
        $not = mysql_query("SELECT 1 FROM cms_editorial_words_global_index group by num_obj,type", $dbh);
        $compte = mysql_num_rows($not);
        $v_state .= "<br /><img src=../../images/d.gif hspace=3>" . htmlentities($msg["nettoyage_reindex_cms"], ENT_QUOTES, $charset) . " :";
        $v_state .= $compte . " " . htmlentities($msg["nettoyage_res_reindex_cms"], ENT_QUOTES, $charset);
        print "\n\t\t\t<form class='form-{$current_module}' name='process_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</form>\n\t\t\t<script type=\"text/javascript\"><!--\n\t\t\t\tdocument.forms['process_state'].submit();\n\t\t\t\t-->\n\t\t\t</script>";
        mysql_query("ALTER TABLE cms_editorial_words_global_index ENABLE KEYS", $dbh);
        mysql_query("ALTER TABLE cms_editorial_fields_global_index ENABLE KEYS", $dbh);
    }
}
Пример #3
0
 function cleanCMS()
 {
     global $msg, $dbh, $charset, $PMBusername;
     if (SESSrights & ADMINISTRATION_AUTH) {
         $result .= "<h3>" . htmlentities($msg["nettoyage_reindex_cms"], ENT_QUOTES, $charset) . "</h3>";
         //remise a zero de la table au début
         pmb_mysql_query("TRUNCATE cms_editorial_words_global_index", $dbh);
         pmb_mysql_query("ALTER TABLE cms_editorial_words_global_index DISABLE KEYS", $dbh);
         pmb_mysql_query("TRUNCATE cms_editorial_fields_global_index", $dbh);
         pmb_mysql_query("ALTER TABLE cms_editorial_fields_global_index DISABLE KEYS", $dbh);
         $query = "select id_article from cms_articles order by id_article";
         $articles = pmb_mysql_query($query, $dbh);
         if (pmb_mysql_num_rows($articles)) {
             while ($row = pmb_mysql_fetch_object($articles)) {
                 $article = new cms_article($row->id_article);
                 $article->maj_indexation();
             }
         }
         $query = "select id_section from cms_sections order by id_section";
         $sections = pmb_mysql_query($query, $dbh);
         if (pmb_mysql_num_rows($sections)) {
             while ($row = pmb_mysql_fetch_object($sections)) {
                 $section = new cms_section($row->id_section);
                 $section->maj_indexation();
             }
         }
         pmb_mysql_query("ALTER TABLE cms_editorial_words_global_index ENABLE KEYS", $dbh);
         pmb_mysql_query("ALTER TABLE cms_editorial_fields_global_index ENABLE KEYS", $dbh);
         $articles = pmb_mysql_query("SELECT count(1) FROM cms_articles", $dbh);
         $count = pmb_mysql_result($articles, 0, 0);
         $sections = pmb_mysql_query("SELECT count(1) FROM cms_sections", $dbh);
         $count += pmb_mysql_result($sections, 0, 0);
         $result .= $count . " " . htmlentities($msg['nettoyage_res_reindex_cms'], ENT_QUOTES, $charset);
     } else {
         $result .= sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername);
     }
     return $result;
 }