-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUserInfoProtector.class.php
35 lines (31 loc) · 1.08 KB
/
UserInfoProtector.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/**
* @brief This site preload bans access to userinfo. (A user can access self page.)
*
* If you need more expressions, you may modify a template.
*
* @see http://sourceforge.net/tracker/index.php?func=detail&aid=1718508&group_id=159211&atid=943472
*/
class UserInfoProtector extends XCube_ActionFilter
{
public function preBlockFilter()
{
$root =& XCube_Root::getSingleton();
$delegateMgr =& $root->getDelegateManager();
$delegateMgr->add('Legacypage.Userinfo.Access',
"UserInfoProtector::rightCheck",
XCUBE_DELEGATE_PRIORITY_2);
}
public function rightCheck()
{
$root =& XCube_Root::getSingleton();
if (!$root->mContext->mUser->mIdentity->isAuthenticated()) {
$root->mController->executeForward(XOOPS_URL);
}
$uid = $root->mContext->mXoopsUser->get('uid');
$requestUid = $root->mContext->mRequest->getRequest('uid');
if ($uid != null && $uid != $requestUid) {
$root->mController->executeForward(XOOPS_URL);
}
}
}