<?php
////////////////////////////////////////////////////////////////////
// EgO v_0.6b by VairuX //
// WARNING: This is unsupported beta version, download and //
// install it at your own risk. //
// //
// This software is property of VairuX (http://www.vairux.da.ru) //
// You may copy, distribute and sell this program as //
// indicated in Artistic License (See LICENSE.TXT). //
// //
// This program may contain pieces of code from other systems //
// that aren't property and/or responsability of VairuX. //
// //
// (C) Copyright 2004 VairuX Systems //
// http://www.vairux.da.ru/ - //
////////////////////////////////////////////////////////////////////
require_once("./includes/functions.php");
exectime();
if($_SERVER[QUERY_STRING] == "version"){sign();die;}
ob_start("ob_gzhandler");
require_once("./includes/config.php");
require_once("./includes/sql_layer.php");
$system_dbi = sql_connect($system_dbhost, $system_dbuname, $system_dbpass, $system_dbname);
$system_result = sql_query("select catmain, url, pagetitle, pagelogo, login, pass, email, language from ".$system_prefix."main", $system_dbi);
list($system_catmain, $system_url, $system_titulo, $system_header, $system_set["login"], $system_set["pass"], $system_adminmail, $system_language) = sql_fetch_row($system_result, $system_dbi);
if ($system_language) { require_once("./".$system_langfolder."/".$system_language.".php"); } else { require_once("./lang/es-ve.php"); }
$system_result = sql_query("select catid from ".$system_prefix."categorias where catid='$system_catmain'", $system_dbi);
list($system_catmain) = sql_fetch_row($system_result, $system_dbi);
if (!$_GET[page]) {
// Verify if category is valid and in database.
if ($system_catmain == 0) {
$system_result = sql_query("select catid, catskin from ".$system_prefix."categorias", $system_dbi);
list($system_catid, $system_catskin) = sql_fetch_row($system_result, $system_dbi);
} else {
$system_catid = $system_catmain;
}
} else {
if (is_numeric($_GET[page])) {
$system_result = sql_query("select catid, catskin from ".$system_prefix."categorias where catid=$_GET[page]", $system_dbi);
list($system_catid, $system_catskin) = sql_fetch_row($system_result, $system_dbi);
} else {
$system_result = sql_query("select catid, catskin from ".$system_prefix."categorias where cattit='$_GET[page]'", $system_dbi);
list($system_catid, $system_catskin) = sql_fetch_row($system_result, $system_dbi);
}
}
if (eregi ("url:", $system_catskin)) {
// Support for url redirection in categories.
$system_redir = eregi_replace ("url:", "", $system_catskin);
Header ("Location: $system_redir");
sql_logout($system_dbi);
die;
}
if ($system_catskin != null OR $system_catskin !='') {
require_once($system_skinsfolder."/".$system_catskin."-skin.php");
} else {
require_once($system_skinsfolder."/"."default-skin.php");
}
if (!$system_catid) {
// Si no existe el ID de categoria: Dar error, si no existe categoria o esta vacia la tabla.
list($system_count) = sql_fetch_row(sql_query("select count(*) from ".$system_prefix."categorias", $system_dbi), $system_dbi);
if ($system_count == 0) {
$system_categoria = $lang["we_are_sorry"];
$system_descripcion = $lang["site_under_construction"];
} else {
$system_categoria = $lang["error"];
$system_descripcion = $lang["cat_doesnt_exists"];
}
if ($system_showmail == true) {
toolelement($system_contactname, "mailto:".$system_adminmail);
}
if (is_admin()) {
toolelement ($lang["admin_name"], "admin.php");
}
writeskin($system_toolbar, $system_titulo, $system_header, $system_metatags, $system_categoria, $system_descripcion, $system_cuerpo, $system_url, $system_more);
sql_logout($system_dbi);
die;
} else {
// If category exists, then shows all items.
if($_GET["feed"] and !eregi("[\.|\\|/|index]+", $_GET["feed"])){
// Support for feeds. Example: index.php?feed=rss2 and rss2 is rss2.php in feeds directory.
if (is_file("./".$system_feedsfolder."/".$_GET["feed"].".php")) {
require_once("./".$system_feedsfolder."/".$_GET["feed"].".php");
sql_logout($system_dbi);
die;
}
}
$system_result = sql_query("select catdesc, cattit, catmeta, catmod, catlimit, orderwork, ordertype from ".$system_prefix."categorias where catid='$system_catid'", $system_dbi);
list($system_descripcion, $system_categoria, $system_metatags, $system_catmod, $system_catlimit, $system_orderwork, $system_orderworktype) = sql_fetch_row($system_result, $system_dbi);
$system_result = sql_query("select toolcat, toolurl, tooltype, tooltitle, toolimage from ".$system_prefix."toolbar ORDER BY toolorder", $system_dbi);
while(list($system_toolcat, $system_toolurl, $system_tooltype, $system_tooltitle, $system_toolimage) = sql_fetch_row($system_result, $system_dbi)) {
switch ($system_tooltype) {
case "url":
$system_linkurl = $system_toolurl;
break;
case "category":
$system_linkurl = "?page=".$system_toolcat;
break;
default:
$system_linkurl = null;
break;
}
if ($system_toolimage and !eregi("blank.gif", $system_toolimage)) {
$system_linktitle = "<img src=\"".$system_toolbarfolder."/".$system_toolimage."\" border=\"0\" alt=\"".$system_tooltitle."\">";
} else {
$system_linktitle = $system_tooltitle;
}
toolelement($system_linktitle, $system_linkurl);
}
if ($system_showmail == true) {
toolelement($system_contactname, "mailto:".$system_adminmail);
}
if (is_admin()) {
toolelement ($lang["admin_name"], "admin.php", "");
// Agregar administrador interactivo para categorias
$system_descripcion .= "\n<div align=\"center\"><br /><b><font face=\"Arial, Helvetica, sans-serif\" size=\"2\" color=\"#CCCCCC\" style=\"background-color:#000000\"> <a href=\"admin.php?op=editcat&catid=".$system_catid."\"><font color=\"#FF0000\">".$lang["button_edit"]."</font></a> - <a href=\"admin.php?op=delcat&catid=".$system_catid."\"><font color=\"#FF0000\">".$lang["button_delete"]."</font></a> </font></b><br /></div>\n";
}
// Si hay un modulo asociado a la categoria, se incluye.
if ($system_catmod != null) {
include("".$system_modsfolder."/".$system_catmod."");
}
// Configuracion de trabajos por pagina (tipo buscador)
if ($_GET[mas] == null) { $_GET[mas] = 1; }
$system_lpag = ($_GET[mas]-1)*$system_catlimit;
list($system_resultcount) = sql_fetch_row(sql_query("SELECT count(*) from ".$system_prefix."trabajos WHERE (workcat='$system_catid') and ((expira='false') or (expira='true' and expdate >= now()))", $system_dbi), $system_dbi);
//listar trabajos:
$system_listfields = "workid, worktit";
if ($system_list_desc) { $system_listfields .= ", workdesc"; }
if ($system_list_thumb) { $system_listfields .= ", thumbnail"; }
if ($system_list_date) { $system_listfields .= ", expdate"; }
if ($system_list_url) { $system_listfields .= ", workurl"; }
$system_result = sql_query("select ".$system_listfields." from ".$system_prefix."trabajos WHERE (workcat='$system_catid') and ((expira='false') or (expira='true' and expdate >= now())) order by ".$system_orderwork." ".$system_orderworktype." limit $system_lpag,$system_catlimit", $system_dbi);
while($system_workdata = sql_fetch_array($system_result, $system_dbi)) {
//chequeos de trabajos
$system_workthumbnail = $system_thumbsfolder."/".$system_workdata['thumbnail'];
if (eregi("blank.gif", $system_workthumbnail)) { $system_workthumbnail=""; }
//escribe trabajo
writework($system_workdata['workid'], $system_workdata['worktit'], $system_workdata['workurl'], $system_workdata['workdesc'], $system_workthumbnail, $system_workdata['expdate']);
// Agregar administrador interactivo para trabajos
if (is_admin()) {
$system_cuerpo .= "\n<div align=\"center\"><b><font face=\"Arial, Helvetica, sans-serif\" size=\"2\" color=\"CCCCCC\" style=\"background-color:#000000\"> <a href=\"admin.php?op=editwork&workid=".$system_workdata["workid"]."\"><font color=\"#FF0000\">".$lang["button_edit"]."</font></a> - <a href=\"admin.php?op=delwork&workid=".$system_workdata["workid"]."\"><font color=\"#FF0000\">".$lang["button_delete"]."</font></a> </font></b><br /><br /><br /></div>\n";
}
}
// Listar cuantas paginas se consiguieron
if ($system_resultcount != 0) {
$system_numerodepaginas = ($system_resultcount / $system_catlimit);
$system_j = 0;
if ($system_numerodepaginas > 1) {
while ($system_j < $system_numerodepaginas) {
$system_j++;
if ($system_j == $_GET[mas]) {
moreelement($system_j, false);
} else {
moreelement ($system_j, "?page=".$_GET[page]."&mas=".$system_j);
}
}
}
}
//}
writeskin($system_toolbar, $system_titulo, $system_header, $system_metatags, $system_categoria, $system_descripcion, $system_cuerpo, $system_url, $system_more);
}
sql_logout($system_dbi);
sign();
?>