projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change on diff options so it works on the new dev (maybe this is due to the migration...
[platal.git]
/
classes
/
user.php
diff --git
a/classes/user.php
b/classes/user.php
index
eb112ca
..
7afd1a0
100644
(file)
--- a/
classes/user.php
+++ b/
classes/user.php
@@
-1,6
+1,6
@@
<?php
/***************************************************************************
<?php
/***************************************************************************
- * Copyright (C) 2003-20
08
Polytechnique.org *
+ * Copyright (C) 2003-20
10
Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-21,11
+21,23
@@
class User extends PlUser
{
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;
// 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);
// 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);
@@
-186,6
+198,14
@@
class User extends PlUser
$this->perm_flags = self::makePerms($this->perms);
}
$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)
{
// Return permission flags for a given permission level.
public static function makePerms($perms)
{
@@
-204,7
+224,7
@@
class User extends PlUser
public static function _default_user_callback($login, $results)
{
$result_count = count($results);
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));
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));