Example #1
0
 public function duplication($table, $idDupli, $fieldCopie = "", $fieldsExcept = "")
 {
     $newId = $this->getNextID($table);
     $newChrono = 0;
     $resultD = $this->free_requete("SELECT * FROM " . $table . " WHERE id=" . $idDupli);
     foreach ($resultD as $rowD) {
         $myInsert = new myInsert(__FILE__);
         $myInsert->table = $table;
         foreach ($rowD as $field => $val) {
             if (strpos($fieldsExcept, $field) === false) {
                 if (strpos($fieldCopie, $field) !== false) {
                     $myInsert->field[$field] = "COPIE DE: " . $val;
                 } else {
                     if ($field == "id") {
                         $myInsert->field[$field] = $newId;
                     } else {
                         if ($field == "chrono") {
                             if ($newChrono == 0) {
                                 $newChrono = $this->getNextChrono($table);
                             }
                             $myInsert->field[$field] = $newChrono;
                         } else {
                             $myInsert->field[$field] = $val;
                         }
                     }
                 }
             }
         }
         $result = $myInsert->execute();
     }
 }
Example #2
0
// GESTION DONNEES
$formMaj = new formMaj();
$formMaj->tables = $myTable;
$formMaj->fields = "*";
$formMaj->where = "id=:id";
$formMaj->whereValue["id"] = array($idCurrent, PDO::PARAM_INT);
$formMaj->multiLang = true;
$formMaj->clause_where();
// Validation du formulaire
if ($__POST["actionForm"] != "" && $__POST["actionForm"] != "Annuler") {
    $formMaj->set_datas();
    // Ajout à l'arboresence
    $resultx = $PDO->free_requete("SELECT id FROM " . $myTableArbo . " WHERE code_menu='" . $__POST["code_menu"] . "'");
    $rowx = $resultx->fetch();
    if ($rowx->id == 0) {
        $myInsert = new myInsert(__FILE__);
        $myInsert->table = $myTableArbo;
        $myInsert->field["code_menu"] = $__POST["code_menu"];
        $result = $myInsert->execute();
    }
    actionFormMaj($__POST["actionForm"]);
}
// chargement des données
$formMaj->get_datas();
///////////////////////////////
// PREPARATION DES DONNEES
///////////////////////////////////
// champs de saisie
///////////////////////////////////
$newfield = new input();
$newfield->field = "code_menu";
Example #3
0
$mySelect->where = "login=:login AND mdp=:mdp AND actif=1";
$mySelect->whereValue["login"] = array($__POST['login'], PDO::PARAM_STR);
$mySelect->whereValue["mdp"] = array($__POST['mdp'], PDO::PARAM_STR);
$result = $mySelect->query();
if (count($result) == 1) {
    $myInsert = new myInsert(__FILE__);
    $myInsert->table = $thisSite->PREFIXE_TBL_CLI . "espaceclient_logs";
    $myInsert->field["datetime"] = date('Y-m-d H:i:s');
    $myInsert->field["login"] = $__POST['login'];
    $myInsert->field["action"] = "connexion_OK";
    $myInsert->field["commentaires"] = "";
    $myInsert->execute();
    $_SESSION["EC_accesOK"] = 1;
    $_SESSION["EC_login"] = $__POST['login'];
    setcookie("EC_login", $__POST['login'], time() + 60 * 60 * 24 * 365, COOKIE_PATH);
    setcookie("EC_mdp", md5($__POST['mdp']), time() + 60 * 60 * 24 * 365, COOKIE_PATH);
    echo json_encode(['reponse' => "1"]);
} else {
    $myInsert = new myInsert(__FILE__);
    $myInsert->table = $thisSite->PREFIXE_TBL_CLI . "espaceclient_logs";
    $myInsert->field["datetime"] = date('Y-m-d H:i:s');
    $myInsert->field["login"] = $__POST['login'];
    $myInsert->field["action"] = "connexion_inconnu";
    $myInsert->field["commentaires"] = "login: "******" / mdp: " . $__POST['mdp'];
    $myInsert->execute();
    $_SESSION["EC_accesOK"] = 0;
    echo json_encode(['reponse' => "0"]);
}
?>

Example #4
0
 public function addPage()
 {
     global $myAdmin;
     global $PDO;
     global $__POST;
     global $thisSite;
     if ($this->idCurrent == 0) {
         return false;
     }
     if ($this->page_type == "") {
         $this->page_type = "page";
     }
     if ($this->page_recherche == "") {
         $this->page_recherche = 1;
     }
     if ($this->page_parent == "") {
         $this->page_parent = 0;
     }
     if ($this->show_sousmenu == "") {
         $this->show_sousmenu = 0;
     }
     if ($this->show_in_arbo == "") {
         $this->show_in_arbo = 0;
     }
     if ($this->page_php == "") {
         $this->page_php = "";
     }
     if ($this->page_tpl == "") {
         $this->page_tpl = "";
     }
     if ($this->page_genre == "") {
         $this->page_genre = "";
     }
     $mySelect = new mySelect(__FILE__);
     $mySelect->tables = $this->table;
     $mySelect->fields = "id_page";
     $mySelect->where = "id=:idCurrent";
     $mySelect->whereValue["idCurrent"] = array($this->idCurrent, PDO::PARAM_INT);
     $mySelect->limit = 1;
     $result = $mySelect->query();
     $row = current($result);
     $this->idPage = $row["id_page"];
     if ($this->idPage > 0) {
         $mySelect = new mySelect(__FILE__);
         $mySelect->tables = $thisSite->PREFIXE_TBL_GEN . "pages";
         $mySelect->fields = "id";
         $mySelect->where = "id=:id_page AND lg=:lg";
         $mySelect->whereValue["id_page"] = array($this->idPage, PDO::PARAM_INT);
         $mySelect->whereValue["lg"] = array($myAdmin->LANG_DEF, PDO::PARAM_STR);
         $result = $mySelect->count();
         if ($result > 0) {
             $mode = "update";
         } else {
             $mode = "insert";
         }
     } else {
         if ($this->idPage == 0) {
             $this->idPage = $PDO->getNextID($thisSite->PREFIXE_TBL_GEN . "pages", $this->nextIdMin, $this->nextIdMax);
             $mode = "insert";
         } else {
             $mode = "update";
         }
     }
     $actif = $__POST["actif"];
     if ($actif != "1" && $actif != "0") {
         $actif = 1;
     }
     foreach ($myAdmin->LIST_LANG_EXTENSION_FIELD as $clg => $extLg) {
         if ($mode == "update") {
             $myUpdate = new myUpdate(__FILE__);
             $myUpdate->table = $thisSite->PREFIXE_TBL_GEN . "pages";
             if ($__POST["titre" . $extLg] != "") {
                 $myUpdate->field["titre"] = $__POST["titre" . $extLg];
             }
             if ($__POST["titre" . $extLg] != "") {
                 $myUpdate->field["page_titre"] = $__POST["titre" . $extLg];
             }
             $myUpdate->field["actif"] = $actif;
             $myUpdate->where = "id=:id_page AND lg=:lg";
             $myUpdate->whereValue["id_page"] = array($this->idPage, PDO::PARAM_INT);
             $myUpdate->whereValue["lg"] = array($clg, PDO::PARAM_STR);
             $result = $myUpdate->execute();
         }
         if ($mode == "insert") {
             $page_url = sanitize_string_for_url($__POST["titre" . $extLg]);
             $myInsert = new myInsert(__FILE__);
             $myInsert->table = $thisSite->PREFIXE_TBL_GEN . "pages";
             $myInsert->field["id"] = $this->idPage;
             $myInsert->field["lg"] = $clg;
             $myInsert->field["titre"] = $__POST["titre" . $extLg];
             $myInsert->field["page_titre"] = $__POST["titre" . $extLg];
             $myInsert->field["actif"] = $actif;
             $myInsert->field["page_genre"] = $this->page_genre;
             $myInsert->field["page_type"] = $this->page_type;
             $myInsert->field["page_url"] = $page_url;
             $myInsert->field["page_php"] = $this->page_php;
             $myInsert->field["page_tpl"] = $this->page_tpl;
             $myInsert->field["page_tag_title"] = $__POST["titre" . $extLg];
             $myInsert->field["page_tag_keywords"] = "";
             $myInsert->field["page_tag_description"] = "";
             $myInsert->field["page_tag_robots"] = "index,follow";
             $myInsert->field["page_sitemap_changefreq"] = "monthly";
             $myInsert->field["page_recherche"] = $this->page_recherche;
             $myInsert->field["page_parent"] = $this->page_parent;
             $myInsert->field["show_sousmenu"] = $this->show_sousmenu;
             $myInsert->field["show_in_arbo"] = $this->show_in_arbo;
             $myInsert->field["article_tableId"] = $this->table . "." . $this->idCurrent;
             $result = $myInsert->execute();
             $myUpdate = new myUpdate(__FILE__);
             $myUpdate->table = $this->table;
             $myUpdate->field["id_page"] = $this->idPage;
             $myUpdate->where = "id=:idCurrent AND lg=:lg";
             $myUpdate->whereValue["idCurrent"] = array($this->idCurrent, PDO::PARAM_INT);
             $myUpdate->whereValue["lg"] = array($clg, PDO::PARAM_STR);
             $result = $myUpdate->execute();
         }
     }
     if ($mode == "insert" && $this->show_in_arbo == 1) {
         $this->addArbo();
     }
     return $this->idPage;
 }
Example #5
0
 public function addLogs($page = "", $action = "", $idCurrent = 0, $msg = "")
 {
     global $thisSite;
     if ($thisSite->SERVER == "local") {
         return;
     }
     if ($page == "") {
         $page = $myAdmin->pageCurrent;
     }
     if ($page == $this->lastPageLog && $action == "") {
         return 0;
     }
     $this->lastPageLog = $page;
     $myInsert = new myInsert(__FILE__);
     $myInsert->table = $thisSite->PREFIXE_TBL_ADM . "logs";
     $myInsert->field["date"] = date("Ymd");
     $myInsert->field["heure"] = date("His");
     $myInsert->field["login"] = $this->LOGIN;
     $myInsert->field["page"] = $page;
     $myInsert->field["action"] = $action;
     $myInsert->field["idCurrent"] = $idCurrent;
     $myInsert->field["msg"] = $msg;
     $result = $myInsert->execute();
 }
Example #6
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;
 }
Example #7
0
include $pathBatch . "init_pages/" . "batch.php";
$myTable = $thisSite->PREFIXE_TBL_GEN . "tags";
$newID = $PDO->getNextID($myTable);
//echoa($__POST);
$first_titre = "";
foreach ($myAdmin->LIST_LANG_EXTENSION_FIELD as $clg => $extlg) {
    //echoa($clg);
    $titre = $__POST["newtag" . $extlg];
    if ($titre != "") {
        $mySelect = new mySelect(__FILE__);
        $mySelect->tables = $myTable;
        $mySelect->fields = "id," . $BdDfield;
        $mySelect->where = "titre='" . addslashes($titre) . "'";
        $qt = $mySelect->count();
        if ($qt == 0) {
            $myInsert = new myInsert(__FILE__);
            $myInsert->table = $myTable;
            $myInsert->field["id"] = $newID;
            $myInsert->field["lg"] = $clg;
            $myInsert->field["parent"] = $__POST["field"];
            $myInsert->field["titre"] = $titre;
            $lastId = $myInsert->execute();
            if ($first_titre == "") {
                $first_titre = $titre;
            }
        } else {
            $lastId = 0;
        }
    }
}
echo json_encode(['lastId' => $lastId, 'titre' => $first_titre]);