Skip to content

Instantly share code, notes, and snippets.

@luniki
Created November 2, 2012 08:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luniki/3999431 to your computer and use it in GitHub Desktop.
Save luniki/3999431 to your computer and use it in GitHub Desktop.
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]
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