本文整理汇总了PHP中user::get_id方法的典型用法代码示例。如果您正苦于以下问题:PHP user::get_id方法的具体用法?PHP user::get_id怎么用?PHP user::get_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user
的用法示例。
在下文中一共展示了user::get_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write
function write($log_file_data, $string)
{
$log_dir = $log_file_data[0];
$log_name = $log_file_data[1];
$file_name = $log_dir . $log_name;
if (!is_dir($log_dir)) {
dir::mkdir($log_dir, 0775, true);
}
$oldumask = @umask(0);
$file_existed = @file_exists($file_name);
$log_file = @fopen($file_name, 'a');
if ($log_file) {
$time = strftime("%b %d %Y %H:%M:%S", strtotime('now'));
$notice = '[ ' . $time . " ]\n";
if ($user_id = user::get_id()) {
$notice .= '[ ' . $user_id . ' ] [ ' . user::get_login() . ' ] [ ' . user::get_email() . ' ] ';
}
$notice .= '[' . sys::client_ip() . '] [' . (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '') . "]\n" . $string . "\n\n";
@fwrite($log_file, $notice);
@fclose($log_file);
if (!$file_existed) {
@chmod($file_name, 0664);
}
@umask($oldumask);
$result = true;
} else {
@umask($oldumask);
$result = false;
debug::write_error("Cannot open log file '{$file_name}' for writing\n" . "The web server must be allowed to modify the file.\n" . "File logging for '{$file_name}' is disabled.", __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, false);
}
return $result;
}
示例2: error
function error($description, $error_place = '', $params = array())
{
if (defined('DEVELOPER_ENVIROMENT')) {
trigger_error('error', E_USER_WARNING);
echo $description . '<br>' . $error_place . '<br><pre>';
print_r($params);
echo '</pre>';
}
debug::write_error($description, $error_place, $params);
rollback_user_transaction();
if (debug::is_console_enabled()) {
echo debug::parse_html_console();
} else {
$message = '';
if ($user_id = user::get_id()) {
$message .= "user id:\t{$user_id}\nlogin:\t\t" . user::get_login() . "\ne-mail:\t\t" . user::get_email() . "\n";
}
$message .= "ip:\t\t" . sys::client_ip() . "\nrequest:\t" . REQUEST_URI . "\nerror:\t\t{$title}\ndescription:\t{$msg}";
$mail = new mime_mail();
$mail->set_body($message);
$mail->build_message();
$mail->send('developer', DEVELOPER_EMAIL, '', WEBSITE_EMAIL, $_SERVER['HTTP_HOST'] . ' internal error!');
}
ob_end_flush();
exit;
}
示例3: _update_log
function _update_log($node_id, $action, $status_code)
{
$ip_register =& $this->_get_ip_register();
$referer_register =& $this->_get_referer_register();
$uri_register =& $this->_get_uri_register();
$this->db->sql_insert('sys_stat_log', array('ip' => $ip_register->get_client_ip(), 'time' => $this->get_register_time_stamp(), 'node_id' => $node_id, 'stat_referer_id' => $referer_register->get_referer_page_id(), 'stat_uri_id' => $uri_register->get_uri_id(), 'user_id' => user::get_id(), 'session_id' => session_id(), 'action' => $action, 'status' => $status_code));
}
示例4: test_login_true
function test_login_true()
{
$this->assertTrue(user::login('vasa', '1'));
$this->assertTrue(user::login('sasa', '1'));
$this->assertTrue(user::is_logged_in());
$this->assertEqual(user::get_id(), 2);
$this->assertEqual(user::get_node_id(), 3);
$this->assertEqual(user::get_login(), 'sasa');
}
示例5: _create_version_record
function _create_version_record()
{
$version_db_table =& db_table_factory::instance('sys_object_version');
$time = time();
$data['object_id'] = $this->get_id();
$data['version'] = $this->get_version();
$data['created_date'] = $time;
$data['modified_date'] = $time;
$data['creator_id'] = user::get_id();
$version_db_table->insert($data);
return true;
}
示例6: _get_groups
function _get_groups()
{
$db =& db_factory::instance();
$sql = 'SELECT sso.*, tn.*
FROM sys_site_object as sso, user_group as tn, user_in_group as u_i_g
WHERE sso.id=tn.object_id
AND sso.current_version=tn.version
AND u_i_g.user_id=' . user::get_id() . '
AND u_i_g.group_id=sso.id';
$db->sql_exec($sql);
return $db->get_array();
}
示例7: login
function login($login, $password)
{
$this->_delete_cookie();
$user_ip = sys::client_ip(true);
$sid = md5(uniqid($user_ip));
session::set('phpbb_sid', $sid);
$phpbb_user_data = array();
$phpbb_user_data['session_user_id'] = user::get_id();
$phpbb_user_data['session_id'] = $sid;
$phpbb_user_data['session_ip'] = $user_ip;
$phpbb_user_data['session_logged_in'] = 1;
$phpbb_user_data['session_start'] = time();
$phpbb_user_data['session_time'] = time();
$db_table =& db_table_factory::create('phpbb_sessions');
return $db_table->insert($phpbb_user_data);
}
示例8: change_password
function change_password()
{
if (!($user_id = $this->get_id())) {
debug::write_error('user id not set', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
return false;
}
if (!($identifier = $this->get_identifier())) {
debug::write_error('user identifier not set', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
return false;
}
$this->set_attribute('password', user::get_crypted_password($identifier, $this->get_attribute('password')));
if ($user_id == user::get_id()) {
user::logout();
message_box::write_warning(strings::get('need_relogin', 'user'));
} else {
session::destroy_user_session($user_id);
}
return $this->update(false);
}
示例9: _create_site_object_record
function _create_site_object_record()
{
$this->set_attribute('version', 1);
$time = time();
$data['identifier'] = $this->get_identifier();
$data['title'] = $this->get_title();
$data['class_id'] = $this->get_class_id();
$data['current_version'] = $this->get_attribute('version');
$data['created_date'] = $time;
$data['modified_date'] = $time;
$data['creator_id'] = user::get_id();
$data['status'] = $this->get_attribute('status', 0);
if ($this->get_attribute('locale_id')) {
$data['locale_id'] = $this->get_attribute('locale_id');
} else {
$data['locale_id'] = $this->_get_parent_locale_id();
}
$sys_site_object_db_table =& db_table_factory::instance('sys_site_object');
$sys_site_object_db_table->insert($data);
return $sys_site_object_db_table->get_last_insert_id();
}
示例10: get_accessor_ids
function get_accessor_ids()
{
$accessor_ids = array();
if ($user_id = user::get_id()) {
$accessor_ids[] = $user_id;
}
foreach (array_keys(user::get_groups()) as $group_id) {
$accessor_ids[] = $group_id;
}
return $accessor_ids;
}
示例11: ob_start
*
* Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
***********************************************************************************
*
* $Id$
*
***********************************************************************************/
ob_start();
require_once '../setup.php';
require_once 'chat_setup.php';
require_once 'smiles.php';
require_once LIMB_DIR . 'core/lib/session/session.class.php';
start_user_session();
$template_vars = array();
$view = file_get_contents(DESIGN_DIR . 'chat/chat.html');
if (user::get_id()) {
$user_data = fetch_one_by_node_id(user::get_node_id());
chat_login($user_data['identifier'], $user_data['chat_color']);
}
if (!session::get('chat_user_id')) {
$template_vars['enter_div_display'] = 'none';
$template_vars['message_div_display'] = 'block';
} else {
$template_vars['enter_div_display'] = 'block';
$template_vars['message_div_display'] = 'none';
}
foreach ($template_vars as $key => $value) {
$view = str_replace("<!--<<{$key}>>-->", $value, $view);
}
$view = str_replace("<!--<<smiles>>-->", get_smiles_htm_table(), $view);
echo $view;
示例12: _session_db_write
function _session_db_write($session_id, $value)
{
$db =& db_factory::instance();
$db->sql_select('sys_session', '*', "session_id='{$session_id}'");
// check if session already exists
$db->sql_select('sys_session', 'session_data', "session_id='{$session_id}'");
$session_res = $db->get_array();
if (!($user_id = user::get_id())) {
$user_id = 0;
}
if (count($session_res) == 1) {
$res = $db->sql_update('sys_session', "last_activity_time=" . time() . ", session_data='{$value}', user_id = {$user_id}", "session_id='{$session_id}'");
} else {
$res = $db->sql_insert('sys_session', array('last_activity_time' => time(), 'session_data' => "{$value}", 'user_id' => "{$user_id}", 'session_id' => "{$session_id}"));
}
}
示例13: catch
} catch (Exception $e) {
echo $e->getMessage();
exit;
}
?>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<META NAME="Author" CONTENT="Janusz Paluch">
<TITLE>W3Pim - terminarz</TITLE>
</HEAD>
<BODY>
<?php
$dbcnx = polacz($GLOBALS['login'], $GLOBALS['pass']);
$uzk_id = $u->get_id();
$edycja = 0;
if (isset($_GET['id_e'])) {
$id_e = $_GET['id_e'];
$edycja = 1;
}
//przypisanie wartosci odpowiednich zmiennych (byla metoda GET)
if (isset($_GET['rok'])) {
$rok = $_GET['rok'];
$miesiac = $_GET['mies'];
$dzien = $_GET['dzien'];
//jesli bez parametrow to biezaca data
} else {
$rok = date("Y");
$miesiac = date("m");
$dzien = date("d");
示例14: _check_sys_object_version_record
function _check_sys_object_version_record()
{
$conditions['object_id'] = $this->object->get_id();
$conditions['version'] = $this->object->get_version();
$this->db->sql_select('sys_object_version', '*', $conditions);
$record = $this->db->fetch_row();
$this->assertEqual($record['object_id'], $this->object->get_id());
$this->assertEqual($record['version'], $this->object->get_version());
$this->assertEqual($record['creator_id'], user::get_id());
}
示例15: _changing_own_password
function _changing_own_password()
{
$object_data = $this->_load_object_data();
return $object_data['id'] == user::get_id() ? true : false;
}