<%@ $Language=JScript /* PARA COLORES PHP */ %><% @set_time_limit(7200); //2 horas include("../includes/DB_Conectar.php"); /*toma la seguridad de la página imagenes_borrar.php*/ $admABMLink_manual="imagenes_borrar.php"; include("../includes/inc_auth.php"); include("../includes/funciones.php"); /*Datos para crear Thumbnail de la imagen*/ $basedir = "$app_path/ADVF/imagenes/"; $resolution = "100x100"; /*********/ $tam_maximo= 310000; if ($OS=="Windows_NT") { $extensiones = "JPG, JPEG $I_or SWF"; } else { $extensiones = "JPG, JPEG, GIF, PNG $I_or SWF"; } %> <%=$I_administration%> <% $uploadDir = $app_path . "ADVF/imagenes/"; $UploadOK = false; $MAXBATCH = 1; if ($Action=="Upload"){ for ($i=1; $i<=$MAXBATCH; $i++) { if (phpversion() < 4) { $upload = $HTTP_POST_VARS["upload${i}"]; $tmp_name = $upload; $tam = $HTTP_POST_VARS["upload${i}_size"]; $nom = $HTTP_POST_VARS["upload${i}_name"]; } else { $upload = $HTTP_POST_FILES["upload${i}"]; $tmp_name = $HTTP_POST_FILES["upload${i}"]["tmp_name"]; $tam = $HTTP_POST_FILES["upload${i}"]["size"]; $nom = $HTTP_POST_FILES["upload${i}"]["name"]; } $epigraf = $HTTP_POST_VARS["epigraf${i}"]; $epigraf_ia = $HTTP_POST_VARS["epigraf_ia${i}"]; $categ = $HTTP_POST_VARS["categ${i}"]; $diac = $HTTP_POST_VARS["diac${i}"]; $mesc = $HTTP_POST_VARS["mesc${i}"]; $yearc = $HTTP_POST_VARS["yearc${i}"]; if ($tam > $MAX_FILE_SIZE) { $msje="$I_errorthefileisbigger $MAX_FILE_SIZE bytes."; %>

<%=$I_replaceimageby%>

<%=$msje%> <%=$I_back%>

<%die(); } if ($tmp_name != "none" && $tmp_name != "") { // chequeo la extension: $ext = StrToLower(SubStr($nom, StrRPos($nom, ".") + 1)); if ($ext != "gif" && $ext != "jpg" && $ext != "png" && $ext != "jpeg") { $msje="$I_invalidfileformat : $ext. $I_itmustbe $extensiones.."; %> <%=$msje%> <%=$I_back%>

<%die(); } //$dest = $uploadDir . $nom; $sql="select advLink from ADVF where advID='$advID'"; $rs=$conn->execute($sql); $destanterior=$app_path.$rs->field("advLink"); @unlink($destanterior);//borro archivo anterior $destanterior=$app_path.GetThumbnailName($rs->field(advLink), "100x100"); @unlink($destanterior);//borro thumbnail anterior /*mantiene el mismo nombre*/ $imageaux1=substr($rs->field("advLink"),strrpos($rs->field("advLink"),"/")+1); $imageaux2=substr($imageaux1,0,strrpos($imageaux1,".")); $uniqid = uniqid(""); $dest = $uploadDir . "$imageaux2.${ext}"; $site_path = "ADVF/imagenes/$imageaux2.${ext}"; $srcimage = $imageaux2.".".$ext; if ($categ == "null") { $msje="$I_errorselectcategory $nom."; %> <%=$msje%> <%=$I_back%>

<%die(); } if (trim($epigraf) == "") { $msje="$I_errorfillinthe $nom."; %> <%=$msje%> <%=$I_back%>

<%die(); } $valida = checkdate($mesc,$diac,$yearc); if (!$valida && $yearc != ""){ $msje="$I_errorinvalidcapturedate $diac-$mesc-$yearc."; %> <%=$msje%> <%=$I_back%>

<%die(); } else { $advFechaCaptura = $yearc. "-" . $mesc ."-". $diac; } $sql = "update ADVF set advTitulo='$epigraf', advTitulo_IA='$epigraf_ia', advFecha='$condate', advLink='$site_path', catID='$categ', advBytes='$tam', advFechaCaptura='$advFechaCaptura', advAutor='$usradID' where advID='$advID'"; //echo "$sql
"; $conn->Execute ($sql); //copio el temporal a dest: @unlink($dest); //por si existe uno anterior, aunque es imposible if (@copy($tmp_name, $dest)){ $msje="<%=$I_file%> $nom uploaded"; //crea Thumnail si es tipo imagen $tnimage = GetThumbnailName($srcimage, $resolution); $mycmd="/cgi-bin/thumber.pl?op=-geometry&arg=${resolution}&in=${basedir}${srcimage}&out=${basedir}${tnimage}"; //echo $mycmd; virtual($mycmd); %> <%=$msje%>
<% $UploadOK = true; } else{ $msje="1: $I_uploadfailed"; %> <%=$msje%> <% $perms = @fileperms($uploadDir); $owner = @fileowner($uploadDir); if (!$perms){ %>
2: <%=$I_thefolder%> <%=$uploadDir%> <%=$I_notexist%>
<% } else{ $myuid = getmyuid(); $perms = @fileperms($dest); $owner = @fileowner($dest); echo "perms: '$perms'
"; echo "owner: '$owner'
"; echo "myuid: '$myuid'
"; if (!($perms & 2) && !(($owner == $myuid) && ($perms & 128))){ echo "3: $I_user '" . get_current_user() . "' $I_havenotpermision $dest
\n"; } } %>
<% } } else { if ($tam > 0) { %> 4: <%=$I_uploadfailed%>

<% } } } %> <% } %>   <% $sql="select advTitulo,advTitulo_IA,advFechaCaptura,catID from ADVF where advID='$advID'"; $rs=$conn->execute($sql); $advTitulo=$rs->field("advTitulo"); $advTitulo_IA=$rs->field("advTitulo_IA"); $array_fecha=explode("-",substr($rs->field("advFechaCaptura"),0,10)); $catID_ant=$rs->field("catID"); // cargo las categorias: $sqlCateg = "select * from ADVF_Categorias order by catNombre"; $rsCateg = $conn->Execute($sqlCateg); $cmboCateg = "\n"; while (!$rsCateg->eof) { $catID = $rsCateg->Field("catID"); $catNombre = $rsCateg->Field("catNombre"); if($catID==$catID_ant){$sel="selected";}else{$sel="";} $cmboCateg .= "\n"; $rsCateg->MoveNext(); } %> > <% for ($j=1; $j<=$MAXBATCH; $j++) { //$array_fecha=explode("-",substr($condate,0,10)); %> > > <% } %>
  <%=$I_imagepath%>
<%=$I_allowedextensions%>: <%=$extensiones%>
<%=$I_name%> <%=$I_name%>
<%=$I_alternativelanguage%>
<%=$I_category%>