<?php
/***************************************************************************
- * Copyright (C) 2003-2008 Polytechnique.org *
+ * Copyright (C) 2003-2009 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
class User extends PlUser
{
+ // Additional fields (non core)
+ protected $promo = null;
+
+ public function promo()
+ {
+ return $this->promo;
+ }
+
// Implementation of the login to uid method.
protected function getLogin($login)
{
global $globals;
+ if (!$login) {
+ throw new UserNotFoundException();
+ }
+
// If $data is an integer, fetches directly the result.
if (is_numeric($login)) {
$res = XDB::query("SELECT user_id FROM auth_user_md5 WHERE user_id = {?}", $login);
$this->perm_flags = self::makePerms($this->perms);
}
+ // Return the password of the user
+ public function password()
+ {
+ return XDB::fetchOneCell('SELECT u.password
+ FROM auth_user_md5 AS u
+ WHERE u.user_id = {?}', $this->id());
+ }
+
// Return permission flags for a given permission level.
public static function makePerms($perms)
{
public static function _default_user_callback($login, $results)
{
$result_count = count($results);
- if ($result_count == 0 || !S::has_perms()) {
+ if ($result_count == 0 || !S::admin()) {
Platal::page()->trigError("Il n'y a pas d'utilisateur avec l'identifiant : $login");
} else {
Platal::page()->trigError("Il y a $result_count utilisateurs avec cet identifiant : " . join(', ', $results));