$v ) { $array[$k] = utf8_decode( $v ); } return $array; } $app = new ecAPP($config); $options = array( 'templateDir' => $app->settings["ecAPI"]["TEMPLATE_DIR"], 'compileDir' => $app->settings["ecAPI"]["COMPILE_DIR"] ); /* 2010-06-01 Cambio pedido por : Gester Alvarez y Felipe C. en Reunion Aprobado por : Paulina C. La pagina del proveedor ya no requiere estár inscrito en Denovios */ /* $require_login = array("inscrito"); */ $tpl=new tpl(); if ( !$_REQUEST["popup"] ) { include("auth.php"); } if ( $_REQUEST["index"] AND $_REQUEST["furl"] ) { $p = $app->readRecord("PROVEEDORES", " URL_____PRO = '".$app->quotesql( $_REQUEST["index"] )."' " ); if ( $p ) $_REQUEST["index"] = $p["ID______PRO"]; else { $output = new HTML_Template_Flexy($options); $output->compile("inactivo.html"); $tpl->CONTENT=$output->bufferedOutputObject($tpl); $tpl->TITLE = "Inactivo"; include("container.php"); die(); } } elseif( is_numeric( $_REQUEST["index"] ) ) { $p = $app->readRecord("PROVEEDORES", " ID______PRO = '".$app->quotesql( $_REQUEST["index"] )."' " ); if ( $p ) { Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: ".$app->settings["ecAPI"]["SITEURL"]."proveedor/".$p["URL_____PRO"] ); exit(); } else { $output = new HTML_Template_Flexy($options); $output->compile("inactivo.html"); $tpl->CONTENT=$output->bufferedOutputObject($tpl); $tpl->TITLE = "Inactivo"; include("container.php"); die(); } } /* $tpl = (object) $app->readRecord("PROVEEDORES , CATEGORIAS ", "ID______PRO='" . $app->quotesql($_REQUEST["index"]) . "' AND activo__pro = 'S' AND ( ID______CAT = categoripro OR ID______CAT || '%' = categoripro OR '%' || ID______CAT = categoripro OR '%' || ID______CAT || '%' = categoripro ) "); */ if ( isset ( $_SESSION["lastCatVisited"] ) ) { $_REQUEST["CATEGORIA"] = (int)$_SESSION["lastCatVisited"]; $tpl->addParams($app->readRecord("PROVEEDORES , CATEGORIAS ", "ID______PRO='" . $app->quotesql( (int) $_REQUEST["index"]) . "' AND activo__pro = 'S' AND ID______CAT = '".$app->quotesql( (int) $_SESSION["lastCatVisited"] )."' ")); } else { $tpl->addParams($app->readRecord("PROVEEDORES ", "ID______PRO='" . $app->quotesql( (int) $_REQUEST["index"]) . "' AND activo__pro = 'S' ")); $cats = explode("|" , $tpl->CATEGORIPRO ); $tpl->addParams( $app->readRecord("CATEGORIAS" , " ID______CAT = '".$app->quotesql( (int) $cats[0] )."' ") ); $_REQUEST["CATEGORIA"] = (int) $tpl->ID______CAT; } if ( !isset( $tpl->ID______PRO ) ) { $output = new HTML_Template_Flexy($options); $output->compile("inactivo.html"); $tpl->CONTENT=$output->bufferedOutputObject($tpl); $tpl->TITLE = "Inactivo"; include("container.php"); die(); } //echo $_REQUEST["index"]; $app->do_query(" UPDATE proveedores SET visitas_pro = visitas_pro + 1 WHERE id______pro = '".(int) $tpl->ID______PRO ."' "); $tpl->DESCRIPCPRO = nl2br($tpl->DESCRIPCPRO); $tpl->NOTICIA_PRO = nl2br($tpl->NOTICIA_PRO); //if ( !eregi('http:\/\/', $tpl->WEB_____PRO ) ) // $tpl->WEB_____PRO = 'http://'.$tpl->WEB_____PRO; $tpl->index = (int)$_REQUEST["index"]; $tpl->url = explode("/",$_SERVER['REQUEST_URI']); $qid = $app->initReadLoop("NOTICIAS", "PROVEEDONOT='" . $app->quotesql($_REQUEST["index"]) . "'"); while($row = $qid->fetchRow(DB_FETCHMODE_ASSOC)) { $tpl->noticias[] = $row; } if ( isset($_REQUEST['idnoticias']) ) { $_REQUEST['idnoticias'] = (int)$_REQUEST['idnoticias']; $qid = $app->initReadLoop("NOTICIAS", "ID______NOT='" . $app->quotesql($_REQUEST["idnoticias"]) . "'"); while($row = $qid->fetchRow(DB_FETCHMODE_ASSOC)) { $tpl->noticia = $row; } } $qid = $app->initReadLoop("PRODUCTOS", "PROVEEDOPRD='" . $app->quotesql($_REQUEST["index"]) . "'", " owner___prd DESC , RANDOM() ASC LIMIT 21"); while($row = $qid->fetchRow(DB_FETCHMODE_ASSOC)) { $row = array_utf8( $row ); if(!$tpl->FOTO1) { $tpl->FOTO1 = $row["FOTO____PRD"]; $tpl->FOTO1_ID = $row["ID______PRD"]; } $row["NOMBRE__PRD"] = str_replace(array("\n","\r"),array(" "," "),nl2br(utf8_encode(substr($row["NOMBRE__PRD"],0,128)))); $row["DESCRIPCPRD"] = str_replace(array("\n","\r"),array(" "," "),nl2br(utf8_encode(substr($row["DESCRIPCPRD"],0,256)))); $tpl->productos[] = $row; } // Le paso la funcion al body onload if ( isset( $tpl->productos[0] ) ) { $tpl->ONLOAD = " switch_image( 'image_top' , '/includes/thumbnailer.php/fill/310/340/".$tpl->productos[0]["FOTO____PRD"]."' , '".$tpl->productos[0]["NOMBRE__PRD"]."' , '".$tpl->productos[0]["DESCRIPCPRD"]."' , 'image_0' , '".$tpl->productos[0]["ID______PRD"]."' ); show_thumbs(); return false; "; } $fotos = explode("|", $tpl->FOTOS___PRO); foreach($fotos as $foto) { if(!$foto) continue; list($name, $mime) = preg_split("/;/", $foto, 2); if(!$tpl->FOTO1) $tpl->FOTO1 = $name; $tpl->fotos[] = $name; } $output = new HTML_Template_Flexy($options); // 2009-10-23 /* if ( !is_file( './archivos/'.$tpl->VIDEO___PRO ) ) { $tpl->VIDEODEMO = $app->readRecord("CONFIG", " nombre__con = 'Denovios_Video_Demo' " ); $tpl->VIDEO___PRO = $tpl->VIDEODEMO["FILE____CON"]; } */ if ( strlen( trim($tpl->VIDEO___PRO) ) == 0 ) { $tpl->VIDEO___PRO = "proveedor-sin-video.png"; } if ( $_REQUEST["popup"] ) { if ( strlen(trim($tpl->WEB_____PRO)) > 7 ) $tpl->WEB = true; if ( strlen(trim($tpl->EMAIL___PRO)) > 7 ) $tpl->EMAIL = true; if ( strlen(trim($tpl->DIRECCIOPRO)) > 7 ) $tpl->DIRECCION = true; if ( strlen(trim($tpl->CONTACTOPRO)) > 7 ) $tpl->CONTACTO = true; $tpl->FONO = TRUE; $nocompilar = true; $output->compile("proveedor_popup.html"); } else { $output->compile("proveedor.html"); } $tpl->CONTENT=$output->bufferedOutputObject($tpl); $tpl->TITLE = "Proveedor - ".$tpl->NOMBRE__PRO; $tpl->DESCRIPTION = "Proveedor - ".$tpl->NOMBRE__PRO." ... "; $tpl->META = "Proveedor - ".$tpl->NOMBRE__PRO.","; include("container.php"); ?>