本文整理汇总了PHP中GetValueInArray函数的典型用法代码示例。如果您正苦于以下问题:PHP GetValueInArray函数的具体用法?PHP GetValueInArray怎么用?PHP GetValueInArray使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetValueInArray函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: convert_article_table
function convert_article_table($_prefix)
{
global $zbp;
$list = array("`ID`" => "log_ID", "`post_title`" => "log_Title", "unix_timestamp(`post_date`)" => "log_PostTime", "`post_excerpt`" => "log_Intro", "`post_content`" => "log_Content", "`post_name`" => "log_Alias", "`post_author`" => "log_AuthorID", '0' => "log_CateID", 'IF(`post_type` = "post", 0, 1 )' => "log_Type", "0" => "log_ViewNums", "`comment_count`" => "log_CommNums", '0' => "log_IsTop", 'IF(`post_status` = "publish", 0, 1 )' => "log_Status", '""' => "log_Meta");
$ary1 = array();
$ary2 = array();
foreach ($list as $name => $value) {
$ary1[] = $value;
$ary2[] = $name . ' AS ' . $value;
}
$sql = build_sql('Post', $_prefix . 'posts', $ary1, $ary2, ' WHERE (((`post_type`="page") OR (`post_type`="post")) AND (`post_status`<>"auto-draft"))');
$zbp->db->QueryMulit($sql);
$array = $zbp->GetArticleList(null, null, null, null, null, false);
foreach ($array as $a) {
if ($a->Intro == '') {
if (strpos($a->Content, '<!--more-->') !== false) {
$a->Intro = GetValueInArray(explode('<!--more-->', $a->Content), 0);
} else {
if ($a->Intro == '') {
$a->Intro = SubStrUTF8($a->Content, $zbp->option['ZC_ARTICLE_EXCERPT_MAX']);
if (strpos($a->Intro, '<') !== false) {
$a->Intro = CloseTags($a->Intro);
}
}
}
}
$a->Save();
}
return;
}
示例2: GetValueInArrayByCurrent
function GetValueInArrayByCurrent($array, $name)
{
if (is_array($array)) {
$array = current($array);
return GetValueInArray($array, $name);
}
}
示例3: misc_statistic
function misc_statistic()
{
global $zbp;
$r = null;
$zbp->BuildTemplate();
$xmlrpc_address = $zbp->host . 'zb_system/xml-rpc/';
$current_member = $zbp->user->Name;
$current_version = $zbp->option['ZC_BLOG_VERSION'];
$all_artiles = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) AS num FROM ' . $GLOBALS['table']['Post'] . ' WHERE log_Type=0'), 'num');
$all_pages = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) AS num FROM ' . $GLOBALS['table']['Post'] . ' WHERE log_Type=1'), 'num');
$all_categorys = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) AS num FROM ' . $GLOBALS['table']['Category']), 'num');
$all_comments = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) AS num FROM ' . $GLOBALS['table']['Comment']), 'num');
$all_views = $zbp->option['ZC_VIEWNUMS_TURNOFF'] == true ? 0 : GetValueInArrayByCurrent($zbp->db->Query('SELECT SUM(log_ViewNums) AS num FROM ' . $GLOBALS['table']['Post']), 'num');
$all_tags = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) as num FROM ' . $GLOBALS['table']['Tag']), 'num');
$all_members = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) AS num FROM ' . $GLOBALS['table']['Member']), 'num');
$current_theme = $zbp->theme;
$current_style = $zbp->style;
$current_member = '{$zbp->user->Name}';
$ajax = Network::Create();
if ($ajax) {
$ajax = substr(get_class($ajax), 7);
}
$system_environment = PHP_OS . ';' . GetValueInArray(explode(' ', str_replace(array('Microsoft-', '/'), array('', ''), GetVars('SERVER_SOFTWARE', 'SERVER'))), 0) . ';' . 'PHP' . phpversion() . ';' . $zbp->option['ZC_DATABASE_TYPE'] . ';' . $ajax;
$r .= "<tr><td class='td20'>{$zbp->lang['msg']['current_member']}</td><td class='td30'>{$current_member}</td><td class='td20'>{$zbp->lang['msg']['current_version']}</td><td class='td30'>{$current_version}</td></tr>";
$r .= "<tr><td class='td20'>{$zbp->lang['msg']['all_artiles']}</td><td>{$all_artiles}</td><td>{$zbp->lang['msg']['all_categorys']}</td><td>{$all_categorys}</td></tr>";
$r .= "<tr><td class='td20'>{$zbp->lang['msg']['all_pages']}</td><td>{$all_pages}</td><td>{$zbp->lang['msg']['all_tags']}</td><td>{$all_tags}</td></tr>";
$r .= "<tr><td class='td20'>{$zbp->lang['msg']['all_comments']}</td><td>{$all_comments}</td><td>{$zbp->lang['msg']['all_views']}</td><td>{$all_views}</td></tr>";
$r .= "<tr><td class='td20'>{$zbp->lang['msg']['current_theme']}/{$zbp->lang['msg']['current_style']}</td><td>{$current_theme}/{$current_style}</td><td>{$zbp->lang['msg']['all_members']}</td><td>{$all_members}</td></tr>";
$r .= "<tr><td class='td20'>{$zbp->lang['msg']['xmlrpc_address']}</td><td>{$xmlrpc_address}</td><td>{$zbp->lang['msg']['system_environment']}</td><td>{$system_environment}</td></tr>";
$zbp->cache->reload_statistic = $r;
$zbp->cache->reload_statistic_time = time();
$zbp->cache->system_environment = $system_environment;
//$zbp->SaveCache();
CountNormalArticleNums();
$zbp->AddBuildModule('statistics', array($all_artiles, $all_pages, $all_categorys, $all_tags, $all_views, $all_comments));
$zbp->BuildModule();
$r = str_replace('{#ZC_BLOG_HOST#}', $zbp->host, $r);
$r = str_replace('{$zbp->user->Name}', $zbp->user->Name, $r);
echo $r;
}
示例4: misc_statistic
function misc_statistic()
{
global $zbp;
$r = null;
$zbp->BuildTemplate();
$xmlrpc_address = $zbp->host . 'zb_system/xml-rpc/';
$current_member = $zbp->user->Name;
$current_version = $zbp->option['ZC_BLOG_VERSION'];
$all_artiles = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(log_ID) AS num FROM ' . $GLOBALS['table']['Post'] . ' WHERE log_Type=0'), 'num');
$all_pages = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(log_ID) AS num FROM ' . $GLOBALS['table']['Post'] . ' WHERE log_Type=1'), 'num');
$all_categorys = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(cate_ID) AS num FROM ' . $GLOBALS['table']['Category']), 'num');
$all_comments = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(comm_ID) AS num FROM ' . $GLOBALS['table']['Comment']), 'num');
$all_views = GetValueInArrayByCurrent($zbp->db->Query('SELECT SUM(log_ViewNums) AS num FROM ' . $GLOBALS['table']['Post']), 'num');
$all_tags = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(tag_ID) as num FROM ' . $GLOBALS['table']['Tag']), 'num');
$all_members = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(mem_ID) AS num FROM ' . $GLOBALS['table']['Member']), 'num');
$current_theme = $zbp->theme;
$current_style = $zbp->style;
$current_member = '{$zbp->user->Name}';
$system_environment = PHP_OS . ';' . GetValueInArray(explode('/', GetVars('SERVER_SOFTWARE', 'SERVER')), 0) . ';' . 'PHP ' . phpversion() . ';' . $zbp->option['ZC_DATABASE_TYPE'];
$r .= "<tr><td class='td20'>{$zbp->lang['msg']['current_member']}</td><td class='td30'>{$current_member}</td><td class='td20'>{$zbp->lang['msg']['current_version']}</td><td class='td30'>{$current_version}</td></tr>";
$r .= "<tr><td class='td20'>{$zbp->lang['msg']['all_artiles']}</td><td>{$all_artiles}</td><td>{$zbp->lang['msg']['all_categorys']}</td><td>{$all_categorys}</td></tr>";
$r .= "<tr><td class='td20'>{$zbp->lang['msg']['all_pages']}</td><td>{$all_pages}</td><td>{$zbp->lang['msg']['all_tags']}</td><td>{$all_tags}</td></tr>";
$r .= "<tr><td class='td20'>{$zbp->lang['msg']['all_comments']}</td><td>{$all_comments}</td><td>{$zbp->lang['msg']['all_views']}</td><td>{$all_views}</td></tr>";
$r .= "<tr><td class='td20'>{$zbp->lang['msg']['current_theme']}/{$zbp->lang['msg']['current_style']}</td><td>{$current_theme}/{$current_style}</td><td>{$zbp->lang['msg']['all_members']}</td><td>{$all_members}</td></tr>";
$r .= "<tr><td class='td20'>{$zbp->lang['msg']['xmlrpc_address']}</td><td>{$xmlrpc_address}</td><td>{$zbp->lang['msg']['system_environment']}</td><td>{$system_environment}</td></tr>";
$s = $zbp->db->sql->Count($zbp->table['Post'], array(array('COUNT', '*', 'num')), array(array('=', 'log_Type', 0), array('=', 'log_IsTop', 0), array('=', 'log_Status', 0)));
$num = GetValueInArrayByCurrent($zbp->db->Query($s), 'num');
$zbp->LoadConfigs();
$zbp->LoadCache();
$zbp->cache->reload_statistic = $r;
$zbp->cache->reload_statistic_time = time();
$zbp->cache->normal_article_nums = $num;
$zbp->SaveCache();
$zbp->AddBuildModule('statistics', array($all_artiles, $all_pages, $all_categorys, $all_tags, $all_views, $all_comments));
$zbp->BuildModule();
$r = str_replace('{$zbp->user->Name}', $zbp->user->Name, $r);
echo $r;
}
示例5: HeartVote_Main
function HeartVote_Main(&$post, $method, $args)
{
global $zbp;
if ($method != 'HeartVote') {
return null;
}
//$id=$template->GetTags('article')->ID;
$id = $post->ID;
$s = "<!--hvbegin--><div class=\"heart-vote\" id=\"HeartVote_{$id}\">";
$s .= "<ul class=\"unit-rating\">";
$s .= "<li class='current-rating' style=\"width:0px;\"></li>";
$s .= "<li><a href=\"javascript:heartVote('1','{$id}')\" title=\"打1分\" class=\"r1-unit\">1</a></li>";
$s .= "<li><a href=\"javascript:heartVote('2','{$id}')\" title=\"打2分\" class=\"r2-unit\">2</a></li>";
$s .= "<li><a href=\"javascript:heartVote('3','{$id}')\" title=\"打3分\" class=\"r3-unit\">3</a></li>";
$s .= "<li><a href=\"javascript:heartVote('4','{$id}')\" title=\"打4分\" class=\"r4-unit\">4</a></li>";
$s .= "<li><a href=\"javascript:heartVote('5','{$id}')\" title=\"打5分\" class=\"r5-unit\">5</a></li>";
$s .= "<li><a href=\"javascript:heartVote('6','{$id}')\" title=\"打6分\" class=\"r6-unit\">6</a></li>";
$s .= "<li><a href=\"javascript:heartVote('7','{$id}')\" title=\"打7分\" class=\"r7-unit\">7</a></li>";
$s .= "<li><a href=\"javascript:heartVote('8','{$id}')\" title=\"打8分\" class=\"r8-unit\">8</a></li>";
$s .= "<li><a href=\"javascript:heartVote('9','{$id}')\" title=\"打9分\" class=\"r9-unit\">9</a></li>";
$s .= "<li><a href=\"javascript:heartVote('10','{$id}')\" title=\"打10分\" class=\"r10-unit\">10</a></li>";
$s .= "</ul><b>0</b><i>分/0个投票</i></div>";
$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;
} else {
$allvote = substr($allvote / $alluser, 0, 3);
}
$s .= "<script type=\"text/javascript\">showVote('{$allvote}','{$alluser}')</script><!--hvend-->";
//$s.="<script src=\"{$zbp->host}zb_users/plugin/HeartVote/getvote.php?id={$id}\" type=\"text/javascript\"></script>";
//$template->SetTags('HeartVote',$s);
echo $s;
$GLOBALS['Filter_Plugin_Post_Call']['HeartVote_Main'] = PLUGIN_EXITSIGNAL_RETURN;
}
示例6: __get
public function __get($name)
{
global $zbp;
switch ($name) {
case 'Category':
return $zbp->GetCategoryByID($this->CateID);
break;
case 'Author':
return $zbp->GetMemberByID($this->AuthorID);
break;
case 'StatusName':
return $zbp->lang['post_status_name'][$this->Status];
break;
case 'Url':
if ($this->Type == ZC_POST_TYPE_ARTICLE) {
$u = new UrlRule($zbp->option['ZC_ARTICLE_REGEX']);
} else {
$u = new UrlRule($zbp->option['ZC_PAGE_REGEX']);
}
$u->Rules['{%id%}'] = $this->ID;
if ($this->Alias) {
$u->Rules['{%alias%}'] = $this->Alias;
} else {
$u->Rules['{%alias%}'] = urlencode($this->Title);
}
$u->Rules['{%year%}'] = $this->Time('Y');
$u->Rules['{%month%}'] = $this->Time('m');
$u->Rules['{%day%}'] = $this->Time('d');
if ($this->Category->Alias) {
$u->Rules['{%category%}'] = $this->Category->Alias;
} else {
$u->Rules['{%category%}'] = urlencode($this->Category->Name);
}
if ($this->Author->Alias) {
$u->Rules['{%author%}'] = $this->Author->Alias;
} else {
$u->Rules['{%author%}'] = urlencode($this->Author->Name);
}
return $u->Make();
break;
case 'Tags':
return $zbp->LoadTagsByIDString($this->Tag);
break;
case 'TagsCount':
return substr_count($this->Tag, '{');
break;
case 'TagsName':
return $this->TagsToNameString;
case 'Template':
$value = $this->Data[$name];
if ($value == '') {
$value = GetValueInArray($this->Category->GetDataArray(), 'LogTemplate');
if ($value == '') {
$value = $zbp->option['ZC_POST_DEFAULT_TEMPLATE'];
}
}
return $value;
case 'CommentPostUrl':
foreach ($GLOBALS['Filter_Plugin_Post_CommentPostUrl'] as $fpname => &$fpsignal) {
$fpreturn = $fpname($this);
if ($fpreturn) {
return $fpreturn;
}
}
$key = '&key=' . md5($zbp->guid . $this->ID . date('Y-m-d'));
return $zbp->host . 'zb_system/cmd.php?act=cmt&postid=' . $this->ID . $key;
break;
case 'ValidCodeUrl':
return $zbp->validcodeurl . '?id=cmt';
break;
case 'Prev':
static $_prev = null;
if ($_prev !== null) {
return $_prev;
}
$articles = $zbp->GetPostList(array('*'), array(array('=', 'log_Type', 0), array('=', 'log_Status', 0), array('<', 'log_PostTime', $this->PostTime)), array('log_PostTime' => 'DESC'), array(1), null);
if (count($articles) == 1) {
$_prev = $articles[0];
} else {
$_prev = '';
}
return $_prev;
break;
case 'Next':
static $_next = null;
if ($_next !== null) {
return $_next;
}
$articles = $zbp->GetPostList(array('*'), array(array('=', 'log_Type', 0), array('=', 'log_Status', 0), array('>', 'log_PostTime', $this->PostTime)), array('log_PostTime' => 'ASC'), array(1), null);
if (count($articles) == 1) {
$_next = $articles[0];
} else {
$_next = '';
}
return $_next;
break;
default:
return parent::__get($name);
break;
}
//.........这里部分代码省略.........
示例7: PostArticle
function PostArticle()
{
global $zbp;
if (!isset($_POST['ID'])) {
return;
}
if (isset($_POST['Tag'])) {
$_POST['Tag'] = TransferHTML($_POST['Tag'], '[noscript]');
$_POST['Tag'] = PostArticle_CheckTagAndConvertIDtoString($_POST['Tag']);
}
if (isset($_POST['Content'])) {
$_POST['Content'] = str_replace('<hr class="more" />', '<!--more-->', $_POST['Content']);
$_POST['Content'] = str_replace('<hr class="more"/>', '<!--more-->', $_POST['Content']);
if (strpos($_POST['Content'], '<!--more-->') !== false) {
if (isset($_POST['Intro'])) {
$_POST['Intro'] = GetValueInArray(explode('<!--more-->', $_POST['Content']), 0);
}
} else {
if (isset($_POST['Intro'])) {
if ($_POST['Intro'] == '') {
$_POST['Intro'] = SubStrUTF8($_POST['Content'], $zbp->option['ZC_ARTICLE_EXCERPT_MAX']);
if (strpos($_POST['Intro'], '<') !== false) {
$_POST['Intro'] = CloseTags($_POST['Intro']);
}
}
}
}
}
if (!isset($_POST['AuthorID'])) {
$_POST['AuthorID'] = $zbp->user->ID;
} else {
if ($_POST['AuthorID'] != $zbp->user->ID && !$zbp->CheckRights('ArticleAll')) {
$_POST['AuthorID'] = $zbp->user->ID;
}
if ($_POST['AuthorID'] == 0) {
$_POST['AuthorID'] = $zbp->user->ID;
}
}
if (isset($_POST['Alias'])) {
$_POST['Alias'] = TransferHTML($_POST['Alias'], '[noscript]');
}
if (isset($_POST['PostTime'])) {
$_POST['PostTime'] = strtotime($_POST['PostTime']);
}
if (!$zbp->CheckRights('ArticleAll')) {
unset($_POST['IsTop']);
}
$article = new Post();
$pre_author = null;
$pre_tag = null;
$pre_category = null;
if (GetVars('ID', 'POST') == 0) {
if (!$zbp->CheckRights('ArticlePub')) {
$_POST['Status'] = ZC_POST_STATUS_AUDITING;
}
} else {
$article->LoadInfoByID(GetVars('ID', 'POST'));
if ($article->AuthorID != $zbp->user->ID && !$zbp->CheckRights('ArticleAll')) {
$zbp->ShowError(6);
}
if (!$zbp->CheckRights('ArticlePub') && $article->Status == ZC_POST_STATUS_AUDITING) {
$_POST['Status'] = ZC_POST_STATUS_AUDITING;
}
$pre_author = $article->AuthorID;
$pre_tag = $article->Tag;
$pre_category = $article->CateID;
}
foreach ($zbp->datainfo['Post'] as $key => $value) {
if ($key == 'ID') {
continue;
}
if ($key == 'Meta') {
continue;
}
if (isset($_POST[$key])) {
$article->{$key} = GetVars($key, 'POST');
}
}
$article->Type = ZC_POST_TYPE_ARTICLE;
foreach ($GLOBALS['Filter_Plugin_PostArticle_Core'] as $fpname => &$fpsignal) {
$fpname($article);
}
FilterPost($article);
FilterMeta($article);
$article->Save();
CountTagArrayString($pre_tag . $article->Tag);
CountMemberArray(array($pre_author, $article->AuthorID));
CountCategoryArray(array($pre_category, $article->CateID));
CountPostArray(array($article->ID));
CountNormalArticleNums();
$zbp->AddBuildModule('previous');
$zbp->AddBuildModule('calendar');
$zbp->AddBuildModule('comments');
$zbp->AddBuildModule('archives');
$zbp->AddBuildModule('tags');
$zbp->AddBuildModule('authors');
foreach ($GLOBALS['Filter_Plugin_PostArticle_Succeed'] as $fpname => &$fpsignal) {
$fpname($article);
}
return true;
//.........这里部分代码省略.........
示例8: zbp_editPost
function zbp_editPost($id, $xmlstring, $publish)
{
global $zbp;
$xml = simplexml_load_string($xmlstring);
if ($xml) {
$post = array();
foreach ($xml->children() as $x) {
$a = (string) $x->name;
if ($a == 'categories') {
$b = $x->value->children()->asXML();
} else {
$b = $x->value->children();
}
$b = str_replace(array('<array>', '</array>', '<data>', '</data>', '<string>', '</string>'), array(''), $b);
$post[$a] = $b;
}
$_POST['ID'] = $id;
$_POST['Title'] = $post['title'];
if ($publish) {
$_POST['Status'] = 0;
} else {
$_POST['Status'] = 1;
}
if (isset($post['mt_basename'])) {
$_POST['Alias'] = $post['mt_basename'];
}
if (isset($post['dateCreated'])) {
date_default_timezone_set('GMT');
$_POST['PostTime'] = strtotime($post['dateCreated']);
date_default_timezone_set($zbp->option['ZC_TIME_ZONE_NAME']);
$_POST['PostTime'] = date('c', $_POST['PostTime']);
}
if (isset($post['wp_author_id'])) {
$_POST['AuthorID'] = $post['wp_author_id'];
} else {
$_POST['AuthorID'] = $zbp->user->ID;
}
if (isset($post['mt_keywords'])) {
$_POST['Tag'] = $post['mt_keywords'];
}
if (isset($post['mt_allow_comments'])) {
if ($post['mt_allow_comments'] > 0) {
$_POST['IsLock'] = $post['mt_allow_comments'] - 1;
} else {
$_POST['IsLock'] = $post['mt_allow_comments'];
}
}
if (isset($post['categories'])) {
$post['categories'] = str_replace('<value>', '', $post['categories']);
$catename = trim(GetValueInArray(explode('</value>', $post['categories']), 0));
$_POST['CateID'] = $zbp->GetCategoryByName($catename)->ID;
}
if (isset($post['mt_excerpt'])) {
$_POST['Intro'] = $post['mt_excerpt'];
}
if (isset($post['mt_text_more']) || isset($post['description'])) {
if (isset($post['mt_text_more'])) {
if ($post['mt_text_more'] != '') {
$_POST['Content'] = $post['description'] . '<!--more-->' . $post['mt_text_more'];
} else {
$_POST['Content'] = $post['description'];
}
} else {
$_POST['Content'] = $post['description'];
}
}
$strXML = '<methodResponse><params><param><value><boolean>$%#1#%$</boolean></value></param></params></methodResponse>';
if (PostArticle() == true) {
$strXML = str_replace("\$%#1#%\$", 1, $strXML);
echo $strXML;
} else {
$zbp->ShowError(0, __FILE__, __LINE_);
}
}
}
示例9: GetRequestUri
/**
* 获取请求来源URL
* @return string 返回URL
*/
function GetRequestUri()
{
$url = '';
if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {
$url = $_SERVER['HTTP_X_ORIGINAL_URL'];
} elseif (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
$url = $_SERVER['HTTP_X_REWRITE_URL'];
if (strpos($url, '?') !== false) {
$querys = GetValueInArray(explode('?', $url), '1');
foreach (explode('&', $querys) as $query) {
$name = GetValueInArray(explode('=', $query), '0');
$value = GetValueInArray(explode('=', $query), '1');
$name = urldecode($name);
$value = urldecode($value);
if (!isset($_GET[$name])) {
$_GET[$name] = $value;
}
if (!isset($_GET[$name])) {
$_REQUEST[$name] = $value;
}
$name = '';
$value = '';
}
}
} elseif (isset($_SERVER['REQUEST_URI'])) {
$url = $_SERVER['REQUEST_URI'];
} elseif (isset($_SERVER['REDIRECT_URL'])) {
$url = $_SERVER['REDIRECT_URL'];
if (isset($_SERVER['REDIRECT_QUERY_STRIN'])) {
$url .= '?' . $_SERVER['REDIRECT_QUERY_STRIN'];
}
} else {
$url = $_SERVER['PHP_SELF'] . ($_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : '');
}
return $url;
}
示例10: Save
/**
* @return bool
*/
public function Save()
{
global $zbp;
if ($this->Type == ZC_POST_TYPE_ARTICLE) {
if ($this->Template == GetValueInArray($this->Category->GetData(), 'LogTemplate')) {
$this->data['Template'] = '';
}
}
if ($this->Template == $zbp->GetPostType_Template($this->Type)) {
$this->data['Template'] = '';
}
foreach ($GLOBALS['hooks']['Filter_Plugin_Post_Save'] as $fpname => &$fpsignal) {
$fpsignal = PLUGIN_EXITSIGNAL_NONE;
$fpreturn = $fpname($this);
if ($fpsignal == PLUGIN_EXITSIGNAL_RETURN) {
return $fpreturn;
}
}
return parent::Save();
}
示例11: PostArticle
/**
* 提交文章数据
* @api Filter_Plugin_PostArticle_Core
* @api Filter_Plugin_PostArticle_Succeed
* @return bool
*/
function PostArticle()
{
global $zbp;
if (!isset($_POST['ID'])) {
return;
}
if (isset($_COOKIE['timezone'])) {
$tz = GetVars('timezone', 'COOKIE');
if (is_numeric($tz)) {
date_default_timezone_set('Etc/GMT' . sprintf('%+d', -$tz));
}
unset($tz);
}
if (isset($_POST['Tag'])) {
$_POST['Tag'] = TransferHTML($_POST['Tag'], '[noscript]');
$_POST['Tag'] = PostArticle_CheckTagAndConvertIDtoString($_POST['Tag']);
}
if (isset($_POST['Content'])) {
$_POST['Content'] = str_replace('<hr class="more" />', '<!--more-->', $_POST['Content']);
$_POST['Content'] = str_replace('<hr class="more"/>', '<!--more-->', $_POST['Content']);
if (strpos($_POST['Content'], '<!--more-->') !== false) {
if (isset($_POST['Intro'])) {
$_POST['Intro'] = GetValueInArray(explode('<!--more-->', $_POST['Content']), 0);
}
} else {
if (isset($_POST['Intro'])) {
if ($_POST['Intro'] == '') {
$_POST['Intro'] = SubStrUTF8($_POST['Content'], $zbp->option['ZC_ARTICLE_EXCERPT_MAX']);
$_POST['Intro'] .= '<!--autointro-->';
}
$_POST['Intro'] = CloseTags($_POST['Intro']);
}
}
}
if (!isset($_POST['AuthorID'])) {
$_POST['AuthorID'] = $zbp->user->ID;
} else {
if ($_POST['AuthorID'] != $zbp->user->ID && !$zbp->CheckRights('ArticleAll')) {
$_POST['AuthorID'] = $zbp->user->ID;
}
if ($_POST['AuthorID'] == 0) {
$_POST['AuthorID'] = $zbp->user->ID;
}
}
if (isset($_POST['Alias'])) {
$_POST['Alias'] = TransferHTML($_POST['Alias'], '[noscript]');
}
if (isset($_POST['PostTime'])) {
$_POST['PostTime'] = strtotime($_POST['PostTime']);
}
if (!$zbp->CheckRights('ArticleAll')) {
unset($_POST['IsTop']);
}
$article = new Post();
$pre_author = null;
$pre_tag = null;
$pre_category = null;
$pre_istop = null;
$pre_status = null;
$orig_id = 0;
if (GetVars('ID', 'POST') == 0) {
if (!$zbp->CheckRights('ArticlePub')) {
$_POST['Status'] = ZC_POST_STATUS_AUDITING;
}
} else {
$article->LoadInfoByID(GetVars('ID', 'POST'));
if ($article->AuthorID != $zbp->user->ID && !$zbp->CheckRights('ArticleAll')) {
$zbp->ShowError(6, __FILE__, __LINE__);
}
if (!$zbp->CheckRights('ArticlePub') && $article->Status == ZC_POST_STATUS_AUDITING) {
$_POST['Status'] = ZC_POST_STATUS_AUDITING;
}
$orig_id = $article->ID;
$pre_author = $article->AuthorID;
$pre_tag = $article->Tag;
$pre_category = $article->CateID;
$pre_istop = $article->IsTop;
$pre_status = $article->Status;
}
foreach ($zbp->datainfo['Post'] as $key => $value) {
if ($key == 'ID' || $key == 'Meta') {
continue;
}
if (isset($_POST[$key])) {
$article->{$key} = GetVars($key, 'POST');
}
}
$article->Type = ZC_POST_TYPE_ARTICLE;
if (isset($_POST['IsTop'])) {
if (1 == $_POST['IsTop']) {
$article->TopType = $_POST['IstopType'];
}
if (0 == $_POST['IsTop']) {
$article->TopType = null;
//.........这里部分代码省略.........
示例12: CreateTable
public function CreateTable($tablename, $datainfo)
{
$s = '';
if ($this->type == 'Dbpdo_MySQL' || $this->type == 'DbMySQL') {
$s .= 'CREATE TABLE IF NOT EXISTS ' . $tablename . ' (';
$i = 0;
foreach ($datainfo as $key => $value) {
if ($value[1] == 'integer') {
if ($i == 0) {
$s .= $value[0] . ' int(11) NOT NULL AUTO_INCREMENT' . ',';
} else {
if ($value[2] == '') {
$s .= $value[0] . ' int(11) NOT NULL DEFAULT \'' . $value[3] . '\'' . ',';
} elseif ($value[2] == 'tinyint') {
$s .= $value[0] . ' tinyint(4) NOT NULL DEFAULT \'' . $value[3] . '\'' . ',';
} elseif ($value[2] == 'smallint') {
$s .= $value[0] . ' smallint(6) NOT NULL DEFAULT \'' . $value[3] . '\'' . ',';
} elseif ($value[2] == 'mediumint') {
$s .= $value[0] . ' mediumint(9) NOT NULL DEFAULT \'' . $value[3] . '\'' . ',';
} elseif ($value[2] == 'int') {
$s .= $value[0] . ' int(11) NOT NULL DEFAULT \'' . $value[3] . '\'' . ',';
} elseif ($value[2] == 'bigint') {
$s .= $value[0] . ' bigint(20) NOT NULL DEFAULT \'' . $value[3] . '\'' . ',';
}
}
}
if ($value[1] == 'boolean') {
$s .= $value[0] . ' tinyint(1) NOT NULL DEFAULT \'' . (int) $value[3] . '\'' . ',';
}
if ($value[1] == 'string') {
if ($value[2] != '') {
if (strpos($value[2], 'char') !== false) {
$s .= $value[0] . ' char(' . str_replace('char', '', $value[2]) . ') NOT NULL DEFAULT \'' . $value[3] . '\'' . ',';
} elseif (is_int($value[2])) {
$s .= $value[0] . ' varchar(' . $value[2] . ') NOT NULL DEFAULT \'' . $value[3] . '\'' . ',';
} elseif ($value[2] == 'tinytext') {
$s .= $value[0] . ' tinytext NOT NULL ' . ',';
} elseif ($value[2] == 'text') {
$s .= $value[0] . ' text NOT NULL ' . ',';
} elseif ($value[2] == 'mediumtext') {
$s .= $value[0] . ' mediumtext NOT NULL ' . ',';
} elseif ($value[2] == 'longtext') {
$s .= $value[0] . ' longtext NOT NULL ' . ',';
}
} else {
$s .= $value[0] . ' longtext NOT NULL ' . ',';
}
}
if ($value[1] == 'double' || $value[1] == 'float') {
$s .= $value[0] . ' $value[1] NOT NULL DEFAULT \'0\'' . ',';
}
$i += 1;
}
reset($datainfo);
$s .= 'PRIMARY KEY (' . GetValueInArrayByCurrent($datainfo, 0) . '),';
$s = substr($s, 0, strlen($s) - 1);
$s .= ') ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;';
}
if ($this->type == 'DbSQLite') {
$s .= 'CREATE TABLE ' . $tablename . ' (';
$i = 0;
foreach ($datainfo as $key => $value) {
if ($value[1] == 'integer') {
if ($i == 0) {
$s .= $value[0] . ' integer primary key' . ',';
} else {
$s .= $value[0] . ' integer NOT NULL DEFAULT \'' . $value[3] . '\'' . ',';
}
}
if ($value[1] == 'boolean') {
$s .= $value[0] . ' bit NOT NULL DEFAULT \'' . (int) $value[3] . '\'' . ',';
}
if ($value[1] == 'string') {
if ($value[2] != '') {
if (strpos($value[2], 'char') !== false) {
$s .= $value[0] . ' char(' . str_replace('char', '', $value[2]) . ') NOT NULL DEFAULT \'' . $value[3] . '\'' . ',';
} elseif (is_int($value[2])) {
$s .= $value[0] . ' varchar(' . $value[2] . ') NOT NULL DEFAULT \'' . $value[3] . '\'' . ',';
} else {
$s .= $value[0] . ' text NOT NULL DEFAULT \'\',';
}
} else {
$s .= $value[0] . ' text NOT NULL DEFAULT \'\',';
}
}
if ($value[1] == 'double' || $value[1] == 'float') {
$s .= $value[0] . ' $value[1] NOT NULL DEFAULT \'0\'' . ',';
}
$i += 1;
}
$s = substr($s, 0, strlen($s) - 1);
$s .= ');';
reset($datainfo);
$s .= 'CREATE UNIQUE INDEX %pre%' . GetValueInArrayByCurrent($datainfo, 0) . ' on ' . $tablename . ' (' . GetValueInArrayByCurrent($datainfo, 0) . ');';
}
if ($this->type == 'DbSQLite3') {
$s .= 'CREATE TABLE ' . $tablename . ' (';
$i = 0;
foreach ($datainfo as $key => $value) {
if ($value[1] == 'integer') {
//.........这里部分代码省略.........
示例13: GetVars
$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;
} else {
$allvote = substr($allvote / $alluser, 0, 3);
}
if ($mode == 'script') {
echo "showVote({$allvote},{$alluser});";
} else {
echo "{$allvote}|{$alluser}";
}
} else {
if ($mode == 'script') {
echo "alert('你已经投过一次了,还想投么( ̄口 ̄)!!!');showVote(0,0);";
} else {
echo '你已经投过一次了,还想投么( ̄口 ̄)!!!';