Esempio n. 1
0
function RegPage_CreateCode($n)
{
    global $zbp;
    for ($i = 0; $i < 100; $i++) {
        $r = new Base($GLOBALS['RegPage_Table'], $GLOBALS['RegPage_DataInfo']);
        $r->InviteCode = GetGuid();
        $r->Level = $zbp->Config('RegPage')->default_level;
        $r->Save();
    }
}
Esempio n. 2
0
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();
    }
}
Esempio n. 3
0
 function GetMemberByID($id)
 {
     if (isset($this->members[$id])) {
         return $this->members[$id];
     }
     $m = new Member();
     $m->Guid = GetGuid();
     return $m;
 }
Esempio n. 4
0
function zbp_newMediaObject($xmlstring)
{
    global $zbp;
    $xml = simplexml_load_string($xmlstring);
    if ($xml) {
        $post = array();
        foreach ($xml->children() as $x) {
            $a = (string) $x->name;
            $b = $x->value->children();
            $post[$a] = $b;
        }
        $upload = new Upload();
        $f = GetGuid() . strrchr($post['name'], '.');
        $upload->Name = $f;
        $upload->SourceName = $post['name'];
        $upload->MimeType = $post['type'];
        $upload->Size = 0;
        $upload->AuthorID = $zbp->user->ID;
        $upload->SaveBase64File($post['bits']);
        $upload->Save();
        $strXML = '<methodResponse><params><param><value><struct><member><name>url</name><value><string>$%#1#%$</string></value></member></struct></value></param></params></methodResponse>';
        $strXML = str_replace("\$%#1#%\$", htmlspecialchars($upload->Url), $strXML);
        echo $strXML;
    }
}
Esempio n. 5
0
/**
 * 获取数据库名
 * @return string  返回SQLite数据文件名
 */
function GetDbName()
{
    return str_replace('-', '', '#%20' . strtolower(GetGuid())) . '.db';
}
Esempio n. 6
0
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/>";
}
Esempio n. 7
0
 /**
  * 通过用户名获取用户实例(不区分大小写)
  * @param string $name
  * @return Member
  */
 public function GetMemberByName($name)
 {
     $name = trim($name);
     if (!$name || !CheckRegExp($name, '[username]')) {
         return new Member();
     }
     if (isset($this->membersbyname[$name])) {
         return $this->membersbyname[$name];
     } else {
         $array = array_keys($this->membersbyname);
         foreach ($array as $k => $v) {
             if (strcasecmp($name, $v) == 0) {
                 return $this->membersbyname[$v];
             }
         }
     }
     $like = $this->db->type == 'pgsql' ? 'ILIKE' : 'LIKE';
     $sql = $this->db->sql->Select($this->table['Member'], '*', array(array($like, 'mem_Name', $name)), null, 1, null);
     $am = $this->GetListType('Member', $sql);
     if (count($am) > 0) {
         $m = $am[0];
         $this->members[$m->ID] = $m;
         $this->membersbyname[$m->Name] =& $this->members[$m->ID];
         return $m;
     }
     $m = new Member();
     $m->Guid = GetGuid();
     return $m;
 }
Esempio n. 8
0
function convert_user_table($_prefix)
{
    global $zbp;
    $sql = $zbp->db->sql->Select($_prefix . 'users' . ',' . $_prefix . 'usermeta', array('*'), array(array('CUSTOM', $_prefix . 'users.ID=' . $_prefix . 'usermeta.user_id'), array('CUSTOM', $_prefix . 'usermeta.meta_key="wp_user_level"')), '', '', '');
    $array = $zbp->db->Query($sql);
    $zbp->db->Query('TRUNCATE `' . $zbp->table['Member'] . '`;');
    $isadmin = false;
    foreach ($array as $key => $value) {
        $amem = array();
        $guid = GetGuid();
        $amem['mem_ID'] = $value['ID'];
        $amem['mem_Guid'] = $guid;
        $amem['mem_Name'] = $value['user_login'];
        $amem['mem_Alias'] = $value['user_nicename'];
        $amem['mem_Email'] = $value['user_email'];
        $amem['mem_HomePage'] = $value['user_url'];
        $amem['mem_Password'] = Member::GetPassWordByGuid(GetGuid(), $guid);
        $amem['mem_PostTime'] = strtotime($value['user_registered']);
        $amem['mem_Level'] = 5;
        if ($value['meta_value'] == 10) {
            $amem['mem_Level'] = 1;
        }
        if ($value['meta_value'] == 7) {
            $amem['mem_Level'] = 2;
        }
        if ($value['meta_value'] == 2) {
            $amem['mem_Level'] = 3;
        }
        if ($value['meta_value'] == 1) {
            $amem['mem_Level'] = 4;
        }
        if ($value['meta_value'] == 0) {
            $amem['mem_Level'] = 5;
        }
        if ($isadmin == false && $amem['mem_Level'] == 1) {
            $amem['mem_Name'] = $zbp->user->Name;
            $amem['mem_Guid'] = $zbp->user->Guid;
            $amem['mem_Password'] = $zbp->user->Password;
            $isadmin = true;
        }
        $zbp->db->Query($zbp->db->sql->Insert($zbp->table['Member'], $amem));
    }
    return;
}