<?php
/**
* 事件相关函数
* @package Z-BlogPHP
* @subpackage System\Event 操作事件
* @copyright (C) RainbowSoft Studio
*/
################################################################################################################
/**
* 验证登录
* @return bool
*/
function VerifyLogin() {
global $zbp;
$m = null;
$u = trim(GetVars('username', 'POST'));
$p = trim(GetVars('password', 'POST'));
if ($zbp->Verify_MD5(GetVars('username', 'POST'), GetVars('password', 'POST'), $m)) {
$zbp->user = $m;
$un = $m->Name;
$ps = $m->PassWord_MD5Path;
$sd = (int) GetVars('savedate');
$addinfo = array();
$addinfo['dishtml5'] = (int) GetVars('dishtml5', 'POST');
$addinfo['chkadmin'] = (int) $zbp->CheckRights('admin');
$addinfo['chkarticle'] = (int) $zbp->CheckRights('ArticleEdt');
$addinfo['levelname'] = $m->LevelName;
$addinfo['userid'] = $m->ID;
$addinfo['useralias'] = $m->StaticName;
if ($sd == 0)
$sdt = 0;
else
$sdt = time() + 3600 * 24 * $sd;
if(HTTP_SCHEME == 'https://'){
setcookie("username", $un, $sdt, $zbp->cookiespath, '', true, false);
setcookie("password", $ps, $sdt, $zbp->cookiespath, '', true, true);
setcookie("addinfo" . str_replace('/', '', $zbp->cookiespath), json_encode($addinfo), $sdt, $zbp->cookiespath, '', true, false);
}else{
setcookie("username", $un, $sdt, $zbp->cookiespath);
setcookie("password", $ps, $sdt, $zbp->cookiespath);
setcookie("addinfo" . str_replace('/', '', $zbp->cookiespath), json_encode($addinfo), $sdt, $zbp->cookiespath);
}
return true;
} else {
$zbp->ShowError(8, __FILE__, __LINE__);
}
}
/**
* 注销登录
*/
function Logout() {
global $zbp;
setcookie('username', '', time() - 3600, $zbp->cookiespath);
setcookie('password', '', time() - 3600, $zbp->cookiespath);
setcookie("addinfo" . str_replace('/', '', $zbp->cookiespath), '', time() - 3600, $zbp->cookiespath);
}
################################################################################################################
/**
* 获取文章
* @param mixed $idorname 文章id 或 名称、别名
* @param array $option|null
* @return Post
*/
function GetPost($idorname, $option = null) {
global $zbp;
$post = null;
if (!is_array($option)) {
$option = array();
}
if (!isset($option['only_article'])) {
$option['only_article'] = false;
}
if (!isset($option['only_page'])) {
$option['only_page'] = false;
}
if (is_string($idorname)) {
$w[] = array('array', array(array('log_Alias', $idorname), array('log_Title', $idorname)));
if ($option['only_article'] == true) {
$w[] = array('=', 'log_Type', '0');
} elseif ($option['only_page'] == true) {
$w[] = array('=', 'log_Type', '1');
}
$articles = $zbp->GetPostList('*', $w, null, 1, null);
if (count($articles) == 0) {
$post = new Post;
} else {
$post = $articles[0];
}
} elseif (is_integer($idorname)) {
$post = $zbp->GetPostByID($idorname);
}
foreach ($GLOBALS['hooks']['Filter_Plugin_GetPost_Result'] as $fpname => &$fpsignal) {
$fpreturn = $fpname($post);
}
return $post;
}
/**
* 获取文章列表
* @param int $count 数量
* @param null $cate 分类ID
* @param null $auth 用户ID
* @param null $date 日期
* @param null $tags 标签
* @param null $search 搜索关键词
* @param null $option
* @return array|mixed
*/
function GetList($count = 10, $cate = null, $auth = null, $date = null, $tags = null, $search = null, $option = null) {
global $zbp;
$list = array();
if (!is_array($option)) {
$option = array();
}
if (!isset($option['only_ontop'])) {
$option['only_ontop'] = false;
}
if (!isset($option['only_not_ontop'])) {
$option['only_not_ontop'] = false;
}
if (!isset($option['has_subcate'])) {
$option['has_subcate'] = false;
}
if (!isset($option['is_related'])) {
$option['is_related'] = false;
}
if ($option['is_related']) {
$at = $zbp->GetPostByID($option['is_related']);
$tags = $at->Tags;
if (!$tags) {
return array();
}
$count = $count + 1;
}
$w = array();
if ($option['only_ontop'] == true) {
$w[] = array('=', 'log_IsTop', 1);
} elseif ($option['only_not_ontop'] == true) {
$w[] = array('=', 'log_IsTop', 0);
}
$w[] = array('=', 'log_Status', 0);
if (!is_null($cate)) {
$category = new Category;
$category = $zbp->GetCategoryByID($cate);
if ($category->ID > 0) {
if (!$option['has_subcate']) {
$w[] = array('=', 'log_CateID', $category->ID);
} else {
$arysubcate = array();
$arysubcate[] = array('log_CateID', $category->ID);
foreach ($zbp->categories[$category->ID]->ChildrenCategories as $subcate) {
$arysubcate[] = array('log_CateID', $subcate->ID);
}
$w[] = array('array', $arysubcate);
}
} else {
return array();
}
}
if (!is_null($auth)) {
$author = new Member;
$author = $zbp->GetMemberByID($auth);
if ($author->ID > 0) {
$w[] = array('=', 'log_AuthorID', $author->ID);
} else {
return array();
}
}
if (!is_null($date)) {
$datetime = strtotime($date);
if ($datetime) {
$datetitle = str_replace(array('%y%', '%m%'), array(date('Y', $datetime), date('n', $datetime)), $zbp->lang['msg']['year_month']);
$w[] = array('BETWEEN', 'log_PostTime', $datetime, strtotime('+1 month', $datetime));
} else {
return array();
}
}
if (!is_null($tags)) {
$tag = new Tag;
if (is_array($tags)) {
$ta = array();
foreach ($tags as $t) {
$ta[] = array('log_Tag', '%{' . $t->ID . '}%');
}
$w[] = array('array_like', $ta);
unset($ta);
} else {
if (is_int($tags)) {
$tag = $zbp->GetTagByID($tags);
} else {
$tag = $zbp->GetTagByAliasOrName($tags);
}
if ($tag->ID > 0) {
$w[] = array('LIKE', 'log_Tag', '%{' . $tag->ID . '}%');
} else {
return array();
}
}
}
if (is_string($search)) {
$search = trim($search);
if ($search !== '') {
$w[] = array('search', 'log_Content', 'log_Intro', 'log_Title', $search);
} else {
return array();
}
}
$select = '*';
$order = array('log_PostTime' => 'DESC');
foreach ($GLOBALS['hooks']['Filter_Plugin_LargeData_GetList'] as $fpname => &$fpsignal) {
$fpreturn = $fpname($select, $w, $order, $count, $option);
}
$list = $zbp->GetArticleList($select, $w, $order, $count, null, false);
if ($option['is_related']) {
foreach ($list as $k => $a) {
if ($a->ID == $option['is_related']) {
unset($list[$k]);
}
}
if (count($list) == $count) {
array_pop($list);
}
}
foreach ($GLOBALS['hooks']['Filter_Plugin_GetList_Result'] as $fpname => &$fpsignal) {
$fpreturn = $fpname($list);
}
没有合适的资源?快使用搜索试试~ 我知道了~
基于PHP的Z-Blog PHP博客系统Zero.zip
共656个文件
png:280个
php:215个
gif:57个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 159 浏览量
2023-07-24
21:58:54
上传
评论
收藏 2.29MB ZIP 举报
温馨提示
基于PHP的Z-Blog PHP博客系统Zero.zip
资源推荐
资源详情
资源评论
收起资源包目录
基于PHP的Z-Blog PHP博客系统Zero.zip (656个子文件)
jquery-ui.custom.css 56KB
ueditor.css 45KB
ueditor.min.css 34KB
admin2.css 19KB
image.css 19KB
html5css3.css 15KB
video.css 15KB
attachment.css 15KB
default.css 12KB
default.css 12KB
style.css 10KB
colpick.css 10KB
codemirror.css 6KB
prism.css 4KB
scrawl.css 4KB
admin.css 3KB
admin3.css 3KB
evol.colorpicker.css 3KB
music.css 2KB
dialogbase.css 2KB
edittable.css 1KB
emotion.css 780B
webuploader.css 543B
style.css 413B
iframe.css 42B
wface.gif 49KB
jxface2.gif 40KB
yface.gif 28KB
bface.gif 27KB
icons.gif 20KB
file-icons.gif 20KB
file-icons.gif 20KB
tface.gif 19KB
fface.gif 18KB
cface.gif 8KB
loading.gif 6KB
icons-all.gif 4KB
zblog.gif 2KB
Angry.gif 2KB
Faint.gif 2KB
Love.gif 2KB
Music.gif 2KB
Cry.gif 2KB
Adore.gif 2KB
Sad.gif 2KB
Cool.gif 2KB
Sleep.gif 2KB
Grimace.gif 2KB
Misdoubt.gif 2KB
Nothing_to_say.gif 2KB
Smile.gif 2KB
Effort.gif 2KB
Shame.gif 2KB
videologo.gif 2KB
After_boom.gif 1KB
cancelbutton.gif 1KB
loading.gif 1KB
button-bg.gif 1KB
lock.gif 1KB
alignicon.gif 1KB
word.gif 1019B
icons.gif 453B
icons.gif 453B
icons.gif 453B
success.gif 445B
success.gif 445B
success.gif 445B
cursor_v.gif 370B
cursor_h.gif 253B
anchor.gif 184B
pointblue.gif 149B
pointgray.gif 149B
pointblue.gif 144B
pointblue.gif 144B
unhighlighted.gif 111B
highlighted.gif 111B
artikel.gif 69B
pagebreak.gif 54B
bg-left.gif 51B
none.gif 43B
spacer.gif 43B
0.gif 43B
style.css.html 10KB
thanks.html 5KB
main.html 675B
include.html 195B
index.html 1B
index.html 1B
index.html 1B
index.html 1B
index.html 1B
index.html 1B
index.html 1B
index.html 1B
bg.jpg 27KB
headbg.jpg 27KB
bg-nav.jpg 27KB
alignicon.jpg 16KB
center_focus.jpg 12KB
center_focus.jpg 12KB
共 656 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
助力毕业
- 粉丝: 2177
- 资源: 5130
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- vue自定义指令( 复制、拖动、权限)
- json格式文件备份redis数据库 工具
- Multi-Agent-Flocking.zip
- 指标公式未来函数检测工具V1.2
- projectData
- SQL Server 性能监视器,它旨在提供开箱即用的全面监控,并作为您自己的项目或应用程序的监控框架 它在本地数据库中收集性能
- Python 程序语言设计模式思路-并发模式:线程池模式:管理线程池,优化线程创建和销毁
- 股事汇投资工具-实时新闻、财经日历、市场快讯、持仓查询、外汇兑换、换算工具、大盘云图、江恩工具、指标检测等
- webrtc-streamer
- html+css+'青春献礼二十大 红色旅游助乡村'为主题的网页设计 2022年参与学校网页设计比赛时完成的
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功