function PasswdVar($pagename, $level) { global $PCache, $PasswdVarAuth, $FmtV; $page = $PCache[$pagename]; if (!isset($page['=passwd'][$level])) { $page = RetrieveAuthPage($pagename, 'ALWAYS', false, READPAGE_CURRENT); if ($page) PCache($pagename, $page); } SDV($PasswdVarAuth, 'attr'); if ($PasswdVarAuth && !@$page['=auth'][$PasswdVarAuth]) return XL('(protected)'); $pwsource = $page['=pwsource'][$level]; if (strncmp($pwsource, 'cascade:', 8) == 0) { $FmtV['$PWCascade'] = substr($pwsource, 8); return FmtPageName('$[(using $PWCascade password)]', $pagename); } $setting = PHSC(implode(' ', preg_replace('/^(?!@|\\w+:).+$/', '****', (array)$page['=passwd'][$level]))); if ($pwsource == 'group' || $pwsource == 'site') { $FmtV['$PWSource'] = $pwsource; $setting = FmtPageName('$[(set by $PWSource)] ', $pagename) . PHSC($setting); } return $setting; }
<p><b>$[Page is unsaved]</b></p> \$PreviewText <hr /><p><b>$[End of preview -- remember to save]</b><br /> <a href='#top'>$[Top]</a></p></div>"); SDV($HandleEditFmt, array(&$PageStartFmt, &$PageEditFmt, 'wiki:$[PmWiki.EditQuickReference]', &$PagePreviewFmt, &$PageEndFmt)); $EditMessageFmt = implode('', $MessagesFmt) . $EditMessageFmt; if ($action=='edit' && IsEnabled($EnableGUIButtons, 0)) array_push($EditFunctions, 'GUIEdit'); } else $MessagesFmt[] = @$EditMessageFmt; function GUIEdit($pagename, &$page, &$new) { global $EditMessageFmt; $EditMessageFmt .= GUIButtonCode($pagename); } ## mainpages: ## In 2.0.beta44 several utility pages change location to the new Site ## group. These settings cause some skins (that use translations) ## to know to link to the new locations. if ($Transition['mainpages']) { XLSDV('en', array( 'Main/SearchWiki' => XL('Site/Search'), 'PmWiki.EditQuickReference' => XL('Site/EditQuickReference'), 'PmWiki.UploadQuickReference' => XL('Site/UploadQuickReference'), )); }
if ($action != 'edit') { return; } SDV($PageEditForm, '$SiteGroup.EditForm'); SDV($PageEditFmt, '$EditForm'); if (@$_REQUEST['editform']) { $PageEditForm = $_REQUEST['editform']; $PageEditFmt = '$EditForm'; } $Conditions['e_preview'] = '(boolean)$_POST["preview"]'; XLSDV('en', array('ak_save' => 's', 'ak_saveedit' => 'u', 'ak_preview' => 'p', 'ak_textedit' => ',', 'e_rows' => '25', 'e_cols' => '60')); # (:e_preview:) displays the preview of formatted text. Markup('e_preview', 'directives', '/^\\(:e_preview:\\)/e', "Keep(\$GLOBALS['FmtV']['\$PreviewText'])"); # If we didn't load guiedit.php, then set (:e_guibuttons:) to # simply be empty. Markup('e_guibuttons', 'directives', '/\\(:e_guibuttons:\\)/', ''); SDVA($InputTags['e_form'], array(':html' => "<form action='{\$PageUrl}?action=edit' method='post'><input \n type='hidden' name='action' value='edit' /><input \n type='hidden' name='n' value='{\$FullName}' /><input \n type='hidden' name='basetime' value='\$EditBaseTime' />")); SDVA($InputTags['e_textarea'], array(':html' => "<textarea \$InputFormArgs \n onkeydown='if (event.keyCode==27) event.returnValue=false;' \n >\$EditText</textarea>", 'name' => 'text', 'id' => 'text', 'accesskey' => XL('ak_textedit'), 'rows' => XL('e_rows'), 'cols' => XL('e_cols'))); SDVA($InputTags['e_author'], array(':html' => "<input type='text' \$InputFormArgs />", 'name' => 'author', 'value' => $Author)); SDVA($InputTags['e_changesummary'], array(':html' => "<input type='text' \$InputFormArgs />", 'name' => 'csum', 'size' => '60', 'maxlength' => '100', 'value' => htmlspecialchars(stripmagic(@$_POST['csum']), ENT_QUOTES))); SDVA($InputTags['e_minorcheckbox'], array(':html' => "<input type='checkbox' \$InputFormArgs />", 'name' => 'diffclass', 'value' => 'minor')); if (@$_POST['diffclass'] == 'minor') { SDV($InputTags['e_minorcheckbox']['checked'], 'checked'); } SDVA($InputTags['e_savebutton'], array(':html' => "<input type='submit' \$InputFormArgs />", 'name' => 'post', 'value' => ' ' . XL('Save') . ' ', 'accesskey' => XL('ak_save'))); SDVA($InputTags['e_saveeditbutton'], array(':html' => "<input type='submit' \$InputFormArgs />", 'name' => 'postedit', 'value' => ' ' . XL('Save and edit') . ' ', 'accesskey' => XL('ak_saveedit'))); SDVA($InputTags['e_savedraftbutton'], array(':html' => '')); SDVA($InputTags['e_previewbutton'], array(':html' => "<input type='submit' \$InputFormArgs />", 'name' => 'preview', 'value' => ' ' . XL('Preview') . ' ', 'accesskey' => XL('ak_preview'))); SDVA($InputTags['e_cancelbutton'], array(':html' => "<input type='submit' \$InputFormArgs />", 'name' => 'cancel', 'value' => ' ' . XL('Cancel') . ' ')); SDVA($InputTags['e_resetbutton'], array(':html' => "<input type='reset' \$InputFormArgs />", 'value' => ' ' . XL('Reset') . ' '));
} } ## pageeditfmt: ## 2.0.beta44 switched to using wiki markup forms for page editing. ## However, some sites and skins have customized values of $PageEdit. ## This setting restores the default values. if (@$Transition['pageeditfmt']) { SDV($PageEditFmt, "<div id='wikiedit'>\n <a id='top' name='top'></a>\n <h1 class='wikiaction'>\$[Editing \$FullName]</h1>\n <form method='post' action='\$PageUrl?action=edit'>\n <input type='hidden' name='action' value='edit' />\n <input type='hidden' name='n' value='\$FullName' />\n <input type='hidden' name='basetime' value='\$EditBaseTime' />\n \$EditMessageFmt\n <textarea id='text' name='text' rows='25' cols='60'\n onkeydown='if (event.keyCode==27) event.returnValue=false;'\n >\$EditText</textarea><br />\n \$[Author]: <input type='text' name='author' value='\$Author' />\n <input type='checkbox' name='diffclass' value='minor' \$DiffClassMinor />\n \$[This is a minor edit]<br />\n <input type='submit' name='post' value=' \$[Save] ' />\n <input type='submit' name='preview' value=' \$[Preview] ' />\n <input type='reset' value=' \$[Reset] ' /></form></div>"); if (@$_POST['preview']) { SDV($PagePreviewFmt, "<div id='wikipreview'>\n <h2 class='wikiaction'>\$[Preview \$FullName]</h2>\n <p><b>\$[Page is unsaved]</b></p>\n \$PreviewText\n <hr /><p><b>\$[End of preview -- remember to save]</b><br />\n <a href='#top'>\$[Top]</a></p></div>"); } SDV($HandleEditFmt, array(&$PageStartFmt, &$PageEditFmt, 'wiki:$[PmWiki.EditQuickReference]', &$PagePreviewFmt, &$PageEndFmt)); $EditMessageFmt = implode('', $MessagesFmt) . $EditMessageFmt; if ($action == 'edit' && IsEnabled($EnableGUIButtons, 0)) { array_push($EditFunctions, 'GUIEdit'); } } else { $MessagesFmt[] = @$EditMessageFmt; } function GUIEdit($pagename, &$page, &$new) { global $EditMessageFmt; $EditMessageFmt .= GUIButtonCode($pagename); } ## mainpages: ## In 2.0.beta44 several utility pages change location to the new Site ## group. These settings cause some skins (that use translations) ## to know to link to the new locations. if ($Transition['mainpages']) { XLSDV('en', array('Main/SearchWiki' => XL('Site/Search'), 'PmWiki.EditQuickReference' => XL('Site/EditQuickReference'), 'PmWiki.UploadQuickReference' => XL('Site/UploadQuickReference'))); }
'name' => 'author', 'value' => $Author)); SDVA($InputTags['e_changesummary'], array( ':html' => "<input type='text' \$InputFormArgs />", 'name' => 'csum', 'size' => '60', 'maxlength' => '100', 'value' => htmlspecialchars(stripmagic(@$_POST['csum']), ENT_QUOTES))); SDVA($InputTags['e_minorcheckbox'], array( ':html' => "<input type='checkbox' \$InputFormArgs />", 'name' => 'diffclass', 'value' => 'minor')); if (@$_POST['diffclass']=='minor') SDV($InputTags['e_minorcheckbox']['checked'], 'checked'); SDVA($InputTags['e_savebutton'], array( ':html' => "<input type='submit' \$InputFormArgs />", 'name' => 'post', 'value' => ' '.XL('Save').' ', 'accesskey' => XL('ak_save'))); SDVA($InputTags['e_saveeditbutton'], array( ':html' => "<input type='submit' \$InputFormArgs />", 'name' => 'postedit', 'value' => ' '.XL('Save and edit').' ', 'accesskey' => XL('ak_saveedit'))); SDVA($InputTags['e_savedraftbutton'], array(':html' => '')); SDVA($InputTags['e_previewbutton'], array( ':html' => "<input type='submit' \$InputFormArgs />", 'name' => 'preview', 'value' => ' '.XL('Preview').' ', 'accesskey' => XL('ak_preview'))); SDVA($InputTags['e_cancelbutton'], array( ':html' => "<input type='submit' \$InputFormArgs />", 'name' => 'cancel', 'value' => ' '.XL('Cancel').' ' )); SDVA($InputTags['e_resetbutton'], array( ':html' => "<input type='reset' \$InputFormArgs />", 'value' => ' '.XL('Reset').' '));
if (!defined('PmWiki')) { exit; } /* Copyright 2006 Patrick R. Michaud (pmichaud@pobox.com) This file is part of PmWiki; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See pmwiki.php for full details. */ array_unshift($EditFunctions, 'EditDraft'); SDV($DraftSuffix, '-Draft'); if ($DraftSuffix) { SDV($SearchPatterns['normal']['draft'], "!{$DraftSuffix}\$!"); } if ($action == 'edit') { SDVA($InputTags['e_savedraftbutton'], array(':html' => "<input type='submit' \$InputFormArgs />", 'name' => 'postdraft', 'value' => ' ' . XL('Save as draft') . ' ', 'accesskey' => XL('ak_savedraft'))); } function EditDraft(&$pagename, &$page, &$new) { global $WikiDir, $DraftSuffix, $DeleteKeyPattern; SDV($DeleteKeyPattern, "^\\s*delete\\s*\$"); $basename = preg_replace("/{$DraftSuffix}\$/", '', $pagename); $draftname = $basename . $DraftSuffix; if ($_POST['postdraft']) { $pagename = $draftname; return; } if ($_POST['post'] && !preg_match("/{$DeleteKeyPattern}/", $new['text'])) { $pagename = $basename; $page = ReadPage($basename); $WikiDir->delete($draftname);
function HandleUpload($pagename, $auth = 'upload') { global $FmtV,$UploadExtMax, $EnableReadOnly, $HandleUploadFmt,$PageStartFmt,$PageEndFmt,$PageUploadFmt; UploadAuth($pagename, $auth, 1); $FmtV['$UploadName'] = MakeUploadName($pagename,@$_REQUEST['upname']); $upresult = PHSC(@$_REQUEST['upresult']); $uprname = PHSC(@$_REQUEST['uprname']); $FmtV['$upext'] = PHSC(@$_REQUEST['upext']); $FmtV['$upmax'] = PHSC(@$_REQUEST['upmax']); $FmtV['$UploadResult'] = ($upresult) ? FmtPageName("<i>$uprname</i>: $[UL$upresult]",$pagename) : (@$EnableReadOnly ? XL('Cannot modify site -- $EnableReadOnly is set'): ''); SDV($HandleUploadFmt,array(&$PageStartFmt,&$PageUploadFmt,&$PageEndFmt)); PrintFmt($pagename,$HandleUploadFmt); }
$basename = preg_replace("/$DraftSuffix\$/", '', $pagename); ## if no -Draft page, switch to $basename if (!PageExists($pagename) && PageExists($basename)) $pagename = $basename; ## The section below handles specialized EditForm pages and handler. ## We don't bother to load it if we're not editing. SDV($DraftActionsPattern, 'edit'); if (! preg_match("/($DraftActionsPattern)/", $action)) return; ## set edit form button labels to reflect draft prompts SDVA($InputTags['e_savebutton'], array('value' => ' '.XL('Publish').' ')); SDVA($InputTags['e_saveeditbutton'], array('value' => ' '.XL('Save draft and edit').' ')); SDVA($InputTags['e_savedraftbutton'], array( ':html' => "<input type='submit' \$InputFormArgs />", 'name' => 'postdraft', 'value' => ' '.XL('Save draft').' ', 'accesskey' => XL('ak_savedraft'))); ## with drafts enabled, the 'post' operation requires 'publish' permissions if ($_POST['post'] && $HandleAuth['edit'] == 'edit') $HandleAuth['edit'] = 'publish'; ## disable the 'publish' button if not authorized to publish if (!CondAuth($basename, 'publish')) SDVA($InputTags['e_savebutton'], array('disabled' => 'disabled')); ## add the draft handler into $EditFunctions array_unshift($EditFunctions, 'EditDraft'); function EditDraft(&$pagename, &$page, &$new) { global $WikiDir, $DraftSuffix, $DeleteKeyPattern, $EnableDraftAtomicDiff, $DraftRecentChangesFmt, $RecentChangesFmt, $Now; SDV($DeleteKeyPattern, "^\\s*delete\\s*$");
function bi_JXL() { #create javascript array holding all XL translations of text used client-side $a = array('Are you sure you want to delete?', 'Yes', 'No', 'approve', 'unapprove', 'Unapproved Comments:', 'Commenter IP: ', 'Enter the IP to block:', 'Submit', 'Post', 'Cancel', 'Either enter a Blog Title or a Pagename.', 'You have unsaved changes.', 'Website:', 'Parsing JSON request failed.', 'Request timeout.', 'Error: '); foreach ($a as $k) { $t .= $k != XL($k) ? 'BlogIt.xl["' . $k . '"]="' . XL($k) . "\";\n" : ''; } $a = array('require' => 'This field is required.', 'date' => 'This field must be formatted as a date.', 'email' => 'This field must be formatted as an email.', 'url' => 'This field must be formatted as a URL.'); foreach ($a as $k => $v) { $t1 .= $v != XL($v) ? $k . ':"' . XL($v) . "\",\n" : ''; } return $t1 > '' ? $t . 'jQuery.extend(jQuery.validity.messages, {' . substr($t1, 0, -2) . '});' : $t; }
function BlockUnapprovedPosts($pagename, &$page, &$new) { global $EnableUrlApprovalRequired, $UnapprovedLinkCount, $UnapprovedLinkCountMax, $EnablePost, $MessagesFmt, $BlockMessageFmt; if (!IsEnabled($EnableUrlApprovalRequired, 1)) { return; } if ($UnapprovedLinkCount <= $UnapprovedLinkCountMax) { return; } if ($page['=auth']['admin']) { return; } $EnablePost = 0; $MessagesFmt[] = $BlockMessageFmt; $MessagesFmt[] = XL('Too many unapproved external links.'); }
function bi_JXL() { //create javascript array holding all XL translations of text used client-side $a = array('Are you sure you want to delete?', 'Yes', 'No', 'approve', 'unapprove', 'Unapproved Comments:', 'Enter the IP to block:', 'Submit', 'Post', 'Cancel', 'Either enter a Blog Title or a Pagename.', 'You have unsaved changes.', 'Website:', 'Parsing JSON request failed.', 'Request timeout.', 'Error: ', 'No data returned.', 'Must be a datetime (dd-mm-yyyy hh:mm).', 'Please enter a valid email address.', 'Please enter a valid URL.', 'Error on edit return.'); foreach ($a as $k) { $t .= $k != XL($k) ? 'BlogIt.xl["' . $k . '"]="' . XL($k) . "\";\n" : ''; } return $t; }
a general regex processor for extracting text from multiple pages using regular expressions and wildcard pagename patterns. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Syntax: {(extract Term1 [Term3] [-Term3] ... [group=GroupName] [name=PageName] [keyword=value] ...)} See Cookbook:TextExtract for documentation and instructions. */ $RecipeInfo['TextExtract']['Version'] = '2009-10-15a'; // defaults for extractor search form SDVA($ExtractFormOpt, array('size' => '30', 'button' => FmtPageName(' $[Search] ', $pagename), 'searchlabel' => FmtPageName('$[Search for]', $pagename), 'pageslabel' => FmtPageName('$[On pages]', $pagename), 'wordlabel' => FmtPageName('$[Match whole word]', $pagename), 'caselabel' => FmtPageName('$[Match case]', $pagename), 'regexlabel' => FmtPageName('$[Regular expression]', $pagename), 'header' => 'full', 'phead' => 'link')); // defaults array SDVA($TextExtractOpt, array('markup' => 'cut', 'unit' => 'para', 'highlight' => 'yellow', 'linenum-color' => 'green', 'matchnum-color' => 'green', 'pagenum-color' => 'green', 'title' => XL('Text Extract'), 'linewrap' => 1, 'case' => 0, 'regex' => 0, 'error' => 1, 'linktext' => 'blue', 'lwords' => 5, 'rwords' => 10, 'ellipsis' => '…')); //defaults for specific markup modes: SDV($TEModeDefaults['text']['shorten'], 1); SDV($TEModeDefaults['text']['textlinks'], 1); #SDV($TEModeDefaults['cut']['shorten'], 1); // main function for text extract processing function TextExtract($pagename, $list, $opt = NULL) { global $TextExtractOpt, $TEModeDefaults, $TextExtract, $TextExtractExclude, $FmtV, $HTMLStylesFmt, $KeepToken, $KPV, $PageListArgPattern; ##DEBUG echo "<pre>LIST "; print_r($list); echo "</pre>"; foreach ($opt as $k => $v) { if (is_array($v)) { foreach ($v as $kk => $vv) { $opt[$k][$kk] = stripmagic($vv); } } else {