diff --git a/ajax/ajax_viewpass.php b/ajax/ajax_viewpass.php index 3f1ba737..2e5c2ac7 100644 --- a/ajax/ajax_viewpass.php +++ b/ajax/ajax_viewpass.php @@ -29,7 +29,7 @@ require_once APP_ROOT.DIRECTORY_SEPARATOR.'inc'.DIRECTORY_SEPARATOR.'init.php'; SP_Util::checkReferer('POST'); if (!SP_Init::isLoggedIn()) { - return -1; + SP_Util::logout(); } $accountId = SP_Common::parseParams('p', 'accountid', false); @@ -85,6 +85,8 @@ if (!$isHistory && $fullTxt) { SP_Log::wrLogInfo($message); } +$accountPass = htmlentities(trim($accountClearPass),ENT_COMPAT,'UTF-8'); + if ($fullTxt) { ?>
@@ -95,12 +97,12 @@ if ($fullTxt) { - +
\ No newline at end of file diff --git a/inc/db.class.php b/inc/db.class.php index 37265cb2..34cb2843 100644 --- a/inc/db.class.php +++ b/inc/db.class.php @@ -37,6 +37,7 @@ class DB static $txtError; static $numError; static $num_rows; + static $num_fields; private static $_db; /** @@ -98,6 +99,11 @@ class DB return false; } } + + if (!self::$_db->set_charset("utf8")){ + SP_Init::initError(_('No es posible conectar con la BD'), 'Error ' . self::$_db->connect_errno . ': ' . self::$_db->connect_error); + } + return true; } @@ -167,7 +173,7 @@ class DB * @brief Realizar una consulta a la BBDD * @param string $query con la consulta a realizar * @param string $querySource con el nombre de la función que realiza la consulta - * @return bool|int devuleve bool si hay un error. Devuelve int con el número de registros + * @return bool|int devuelve bool si hay un error. Devuelve int con el número de registros */ public static function doQuery($query, $querySource) { @@ -207,6 +213,7 @@ class DB } self::$num_rows = $queryRes->num_rows; + self::$num_fields = $queryRes->field_count; $queryRes->close(); } diff --git a/inc/tpl/search.php b/inc/tpl/search.php index 84107ae8..cc52b959 100644 --- a/inc/tpl/search.php +++ b/inc/tpl/search.php @@ -32,7 +32,7 @@ $customersSelProp = array("name" => "customer", "label" => "", "selected" => SP_Common::parseParams('s', 'accountSearchCustomer', 0), "default" => "", - "js" => 'OnChange="accSearch(0)"', + "js" => 'OnChange="clearSearch(1); accSearch(0)"', "attribs" => ""); $categoriesSelProp = array("name" => "category", @@ -42,7 +42,7 @@ $categoriesSelProp = array("name" => "category", "label" => "", "selected" => SP_Common::parseParams('s', 'accountSearchCategory', 0), "default" => "", - "js" => 'OnChange="accSearch(0)"', + "js" => 'OnChange="clearSearch(1); accSearch(0)"', "attribs" => ""); $isAdmin = ($_SESSION["uisadminapp"] || $_SESSION["uisadminacc"]); @@ -56,7 +56,7 @@ $searchOrder = SP_Common::parseParams('s', 'accountSearchOrder', 0);
- + /> diff --git a/js/functions.js b/js/functions.js index 487b179d..0383ba5f 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1,4 +1,3 @@ -var gsorder = 0; var lastlen = 0; var order = {}; @@ -96,7 +95,7 @@ function setWindowAdjustSize() { if ( browser == "MSIE" ){ windowAdjustSize = 150; } - console.log(windowAdjustSize); + //console.log(windowAdjustSize); } // Función para retornar el scroll a la posición inicial @@ -105,19 +104,21 @@ function scrollUp() { } // Función para limpiar un formulario -function Clear(id, search) { - if (search !== 1) { - } else { - document.frmSearch.search.value = ""; - document.frmSearch.customer.selectedIndex = 0; - document.frmSearch.category.selectedIndex = 0; +function clearSearch(clearStart) { + if ( clearStart === 1 ){ $('#frmSearch').find('input[name="start"]').val(0); - $('#frmSearch').find('input[name="skey"]').val(0); - $('#frmSearch').find('input[name="sorder"]').val(0); - $(".select-box").val('').trigger("chosen:updated"); - order.key = 0; - order.dir = 0; + return; } + + document.frmSearch.search.value = ""; + document.frmSearch.customer.selectedIndex = 0; + document.frmSearch.category.selectedIndex = 0; + $('#frmSearch').find('input[name="start"]').val(0); + $('#frmSearch').find('input[name="skey"]').val(0); + $('#frmSearch').find('input[name="sorder"]').val(0); + $(".select-box").val('').trigger("chosen:updated"); + order.key = 0; + order.dir = 0; } // Funcion para crear un desplegable con opciones @@ -241,9 +242,9 @@ function viewPass(id, full, history) { type: 'POST', url: APP_ROOT + '/ajax/ajax_viewpass.php', async: false, - data: {'accountid': id, 'full': full, 'isHistory': history}, + data: {'accountid': id, 'full': full, 'isHistory': history, 'isAjax': 1}, success: function(data){ - if (data === "-1") { + if (data == "-1") { doLogout(); } else { if ( full === 0 ){