<?php
/***************************************************************************
- * Copyright (C) 2003-2009 Polytechnique.org *
+ * Copyright (C) 2003-2010 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
$s = replace_accent(trim($this->value));
$r = $s = str_replace('*','%',$s);
- if (S::has_perms() && strpos($s, '@') !== false) {
+ if (S::admin() && strpos($s, '@') !== false) {
$this->email = $s;
- } else if (S::has_perms() && preg_match('/[0-9]+\.([0-9]+|%)\.([0-9]+|%)\.([0-9]+|%)/', $s)) {
+ } else if (S::admin() && preg_match('/[0-9]+\.([0-9]+|%)\.([0-9]+|%)\.([0-9]+|%)/', $s)) {
$this->ip = $s;
}
if ($this->email || $this->ip) {
$join .= "LEFT JOIN emails AS ems ON (ems.uid = u.user_id)";
}
if (!empty($this->ip)) {
- $join .= "INNER JOIN logger.sessions AS ls ON (ls.uid = u.user_id)\n";
+ $join .= "INNER JOIN log_sessions AS ls ON (ls.uid = u.user_id)\n";
}
if (!empty($this->phone)) {
if (!S::logged()) {
function too_large()
{
- return ($this->value=='');
+ return ($this->value == '');
}
// }}}
* imposées par l'utilisateur) */
function length()
{
- $cleaned = replace_accent(strtolower($this->value));
+ $cleaned = strtolower(replace_accent($this->value));
$length = strlen(ereg_replace('[a-z0-9]', '', $cleaned));
return strlen($this->value) - $length;
}
function too_large()
{
- return ($this->length()<2);
+ return ($this->length() < 2);
}
// }}}
{
$this->fields = $_fields;
$this->and = $_and;
- foreach ($this->fields as $key=>&$field) {
- if (is_null($field)) {
- unset($this->fields[$key]);
+
+ $cleanFields = array();
+ foreach ($this->fields as $field) {
+ if (!is_null($field)) {
+ $cleanFields[] = $field;
}
}
+ $this->fields = $cleanFields;
}
// }}}
function too_large()
{
$b = true;
- for ($i=0 ; $b && $i<count($this->fields) ; $i++) {
+ for ($i = 0; $b && $i < count($this->fields); ++$i) {
if (!is_null($this->fields[$i])) {
$b = $b && $this->fields[$i]->too_large();
}