コード例 #1
0
ファイル: api.php プロジェクト: kevin2010/zblogphp
function AlipayAPI_Start($parameter)
{
    global $zbp;
    require_once "alipay.aconfig.php";
    require_once "lib/alipay_submit.class.php";
    //公共$parameter
    $parameter["partner"] = trim($alipay_config['partner']);
    $parameter["anti_phishing_key"] = "";
    //防钓鱼时间戳//若要使用请调用类文件submit中的query_timestamp函数
    $parameter["exter_invoke_ip"] = GetGuestIP();
    //客户端的IP地址
    $parameter["_input_charset"] = trim(strtolower($alipay_config['input_charset']));
    //建立请求
    $alipaySubmit = new AlipaySubmit($alipay_config);
    $html_text = $alipaySubmit->buildRequestForm($parameter, "get", "...");
    echo $html_text;
}
コード例 #2
0
ファイル: createdata.php プロジェクト: chonghua/zblogphp
function page()
{
    for ($i = 0; $i < 1000; $i++) {
        $a = new Post();
        $a->CateID = 0;
        $a->AuthorID = 1;
        $a->Tag = '';
        $a->Status = ZC_POST_STATUS_PUBLIC;
        $a->Type = ZC_POST_TYPE_PAGE;
        $a->Alias = '';
        $a->IsTop = false;
        $a->IsLock = false;
        $a->Title = getRandStr(mt_rand(6, 10));
        $a->Intro = '';
        $a->Content = getRandStr(mt_rand(200, 300)) . GetGuid() . '<br/>' . GetGuid();
        $a->IP = GetGuestIP();
        $a->PostTime = time();
        $a->CommNums = 0;
        $a->ViewNums = 0;
        $a->Template = '';
        $a->Meta = '';
        $a->Save();
    }
}
コード例 #3
0
function PostMember()
{
    global $zbp;
    if (!isset($_POST['ID'])) {
        return;
    }
    if (!$zbp->CheckRights('MemberAll')) {
        unset($_POST['Level']);
        unset($_POST['Name']);
    }
    if (isset($_POST['Password'])) {
        if ($_POST['Password'] == '') {
            unset($_POST['Password']);
        } else {
            if (strlen($_POST['Password']) < $zbp->option['ZC_PASSWORD_MIN'] || strlen($_POST['Password']) > $zbp->option['ZC_PASSWORD_MAX']) {
                $zbp->ShowError(54);
            }
            if (!CheckRegExp($_POST['Password'], '[password]')) {
                $zbp->ShowError(54);
            }
            $_POST['Password'] = Member::GetPassWordByGuid($_POST['Password'], $_POST['Guid']);
        }
    }
    if (isset($_POST['Name'])) {
        if (isset($zbp->membersbyname[$_POST['Name']])) {
            if ($zbp->membersbyname[$_POST['Name']]->ID != $_POST['ID']) {
                $zbp->ShowError(62);
            }
        }
    }
    if (isset($_POST['Alias'])) {
        $_POST['Alias'] = TransferHTML($_POST['Alias'], '[noscript]');
    }
    $mem = new Member();
    if (GetVars('ID', 'POST') == 0) {
        if (isset($_POST['Password']) == false || $_POST['Password'] == '') {
            $zbp->ShowError(73);
        }
        $_POST['IP'] = GetGuestIP();
    } else {
        $mem->LoadInfoByID(GetVars('ID', 'POST'));
    }
    foreach ($zbp->datainfo['Member'] as $key => $value) {
        if ($key == 'ID') {
            continue;
        }
        if ($key == 'Meta') {
            continue;
        }
        if (isset($_POST[$key])) {
            $mem->{$key} = GetVars($key, 'POST');
        }
    }
    foreach ($GLOBALS['Filter_Plugin_PostMember_Core'] as $fpname => &$fpsignal) {
        $fpname($mem);
    }
    FilterMember($mem);
    FilterMeta($mem);
    CountMember($mem);
    $mem->Save();
    foreach ($GLOBALS['Filter_Plugin_PostMember_Succeed'] as $fpname => &$fpsignal) {
        $fpname($mem);
    }
    if (isset($_POST['Password'])) {
        if ($mem->ID == $zbp->user->ID) {
            Redirect($zbp->host . 'zb_system/cmd.php?act=login');
        }
    }
    return true;
}
コード例 #4
0
ファイル: index.php プロジェクト: ijustyce/zblogphp
function InsertInfo()
{
    global $zbp;
    $zbp->guid = GetGuid();
    $mem = new Member();
    $guid = GetGuid();
    $mem->Guid = $guid;
    $mem->Level = 1;
    $mem->Name = GetVars('username', 'POST');
    $mem->Password = Member::GetPassWordByGuid(GetVars('password', 'POST'), $guid);
    $mem->IP = GetGuestIP();
    $mem->PostTime = time();
    $mem->Save();
    $cate = new Category();
    $cate->Name = $zbp->lang['msg']['uncategory'];
    $cate->Alias = 'uncategorized';
    $cate->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_navbar'];
    $t->FileName = "navbar";
    $t->Source = "system";
    $t->SidebarID = 0;
    $t->Content = '<li id="nvabar-item-index"><a href="{#ZC_BLOG_HOST#}">' . $zbp->lang['zb_install']['index'] . '</a></li><li id="navbar-page-2"><a href="{#ZC_BLOG_HOST#}?id=2">' . $zbp->lang['zb_install']['guestbook'] . '</a></li>';
    $t->HtmlID = "divNavBar";
    $t->Type = "ul";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['calendar'];
    $t->FileName = "calendar";
    $t->Source = "system";
    $t->SidebarID = 1;
    $t->Content = "";
    $t->HtmlID = "divCalendar";
    $t->Type = "div";
    $t->IsHideTitle = true;
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['control_panel'];
    $t->FileName = "controlpanel";
    $t->Source = "system";
    $t->SidebarID = 1;
    $t->Content = '<span class="cp-hello">' . $zbp->lang['zb_install']['wellcome'] . '</span><br/><span class="cp-login"><a href="{#ZC_BLOG_HOST#}zb_system/cmd.php?act=login">' . $zbp->lang['msg']['admin_login'] . '</a></span>&nbsp;&nbsp;<span class="cp-vrs"><a href="{#ZC_BLOG_HOST#}zb_system/cmd.php?act=misc&amp;type=vrs">' . $zbp->lang['msg']['view_rights'] . '</a></span>';
    $t->HtmlID = "divContorPanel";
    $t->Type = "div";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_catalog'];
    $t->FileName = "catalog";
    $t->Source = "system";
    $t->SidebarID = 1;
    $t->Content = "";
    $t->HtmlID = "divCatalog";
    $t->Type = "ul";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['search'];
    $t->FileName = "searchpanel";
    $t->Source = "system";
    $t->SidebarID = 1;
    $t->Content = '<form name="search" method="post" action="{#ZC_BLOG_HOST#}zb_system/cmd.php?act=search"><input type="text" name="q" size="11" /> <input type="submit" value="' . $zbp->lang['msg']['search'] . '" /></form>';
    $t->HtmlID = "divSearchPanel";
    $t->Type = "div";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_comments'];
    $t->FileName = "comments";
    $t->Source = "system";
    $t->SidebarID = 1;
    $t->Content = "";
    $t->HtmlID = "divComments";
    $t->Type = "ul";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_archives'];
    $t->FileName = "archives";
    $t->Source = "system";
    $t->SidebarID = 1;
    $t->Content = "";
    $t->HtmlID = "divArchives";
    $t->Type = "ul";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_statistics'];
    $t->FileName = "statistics";
    $t->Source = "system";
    $t->SidebarID = 0;
    $t->Content = "";
    $t->HtmlID = "divStatistics";
    $t->Type = "ul";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_favorite'];
    $t->FileName = "favorite";
    $t->Source = "system";
    $t->SidebarID = 1;
    $t->Content = '<li><a href="http://bbs.zblogcn.com/" target="_blank">ZBlogger社区</a></li><li><a href="http://app.zblogcn.com/" target="_blank">Z-Blog应用中心</a></li><li><a href="http://weibo.com/zblogcn" target="_blank">Z-Blog新浪官微</a></li><li><a href="http://t.qq.com/zblogcn" target="_blank">Z-Blog腾讯官微</a></li>';
    $t->HtmlID = "divFavorites";
    $t->Type = "ul";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_link'];
    $t->FileName = "link";
    $t->Source = "system";
    $t->SidebarID = 1;
    $t->Content = '<li><a href="http://www.dbshost.cn/" target="_blank" title="独立博客服务 Z-Blog官方主机">DBS主机</a></li>';
    $t->HtmlID = "divLinkage";
    $t->Type = "ul";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_misc'];
    $t->FileName = "misc";
    $t->Source = "system";
    $t->SidebarID = 1;
    $t->Content = '<li><a href="http://www.zblogcn.com/" target="_blank"><img src="{#ZC_BLOG_HOST#}zb_system/image/logo/zblog.gif" height="31" width="88" alt="RainbowSoft Studio Z-Blog" /></a></li><li><a href="{#ZC_BLOG_HOST#}feed.php" target="_blank"><img src="{#ZC_BLOG_HOST#}zb_system/image/logo/rss.png" height="31" width="88" alt="订阅本站的 RSS 2.0 新闻聚合" /></a></li>';
    $t->HtmlID = "divMisc";
    $t->Type = "ul";
    $t->IsHideTitle = true;
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_authors'];
    $t->FileName = "authors";
    $t->Source = "system";
    $t->SidebarID = 0;
    $t->Content = "";
    $t->HtmlID = "divAuthors";
    $t->Type = "ul";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_previous'];
    $t->FileName = "previous";
    $t->Source = "system";
    $t->SidebarID = 0;
    $t->Content = "";
    $t->HtmlID = "divPrevious";
    $t->Type = "ul";
    $t->Save();
    $t = new Module();
    $t->Name = $zbp->lang['msg']['module_tags'];
    $t->FileName = "tags";
    $t->Source = "system";
    $t->SidebarID = 0;
    $t->Content = "";
    $t->HtmlID = "divTags";
    $t->Type = "ul";
    $t->Save();
    $a = new Post();
    $a->CateID = 1;
    $a->AuthorID = 1;
    $a->Tag = '';
    $a->Status = ZC_POST_STATUS_PUBLIC;
    $a->Type = ZC_POST_TYPE_ARTICLE;
    $a->Alias = '';
    $a->IsTop = false;
    $a->IsLock = false;
    $a->Title = $zbp->lang['zb_install']['hello_zblog'];
    $a->Intro = $zbp->lang['zb_install']['hello_zblog_content'];
    $a->Content = $zbp->lang['zb_install']['hello_zblog_content'];
    $a->IP = GetGuestIP();
    $a->PostTime = time();
    $a->CommNums = 0;
    $a->ViewNums = 0;
    $a->Template = '';
    $a->Meta = '';
    $a->Save();
    $a = new Post();
    $a->CateID = 0;
    $a->AuthorID = 1;
    $a->Tag = '';
    $a->Status = ZC_POST_STATUS_PUBLIC;
    $a->Type = ZC_POST_TYPE_PAGE;
    $a->Alias = '';
    $a->IsTop = false;
    $a->IsLock = false;
    $a->Title = $zbp->lang['zb_install']['guestbook'];
    $a->Intro = '';
    $a->Content = $zbp->lang['zb_install']['guestbook_content'];
    $a->IP = GetGuestIP();
    $a->PostTime = time();
    $a->CommNums = 0;
    $a->ViewNums = 0;
    $a->Template = '';
    $a->Meta = '';
    $a->Save();
    echo $zbp->lang['zb_install']['create_datainfo'] . "<br/>";
}
コード例 #5
0
ファイル: c_system_event.php プロジェクト: zblogcn/zblogphp
/**
 * 提交用户数据
 * @return bool
 */
function PostMember()
{
    global $zbp;
    $mem = new Member();
    $data = array();
    if (!isset($_POST['ID'])) {
        return false;
    }
    //检测密码
    if (trim($_POST["Password"]) == '' || trim($_POST["PasswordRe"]) == '' || $_POST["Password"] != $_POST["PasswordRe"]) {
        unset($_POST["Password"]);
        unset($_POST["PasswordRe"]);
    }
    $data['ID'] = $_POST['ID'];
    $editableField = array('Password', 'Email', 'HomePage', 'Alias', 'Intro', 'Template');
    // 如果是管理员,则再允许改动别的字段
    if ($zbp->CheckRights('MemberAll')) {
        array_push($editableField, 'Level', 'Status', 'Name', 'IP');
    } else {
        $data['ID'] = $zbp->user->ID;
    }
    // 复制一个新数组
    foreach ($editableField as $value) {
        if (isset($_POST[$value])) {
            $data[$value] = GetVars($value, 'POST');
        }
    }
    if (isset($data['Name'])) {
        // 检测同名
        if (isset($zbp->membersbyname[$data['Name']])) {
            if ($zbp->membersbyname[$data['Name']]->ID != $data['ID']) {
                $zbp->ShowError(62, __FILE__, __LINE__);
            }
        }
    }
    if (isset($data['Alias'])) {
        $data['Alias'] = TransferHTML($data['Alias'], '[noscript]');
    }
    if ($data['ID'] == 0) {
        if (!isset($data['Password']) || $data['Password'] == '') {
            $zbp->ShowError(73, __FILE__, __LINE__);
        }
        $data['IP'] = GetGuestIP();
    } else {
        $mem->LoadInfoByID($data['ID']);
    }
    foreach ($zbp->datainfo['Member'] as $key => $value) {
        if ($key == 'ID' || $key == 'Meta') {
            continue;
        }
        if (isset($data[$key])) {
            $mem->{$key} = $data[$key];
        }
    }
    // 然后,读入密码
    // 密码需要单独处理,因为拿不到用户Guid
    if (isset($data['Password'])) {
        if ($data['Password'] != '') {
            if (strlen($data['Password']) < $zbp->option['ZC_PASSWORD_MIN'] || strlen($data['Password']) > $zbp->option['ZC_PASSWORD_MAX']) {
                $zbp->ShowError(54, __FILE__, __LINE__);
            }
            if (!CheckRegExp($data['Password'], '[password]')) {
                $zbp->ShowError(54, __FILE__, __LINE__);
            }
            $mem->Password = Member::GetPassWordByGuid($data['Password'], $mem->Guid);
        }
    }
    FilterMeta($mem);
    foreach ($GLOBALS['hooks']['Filter_Plugin_PostMember_Core'] as $fpname => &$fpsignal) {
        $fpname($mem);
    }
    FilterMember($mem);
    CountMember($mem);
    // 查询同名
    if (isset($data['Name'])) {
        if ($data['ID'] == 0) {
            if ($zbp->CheckMemberNameExist($data['Name'])) {
                $zbp->ShowError(62, __FILE__, __LINE__);
            }
        }
    }
    $mem->Save();
    foreach ($GLOBALS['hooks']['Filter_Plugin_PostMember_Succeed'] as $fpname => &$fpsignal) {
        $fpname($mem);
    }
    $zbp->AddBuildModule('authors');
    if (isset($data['Password'])) {
        if ($mem->ID == $zbp->user->ID) {
            Redirect($zbp->host . 'zb_system/cmd.php?act=login');
        }
    }
    return true;
}
コード例 #6
0
ファイル: vote.php プロジェクト: ijustyce/zblogphp
require '../../../zb_system/function/c_system_base.php';
require '../../../zb_system/function/c_system_admin.php';
$zbp->Load();
if (!$zbp->CheckPlugin('HeartVote')) {
    $zbp->ShowError(48);
    die;
}
$mode = null;
if (!isset($_POST['vote'])) {
    $mode = 'script';
    header('Content-type: application/x-javascript; Charset=utf-8');
}
$vote = GetVars("vote");
$id = GetVars("id");
$ip = GetGuestIP();
$sql = $zbp->db->sql->Select($zbp->table['HeartVote'], '*', array(array('=', 'vote_LogID', $id), array('=', 'vote_IP', $ip)), null, null, null);
$array = $zbp->db->Query($sql);
if (count($array) == 0) {
    $vh = new HeartVote();
    $vh->LogID = $id;
    $vh->Score = $vote;
    $vh->IP = $ip;
    $vh->Save();
    $sql = $zbp->db->sql->Count($zbp->table['HeartVote'], array(array('SUM', 'vote_Score', 'allvote'), array('COUNT', '*', 'alluser')), array(array('=', 'vote_LogID', $id)));
    $array = $zbp->db->Query($sql);
    $array = current($array);
    $alluser = GetValueInArray($array, 'alluser');
    $allvote = GetValueInArray($array, 'allvote');
    if ($alluser == 0) {
        $allvote = 0;
コード例 #7
0
ファイル: reg.php プロジェクト: ijustyce/zblogphp
if (isset($zbp->membersbyname[$name])) {
    $zbp->ShowError('用户名已存在');
    die;
}
$member->Name = $name;
if (strlen($password) < $zbp->option['ZC_PASSWORD_MIN'] || strlen($password) > $zbp->option['ZC_PASSWORD_MAX']) {
    $zbp->ShowError('密码必须在' . $zbp->option['ZC_PASSWORD_MIN'] . '位-' . $zbp->option['ZC_PASSWORD_MAX'] . '位间.');
    die;
}
if ($password != $repassword) {
    $zbp->ShowError('请核对密码.');
    die;
}
$member->Password = Member::GetPassWordByGuid($password, $invitecode);
$member->PostTime = time();
$member->IP = GetGuestIP();
if (strlen($email) < 5 || strlen($email) > $zbp->option['ZC_EMAIL_MAX']) {
    $zbp->ShowError('邮箱不能过长或过短.');
    die;
}
if (CheckRegExp($email, '[email]')) {
    $member->Email = $email;
} else {
    $zbp->ShowError('邮箱格式不正确.');
    die;
}
if (strlen($homepage) > $zbp->option['ZC_HOMEPAGE_MAX']) {
    $zbp->ShowError('网址不能过长.');
    die;
}
if (CheckRegExp($homepage, '[homepage]')) {