addTable('sysvals'); $q->addJoin('syskeys', 'sk', 'syskey_id = sysval_key_id'); $q->addQuery('syskey_type, syskey_sep1, syskey_sep2, sysval_value'); $q->addWhere("sysval_title = '$title'"); $q->exec(); $row = $q->fetchRow(); $q->clear(); // type 0 = list $sep1 = $row['syskey_sep1']; $sep2 = $row['syskey_sep2']; // alias separator // A bit of magic to handle newlines and returns as separators // Missing sep1 is treated as a newline. if (!isset($sep1)) $sep1 = "\n"; if ($sep1 == "\\n") $sep1 = "\n"; if ($sep1 == "\\r") $sep1 = "\r"; $temp = explode( $sep1, $row['sysval_value'] ); $arr = array(); // We use trim() to make sure a numeric that has spaces // is properly treated as a numeric foreach ($temp as $item) { if($item) { $sep2 = empty($sep2) ? "\n" : $sep2; $temp2 = explode( $sep2, $item ); if (isset( $temp2[1] )) { $arr[trim($temp2[0])] = trim($temp2[1]); } else { $arr[trim($temp2[0])] = trim($temp2[0]); } } } return $arr; } function arraySelect( &$arr, $select_name, $select_attribs, $selected, $translate=false ) { $s = "\n\n"; return $s; } //////////////////////////////////////////////////// //Convierte fecha de mysql a normal //////////////////////////////////////////////////// function cambiaf_a_normal($fecha){ ereg( "([0-9]{2,4})-([0-9]{1,2})-([0-9]{1,2})", $fecha, $mifecha); $lafecha=$mifecha[3]."/".$mifecha[2]."/".$mifecha[1]; return $lafecha; } /* * Obtiene la hora de una fecha en formato mysql */ function obtenerHora($fecha){ ereg( "([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $fecha, $mifecha); $lafecha=$mifecha[1].":".$mifecha[2].":".$mifecha[3]; return $lafecha; } //////////////////////////////////////////////////// //Convierte fecha de normal a mysql //////////////////////////////////////////////////// function cambiaf_a_mysql($fecha){ ereg( "([0-9]{1,2})/([0-9]{1,2})/([0-9]{2,4})", $fecha, $mifecha); $lafecha=$mifecha[3]."-".$mifecha[2]."-".$mifecha[1]; return $lafecha; } /* ELIMINA ACENTOS DE UNA CADENA Y CARACTERES RATOS, SUSTITUYE ESPACIOS POR GUIONES Y PONE EN MINUSCULA */ /* function getAliasName($clean_filename) { if (function_exists('iconv')) { $filename = $clean_filename; $filename = preg_replace('~[^0-9_.]+~u', '-', $filename); $filename = trim($filename, "-"); $filename = iconv("utf-8", "us-ascii//TRANSLIT", $filename); $filename = strtolower($filename); $filename = preg_replace('~[^-a-z0-9_.]+~', '', $filename); return $filename; } else { return $clean_filename; } }*/ function getAliasName($clean_filename) { if (function_exists('iconv')) { $filename = $clean_filename; $filename = limpiar_acentos($filename); $filename = trim($filename, "-"); $filename = iconv("utf-8", "us-ascii//TRANSLIT", $filename); $filename = strtolower($filename); // $filename = preg_replace('~[^-a-z0-9_.]+~', '', $filename); return $filename; } else { return $clean_filename; } } function limpiar_acentos($s) { $s = ereg_replace("[]","a",$s); $s = ereg_replace("[]","A",$s); $s = ereg_replace("[]","I",$s); $s = ereg_replace("[]","i",$s); $s = ereg_replace("[]","e",$s); $s = ereg_replace("[]","E",$s); $s = ereg_replace("[]","o",$s); $s = ereg_replace("[]","O",$s); $s = ereg_replace("[]","u",$s); $s = ereg_replace("[]","U",$s); $s = str_replace("","c",$s); $s = str_replace("","C",$s); $s = str_replace("[]","n",$s); $s = str_replace("[]","N",$s); $s = str_replace("[%]","-",$s); $s = str_replace(" ","-",$s); return $s; } /*Crea los directorios recursivamente*/ function crearDirectorio($server, $path) { $dirs = array(); $path = preg_replace('/(\/){2,}|(\\\){1,}/','/',$path); //slo se adminten -; $dirs = explode("/", $path); $path = $server; $i = 0; foreach ($dirs AS $element) { $path .= $element . "/"; if(!is_dir($path) && $i != 0) { if(!mkdir($path,0777)){ echo "Hubo un error en: " . $path; return 0; } } $i++; } return true; echo $path; } ?>
addTable('jos_categories c'); $q->addTable('jos_sections s'); $q->addQuery('c.*'); $q->addWhere('c.alias ="'.$_GET['alias'].'"'); $q->addWhere('c.section =s.id'); $q->addOrder('s.title ASC'); $q->exec(); $i=0; while($aux=$q->fetchRow()){ $val[$i]=$aux; $i++; } $q->clear(); echo ""; $i=0; while($i < sizeof($val)){ $q = new DBQuery; $q->addTable('jos_sections'); $q->addQuery('*'); $q->addWhere('id ="'.$val[$i]['section'].'"'); $q->exec(); $section=$q->fetchRow(); $q->clear(); $q = new DBQuery; $q->addTable('jos_menu'); $q->addQuery('*'); $q->addWhere('alias ="'.$section['alias'].'"'); $q->exec(); $menu=$q->fetchRow(); $q->clear(); $q = new DBQuery; $q->addTable('jos_content'); $q->addQuery('*'); $q->addWhere('catid ="'.$val[$i]['id'].'"'); $q->addWhere('state ="1"'); $q->exec(); while($content=$q->fetchRow()){ echo ""; } $q->clear(); $i++; } echo "
".$val[0]['title']."Localidad
".$content['title']."".$section['title']."
"; ?>