AnonSec Team
Server IP : 10.111.40.2  /  Your IP : 216.73.217.145
Web Server : Apache
System : Linux webd002.cluster111.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : comimage ( 586)
PHP Version : 7.4.33
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0705) :  /home/comimage/kerromes.com/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/comimage/kerromes.com/admin/actions.php
<?php
require(dirname(__FILE__).'/../inc/tools/configuration.php');

if ($_GET['do'] == 'posttemplate') {
    $vSuccess = $metier->handlePostForTemplate($bdd, $_POST, $_GET['id']);
    if ($vSuccess) {
        header("Location: templates.php");
    } else {
        $vHtml = '<h1>Panneau d\'administration</h1>';
        include("inc-form-template.php");
        require_once 'admin_template.php';
        exit;
    }
}


elseif ($_GET['do'] == "add" && $_GET['model_p'] != "" && $_GET['step'] == 2 && ($_GET['model'] > 0 || $_POST["template"] > 0)  && $_GET['gab'] > 0){
	//**************** ENREGISTREMENT POUR ID *********************
    
        $titre = textLibre($_POST['requiredT']);
        $nom_page = minuscule($_POST['requiredPageWeb']);
        $description = textLibre($_POST['requiredD']);
        $motsCles = textLibre($_POST['requiredM']);
        $article = addslashes($_POST['requiredA']);
        $nomDIV = textLibre($_POST['nomDIV']);
        $categorie = minuscule($_POST['cat']);
        $heure_insert = time();
        if(isset($_POST['template'])){
        	$template = $_POST['template'];
		}elseif(isset($_GET['template'])){
			$template = $_GET['template'];
		}else{
			$template = 0;
			}
		if(isset($_POST['parent'])){
        	$parent = $_POST['parent'];
		}elseif(isset($_GET['parent'])){
			$parent = $_GET['parent'];
		}else{
			$parent = 0;
			}
        $modele = isset($_GET['modele']) ?  $_GET['modele'] : 1;
        
        if($titre != "" && $description != "" && $motsCles != "" && $article != "" && $nomDIV != ""){
            if($_GET['model_p'] == "p"){
                if($nom_page != ""){
                    $web = $metier->getTable($bdd,TABLE_PAGES_WEB,"id",minuscule($_GET['iddiv']));
                    if($web->id > 0){
                        //***** MODIFICATION *********
                        $metier->executerSansRetour($bdd,"UPDATE `".TABLE_PAGES_WEB."` SET `page`='".$nom_page."',`titre`='".$titre."',`description`='".$description."',`mot_cle`='".$motsCles."',`article`='".$article."',`heure`='".time()."',`gabarit`='".minuscule($_GET['gab'])."',`modele`='".minuscule($_GET['model'])."',`template`='".$template."',`id_parent`='".$parent."' WHERE `id`=".$web->id);
                        $id = $web->id;
                    } else {						
                        //***** INSERTION *********
                        $o = $metier->executerRetourObjet($bdd,"SELECT COUNT(*) AS total FROM `".TABLE_PAGES_WEB."`");
						$metier->executerSansRetourex($bdd,"INSERT INTO `".TABLE_PAGES_WEB."` ( `page`, `titre`, `description`, `mot_cle`, `article`, `menu`, `footer`, `editeur_off`, `menu_top`, `ordre`, `categorie_blog`, `enligne`, `heure`, `gabarit`, `modele`, `div`,  `maclass`, `maitre`, `template`, `id_parent`) 
                        VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", array($nom_page, $titre, $description, $motsCles, $article, 0, 0, 0, 0, $o->total, 0, 1, $heure_insert, minuscule($_GET['gab']), minuscule($modele), $nomDIV, '', 0, $template, $parent));
                        
                        $id = $metier->getChamps($bdd,"id",TABLE_PAGES_WEB,"heure",$heure_insert);
                        //générer une copie de page
                        if($_GET['model_page'] > 0){
                            $metier->duplicatePage($bdd,$id,minuscule($_GET['model_page']),minuscule($_GET['model_p']));
                        }
                    }
                    
                    if($_GET['gab'] == 1 && $_GET['model'] == 1){
                        echo ADMIN_CSS;
                        ($web->id > 0)?msg("Page web modifiée !", "ok"):msg("Page web ajoutée !", "ok");
                        redirection(1,"editermespages.php");
                    }
                    else{
                        //renvoit vers la suite
                        if($_COOKIE['apseudo'] == "sadmin"){
                            header("location:gabarit.php?model_p=".$_GET['model_p']."&step=3&model=".$_GET['model']."&gab=".$_GET['gab']."&iddiv=".$id);
                        }
                        else{
                            header("location:editermespages.php");
                        }
                        exit();
                    }
                }
                else{
                    echo ADMIN_CSS;
                    msg("Le champ : page web est obligatoire !", "error");
                    redirection(1,$_SERVER['HTTP_REFERER']);
                }
            }
            else{
                if($_POST['cat'] == 0){
                    echo ADMIN_CSS;
                    msg("La catégorie est obligatoire !", "error");
                    redirection(1,$_SERVER['HTTP_REFERER']);
                }
                else{
                    $web = $metier->getTable($bdd,TABLE_BLOG,"id",minuscule($_GET['iddiv']));
                    if($web->id > 0){
                        //***** MODIFICATION *********
                        $metier->executerSansRetour($bdd,"UPDATE `".TABLE_BLOG."` SET `categorie`=".$categorie.",`titre`='".$titre."',`description`='".$description."',`mot_cle`='".$motsCles."',`article`='".$article."',`heure`='".time()."',`gabarit`='".minuscule($_GET['gab'])."',`modele`='".minuscule($_GET['model'])."',`template`='".$template."' WHERE `id`=".$web->id);
                        $id = $web->id;
                    }
                    else{
                        //***** INSERTION *********
                         $o = $metier->executerRetourObjet($bdd,"SELECT COUNT(*) AS total FROM `".TABLE_BLOG."`");
						$metier->executerSansRetourex($bdd, "INSERT INTO `".TABLE_BLOG."` (`titre`, `description`, `mot_cle`, `article`, `categorie`, `ordre`, `enligne`, `heure`, `gabarit`, `modele`, `div`, `maclass`, `maitre`, `template`)
						VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", array($titre, $description,  $motsCles, $article, $categorie, $o->total, 1, $heure_insert, minuscule($_GET['gab']), minuscule($_GET['model']), $nomDIV, '', 0, $template));
						
                        $id = $metier->getChamps($bdd,"id",TABLE_BLOG,"heure",$heure_insert);
						msg("Article !", "ok");
                        //générer une copie de page
                        if($_GET['model_page'] > 0){
                            $metier->duplicatePage($bdd,$id,minuscule($_GET['model_page']),minuscule($_GET['model_p']));
                        }
                    }
                    
                    if($_GET['gab'] == 1 && $_GET['model'] == 1){
                        echo ADMIN_CSS;
                        ($web->id > 0)?msg("Article modifié !", "ok"):msg("Article ajouté !", "ok");
                        redirection(1,"blog.php");
                    }
                    else{
                        //renvoit vers la suite
                        if($_COOKIE['apseudo'] == "sadmin"){
                            header("location:gabarit.php?model_p=".$_GET['model_p']."&step=3&model=".$_GET['model']."&gab=".$_GET['gab']."&iddiv=".$id);
                        }
                        else{
                            header("location:editermespages.php");
                        }
                        exit();
                    }
                }
            }
        }
        else{
            echo ADMIN_CSS;
            msg("Tous les champs sont obligatoires !", "error");
            redirection(1,$_SERVER['HTTP_REFERER']);
        }
}
elseif($_GET['do'] == "mod_contenu_suppl" || $_GET['do'] == "add_contenu_supp" || $_GET['do'] == "mod_contenu"){
    $description = textLibre($_POST['description']);
    if($description != ""){
        if($_GET['do'] == "mod_contenu"){
            if($_GET['model_p'] == "p"){
                $metier->updateUnElement($bdd,TABLE_PAGES_WEB, "article", $description, "id", $_GET['iddiv']);
            }
            else{
                $metier->updateUnElement($bdd,TABLE_BLOG, "article", $description, "id", $_GET['iddiv']);
            }
            echo ADMIN_CSS;
            msg("Le contenu a été modifié !", "ok");
            redirection(1,"gabarit.php?model_p=".$_GET['model_p']."&step=3&model=".$_GET['model']."&gab=".$_GET['gab']."&iddiv=".$_GET['iddiv']."&page=".$_GET['page']);
        }
        elseif($_GET['do'] == "mod_contenu_suppl"){
            $metier->updateUnElement($bdd,TABLE_CONTENUS_SUPPL, "contenu", $description, "id", $_GET['idcs']);
            echo ADMIN_CSS;
            msg("Le contenu a été modifié !", "ok");
            redirection(1,"gabarit.php?model_p=".$_GET['model_p']."&step=3&model=".$_GET['model']."&gab=".$_GET['gab']."&iddiv=".$_GET['iddiv']."&page=".$_GET['page']);
        }
        else{
            $o = $metier->executerRetourObjet($bdd,"SELECT COUNT(*) AS total FROM `".TABLE_CONTENUS_SUPPL."` WHERE `page_id`=".minuscule($_GET['iddiv'])." AND `model_p`='".minuscule($_GET['model_p'])."' AND `nature`=".minuscule($_GET['nature']));
			$metier->executerSansRetourex($bdd,"INSERT INTO `".TABLE_CONTENUS_SUPPL."`(`page_id`, `model_p`, `nature`, `contenu`, `ordre`, `maclass`, `unique`)
			VALUES (?, ?, ?, ?, ?, ?, ?)", array(minuscule($_GET['iddiv']), minuscule($_GET['model_p']), minuscule($_GET['nature']), $description, $o->total, '', 0));
			
			
            echo ADMIN_CSS;
            msg("Le contenu a été ajouté !", "ok");
            redirection(1,"gabarit.php?model_p=".$_GET['model_p']."&step=3&model=".$_GET['model']."&gab=".$_GET['gab']."&iddiv=".$_GET['iddiv']."&page=".$_GET['page']);
        }
    }
    else{
        echo ADMIN_CSS;
        msg("Le contenu ne peut rester vide !", "error");
        redirection(1,$_SERVER['HTTP_REFERER']);
    }
}
elseif($_GET['do'] == "add_bloc"){
    $bloc_id = minuscule($_POST['bdispo'.minuscule($_GET['nature'])]);
    $position = minuscule($_POST['position'.minuscule($_GET['nature'])]);
    $contenu_id = minuscule($_POST['lcont'.minuscule($_GET['nature'])]);
    if($bloc_id > 0 && $position > 0 && $contenu_id > 0){
		$metier->executerSansRetourex($bdd,"INSERT INTO `".TABLE_ASSOCIER_BLOC."`(`page_id`,`model_p`,`nature`,`bloc_id`,`avant_apres`,`contenu_id`)
		VALUES (?, ?, ?, ?, ?, ?)", array(minuscule($_GET['iddiv']), minuscule($_GET['model_p']), minuscule($_GET['nature']), $bloc_id, $position, $contenu_id));
		
		
        echo ADMIN_CSS;
        msg("Le bloc a été ajouté !", "ok");
        redirection(1,$_SERVER['HTTP_REFERER']);
    }
    else{
        //erreur
        echo ADMIN_CSS;
        msg("ATTENTION... une erreur est survenue !", "error");
        redirection(1,$_SERVER['HTTP_REFERER']);
    }
}
elseif($_GET['do'] == "add_bloc_corps_page"){
    $bloc_id = minuscule($_POST['bdispo']);
    $position = minuscule($_POST['position']);
    $contenu_id = minuscule($_POST['lcont']);
    if($position > 0 && $bloc_id > 0){
		 $metier->executerSansRetourex($bdd, "INSERT INTO `".TABLE_ASSOCIER_BLOC."` (`page_id`, `model_p`, `nature`, `bloc_id`, `avant_apres`, `contenu_id`) VALUES (?, ?, ?, ?, ?, ?)", array(minuscule($_GET['iddiv']), minuscule($_GET['model_p']), 2, $bloc_id, $position, $contenu_id));
        echo ADMIN_CSS;
        msg("Le bloc a été ajouté !", "ok");
        redirection(1,$_SERVER['HTTP_REFERER']);
    }
    else{
        //erreur
        echo ADMIN_CSS;
        msg("ATTENTION... une erreur est survenue !", "error");
        redirection(1,$_SERVER['HTTP_REFERER']);
    }
}
elseif($_GET['do'] == "mod_class"){
    $maclass = textLibre($_POST['maclass']);
    $array = $_POST['nclass'];
    if(count($array) > 0){
        foreach($array as $class){
            $t = substr($class,0,1);
            $m = substr($class,1,1);
            $p = explode(":",$class);
            if($t == "x"){
                //C'est une page web ou un article
                $table = ($m == "p")?TABLE_PAGES_WEB:TABLE_BLOG;
                $metier->updateUnElement($bdd,$table, "maclass", $maclass, "id", $p[1]);
            }
            else{
                //C'est un contenu supplémentaire
                $metier->updateUnElement($bdd,TABLE_CONTENUS_SUPPL, "maclass", $maclass, "id", $p[1]);
            }
        }
    }
    echo ADMIN_CSS;
    msg("Class modifiée !", "ok");
    redirection(0,$_SERVER['HTTP_REFERER']);
}
elseif($_GET['do'] == "add_model_page"){
    $model_page_id = minuscule($_GET['model_page']);
    $model_p = minuscule($_GET['model_p']);
    $table = ($model_p == "p")?TABLE_PAGES_WEB:TABLE_BLOG;
    $web = $metier->getTable($bdd,$table,"id",$model_page_id);
    if($model_page_id > 0 && $model_p != ""){
        header("location:gabarit.php?model_p=".$model_p."&step=2&model=".$web->modele."&gab=".$web->gabarit."&model_page=".$model_page_id);
        exit();
    }
    else{
        header("location:".$_SERVER["HTTP_REFERER"]);
        exit();
    }
}
elseif($_GET['do'] == "change_maitre"){
    if(is_numeric($_GET['id'])){
        if($_GET['p'] == "web"){
            //editer mes pages
            $metier->updateUnElement($bdd,TABLE_PAGES_WEB,"maitre",0,"maitre",1);
            $metier->updateUnElement($bdd,TABLE_PAGES_WEB,"maitre",minuscule($_GET['etat']),"id",minuscule($_GET['id']));
            echo '<h1 style="text-align:center;margin-top:30px;" class="warning ok">Page maitre mise à jour !</h1>';
            redirection(1,$_SERVER['HTTP_REFERER']);
        }
        else{
            //partie blog
            $metier->updateUnElement($bdd,TABLE_BLOG,"maitre",0,"maitre",1);
            $metier->updateUnElement($bdd,TABLE_BLOG,"maitre",minuscule($_GET['etat']),"id",minuscule($_GET['id']));
            echo '<h1 style="text-align:center;margin-top:30px;" class="warning ok">Page maitre mise à jour !</h1>';
            redirection(1,$_SERVER['HTTP_REFERER']);
        }
    }
    else{
        echo '<h1 style="text-align:center;margin-top:30px;" class="warning error">Erreur...</h1>';
        redirection(1,$_SERVER['HTTP_REFERER']);
    }
}
elseif($_POST["do"] == "modcoord"){
	$verificatmail = conformEmail($_POST["txtmail"]);
	
	if($verificatmail != 1){
			echo ADMIN_CSS;
			msg("Le mail n'est pas valide !", "error");
			redirection(2,$_SERVER['HTTP_REFERER']);
		}else{
		$metier->executerSansRetour($bdd,"UPDATE `".TABLE_COORD."` SET `nom`='".textLibre($_POST["txtname"])."', `adresse1`='".textLibre($_POST["txtadr1"])."', `adresse2`='".textLibre($_POST["txtadr2"])."', `cp`='".textLibre($_POST["txtcp"])."', `tel`='".$_POST["txttel"]."', `fax`='".$_POST["txtfax"]."', `portable`='".$_POST["txtgsm"]."', `siret`='".$_POST["txtsiret"]."', `email`='".textLibre($_POST["txtmail"])."', `plan`='".textLibre($_POST["txtplan"])."', `slogan`='".textLibre($_POST["slogan"])."' WHERE `id`='1'");
		echo ADMIN_CSS;
		msg("Coordonnées modifiées !", "ok");
		redirection(2,$_SERVER['HTTP_REFERER']);
		}
	}
else{
	header("location:".$_SERVER["HTTP_REFERER"]);
	exit();
}

AnonSec - 2021