function MergeSimulEdits($pagename,&$page,&$new) { global $Now, $EnablePost, $MessagesFmt, $WorkDir; if (@!$_POST['basetime'] || !PageExists($pagename) || $page['time'] >= $Now || $_POST['basetime']>=$page['time'] || $page['text'] == $new['text']) return; $EnablePost = 0; $old = array(); RestorePage($pagename,$page,$old,"diff:{$_POST['basetime']}"); $text = Merge($new['text'],$old['text'],$page['text']); if ($text > '') { $new['text'] = $text; $ec = '$[EditConflict]'; } else $ec = '$[EditWarning]'; XLSDV('en', array( 'EditConflict' => "The page you are editing has been modified since you started editing it. The modifications have been merged into the text below, you may want to verify the results of the merge before pressing save. Conflicts the system couldn't resolve are bracketed by <<<<<<< and >>>>>>>.", 'EditWarning' => "The page you are editing has been modified since you started editing it. If you continue, your changes will overwrite any changes that others have made.")); $MessagesFmt[] = "<p class='editconflict'>$ec (<a target='_blank' href='\$PageUrl?action=diff'>$[View changes]</a>) </p>\n"; }
function MergeSimulEdits($pagename, &$page, &$new) { global $Now, $EnablePost, $MessagesFmt, $WorkDir, $SysMergeCmd; SDV($SysMergeCmd, "/usr/bin/diff3 -L '' -L '' -L '' -m -E"); if (@(!$_POST['basetime']) || !PageExists($pagename) || $page['time'] >= $Now || $_POST['basetime'] >= $page['time'] || $page['text'] == $new['text']) { return; } $EnablePost = 0; XLSDV('en', array('EditConflict' => "The page you are\n editing has been modified since you started editing it.\n The modifications have been merged into the text below, \n you may want to verify the results of the merge before\n pressing save. Conflicts the system couldn't resolve are\n bracketed by <<<<<<< and\n >>>>>>>.")); $MessagesFmt[] = "<p class='editconflict'>\$[EditConflict]\n (<a target='_blank' href='\$PageUrl?action=diff'>\$[View changes]</a>)\n </p>\n"; $old = array(); RestorePage($pagename, $page, $old, "diff:{$_POST['basetime']}"); $new['text'] = Merge($new['text'], $old['text'], $page['text']); }
<input type='hidden' name='n' value='{\$FullName}' /> <input type='hidden' name='action' value='postupload' /> <table border='0'> <tr><td align='right'>$[File to upload:]</td><td><input name='uploadfile' type='file' /></td></tr> <tr><td align='right'>$[Name attachment as:]</td> <td><input type='text' name='upname' value='\$UploadName' /><input type='submit' value=' $[Upload] ' /><br /> </td></tr></table></form></div>", 'wiki:$[{$SiteGroup}/UploadQuickReference]')); XLSDV('en',array( 'ULsuccess' => 'successfully uploaded', 'ULbadname' => 'invalid attachment name', 'ULbadtype' => '\'$upext\' is not an allowed file extension', 'ULtoobig' => 'file is larger than maximum allowed by webserver', 'ULtoobigext' => 'file is larger than allowed maximum of $upmax bytes for \'$upext\' files', 'ULpartial' => 'incomplete file received', 'ULnofile' => 'no file uploaded', 'ULexists' => 'file with that name already exists', 'ULpquota' => 'group quota exceeded', 'ULtquota' => 'upload quota exceeded')); SDV($PageAttributes['passwdupload'],'$[Set new upload password:]'); SDV($DefaultPasswords['upload'],'*'); SDV($AuthCascade['upload'], 'read'); SDV($FmtPV['$PasswdUpload'], 'PasswdVar($pn, "upload")'); Markup('attachlist', 'directives', '/\\(:attachlist\\s*(.*?):\\)/ei', "Keep('<ul>'.FmtUploadList('$pagename',PSS('$1')).'</ul>')"); SDV($GUIButtons['attach'], array(220, 'Attach:', '', '$[file.ext]', '$GUIButtonDirUrlFmt/attach.gif"$[Attach file]"'));
to FmtPageList. FmtPageList then returns the output to the caller, and calls Keep() (preserves HTML) or PRR() (re-evaluate as markup) as appropriate for the output being returned. */ ## $LinkIndexFile is the index file for backlinks and link= option if (IsEnabled($EnableLinkIndex, 1)) { SDV($LinkIndexFile, "{$WorkDir}/.linkindex"); $EditFunctions[] = 'PostLinkIndex'; } ## $SearchPatterns holds patterns for list= option SDVA($SearchPatterns['all'], array()); $SearchPatterns['normal'][] = '!\\.(All)?Recent(Changes|Uploads)$!'; $SearchPatterns['normal'][] = '!\\.Group(Print)?(Header|Footer|Attributes)$!'; SDV($SearchResultsFmt, "<div class='wikisearch'>\$[SearchFor]\n {$HTMLVSpace}\$MatchList\n {$HTMLVSpace}\$[SearchFound]{$HTMLVSpace}</div>"); SDV($SearchQuery, str_replace('$', '$', htmlspecialchars(stripmagic(@$_REQUEST['q']), ENT_NOQUOTES))); XLSDV('en', array('SearchFor' => 'Results of search for <em>$Needle</em>:', 'SearchFound' => '$MatchCount pages found out of $MatchSearched pages searched.')); Markup('pagelist', 'directives', '/\\(:pagelist(\\s+.*?)?:\\)/ei', "FmtPageList('\$MatchList', \$pagename, array('o' => PSS('\$1 ')))"); Markup('searchresults', 'directives', '/\\(:searchresults(\\s+.*?)?:\\)/ei', "FmtPageList(\$GLOBALS['SearchResultsFmt'], \$pagename,\n array('o' => PSS('\$1'), 'req' => 1))"); Markup('searchbox', '>links', '/\\(:searchbox(\\s.*?)?:\\)/e', "SearchBox(\$pagename, ParseArgs(PSS('\$1')))"); SDV($HandleActions['search'], 'HandleSearchA'); SDV($HandleAuth['search'], 'read'); ## SearchBox generates the output of the (:searchbox:) markup. ## If $SearchBoxFmt is defined, that is used, otherwise a searchbox ## is generated. Options include group=, size=, label=. function SearchBox($pagename, $opt) { global $SearchBoxFmt, $SearchBoxOpt, $SearchQuery, $EnablePathInfo; if (isset($SearchBoxFmt)) { return FmtPageName($SearchBoxFmt, $pagename); } SDVA($SearchBoxOpt, array('size' => '40', 'label' => FmtPageName('$[Search]', $pagename), 'group' => @$_REQUEST['group'], 'value' => $SearchQuery));
function HandleAttr($pagename, $auth = 'attr') { global $PageAttrFmt,$PageStartFmt,$PageEndFmt; $page = RetrieveAuthPage($pagename, $auth, true, READPAGE_CURRENT); if (!$page) { Abort("?unable to read $pagename"); } PCache($pagename,$page); XLSDV('en', array('EnterAttributes' => "Enter new attributes for this page below. Leaving a field blank will leave the attribute unchanged. To clear an attribute, enter 'clear'.")); SDV($PageAttrFmt,"<div class='wikiattr'> <h2 class='wikiaction'>$[{\$FullName} Attributes]</h2> <p>$[EnterAttributes]</p></div>"); SDV($HandleAttrFmt,array(&$PageStartFmt,&$PageAttrFmt, 'function:PrintAttrForm',&$PageEndFmt)); PrintFmt($pagename,$HandleAttrFmt); }
function XLPage($lang, $p) { global $TimeFmt, $XLLangs, $FarmD; $page = ReadPage($p); if (!$page) { return; } $text = preg_replace("/=>\\s*\n/", '=> ', @$page['text']); foreach (explode("\n", $text) as $l) { if (preg_match('/^\\s*[\'"](.+?)[\'"]\\s*=>\\s*[\'"](.+)[\'"]/', $l, $match)) { $xl[stripslashes($match[1])] = stripslashes($match[2]); } } if (isset($xl)) { if (@$xl['xlpage-i18n']) { $i18n = preg_replace('/[^-\\w]/', '', $xl['xlpage-i18n']); include_once "{$FarmD}/scripts/xlpage-{$i18n}.php"; } if ($xl['Locale']) { setlocale(LC_ALL, $xl['Locale']); } if ($xl['TimeFmt']) { $TimeFmt = $xl['TimeFmt']; } array_unshift($XLLangs, $lang); XLSDV($lang, $xl); } }
## Form-based authorization prompts (for use with PmWikiAuth) SDVA($InputTags['auth_form'], array(':html' => "<form action='{$_SERVER['REQUEST_URI']}' method='post' \n name='authform'>\$PostVars")); SDV($AuthPromptFmt, array(&$PageStartFmt, 'page:$SiteGroup.AuthForm', "<script language='javascript' type='text/javascript'><!--\n try { document.authform.authid.focus(); }\n catch(e) { document.authform.authpw.focus(); } //--></script>", &$PageEndFmt)); ## The section below handles specialized EditForm pages. ## We don't bother to load it if we're not editing. 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')));
<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'), )); }
(at your option) any later version. See pmwiki.php for full details. This script handles per-browser preferences. Preference settings are stored in wiki pages as XLPage translations, and a cookie on the browser tells PmWiki where to find the browser's preferred settings. This script looks for a ?setprefs= request parameter (e.g., in a url); when it finds one it sets a 'setprefs' cookie on the browser identifying the page to be used to load browser preferences, and loads the associated preferences. If there is no ?setprefs= request, then the script uses the 'setprefs' cookie from the browser to load the preference settings. */ SDV($PrefsCookie, $CookiePrefix . 'setprefs'); SDV($PrefsCookieExpires, $Now + 60 * 60 * 24 * 365); $LogoutCookies[] = $PrefsCookie; $sp = ''; if (@$_COOKIE[$PrefsCookie]) { $sp = $_COOKIE[$PrefsCookie]; } if (isset($_GET['setprefs'])) { $sp = $_GET['setprefs']; setcookie($PrefsCookie, $sp, $PrefsCookieExpires, '/'); } if ($sp && PageExists($sp)) { XLPage('prefs', $sp); } XLSDV('en', array('ak_view' => '', 'ak_edit' => 'e', 'ak_history' => 'h', 'ak_print' => '', 'ak_recentchanges' => 'c', 'ak_save' => 's', 'ak_saveedit' => 'u', 'ak_savedraft' => 'd', 'ak_preview' => 'p', 'ak_em' => '', 'ak_strong' => ''));
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. This script handles per-browser preferences. Preference settings are stored in wiki pages as XLPage translations, and a cookie on the browser tells PmWiki where to find the browser's preferred settings. This script looks for a ?setprefs= request parameter (e.g., in a url); when it finds one it sets a 'setprefs' cookie on the browser identifying the page to be used to load browser preferences, and loads the associated preferences. If there is no ?setprefs= request, then the script uses the 'setprefs' cookie from the browser to load the preference settings. */ SDV($PrefsCookieExpires, $Now + 60 * 60 * 24 * 365); if (@$_COOKIE['setprefs']) { $sp = $_COOKIE['setprefs']; } if (isset($_GET['setprefs'])) { $sp = $_GET['setprefs']; setcookie('setprefs', $sp, $PrefsCookieExpires, '/'); } if (PageExists($sp)) { XLPage('prefs', $sp); } XLSDV('en', array('ak_edit' => 'e', 'ak_history' => 'h', 'ak_recentchanges' => 'c', 'ak_save' => 's', 'ak_saveedit' => 'u', 'ak_preview' => 'p'));
XLSDV('fr', array('Striked Text' => 'Texte barré')); XLSDV('fr', array('Heading level 1' => 'Entête niveau 1')); XLSDV('fr', array('Heading level 2' => 'Entête niveau 2')); XLSDV('fr', array('Heading level 3' => 'Entête niveau 3')); XLSDV('fr', array('Heading level 4' => 'Entête niveau 4')); XLSDV('fr', array('WikiPage | link description text' => 'PageWiki | description du lien')); XLSDV('fr', array('link description text http://' => 'description du lien http://')); XLSDV('fr', array(':: Link to external page' => ':: Lien vers une page extérieure')); XLSDV('fr', array(':: Link to a page in this wiki' => ':: Lien vers une page dans ce wiki')); XLSDV('fr', array(':: Unordered (bullet) list' => ':: Liste non ordonnée (puces)')); XLSDV('fr', array(':: Ordered (numbered) list' => ':: Liste ordonnée (numérotée)')); XLSDV('fr', array(':: Separator line' => ':: Ligne séparatrice')); XLSDV('fr', array(':: Comment (wont be interpreted)' => ':: Commentaire (ne sera pas interprété)')); XLSDV('fr', array(':: Preformated Code' => ':: Code préformatté')); XLSDV('fr', array(':: Insert <CurrentTime>' => ':: Insérer date et heure')); XLSDV('fr', array(':: Attach File' => ':: Attacher un fichier')); // TODO verbatim zone // Buttons to be hidden $GUIButtons['big'] = array(); $GUIButtons['small'] = array(); $GUIButtons['pagelink'] = array(); /*$GUIButtons['extlink'] = array();*/ /*$GUIButtons['attach'] = array();*/ $GUIButtons['sup'] = array(); $GUIButtons['sub'] = array(); $GUIButtons['center'] = array(); // // Basic formatting // RAW (markup, won't be interpreted. It should be double ' but it will interfere with the reste of the pmwiki syntax, so we use double " instead) Markup('txt2tags_markup_raw', '<_begin', '/""(.*?)""/', '[= $1 =]'); // Comments