* Force UTF-8 charset in database connection.

* Fixed password view when it contains some special characters.
* Fixed search filtering when selected result page was >1
* Fixed logout when viewing password.
This commit is contained in:
nuxsmin
2014-06-04 01:08:46 +02:00
parent ba5415950d
commit 94c0c34cac
4 changed files with 32 additions and 22 deletions

View File

@@ -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) {
?>
<div id="fancyMsg" class="msgInfo">
@@ -95,12 +97,12 @@ if ($fullTxt) {
</tr>
<tr>
<td><span class="altTxtBlue"><?php echo _('Clave'); ?></span></td>
<td><?php echo htmlentities(trim($accountClearPass)); ?></td>
<td><?php echo $accountPass; ?></td>
</tr>
</table>
</div>
<?php
} else {
echo htmlentities(trim($accountClearPass));
echo $accountPass;
}
?>

View File

@@ -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();
}

View File

@@ -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);
<table id="tblTools" class="round shadow">
<tr>
<td id="toolsLeft">
<img src="imgs/clear.png" title="<?php echo _('Limpiar'); ?>" class="inputImg" id="btnClear" onClick="Clear('frmSearch', 1); accSearch(0);" />
<img src="imgs/clear.png" title="<?php echo _('Limpiar'); ?>" class="inputImg" id="btnClear" onClick="clearSearch(); accSearch(0);" />
<input type="text" name="search" id="txtSearch" onKeyUp="accSearch(1,event)" value="<?php echo SP_Common::parseParams('s', 'accountSearchTxt'); ?>" placeholder="<?php echo _('Texto a buscar'); ?>"/>
<?php if ( $globalSearch && ! $isAdmin ): ?>
<input type="checkbox" name="gsearch" id="gsearch" class="checkbox" <?php echo ($chkGlobalSearch) ? 'checked="checked"' : ''; ?>/>

View File

@@ -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 ){