0) { $ruta_sitio = "http://localhost/interart/"; $desarrollo['db_user'] = "root"; $desarrollo['db_password'] = "dkfjgh"; $desarrollo['db_name'] = "interart"; $desarrollo['db_host'] = "localhost"; } else { $ruta_sitio = "http://localhost/base/"; $desarrollo['db_user'] = "galeria_dbuser"; $desarrollo['db_password'] = "inter2009"; $desarrollo['db_name'] = "galeria_interart"; $desarrollo['db_host'] = "localhost"; } return $desarrollo; } function correr_query($query) { $string_error = ""; try { $variables = variables_conexion(); $con = mysql_connect($variables["db_host"],$variables["db_user"],$variables["db_password"]); if (!$con) { $string_error = '-1 Could not connect: '.mysql_error().' '.$aplicacion_en_produccion; return $string_error; } mysql_select_db($variables["db_name"], $con); mysql_query($query); mysql_close($con); return $string_error; } catch (Exception $e) { $string_error = $e; return "-1: ".$string_error; } } function seleccionar($query) { $string_error = ""; try { $variables = variables_conexion(); $con = mysql_connect($variables["db_host"],$variables["db_user"],$variables["db_password"]); if (!$con) { $string_error = '-1: Could not connect: '.mysql_error().' '.$aplicacion_en_produccion; return $string_error; } mysql_select_db($variables["db_name"], $con); mysql_query("SET CHARACTER SET lantin1"); mysql_query("SET NAMES latin1"); $result = mysql_query($query); mysql_close($con); return $result; } catch (Exception $e) { $string_error = $e; return "-1: ".$string_error; } } function testConnection() { $string_error = ""; try { $variables = variables_conexion(); $con = mysql_connect($variables["db_host"],$variables["db_user"],$variables["db_password"]); if (!$con) { $string_error = '-1: Could not connect: '.mysql_error(); return $string_error; } mysql_select_db($variables["db_name"], $con); mysql_query("SET CHARACTER SET utf8"); mysql_query("SET NAMES utf8"); $result = mysql_query("select * from highlight"); $row = mysql_fetch_array($result); mysql_close($con); return "Conexión exitosa".$row["Texto"]; } catch (Exception $e) { $string_error = $e; return "-1: ".$string_error; } } //function to encrypt the string function encode5t($str) { for($i=0; $i<5;$i++) { $str=strrev(base64_encode($str)); //apply base64 first and then reverse the string } return $str; } //function to decrypt the string function decode5t($str) { for($i=0; $i<5;$i++) { $str=base64_decode(strrev($str)); //apply base64 first and then reverse the string} } return $str; } function fill_drop($query, $name, $selected, $tamano = 0) { $results = seleccionar($query); if ($tamano > 0) { $tamano = mysql_num_rows($results) + 1; $tamano = "size = '".$tamano."'"; } else { $tamano = ""; } $drop = ""; return $drop; } function insertar($campos, $datos, $tabla) { $string_error[0] = ""; try { $queryString = "Insert into ".$tabla." ("; $queryString2 = " values("; foreach($campos as $key) { $queryString=$queryString.$key.","; } foreach($datos as $key) { $queryString2=$queryString2."'".$key."',"; } $queryString = substr($queryString, 0, strlen($queryString)-1).") "; $queryString2 = substr($queryString2, 0, strlen($queryString2)-1).") "; $queryString = $queryString.$queryString2; // echo($queryString); $string_error[0] = correr_query($queryString); if (substr($string_error,0,2) != "-1") { $string_error[0] = get_last_id($tabla); if (substr($string_error[0],0,2) != "-1") { $string_error[1] = $string_error[0]; $string_error[0] = ""; return $string_error; } else return $string_error; } else return $string_error; } catch (Exception $e) { $string_error[0]= $e; return $string_error; } } function actualizar($campos, $datos, $tabla, $id) { $string_error[0] = ""; try { $queryString = "update ".$tabla." set "; $i =0; foreach($campos as $key) { $queryString= $queryString.$key."='".$datos[$i]."', "; $i = $i +1; } $queryString = substr($queryString, 0, strlen($queryString)-2)." where id = ".$id; // echo($queryString); $string_error[0] = correr_query($queryString); return $string_error; } catch (Exception $e) { $string_error[0] = $e; return $string_error; } } function bitacora($usuario, $actividad, $pantalla, $fecha) { $string_error[0] = ""; try { $queryString = "insert into bitacora (Usuario, Actividad, Pantalla, Fecha) values (' ".$usuario."','".$actividad."','".$pantalla."','".$fecha."')"; $string_error[0] = correr_query($queryString); return $string_error; } catch (Exception $e) { $string_error[0] = $e; return $string_error; } } function alerta($mensaje) { echo(""); } function get_last_id($tabla) { $string_error = ""; try { $variables = variables_conexion(); $con = mysql_connect($variables["db_host"],$variables["db_user"],$variables["db_password"]); if (!$con) { $string_error = '-1 Could not connect: '.mysql_error().' '.$aplicacion_en_produccion; return $string_error; } mysql_select_db($variables["db_name"], $con); $result = mysql_query("select ID from $tabla order by ID desc"); $string_error = mysql_result($result, 0); mysql_close($con); return $string_error; } catch (Exception $e) { $string_error = $e; return "-1: ".$string_error; } } function despliega_tabla( $res, $titulo='', // Título de la tabla $titulosColumnas=NULL, // Arreglo opcional para titulares de columnas. Debe ser del mismo tamaño que los resultados para evitar errores HTML. $columnasMismoAncho=NULL, // Si verdadero entonces todas las columnas tendrán el mismo ancho (si no se ajusta al contenido) $colorTable=NULL // Si verdadero entonces la función de colorear tabla se activa. ) { $claseContenido = "tabla_item"; $claseTitulo = 'tabla_header'; $colorBorde='White'; $colorRenglon1='#FFFFFF'; $colorRenglon2='#F3F3F3'; $colorFondo="#11508D"; $i2 = 0; while($row=mysql_fetch_array($res)) { $cols = count($row)/2; for($i = 0; $i < $cols; $i++) { $arreglo[mysql_field_name($res,$i)][$i2] = $row[$i]; } $i2++; } $numColumnas = count($arreglo); $nombres_keys = array_keys($arreglo); $numRenglones = count($arreglo[$nombres_keys[0]]); if($columnasMismoAncho)$anchoColumnas = floor(100/$numColumnas).'%'; if(!isset($titulosColumnas)) $titulosColumnas = $nombres_keys; if($numColumnas==0)$str_nosort='NoSort'; $HTML=''; if ($titulo!='') { $HTML.=' ';} if(empty($arreglo)){ $HTML .= ''; }else{ $HTML.=' '; $tit=0; while ( $tit < count($titulosColumnas)) { // for ($tit=0; $tit < 4; $tit++) $HTML .= ' '; $tit++; } $HTML.= ' '; //$renglonResaltado=0; for ($ren=0; $ren < $numRenglones; $ren++){ if ($colorRenglon==$colorRenglon1){ $colorRenglon=$colorRenglon2; $renglonResaltado=1; } else { $colorRenglon=$colorRenglon1; $renglonResaltado=0; } $HTML.= ' '.$arreglo[$nombres_keys[$col]][$ren]." "; } $HTML.= ''; } } $HTML.= '
'; $fix='height="22" valign="middle"'; $HTML.='
'.$titulo.'
No hay datos que desplegar
'.$titulosColumnas[$tit].'
'; return $HTML; }//FIN despliega_tabla function uploadFile($FileName, $TmpName, $Target) { $temp = 0; $nombreArchivo = $temp.$FileName; while(file_exists($Target.$nombreArchivo)) { $temp++; $nombreArchivo = $temp.$FileName; } $archivo = $Target.$nombreArchivo; if(move_uploaded_file($TmpName,$archivo)) { $error[0] = 0; $error[1] = $nombreArchivo; } else { $error[0] = -1; $error[1] = "Error al subir la imagen"; } return $error; } function enviarCorreoContacto($para,$datos) { require("../Funciones/Funciones/class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPAuth = true; $mail->Host = "69.64.84.207"; $mail->Username = "generica@iprogram.com.mx"; $mail->Password = "generica2009"; $mail->Port = 45; $mail->From = getGenerico(); $mail->FromName = "Geopolis"; $mail->AddAddress($para); $mail->IsHTML(true); $mail->Subject = "Se han contactado en el sitio de geopolis"; $cuerpo = "Se ha contactado la siguiente persona en el sitio:

Nombre: ".$datos[0]. "
E-mail: ".$datos[1]. "
Teléfono: ".$datos[2]. "
Empresa: ".$datos[3]. "
Comentario: ".$datos[4]. "

Atentamente
Geopolis"; $body = $cuerpo; $mail->Body = $body; $exito = $mail->Send(); return $exito; } function resizeImage($file, $maxSizeW, $maxSizeH) { $save = $file; $pos = strpos(strtolower($file), "jpg"); if ($pos == false) { return; } list($width, $height) = getimagesize($file) ; if ($width > $height) { $modwidth = $maxSizeW; $diff = $width / $modwidth; $modheight = $height / $diff; $position = "1"; } else { $modheight = $maxSizeH; $diff = $height / $modheight; $modwidth = $width / $diff; $position = "2"; } $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100) ; return $position; } function eliminarArchivo($ruta,$nombre) { if ($nombre != "") { $myFile = $ruta.$nombre; if (file_exists($myFile)){unlink($myFile);} } } function imagenFlash($ruta, $nombre, $w, $h, $crop = false) { if (substr($nombre,-3) == "swf") { $foto = ' '; } else { if ($crop) cropImage2($w,$h,$ruta.$nombre); $foto = ''; } echo($foto); } function getImageDim($file, $maxSizeW, $maxSizeH, $ajustar = false) { $save = $file; list($width, $height) = getimagesize($file) ; if ($ajustar == false ) { if ($width > $height) { $modwidth = $maxSizeW; $diff = $width / $modwidth; $modheight = $height / $diff; $position = "1"; } else { $modheight = $maxSizeH; $diff = $height / $modheight; $modwidth = $width / $diff; $position = "2"; } if ($modwidth < $maxSizeW ) { $modwidth = $maxSizeW; $diff = $width / $modwidth; $modheight = $height / $diff; $position = "1"; } if ($modheight < $maxSizeH) { $modheight = $maxSizeH; $diff = $height / $modheight; $modwidth = $width / $diff; $position = "2"; } } else { if ($width > $height) { $modheight = $maxSizeH; $diff = $height / $modheight; $modwidth = $width / $diff; $position = "2"; } else { $modwidth = $maxSizeW; $diff = $width / $modwidth; $modheight = $height / $diff; $position = "1"; } if ($modwidth > $maxSizeW ) { $modwidth = $maxSizeW; $diff = $width / $modwidth; $modheight = $height / $diff; $position = "1"; } if ($modheight > $maxSizeH) { $modheight = $maxSizeH; $diff = $height / $modheight; $modwidth = $width / $diff; $position = "2"; } } $arreglo[0] = (int)$modwidth; $arreglo[1] = (int)$modheight; $arreglo[2] = $position; return $arreglo; } function resizeImage2($file, $maxSizeW, $maxSizeH) { $save = $file; $pos = strpos(strtolower($file), "jpg"); if ($pos == false) { return; } list($width, $height) = getimagesize($file) ; if ($width > $height) { $modwidth = $maxSizeW; $diff = $width / $modwidth; $modheight = $height / $diff; $position = "1"; } else { $modheight = $maxSizeH; $diff = $height / $modheight; $modwidth = $width / $diff; $position = "2"; } if ($modwidth > $maxSizeW) { $modwidth = $maxSizeW; $diff = $width / $modwidth; $modheight = $height / $diff; } if ($modheight > $maxSizeH) { $modheight = $maxSizeH; $diff = $height / $modheight; $modwidth = $width / $diff; } $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100) ; return $position; } function cropImage($nw, $nh, $source, $dest) { $size = getimagesize($source); $w = $size[0]; $h = $size[1]; $stype = substr(strtolower($source),-3); switch($stype) { case 'gif': $simg = imagecreatefromgif($source); break; case 'jpg': $simg = imagecreatefromjpeg($source); break; case 'png': $simg = imagecreatefrompng($source); break; default: return; break; } $dimg = imagecreatetruecolor($nw, $nh); $wm = $w/$nw; $hm = $h/$nh; $h_height = $nh/2; $w_height = $nw/2; if($w> $h) { $adjusted_width = $w / $hm; $half_width = $adjusted_width / 2; $int_width = $half_width - $w_height; imagecopyresampled($dimg,$simg,-$int_width,0,0,0,$adjusted_width,$nh,$w,$h); } elseif(($w <$h) || ($w == $h)) { $adjusted_height = $h / $wm; $half_height = $adjusted_height / 2; $int_height = $half_height - $h_height; imagecopyresampled($dimg,$simg,0,-$int_height,0,0,$nw,$adjusted_height,$w,$h); } else { imagecopyresampled($dimg,$simg,0,0,0,0,$nw,$nh,$w,$h); } imagejpeg($dimg,$dest,100); } function blurImage($cual,$target) { $im = imagecreatefromjpeg($target.$cual); for ($i = 0; $i < 20; $i++) { imagefilter($im, IMG_FILTER_GAUSSIAN_BLUR); } $nombre = substr($cual,0,-4); $nombre .= "_blur".substr($cual,-4); imagejpeg($im, $target.$nombre); imagedestroy($im); return $nombre; } function dropShadow($cual,$nombre) { $src = $_SERVER['DOCUMENT_ROOT'].$cual.$nombre; define("DS_OFFSET", 5); define("DS_STEPS", 3); define("DS_SPREAD", 1); $background = array("r" => 255, "g" => 255, "b" => 255); list($o_width, $o_height) = getimagesize($src); $width = $o_width + DS_OFFSET; $height = $o_height + DS_OFFSET; $image = imagecreatetruecolor($width, $height); $step_offset = array("r" => ($background["r"] / DS_STEPS), "g" => ($background["g"] / DS_STEPS), "b" => ($background["b"] / DS_STEPS)); $current_color = $background; for ($i = 0; $i <= DS_STEPS; $i++) { $colors[$i] = imagecolorallocate($image, round($current_color["r"]), round($current_color["g"]), round($current_color["b"])); $current_color["r"] -= $step_offset["r"]; $current_color["g"] -= $step_offset["g"]; $current_color["b"] -= $step_offset["b"]; } imagefilledrectangle($image, 0,0, $width, $height, $colors[0]); for ($i = 0; $i < count($colors); $i++) { imagefilledrectangle($image, DS_OFFSET, DS_OFFSET, $width, $height, $colors[$i]); $width -= DS_SPREAD; $height -= DS_SPREAD; } $original_image = imagecreatefromjpeg($src); imagecopymerge($image, $original_image, 0,0, 0,0, $o_width, $o_height, 100); imagejpeg($image, $_SERVER['DOCUMENT_ROOT'].$cual."/shadows/".$nombre); imagedestroy($original_image); imagedestroy($image); } function readTXT($cual) { $myFile = "../../".$cual; $fh = fopen($myFile, 'r'); $fr = fread($fh, filesize($myFile)); fclose($fh); return $fr; } function resizeCurrImage($cual,$path, $maxW, $maxH) { $a_imageinfo = getimagesize($_SERVER['DOCUMENT_ROOT'].$path.$cual); $width = $a_imageinfo[0]; $height = $a_imageinfo[1]; // max width 180 max height 140 if ($width > $height) { $w2 = $maxW; $h2 = ($w2 * $height)/$width; } else { $h2 = $maxH; $w2 = ($h2 * $width)/$height; } if ($w2 > $maxW) { $w2 = $maxW; $h2 = ($w2 * $height)/$width; } if ($h2 > $maxH) { $h2 = $maxH; $w2 = ($h2 * $width)/$height; } $info[0] = $h2; $info[1] = $w2; return $info; } ?> Galería Interart - Latin American Masters
Dickens 33-C
Col. Polanco
Mexico, D.F. 11560
t. 5282.2001 / 5282.2002
`