<?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) {
setcookie("username", $un, 0, $zbp->cookiespath);
setcookie("password", $ps, 0, $zbp->cookiespath);
setcookie("addinfo" . str_replace('/','',$zbp->cookiespath), json_encode($addinfo), 0, $zbp->cookiespath);
} else {
setcookie("username", $un, time() + 3600 * 24 * $sd, $zbp->cookiespath);
setcookie("password", $ps, time() + 3600 * 24 * $sd, $zbp->cookiespath);
setcookie("addinfo" . str_replace('/','',$zbp->cookiespath), json_encode($addinfo), time() + 3600 * 24 * $sd, $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;
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) {
return new Post;
}
return $articles[0];
}
if(is_integer($idorname)){
return $zbp->GetPostByID($idorname);
}
}
/**
* 获取文章列表
* @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;
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);
$articles = array();
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->categorys[$category->ID]->SubCategorys as $subcate) {
$arysubcate[] = array('log_CateID', $subcate->ID);
}
$w[] = array('array', $arysubcate);
}
}
}
if (!is_null($auth)) {
$author = new Member;
$author = $zbp->GetMemberByID($auth);
if ($author->ID > 0) {
$w[] = array('=', 'log_AuthorID', $author->ID);
}
}
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));
}
}
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 . '}%');
}
}
}
if (is_string($search)) {
$search=trim($search);
if ($search!=='') {
$w[] = array('search', 'log_Content', 'log_Intro', 'log_Title', $search);
}
}
$select = '*';
$order = array('log_PostTime' => 'DESC');
foreach ($GLOBALS['Filter_Plugin_LargeData_GetList'] as $fpname => &$fpsignal) {
$fpreturn = $fpname($select,$w,$order,$count,$option);
}
$articles = $zbp->GetArticleList($select, $w, $order, $count, null, false);
if ($option['is_related']) {
foreach ($articles as $k => $a) {
if ($a->ID == $option['is_related'])
unset($articles[$k]);
}
if (count($articles) == $count){
array_pop($articles);
}
}
return $articles;
}
################################################################################################################
/**
* ViewIndex,首页,搜索页,feed页的主函数
* @api Filter_Plugin_ViewIndex_Begin
* @return mixed
*/
function ViewIndex(){
global $zbp,$action;
foreach ($GLOBALS['Filter_Plugin_ViewIndex_Begin'] as $fpname => &$fpsignal) {
$fpreturn = $fpname();
if ($fpsignal == PLUGIN_EXITSIGNAL_RETURN) {
$fpsignal=PLUGIN_EXITSIGNAL_NONE;return $fpreturn;
}
}
switch ($action) {
case 'feed':
ViewFeed();
break;
case 'search':
ViewSearch();
break;
case '':
default:
if( $zbp->currenturl==$zbp->cookiespath ||
$zbp->currenturl==$zbp->cookiespath . 'index.php' ){
ViewList(null,null,null,null,null);
}elseif( ($zbp->option['ZC_STATIC_MODE'] == 'ACTIVE' || isset($_GET['rewrite']) ) &&
(isset($_GET['id'])||isset($_GET['alias'])) ){
ViewPost(GetVars('id','GET'),GetVars('alias','GET'));
}elseif( ($zbp->option['ZC_STATIC_MODE'] == 'ACTIVE' || isset($_GET['rewrite']) ) &&
(isset($_GET['page'])||isset($_GET['cate'])||isset($_GET['auth'])||isset($_GET['date'])||isset($_GET['tags'])) ){
ViewList(GetVars('page','GET'),GetVars('cate','GET'),GetVars('auth','GET'),GetVars('date','GET'),GetVars('tags','GET'));
}else{
ViewAuto($zbp->currenturl);
}
}
}
/**
* 显示RSS2Feed
* @api Filter_Plugin_ViewFeed_Begin
* @return mixed
*/
function ViewFeed(){
global $zbp;
foreach ($GLOBALS['Filter_Plugin_ViewFeed_Begin'] as $fpname => &$fpsignal) {
$fpreturn = $fpname();
if ($fpsignal == PLUGIN_EXITSIGNAL_RETURN) {
$fpsignal=PLUGIN_EXITSIGNAL_NONE;return $fpreturn;
}
}
if(!$zbp->CheckRights($GLOBALS['action'])){
没有合适的资源?快使用搜索试试~ 我知道了~
基于PHP的Z-BlogPHP for SAE版 php博客系统.zip
共728个文件
php:286个
png:282个
gif:57个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 146 浏览量
2023-07-24
21:58:56
上传
评论
收藏 2.34MB ZIP 举报
温馨提示
基于PHP的Z-BlogPHP for SAE版 php博客系统.zip
资源推荐
资源详情
资源评论
收起资源包目录
基于PHP的Z-BlogPHP for SAE版 php博客系统.zip (728个子文件)
jquery-ui.custom.css 56KB
ueditor.css 45KB
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
shCoreDefault.pack.css 7KB
codemirror.css 5KB
scrawl.css 4KB
admin.css 3KB
evol.colorpicker.css 3KB
admin3.css 2KB
music.css 2KB
dialogbase.css 2KB
edittable.css 1KB
jquery.ui.ie.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
highlighted.gif 111B
unhighlighted.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
error.html 3KB
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
headbg.jpg 27KB
bg.jpg 27KB
bg-nav.jpg 27KB
alignicon.jpg 16KB
center_focus.jpg 12KB
共 728 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
助力毕业
- 粉丝: 2179
- 资源: 5136
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功