/** * Create & Update article */ function api_article_post_function() { global $zbp; Add_Filter_Plugin('Filter_Plugin_PostArticle_Succeed', 'api_article_post_callback'); PostArticle(); $zbp->BuildModule(); $zbp->SaveCache(); }
case 'ArticleDel': if (!$zbp->ValidToken(GetVars('token', 'GET'))) { $zbp->ShowError(5, __FILE__, __LINE__); die; } DelArticle(); $zbp->BuildModule(); $zbp->SaveCache(); $zbp->SetHint('good'); Redirect('cmd.php?act=ArticleMng'); break; case 'ArticleMng': Redirect('admin/?' . GetVars('QUERY_STRING', 'SERVER')); break; case 'ArticlePst': PostArticle(); $zbp->BuildModule(); $zbp->SaveCache(); $zbp->SetHint('good'); Redirect('cmd.php?act=ArticleMng'); break; case 'PageEdt': Redirect('admin/edit.php?' . GetVars('QUERY_STRING', 'SERVER')); break; case 'PageDel': if (!$zbp->ValidToken(GetVars('token', 'GET'))) { $zbp->ShowError(5, __FILE__, __LINE__); die; } DelPage(); $zbp->BuildModule();
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_); } } }