echo "</div>"; } $temp = ob_get_contents(); ob_end_clean(); $temp = $temp . "\n\n"; $smarty->assign("PUBLICITE_" . $pub_emplacement . $pub_emplacement_numero, $temp); // MAJ STATS $mySelect = new mySelect(__FILE__); $mySelect->tables = $thisSite->PREFIXE_TBL_PUB . "stats"; $mySelect->where = "id_bandeau=:id_bandeau AND aa=:aa AND mm=:mm AND jj=:jj AND lg=:lg"; $mySelect->whereValue["id_bandeau"] = array($bandeauChoisi, PDO::PARAM_INT); $mySelect->whereValue["aa"] = array(date(Y), PDO::PARAM_STR); $mySelect->whereValue["mm"] = array(date(m), PDO::PARAM_STR); $mySelect->whereValue["jj"] = array(date(d), PDO::PARAM_STR); $mySelect->whereValue["lg"] = array($thisSite->current_lang, PDO::PARAM_STR); if ($mySelect->count() == 0) { $myInsert = new myInsert(__FILE__); $myInsert->table = $thisSite->PREFIXE_TBL_PUB . "stats"; $myInsert->field["id_emplacement"] = $pub_emplacement; $myInsert->field["lg"] = $thisSite->current_lang; $myInsert->field["id_campagne"] = $id_campagne; $myInsert->field["id_bandeau"] = $bandeauChoisi; $myInsert->field["aa"] = date(Y); $myInsert->field["mm"] = date(m); $myInsert->field["jj"] = date(d); $myInsert->field["nb_aff"] = 1; $result = $myInsert->execute(); } else { $myUpdate = new myUpdate(__FILE__); $myUpdate->table = $thisSite->PREFIXE_TBL_PUB . "stats"; $myUpdate->field["nb_aff"] = "LITERAL:nb_aff+1";
<?php // Chargement total element à updater en ligne pour controle foreach ($listCols as $col => $datasCol) { if ($datasCol["update"] > 0) { $mySelect = new mySelect(__FILE__); $mySelect->tables = $myTable; $mySelect->fields = $datasCol["field"]; if ($formList->where == "") { $mySelect->where = $datasCol["field"] . "=1"; } else { $mySelect->where = $formList->where . " AND " . $datasCol["field"] . "=1"; } $countTrue = $mySelect->count(); $listCols[$col]["countTrue"] = $countTrue; } } // recherche des colonnes existant dans la table et qui donc peuvent être utilisé pour le tri par colonne foreach ($listCols as $col => $datasCol) { if ($datasCol["field"] != "") { $field = $datasCol["field"]; $oneDatasList = current($formList->datasList); if (isset($oneDatasList[$field]) && !isset($listCols[$col]["orderOk"])) { $listCols[$col]["orderOk"] = 1; } } }
<?php $pathBatch = "../"; include $pathBatch . "init_pages/" . "batch.php"; // récupération données standard $table = $__GET["table"]; $valOrigin = $__GET["valOrigin"]; end($__GET); $field = key($__GET); $valField = $__GET[$field]; // champ de la base de donnée: on enleve l'extension langue du champ si existe if (in_array(substr($field, strrpos($field, "_")), $myAdmin->LIST_LANG_EXTENSION_FIELD)) { $BdDfield = substr($field, 0, strrpos($field, "_")); } else { $BdDfield = $field; } $mySelect = new mySelect(__FILE__); $mySelect->tables = $table; $mySelect->fields = "id," . $BdDfield; $mySelect->where = $BdDfield . "='" . addslashes($valField) . "' AND " . $BdDfield . "!='" . addslashes($valOrigin) . "'"; $qt = $mySelect->count(); if ($qt > 0) { echo "false"; } else { echo "true"; }
<?php include DOS_INC_ADMIN . "controle_login.php"; // ajout selecteur de variables $mySelect = new mySelect(__FILE__); $mySelect->tables = $thisSite->PREFIXE_TBL_GEN . "variables"; $mySelect->fields = "*"; $mySelect->where = "lg>=:lg"; $mySelect->whereValue["lg"] = array($myAdmin->LANG_ADMIN, PDO::PARAM_STR); $nb_variables = $mySelect->count(); if ($nb_variables > 0) { $result = $mySelect->query(); $data_variables = ""; $data_variables .= "<div id='show_variables'>"; $data_variables .= "<select id='liste_variables' onChange=\"javascript:select_variables();\" >"; $data_variables .= "<option>Choisissez une variable...</option>"; foreach ($result as $row) { $codevar = $thisSite->SEPVAR . stripslashes($row["code"]) . $thisSite->SEPVAR; $titrevar = stripslashes($row["titre"]); $data_variables .= "<option value='{$codevar}'>{$titrevar}</option>"; } $data_variables .= "</select>"; $data_variables .= "</div>"; $smarty->assign("data_variables", $data_variables); } //nb_variables
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; }
public function count_datas($clg) { global $myAdmin; $mySelect = new mySelect(__FILE__); $mySelect->tables = $this->tables; $mySelect->where = $this->whereFull; $mySelect->whereValue = $this->whereValuebyLg[$clg]; $result = $mySelect->count(); return $result; }