本文整理汇总了PHP中get_user_id函数的典型用法代码示例。如果您正苦于以下问题:PHP get_user_id函数的具体用法?PHP get_user_id怎么用?PHP get_user_id使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_user_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
if ($_POST) {
$opmode = $_POST["opmode"];
$model = D("UserTag");
if (false === $model->create()) {
$this->error($model->getError());
}
if ($opmode == "add") {
$model->module = MODULE_NAME;
$model->user_id = get_user_id();
$list = $model->add();
}
if ($opmode == "edit") {
$model->user_id = get_user_id();
$list = $model->save();
}
if ($opmode == "del") {
$model->user_id = get_user_id();
$tag_id = $model->id;
$model->del_tag($tag_id);
}
}
$model = D("UserTag");
$tag_list = $model->get_tag_list("id,pid,name");
$tree = list_to_tree($tag_list);
$this->assign('menu', sub_tree_menu($tree));
$tag_list = $model->get_tag_list();
$this->assign("tag_list", $tag_list);
$this->assign('js_file', "UserTag:js/index");
$this->display('UserTag:index');
}
示例2: _upload
private function _upload()
{
import("@.ORG.Util.UploadFile");
$module = strtolower($_REQUEST["module"]);
$upload = new UploadFile();
$upload->subFolder = $module;
$upload->savePath = C("SAVE_PATH");
$upload->saveRule = uniqid;
$upload->autoSub = true;
$upload->subType = "date";
if (!$upload->upload()) {
$this->error($upload->getErrorMsg());
} else {
//取得成功上传的文件信息
$uploadList = $upload->getUploadFileInfo();
$File = M("File");
$File->create($uploadList[0]);
$File->create_time = time();
$user_id = get_user_id();
$File->user_id = $user_id;
$fileId = $File->add();
$fileInfo = $uploadList[0];
$fileInfo['id'] = $fileId;
$fileInfo['error'] = 0;
$fileInfo['url'] = $fileInfo['savepath'] . $fileInfo['savename'];
//header("Content-Type:text/html; charset=utf-8");
exit(json_encode($fileInfo));
//$this->success ('上传成功!');
}
}
示例3: do_wysiwygs
function do_wysiwygs()
{
$editor_name = html_editor_name($this->site_info->id());
$params = html_editor_params($this->site_info->id());
if (strpos($editor_name, 'loki') === 0) {
if (!empty($this->username) && ($user_id = get_user_id($this->username))) {
if ($editor_name == 'loki') {
$params['widgets'] = array('strong', 'em', 'link');
} else {
$params['widgets'] = array('strong', 'em', 'link', 'blockquote');
}
if (function_exists('reason_user_has_privs')) {
$params['user_is_admin'] = reason_user_has_privs($user_id, 'edit_html');
}
} else {
if ($editor_name == 'loki') {
$params['widgets'] = array('strong', 'em');
} else {
$params['widgets'] = array('strong', 'em', 'blockquote');
}
if (isset($params['paths'])) {
unset($params['paths']['site_feed']);
unset($params['paths']['finder_feed']);
unset($params['paths']['default_site_regexp']);
unset($params['paths']['default_type_regexp']);
}
}
}
$this->change_element_type('comment_content', $editor_name, $params);
}
示例4: index
public function index()
{
header("Content-Type:text/html; charset=utf-8");
$widget['jquery-ui'] = true;
$this->assign("widget", $widget);
$config = D("UserConfig")->get_config();
$this->assign("home_sort", $config['home_sort']);
$flow_type = M("flow_type");
$data['tag'] = 88;
$flowlist = $flow_type->where($data)->select();
$this->assign("flowlist", $flowlist);
$flow = M("flow");
//追踪流程
$this->show = $flow->where('user_id ="' . (int) get_user_id() . '" AND (type=69 or type=70 or type=71 or type=72 or type=73)')->limit(50)->select();
//已审批
$this->show1 = $flow->where('user_id ="' . (int) get_user_id() . '" AND (type=69 or type=70 or type=71 or type=72 or type=73) AND step=40')->limit(50)->select();
//待审批的列表
$user_id = get_user_id();
$emp_no = get_emp_no();
$FlowLog = M("FlowLog");
$model = D('Flow');
$where['emp_no'] = $emp_no;
$where['result'] = 3;
$log_list = $FlowLog->where($where)->getField('flow_id id,flow_id');
// dump($where);
$map['id'] = array('in', $log_list);
$map['type'] = array('in', '69,70,71,72,73');
$todo_flow_list = $model->where($map)->limit(50)->order("create_time desc")->select();
$this->assign("todo_flow_list", $todo_flow_list);
$this->display();
}
示例5: save
public function save()
{
$data['create_time'] = time();
$data['create_user'] = get_user_id();
$data['name'] = $_POST['name'];
$data['num'] = $_POST['num'];
$data['touying'] = $_POST['touying'];
$data['place'] = $_POST['place'];
$data['mai'] = $_POST['mai'];
$id = $_POST['id'];
if ($id) {
$result = D('Room')->where('id=' . $id)->save($data);
} else {
$result = D('Room')->add($data);
}
if ($result === false) {
$da['info'] = "操作失败!";
$da['status'] = 0;
$da['data'] = $_POST;
$this->ajaxReturn($da);
} else {
$da['info'] = "操作成功!";
$da['status'] = 1;
$this->ajaxReturn($da);
}
}
示例6: _before_update
function _before_update(&$data, $options)
{
$old_data = M("Crm")->find($data['id']);
$diff = array_diff_assoc($data, $old_data);
$diff = array_keys($diff);
$desc = array('name' => '姓名', 'mobile_tel' => '手机', 'district' => '小区', 'need' => '客户需求', 'source' => '客户来源', 'age' => '年龄', 'work' => '职业');
if (!empty($diff)) {
foreach ($diff as $val) {
$model->need = implode(",", $model->need);
if (is_array($data[$val])) {
$new = implode(",", $data[$val]);
} else {
$new = $data[$val];
}
$comment .= $desc[$val] . ":" . $old_data[$val] . "->" . $new . " ; ";
}
$model = D("CrmLog");
$log['user_id'] = get_user_id();
$log['user_name'] = get_user_name();
$log['create_time'] = time();
$log['crm_id'] = $data['id'];
$log['emp_no'] = get_emp_no();
$log['comment'] = $comment;
$model->add($log);
}
}
示例7: json_latest_event
function json_latest_event()
{
$sql = new DBAccess();
$user_id = (int) get_user_id();
$events = $sql->FetchAll("select event_id, message as event, date, send_to, send_from, unread, uname as sender from events join players on player_id = send_from where send_to = '" . sql($user_id) . "' order by date desc limit 1");
return '{"event":' . json_encode(reset($events)) . '}';
}
示例8: generate
function generate()
{
$url = site_url() . 'home/preview' . '?' . http_build_query($this->users->get_user_by_id(get_user_id()));
$name = md5(date('ymdHis'));
if ($_SERVER['REMOTE_ADDR'] == '127.0.0.1') {
$dir = $this->config->item('static_path');
if (shell_exec('xvfb-run -a wkhtmltopdf "' . $url . '" "' . $dir . 'uploads/business-cards/' . $name . '.pdf"')) {
header('Location: ' . site_url() . 'uploads/business-cards/' . $name . '.pdf');
}
exit;
}
require 'application/libraries/pdfcrowd.php';
try {
// create an API client instance
$client = new Pdfcrowd("elshafey", "1386e8072e4b1bc2b82e6f3a8a166205");
// convert a web page and store the generated PDF into a $pdf variable
$pdf = $client->convertURI($url);
// set HTTP response headers
header("Content-Type: application/pdf");
header("Cache-Control: max-age=0");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename=\"{$name}.pdf\"");
// send the generated PDF
echo $pdf;
} catch (PdfcrowdException $why) {
echo "Pdfcrowd Error: " . $why;
}
}
示例9: share
public function share($user_id, $post_id)
{
$post_mapper = new Application_Model_PostMapper();
$user_mapper = new Application_Model_UserMapper();
$shared_post = $post_mapper->find($post_id);
$user = $user_mapper->find($shared_post['user_id']);
$share_elm = $this->findByTwoColumns('user_id', $user_id, 'post_id', $post_id);
$db = Zend_Registry::get('db');
if (empty($share_elm)) {
$sql = "insert into post_share VALUES(" . $user_id . "," . $post_id . ");";
$db->query($sql);
$post_model = new Application_Model_Post();
$username = $user['username'];
$post_model->_fields['user_id'] = get_user_id();
$post_model->_fields['content'] = "The Post originally shared by {$username}: \n" . $shared_post['content'];
$post_model->_fields['comment_number'] = 0;
$post_model->_fields['is_reported'] = 0;
$post_model->_fields['updated_at'] = time();
$new_id = $post_mapper->save($post_model);
$path = APPLICATION_PATH . "/../public/post_pic/" . "{$post_id}.png";
$path2 = APPLICATION_PATH . "/../public/post_pic/{$new_id}.png";
copy($path, $path2);
return true;
}
return false;
}
示例10: _update
protected function _update()
{
$id = $_POST["id"];
$model = M("MailOrganize");
$model->where("id={$id}")->delete();
$model = D("MailOrganize");
if (false === $model->create()) {
$this->error($model->getError());
}
if (in_array('user_id', $model->getDbFields())) {
$model->user_id = get_user_id();
}
if (in_array('user_name', $model->getDbFields())) {
$model->user_name = get_user_name();
}
//保存当前数据对象
$list = $model->add();
if ($list !== false) {
//保存成功
$this->assign('jumpUrl', get_return_url());
$this->success('编辑成功!');
} else {
//失败提示
$this->error('编辑失败!');
}
}
示例11: dept
function dept()
{
$widget['date'] = true;
$this->assign("widget", $widget);
$model = M("Dept");
$list = $model->where('is_del=0')->order('sort asc')->getField('id,name');
$this->assign('dept_list', $list);
$where = $this->_search("User");
if (method_exists($this, '_search_filter')) {
$this->_search_filter($where);
if ($where['is_del'] == "") {
$where['is_del'] = 0;
}
}
$where['id'] = array('gt', '1');
$model = D("user");
$userId = get_user_id();
$userInfo = get_user_info($userId, 'id,name,emp_no,dept_id,phone');
$where['dept_id'] = array("eq", $userInfo[$userId]['dept_id']);
// if (!empty($model)) {
// $this -> _list($model, $where,"emp_no",true);
// }
$info = $model->where($where)->order("emp_no desc")->select();
for ($i = 0; $info[$i]; $i++) {
$info[$i]['dept'] = D("dept")->where("id=" . $info[$i]['dept_id'])->getField("name");
$info[$i]['position'] = D("position")->where("id=" . $info[$i]['position_id'])->getField("name");
}
$this->assign("list", $info);
$this->display();
}
示例12: upgrade
/** Upgrade database from given version to the latest. */
static function upgrade($country, $version = null)
{
if ($version === null) {
$version = Installer::getVersion();
if ($version === null) {
// Assume it's an old v4 with the old id
$version = 4;
}
}
while ($version != PT::DB_LEVEL) {
$uid = get_user_id();
$type = get_db_type($uid);
$pdo = PDOBuilder::getPDO();
// Load generic sql update for current version
$file = PT::$ABSPATH . "/install/database/" . $type . "/upgrade-" . $version . ".sql";
$fileContent = \file_get_contents($file);
if (!Installer::loadFile($pdo, $fileContent)) {
return false;
}
// Check for localized update data for current version
$file = PT::$ABSPATH . "/install/database/" . $type . "upgrade-" . $version . "_" . $country . ".sql";
if (\file_exists($file)) {
$fileContent = \file_get_contents($file);
if (!Installer::loadFile($pdo, $fileContent)) {
return false;
}
}
$version++;
}
}
示例13: node
public function node()
{
$node_model = M("Node");
if (!empty($_POST['eq_pid'])) {
$eq_pid = $_POST['eq_pid'];
} else {
$eq_pid = $node_model->where('pid=0')->order('sort asc')->getField('id');
}
//dump($node_model -> select());
if (get_user_id() == 1) {
$node_list = $node_model->order('sort asc')->select();
} else {
$node_list = $node_model->where('id <> 84')->order('sort asc')->select();
}
// $node_list = $node_model -> order('sort asc') -> select();
$node_list = tree_to_list(list_to_tree($node_list, $eq_pid));
$node_list = rotate($node_list);
//dump($node_list);
$node_list = implode(",", $node_list['id']) . ",{$eq_pid}";
$where['id'] = array('in', $node_list);
$menu = $node_model->field('id,pid,name,url')->where($where)->order('sort asc')->select();
$tree = list_to_tree($menu);
$this->assign('eq_pid', $eq_pid);
$list = tree_to_list($tree);
$this->assign('node_list', $list);
//$this->assign('menu',sub_tree_menu($list));
$role = M("Role")->select();
$this->assign('list', $role);
$list = $node_model->where('pid=0 and is_del = 0')->order('sort asc')->getField('id,name');
$this->assign('groupList', $list);
$this->display();
}
示例14: try_add_user
function try_add_user($login, $pass, $pass2, $realname, $session, $is_admin, $antispam)
{
$return_val = false;
// Help prevent robot registrations
if (!check_antispam($antispam)) {
display_error("Invalid security code");
} else {
if ($session != md5(session_id() . $_SERVER['REMOTE_ADDR'])) {
display_error("Invalid session.");
} else {
if ($pass != $pass2) {
display_warning("Password mismatch");
} else {
if ($realname == '' || $pass == '' || $pass2 == '' || $login == '') {
display_warning("Please fill out all fields");
} else {
if (get_user_id($login) > 0) {
display_error("The user <strong>{$login}</strong> already exists.");
} else {
add_user($login, $realname, $pass, $is_admin);
$return_val = display_success("<strong>{$login}</strong> has been successfully created");
}
}
}
}
}
return $return_val;
}
示例15: TPSession
function TPSession()
{
// define the DB store.
if (!$this->store) {
$this->store = OAuthStore::instance('MySQL', get_db_options());
}
// determine who this user is (from this site's cookie alone)
$this->user_id = get_user_id(COOKIE_NAME);
debug("[TPSession::TPSesssion], user_id = " . $this->user_id);
// If there's no user_id in the cookie, then there's no session -- not logged in.
if (!$this->user_id) {
return 0;
}
// This method look up the OAuth token in one of two ways:
// 1. the _GET parameters -- if this is the last step of the OAuth dance.
// 2. the Database -- if the user already completed the OAuth dance.
$this->oauth_token = get_oauth_token(COOKIE_NAME, $_GET, $this->store);
// debug ("OAUTH TOKEN = " . $this->oauth_token);
// Somebody wanted to log out! You should let them.
if (array_key_exists('logout', $_GET)) {
$this->log_out();
} else {
if (array_key_exists('oauth_verifier', $_GET)) {
$this->verify_access_token();
}
}
// Also update the local author record if all goes well...
if (!$this->author and $this->is_logged_in()) {
$this->update_author_record();
}
}