Esempio n. 1
0
<?php

$myUpdate = new myUpdate(__FILE__);
$myUpdate->table = $thisSite->PREFIXE_TBL_PUB . "stats";
$myUpdate->field["nb_click"] = "LITERAL:nb_click+1";
$myUpdate->where = "id_bandeau=:id_bandeau AND aa=:aa AND mm=:mm AND jj=:jj AND lg=:lg";
$myUpdate->whereValue["id_bandeau"] = array($__GET["id"], PDO::PARAM_INT);
$myUpdate->whereValue["aa"] = array(date(Y), PDO::PARAM_STR);
$myUpdate->whereValue["mm"] = array(date(m), PDO::PARAM_STR);
$myUpdate->whereValue["jj"] = array(date(d), PDO::PARAM_STR);
$myUpdate->whereValue["lg"] = array($thisSite->current_lang, PDO::PARAM_STR);
$result = $myUpdate->execute();
$mySelect = new mySelect(__FILE__);
$mySelect->tables = $thisSite->PREFIXE_TBL_PUB . "bandeaux";
$mySelect->fields = "lien_destination";
$mySelect->where = "id=:id_bandeau AND lg=:lg";
$mySelect->whereValue["id_bandeau"] = array($__GET["id"], PDO::PARAM_INT);
$mySelect->whereValue["lg"] = array($thisSite->current_lang, PDO::PARAM_STR);
$result = $mySelect->query();
$row = current($result);
$lien_destination = stripslashes($row["lien_destination"]);
if ($lien_destination != "") {
    $parse_lien = parse_url($lien_destination);
    if ($parse_lien["scheme"] == "") {
        $lien_destination = $thisSite->RACINE . $lien_destination;
    }
    header("Location: {$lien_destination}");
}
Esempio n. 2
0
function deleteArbo($idDel)
{
    global $thisSite;
    $arbo_site = array();
    $mySelect = new mySelect(__FILE__);
    $mySelect->tables = $thisSite->PREFIXE_TBL_GEN . "arbo";
    $mySelect->fields = "*";
    $result = $mySelect->query();
    foreach ($result as $row) {
        $nivRub = unserialize($row['arbo_menu']);
        //echoa($row['code_menu']);
        //echoa($nivRub);
        if (array_key_exists($idDel, $nivRub)) {
            unset($nivRub[$idDel]);
        }
        if (is_array($nivRub)) {
            foreach ($nivRub as $idRub => $nivsRub) {
                //echoa($nivsRub);
                if (is_array($nivsRub)) {
                    if (array_key_exists($idDel, $nivsRub)) {
                        unset($nivRub[$idRub][$idDel]);
                    }
                }
                if (is_array($nivsRub)) {
                    foreach ($nivsRub as $idsRub => $nivssRub) {
                        //echoa($nivssRub);
                        if (is_array($nivssRub)) {
                            if (array_key_exists($idDel, $nivssRub)) {
                                unset($nivRub[$idRub][$idsRub][$idDel]);
                            }
                        }
                    }
                }
                //$nivsRub
            }
        }
        //$nivRub
        //echoa($nivRub);
        $myUpdate = new myUpdate(__FILE__);
        $myUpdate->table = $thisSite->PREFIXE_TBL_GEN . "arbo";
        $myUpdate->field["arbo_menu"] = serialize($nivRub);
        $myUpdate->where = "code_menu='" . $row['code_menu'] . "'";
        $result = $myUpdate->execute();
    }
    // suppression dans l'arbo
}
Esempio n. 3
0
 public function addArbo()
 {
     global $thisSite;
     if ($this->idPage == 0 || $this->idPage == "") {
         return false;
     }
     $myTable = $thisSite->PREFIXE_TBL_GEN . "arbo";
     if ($this->idPageParent == "") {
         $this->idPageParent = 0;
     }
     if ($this->code_menu == "noneItem" || $this->code_menu == "") {
         $this->code_menu = "horsmenu";
     }
     $mySelect = new mySelect(__FILE__);
     $mySelect->tables = $myTable;
     $mySelect->fields = "arbo_menu";
     $mySelect->where = "code_menu='" . $this->code_menu . "'";
     $result = $mySelect->query();
     $row = current($result);
     $arbo_menu = unserialize($row['arbo_menu']);
     if (is_array($this->idPageParent)) {
         $arbo_menu[$this->idPageParent[0]][$this->idPageParent[1]][$this->idPage] = "";
     } else {
         if ($this->idPageParent > 0) {
             $arbo_menu[$this->idPageParent][$this->idPage] = "";
         } else {
             $arbo_menu[$this->idPage] = "";
         }
     }
     $myUpdate = new myUpdate(__FILE__);
     $myUpdate->table = $myTable;
     $myUpdate->field["arbo_menu"] = serialize($arbo_menu);
     $myUpdate->where = "code_menu='" . $this->code_menu . "'";
     $result = $myUpdate->execute();
 }
Esempio n. 4
0
    }
    $idSet = $formMaj->set_datas();
    // Ajout à l'arboresence hors menu
    if ($majInsert == 1 && $__POST["show_in_arbo"] == "1") {
        $classPage = new classPage();
        $classPage->idPage = $idSet;
        if ($__POST["add_menu"] != "0") {
            $classPage->code_menu = $__POST["add_menu"];
        }
        $classPage->addArbo();
    }
    if ($__POST["article_tableId"] != "") {
        list($article_table, $article_id) = explode(".", $__POST["article_tableId"]);
        if ($article_table != "" && $article_id > 0) {
            foreach ($myAdmin->LIST_LANG_EXTENSION_FIELD as $clg => $extLg) {
                $myUpdateA = new myUpdate(__FILE__);
                $myUpdateA->table = $article_table;
                $myUpdateA->field["titre"] = $__POST["page_titre" . $extLg];
                $myUpdateA->field["actif"] = $__POST["actif"];
                $myUpdateA->where = "id=:id AND lg=:lg";
                $myUpdateA->whereValue["id"] = array($article_id, PDO::PARAM_INT);
                $myUpdateA->whereValue["lg"] = array($clg, PDO::PARAM_STR);
                $resultA = $myUpdateA->execute();
            }
        }
    }
    $thisSite->reInit = 1;
    // permet la réactualisation du site public pour que les modifications soient prisent en compte
    actionFormMaj($__POST["actionForm"]);
}
// chargement des données
Esempio n. 5
0
 public function set_datas($debug = 0)
 {
     global $myAdmin;
     global $PDO;
     global $__POST;
     global $datas_lang;
     global $idCurrent;
     global $majInsert;
     $this->TableFields = $PDO->getFieldsName($this->tables);
     foreach ($this->whereValuebyLg as $clg => $whereValueFull) {
         $extlg = $myAdmin->LIST_LANG_EXTENSION_FIELD[$clg];
         if ($this->count_datas($clg) > 0) {
             // UPDATE
             $myUpdate = new myUpdate(__FILE__);
             $myUpdate->table = $this->tables;
             $myUpdate->where = $this->whereFull;
             $myUpdate->whereValue = $whereValueFull;
             //echoa($TableFields);
             //echoa($__POST);
             $fields = $this->prepare_maj_fields($extlg, "update");
             foreach ($fields as $fieldName => $value) {
                 $myUpdate->field[$fieldName] = $value;
             }
             $result = $myUpdate->execute();
         } else {
             // INSERT
             $myInsert = new myInsert(__FILE__);
             $myInsert->table = $this->tables;
             if ($this->multiLang == true) {
                 $myInsert->field["lg"] = $clg;
             }
             if ($idCurrent > 0) {
                 $myInsert->field["id"] = $idCurrent;
                 $chrono = $PDO->getNextChrono($this->tables, $idCurrent);
                 if ($chrono > 0) {
                     $myInsert->field["chrono"] = $chrono;
                 }
             } else {
                 // on recherche le dernier ID et on ajoute 1
                 $idCurrent = $PDO->getNextID($this->tables, $this->nextIdMin, $this->nextIdMax);
                 $myInsert->field["id"] = $idCurrent;
                 $chrono = $PDO->getNextChrono($this->tables);
                 if ($chrono > 0) {
                     $myInsert->field["chrono"] = $chrono;
                 }
             }
             $fields = $this->prepare_maj_fields($extlg, "insert");
             foreach ($fields as $fieldName => $value) {
                 $myInsert->field[$fieldName] = $value;
             }
             $result = $myInsert->execute();
         }
         // $this->count_datas($clg)>0
     }
     // langue
     if ($this->maj_media_inside == false) {
         $this->maj_media_inside($idCurrent);
     }
     // pour éviter la récurcivité
     if ($majInsert == 1) {
         $action = "INS";
     } else {
         $action = "UPD";
     }
     $myAdmin->addLogs($myAdmin->pageCurrent, $action, $idCurrent, $result);
     //////
     // Fin de la mise à jour
     // Choix Notification et reroutage éventuel
     $notification = "";
     if ($result === false || !isset($result)) {
         $notificationClass = "jBox-Notice-red";
         $notification = "<div><i class='fa fa-times mrs'></i>" . $datas_lang["majKo"] . "</div>";
     } else {
         $notificationClass = "jBox-Notice-green";
         $notification = "<div><i class='fa fa-check mrs'></i>" . $datas_lang["majOk"] . "</div>";
     }
     $notification = addslashes($notification);
     $myAdmin->notification = $notification;
     $myAdmin->notificationClass = $notificationClass;
     if ($_POST["actionForm"] == "valider" && $notification == "") {
         exit;
     }
     return $idCurrent;
 }