Пример #1
0
function Pad_Main()
{
    global $zbp;
    if (GetVars('mod', 'GET') == 'pad') {
        if (GetVars('act', 'GET') == 'logout') {
            Pad_Logout();
        }
        if (GetVars('act', 'GET') == 'login') {
            Pad_Login();
        }
        if (GetVars('act', 'GET') == 'verify') {
            Pad_Verify();
        }
        if (isset($_GET['q'])) {
            Pad_Search();
        }
        Pad_Export();
        die;
    }
    if (GetVars('mod', 'GET') == 'pc') {
        return null;
    }
    $Pad_List = '/android|iphone|ipad|windows\\sphone|kindle|gt\\-p|gt\\-n|rim\\stablet|opera|meego/i';
    $UA = GetGuestAgent();
    if (CheckRegExp($UA, $Pad_List) == true) {
        Pad_Export();
    }
}
Пример #2
0
function ActivePlugin_WhitePage()
{
    global $zbp;
    Add_Filter_Plugin('Filter_Plugin_Admin_TopMenu', 'WhitePage_AddMenu');
    $s = '';
    if ($zbp->Config('WhitePage')->HasKey("custom_bgcolor")) {
        $zbp->Config('WhitePage')->custom_bgcolor = str_replace('#', '', $zbp->Config('WhitePage')->custom_bgcolor);
        $s .= "body{background-color:#" . $zbp->Config('WhitePage')->custom_bgcolor . ";}";
    }
    if ($zbp->Config('WhitePage')->HasKey("custom_headtitle")) {
        $s .= "#BlogTitle,#BlogSubTitle,#BlogCopyRight,#BlogPowerBy{text-align:" . $zbp->Config('WhitePage')->custom_headtitle . ";}";
    }
    if ($zbp->Config('WhitePage')->HasKey("custom_pagewidth")) {
        if ($zbp->Config('WhitePage')->custom_pagewidth == 1000) {
            $s .= "#divAll{width:1000px;}#divMiddle{width:940px;padding:0 30px;}#divSidebar{width:240px;padding:0 0 0 20px;}#divMain{width:670px;padding:0 0 20px 0;}#divTop{padding-top:30px;}body{font-size:15px;}";
        }
    }
    if ($zbp->Config('WhitePage')->HasKey("text_indent")) {
        $s .= "div.post-body p{text-indent:" . (int) $zbp->Config('WhitePage')->text_indent . "em;}";
    }
    if ($zbp->Config('WhitePage')->HasKey("custom_pagetype")) {
        if ($zbp->Config('WhitePage')->custom_pagetype == 1) {
            if ($zbp->Config('WhitePage')->custom_pagewidth == 1000) {
                $s .= "#divAll{background:url('" . $zbp->host . "zb_users/theme/WhitePage/style/default/bg1000-1.png') no-repeat 50% top;}#divPage{background:url('" . $zbp->host . "zb_users/theme/WhitePage/style/default/bg1000-2.png') no-repeat 50% bottom;}#divMiddle{background:url('" . $zbp->host . "zb_users/theme/WhitePage/style/default/bg1000-3.png') repeat-y 50% 50%;}";
            }
        }
        if ($zbp->Config('WhitePage')->custom_pagetype == 2) {
            $s .= "#divAll{box-shadow: 0 0 5px #666;background-color:white;border-radius: 0px;}";
            $s .= "#divAll{background:white;}#divPage{background:none;}#divMiddle{background:none;}";
        }
        if ($zbp->Config('WhitePage')->custom_pagetype == 3) {
            $s .= "#divAll{box-shadow: 0 0 5px #666;background-color:white;border-radius: 7px;}";
            $s .= "#divAll{background:white;}#divPage{background:none;}#divMiddle{background:none;}";
        }
        if ($zbp->Config('WhitePage')->custom_pagetype == 4) {
            $s .= "#divAll{box-shadow:none;background-color:white;border-radius: 0;}";
            $s .= "#divAll{background:white;}#divPage{background:none;}#divMiddle{background:none;}";
            $s .= "#divTop{padding-top:30px;}";
        }
        if ($zbp->Config('WhitePage')->custom_pagetype == 5) {
            $s .= "#divAll{box-shadow:none;background-color:white;border-radius: 0;border-radius: 7px;}";
            $s .= "#divAll{background:white;}#divPage{background:none;}#divMiddle{background:none;}";
            $s .= "#divTop{padding-top:30px;}";
        }
    }
    $Pad_List = '/touch|arm;|android|iphone|ipad|windows\\sphone|kindle|gt\\-p|gt\\-n|rim\\stablet|meego/i';
    $UA = GetGuestAgent();
    if (CheckRegExp($UA, $Pad_List) == true) {
        $s .= "body{font-size:4vw;}#divMain{width:100%;}#divSidebar{width:100%;}.function{width:50%;font-size:3vw;}";
        $s .= "div.post .post-title{width:100%;}div.post .post-date{width:100%;}#divBottom{font-size:2vw;}#divAll{background:white;width:99%;margin:0.3em auto;}#divPage{background:none;}#divMiddle{background:white;width:98%;padding:0;}#divCommentPost input{width:70%;}#divCommentPost input.button{width:50%;}";
    }
    $zbp->header .= '	<style type="text/css">' . $s . '</style>' . "\r\n";
}
Пример #3
0
function PostComment()
{
    global $zbp;
    $_POST['LogID'] = $_GET['postid'];
    if ($zbp->VerifyCmtKey($_GET['postid'], $_GET['key']) == false) {
        $zbp->ShowError(43);
    }
    if ($zbp->option['ZC_COMMENT_VERIFY_ENABLE']) {
        if ($zbp->user->ID == 0) {
            if ($zbp->CheckValidCode($_POST['verify'], 'cmt') == false) {
                $zbp->ShowError(38);
            }
        }
    }
    $replyid = (int) GetVars('replyid', 'POST');
    if ($replyid == 0) {
        $_POST['RootID'] = 0;
        $_POST['ParentID'] = 0;
    } else {
        $_POST['ParentID'] = $replyid;
        $c = $zbp->GetCommentByID($replyid);
        if ($c->Level == 3) {
            $zbp->ShowError(52);
        }
        $_POST['RootID'] = Comment::GetRootID($c->ID);
    }
    $_POST['AuthorID'] = $zbp->user->ID;
    $_POST['Name'] = $_POST['name'];
    $_POST['Email'] = $_POST['email'];
    $_POST['HomePage'] = $_POST['homepage'];
    $_POST['Content'] = $_POST['content'];
    $_POST['PostTime'] = Time();
    $_POST['IP'] = GetGuestIP();
    $_POST['Agent'] = GetGuestAgent();
    $cmt = new Comment();
    foreach ($zbp->datainfo['Comment'] as $key => $value) {
        if ($key == 'ID') {
            continue;
        }
        if ($key == 'Meta') {
            continue;
        }
        if ($key == 'IsChecking') {
            continue;
        }
        if (isset($_POST[$key])) {
            $cmt->{$key} = GetVars($key, 'POST');
        }
    }
    foreach ($GLOBALS['Filter_Plugin_PostComment_Core'] as $fpname => &$fpsignal) {
        $fpname($cmt);
    }
    FilterComment($cmt);
    if ($cmt->IsThrow == false) {
        $cmt->Save();
        if ($cmt->IsChecking == false) {
            CountPostArray(array($cmt->LogID));
            $zbp->AddBuildModule('comments');
            $zbp->comments[$cmt->ID] = $cmt;
            if (GetVars('isajax', 'POST')) {
                ViewComment($cmt->ID);
            }
            foreach ($GLOBALS['Filter_Plugin_PostComment_Succeed'] as $fpname => &$fpsignal) {
                $fpname($cmt);
            }
            return true;
        } else {
            $zbp->ShowError(53);
        }
    } else {
        $zbp->ShowError(14);
    }
}
Пример #4
0
/**
 * 提交评论
 * @return bool
 */
function PostComment()
{
    global $zbp;
    $isAjax = GetVars('isajax', 'POST');
    $returnJson = GetVars('format', 'POST') == 'json';
    $returnCommentWhiteList = array('ID' => null, 'Content' => null, 'LogId' => null, 'Name' => null, 'ParentID' => null, 'PostTime' => null, 'HomePage' => null, 'Email' => null, 'AuthorID' => null);
    $_POST['LogID'] = $_GET['postid'];
    if ($zbp->ValidCmtKey($_GET['postid'], $_GET['key']) == false) {
        $zbp->ShowError(43, __FILE__, __LINE__);
    }
    if ($zbp->option['ZC_COMMENT_VERIFY_ENABLE']) {
        if (!$zbp->CheckRights('NoValidCode')) {
            if ($zbp->CheckValidCode($_POST['verify'], 'cmt') == false) {
                $zbp->ShowError(38, __FILE__, __LINE__);
            }
        }
    }
    //判断是不是有同名(别名)的用户
    $m = $zbp->GetMemberByNameOrAlias($_POST['name']);
    if ($m->ID > 0) {
        if ($m->ID != $zbp->user->ID) {
            $zbp->ShowError(31, __FILE__, __LINE__);
        }
    }
    $replyid = (int) GetVars('replyid', 'POST');
    if ($replyid == 0) {
        $_POST['RootID'] = 0;
        $_POST['ParentID'] = 0;
    } else {
        $_POST['ParentID'] = $replyid;
        $c = $zbp->GetCommentByID($replyid);
        if ($c->Level == 3) {
            $zbp->ShowError(52, __FILE__, __LINE__);
        }
        $_POST['RootID'] = Comment::GetRootID($c->ID);
    }
    $_POST['AuthorID'] = $zbp->user->ID;
    $_POST['Name'] = GetVars('name', 'POST');
    if ($zbp->user->ID > 0) {
        $_POST['Name'] = $zbp->user->Name;
    }
    $_POST['Email'] = GetVars('email', 'POST');
    $_POST['HomePage'] = GetVars('homepage', 'POST');
    $_POST['Content'] = GetVars('content', 'POST');
    $_POST['PostTime'] = Time();
    $_POST['IP'] = GetGuestIP();
    $_POST['Agent'] = GetGuestAgent();
    $cmt = new Comment();
    foreach ($zbp->datainfo['Comment'] as $key => $value) {
        if ($key == 'ID' || $key == 'Meta') {
            continue;
        }
        if ($key == 'IsChecking') {
            continue;
        }
        if (isset($_POST[$key])) {
            $cmt->{$key} = GetVars($key, 'POST');
        }
    }
    if ($zbp->option['ZC_COMMENT_AUDIT'] && !$zbp->CheckRights('root')) {
        $cmt->IsChecking = true;
    }
    foreach ($GLOBALS['hooks']['Filter_Plugin_PostComment_Core'] as $fpname => &$fpsignal) {
        $fpname($cmt);
    }
    FilterComment($cmt);
    if ($cmt->IsThrow) {
        $zbp->ShowError(14, __FILE__, __LINE__);
        return false;
    }
    $cmt->Save();
    if ($cmt->IsChecking) {
        CountCommentNums(0, +1);
        $zbp->ShowError(53, __FILE__, __LINE__);
        return false;
    }
    CountPostArray(array($cmt->LogID), +1);
    CountCommentNums(+1, 0);
    $zbp->AddBuildModule('comments');
    $zbp->comments[$cmt->ID] = $cmt;
    if ($isAjax) {
        ViewComment($cmt->ID);
    } elseif ($returnJson) {
        ob_clean();
        ViewComment($cmt->ID);
        $commentHtml = ob_get_clean();
        JsonReturn(array_merge_recursive(array("html" => $commentHtml), array_intersect_key($cmt->GetData(), $returnCommentWhiteList)));
    }
    foreach ($GLOBALS['hooks']['Filter_Plugin_PostComment_Succeed'] as $fpname => &$fpsignal) {
        $fpname($cmt);
    }
    return true;
}
Пример #5
0
function Server_SendRequest($url, $data = array(), $u = '', $c = '')
{
    global $zbp;
    $un = $zbp->Config('AppCentre')->username;
    $ps = $zbp->Config('AppCentre')->password;
    $c .= ' apptype=' . urlencode($zbp->Config('AppCentre')->apptype) . '; ';
    if ($un && $ps) {
        $c .= "username="******"; password="******"shop_username="******"; shop_password="******"curl_init") && function_exists('curl_exec')) {
        return Server_SendRequest_CUrl($url, $data, $u, $c);
    }
    if (!ini_get("allow_url_fopen")) {
        return "";
    }
    if ($data) {
        //POST
        $data = http_build_query($data);
        $opts = array('http' => array('method' => 'POST', 'header' => "Content-Type:application/x-www-form-urlencoded\r\n" . 'Content-Length: ' . strlen($data) . "\r\n" . "Cookie: " . $c . "\r\n", 'user_agent' => $u, 'content' => $data));
        $content = stream_context_create($opts);
    } else {
        //GET
        $opts = array('http' => array('method' => 'GET', 'header' => "Cookie: " . $c . "\r\n", 'user_agent' => $u));
        $content = stream_context_create($opts);
    }
    if (function_exists('ini_set')) {
        ini_set('default_socket_timeout', 120);
    }
    if (extension_loaded('zlib')) {
        return file_get_contents('compress.zlib://' . $url, false, $content);
    } else {
        return file_get_contents($url, false, $content);
    }
}