本文整理汇总了PHP中Preferences::moduleIsEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Preferences::moduleIsEnabled方法的具体用法?PHP Preferences::moduleIsEnabled怎么用?PHP Preferences::moduleIsEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preferences
的用法示例。
在下文中一共展示了Preferences::moduleIsEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$prefs = Preferences::getInstance();
if (!$prefs) {
die_error('get Preferences failed', __FILE__, __LINE__);
}
$mods_enable = $prefs->get('general', 'module_enable');
if (!in_array('UserGroupDB', $mods_enable)) {
die_error(_('UserGroupDB module must be enabled'), __FILE__, __LINE__);
}
$this->instance_type = array();
$mod_usergroup_name = 'UserGroupDB_' . $prefs->get('UserGroupDB', 'enable');
$a_userGroupDB = new $mod_usergroup_name();
$this->instance_type['static'] = $a_userGroupDB;
if (Preferences::moduleIsEnabled('UserGroupDBDynamic')) {
$this->instance_type['dynamic'] = UserGroupDBDynamic::getInstance();
}
if (Preferences::moduleIsEnabled('UserGroupDBDynamicCached')) {
$this->instance_type['dynamiccached'] = UserGroupDBDynamicCached::getInstance();
}
}
示例2: authenticate_ovd_user
function authenticate_ovd_user($login_, $password_)
{
// it's not the login&password from the conf file in /etc
// let's try to login a real user
if (Preferences::fileExists() === false) {
$_SESSION['admin_error'] = _('The system is not configured');
Logger::info('main', 'admin/login.php::authenticate_ovd_user the system is not configured');
return false;
}
if (Preferences::moduleIsEnabled('UserDB') === false) {
$_SESSION['admin_error'] = _('The module UserDB is not enabled');
Logger::info('main', 'admin/login.php::authenticate_ovd_user module UserDB is not enabled');
return false;
}
$userDB = UserDB::getInstance();
$user = $userDB->import($login_);
if (!is_object($user)) {
// the user does not exist
$_SESSION['admin_error'] = _('There was an error with your authentication');
Logger::info('main', 'admin/login.php::authenticate_ovd_user authentication failed: user(login=' . $login_ . ') does not exist');
return false;
}
$auth = $userDB->authenticate($user, $password_);
if (!$auth) {
$_SESSION['admin_error'] = _('There was an error with your authentication');
Logger::info('main', 'admin/login.php::authenticate_ovd_user authentication failed for user(login=' . $login_ . '): wrong password');
return false;
}
// the user exists, does he have right to log in the admin panel ?
$policy = $user->getPolicy();
if (isset($policy['canUseAdminPanel']) && $policy['canUseAdminPanel'] == true) {
return $user;
}
Logger::info('main', 'login.php failed to log in ' . $login_ . ' : access denied to admin panel');
$_SESSION['admin_error'] = _('Unauthorized access');
return false;
}
示例3: get
public function get()
{
$used = 0;
$total = 0;
if (Preferences::moduleIsEnabled('ProfileDB')) {
$profiledb = ProfileDB::getInstance();
$total += $profiledb->count();
$used += $profiledb->countOnServer($this->server->fqdn);
}
if (Preferences::moduleIsEnabled('SharedFolderDB')) {
$sharedfolderdb = SharedFolderDB::getInstance();
$total += $sharedfolderdb->count();
$used += $sharedfolderdb->countOnServer($this->server->fqdn);
}
if ($total == 0) {
return 0;
} else {
return 1.0 - (double) $used / (double) $total;
}
}
示例4: getSharedFolders
public function getSharedFolders()
{
if (Preferences::moduleIsEnabled('SharedFolderDB') == false) {
return array();
}
$session_settings_defaults = $this->getSessionSettings('session_settings_defaults');
if (array_key_exists('enable_sharedfolders', $session_settings_defaults)) {
$enable_sharedfolders = $session_settings_defaults['enable_sharedfolders'];
if ($enable_sharedfolders == 0) {
return array();
}
}
$sharedfolderdb = SharedFolderDB::getInstance();
$publications = $sharedfolderdb->get_publications();
$users_group_id = array();
foreach ($publications as $publication) {
if (in_array($publication['group'], $users_group_id)) {
continue;
}
array_push($users_group_id, $publication['group']);
}
// from this group, which are these I am into
$users_groups_mine_ids = $this->get_my_usersgroups_from_list($users_group_id);
$sharedfolders = array();
foreach ($publications as $publication) {
if (!in_array($publication['group'], $users_groups_mine_ids)) {
continue;
}
if (array_key_exists($publication['share'], $sharedfolders)) {
if ($publication['mode'] == 'rw' && $sharedfolders[$publication['share']]['mode'] != 'rw') {
$sharedfolders[$publication['share']]['mode'] = $publication['mode'];
}
continue;
}
$share = $sharedfolderdb->import($publication['share']);
if (is_null($share)) {
continue;
}
$sharedfolders[$publication['share']] = array('share' => $share, 'mode' => $publication['mode']);
}
return $sharedfolders;
}
示例5: popup_error
popup_error(_('Shared folder management is not enabled'));
redirect();
}
if (!checkAuthorization('manageSharedFolders')) {
redirect();
}
if ($_REQUEST['action'] == 'add' && isset($_REQUEST['sharedfolder_id']) && isset($_REQUEST['usergroup_id'])) {
action_add_sharedfolder_acl($_REQUEST['sharedfolder_id'], $_REQUEST['usergroup_id']);
redirect();
} elseif ($_REQUEST['action'] == 'del' && isset($_REQUEST['sharedfolder_id']) && isset($_REQUEST['usergroup_id'])) {
action_del_sharedfolder_acl($_REQUEST['sharedfolder_id'], $_REQUEST['usergroup_id']);
redirect();
}
}
if ($_REQUEST['name'] == 'Profile') {
if (Preferences::moduleIsEnabled('ProfileDB') == false) {
popup_error(_('Profile management is not enabled'));
redirect();
}
if (!checkAuthorization('manageServers')) {
redirect();
}
if ($_REQUEST['action'] == 'del') {
$profiledb = ProfileDB::getInstance();
foreach ($_REQUEST['ids'] as $id) {
$network_folder = $profiledb->import($id);
if (is_object($network_folder)) {
if (!$network_folder->isUsed()) {
$buf = $profiledb->remove($network_folder->id);
} else {
$buf = false;
示例6: array
} else {
if ($serverStatus !== Session::SESSION_STATUS_DESTROYED) {
Logger::info('main', "Session " . $session->id . " switch status " . Session::SESSION_STATUS_DESTROYED . " on " . $server->fqdn);
$session->setServerStatus($server->id, Session::SESSION_STATUS_DESTROYED);
}
}
}
}
}
if (array_key_exists('shares', $ret) && is_array($ret['shares'])) {
$profiledb = null;
if (Preferences::moduleIsEnabled('ProfileDB')) {
$profiledb = ProfileDB::getInstance();
}
$sharedfolderdb = null;
if (Preferences::moduleIsEnabled('SharedFolderDB')) {
$sharedfolderdb = SharedFolderDB::getInstance();
}
$disabled_users = array();
foreach ($ret['shares'] as $share) {
if (is_object($sharedfolderdb) && $sharedfolderdb->exists($share['id'])) {
$buf = $sharedfolderdb->import($share['id']);
$db = $sharedfolderdb;
} else {
if (is_object($profiledb) && $profiledb->exists($share['id'])) {
$buf = $profiledb->import($share['id']);
$db = $profiledb;
} else {
$buf = false;
}
}
示例7: load_orphans
public static function load_orphans()
{
Logger::debug('main', 'Starting Abstract_Network_Folder::load_orphans()');
$sharedfolderdb = null;
if (Preferences::moduleIsEnabled('SharedFolderDB')) {
$sharedfolderdb = SharedFolderDB::getInstance();
}
$profiles = null;
if (Preferences::moduleIsEnabled('ProfileDB')) {
$profiledb = ProfileDB::getInstance();
}
$SQL = SQL::getInstance();
if (is_null($sharedfolderdb) && is_null($profiledb)) {
$SQL->DoQuery('SELECT * FROM #1;', self::$table);
} else {
if (is_null($sharedfolderdb)) {
$SQL->DoQuery('SELECT * FROM #1 WHERE @2 NOT IN ( SELECT @2 FROM #3 );', self::$table, 'id', ProfileDB_internal::$table);
} else {
if (is_null($profiledb)) {
$SQL->DoQuery('SELECT * FROM #1 WHERE @2 NOT IN ( SELECT @2 FROM #3 );', self::$table, 'id', SharedFolderDB_internal::$table);
} else {
$SQL->DoQuery('SELECT * FROM #1 WHERE @2 NOT IN ( SELECT @2 FROM #3 ) AND @2 NOT IN ( SELECT @2 FROM #4 )', self::$table, 'id', ProfileDB_internal::$table, SharedFolderDB_internal::$table);
}
}
}
$rows = $SQL->FetchAllResults();
$network_folders = array();
foreach ($rows as $row) {
$Network_Folder = self::generateFromRow($row);
if (!is_object($Network_Folder)) {
continue;
}
$network_folders[] = $Network_Folder;
}
return $network_folders;
}
示例8: dirname
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
require_once dirname(__FILE__) . '/../admin/includes/core-minimal.inc.php';
if (Preferences::fileExists() === false) {
exit(1);
}
//BEGIN Updating logs cache
$servers = Abstract_Server::load_all();
foreach ($servers as $server) {
$buf = new Server_Logs($server);
$buf->process();
}
//END Updating logs cache
//BEGIN UserGroupDBDynamic_cached update
if (Preferences::moduleIsEnabled('UserGroupDBDynamicCached')) {
$ugdbdc = UserGroupDBDynamicCached::getInstance();
$groups = $ugdbdc->getList();
if (!is_array($groups)) {
Logger::error('main', '(hourly cron) UserGroupDBDynamic_cached->getList() failed');
} else {
foreach ($groups as $a_group) {
$ret = $ugdbdc->updateCache($a_group);
if ($ret !== true) {
Logger::error('main', '(hourly cron) UserGroupDBDynamic_cached->updateCache for group \'' . $a_group->getUniqueID() . '\' failed');
}
}
}
}
//END UserGroupDBDynamic_cached update
exit(0);
示例9: removeRole
public static function removeRole($fqdn_, $role_)
{
Logger::debug('main', "Starting Abstract_Server::removeRole for '{$fqdn_}' removing '{$role_}'");
if (substr($fqdn_, -1) == '.') {
$fqdn_ = substr($fqdn_, 0, strlen($fqdn_) - 1);
}
$a_server = Abstract_Server::load($fqdn_);
if (is_object($a_server) == false) {
Logger::error('main', "Starting Abstract_Server::removeRole error failed to load server '{$fqdn_}'");
return false;
}
$roles = $a_server->getAttribute('roles');
if (is_array($roles) == false) {
return false;
}
if (in_array($role_, $roles) == false) {
return false;
}
switch ($role_) {
case Server::SERVER_ROLE_APS:
$prefs = Preferences::getInstance();
if (!$prefs) {
die_error('get Preferences failed', __FILE__, __LINE__);
}
$slave_server_settings = $prefs->get('general', 'slave_server_settings');
$remove_orphan = (bool) $slave_server_settings['remove_orphan'];
Abstract_Liaison::delete('ApplicationServer', NULL, $fqdn_);
if ($remove_orphan) {
$apps = $a_server->getApplications();
$applicationDB = ApplicationDB::getInstance();
// remove the orphan applications
if (is_array($apps)) {
foreach ($apps as $an_application) {
if ($an_application->isOrphan()) {
Logger::debug('main', "Abstract_Server::delete {$an_application} is orphan");
$applicationDB->remove($an_application);
}
}
}
}
$tm = new Tasks_Manager();
$tm->load_from_server($fqdn_);
foreach ($tm->tasks as $a_task) {
$tm->remove($a_task->id);
}
break;
case Server::SERVER_ROLE_FS:
if (Preferences::moduleIsEnabled('ProfileDB')) {
$profiledb = ProfileDB::getInstance();
$folders = $profiledb->importFromServer($fqdn_);
foreach ($folders as $a_folder) {
$profiledb->remove($a_folder->id);
}
}
if (Preferences::moduleIsEnabled('SharedFolderDB')) {
$sharedfolderdb = SharedFolderDB::getInstance();
$folders = $sharedfolderdb->importFromServer($fqdn_);
foreach ($folders as $a_folder) {
$profiledb->remove($a_folder->id);
}
}
break;
// case Server::SERVER_ROLE_GATEWAY:
// break;
}
return true;
}
示例10: updateNetworkFolders
public function updateNetworkFolders()
{
if (!is_array($this->roles) || !array_key_exists(Server::SERVER_ROLE_FS, $this->roles)) {
Logger::critical('main', 'Server::updateNetworkFolders - Not an FS');
return false;
}
if (!$this->isOnline()) {
Logger::debug('main', 'Server::updateNetworkFolders server "' . $this->fqdn . ':' . $this->web_port . '" is not online');
return false;
}
$forders_on_server = $this->getNetworkFoldersList();
if (is_array($forders_on_server) === false) {
Logger::error('main', 'Server::updateNetworkFolders getNetworkFoldersList failed for fqdn=' . $this->fqdn);
return false;
}
$folders_on_sm1 = array();
if (Preferences::moduleIsEnabled('ProfileDB')) {
$profiledb = ProfileDB::getInstance();
$folders_on_sm1 = $profiledb->importFromServer($this->fqdn);
}
$folders_on_sm2 = array();
if (Preferences::moduleIsEnabled('SharedFolderDB')) {
$sharedfolderdb = SharedFolderDB::getInstance();
$folders_on_sm2 = $sharedfolderdb->importFromServer($this->fqdn);
}
$folders_on_sm = array();
if (is_array($folders_on_sm1)) {
$folders_on_sm = array_merge($folders_on_sm, $folders_on_sm1);
}
if (is_array($folders_on_sm2)) {
$folders_on_sm = array_merge($folders_on_sm, $folders_on_sm2);
}
foreach ($forders_on_server as $folder_id) {
if (Preferences::moduleIsEnabled('SharedFolderDB')) {
$folder = $sharedfolderdb->import($folder_id);
if ($folder) {
$db = $sharedfolderdb;
}
}
if (Preferences::moduleIsEnabled('ProfileDB')) {
if (!$folder) {
$folder = $profiledb->import($folder_id);
$db = $profiledb;
}
}
if (is_object($folder) === false) {
// networkfolder does not exist
$folder = new NetworkFolder();
$folder->id = $folder_id;
$folder->name = $folder_id;
$folder->server = $this->fqdn;
$profiledb->remove($folder);
$sharedfolderdb->remove($folder);
}
}
return true;
}
示例11: getSharedFolders
public function getSharedFolders()
{
$sharedfolders = array();
if (Preferences::moduleIsEnabled('SharedFolderDB') == false) {
return array();
}
$session_settings_defaults = $this->getSessionSettings('session_settings_defaults');
if (array_key_exists('enable_sharedfolders', $session_settings_defaults)) {
$enable_sharedfolders = $session_settings_defaults['enable_sharedfolders'];
if ($enable_sharedfolders == 0) {
return $sharedfolders;
}
}
$usergroups = $this->usersGroups();
if (is_array($usergroups) === false) {
Logger::error('main', 'User::getSharedFolders usersGroups failed for user (login=' . $this->getAttribute('login') . ')');
} else {
$sharedfolderdb = SharedFolderDB::getInstance();
foreach ($usergroups as $group) {
$prefs_of_a_group_unsort = Abstract_UserGroup_Preferences::loadByUserGroupId($group->getUniqueID(), 'general', 'session_settings_defaults');
if (array_key_exists('enable_sharedfolders', $prefs_of_a_group_unsort)) {
$pref = $prefs_of_a_group_unsort['enable_sharedfolders'];
$element = $pref->toConfigElement();
$enable_sharedfolders = $element->content;
if ($enable_sharedfolders == 0) {
continue;
}
}
$networkfolders = $sharedfolderdb->importFromUsergroup($group->getUniqueID());
foreach ($networkfolders as $a_networkfolder) {
$sharedfolders[] = $a_networkfolder;
}
}
}
return array_unique($sharedfolders);
}
示例12: get_liaisons_types
private static function get_liaisons_types()
{
$liaisons_types = array('ApplicationServer', 'AppsGroup', 'ApplicationMimeType', 'ServerSession', 'UsersGroup', 'UsersGroupApplicationsGroup');
if (Preferences::moduleIsEnabled('ProfileDB')) {
$liaisons_types[] = 'UserProfile';
}
if (Preferences::moduleIsEnabled('UsersGroupDBDynamic') || Preferences::moduleIsEnabled('UsersGroupDBDynamicCached')) {
$liaisons_types[] = 'UsersGroupCached';
}
return $liaisons_types;
}
示例13: show_manage
//.........这里部分代码省略.........
echo '<td>' . $key . ' ' . $buffer . '</td>';
if ($can_manage_usersgroups && !$extends_from_default) {
echo '<td>';
echo '<form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this rule?') . '\');">';
echo '<input type="hidden" name="name" value="UserGroup_PolicyRule" />';
echo '<input type="hidden" name="action" value="del" />';
echo '<input type="hidden" name="id" value="' . $group->getUniqueID() . '" />';
echo '<input type="hidden" name="element" value="' . $key . '" />';
echo '<input type="submit" value="' . _('Delete this rule') . '" />';
echo '</form>';
echo '</td>';
}
echo '</tr>';
}
if ($can_manage_usersgroups && count($policy_rules_disable) > 0 && array_search(false, $policy) !== false) {
echo '<tr><form action="actions.php" method="post"><td>';
echo '<input type="hidden" name="name" value="UserGroup_PolicyRule" />';
echo '<input type="hidden" name="action" value="add" />';
echo '<input type="hidden" name="id" value="' . $group->getUniqueID() . '" />';
echo '<select name="element">';
foreach ($policy as $key => $value) {
if ($value === true) {
continue;
}
echo '<option value="' . $key . '" >' . $key . '</option>';
}
echo '</select>';
echo '</td><td><input type="submit" value="' . _('Add this rule') . '" /></td>';
echo '</form></tr>';
}
echo '</table>';
echo '</div>';
echo '<br/>';
if (Preferences::moduleIsEnabled('SharedFolderDB')) {
$sharedfolderdb = SharedFolderDB::getInstance();
$all_sharedfolders = $sharedfolderdb->getList();
if (count($all_sharedfolders) > 0) {
$available_sharedfolders = array();
$used_sharedfolders = $sharedfolderdb->importFromUsergroup($group->getUniqueID());
foreach ($all_sharedfolders as $sharedfolder) {
if (in_array($sharedfolder->id, array_keys($used_sharedfolders))) {
continue;
}
$available_sharedfolders[] = $sharedfolder;
}
echo '<br />';
echo '<div>';
echo '<h2>' . _('Shared folders') . '</h1>';
echo '<table border="0" cellspacing="1" cellpadding="3">';
foreach ($used_sharedfolders as $sharedfolder) {
echo '<tr>';
echo '<td><a href="sharedfolders.php?action=manage&id=' . $sharedfolder->id . '">' . $sharedfolder->name . '</a></td>';
if ($can_manage_sharedfolders) {
echo '<td><form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this shared folder access?') . '\');">';
echo '<input type="hidden" name="name" value="SharedFolder_ACL" />';
echo '<input type="hidden" name="action" value="del" />';
echo '<input type="hidden" name="sharedfolder_id" value="' . $sharedfolder->id . '" />';
echo '<input type="hidden" name="usergroup_id" value="' . $group->getUniqueID() . '" />';
echo '<input type="submit" value="' . _('Delete access to this shared folder') . '" />';
echo '</form></td>';
}
echo '</tr>';
}
if (count($available_sharedfolders) > 0 && $can_manage_sharedfolders) {
echo '<tr><form action="actions.php" method="post"><td>';
echo '<input type="hidden" name="name" value="SharedFolder_ACL" />';
示例14: array
$menu['applications'] = array('id' => 'applications', 'name' => _('Applications'), 'page' => 'applications.php', 'parent' => array());
$menu['configuration'] = array('id' => 'configuration', 'name' => _('Configuration'), 'page' => 'configuration-sumup.php', 'parent' => array());
$menu['status'] = array('id' => 'status', 'name' => _('Status'), 'page' => 'sessions.php', 'parent' => array());
if (isAuthorized('viewServers')) {
$menu['servers_child'] = array('id' => 'servers_child', 'name' => _('Servers'), 'page' => 'servers.php', 'parent' => array('servers'));
$menu['servers_unregistered'] = array('id' => 'servers_unregistered', 'name' => _('Unregistered servers'), 'page' => 'servers.php?view=unregistered', 'parent' => array('servers'));
$menu['tasks'] = array('id' => 'tasks', 'name' => _('Tasks'), 'page' => 'tasks.php', 'parent' => array('servers'));
}
if (isAuthorized('viewSharedFolders')) {
if (Preferences::moduleIsEnabled('SharedFolderDB')) {
$menu['sharedfolders'] = array('id' => 'sharedfolders', 'name' => _('Shared folders'), 'page' => 'sharedfolders.php', 'parent' => array('servers'));
}
}
if (isAuthorized('viewSharedFolders')) {
// it should be viewProfile
if (Preferences::moduleIsEnabled('ProfileDB')) {
$menu['profile'] = array('id' => 'profiles', 'name' => _('Profiles'), 'page' => 'profiles.php', 'parent' => array('servers'));
}
}
if (isAuthorized('viewUsers')) {
$menu['user_child'] = array('id' => 'user_child', 'name' => _('Users'), 'page' => 'users.php', 'parent' => array('users'));
}
if (isAuthorized('viewUsersGroups')) {
$menu['users_groups'] = array('id' => 'users_groups', 'name' => _('Users Groups'), 'page' => 'usersgroup.php', 'parent' => array('users'));
}
if (isAuthorized('viewApplications')) {
$menu['applications_child'] = array('id' => 'applications_child', 'name' => _('Applications'), 'page' => 'applications.php', 'parent' => array('applications'));
}
if (isAuthorized('viewApplicationsGroups')) {
$menu['applications_groups'] = array('id' => 'applications_groups', 'name' => _('Applications Groups'), 'page' => 'appsgroup.php', 'parent' => array('applications'));
}
示例15: remove
public function remove($usergroup_)
{
Logger::debug('main', "USERGROUPDB::remove({$usergroup_})");
if (array_key_exists($usergroup_->id, $this->cache)) {
unset($this->cache[$usergroup_->id]);
}
// first we delete liaisons
$sql2 = SQL::getInstance();
Abstract_Liaison::delete('UsersGroupApplicationsGroup', $usergroup_->getUniqueID(), NULL);
Abstract_Liaison::delete('UsersGroup', NULL, $usergroup_->getUniqueID());
// second we delete sharedfolder acls for the group
if (Preferences::moduleIsEnabled('SharedFolderDB')) {
$sharedfolderdb = SharedFolderDB::getInstance();
$networkfolders = $sharedfolderdb->importFromUsergroup($usergroup_->getUniqueID());
if (is_array($networkfolders) && count($networkfolders) > 0) {
foreach ($networkfolders as $networkfolder) {
$networkfolder->delUserGroup($usergroup_);
}
}
}
// third remove the preferences if it is default
if ($usergroup_->isDefault()) {
// unset the default usergroup
$prefs = new Preferences_admin();
$mods_enable = $prefs->set('general', 'user_default_group', '');
$prefs->backup();
}
// fourth we delete the group
$res = $sql2->DoQuery('DELETE FROM @1 WHERE @2 = %3', $this->table, 'id', $usergroup_->id);
return $res !== false;
}