/** * @return true if account is admin */ function isAdmin($iId = 0) { if (!$iId && isset($GLOBALS['logged']['admin']) && $GLOBALS['logged']['admin']) { // easier check for currently logged in user return true; } return isRole(BX_DOL_ROLE_ADMIN, $iId); }
function serviceIsUrlAccessable($sURL, $iUserId = 0) { if ($iUserId && isRole(BX_DOL_ROLE_ADMIN, $iUserId) || strpos($sURL, '/' . $GLOBALS['admin_dir']) === 0) { return true; } //admin isn't affected by this module also access to admin panel shouldn't ever be protected $aMemLevel = getMemberMembershipInfo($iUserId); $iMemLevel = $aMemLevel['ID']; if ($iMemLevel) { $aRules = $this->_oDb->getAllRules(); foreach ($aRules as $aRule) { if ($aRule['MemLevels'][$iMemLevel] && @preg_match('#' . $aRule['Rule'] . '#i', $sURL)) { return false; } } } return true; }
function isModerator($iId = 0) { return isRole(BX_DOL_ROLE_MODERATOR, $iId); }
function getUserInfo($sUser) { global $gConf; $aRoles = array('_bx_forum_role_admin' => BX_DOL_ROLE_ADMIN, '_bx_forum_role_moderator' => BX_DOL_ROLE_MODERATOR, '_bx_forum_role_affiliate' => BX_DOL_ROLE_AFFILIATE, '_bx_forum_role_member' => BX_DOL_ROLE_MEMBER, '_bx_forum_role_guest' => BX_DOL_ROLE_GUEST); require_once BX_DIRECTORY_PATH_ROOT . 'inc/utils.inc.php'; require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolProfile.php'; $aRet = array(); $oProfile = new BxDolProfile(getID($sUser)); $aRet['profile_onclick'] = ''; $aRet['profile_url'] = $oProfile->_iProfileID ? getProfileLink($oProfile->_iProfileID) : ''; $aRet['profile_title'] = $oProfile->_iProfileID ? getNickName($oProfile->_iProfileID) : $sUser; $aRet['admin'] = $oProfile->_iProfileID ? isAdmin($oProfile->_iProfileID) : false; $aRet['special'] = false; $aRet['join_date'] = ''; $aRet['role'] = _t('_bx_forum_role_undefined'); if ($oProfile->_iProfileID) { foreach ($aRoles as $sRolelangKey => $iRoleMask) { if (isRole($iRoleMask, $oProfile->_iProfileID)) { $aRet['role'] = _t($sRolelangKey); break; } } } if ($gConf['robot'] == $sUser) { $aRet['profile_title'] = _t('_bx_forum_robot'); $aRet['role'] = _t('_bx_forum_role_robot'); } elseif ($gConf['anonymous'] == $sUser) { $aRet['profile_title'] = _t('_bx_forum_anonymous'); } $aRet['avatar'] = $GLOBALS['oFunctions']->getSexPic('male', 'small'); if ($oProfile->_iProfileID) { $aRet['avatar'] = $GLOBALS['oFunctions']->getMemberAvatar($oProfile->_iProfileID, 'small'); } return $aRet; }
function needRole($role) { if (!isRole($role)) { if ($_SERVER["QUERY_STRING"] == 'c=session&a=loginForm') { die(""); } die('<html><body><script language="javascript">window.top.location.href="?c=session&a=loginForm";</script></body></html>'); } }
function getUserInfo($sUser) { $aRoles = array('_bx_forum_role_admin' => BX_DOL_ROLE_ADMIN, '_bx_forum_role_moderator' => BX_DOL_ROLE_MODERATOR, '_bx_forum_role_affiliate' => BX_DOL_ROLE_AFFILIATE, '_bx_forum_role_member' => BX_DOL_ROLE_MEMBER, '_bx_forum_role_guest' => BX_DOL_ROLE_GUEST); require_once BX_DIRECTORY_PATH_ROOT . 'inc/utils.inc.php'; require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolProfile.php'; $aRet = array(); $oProfile = new BxDolProfile($sUser); $aRet['profile_onclick'] = ''; $aRet['profile_url'] = getProfileLink($oProfile->_iProfileID); $aRet['admin'] = isAdmin($oProfile->_iProfileID); $aRet['special'] = false; $aRet['join_date'] = ''; $aRet['role'] = _t('_bx_forum_role_undefined'); foreach ($aRoles as $sRolelangKey => $iRoleMask) { if (isRole($iRoleMask, $oProfile->_iProfileID)) { $aRet['role'] = _t($sRolelangKey); break; } } if ($oProfile->_iProfileID) { $aProfileInfo = getProfileInfo($oProfile->_iProfileID); if ($aProfileInfo['Avatar']) { include_once BX_DIRECTORY_PATH_MODULES . 'boonex/avatar/include.php'; $aRet['avatar'] = BX_AVA_URL_USER_AVATARS . $aProfileInfo['Avatar'] . 'i' . BX_AVA_EXT; } else { $aRet['avatar'] = $GLOBALS['oFunctions']->getSexPic($aProfileInfo['Sex'], 'small'); } } // Ray integration [begin] /* $iId = $oProfile->_iProfileID; $sPassword = md5(getPassword($iId)); $bEnableRay = (getParam( 'enable_ray' ) == 'on'); $check_res = checkAction ($iId, ACTION_ID_USE_RAY_IM); $aRay = '<ray_on>0</ray_on>'; if ($bEnableRay && $check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) { $aRet['ray_on'] = 1; $aRet['ray_id'] = $iId; $aRet['ray_pwd'] = $sPassword; } */ // Ray integration [ end ] return $aRet; }