📄 base.users.class.inc
字号:
* @access public * * @param string $email * * @return bool True if exists */ function email_exists($email) { } /** * This function adds a new user to the database. * * @access public * * @param string $user Array of all columns of table 'users' * @param string $user_groups The user group id's the user will be member of * @param string $visible_user_groups The user group id's where the user will be visible to * @param string $modules_read The modules the user will have read permissions for * @param string $modules_write The modules the user will have write permissions for * @param string $acl Some custom ACL id's the user will have access to (Be carefull) * * @return bool True on success */ function add_user( $user, $user_groups=array(), $visible_user_groups=array(), $modules_read=array(), $modules_write=array(), $acl=array()) { return false; } /** * This function tells us if we exceeded the maximum number of users if set in * config.php * * @access public * * @param void * * @return bool */ function max_users_reached() { } /** * This function set's the preferences of the user. * * @access public * * @param int $user_id * @param string $date_format * @param string $time_format * @param char $thousands_seperator * @param char $decimal_seperator * @param char $currency * @param bool $mail_client * @param int $max_rows_list * @param string $timezone_offset * @param string $DST * @param string $start_module * @param string $language * @param string $theme * @param string $first_weekday * * @return bool True on success */ function set_preferences($user_id, $date_format, $time_format, $thousands_seperator, $decimal_seperator, $currency, $mail_client, $max_rows_list, $timezone_offset, $DST, $start_module, $language, $theme, $first_weekday) { return false; } /** * This function stores the user's language * * @access public * * @param int $user_id * @param string $language * * @return bool True on success */ function set_language($user_id, $language) { return false; } /** * This function stores the user's start module * * @access public * * @param int $user_id * @param string $module_id * * @return bool */ function set_start_module($user_id, $module_id) { return false; } /** * This function stores the user's notation settings. * * @access public * * @param int $user_id * @param string $date_format * @param string $time_format * @param char $thousands_seperator * @param char $decimal_seperator * @param char $currency * @param string $timezone_offset * @param string $DST * @param string $first_weekday * @param string $sort_name * * @return bool */ function set_notations($user_id, $date_format, $time_format, $thousands_seperator, $decimal_seperator, $currency, $timezone_offset, $DST, $first_weekday, $sort_name) { return false; } /** * This function stores the user's look&feel settings. * * @access public * * @param int $user_id * @param int $max_rows_list * @param string $start_module * @param string $language * @param string $theme * * @return bool */ function set_look_and_feel($user_id, $max_rows_list, $start_module, $language, $theme) { return false; } /** * This function deletes a user from the database. * * @access public * * @param int $user_id * * @return bool */ function delete_user($user_id) { return false; } /** * This function updates the number of logins of the user in the database. * * @access public * * @param int $user_id * * @return bool */ function increment_logins($user_id) { return false; } /** * Updates the session data corresponding to the user_id. * * @access public * * @param int $user_id * * @return bool */ function update_session($user_id) { global $GO_LANGUAGE, $GO_CONFIG; if ($userdata = $this->get_user($user_id)) { $middle_name = $userdata['middle_name'] == '' ? '' : $userdata['middle_name'].' '; $GO_LANGUAGE->set_language($userdata['language']); $_SESSION['GO_SESSION']['user_id'] = $user_id; //It session could be stolen from another host! $_SESSION['DIR_CHECK'] = md5($GO_CONFIG->root_path); $_SESSION['GO_SESSION']['username'] = $userdata['username']; $_SESSION['GO_SESSION']['authcode'] = $userdata['authcode']; $_SESSION['GO_SESSION']['name'] = $userdata['first_name'].' '.$middle_name.$userdata['last_name']; $_SESSION['GO_SESSION']['first_name'] = $userdata['first_name']; $_SESSION['GO_SESSION']['middle_name'] = $userdata['middle_name']; $_SESSION['GO_SESSION']['last_name'] = $userdata['last_name']; $_SESSION['GO_SESSION']['email'] = $userdata['email']; $_SESSION['GO_SESSION']['thousands_seperator'] = $userdata['thousands_seperator']; $_SESSION['GO_SESSION']['decimal_seperator'] = $userdata['decimal_seperator']; $_SESSION['GO_SESSION']['date_format'] = get_dateformat($userdata['date_format'], $userdata['date_seperator']); $_SESSION['GO_SESSION']['date_seperator'] = $userdata['date_seperator']; $_SESSION['GO_SESSION']['time_format'] = $userdata['time_format']; $_SESSION['GO_SESSION']['currency'] = $userdata['currency']; $_SESSION['GO_SESSION']['mail_client'] = $userdata['mail_client']; $_SESSION['GO_SESSION']['lastlogin'] = isset ($userdata['lastlogin']) ? $userdata['lastlogin'] : get_gmt_time(); $_SESSION['GO_SESSION']['max_rows_list'] = $userdata['max_rows_list']; $_SESSION['GO_SESSION']['timezone'] = $userdata['timezone']; $_SESSION['GO_SESSION']['start_module'] = isset ($userdata['start_module']) ? $userdata['start_module'] : 'summary'; $_SESSION['GO_SESSION']['DST'] = $userdata['DST']; $_SESSION['GO_SESSION']['theme'] = $userdata['theme']; $_SESSION['GO_SESSION']['first_weekday'] = $userdata['first_weekday']; $_SESSION['GO_SESSION']['sort_name'] = $userdata['sort_name']; $_SESSION['GO_SESSION']['use_checkbox_select'] = $userdata['use_checkbox_select']; return true; } return false; } /** * This function generates a randomized password. * * @access public * * @param string $characters_allow * @param string $characters_disallow * @param int $password_length * @param int $repeat * * @return string */ function random_password($characters_allow = 'a-z,1-9', $characters_disallow = 'i,o', $password_length = 8, $repeat = 0) { // Generate array of allowable characters. $characters_allow = explode(',', $characters_allow); for ($i = 0; $i < count($characters_allow); $i ++) { if (substr_count($characters_allow[$i], '-') > 0) { $character_range = explode('-', $characters_allow[$i]); for ($j = ord($character_range[0]); $j <= ord($character_range[1]); $j ++) { $array_allow[] = chr($j); } } else { $array_allow[] = $characters_allow[$i]; } } // Generate array of disallowed characters. $characters_disallow = explode(',', $characters_disallow); for ($i = 0; $i < count($characters_disallow); $i ++) { if (substr_count($characters_disallow[$i], '-') > 0) { $character_range = explode('-', $characters_disallow[$i]); for ($j = ord($character_range[0]); $j <= ord($character_range[1]); $j ++) { $array_disallow[] = chr($j); } } else { $array_disallow[] = $characters_disallow[$i]; } } mt_srand(( double ) microtime() * 1000000); // Generate array of allowed characters by removing disallowed // characters from array. $array_allow = array_diff($array_allow, $array_disallow); // Resets the keys since they won't be consecutive after // removing the disallowed characters. reset($array_allow); $new_key = 0; while (list ($key, $val) = each($array_allow)) { $array_allow_tmp[$new_key] = $val; $new_key ++; } $array_allow = $array_allow_tmp; $password = ''; while (strlen($password) < $password_length) { $character = mt_rand(0, count($array_allow) - 1); // If characters are not allowed to repeat, // only add character if not found in partial password string. if ($repeat == 0) { if (substr_count($password, $array_allow[$character]) == 0) { $password .= $array_allow[$character]; } } else { $password .= $array_allow[$character]; } } return $password; }}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -