本文整理汇总了PHP中get_current_admin_id函数的典型用法代码示例。如果您正苦于以下问题:PHP get_current_admin_id函数的具体用法?PHP get_current_admin_id怎么用?PHP get_current_admin_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_current_admin_id函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_post
function add_post()
{
$this->_getTree();
if (IS_POST) {
if (!empty($_POST['photos_alt']) && !empty($_POST['photos_url'])) {
foreach ($_POST['photos_url'] as $key => $url) {
$photourl = sp_asset_relative_url($url);
$_POST['smeta']['photo'][] = array("url" => $photourl, "alt" => $_POST['photos_alt'][$key]);
}
}
$_POST['smeta']['thumb'] = sp_asset_relative_url($_POST['smeta']['thumb']);
$_POST['post']['post_date'] = date("Y-m-d H:i:s", time());
$_POST['post']['smeta'] = json_encode($_POST['smeta']);
$_POST['post']['post_author'] = get_current_admin_id();
$result = $this->posts_obj->add($_POST['post']);
if ($result) {
//
$_POST['term']['object_id'] = $result;
$result = $this->terms_relationship->add($_POST['term']);
if ($result) {
$this->success("添加成功!");
} else {
$this->error("归类失败!");
}
} else {
$this->error("添加失败!");
}
}
}
示例2: add_post
function add_post()
{
if (IS_POST) {
if (empty($_POST['term'])) {
$this->error("请至少选择一个分类栏目!");
}
if (!empty($_POST['photos_alt']) && !empty($_POST['photos_url'])) {
foreach ($_POST['photos_url'] as $key => $url) {
$photourl = sp_asset_relative_url($url);
$_POST['smeta']['photo'][] = array("url" => $photourl, "alt" => $_POST['photos_alt'][$key]);
}
}
$_POST['smeta']['thumb'] = sp_asset_relative_url($_POST['smeta']['thumb']);
$_POST['post']['post_date'] = date("Y-m-d H:i:s", time());
$_POST['post']['post_author'] = get_current_admin_id();
$article = I("post.post");
$article['smeta'] = json_encode($_POST['smeta']);
$article['post_content'] = htmlspecialchars_decode($article['post_content']);
$result = $this->posts_model->add($article);
if ($result) {
//
foreach ($_POST['term'] as $mterm_id) {
$this->term_relationships_model->add(array("term_id" => intval($mterm_id), "object_id" => $result));
}
$this->success("添加成功!");
} else {
$this->error("添加失败!");
}
}
}
示例3: password_post
function password_post()
{
if (IS_POST) {
if (empty($_POST['old_password'])) {
$this->error("原始密码不能为空!");
}
if (empty($_POST['password'])) {
$this->error("新密码不能为空!");
}
$user_obj = D("Common/Users");
$uid = get_current_admin_id();
$admin = $user_obj->where(array("id" => $uid))->find();
$old_password = $_POST['old_password'];
$password = $_POST['password'];
if (sp_password($old_password) == $admin['user_pass']) {
if ($_POST['password'] == $_POST['repassword']) {
if ($admin['user_pass'] == sp_password($password)) {
$this->error("新密码不能和原始密码相同!");
} else {
$data['user_pass'] = sp_password($password);
$data['id'] = $uid;
$r = $user_obj->save($data);
if ($r !== false) {
$this->success("修改成功!");
} else {
$this->error("修改失败!");
}
}
} else {
$this->error("密码输入不一致!");
}
} else {
$this->error("原始密码不正确!");
}
}
}
示例4: userinfo_post
function userinfo_post()
{
if (IS_POST) {
$_POST['id'] = get_current_admin_id();
$create_result = $this->users_obj->field("user_login,user_email,last_login_ip,last_login_time,create_time,user_activation_key,user_status,role_id,score,user_type", true)->create();
if ($create_result) {
if ($this->users_obj->save() !== false) {
$this->success("保存成功!");
} else {
$this->error("保存失败!");
}
} else {
$this->error($this->users_obj->getError());
}
}
}
示例5: sp_get_current_admin_id
function sp_get_current_admin_id()
{
return get_current_admin_id();
}
示例6: add_post
function add_post()
{
if (IS_POST) {
$_POST['smeta']['thumb'] = sp_asset_relative_url($_POST['smeta']['thumb']);
$_POST['post']['post_date'] = date("Y-m-d H:i:s", time());
$_POST['post']['post_author'] = get_current_admin_id();
$page = I("post.post");
$page['smeta'] = json_encode($_POST['smeta']);
$page['post_content'] = htmlspecialchars_decode($page['post_content']);
$result = $this->posts_model->add($page);
if ($result) {
$this->success("添加成功!");
} else {
$this->error("添加失败!");
}
}
}
示例7: userinfo
function userinfo()
{
$id = get_current_admin_id();
$user = $this->users_obj->where(array("id" => $id))->find();
$this->assign($user);
$this->display();
}
示例8: add_post
function add_post()
{
if (IS_POST) {
$_POST['smeta']['thumb'] = sp_asset_relative_url($_POST['smeta']['thumb']);
$_POST['post']['post_date'] = date("Y-m-d H:i:s", time());
$_POST['post']['smeta'] = json_encode($_POST['smeta']);
$_POST['post']['post_author'] = get_current_admin_id();
$result = $this->posts_obj->add($_POST['post']);
if ($result) {
$this->success("添加成功!");
} else {
$this->error("添加失败!");
}
}
}
示例9: userinfo
function userinfo()
{
$id = get_current_admin_id();
$user = $this->users_obj->where("ID='{$id}'")->find();
$this->assign($user);
$this->display();
}