本文整理汇总了PHP中UpdatePage函数的典型用法代码示例。如果您正苦于以下问题:PHP UpdatePage函数的具体用法?PHP UpdatePage怎么用?PHP UpdatePage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UpdatePage函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: HandleGuestStore
function HandleGuestStore($pagename, $auth)
{
global $wpcom_api_key, $wpcom_home;
$akismet = new Akismet($wpcom_home, $wpcom_api_key);
$akismet->setCommentAuthor($_POST['name']);
$akismet->setCommentAuthorEmail($_POST['email']);
$akismet->setCommentAuthorURL($_POST['url']);
$akismet->setCommentContent($_POST['comment']);
$itemurl = $pagename . date("Ymd") . "-" . uniqid();
$akismet->setPermalink($itemurl);
$page['name'] = $itemurl;
$page['text'] = "----\n";
$page['text'] .= strlen($_POST['name']) > 0 ? $_POST['name'] : "Unbekannt";
if (strlen($_POST['email']) > 0) {
$page['text'] .= " [[✉->mailto:";
$page['text'] .= $_POST['email'];
$page['text'] .= "]]";
}
if (strlen($_POST['url']) > 0) {
$page['text'] .= " [[➚->";
$page['text'] .= substr($_POST['url'], 0, 4) == "http" ? $_POST['url'] : "http://" . $_POST['url'];
$page['text'] .= "]]";
}
$page['text'] .= " schrieb am ";
$page['text'] .= date("d.m.Y");
$page['text'] .= ":\n\n";
$page['text'] .= $_POST['comment'];
$page['text'] .= $akismet->isCommentSpam() ? "(:spam: true:)" : "(:spam: false:)";
$page['time'] = $Now;
$page['host'] = $_SERVER['REMOTE_ADDR'];
$page['agent'] = @$_SERVER['HTTP_USER_AGENT'];
UpdatePage($page['name'], $page, $page);
HandleBrowse($pagename);
}
示例2: HandleEdit
function HandleEdit($pagename, $auth = 'edit') {
global $IsPagePosted, $EditFields, $ChangeSummary, $EditFunctions,
$EnablePost, $FmtV, $Now, $EditRedirectFmt,
$PageEditForm, $HandleEditFmt, $PageStartFmt, $PageEditFmt, $PageEndFmt;
SDV($EditRedirectFmt, '$FullName');
if (@$_POST['cancel'])
{ Redirect(FmtPageName($EditRedirectFmt, $pagename)); return; }
Lock(2);
$page = RetrieveAuthPage($pagename, $auth, true);
if (!$page) Abort("?cannot edit $pagename");
$new = $page;
foreach((array)$EditFields as $k)
if (isset($_POST[$k])) $new[$k]=str_replace("\r",'',stripmagic($_POST[$k]));
$new['csum'] = $ChangeSummary;
if ($ChangeSummary) $new["csum:$Now"] = $ChangeSummary;
$EnablePost &= preg_grep('/^post/', array_keys(@$_POST));
$new['=preview'] = $new['text'];
PCache($pagename, $new);
UpdatePage($pagename, $page, $new);
Lock(0);
if ($IsPagePosted && !@$_POST['postedit'])
{ Redirect(FmtPageName($EditRedirectFmt, $pagename)); return; }
$FmtV['$DiffClassMinor'] =
(@$_POST['diffclass']=='minor') ? "checked='checked'" : '';
$FmtV['$EditText'] =
str_replace('$','$',PHSC(@$new['text'],ENT_NOQUOTES));
$FmtV['$EditBaseTime'] = $Now;
if (@$PageEditForm) {
$efpage = FmtPageName($PageEditForm, $pagename);
$form = RetrieveAuthPage($efpage, 'read', false, READPAGE_CURRENT);
if (!$form || !@$form['text'])
Abort("?unable to retrieve edit form $efpage", 'editform');
$FmtV['$EditForm'] = MarkupToHTML($pagename, $form['text']);
}
SDV($PageEditFmt, "<div id='wikiedit'>
<h2 class='wikiaction'>$[Editing {\$FullName}]</h2>
<form method='post' rel='nofollow' action='\$PageUrl?action=edit'>
<input type='hidden' name='action' value='edit' />
<input type='hidden' name='n' value='\$FullName' />
<input type='hidden' name='basetime' value='\$EditBaseTime' />
\$EditMessageFmt
<textarea id='text' name='text' rows='25' cols='60'
onkeydown='if (event.keyCode==27) event.returnValue=false;'
>\$EditText</textarea><br />
<input type='submit' name='post' value=' $[Save] ' />");
SDV($HandleEditFmt, array(&$PageStartFmt, &$PageEditFmt, &$PageEndFmt));
PrintFmt($pagename, $HandleEditFmt);
}
示例3: PmFormSave
function PmFormSave($pagename, $msgtmpl, $opt, $safe_opt)
{
global $IsPagePosted;
Lock(2);
$saveto = MakePageName($pagename, $safe_opt['saveto']);
$target = @$opt['target'];
$page = ReadPage($saveto);
if (preg_match("/.*\\(:pmform +{$target}( .*?)?:\\).*\n?/", @$page['text'], $mark)) {
$mark_opt = ParseArgs($mark[1]);
$mark_opt['=mark'] = $mark[0];
$opt = array_merge($opt, $mark_opt);
$safe_opt = array_merge($safe_opt, $mark_opt);
}
if (!@$mark) {
$page = RetrieveAuthPage($saveto, 'edit', true);
if (!$page) {
return '$[Edit permission required]';
}
}
$new = $page;
$text = @$new['text'];
$errors = NULL;
if (preg_match('/\\S/', $msgtmpl)) {
$msgtext = FmtTemplateVars($msgtmpl, $opt, $saveto);
$errors = PmFormUpdateText($saveto, $text, $msgtext, $opt, $safe_opt);
}
if (!$errors && @$opt['savevars']) {
$errors = PmFormUpdateVars($saveto, $text, $opt);
}
if (!$errors) {
$new['text'] = $text;
UpdatePage($saveto, $page, $new);
if (!$IsPagePosted) {
return '$[Unable to save page]';
}
}
return $errors;
}
示例4: DeleteCompany
DeleteCompany($DeleteId);
}
if (ValidId($DeleteHost)) {
DeleteHost($EditId, $DeleteHost);
}
if ($HostId == "new" && ValidArr($EditArr)) {
CreateNewHost($EditId, $EditArr);
}
if (ValidId($HostId) && !ValidVar($EditPage) && !ValidVar($EditEvent) && ValidArr($EditArr)) {
UpdateHost($HostId, $EditArr);
}
if ($EditPage == "new" && ValidArr($EditArr)) {
AddSitePage($HostId, $EditArr);
}
if (ValidId($EditPage) && ValidArr($EditArr)) {
UpdatePage($EditPage, $EditArr);
}
if (ValidId($DeletePage)) {
DeletePage($DeletePage);
}
if (ValidId($EditEvent) && ValidArr($EditArr2)) {
UpdateQuery($EditEvent, $EditArr2);
}
if (ValidVar($EditEvent) == "new" && ValidId($EventPage) && ValidArr($EditArr2)) {
CreateQuery($EventPage, $EditArr2);
}
if (ValidId($DeleteEvent)) {
DeleteQuery($DeleteEvent);
}
if (ValidId($HostId) && ValidVar($NewHost)) {
CreateNewSiteHost($HostId, $NewHost);