当前位置: 首页>>代码示例>>PHP>>正文


PHP GeneratePage函数代码示例

本文整理汇总了PHP中GeneratePage函数的典型用法代码示例。如果您正苦于以下问题:PHP GeneratePage函数的具体用法?PHP GeneratePage怎么用?PHP GeneratePage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GeneratePage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PurgePage

function PurgePage(&$request)
{
    global $WikiTheme;
    $page = $request->getPage();
    $pagelink = WikiLink($page);
    if ($request->getArg('cancel')) {
        $request->redirect(WikiURL($page));
        // noreturn
    }
    $current = $page->getCurrentRevision();
    if (!$current or !($version = $current->getVersion())) {
        $html = HTML::p(array('class' => 'error'), _("Sorry, this page does not exist."));
    } elseif (!$request->isPost() || !$request->getArg('verify')) {
        $purgeB = Button('submit:verify', _("Purge Page"), 'wikiadmin');
        $cancelB = Button('submit:cancel', _("Cancel"), 'button');
        // use generic wiki button look
        $fieldset = HTML::fieldset(HTML::p(fmt("You are about to purge '%s'!", $pagelink)), HTML::form(array('method' => 'post', 'action' => $request->getPostURL()), HiddenInputs(array('currentversion' => $version, 'pagename' => $page->getName(), 'action' => 'purge')), HTML::div(array('class' => 'toolbar'), $purgeB, $WikiTheme->getButtonSeparator(), $cancelB)));
        $sample = HTML::div(array('class' => 'transclusion'));
        // simple and fast preview expanding only newlines
        foreach (explode("\n", firstNWordsOfContent(100, $current->getPackedContent())) as $s) {
            $sample->pushContent($s, HTML::br());
        }
        $html = HTML($fieldset, HTML::div(array('class' => 'wikitext'), $sample));
    } elseif ($request->getArg('currentversion') != $version) {
        $html = HTML(HTML::p(array('class' => 'error'), _("Someone has edited the page!")), HTML::p(fmt("Since you started the purge process, someone has saved a new version of %s.  Please check to make sure you still want to permanently purge the page from the database.", $pagelink)));
    } else {
        // Real purge.
        $pagename = $page->getName();
        $dbi = $request->getDbh();
        $dbi->purgePage($pagename);
        $dbi->touch();
        $html = HTML::div(array('class' => 'feedback'), fmt("Purged page '%s' successfully.", $pagename));
    }
    GeneratePage($html, _("Purge Page"));
}
开发者ID:hugcoday,项目名称:wiki,代码行数:35,代码来源:purgepage.php

示例2: actionPage

function actionPage(&$request, $action)
{
    global $WikiTheme;
    $pagename = $request->getArg('pagename');
    $version = $request->getArg('version');
    $page = $request->getPage();
    $revision = $page->getCurrentRevision();
    $dbi = $request->getDbh();
    $actionpage = $dbi->getPage($action);
    $actionrev = $actionpage->getCurrentRevision();
    $pagetitle = HTML(fmt("%s: %s", $actionpage->getName(), $WikiTheme->linkExistingWikiWord($pagename, false, $version)));
    $validators = new HTTP_ValidatorSet(array('pageversion' => $revision->getVersion(), '%mtime' => $revision->get('mtime')));
    $request->appendValidators(array('pagerev' => $revision->getVersion(), '%mtime' => $revision->get('mtime')));
    $request->appendValidators(array('actionpagerev' => $actionrev->getVersion(), '%mtime' => $actionrev->get('mtime')));
    $transformedContent = $actionrev->getTransformedContent();
    $template = Template('browse', array('CONTENT' => $transformedContent));
    /*
        if (!headers_sent()) {
            //FIXME: does not work yet. document.write not supported (signout button)
            // http://www.w3.org/People/mimasa/test/xhtml/media-types/results
            if (ENABLE_XHTML_XML 
                and (!isBrowserIE() and
                     strstr($request->get('HTTP_ACCEPT'),'application/xhtml+xml')))
                header("Content-Type: application/xhtml+xml; charset=" . $GLOBALS['charset']);
            else
                header("Content-Type: text/html; charset=" . $GLOBALS['charset']);
        }
    */
    GeneratePage($template, $pagetitle, $revision);
    $request->checkValidators();
    flush();
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:32,代码来源:display.php

示例3: RemovePage

function RemovePage(&$request)
{
    global $WikiTheme;
    $page = $request->getPage();
    $pagelink = WikiLink($page);
    if ($request->getArg('cancel')) {
        $request->redirect(WikiURL($page));
        // noreturn
    }
    $current = $page->getCurrentRevision();
    if (!$current or !($version = $current->getVersion())) {
        $html = HTML(HTML::h2(_("Already deleted")), HTML::p(_("Sorry, this page is not in the database.")));
    } elseif (!$request->isPost() || !$request->getArg('verify')) {
        $removeB = Button('submit:verify', _("Remove Page"), 'wikiadmin');
        $cancelB = Button('submit:cancel', _("Cancel"), 'button');
        // use generic wiki button look
        $html = HTML(HTML::h2(fmt("You are about to remove '%s'!", $pagelink)), HTML::form(array('method' => 'post', 'action' => $request->getPostURL()), HiddenInputs(array('currentversion' => $version, 'pagename' => $page->getName(), 'action' => 'remove')), HTML::div(array('class' => 'toolbar'), $removeB, $WikiTheme->getButtonSeparator(), $cancelB)), HTML::hr());
        $sample = HTML::div(array('class' => 'transclusion'));
        // simple and fast preview expanding only newlines
        foreach (explode("\n", firstNWordsOfContent(100, $current->getPackedContent())) as $s) {
            $sample->pushContent($s, HTML::br());
        }
        $html->pushContent(HTML::div(array('class' => 'wikitext'), $sample));
    } elseif ($request->getArg('currentversion') != $version) {
        $html = HTML(HTML::h2(_("Someone has edited the page!")), HTML::p(fmt("Since you started the deletion process, someone has saved a new version of %s.  Please check to make sure you still want to permanently remove the page from the database.", $pagelink)));
    } else {
        // Codendi specific: remove the deleted wiki page from ProjectWantedPages
        $projectPageName = 'ProjectWantedPages';
        $pagename = $page->getName();
        $dbi = $request->getDbh();
        require_once PHPWIKI_DIR . "/lib/loadsave.php";
        $pagehandle = $dbi->getPage($projectPageName);
        if ($pagehandle->exists()) {
            // don't replace default contents
            $current = $pagehandle->getCurrentRevision();
            $version = $current->getVersion();
            $text = $current->getPackedContent();
            $meta = $current->_data;
        }
        $text = str_replace("* [{$pagename}]", "", $text);
        $meta['summary'] = $GLOBALS['Language']->getText('wiki_lib_wikipagewrap', 'page_added', array($pagename));
        $meta['author'] = user_getname();
        $pagehandle->save($text, $version + 1, $meta);
        //Codendi specific: remove permissions for this page @codenditodo: may be transferable otherwhere.
        require_once 'common/wiki/lib/WikiPage.class.php';
        $wiki_page = new WikiPage(GROUP_ID, $_REQUEST['pagename']);
        $wiki_page->resetPermissions();
        // Real delete.
        //$pagename = $page->getName();
        $dbi = $request->getDbh();
        $dbi->deletePage($pagename);
        $dbi->touch();
        $link = HTML::a(array('href' => 'javascript:history.go(-2)'), _("Back to the previous page."));
        $html = HTML(HTML::h2(fmt("Removed page '%s' successfully.", $pagename)), HTML::div($link), HTML::hr());
    }
    GeneratePage($html, _("Remove Page"));
}
开发者ID:nterray,项目名称:tuleap,代码行数:57,代码来源:removepage.php

示例4: savePage

 function savePage()
 {
     $request =& $this->request;
     if ($this->isUnchanged()) {
         // Allow admin lock/unlock even if
         // no text changes were made.
         if ($this->updateLock()) {
             $dbi = $request->getDbh();
             $dbi->touch();
         }
         // Save failed. No changes made.
         $this->_redirectToBrowsePage();
         // user will probably not see the rest of this...
         include_once 'lib/display.php';
         // force browse of current version:
         $request->setArg('version', false);
         displayPage($request, 'nochanges');
         return true;
     }
     if (!$this->user->isAdmin() and $this->isSpam()) {
         $this->_isSpam = true;
         return false;
         /*
         // Save failed. No changes made.
         $this->_redirectToBrowsePage();
         // user will probably not see the rest of this...
         include_once('lib/display.php');
         // force browse of current version:
         $request->setArg('version', false);
         displayPage($request, 'nochanges');
         return true;
         */
     }
     $page =& $this->page;
     // Include any meta-data from original page version which
     // has not been explicitly updated.
     // (Except don't propagate pgsrc_version --- moot for now,
     //  because at present it never gets into the db...)
     $meta = $this->selected->getMetaData();
     unset($meta['pgsrc_version']);
     $meta = array_merge($meta, $this->meta);
     // Save new revision
     $this->_content = $this->getContent();
     $newrevision = $page->save($this->_content, $this->version == -1 ? -1 : $this->_currentVersion + 1, $meta);
     if (!isa($newrevision, 'WikiDB_PageRevision')) {
         // Save failed.  (Concurrent updates).
         return false;
     } else {
         // Save succeded. We store cross references (if there are).
         $reference_manager =& ReferenceManager::instance();
         $reference_manager->extractCrossRef($this->_content, $page->getName(), ReferenceManager::REFERENCE_NATURE_WIKIPAGE, GROUP_ID);
         // Save succeded. We raise an event.
         $new = $this->version + 1;
         $difflink = WikiURL($page->getName(), array('action' => 'diff'), true);
         $difflink .= "&versions%5b%5d=" . $this->version . "&versions%5b%5d=" . $new;
         $eM =& EventManager::instance();
         $uM =& UserManager::instance();
         $user =& $uM->getCurrentUser();
         $eM->processEvent("wiki_page_updated", array('group_id' => GROUP_ID, 'wiki_page' => $page->getName(), 'diff_link' => $difflink, 'user' => $user, 'version' => $this->version));
     }
     // New contents successfully saved...
     $this->updateLock();
     // Clean out archived versions of this page.
     include_once 'lib/ArchiveCleaner.php';
     $cleaner = new ArchiveCleaner($GLOBALS['ExpireParams']);
     $cleaner->cleanPageRevisions($page);
     /* generate notification emails done in WikiDB::save to catch 
        all direct calls (admin plugins) */
     // look at the errorstack
     $errors = $GLOBALS['ErrorManager']->_postponed_errors;
     $warnings = $GLOBALS['ErrorManager']->getPostponedErrorsAsHTML();
     $GLOBALS['ErrorManager']->_postponed_errors = $errors;
     $dbi = $request->getDbh();
     $dbi->touch();
     global $WikiTheme;
     if (empty($warnings->_content) && !$WikiTheme->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).
         $this->_redirectToBrowsePage();
     }
     // Force browse of current page version.
     $request->setArg('version', false);
     //$request->setArg('action', false);
     $template = Template('savepage', $this->tokens);
     $template->replace('CONTENT', $newrevision->getTransformedContent());
     if (!empty($warnings->_content)) {
         $template->replace('WARNINGS', $warnings);
     }
     $pagelink = WikiLink($page);
     GeneratePage($template, fmt("Saved: %s", $pagelink), $newrevision);
     return true;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:94,代码来源:editpage.php

示例5: trim

}
$full = trim($full);
$html = "<P><B>" . sprintf(gettext("Searching for \"%s\" ....."), htmlspecialchars($full)) . "</B></P>\n<DL>\n";
$found = 0;
$count = 0;
if (strlen($full)) {
    // search matching pages
    $query = InitFullSearch($dbi, $full);
    // quote regexp chars (space are treated as "or" operator)
    $full = preg_replace("/\\s+/", "|", preg_quote($full));
    while ($pagehash = FullSearchNextMatch($dbi, $query)) {
        $html .= "<DT><B>" . LinkExistingWikiWord($pagehash["pagename"]) . "</B>\n";
        $count++;
        // print out all matching lines, highlighting the match
        for ($j = 0; $j < count($pagehash["content"]); $j++) {
            if ($hits = preg_match_all(":{$full}:i", $pagehash["content"][$j], $dummy)) {
                $matched = preg_replace(":{$full}:i", "{$FieldSeparator}OT\\0{$FieldSeparator}CT", $pagehash["content"][$j]);
                $matched = htmlspecialchars($matched);
                $matched = str_replace("{$FieldSeparator}OT", '<b>', $matched);
                $matched = str_replace("{$FieldSeparator}CT", '</b>', $matched);
                $html .= "<dd><small>{$matched}</small></dd>\n";
                $found += $hits;
            }
        }
    }
} else {
    $html .= "<dd>" . gettext("(You entered an empty search string)") . "</dd>\n";
}
$html .= "</dl>\n<hr noshade>" . sprintf(gettext("%d matches found in %d pages."), $found, $count) . "\n";
GeneratePage('MESSAGE', $html, gettext("Full Text Search Results"), 0);
开发者ID:BackupTheBerlios,项目名称:oralux,代码行数:30,代码来源:fullsearch.php

示例6: showDiff

function showDiff(&$request)
{
    $pagename = $request->getArg('pagename');
    if (is_array($versions = $request->getArg('versions'))) {
        // Version selection from pageinfo.php display:
        rsort($versions);
        list($version, $previous) = $versions;
    } else {
        $version = $request->getArg('version');
        $previous = $request->getArg('previous');
    }
    // abort if page doesn't exist
    $dbi = $request->getDbh();
    $page = $request->getPage();
    $current = $page->getCurrentRevision();
    if ($current->getVersion() < 1) {
        $html = HTML::div(array('id' => 'content'), HTML::p(fmt("I'm sorry, there is no such page as %s.", WikiLink($pagename, 'unknown'))));
        include_once 'lib/Template.php';
        GeneratePage($html, sprintf(_("Diff: %s"), $pagename), false);
        return;
        //early return
    }
    if ($version) {
        if (!($new = $page->getRevision($version))) {
            NoSuchRevision($request, $page, $version);
        }
        $new_version = fmt("version %d", $version);
    } else {
        $new = $current;
        $new_version = _("current version");
    }
    if (preg_match('/^\\d+$/', $previous)) {
        if (!($old = $page->getRevision($previous))) {
            NoSuchRevision($request, $page, $previous);
        }
        $old_version = fmt("version %d", $previous);
        $others = array('major', 'minor', 'author');
    } else {
        switch ($previous) {
            case 'author':
                $old = $new;
                while ($old = $page->getRevisionBefore($old)) {
                    if ($old->get('author') != $new->get('author')) {
                        break;
                    }
                }
                $old_version = _("revision by previous author");
                $others = array('major', 'minor');
                break;
            case 'minor':
                $previous = 'minor';
                $old = $page->getRevisionBefore($new);
                $old_version = _("previous revision");
                $others = array('major', 'author');
                break;
            case 'major':
            default:
                $old = $new;
                while ($old && $old->get('is_minor_edit')) {
                    $old = $page->getRevisionBefore($old);
                }
                if ($old) {
                    $old = $page->getRevisionBefore($old);
                }
                $old_version = _("predecessor to the previous major change");
                $others = array('minor', 'author');
                break;
        }
    }
    $new_link = WikiLink($new, '', $new_version);
    $old_link = $old ? WikiLink($old, '', $old_version) : $old_version;
    $page_link = WikiLink($page);
    $html = HTML::div(array('id' => 'content'), HTML::p(fmt("Differences between %s and %s of %s.", $new_link, $old_link, $page_link)));
    $otherdiffs = HTML::p(_("Other diffs:"));
    $label = array('major' => _("Previous Major Revision"), 'minor' => _("Previous Revision"), 'author' => _("Previous Author"));
    foreach ($others as $other) {
        $args = array('action' => 'diff', 'previous' => $other);
        if ($version) {
            $args['version'] = $version;
        }
        if (count($otherdiffs->getContent()) > 1) {
            $otherdiffs->pushContent(", ");
        } else {
            $otherdiffs->pushContent(" ");
        }
        $otherdiffs->pushContent(Button($args, $label[$other]));
    }
    $html->pushContent($otherdiffs);
    if ($old and $old->getVersion() == 0) {
        $old = false;
    }
    $html->pushContent(HTML::Table(PageInfoRow(_("Newer page:"), $new, $request, empty($version)), PageInfoRow(_("Older page:"), $old, $request, false)));
    if ($new && $old) {
        $diff = new Diff($old->getContent(), $new->getContent());
        if ($diff->isEmpty()) {
            $html->pushContent(HTML::hr(), HTML::p('[', _("Versions are identical"), ']'));
        } else {
            // New CSS formatted unified diffs (ugly in NS4).
            $fmt = new HtmlUnifiedDiffFormatter();
            // Use this for old table-formatted diffs.
//.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:tuleap,代码行数:101,代码来源:diff.php

示例7: sprintf

    $aText = $aLang == "en" ? "Archived page:" : "Page archivée :";
    $html .= "<dl><dt>{$aText}</dt>";
    if (is_array($archive)) {
        $html .= "\n<dd>";
        $html .= sprintf(gettext("Version %s"), $archive['version']);
        $html .= "\n</dd><dd>";
        $aText = $aLang == "en" ? "Last modified on %s" : "Dernière modification : %s";
        $html .= sprintf($aText, date($datetimeformat, $archive['lastmodified']));
        $html .= "\n</dd><dd>";
        $aText = $aLang == "en" ? "By %s" : "Par %s";
        $html .= sprintf($aText, $archive['author']);
        $html .= "</dd>";
    } else {
        $html .= "<dd><em>";
        $html .= $aLang == "en" ? "None" : "Aucune";
        $html .= "</em></dd>";
    }
    $html .= "</dl></div>\n";
    if (is_array($wiki) && is_array($archive)) {
        $diff = new WikiDiff($archive['content'], $wiki['content']);
        if ($diff->isEmpty()) {
            $aText = $aLang == "en" ? "Versions are identical" : "Les versions sont identiques";
            $html .= '<hr>[' . $aText . ']';
        } else {
            //$fmt = new WikiDiffFormatter;
            $fmt = new WikiUnifiedDiffFormatter();
            $html .= $fmt->format($diff, $archive['content']);
        }
    }
    GeneratePage('MESSAGE2', $html, sprintf("Diff %s", htmlspecialchars($pagename)), 0);
}
开发者ID:BackupTheBerlios,项目名称:oralux,代码行数:31,代码来源:diff.php

示例8: GetAllWikiPagenames

$directory = $dumpserial;
$pages = GetAllWikiPagenames($dbi);
// see if we can access the directory the user wants us to use
if (!file_exists($directory)) {
    if (!mkdir($directory, 0755)) {
        ExitWiki("Cannot create directory '{$directory}'<br>\n");
    } else {
        $html = "Created directory '{$directory}' for the page dump...<br>\n";
    }
} else {
    $html = "Using directory '{$directory}'<br>\n";
}
$numpages = count($pages);
for ($x = 0; $x < $numpages; $x++) {
    $pagename = htmlspecialchars($pages[$x]);
    $filename = preg_replace('/^\\./', '%2e', rawurlencode($pages[$x]));
    $html .= "<br>{$pagename} ... ";
    if ($pagename != $filename) {
        $html .= "<small>saved as {$filename}</small> ... ";
    }
    $data = serialize(RetrievePage($dbi, $pages[$x], $WikiPageStore));
    if ($fd = fopen("{$directory}/{$filename}", "w")) {
        $num = fwrite($fd, $data, strlen($data));
        $html .= "<small>{$num} bytes written</small>\n";
    } else {
        ExitWiki("<b>couldn't open file '{$directory}/{$filename}' for writing</b>\n");
    }
}
$html .= "<p><b>Dump complete.</b>";
GeneratePage('MESSAGE', $html, 'Dump serialized pages', 0);
ExitWiki('');
开发者ID:BackupTheBerlios,项目名称:oralux,代码行数:31,代码来源:dumpserial.php

示例9: NoSuchRevision

function NoSuchRevision(&$request, $page, $version)
{
    $html = HTML(HTML::h2(_("Revision Not Found")), HTML::p(fmt("I'm sorry.  Version %d of %s is not in the database.", $version, WikiLink($page, 'auto'))));
    include_once 'lib/Template.php';
    GeneratePage($html, _("Bad Version"), $page->getCurrentRevision());
    $request->finish();
}
开发者ID:hugcoday,项目名称:wiki,代码行数:7,代码来源:stdlib.php

示例10: rcs_id

<?php

// Backlinks: returns pages which link to a given page.
rcs_id('$Id: backlinks.php,v 1.1 2004/09/28 21:48:44 gcasse Exp $');
if (get_magic_quotes_gpc()) {
    $refs = stripslashes($refs);
}
$pagename = $refs;
// No HTML markup allowed in $title.
$title = sprintf(gettext("Pages which link to %s"), htmlspecialchars($pagename));
if (IsWikiPage($dbi, $pagename)) {
    $pagelink = LinkExistingWikiWord($pagename);
} else {
    $pagelink = LinkUnknownWikiWord($pagename);
}
$html = "<p><b>" . sprintf(gettext("Pages which link to %s") . " .....", $pagelink) . "</b></p>\n<ul>\n";
// search matching pages
$query = InitBackLinkSearch($dbi, $pagename);
$found = 0;
while ($page = BackLinkSearchNextMatch($dbi, $query)) {
    $found++;
    $html .= "<li>" . LinkExistingWikiWord($page) . "<br>\n";
}
$html .= "</ul>\n<hr noshade>\n" . sprintf(gettext("%d pages link to %s."), $found, $pagelink) . "\n";
GeneratePage('MESSAGE', $html, $title, 0);
开发者ID:BackupTheBerlios,项目名称:oralux,代码行数:25,代码来源:backlinks.php

示例11: rcs_id

<?php

// Title search: returns pages having a name matching the search term
rcs_id('$Id: search.php,v 1.1 2004/09/28 21:48:48 gcasse Exp $');
if (get_magic_quotes_gpc()) {
    $search = stripslashes($search);
}
$html = "<P><B>" . sprintf(gettext("Searching for \"%s\" ....."), htmlspecialchars($search)) . "</B></P>\n";
// quote regexp chars (backends should do this...)
//$search = preg_quote($search);
// search matching pages
$found = 0;
if (strlen($search)) {
    $query = InitTitleSearch($dbi, $search);
    while ($page = TitleSearchNextMatch($dbi, $query)) {
        $found++;
        $html .= LinkExistingWikiWord($page) . "<br>\n";
    }
} else {
    $html .= gettext("(You entered an empty search string)") . "<br>\n";
}
$html .= "<hr noshade>\n" . sprintf(gettext("%d pages match your query."), $found) . "\n";
GeneratePage('MESSAGE', $html, gettext("Title Search Results"), 0);
开发者ID:BackupTheBerlios,项目名称:oralux,代码行数:23,代码来源:search.php

示例12: RevertPage

function RevertPage(&$request)
{
    $mesg = HTML::dd();
    $pagename = $request->getArg('pagename');
    $version = $request->getArg('version');
    if (!$version) {
        PrintXML(HTML::dt(fmt("Revert"), " ", WikiLink($pagename)), HTML::dd(_("missing required version argument")));
        return;
    }
    $dbi =& $request->_dbi;
    $page = $dbi->getPage($pagename);
    $current = $page->getCurrentRevision();
    $currversion = $current->getVersion();
    if ($currversion == 0) {
        $mesg->pushContent(' ', _("no page content"));
        PrintXML(HTML::dt(fmt("Revert"), " ", WikiLink($pagename)), $mesg);
        flush();
        return;
    }
    if ($currversion == $version) {
        $mesg->pushContent(' ', _("same version page"));
        PrintXML(HTML::dt(fmt("Revert"), " ", WikiLink($pagename)), $mesg);
        flush();
        return;
    }
    if ($request->getArg('cancel')) {
        $mesg->pushContent(' ', _("Cancelled"));
        PrintXML(HTML::dt(fmt("Revert"), " ", WikiLink($pagename)), $mesg);
        flush();
        return;
    }
    if (!$request->getArg('verify')) {
        $mesg->pushContent(HTML::br(), _("Are you sure?"), HTML::br(), HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), HiddenInputs($request->getArgs(), false, array('verify')), HiddenInputs(array('verify' => 1)), Button('submit:verify', _("Yes"), 'button'), HTML::Raw('&nbsp;'), Button('submit:cancel', _("Cancel"), 'button')));
        $rev = $page->getRevision($version);
        $html = HTML(HTML::dt(fmt("Revert %s to version {$version}", WikiLink($pagename))), $mesg, $rev->getTransformedContent());
        $template = Template('browse', array('CONTENT' => $html));
        GeneratePage($template, $pagename, $rev);
        $request->checkValidators();
        flush();
        return;
    }
    $rev = $page->getRevision($version);
    $content = $rev->getPackedContent();
    $versiondata = $rev->_data;
    $versiondata['summary'] = sprintf(_("revert to version %d"), $version);
    $new = $page->save($content, $currversion + 1, $versiondata);
    $dbi->touch();
    $pagelink = WikiLink($pagename);
    $mesg->pushContent(fmt("Revert: %s", $pagelink), fmt("- version %d saved to database as version %d", $version, $new->getVersion()));
    // Force browse of current page version.
    $request->setArg('version', false);
    $template = Template('savepage', array());
    $template->replace('CONTENT', $new->getTransformedContent());
    GeneratePage($template, $mesg, $new);
    flush();
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:56,代码来源:loadsave.php

示例13: handleAction

 function handleAction()
 {
     // Check illegal characters in page names: <>[]{}|"
     require_once "lib/Template.php";
     $page = $this->getPage();
     $pagename = $page->getName();
     if (preg_match("/[<\\[\\{\\|\"\\}\\]>]/", $pagename, $matches) > 0) {
         $CONTENT = HTML::div(array('class' => 'error'), _("Illegal character '") . $matches[0] . _("' in page name."));
         GeneratePage($CONTENT, $pagename);
         $this->finish();
     }
     $action = $this->getArg('action');
     if ($this->isPost() and !$this->_user->isAdmin() and $action != 'browse' and $action != 'wikitohtml') {
         if ($page->get('moderation')) {
             require_once "lib/WikiPlugin.php";
             $loader = new WikiPluginLoader();
             $plugin = $loader->getPlugin("ModeratedPage");
             if ($plugin->handler($this, $page)) {
                 $CONTENT = HTML::div(array('class' => 'wiki-edithelp'), fmt("%s: action forwarded to a moderator.", $action), HTML::br(), _("This action requires moderator approval. Please be patient."));
                 if (!empty($plugin->_tokens['CONTENT'])) {
                     $plugin->_tokens['CONTENT']->pushContent(HTML::br(), _("You must wait for moderator approval."));
                 } else {
                     $plugin->_tokens['CONTENT'] = $CONTENT;
                 }
                 $title = WikiLink($page->getName());
                 $title->pushContent(' : ', WikiLink(_("ModeratedPage")));
                 GeneratePage(Template('browse', $plugin->_tokens), $title, $page->getCurrentRevision());
                 $this->finish();
             }
         }
     }
     $method = "action_{$action}";
     if (method_exists($this, $method)) {
         $this->{$method}();
     } elseif ($page = $this->findActionPage($action)) {
         $this->actionpage($page);
     } else {
         $this->finish(fmt("%s: Bad action", $action));
     }
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:40,代码来源:main.php

示例14: output

 function output($template, $title_fs)
 {
     global $WikiTheme;
     $selected =& $this->selected;
     $current =& $this->current;
     if ($selected && $selected->getVersion() != $current->getVersion()) {
         $rev = $selected;
         $pagelink = WikiLink($selected);
     } else {
         $rev = $current;
         $pagelink = WikiLink($this->page);
     }
     $title = new FormattedText($title_fs, $pagelink);
     if (USE_HTMLAREA and $template == 'editpage') {
         $WikiTheme->addMoreHeaders(Edit_HtmlArea_Head());
         //$tokens['PAGE_SOURCE'] = Edit_HtmlArea_ConvertBefore($this->_content);
     }
     $template = Template($template, $this->tokens);
     GeneratePage($template, $title, $rev);
     return true;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:21,代码来源:editpage.php

示例15: actionPage

function actionPage(&$request, $action)
{
    global $WikiTheme;
    global $robots;
    $pagename = $request->getArg('pagename');
    $version = $request->getArg('version');
    $page = $request->getPage();
    $revision = $page->getCurrentRevision();
    $dbi = $request->getDbh();
    $actionpage = $dbi->getPage($action);
    $actionrev = $actionpage->getCurrentRevision();
    $pagetitle = HTML(fmt("%s: %s", $actionpage->getName(), $WikiTheme->linkExistingWikiWord($pagename, false, $version)));
    $request->setValidators(array('pageversion' => $revision->getVersion(), '%mtime' => $revision->get('mtime')));
    $request->appendValidators(array('pagerev' => $revision->getVersion(), '%mtime' => $revision->get('mtime')));
    $request->appendValidators(array('actionpagerev' => $actionrev->getVersion(), '%mtime' => $actionrev->get('mtime')));
    $transformedContent = $actionrev->getTransformedContent();
    /* Optionally tell google (and others) not to take notice of action pages.
          RecentChanges or AllPages might be an exception.
       */
    $args = array();
    if (GOOGLE_LINKS_NOFOLLOW) {
        $robots = "noindex,nofollow";
        $args = array('ROBOTS_META' => $robots);
    }
    /* Handle other formats: So far we had html only.
          xml is requested by loaddump, rss is handled by recentchanges,
          pdf is a special action, but should be a format to dump multiple pages
          if the actionpage plugin returns a pagelist.
          rdf and owl are handled by SemanticWeb.
       */
    $format = $request->getArg('format');
    /* At first the single page formats: html, xml */
    if ($pagename == _("LinkDatabase")) {
        $template = Template('browse', array('CONTENT' => $transformedContent));
        GeneratePage($template, $pagetitle, $revision, $args);
    } elseif (!$format or $format == 'html' or $format == 'sidebar' or $format == 'contribs') {
        $template = Template('browse', array('CONTENT' => $transformedContent));
        GeneratePage($template, $pagetitle, $revision, $args);
    } elseif ($format == 'xml') {
        $request->setArg('format', '');
        $template = new Template('browse', $request, array('revision' => $revision, 'CONTENT' => $transformedContent));
        $html = GeneratePageAsXML($template, $pagename, $revision);
        header("Content-Type: application/xhtml+xml; charset=" . $GLOBALS['charset']);
        echo $html;
    } else {
        $pagelist = null;
        require_once 'lib/WikiPlugin.php';
        // Then the multi-page formats
        // rss (if not already handled by RecentChanges)
        // Need the pagelist from the first plugin
        foreach ($transformedContent->_content as $cached_element) {
            if (is_a($cached_element, "Cached_PluginInvocation")) {
                $loader = new WikiPluginLoader();
                $markup = null;
                // return the first found pagelist
                $pagelist = $loader->expandPI($cached_element->_pi, $request, $markup, $pagename);
                if (is_a($pagelist, 'PageList')) {
                    break;
                }
            }
        }
        if (!$pagelist or !is_a($pagelist, 'PageList')) {
            if (!in_array($format, array("rss91", "rss2", "rss", "atom", "rdf"))) {
                trigger_error(sprintf("Format %s requires an actionpage returning a pagelist.", $format) . "\n" . "Fall back to single page mode", E_USER_WARNING);
            }
            require_once 'lib/PageList.php';
            $pagelist = new PageList();
            if ($format == 'pdf') {
                $pagelist->addPage($page);
            }
        } else {
            foreach ($pagelist->_pages as $page) {
                $name = $page->getName();
                if ($name != $pagename and $page->exists()) {
                    $args['VALID_LINKS'][] = $name;
                }
            }
        }
        if ($format == 'pdf') {
            require_once "lib/pdf.php";
            array_unshift($args['VALID_LINKS'], $pagename);
            ConvertAndDisplayPdfPageList($request, $pagelist, $args);
        } elseif ($format == 'ziphtml') {
            // need to fix links
            require_once 'lib/loadsave.php';
            array_unshift($args['VALID_LINKS'], $pagename);
            $request->setArg('zipname', FilenameForPage($pagename) . ".zip");
            $request->setArg('pages', $args['VALID_LINKS']);
            $request->setArg('format', '');
            MakeWikiZipHtml($request);
        } elseif (in_array($format, array("rss91", "rss2", "rss", "atom"))) {
            $args = $request->getArgs();
            //$request->setArg('format','');
            if ($pagename == _("RecentChanges")) {
                $template->printExpansion($args);
            } else {
                require_once "lib/plugin/RecentChanges.php";
                $plugin = new WikiPlugin_RecentChanges();
                return $plugin->format($plugin->getChanges($request->_dbi, $args), $args);
            }
//.........这里部分代码省略.........
开发者ID:hugcoday,项目名称:wiki,代码行数:101,代码来源:display.php


注:本文中的GeneratePage函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。