Created
November 2, 2012 08:14
-
-
Save luniki/3999431 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 313024da9c20df01ef6ac71741a42c53e993b5c4 | |
Author: Marcus Lunzenauer <mlunzena@uos.de> | |
Date: Fri Nov 2 08:51:35 2012 +0100 | |
prevent user faking to compatible-ize with Stud.IP2.3 | |
Modified app/controllers/api.php | |
diff --git a/app/controllers/api.php b/app/controllers/api.php | |
index 9cb0298..7d7b1e8 100644 | |
--- a/app/controllers/api.php | |
+++ b/app/controllers/api.php | |
@@ -49,22 +49,26 @@ class ApiController extends StudipController | |
} | |
// Fake user identity | |
- $user = User::find($user_id); | |
- | |
- $GLOBALS['auth'] = new Seminar_Auth(); | |
- $GLOBALS['auth']->auth = array( | |
- 'uid' => $user->user_id, | |
- 'uname' => $user->username, | |
- 'perm' => $user->perms, | |
- ); | |
- | |
- $GLOBALS['user'] = new Seminar_User(); | |
- $GLOBALS['user']->fake_user = true; | |
- $GLOBALS['user']->register_globals = false; | |
- $GLOBALS['user']->start($user->user_id); | |
- | |
- $GLOBALS['perm'] = new Seminar_Perm(); | |
- $GLOBALS['MAIL_VALIDATE_BOX'] = false; | |
+ if ($GLOBALS['user']->id === 'nobody') { | |
+ | |
+ $user = User::find($user_id); | |
+ | |
+ $GLOBALS['auth'] = new Seminar_Auth(); | |
+ $GLOBALS['auth']->auth = array( | |
+ 'uid' => $user->user_id, | |
+ 'uname' => $user->username, | |
+ 'perm' => $user->perms, | |
+ ); | |
+ | |
+ $GLOBALS['user'] = new Seminar_User(); | |
+ $GLOBALS['user']->fake_user = true; | |
+ $GLOBALS['user']->register_globals = false; | |
+ $GLOBALS['user']->start($user->user_id); | |
+ | |
+ | |
+ $GLOBALS['perm'] = new Seminar_Perm(); | |
+ $GLOBALS['MAIL_VALIDATE_BOX'] = false; | |
+ } | |
setTempLanguage($GLOBALS['user']->id); | |
[back] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 313024da9c20df01ef6ac71741a42c53e993b5c4 | |
Author: Marcus Lunzenauer <mlunzena@uos.de> | |
Date: Fri Nov 2 08:51:35 2012 +0100 | |
prevent user faking to compatible-ize with Stud.IP2.3 | |
Modified app/controllers/api.php | |
diff --git a/app/controllers/api.php b/app/controllers/api.php | |
index 9cb0298..7d7b1e8 100644 | |
--- a/app/controllers/api.php | |
+++ b/app/controllers/api.php | |
@@ -49,22 +49,26 @@ class ApiController extends StudipController | |
} | |
// Fake user identity | |
- $user = User::find($user_id); | |
- | |
- $GLOBALS['auth'] = new Seminar_Auth(); | |
- $GLOBALS['auth']->auth = array( | |
- 'uid' => $user->user_id, | |
- 'uname' => $user->username, | |
- 'perm' => $user->perms, | |
- ); | |
- | |
- $GLOBALS['user'] = new Seminar_User(); | |
- $GLOBALS['user']->fake_user = true; | |
- $GLOBALS['user']->register_globals = false; | |
- $GLOBALS['user']->start($user->user_id); | |
- | |
- $GLOBALS['perm'] = new Seminar_Perm(); | |
- $GLOBALS['MAIL_VALIDATE_BOX'] = false; | |
+ if ($GLOBALS['user']->id === 'nobody') { | |
+ | |
+ $user = User::find($user_id); | |
+ | |
+ $GLOBALS['auth'] = new Seminar_Auth(); | |
+ $GLOBALS['auth']->auth = array( | |
+ 'uid' => $user->user_id, | |
+ 'uname' => $user->username, | |
+ 'perm' => $user->perms, | |
+ ); | |
+ | |
+ $GLOBALS['user'] = new Seminar_User(); | |
+ $GLOBALS['user']->fake_user = true; | |
+ $GLOBALS['user']->register_globals = false; | |
+ $GLOBALS['user']->start($user->user_id); | |
+ | |
+ | |
+ $GLOBALS['perm'] = new Seminar_Perm(); | |
+ $GLOBALS['MAIL_VALIDATE_BOX'] = false; | |
+ } | |
setTempLanguage($GLOBALS['user']->id); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment