Fix issues with string encoding in backtrace
ChangeLog | 3 +++
classes/plbacktrace.php | 13 +++++++++----
classes/plset.php | 1 -
htdocs/css/default.css | 2 +-
htdocs/css/keynote.css | 2 +-
include/userset.inc.php | 17 ++++++++++++++---
modules/carnet.php | 11 ++++++++++-
modules/search/classes.inc.php | 1 +
templates/carnet/mescontacts.tpl | 15 ++++++++++++++-
templates/core/plset.tpl | 2 +-
templates/skin/common.title.header.tpl | 2 +-
11 files changed, 55 insertions(+), 14 deletions(-)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1913
839d8a87-29fc-0310-9880-
83ba4fa771e5
Bug/Wish:
+ * Carnet:
+ - #682: Can quick search in contact list -FRU
+
* Core:
- #674: MiniWiki xhtml validation -FRU
- #678: PlUpload filename detection -FRU
private function fixCharset($action)
{
- return is_utf8($action) ? $action : utf8_encode($action);
+ if (!is_string($action)) {
+ return $action;
+ } else {
+ return is_utf8($action) ? $action : utf8_encode($action);
+ }
}
private function add(array &$entry, $sizef = 'rows', $timef = 'exectime', $errorf = 'error')
unset($entry[$timef]);
$trace['rows'] = @$entry[$sizef];
unset($entry[$sizef]);
- $trace['error'] = @$entry[$errorf];
+ $trace['error'] = $this->fixCharset(@$entry[$errorf]);
unset($entry[$errorf]);
if ($trace['error']) {
$this->error = true;
}
- $trace['data'] = array($entry);
+ $trace['data'] = array($this->fixCharset($entry));
$this->traces[] =& $trace;
}
{
$trace =& $this->traces[count($this->traces) - 1];
$trace['rows'] = $rows;
- $trace['error'] = $error;
+ $trace['error'] = $this->fixCharset($error);
+ array_walk_recursive($userdata, array($this, 'fixCharset'));
$trace['data'] = $userdata;
if ($trace['error']) {
$this->error = true;
$limitcount = "LIMIT $limitcount";
}
$joins = $this->joins . ' ' . $joins;
- $where = $where;
if (trim($this->where)) {
if (trim($where)) {
$where .= ' AND ';
vertical-align: top;
}
-#quick_search {
+.quick_search {
color: gray;
text-align: right;
}
font-size: 95%;
}
-#quick_search {
+.quick_search {
color: gray;
background: #fff;
text-align: right;
new ThrowError('Recherche trop générale.');
}
$this->score = $qSearch->get_score_statement();
- parent::__construct($join . ' ' . $fields->get_select_statement(),
- $where . ' ' . $fields->get_where_statement() .
- (S::logged() && Env::has('nonins') ? ' AND u.perms="pending" AND u.deces=0' : ''));
+ $pwhere = $fields->get_where_statement();
+ if (trim($pwhere)) {
+ if (trim($where)) {
+ $where .= ' AND ';
+ }
+ $where .= $pwhere;
+ }
+ if (S::logged() && Env::has('nonins')) {
+ if (trim($where)) {
+ $where .= ' AND ';
+ }
+ $where .= 'u.perms="pending" AND u.deces=0';
+ }
+ parent::__construct($join . ' ' . $fields->get_select_statement(), $where);
$this->order = implode(',',array_filter(array($fields->get_order_statement(),
'u.promo DESC, NomSortKey, prenom')));
return Array($total, $list);
}
+ function searchErrorHandler($explain) {
+ global $page;
+ $page->trig($explain);
+ $this->handler_contacts($page);
+ }
+
function handler_contacts(&$page, $action = null, $subaction = null, $ssaction = null)
{
$page->assign('xorg_title','Polytechnique.org - Mes contacts');
if ($search && trim(Env::v('quick'))) {
require_once 'userset.inc.php';
$base = 'carnet/contacts/search';
- $view = new SearchSet(true, false, "INNER JOIN contacts AS c2 ON (u.user_id = c2.contact)", " c2.uid = $uid AND ");
+
+ require_once(dirname(__FILE__) . '/search/classes.inc.php');
+ ThrowError::$throwHook = array($this, 'searchErrorHandler');
+ $view = new SearchSet(true, false, "INNER JOIN contacts AS c2 ON (u.user_id = c2.contact)", "c2.uid = $uid");
} else {
$base = 'carnet/contacts';
$view = new UserSet("INNER JOIN contacts AS c2 ON (u.user_id = c2.contact)", " c2.uid = $uid ");
$ip = XDB::escape($this->ip);
$where[] = "( ls.ip = $ip OR ls.forward_ip = $ip )";
}
+
return join(" AND ", $where);
}
il te suffit de cliquer sur l'icône {icon name=add} en face de son nom dans les résultats !
</p>
-{if $plset_count}
+{if $plset_count || $smarty.request.quick}
<p>
Pour récupérer ta liste de contacts dans un PDF imprimable :<br />
(attention, les photos font beaucoup grossir les fichiers !)
</li>
</ul>
+<p>
+ <div style="float: right">
+ <form action="carnet/contacts/search#plset_content" method="get">
+ <input type="text" size="30" name="quick" class="quick_search"
+ value="{$smarty.request.quick|default:'recherche dans tes contacts'}"
+ onfocus="if (this.value == 'recherche dans tes contacts') this.value=''"
+ onblur="if (this.value == '') this.value='recherche dans tes contacts'"/>
+ <a href="carnet/contacts">{icon name=cross title='Annuler la recherche'}</a>
+ </form>
+ </div>
+ Tu peux faire une recherche sur tes contacts :
+</p>
+
{include file="core/plset.tpl"}
{/if}
{* *}
{**************************************************************************}
-<div>
+<div style="clear: both">
<h1 style="display: block; float: right">
{if !$plset_count}
Aucune entrée
{insert name="getNbIns"} polytechniciens sur le web\r
<form action="search" method="get">\r
<div>\r
- <input type="text" size="30" name="quick" id="quick_search" value="{$smarty.request.quick|default:"recherche dans l'annuaire"}" onfocus="if (this.value == '{$smarty.request.quick|default:"recherche dans l'annuaire"|escape:javascript}') this.value=''" onblur="if (this.value == '') this.value='{$smarty.request.quick|default:"recherche dans l'annuaire"|escape:javascript}'"/> \r
+ <input type="text" size="30" name="quick" class="quick_search" value="{$smarty.request.quick|default:"recherche dans l'annuaire"}" onfocus="if (this.value == '{$smarty.request.quick|default:"recherche dans l'annuaire"|escape:javascript}') this.value=''" onblur="if (this.value == '') this.value='{$smarty.request.quick|default:"recherche dans l'annuaire"|escape:javascript}'"/> \r
</div>\r
</form>\r
{insert name="getNbNotifs"}\r