added isLoggedIn()
This commit is contained in:
parent
6d1904ffd6
commit
092ca3ff57
|
@ -55,7 +55,7 @@ class account extends baseModule {
|
||||||
* @see baseModule::get_metaData()
|
* @see baseModule::get_metaData()
|
||||||
*/
|
*/
|
||||||
function get_metaData() {
|
function get_metaData() {
|
||||||
if (isset($_SESSION['loggedIn']) && ($_SESSION['loggedIn'] === true)) {
|
if (isLoggedIn()) {
|
||||||
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
||||||
}
|
}
|
||||||
$return = array();
|
$return = array();
|
||||||
|
@ -81,7 +81,7 @@ class account extends baseModule {
|
||||||
$return['PDF_fields'] = array(
|
$return['PDF_fields'] = array(
|
||||||
'description' => _('Description')
|
'description' => _('Description')
|
||||||
);
|
);
|
||||||
if (isset($_SESSION['loggedIn']) && ($_SESSION['loggedIn'] === true) && !in_array('posixAccount', $modules)) {
|
if (isLoggedIn() && !in_array('posixAccount', $modules)) {
|
||||||
$return['PDF_fields']['uid'] = _('User name');
|
$return['PDF_fields']['uid'] = _('User name');
|
||||||
}
|
}
|
||||||
// help Entries
|
// help Entries
|
||||||
|
|
|
@ -114,7 +114,7 @@ class ddns extends baseModule {
|
||||||
'reverseZone' => _('Reverse zone name'),
|
'reverseZone' => _('Reverse zone name'),
|
||||||
);
|
);
|
||||||
// upload fields
|
// upload fields
|
||||||
if (isset($_SESSION['loggedIn']) && $this->check_if_ddns_is_enable()) {
|
if (isLoggedIn() && $this->check_if_ddns_is_enable()) {
|
||||||
$return['upload_columns'] = array(
|
$return['upload_columns'] = array(
|
||||||
array(
|
array(
|
||||||
'name' => 'ddns_DNSserver',
|
'name' => 'ddns_DNSserver',
|
||||||
|
|
|
@ -164,7 +164,7 @@ class freeRadius extends baseModule {
|
||||||
$profileElements[] = $dialupAccessSelect;
|
$profileElements[] = $dialupAccessSelect;
|
||||||
$return['profile_mappings']['freeRadius_dialupAccess'] = 'dialupAccess';
|
$return['profile_mappings']['freeRadius_dialupAccess'] = 'dialupAccess';
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('freeRadius_hideRadiusProfileDn')) {
|
if (!$this->isBooleanConfigOptionSet('freeRadius_hideRadiusProfileDn') && isLoggedIn()) {
|
||||||
$profileOptions = array('-' => '');
|
$profileOptions = array('-' => '');
|
||||||
foreach ($this->getProfiles() as $dn) {
|
foreach ($this->getProfiles() as $dn) {
|
||||||
$profileOptions[getAbstractDN($dn)] = $dn;
|
$profileOptions[getAbstractDN($dn)] = $dn;
|
||||||
|
|
|
@ -631,7 +631,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$return['PDF_fields']['initials'] = _('Initials');
|
$return['PDF_fields']['initials'] = _('Initials');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_SESSION['loggedIn']) && ($_SESSION['loggedIn'] === true)) {
|
if (isLoggedIn()) {
|
||||||
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
$modules = $_SESSION['config']->get_AccountModules($this->get_scope());
|
||||||
if (!in_array('posixAccount', $modules)) {
|
if (!in_array('posixAccount', $modules)) {
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideUID')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideUID')) {
|
||||||
|
|
|
@ -276,7 +276,7 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
// upload
|
// upload
|
||||||
$return['upload_preDepends'] = array('inetOrgPerson');
|
$return['upload_preDepends'] = array('inetOrgPerson');
|
||||||
// user specific upload options
|
// user specific upload options
|
||||||
if (($this->get_scope() == 'user') && isset($_SESSION['loggedIn']) && ($_SESSION['loggedIn'] === true)) {
|
if (($this->get_scope() == 'user') && isLoggedIn()) {
|
||||||
$return['upload_columns'] = array(
|
$return['upload_columns'] = array(
|
||||||
array(
|
array(
|
||||||
'name' => 'posixAccount_userName',
|
'name' => 'posixAccount_userName',
|
||||||
|
@ -3098,7 +3098,7 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
*/
|
*/
|
||||||
private function getShells() {
|
private function getShells() {
|
||||||
// self service
|
// self service
|
||||||
if (!isset($_SESSION['loggedIn']) && isset($this->selfServiceSettings) && isset($this->selfServiceSettings->moduleSettings['posixAccount_shells'])
|
if (!isLoggedIn() && isset($this->selfServiceSettings) && isset($this->selfServiceSettings->moduleSettings['posixAccount_shells'])
|
||||||
&& (sizeof($this->selfServiceSettings->moduleSettings['posixAccount_shells'])) > 0) {
|
&& (sizeof($this->selfServiceSettings->moduleSettings['posixAccount_shells'])) > 0) {
|
||||||
return $this->selfServiceSettings->moduleSettings['posixAccount_shells'];
|
return $this->selfServiceSettings->moduleSettings['posixAccount_shells'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ class sambaGroupMapping extends baseModule {
|
||||||
);
|
);
|
||||||
// upload fields
|
// upload fields
|
||||||
// search existing Samba 3 domains
|
// search existing Samba 3 domains
|
||||||
if (isset($_SESSION['loggedIn']) && ($_SESSION['loggedIn'] === true)) {
|
if (isLoggedIn()) {
|
||||||
$return['upload_columns'] = array(
|
$return['upload_columns'] = array(
|
||||||
array(
|
array(
|
||||||
'name' => 'sambaGroupMapping_name',
|
'name' => 'sambaGroupMapping_name',
|
||||||
|
|
|
@ -115,7 +115,7 @@ function loadAccountProfile($profile, $scope) {
|
||||||
* @return boolean true, if saving succeeded
|
* @return boolean true, if saving succeeded
|
||||||
*/
|
*/
|
||||||
function saveAccountProfile($attributes, $profile, $scope) {
|
function saveAccountProfile($attributes, $profile, $scope) {
|
||||||
if (!$_SESSION['loggedIn'] == true) return false;
|
if (!isLoggedIn()) return false;
|
||||||
// check profile name
|
// check profile name
|
||||||
if (!preg_match("/^[0-9a-z _-]+$/i", $profile) || !preg_match("/^[a-z]+$/i", $scope)) return false;
|
if (!preg_match("/^[0-9a-z _-]+$/i", $profile) || !preg_match("/^[a-z]+$/i", $scope)) return false;
|
||||||
if (!is_array($attributes)) {
|
if (!is_array($attributes)) {
|
||||||
|
@ -152,7 +152,7 @@ function saveAccountProfile($attributes, $profile, $scope) {
|
||||||
* @return boolean true if profile was deleted
|
* @return boolean true if profile was deleted
|
||||||
*/
|
*/
|
||||||
function delAccountProfile($file, $scope) {
|
function delAccountProfile($file, $scope) {
|
||||||
if (!$_SESSION['loggedIn'] == true) return false;
|
if (!isLoggedIn()) return false;
|
||||||
if (!preg_match("/^[0-9a-z _-]+$/i", $file) || !preg_match("/^[a-z]+$/i", $scope)) return false;
|
if (!preg_match("/^[0-9a-z _-]+$/i", $file) || !preg_match("/^[a-z]+$/i", $scope)) return false;
|
||||||
$prof = substr(__FILE__, 0, strlen(__FILE__) - 16) . "config/profiles/". $_SESSION['config']->getName() . '/' . $file . "." . $scope;
|
$prof = substr(__FILE__, 0, strlen(__FILE__) - 16) . "config/profiles/". $_SESSION['config']->getName() . '/' . $file . "." . $scope;
|
||||||
if (is_file($prof)) {
|
if (is_file($prof)) {
|
||||||
|
|
|
@ -472,4 +472,13 @@ function checkIfToolIsActive($tool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the user is logged in.
|
||||||
|
*
|
||||||
|
* @return boolean is logged in
|
||||||
|
*/
|
||||||
|
function isLoggedIn() {
|
||||||
|
return (isset($_SESSION['loggedIn']) && ($_SESSION['loggedIn'] === true));
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -58,7 +58,7 @@ class group extends baseType {
|
||||||
* @return string alias name
|
* @return string alias name
|
||||||
*/
|
*/
|
||||||
function getAlias() {
|
function getAlias() {
|
||||||
if (isset($_SESSION['loggedIn']) && isset($_SESSION['config'])) {
|
if (isLoggedIn() && isset($_SESSION['config'])) {
|
||||||
$modules = $_SESSION['config']->get_AccountModules('group');
|
$modules = $_SESSION['config']->get_AccountModules('group');
|
||||||
if (in_array('organizationalRole', $modules)) {
|
if (in_array('organizationalRole', $modules)) {
|
||||||
return _('Roles');
|
return _('Roles');
|
||||||
|
|
|
@ -49,7 +49,7 @@ include_once('../../lib/modules.inc');
|
||||||
startSecureSession();
|
startSecureSession();
|
||||||
|
|
||||||
// Redirect to startpage if user is not loged in
|
// Redirect to startpage if user is not loged in
|
||||||
if (!isset($_SESSION['loggedIn']) || ($_SESSION['loggedIn'] !== true)) {
|
if (!isLoggedIn()) {
|
||||||
metaRefresh("../login.php");
|
metaRefresh("../login.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ if (!checkIfWriteAccessIsAllowed()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redirect to startpage if user is not loged in
|
// Redirect to startpage if user is not loged in
|
||||||
if (!isset($_SESSION['loggedIn']) || ($_SESSION['loggedIn'] !== true)) {
|
if (!isLoggedIn()) {
|
||||||
metaRefresh("login.php");
|
metaRefresh("login.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ checkIfToolIsActive('toolFileUpload');
|
||||||
if (!checkIfWriteAccessIsAllowed()) die();
|
if (!checkIfWriteAccessIsAllowed()) die();
|
||||||
|
|
||||||
// Redirect to startpage if user is not loged in
|
// Redirect to startpage if user is not loged in
|
||||||
if (!isset($_SESSION['loggedIn']) || ($_SESSION['loggedIn'] !== true)) {
|
if (!isLoggedIn()) {
|
||||||
metaRefresh("login.php");
|
metaRefresh("login.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ checkIfToolIsActive('toolFileUpload');
|
||||||
if (!checkIfWriteAccessIsAllowed()) die();
|
if (!checkIfWriteAccessIsAllowed()) die();
|
||||||
|
|
||||||
// Redirect to startpage if user is not loged in
|
// Redirect to startpage if user is not loged in
|
||||||
if (!isset($_SESSION['loggedIn']) || ($_SESSION['loggedIn'] !== true)) {
|
if (!isLoggedIn()) {
|
||||||
metaRefresh("login.php");
|
metaRefresh("login.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ if (!checkIfWriteAccessIsAllowed()) die();
|
||||||
checkIfToolIsActive('toolFileUpload');
|
checkIfToolIsActive('toolFileUpload');
|
||||||
|
|
||||||
// Redirect to startpage if user is not loged in
|
// Redirect to startpage if user is not loged in
|
||||||
if (!isset($_SESSION['loggedIn']) || ($_SESSION['loggedIn'] !== true)) {
|
if (!isLoggedIn()) {
|
||||||
metaRefresh("login.php");
|
metaRefresh("login.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue