예제 #1
0
function outputFile($filename, $path)
{
    if (vwSessionGetVar('downloadz') != true) {
        global $rsc_dir;
        $data = isAValidMedia($filename);
        $size = filesize("{$rsc_dir}{$path}/{$filename}");
        /*echo '<html>
        				';
        		echo '<body onLoad="clow();">
        				&nbsp;
        				<script>
        					function clow()
        						{
        							window.close();}
        				</script>
        				</body >
        			</html>';*/
        header("Pragma: public");
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        header("Content-Type: {$data['header']}");
        header("Content-Disposition: attachment; filename={$filename}");
        header("Content-Description: Descarga de recurso");
        header('Content-Length: ' . $size);
        header('Content-Transfer-Encoding: base64');
        vwSessionSetVar('downloadz', true);
        @readfile("{$rsc_dir}{$path}/{$filename}");
        echo "<meta http-equiv='refresh' content='7'>";
        die;
    } else {
        vwSessionSetVar('downloadz', false);
        echo '<body onLoad="clow();">
							&nbsp;
							<script>
								function clow()
									{
										window.close();}
							</script>
							</body >
						</html>';
        die;
    }
}
예제 #2
0
function render_admin_listarsecciones($param)
{
    require_once "lister.php";
    $sf = vwVarFromInput('sf');
    $start = vwVarFromInput('start');
    $up = vwVarFromInput('up');
    list($db) = Getdb();
    $tbl = GetTable('secciones');
    $col = GetCols('secciones');
    $sql = "Select * from {$tbl}";
    $Cols = array(array("dbname" => $col['sid'], "label" => "id", "width" => "45px", "sortable" => false), array("dbname" => $col['nombre'], "label" => "Nombre", "width" => "200px", "sortable" => true));
    $opciones = array(array("funcion" => "cbSeccionEdit", "valor" => "{$col['sid']}"), array("funcion" => "cbSeccionDelete", "valor" => "{$col['sid']}"));
    $acciones = array(array('funcion' => "cbSeccionAdmAdd"));
    $archivList = new Lister("admSecciones", $sql, 25, $Cols, $col['sid'], $opciones, "dg-admsecciones.css");
    $archivList->table = "{$tbl}";
    $archivList->where = "";
    $archivList->GeneralActions = $acciones;
    if ($sf != "") {
        $archivList->SetSort($sf, $up);
    }
    if ($start != "") {
        $archivList->SetStart($start);
    }
    $listado = $archivList->render();
    if ($listado === null || trim($listado) == "") {
        $aux = cbSeccionAdmAdd();
        $listado = "<br><center><a link href='{$aux['url']}'>{$aux['etiqueta']}</a></center>";
    }
    $resultado = SmartyInit();
    $plantilla = "seccion/listarseccion.tpl";
    $resultado->assign("listado", $listado);
    $salida = $resultado->fetch($plantilla);
    vwSessionSetVar('urlantigua', CurrentUrl());
    return $salida;
}
예제 #3
0
function render_admin_listarusuarios($param)
{
    require_once "lister.php";
    $sf = vwVarFromInput('sf');
    $start = vwVarFromInput('start');
    $up = vwVarFromInput('up');
    list($db) = Getdb();
    $tblusuarios = GetTable('usuarios');
    $colsusuarios = GetCols('usuarios');
    $sql = "Select * from {$tblusuarios}";
    $Cols = array(array("dbname" => $colsusuarios['uid'], "label" => "id", "width" => "45px", "sortable" => false), array("dbname" => $colsusuarios['uname'], "label" => "Usuario", "width" => "80px", "sortable" => false), array("dbname" => $colsusuarios['nombre'], "label" => "Nombre", "width" => "100px", "sortable" => true), array("dbname" => $colsusuarios['apellidos'], "label" => "Apellidos", "width" => "120px", "sortable" => true), array("dbname" => $colsusuarios['nivel'], "label" => "Nivel", "width" => "45px", "sortable" => false));
    $opciones = array(array("funcion" => "cbUserPromote", "valor" => "{$colsusuarios['nivel']}"), array("funcion" => "cbUserEdit", "valor" => "{$colsusuarios['uid']}"), array("funcion" => "cbUserDelete", "valor" => "{$colsusuarios['uid']}"), array("funcion" => "cbUserMasInfo", "valor" => "{$colsusuarios['uid']}"));
    $acciones = array(array('funcion' => "cbUserAdmAdd"));
    $userList = new Lister("admUsuarios", $sql, 25, $Cols, $colsusuarios['uid'], $opciones, "dg-admusers.css");
    $userList->table = "{$table}";
    $userList->where = "";
    $userList->GeneralActions = $acciones;
    if ($sf != "") {
        $userList->SetSort($sf, $up);
    }
    if ($start != "") {
        $userList->SetStart($start);
    }
    $listado = $userList->render();
    $resultado = SmartyInit();
    $plantilla = "usuarios/listusers.tpl";
    $resultado->assign("listado", $listado);
    $salida = $resultado->fetch($plantilla);
    vwSessionSetVar('urlantigua', CurrentUrl());
    return $salida;
}
예제 #4
0
function render_admin_verrsc($param)
{
    $did = $param['did'];
    if ($did < 1) {
        $did = vwSessionGetVar('udid');
    } else {
        vwSessionSetVar('udid', $did);
    }
    if ($did < 1) {
        header('Location: index.php');
        die;
    }
    require_once "lister.php";
    $sf = vwVarFromInput('sf');
    $start = vwVarFromInput('start');
    $up = vwVarFromInput('up');
    list($db) = Getdb();
    $tbl = GetTable('recursos');
    $col = GetCols('recursos');
    $sql = "Select * from {$tbl} where {$col['did']}={$did}";
    $Cols = array(array("dbname" => $col['rid'], "label" => "id", "width" => "45px", "sortable" => true), array("dbname" => $col['titulo'], "label" => "T&itulo", "width" => "200px", "sortable" => true), array("dbname" => $col['url'], "label" => "URL", "width" => "200px", "sortable" => false), array("dbname" => $col['archivo'], 'label' => "Archivo", "width" => "100px", "sortable" => false));
    $opciones = array(array("funcion" => "cbRscEdit", "valor" => "{$col['rid']}"), array("funcion" => "cbRscDelete", "valor" => "{$col['rid']}"));
    $acciones = array(array('funcion' => "cbRscAdmAdd"));
    $archivList = new Lister("admRecursos", $sql, 25, $Cols, $col['rid'], $opciones, "dg-admrecursos.css");
    $archivList->table = "{$tbl}";
    $archivList->where = "{$col['did']}={$did}";
    $archivList->GeneralActions = $acciones;
    if ($sf != "") {
        $archivList->SetSort($sf, $up);
    }
    if ($start != "") {
        $archivList->SetStart($start);
    }
    $listado = $archivList->render();
    if ($listado === null || trim($listado) == "") {
        $aux = cbSeccionAdmAdd();
        $listado = "<br><center><a link href='{$aux['url']}'>{$aux['etiqueta']}</a></center>";
    }
    $resultado = SmartyInit();
    $plantilla = "document/listarsc.tpl";
    $resultado->assign("listado", $listado);
    $salida = $resultado->fetch($plantilla);
    vwSessionSetVar('urlantigua', CurrentUrl());
    return $salida;
}
예제 #5
0
function render_user_listarResultados($param)
{
    $col = GetCols('documentos');
    $tbl = GetTable('documentos');
    list($db) = Getdb();
    if (vwSessionGetVar('search') == "new") {
        list($cond1, $cond2, $cond3, $cond4, $cond5, $cond6, $cond7, $cond8) = vwVarFromInput('cond1', 'cond2', 'cond3', 'cond4', 'cond5', 'cond6', 'cond7', 'cond8');
        list($aid, $sid, $signatura, $folios, $siglos, $periodo, $resumen, $notas) = vwVarFromInput('aid', 'sid', 'signatura', 'folios', 'siglos', 'periodo', 'resumen', 'notas');
        $ft1 = true;
        $ft2 = true;
        $condiciones = array();
        if (trim($aid) != "") {
            $semaforo = true;
            if ($cond1 != "REQ") {
                $semaforo = false;
            }
            $condiciones[] = array("condicion" => "{$col['aid']}=" . trim($aid), "requerido" => $semaforo);
        }
        if (trim($sid) != "") {
            $semaforo = true;
            if ($cond2 != "REQ") {
                $semaforo = false;
            }
            $condiciones[] = array("condicion" => "{$col['sid']}=" . trim($sid), "requerido" => $semaforo);
        }
        if (trim($signatura) != "") {
            $semaforo = true;
            if ($cond3 != "REQ") {
                $semaforo = false;
            }
            $condiciones[] = array("condicion" => "{$col['signatura']} like '%" . htmlentities(trim($signatura), ENT_QUOTES) . "%'", "requerido" => $semaforo);
        }
        if (trim($folios) != "") {
            $semaforo = true;
            if ($cond4 != "REQ") {
                $semaforo = false;
            }
            $condiciones[] = array("condicion" => "{$col['folios']} like '%" . htmlentities(trim($folios), ENT_QUOTES) . "%'", "requerido" => $semaforo);
        }
        if (trim($siglos) != "") {
            $semaforo = true;
            if ($cond5 != "REQ") {
                $semaforo = false;
            }
            $condiciones[] = array("condicion" => "{$col['siglos']} like '%" . htmlentities(trim($siglos), ENT_QUOTES) . "%'", "requerido" => $semaforo);
        }
        if (trim($periodo) != "") {
            $semaforo = true;
            if ($cond6 != "REQ") {
                $semaforo = false;
            }
            $items = ParsePeriodForSearch($periodo);
            $condicion = "";
            $prev = "";
            $semaforo1 = false;
            foreach ($items as $item) {
                if (!$semaforo1) {
                    $semaforo1 = true;
                    $prev = " OR ";
                }
                $condicion = $condicion . $prev . " {$col['periodo']} like '%{$item}%'";
                $semaforo1 = true;
            }
            if (trim($condicion) != "") {
                $condiciones[] = array("condicion" => "({$condicion})", "requerido" => $semaforo);
            }
        }
        if (trim($resumen) != "") {
            $resumen = str_replace("'", "", $resumen);
            $semaforo = true;
            if ($cond7 != "REQ") {
                $semaforo = false;
            }
            $condiciones[] = array("condicion" => " MATCH ({$col['resumen']}) AGAINST ('" . htmlentities(trim($resumen), ENT_NOQUOTES) . "' IN BOOLEAN MODE)", "requerido" => $semaforo);
            $ft1 = " MATCH ({$col['resumen']}) AGAINST ('" . htmlentities(trim($resumen), ENT_NOQUOTES) . "' IN BOOLEAN MODE) AS puntuaje1";
        }
        if (trim($notas) != "") {
            $notas = str_replace("'", "", $notas);
            $semaforo = true;
            if ($cond8 != "REQ") {
                $semaforo = false;
            }
            $condiciones[] = array("condicion" => " MATCH ({$col['notas']}) AGAINST ('" . htmlentities(trim($notas), ENT_NOQUOTES) . "' IN BOOLEAN MODE)", "requerido" => $semaforo);
            $ft2 = " MATCH ({$col['notas']}) AGAINST ('" . htmlentities(trim($notas), ENT_NOQUOTES) . "' IN BOOLEAN MODE) AS puntuaje2";
        }
        $sqlwhere = "";
        $semaforo = false;
        foreach ($condiciones as $condicion) {
            if (!$semaforo) {
                $sqlwhere = $condicion['condicion'];
                $semaforo = true;
            } else {
                switch ($condicion['requerido']) {
                    case false:
                        $sqlwhere = $sqlwhere . " OR {$condicion['condicion']}";
                        break;
                    case true:
                        $sqlwhere = "({$sqlwhere}) AND {$condicion['condicion']}";
                        break;
                }
            }
        }
        if ($ft1 != true || $ft2 != true) {
            if ($ft1 != true && $ft2 != true) {
                $sql2 = "SELECT *, {$ft1},{$ft2} FROM {$tbl} WHERE {$sqlwhere} ORDER BY puntuaje1 desc, puntuaje2 desc;";
            } else {
                if ($ft2 == true) {
                    $sql2 = "SELECT *, {$ft1} FROM {$tbl} WHERE {$sqlwhere};";
                } else {
                    $sql2 = "SELECT *, {$ft2} FROM {$tbl} WHERE {$sqlwhere};";
                }
            }
        } else {
            $sql2 = "SELECT * FROM {$tbl} WHERE {$sqlwhere} ";
        }
        vwSessionSetVar('sqlsearch', $sql2);
        //vwSessionSetVar('sqlbase',$sqlbase);
        vwSessionSetVar('sqlwhere', $sqlwhere);
        vwSessionSetVar('search', "no");
    } else {
        $sql2 = vwSessionGetVar('sqlsearch');
        $sqlwhere = vwSessionGetVar('sqlwhere');
    }
    $sf = $param['start'] + 0;
    $rs = $db->SelectLimit($sql2, 25, $sf);
    if ($rs === false) {
        $mensaje = "Ha generado una busqueda incorrecta, revise los datos introducidos";
    } else {
        $items = $rs->GetRows();
        if (trim($items[0][$col['aid']] < 1)) {
            $mensaje = "No hay registros que cumplan sus criterios de busqueda";
        }
    }
    /* Aqui comienza el uso del nuevo Lister .... */
    $Cols = array(array("dbname" => $col['aid'], "showcall" => array("funcion" => 'cbzArchivos', "valor" => $col['aid'])), array("dbname" => $col['sid'], "showcall" => array("funcion" => 'cbzSecciones', "valor" => $col['sid'])), array("dbname" => $col['periodo'], "showcall" => array("funcion" => 'cbzPeriodo', "valor" => $col['periodo'])), array("dbname" => "EXTRA", "showcall" => array("funcion" => 'cbzRecursos', "valor" => $col['did'])));
    $options = array(array('funcion' => 'cbzMasInfo', 'valor' => $col['did']));
    $lister = new freeLister("usrListado", "freeLister1.css", "resultDocs.tpl", $col['did'], 25, $Cols, $options, $sqlwhere, $sql2);
    $lister->SetStart($param['start'] + 0);
    $z = $lister->render();
    return $z;
}
예제 #6
0
require_once "tools.php";
require_once "db.inc.php";
require_once "vardb.inc.php";
require_once "varsession.inc.php";
require_once "render.inc.php";
Init();
limpiar();
$uid = vwSessionGetVar("uid");
// Obtenemos el uid del usuario
if (is_null($uid)) {
    $uid = "0";
    vwSessionSetVar("uid", 0);
    $UserName = "******";
    vwSessionSetVar("UserName", $UserName);
    $UserLevel = 1;
    vwSessionSetVar("UserLevel", $UserLevel);
} else {
    //Si no lo es obtenemos su nombre de usuario y su nivel
    $UserLevel = vwSessionGetVar("UserLevel");
    $UserName = vwSessionGetVar("UserName");
}
if (!isset($actor) || isset($actor) && $actor == "") {
    $actor = "static";
    $accion = "mostrar";
    $sujeto = "inicio";
}
switch ($actor) {
    case "static":
        if (trim($accion) == "mostrar") {
            switch ($sujeto) {
                // Pantallas estaticas válidas
function render_admin_listardocumentos($param)
{
    require_once "lister.php";
    $sf = vwVarFromInput('sf');
    $start = vwVarFromInput('start');
    $up = vwVarFromInput('up');
    list($db) = Getdb();
    $tbl = GetTable('documentos');
    $col = GetCols('documentos');
    $sql = "Select * from {$tbl}";
    $Cols = array(array("dbname" => $col['did'], "label" => "id", "width" => "45px", "sortable" => true), array("dbname" => $col['aid'], "label" => "Archivo", "width" => "70px", "sortable" => true, "dropdown" => true, "dropcall" => array("funcion" => "cbzArchivos", "valor" => $col['aid'])), array("dbname" => $col['sid'], "label" => "Secci&oacute;n", "width" => "100px", "sortable" => false, "dropdown" => true, "dropcall" => array("funcion" => "cbzSecciones", "valor" => $col['sid'])), array("dbname" => $col['signatura'], "label" => "Signatura", "width" => "70px", "sortable" => true), array("dbname" => $col['folios'], "label" => "Folios", "width" => "70px", "sortable" => "false"));
    $opciones = array(array("funcion" => "cbDocumentoEdit", "valor" => "{$col['did']}"), array("funcion" => "cbDocumentoDelete", "valor" => "{$col['did']}"), array("funcion" => "cbDocumentoSeeRsc", "valor" => "{$col['did']}"), array("funcion" => "cbDocumentoAddRsc", "valor" => "{$col['did']}"));
    $acciones = array(array('funcion' => "cbDocumentoAdmAdd"));
    $documentList = new Lister("admDocumentos", $sql, 25, $Cols, $col['did'], $opciones, "dg-admdocumentos.css");
    $documentList->table = "{$tbl}";
    $documentList->where = "";
    $documentList->GeneralActions = $acciones;
    if ($sf != "") {
        $documentList->SetSort($sf, $up);
    }
    if ($start != "") {
        $documentList->SetStart($start);
    }
    $listado = $documentList->render();
    if ($listado === null || trim($listado) == "") {
        $aux = cbDocumentoAdmAdd();
        $listado = "<br><center><a link href='{$aux['url']}'>{$aux['etiqueta']}</a></center>";
    }
    $resultado = SmartyInit();
    $plantilla = "document/listardocument.tpl";
    $resultado->assign("listado", $listado);
    $salida = $resultado->fetch($plantilla);
    vwSessionSetVar('urlantigua', CurrentUrl());
    return $salida;
}
function logUserOut()
{
    vwSessionVarsClean();
    $uid = "0";
    vwSessionSetVar("uid", 0);
    $UserName = "******";
    vwSessionSetVar("UserName", $UserName);
    $UserLevel = 1;
    vwSessionSetVar("UserLevel", $UserLevel);
}
예제 #9
0
<?php

require_once "adodb/adodb-sessions.inc.php";
require_once "tools.php";
require_once "db.inc.php";
require_once "vardb.inc.php";
require_once "render.admin.inc.php";
Init();
// Inicializa las conexiones a la BBDD
// Comprobamos la tabla de usuarios para ver si ha expirado algun usuario
if (!vwSessionGetVar("expireuser")) {
    vwSessionSetVar("expireuser", "si");
    require_once "usuario.aux.inc.php";
    ExpireUser();
}
$key = vwSessionGetVar("key");
// Comprobamos si hay hackeo de la pagina
if ($key != "asd654fasd64f6as54fas654f3as21fr4awe31vgsdf3a84g31adv38gv1we6agh13b1f36t432g1b3d54fgh3ea") {
    $param['ruta'] = "error";
    $param['mensaje'] = 'No puedes entrar al menu de administraci&oacute;n sin entrar en el sistema como administrador';
    render($param);
    die;
}
$param = array();
switch ($actor) {
    case "usuarios":
        switch ($accion) {
            case "listarusuarios":
                $param['ruta'] = "{$actor}/{$accion}";
                $param['plantilla'] = "admusuarios";
                render_admin($param);
function render_admin_listarestadisticas($param)
{
    require_once "lister.php";
    $sf = vwVarFromInput('sf');
    $start = vwVarFromInput('start');
    $up = vwVarFromInput('up');
    list($db) = Getdb();
    // Recursos
    $tbl = GetTable('recursos');
    $col = GetCols('recursos');
    $sql = "Select * from {$tbl}";
    $Cols = array(array("dbname" => $col['rid'], "label" => "id", "width" => "45px", "sortable" => false), array("dbname" => $col['nombre'], "label" => "Nombre", "width" => "200px", "sortable" => false), array("dbname" => $col['acceso'], "label" => "Nº Accesos", "width" => "45px", "sortable" => true), array("dbname" => $col['solicitud'], "label" => "Nº Solicitudes", "width" => "45px", "sortable" => true, "sort" => "D"));
    $opciones = array();
    $acciones = array();
    $recurList = new Lister("admRecursos", $sql, 25, $Cols, $col['rid'], $opciones, "dg-admrecursos.css");
    $recurList->table = "{$tbl}";
    $recurList->where = "";
    $recurList->GeneralActions = $acciones;
    if ($sf != "") {
        $recurList->SetSort($sf, $up);
    }
    if ($start != "") {
        $recurList->SetStart($start);
    }
    $listadoRecur = $recurList->render();
    if ($listadoRecur === null || trim($listadoRecur) == "") {
        $listadoRecur = "<br><center>No hay estadisticas a mostrar</a></center>";
    }
    //Documentos
    $tbl = GetTable('documentos');
    $col = GetCols('documentos');
    $sql = "Select * from {$tbl}";
    $Cols = array(array("dbname" => $col['did'], "label" => "id", "width" => "45px", "sortable" => false), array("dbname" => $col['visitas'], "label" => "Visitas", "width" => "45px", "sortable" => true, "sort" => "D"), array("dbname" => $col['signatura'], "label" => "Signatura", "width" => "200px", "sortable" => false));
    $opciones = array();
    $acciones = array();
    $docuList = new Lister("admDocumentos", $sql, 25, $Cols, $col['did'], $opciones, "dg-admdocumentos.css");
    $docuList->table = "{$tbl}";
    $docuList->where = "";
    $docuList->GeneralActions = $acciones;
    if ($sf != "") {
        $docuList->SetSort($sf, $up);
    }
    if ($start != "") {
        $docuList->SetStart($start);
    }
    $listadoDocu = $docuList->render();
    //****************
    if ($listadoDocu === null || trim($listadoDocu) == "") {
        $listadoDocu = "<br><center>No hay estadisticas a mostrar</a></center>";
    }
    ///********
    $listadoRegistros = eventos('registro');
    $listadoVerdoc = eventos('verdoc');
    $listadoVerrsc = eventos('verrsc');
    $listadoSolicitudes = eventos('solicitud');
    $listadoEdicion = eventos('editar');
    $listadoConceder = eventos('conceder');
    ///********
    $resultado = SmartyInit();
    $plantilla = "estadisticas/listarestadisticas.tpl";
    $resultado->assign("listadoRecur", $listadoRecur);
    $resultado->assign("listadoDocu", $listadoDocu);
    $resultado->assign("listadoRegistros", $listadoRegistros);
    $resultado->assign("listadoVerdoc", $listadoVerdoc);
    $resultado->assign("listadoVerrsc", $listadoVerrsc);
    $resultado->assign("listadoSolicitudes", $listadoSolicitudes);
    $resultado->assign("listadoConceder", $listadoConceder);
    $resultado->assign("listadoEdicion", $listadoEdicion);
    $salida = $resultado->fetch($plantilla);
    vwSessionSetVar('urlantigua', CurrentUrl());
    return $salida;
}