コード例 #1
0
ファイル: Auto.php プロジェクト: bloveing/openulteo
 public function get_login()
 {
     $userDB = UserDB::getInstance();
     if (!is_object($userDB)) {
         return NULL;
     }
     $prefs = Preferences::getInstance();
     $config = $prefs->get('AuthMethod', 'Auto');
     if (array_key_exists('login', $_POST) && array_key_exists('uselogin', $config) && $config['uselogin'] == '1') {
         $this->login = $_POST['login'];
     } else {
         $this->login = '******' . gen_unique_string();
     }
     $u = new User();
     $u->setAttribute('login', $this->login);
     $u->setAttribute('password', $u->getAttribute('login'));
     $u->setAttribute('displayname', 'user ' . $u->getAttribute('login'));
     if ($userDB->add($u)) {
         $user = $userDB->import($u->getAttribute('login'));
     } else {
         Logger::error('main', 'AuthMethod::Auto::get_login failed to add user ' . $u->getAttribute('login'));
         return NULL;
     }
     if (!is_object($user)) {
         return NULL;
     }
     $this->login = $user->getAttribute('login');
     return $this->login;
 }
コード例 #2
0
 public function __construct()
 {
     parent::__construct();
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $a_pref = $prefs->get('UserGroupDB', 'activedirectory');
     if (is_array($a_pref)) {
         foreach ($a_pref as $k => $v) {
             $this->preferences[$k] = $v;
         }
     }
     // Generate parent (ldap) settings
     $this->preferences['filter'] = '(objectClass=group)';
     $this->preferences['match'] = array('name' => 'name', 'description' => 'description');
     $this->preferences['group_match_user'] = array('user_field', 'group_field');
     $this->preferences['user_field'] = 'memberOf';
     $this->preferences['user_field_type'] = 'group_dn';
     $this->preferences['group_field'] = 'member';
     $this->preferences['group_field_type'] = 'user_dn';
     $this->preferences['ou'] = '';
     if (array_key_exists('use_child_group', $this->preferences)) {
         if (in_array($this->preferences['use_child_group'], array(1, '1'))) {
             $this->preferences['user_field'] .= ':1.2.840.113556.1.4.1941:';
             $this->preferences['group_field'] .= ':1.2.840.113556.1.4.1941:';
         }
     }
 }
コード例 #3
0
 public static function callMethod($method_name_, $type_, $element_ = NULL, $group_ = NULL)
 {
     Logger::debug('main', "Abstract_Liaison::callMethod ('{$method_name_}', '{$type_}', '{$element_}', '{$group_}')");
     if ($type_ != 'UsersGroup') {
         $method_to_call = array('Abstract_Liaison_sql', $method_name_);
         $class_to_use = 'Abstract_Liaison_sql';
     } else {
         $prefs = Preferences::getInstance();
         if (!$prefs) {
             Logger::error('main', 'Abstract_Liaison::load get Preferences failed');
             return NULL;
         }
         $mods_enable = $prefs->get('general', 'module_enable');
         if (!in_array('UserGroupDB', $mods_enable)) {
             Logger::error('main', 'Abstract_Liaison::load UserGroupDB module must be enabled');
             return NULL;
         }
         $mod_usergroup_name = 'UserGroupDB_' . $prefs->get('UserGroupDB', 'enable');
         $liaison_type = call_user_func(array($mod_usergroup_name, 'liaisonType'));
         $method_to_call = array('Abstract_Liaison_' . $liaison_type, $method_name_);
         $class_to_use = 'Abstract_Liaison_' . $liaison_type;
     }
     if (!method_exists($class_to_use, $method_name_)) {
         Logger::error('main', "Abstract_Liaison::callMethod method '{$method_to_call}' does not exist");
         return NULL;
     }
     return call_user_func($method_to_call, $type_, $element_, $group_);
 }
コード例 #4
0
ファイル: SessionManagement.php プロジェクト: skdong/nfs-ovd
 public function __construct()
 {
     $this->prefs = Preferences::getInstance();
     if (!$this->prefs) {
         Logger::critical('main', 'SessionManagement::__construct - get Preferences failed');
         throw_response(INTERNAL_ERROR);
     }
 }
コード例 #5
0
ファイル: sql.php プロジェクト: skdong/nfs-ovd
 public function __construct()
 {
     $prefs = Preferences::getInstance();
     $sql_conf = $prefs->get('general', 'sql');
     if (is_array($sql_conf)) {
         $this->table = $sql_conf['prefix'] . 'user';
     }
 }
コード例 #6
0
ファイル: ldap.php プロジェクト: bloveing/openulteo
 public function __construct()
 {
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $this->config = $prefs->get('UserDB', 'ldap');
     $this->cache_users = array();
 }
コード例 #7
0
ファイル: sql.php プロジェクト: skdong/nfs-ovd
 public function __construct()
 {
     $prefs = Preferences::getInstance();
     $sql_conf = $prefs->get('general', 'sql');
     if (is_array($sql_conf)) {
         @define('APPLICATION_TABLE', $sql_conf['prefix'] . 'application');
     }
     $this->cache = array();
 }
コード例 #8
0
ファイル: sql_external.php プロジェクト: skdong/nfs-ovd
 public function __construct()
 {
     $prefs = Preferences::getInstance();
     if ($prefs) {
         $this->config = $prefs->get('UserGroupDB', 'sql_external');
     } else {
         die_error('USERGROUPDB::MYSQL_external::construct get Prefs failed', __FILE__, __LINE__);
     }
 }
コード例 #9
0
ファイル: UsersList.class.php プロジェクト: skdong/nfs-ovd
 public function __construct($array_env)
 {
     $this->search_item = '';
     $this->search_fields = array('login');
     if (array_keys_exists_not_empty(array('search_item'), $array_env) && isset($array_env['search_fields'])) {
         $this->search_item = $array_env['search_item'];
         $this->search_fields = $array_env['search_fields'];
     }
     $prefs = Preferences::getInstance();
     $this->search_limit = $prefs->get('general', 'max_items_per_page');
 }
コード例 #10
0
ファイル: mail.inc.php プロジェクト: bloveing/openulteo
function send_alert_mail($subject_, $message_)
{
    $prefs = Preferences::getInstance();
    if (!$prefs) {
        die_error('get Preferences failed', __FILE__, __LINE__);
    }
    $tos = $prefs->get('events', 'mail_to');
    foreach ($tos as $to) {
        sendamail($to, $subject_, $message_);
    }
}
コード例 #11
0
ファイル: internal.php プロジェクト: skdong/nfs-ovd
 public function __construct()
 {
     $prefs = Preferences::getInstance();
     if ($prefs) {
         $sql_conf = $prefs->get('general', 'sql');
         if (is_array($sql_conf)) {
             $this->table = $sql_conf['prefix'] . UserGroupDBDynamicCached_internal::$tablename;
         } else {
             $this->table = NULL;
         }
     }
 }
コード例 #12
0
 public function __construct()
 {
     parent::__construct();
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $this->config_ad = $prefs->get('UserDB', 'activedirectory');
     if (is_null($this->config_ad)) {
         die_error('Active Directory configuration missing2', __FILE__, __LINE__);
     }
     $this->config = $this->makeLDAPconfig();
 }
コード例 #13
0
ファイル: sql.php プロジェクト: skdong/nfs-ovd
 public function __construct()
 {
     $prefs = Preferences::getInstance();
     if ($prefs) {
         $sql_conf = $prefs->get('general', 'sql');
         if (is_array($sql_conf)) {
             $this->table = $sql_conf['prefix'] . ApplicationsGroupDB_sql::$prefixless_tablename;
         } else {
             $this->table = NULL;
         }
     }
     $this->cache = array();
 }
コード例 #14
0
ファイル: SQL.class.php プロジェクト: bloveing/openulteo
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         $prefs = Preferences::getInstance();
         if (!$prefs) {
             die_error('get Preferences failed', __FILE__, __LINE__);
             return false;
         }
         $sql_conf = $prefs->get('general', 'sql');
         self::newInstance($sql_conf);
     }
     return self::$instance;
 }
コード例 #15
0
ファイル: sql.php プロジェクト: skdong/nfs-ovd
 public function __construct()
 {
     $prefs = Preferences::getInstance();
     if ($prefs) {
         $sql_conf = $prefs->get('general', 'sql');
         if (is_array($sql_conf)) {
             $this->table = $sql_conf['prefix'] . 'usergroup';
         } else {
             $this->table = NULL;
         }
     }
     $this->cache = array();
 }
コード例 #16
0
ファイル: ldap.php プロジェクト: bloveing/openulteo
 public function __construct()
 {
     $this->cache_import = array();
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $a_pref = $prefs->get('UserGroupDB', 'ldap');
     if (is_array($a_pref)) {
         $this->preferences = $a_pref;
     } else {
         // ugly...
         $this->preferences = array();
     }
 }
コード例 #17
0
ファイル: UserDB.php プロジェクト: bloveing/openulteo
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         $prefs = Preferences::getInstance();
         if (!$prefs) {
             die_error('get Preferences failed', __FILE__, __LINE__);
         }
         $mods_enable = $prefs->get('general', 'module_enable');
         if (!in_array('UserDB', $mods_enable)) {
             die_error(_('UserDB module must be enabled'), __FILE__, __LINE__);
         }
         $mod_app_name = 'UserDB_' . $prefs->get('UserDB', 'enable');
         self::$instance = new $mod_app_name();
     }
     return self::$instance;
 }
コード例 #18
0
ファイル: domain.php プロジェクト: skdong/nfs-ovd
function get_domain()
{
    $prefs = Preferences::getInstance();
    $buf = $prefs->get('UserDB', 'enable');
    if ($buf == 'activedirectory') {
        $buf = $prefs->get('UserDB', 'activedirectory');
        return $buf['domain'];
    }
    if ($buf == 'ldap') {
        $buf = $prefs->get('UserDB', 'ldap');
        if (isset($buf['ad']) && $buf['ad'] == 1) {
            return $buf['host'];
        }
    }
    return NULL;
}
コード例 #19
0
 public function toConfigElement()
 {
     $prefs = Preferences::getInstance();
     $settings = $prefs->getElements($this->key, $this->container);
     if (is_array($settings) == false) {
         Logger::error('main', 'User_Preferences::toConfigElement prefs(' . $this->key . ',' . $this->container . ') is not an array');
         return null;
     }
     if (array_key_exists($this->element_id, $settings) == false) {
         Logger::error('main', 'User_Preferences::toConfigElement \'' . $this->element_id . '\' not in prefs(' . $this->key . ',' . $this->container . ') is not an array');
         return null;
     }
     $a_setting = clone $settings[$this->element_id];
     $a_setting->content = $this->value;
     return $a_setting;
 }
コード例 #20
0
 public function __construct($id_, $name_, $description_, $url_)
 {
     Logger::debug('main', "Application_weblink::construct('{$id_}','{$name_}','{$description_}','{$url_}')");
     parent::__construct($id_, $name_, $description_, 'weblink', $url_, NULL, NULL, NULL, true, $name_ . '.weblink');
     // executable_path <=> url;
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $mods_enable = $prefs->get('general', 'module_enable');
     if (!in_array('ApplicationDB', $mods_enable)) {
         die_error('Module ApplicationDB must be enabled', __FILE__, __LINE__);
     }
     $default_browser = $prefs->get('general', 'default_browser');
     if (!is_array($default_browser)) {
         Logger::error('main', 'Application_weblink::construct failed to get default_browser preferences');
     }
     $this->default_browser = $default_browser;
 }
コード例 #21
0
 public final function getIsActive()
 {
     try {
         $prefs = Preferences::getInstance();
     } catch (Exception $e) {
         return false;
     }
     if (!is_object($prefs)) {
         return false;
     }
     $buf = $prefs->get('events', 'active_callbacks');
     if ($buf && array_key_exists(get_class($this->ev), $buf)) {
         $tmp = $buf[get_class($this->ev)];
         if (in_array(get_class($this), $tmp)) {
             return true;
         }
     }
     return false;
 }
コード例 #22
0
ファイル: Logger.class.php プロジェクト: bloveing/openulteo
 public function __construct($module_ = 'main')
 {
     $this->filename = SESSIONMANAGER_LOGS . '/' . strtolower($module_) . '.log';
     $this->fd = @fopen($this->filename, 'a');
     if ($this->fd === false) {
         $this->fd = NULL;
     }
     try {
         $prefs = Preferences::getInstance();
         $level_flags2 = array();
         if (is_object($prefs)) {
             $level_flags2 = $prefs->get('general', 'log_flags');
         }
         if (!isset($level_flags2) || !is_array($level_flags2)) {
             $level_flags2 = array($level_);
         }
         $this->level_flags = $level_flags2;
     } catch (Exception $e) {
     }
 }
コード例 #23
0
function do_auto_clean_db($new_prefs)
{
    $prefs = Preferences::getInstance();
    $old_profile = getProfileMode($prefs);
    $new_profile = getProfileMode($new_prefs);
    $old_u = $prefs->get('UserDB', 'enable');
    $new_u = $new_prefs->get('UserDB', 'enable');
    $old_ugrp = $prefs->get('UserGroupDB', 'enable');
    $new_ugrp = $new_prefs->get('UserGroupDB', 'enable');
    $has_changed_u = False;
    $has_changed_ug = False;
    $userGroupDB = UserGroupDB::getInstance();
    if ($old_profile == $new_profile) {
        $p = new $new_profile();
        list($has_changed_u, $has_changed_ug) = $p->has_change($prefs, $new_prefs);
    }
    // If UserDB module change
    if (($old_u != $new_u || $has_changed_u) && $userGroupDB->isWriteable()) {
        // Remove Users from user groups
        Abstract_Liaison::delete('UsersGroup', NULL, NULL) or popup_error('Unable to remove Users from UserGroups');
        // check if profile must become orphan
        $mods_enable = $prefs->get('general', 'module_enable');
        $new_mods_enable = $new_prefs->get('general', 'module_enable');
        if (in_array('ProfileDB', $mods_enable) || in_array('ProfileDB', $new_mods_enable)) {
            Abstract_Liaison::delete('UserProfile', NULL, NULL);
        }
    }
    // If UserGroupDB module change
    if ($old_ugrp != $new_ugrp || $has_changed_ug) {
        // Remove Publications
        Abstract_Liaison::delete('UsersGroupApplicationsGroup', NULL, NULL) or popup_error('Unable to remove Publications');
        // Unset default usersgroup
        $new_prefs->set('general', 'user_default_group', NULL);
        // check if sharedfolder must become orphan
        $mods_enable = $prefs->get('general', 'module_enable');
        $new_mods_enable = $new_prefs->get('general', 'module_enable');
        if (in_array('SharedFolderDB', $mods_enable) || in_array('SharedFolderDB', $new_mods_enable)) {
            Abstract_Liaison::delete('UserGroupSharedFolder', NULL, NULL);
        }
    }
}
コード例 #24
0
 public function __construct($id_, $application_id, $url_prefix, $raw_configuration, $values)
 {
     Logger::debug('api', "Application_webapp_configuration::construct('{$id_}','{$application_id}','{$url_prefix}','{$raw_configuration}','{$values}')");
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $mods_enable = $prefs->get('general', 'module_enable');
     if (!in_array('ApplicationDB', $mods_enable)) {
         die_error('Module ApplicationDB must be enabled', __FILE__, __LINE__);
     }
     if (!in_array('WebAppConfDB', $mods_enable)) {
         die_error('Module WebAppConfDB must be enabled', __FILE__, __LINE__);
     }
     $this->attributes = array();
     $this->attributes['id'] = $id_;
     $this->attributes['application_id'] = $application_id;
     $this->attributes['url_prefix'] = $url_prefix;
     $this->attributes['raw_configuration'] = $raw_configuration;
     $this->attributes['values'] = $values;
 }
コード例 #25
0
ファイル: Script.class.php プロジェクト: bloveing/openulteo
 public function usersGroups()
 {
     Logger::debug('main', 'Script::usersGroups');
     $userGroupDB = UserGroupDB::getInstance();
     $result = array();
     // add the default user group is enable
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         Logger::critical('main', 'Script::usersGroups get prefs failed');
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $liaison = Abstract_Liaison::load('Scripts', $this->getAttribute('name'), NULL);
     if (is_null($liaison)) {
         Logger::error('main', 'Script::usersGroups load(' . $this->getAttribute('name') . ') is null');
         return $result;
     }
     foreach ($liaison as $row) {
         $g = $userGroupDB->import($row->group);
         if (is_object($g)) {
             $result[] = $g;
         }
     }
     return $result;
 }
コード例 #26
0
 public function getPolicy($with_default_ = true)
 {
     Logger::debug('main', 'UsersGroup::getPolicy for ' . $this->id);
     $prefs = Preferences::getInstance();
     $prefs_policy = $prefs->get('general', 'policy');
     $elements = $prefs->getElements('general', 'policy');
     if (array_key_exists('default_policy', $elements) == false) {
         Logger::error('main', 'UsersGroup::getPolicy, default_policy not found on general policy');
         return array();
     }
     $result_keys = $elements['default_policy']->content_available;
     $result = array();
     foreach ($result_keys as $key) {
         $result[$key] = false;
     }
     $default_policy = $prefs_policy['default_policy'];
     foreach ($default_policy as $k => $v) {
         if ($with_default_) {
             $result[$v] = true;
         } else {
             unset($result[$v]);
         }
     }
     $acls = Abstract_Liaison::load('ACL', $this->getUniqueID(), NULL);
     if (is_array($acls)) {
         foreach ($acls as $acl_liaison) {
             $result[$acl_liaison->group] = True;
         }
     }
     return $result;
 }
コード例 #27
0
ファイル: internal.php プロジェクト: bloveing/openulteo
 public static function getAuthMethods()
 {
     $prefs = Preferences::getInstance();
     return $prefs->get('AuthMethod', 'enable');
 }
コード例 #28
0
ファイル: session-reporting.php プロジェクト: skdong/nfs-ovd
function show_default()
{
    $search_by_user = false;
    $search_by_time = false;
    $user = '';
    $t1 = time();
    $t0 = strtotime('-1 Month', $t1);
    $prefs = Preferences::getInstance();
    $search_limit = $prefs->get('general', 'max_items_per_page');
    if (isset($_REQUEST['search_by']) && is_array($_REQUEST['search_by'])) {
        if (in_array('user', $_REQUEST['search_by'])) {
            $search_by_user = true;
            if (isset($_REQUEST['user'])) {
                $user = $_REQUEST['user'];
            }
        } else {
            $search_by_user = false;
        }
        if (in_array('time', $_REQUEST['search_by'])) {
            $search_by_time = true;
            if (isset($_REQUEST['from'])) {
                $t0 = $_REQUEST['from'];
            }
            if (isset($_REQUEST['to'])) {
                $t1 = $_REQUEST['to'];
            }
        } else {
            $search_by_time = false;
        }
    }
    $sessions = get_sessions_history($search_by_time ? $t0 : null, $search_by_time ? $t1 : null, $search_by_user ? $user : null, $search_limit + 1);
    $partial_result = false;
    if (count($sessions) > $search_limit) {
        $partial_result = true;
        array_pop($sessions);
    }
    page_header(array('js_files' => array('media/script/lib/calendarpopup/CalendarPopup.js')));
    echo '<script type="text/javascript" charset="utf-8">';
    echo '  function toggle_login(state) {';
    echo '    if (state == true) {';
    echo '      $(\'by_login_1\').show();';
    echo '      $(\'by_login_2\').show();';
    echo '    } else {';
    echo '      $(\'by_login_1\').hide();';
    echo '      $(\'by_login_2\').hide();';
    echo '    }';
    echo '  };';
    echo '  function toggle_time(state) {';
    echo '    if (state == true) {';
    echo '      $(\'by_time_1\').show();';
    echo '      $(\'by_time_2\').show();';
    echo '    } else {';
    echo '      $(\'by_time_1\').hide();';
    echo '      $(\'by_time_2\').hide();';
    echo '    }';
    echo '  };';
    echo '  Event.observe(window, \'load\', function() {';
    echo '    toggle_login(' . ($search_by_user ? 'true' : 'false') . ');';
    echo '    toggle_time(' . ($search_by_time ? 'true' : 'false') . ');';
    echo '  });';
    echo '</script>';
    echo '<h1>' . _('Sessions Reporting') . '</h1>';
    echo '<div style="margin-bottom: 15px;">';
    echo '<form action="" method="GET">';
    echo '<table>';
    echo '<tr><td colspan="5">' . _('Search for archived sessions :') . '</td></tr>';
    echo '<tr><td style="padding-left: 15px;">&nbsp;</td><td><input type="checkbox" name="search_by[]" value="user" onchange="toggle_login(this.checked);"';
    if ($search_by_user === true) {
        echo ' checked="checked"';
    }
    echo '/>' . _('By user') . '</td></tr>';
    echo '<tr id="by_login_1"><td></td><td></td><td colspan="3"><input type="text" name="user" value="' . $user . '" /></td></tr>';
    echo '<tr id="by_login_2"><td></td><td></td><td colspan="3"><em>' . _('user login') . '</em></td></tr>';
    echo '<tr><td></td><td><input type="checkbox" name="search_by[]" value="time" onchange="toggle_time(this.checked);"';
    if ($search_by_time === true) {
        echo ' checked="checked"';
    }
    echo '"/>' . _('By time') . '</td></tr>';
    echo '<tr id="by_time_1"><td></td><td></td><td><strong>' . _('From') . '</strong></td>';
    echo '<td>';
    echo '<a href="#" id="anchor_day_from" onclick="calendar_day_from.select($(\'from\'), \'anchor_day_from\'); return false;" >' . date('Y-m-d', $t0) . '</a>';
    echo '&nbsp;<select id="hour_from" onchange="calendars_update();">';
    for ($i = 0; $i < 24; $i++) {
        echo '<option value="' . $i . '">' . ($i < 10 ? '0' : '') . $i . ':00</option>';
    }
    echo '</select>';
    echo '<div id="calendar_day_from" style="position: absolute; visibility: hidden; background: white;"></div>';
    echo '</td>';
    echo '</tr>';
    echo '<tr id="by_time_2"><td></td><td></td><td><strong>' . _('To') . '</strong></td>';
    echo '<td>';
    echo '<a href="#" id="anchor_day_to" onclick="calendar_day_to.select($(\'to\'), \'anchor_day_to\'); return false;" >' . date('Y-m-d', $t1) . '</a>';
    echo '&nbsp;<select id="hour_to" onchange="calendars_update();">';
    for ($i = 0; $i < 24; $i++) {
        echo '<option value="' . $i . '">' . ($i < 10 ? '0' : '') . $i . ':00</option>';
    }
    echo '</select>';
    echo '<div id="calendar_day_to" style="position: absolute; visibility: hidden; background: white;"></div>';
    echo '</td>';
    echo '</tr>';
    echo '<tr><td></td><td></td><td><input type="submit" value="' . _('Search') . '" /><td><td>';
    if (count($sessions) > 0) {
        echo sprintf(ngettext('<strong>%d</strong> result.', '<strong>%d</strong> results.', count($sessions)), count($sessions));
    } else {
        echo '<span class="error"><strong>' . _('No result found!') . '</strong></span>';
    }
    echo '</td></tr>';
    if ($partial_result === true) {
        echo '<tr><td></td>';
        echo '<td colspan="5">';
        echo '<span class="error">';
        echo sprintf(ngettext("<strong>Partial content:</strong> Only <strong>%d result</strong> displayed but there are more. Please restrict your search field.", "<strong>Partial content:</strong> Only <strong>%d results</strong> displayed but there are more. Please restrict your search field.", $search_limit), $search_limit);
        echo '</span>';
        echo '</td></tr>';
    }
    echo '</table>';
    echo '<input id="from" name="from" value="' . $t0 . '" type="hidden" />';
    echo '<input id="to" name="to" value="' . $t1 . '" type="hidden" />';
    echo '</form>';
    echo '</div>';
    echo '<script type="text/javascript" charset="utf-8">';
    echo '  document.write(getCalendarStyles());';
    echo '  var calendar_day_from = new CalendarPopup("calendar_day_from");';
    echo '  var calendar_day_to   = new CalendarPopup("calendar_day_to");';
    echo '  function calendars_init() {';
    echo '    calendar_day_from.setReturnFunction("calendars_callback_from");';
    echo '    calendar_day_to.setReturnFunction("calendars_callback");';
    echo '    var from_date = new Date();';
    echo '    from_date.setTime($("from").value*1000);';
    echo '    calendar_day_from.currentDate = from_date;';
    echo '    rewrite_date(from_date, $(\'anchor_day_from\'), $(\'hour_from\'));';
    echo '    var to_date = new Date();';
    echo '    to_date.setTime($("to").value*1000);';
    echo '    calendar_day_to.currentDate = to_date;';
    echo '    rewrite_date(to_date, $(\'anchor_day_to\'), $(\'hour_to\'));';
    echo '  }';
    echo '  function calendars_callback_from(y, m, d) {';
    echo '    calendar_day_from.currentDate.setFullYear(y);';
    echo '    calendar_day_from.currentDate.setMonth(m-1);';
    echo '    calendar_day_from.currentDate.setDate(d);';
    echo '    calendars_update();';
    echo '  }';
    echo '  function calendars_callback_to(y, m, d) {';
    echo '    calendar_day_to.currentDate.setFullYear(y);';
    echo '    calendar_day_to.currentDate.setMonth(m-1);';
    echo '    calendar_day_to.currentDate.setDate(d);';
    echo '    calendars_update();';
    echo '  }';
    echo '  function calendars_update() {';
    echo '    var from_date = calendar_day_from.currentDate;';
    echo '    var from_hour = $(\'hour_from\').options[$(\'hour_from\').selectedIndex].value;';
    echo '    from_date.setHours(from_hour);';
    echo '    rewrite_date(from_date, $(\'anchor_day_from\'), $(\'hour_from\'));';
    echo '    $("from").value = from_date.getTime()/1000;';
    echo '    var to_date = calendar_day_to.currentDate;';
    echo '    var to_hour = $(\'hour_to\').options[$(\'hour_to\').selectedIndex].value;';
    echo '    to_date.setHours(to_hour);';
    echo '    rewrite_date(to_date, $(\'anchor_day_to\'), $(\'hour_to\'));';
    echo '    $("to").value = to_date.getTime()/1000;';
    echo '  }';
    echo '  function rewrite_date(date, ymd_node, hour_select_node) {';
    echo '    var buf = date.getFullYear()+"-";';
    echo '    if (date.getMonth()+1 < 10)';
    echo '      buf+= "0";';
    echo '    buf+=date.getMonth()+1+"-";';
    echo '    if (date.getDate() < 10)';
    echo '      buf+= "0";';
    echo '    buf+=date.getDate(); ';
    echo '    ymd_node.innerHTML = buf;';
    echo '';
    echo '    for(var i=0; i<hour_select_node.options.length; i++) {';
    echo '      if (hour_select_node.options[i].value == date.getHours())';
    echo '        hour_select_node.selectedIndex = i;';
    echo '    }';
    echo '  }';
    echo '  Event.observe(window, \'load\', function() {';
    echo '    calendars_init();';
    echo '  });';
    echo '</script>';
    if (count($sessions) > 0) {
        echo '<table class="main_sub sortable" id="main_table" border="0" cellspacing="1" cellpadding="5">';
        echo '<thead>';
        echo '<tr class="title">';
        echo '<th>' . _('Session id') . '</th>';
        echo '<th>' . _('User') . '</th>';
        echo '<th>' . _('Date') . '</th>';
        echo '</tr>';
        echo '</thead>';
        echo '<tbody>';
        $count = 0;
        foreach ($sessions as $session) {
            $content = 'content' . ($count++ % 2 == 0 ? 1 : 2);
            echo '<tr class="' . $content . '">';
            echo '<td>' . $session['id'] . '</td>';
            echo '<td><a href="users.php?action=manage&id=' . $session['user'] . '">' . $session['user'] . '</a></td>';
            echo '<td>' . $session['start_stamp'] . '</td>';
            echo '<td><form><input type="hidden" name="action" value="manage"/><input type="hidden" name="id" value="' . $session['id'] . '"/><input type="submit" value="' . _('Get more information') . '"/></form></td>';
            echo '</tr>';
        }
        echo '</tbody>';
        echo '</table>';
    }
    page_footer();
    die;
}
コード例 #29
0
ファイル: Preferences.class.php プロジェクト: skdong/nfs-ovd
 public static function moduleIsEnabled($name_)
 {
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $mods_enable = $prefs->get('general', 'module_enable');
     return in_array($name_, $mods_enable);
 }
コード例 #30
0
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * 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__) . '/includes/core.inc.php';
require_once dirname(__FILE__) . '/includes/page_template.php';
if (!checkAuthorization('viewConfiguration')) {
    redirect('index.php');
}
page_header();
$prefs = Preferences::getInstance();
if (!$prefs) {
    die_error('get Preferences failed', __FILE__, __LINE__);
}
?>

<table style="width: 100%;" border="0" cellspacing="3" cellpadding="5">
  <tr>

  <td style="padding: 20px; vertical-align: top;">
  <div class="container rounded" style="background: #eee; width: 98%; margin-left: auto; margin-right: auto;">
  <div>
  <h2><?php 
echo _('Last save');
?>
</h2>