Back button to go back to the edit page."), _("Copy your changes to the clipboard or to another temporary place (e.g. text editor)."), _("Reload the page. You should now see the most current version of the page. Your changes are no longer there."), _("Make changes to the file again. Paste your additions from the clipboard (or text editor)."), _("Press Save again.")); $html[] = HTML::p(_("PhpWiki is unable to save your changes, because another user edited and saved the page while you were editing the page too. If saving proceeded now changes from the previous author would be lost.")); $html[] = HTML::p(_("In order to recover from this situation follow these steps:")); $steps = HTML::ol(); foreach ($steps as $step) $steps->pushContent(HTML::li($step)); $html[] = $steps; $html[] = HTML::p(_("Sorry for the inconvenience.")); echo GeneratePage('MESSAGE', $html, sprintf(_("Problem while updating %s"), $request->getArg('pagename'))); $request->finish(); } function PageIsLocked (&$request) { $html[] = HTML::p(_("This page has been locked by the administrator so your changes could not be saved.")); $html[] = HTML::p(_("Use your browser's Back button to go back to the edit page."), ' ', _("Copy your changes to the clipboard. You can try editing a different page or save your text in a text editor.")); $html[] = HTML::p(_("Sorry for the inconvenience.")); echo GeneratePage('MESSAGE', $html, sprintf (_("Problem while editing %s"), $request->getArg('pagename'))); $request->finish(); } function BadFormVars (&$request) { $html[] = HTML::p(_("Bad form submission")); $html[] = HTML::p(_("Required form variables are missing.")); echo GeneratePage('MESSAGE', $html, sprintf(_("Edit aborted: %s"), $request->getArg('pagename'))); $request->finish(); } function savePage (&$request) { global $Theme; if (! $request->isPost()) BadFormVars($request); if ($request->getArg('preview') || !$request->getArg('save')) { include_once('lib/editpage.php'); return editPage($request, 'do_preview'); } $pagename = $request->getArg('pagename'); $version = $request->getArg('version'); $page = $request->getPage(); $current = $page->getCurrentRevision(); $content = $request->getArg('content'); $editversion = $request->getArg('editversion'); if ( $content === false || $editversion === false ) BadFormVars($request); // noreturn $user = $request->getUser(); if ($page->get('locked') && !$user->isAdmin()) PageIsLocked($request); // noreturn. $meta['author'] = $user->getId(); $meta['author_id'] = $user->getAuthenticatedId(); $meta['is_minor_edit'] = (bool) $request->getArg('minor_edit'); $meta['summary'] = trim($request->getArg('summary')); $content = preg_replace('/[ \t\r]+\n/', "\n", chop($content)); if ($request->getArg('convert')) $content = CookSpaces($content); if ($content == $current->getPackedContent()) { // Save failed. No changes made. include_once('lib/display.php'); // force browse of current version: $request->setArg('version', false); return displayPage($request, 'nochanges'); } //////////////////////////////////////////////////////////////// // // From here on, we're actually saving. // $newrevision = $page->createRevision($editversion + 1, $content, $meta, ExtractWikiPageLinks($content)); if (!is_object($newrevision)) { // Save failed. (Concurrent updates). // FIXME: this should return one to the editing form, // (with an explanatory message, and options to // view diffs & merge...) ConcurrentUpdates($request); } // New contents successfully saved... // Clean out archived versions of this page. $cleaner = new ArchiveCleaner($GLOBALS['ExpireParams']); $cleaner->cleanPageRevisions($page); $dbi = $request->getDbh(); $warnings = $dbi->GenericWarnings(); if (empty($warnings) && ! $Theme->getImageURL('signature')) { // Do redirect to browse page if no signature has // been defined. In this case, the user will most // likely not see the rest of the HTML we generate // (below). $request->redirect(WikiURL($pagename, false, 'absolute_url')); } // Force browse of current page version. $request->setArg('version', false); $wrapper = new WikiTemplate('top'); $wrapper->qreplace('TITLE', sprintf(_("Saved: %s"), $pagename)); $wrapper->replace('HEADER', fmt("Saved: %s", $Theme->linkExistingWikiWord($pagename))); $wrapper->setPageRevisionTokens($newrevision); $template = new WikiTemplate('savepage'); if (!empty($warnings)) $template->qreplace('WARNINGS', $warnings); $template->replace('CONTENT', do_transform($newrevision->getContent())); $wrapper->printExpansion($template); } // Local Variables: // mode: php // tab-width: 8 // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: ?>