Пример #1
0
function Pad_Export()
{
    global $zbp;
    if ($zbp->currenturl == $zbp->cookiespath || $zbp->currenturl == $zbp->cookiespath . 'index.php') {
        Pad_Pre();
        $zbp->template->SetTemplate('index');
        ViewList(null, null, null, null, null);
        die;
    } elseif (isset($_GET['id']) || isset($_GET['alias'])) {
        Pad_Pre();
        $zbp->template->SetTemplate('single');
        ViewPost(GetVars('id', 'GET'), GetVars('alias', 'GET'));
        die;
    } elseif (isset($_GET['page']) || isset($_GET['cate']) || isset($_GET['auth']) || isset($_GET['date']) || isset($_GET['tags'])) {
        Pad_Pre();
        $zbp->template->SetTemplate('index');
        ViewList(GetVars('page', 'GET'), GetVars('cate', 'GET'), GetVars('auth', 'GET'), GetVars('date', 'GET'), GetVars('tags', 'GET'));
        die;
    } elseif (GetVars('mod', 'GET') == 'pad') {
        Pad_Pre();
        $zbp->template->SetTemplate('index');
        ViewList(null, null, null, null, null);
        die;
    }
}
Пример #2
0
<?php

/**
 * Z-Blog with PHP
 * @author 
 * @copyright (C) RainbowSoft Studio
 * @version
 */
require './zb_system/function/c_system_base.php';
zbp_index_redirect_install();
$zbp->Load();
foreach ($GLOBALS['Filter_Plugin_Index_Begin'] as $fpname => &$fpsignal) {
    $fpname();
}
$url = GetRequestUri();
if ($url == $cookiespath || $url == $cookiespath . 'index.php') {
    ViewList(null, null, null, null, null);
} elseif (isset($_GET['id']) || isset($_GET['alias'])) {
    ViewPost(GetVars('id', 'GET'), GetVars('alias', 'GET'));
} elseif (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($url);
}
foreach ($GLOBALS['Filter_Plugin_Index_End'] as $fpname => &$fpsignal) {
    $fpname();
}
RunTime();
Пример #3
0
function ViewAuto($url)
{
    global $zbp;
    $rewrite_go_on = true;
    foreach ($GLOBALS['Filter_Plugin_ViewAuto_Begin'] as $fpname => &$fpsignal) {
        $fpreturn = $fpname($url);
        if ($fpsignal == PLUGIN_EXITSIGNAL_RETURN) {
            return $fpreturn;
        }
    }
    if ($zbp->option['ZC_STATIC_MODE'] == 'ACTIVE') {
        ViewList(null, null, null, null, null);
        return null;
    }
    if (isset($_SERVER['SERVER_SOFTWARE'])) {
        if (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false && isset($_GET['rewrite']) !== true) {
            $url = iconv('GBK', 'UTF-8//TRANSLIT//IGNORE', $url);
        }
    }
    $url = substr($url, strlen($zbp->cookiespath));
    $url = urldecode($url);
    $r = UrlRule::Rewrite_url($zbp->option['ZC_INDEX_REGEX'], 'index');
    $m = array();
    if (preg_match($r, $url, $m) == 1) {
        ViewList($m[1], null, null, null, null, $rewrite_go_on);
        return null;
    }
    $r = UrlRule::Rewrite_url($zbp->option['ZC_DATE_REGEX'], 'date');
    $m = array();
    if (preg_match($r, $url, $m) == 1) {
        ViewList($m[2], null, null, $m[1], null, $rewrite_go_on);
        return null;
    }
    $r = UrlRule::Rewrite_url($zbp->option['ZC_AUTHOR_REGEX'], 'auth');
    $m = array();
    if (preg_match($r, $url, $m) == 1) {
        ViewList($m[2], null, $m[1], null, null, $rewrite_go_on);
        return null;
    }
    $r = UrlRule::Rewrite_url($zbp->option['ZC_TAGS_REGEX'], 'tags');
    $m = array();
    if (preg_match($r, $url, $m) == 1) {
        ViewList($m[2], null, null, null, $m[1], $rewrite_go_on);
        return null;
    }
    $r = UrlRule::Rewrite_url($zbp->option['ZC_CATEGORY_REGEX'], 'cate');
    $m = array();
    if (preg_match($r, $url, $m) == 1) {
        $result = ViewList($m[2], $m[1], null, null, null, $rewrite_go_on);
        if ($result != ZC_REWRITE_GO_ON) {
            return null;
        }
    }
    $r = UrlRule::Rewrite_url($zbp->option['ZC_PAGE_REGEX'], 'page');
    $m = array();
    if (preg_match($r, $url, $m) == 1) {
        if (strpos($zbp->option['ZC_PAGE_REGEX'], '{%id%}') !== false) {
            $result = ViewPost($m[1], null, $rewrite_go_on);
        } else {
            $result = ViewPost(null, $m[1], $rewrite_go_on);
        }
        if ($result == ZC_REWRITE_GO_ON) {
            $zbp->ShowError(2);
        }
        //return null;
        return null;
    }
    $r = UrlRule::Rewrite_url($zbp->option['ZC_ARTICLE_REGEX'], 'article');
    $m = array();
    if (preg_match($r, $url, $m) == 1) {
        if (strpos($zbp->option['ZC_ARTICLE_REGEX'], '{%id%}') !== false) {
            $result = ViewPost($m[1], null, $rewrite_go_on);
        } else {
            $result = ViewPost(null, $m[1], $rewrite_go_on);
        }
        if ($result == ZC_REWRITE_GO_ON) {
            $zbp->ShowError(2);
        }
        //return null;
        return null;
    }
    ViewList(null, null, null, null, null);
}
Пример #4
0
/**
 * 根据Rewrite_url规则显示页面
 * @api Filter_Plugin_ViewAuto_Begin
 * @api Filter_Plugin_ViewAuto_End
 * @param string $inpurl 页面url
 * @return null|string
 */
function ViewAuto($inpurl)
{
    global $zbp;
    foreach ($GLOBALS['Filter_Plugin_ViewAuto_Begin'] as $fpname => &$fpsignal) {
        $fpreturn = $fpname($inpurl);
        if ($fpsignal == PLUGIN_EXITSIGNAL_RETURN) {
            $fpsignal = PLUGIN_EXITSIGNAL_NONE;
            return $fpreturn;
        }
    }
    $url = GetValueInArray(explode('?', $inpurl), '0');
    if ($zbp->cookiespath === substr($url, 0, strlen($zbp->cookiespath))) {
        $url = substr($url, strlen($zbp->cookiespath));
    }
    if (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false && isset($_GET['rewrite']) == true) {
        //iis+httpd.ini下如果存在真实文件
        $realurl = $zbp->path . urldecode($url);
        if (is_readable($realurl) && is_file($realurl)) {
            die(file_get_contents($realurl));
        }
        unset($realurl);
    }
    $url = urldecode($url);
    if ($url == '' || $url == 'index.php' || trim($url, '/') == '') {
        ViewList(null, null, null, null, null);
        return null;
    }
    if ($zbp->option['ZC_STATIC_MODE'] == 'REWRITE') {
        $r = UrlRule::Rewrite_url($zbp->option['ZC_INDEX_REGEX'], 'index');
        $m = array();
        if (preg_match($r, $url, $m) == 1) {
            ViewList($m[1], null, null, null, null, true);
            return null;
        }
        $r = UrlRule::Rewrite_url($zbp->option['ZC_DATE_REGEX'], 'date');
        $m = array();
        if (preg_match($r, $url, $m) == 1) {
            ViewList($m[2], null, null, $m[1], null, true);
            return null;
        }
        $r = UrlRule::Rewrite_url($zbp->option['ZC_AUTHOR_REGEX'], 'auth');
        $m = array();
        if (preg_match($r, $url, $m) == 1) {
            $result = ViewList($m[2], null, $m[1], null, null, true);
            if ($result == true) {
                return null;
            }
        }
        $r = UrlRule::Rewrite_url($zbp->option['ZC_TAGS_REGEX'], 'tags');
        $m = array();
        if (preg_match($r, $url, $m) == 1) {
            $result = ViewList($m[2], null, null, null, $m[1], true);
            if ($result == true) {
                return null;
            }
        }
        $r = UrlRule::Rewrite_url($zbp->option['ZC_CATEGORY_REGEX'], 'cate');
        $m = array();
        if (preg_match($r, $url, $m) == 1) {
            $result = ViewList($m[2], $m[1], null, null, null, true);
            if ($result == true) {
                return null;
            }
        }
        $r = UrlRule::Rewrite_url($zbp->option['ZC_ARTICLE_REGEX'], 'article');
        $m = array();
        if (preg_match($r, $url, $m) == 1) {
            if (strpos($zbp->option['ZC_ARTICLE_REGEX'], '{%id%}') !== false) {
                $result = ViewPost($m[1], null, true);
            } else {
                $result = ViewPost(null, $m[1], true);
            }
            if ($result == false) {
                $zbp->ShowError(2, __FILE__, __LINE__);
            }
            return null;
        }
        $r = UrlRule::Rewrite_url($zbp->option['ZC_PAGE_REGEX'], 'page');
        $m = array();
        if (preg_match($r, $url, $m) == 1) {
            if (strpos($zbp->option['ZC_PAGE_REGEX'], '{%id%}') !== false) {
                $result = ViewPost($m[1], null, true);
            } else {
                $result = ViewPost(null, $m[1], true);
            }
            if ($result == false) {
                $zbp->ShowError(2, __FILE__, __LINE__);
            }
            return null;
        }
    }
    foreach ($GLOBALS['Filter_Plugin_ViewAuto_End'] as $fpname => &$fpsignal) {
        $fpreturn = $fpname($url);
        if ($fpsignal == PLUGIN_EXITSIGNAL_RETURN) {
            $fpsignal = PLUGIN_EXITSIGNAL_NONE;
            return $fpreturn;
        }
    }
    if (isset($zbp->option['ZC_COMPATIBLE_ASP_URL']) && $zbp->option['ZC_COMPATIBLE_ASP_URL'] == true) {
        if (isset($_GET['id']) || isset($_GET['alias'])) {
            ViewPost(GetVars('id', 'GET'), GetVars('alias', 'GET'));
            return null;
        } elseif (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'));
            return null;
        }
    }
    $zbp->ShowError(2, __FILE__, __LINE__);
}