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


PHP HTML::hr方法代码示例

本文整理汇总了PHP中HTML::hr方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::hr方法的具体用法?PHP HTML::hr怎么用?PHP HTML::hr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTML的用法示例。


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

示例1: 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

示例2: 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 {
        // 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:neymanna,项目名称:fusionforge,代码行数:36,代码来源:removepage.php

示例3: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     extract($this->getArgs($argstr, $request));
     if (is_array($versions)) {
         // Version selection from pageinfo.php display:
         rsort($versions);
         list($version, $previous) = $versions;
     }
     // Check if user is allowed to get the Page.
     if (!mayAccessPage('view', $pagename)) {
         return $this->error(sprintf(_("Illegal access to page %s: no read access"), $pagename));
     }
     // abort if page doesn't exist
     $page = $request->getPage($pagename);
     $current = $page->getCurrentRevision();
     if ($current->getVersion() < 1) {
         $html = HTML(HTML::p(fmt("I'm sorry, there is no such page as %s.", WikiLink($pagename, 'unknown'))));
         return $html;
         //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(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('pagename' => $pagename, '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($this->PageInfoRow(_("Newer page:"), $new, $request), $this->PageInfoRow(_("Older page:"), $old, $request)));
     if ($new && $old) {
         $diff = new Diff($old->getContent(), $new->getContent());
         if ($diff->isEmpty()) {
             $html->pushContent(HTML::hr(), HTML::p(_("Content of versions "), $old->getVersion(), _(" and "), $new->getVersion(), _(" is identical.")));
             // If two consecutive versions have the same content, it is because the page was
             // renamed, or metadata changed: ACL, owner, markup.
             // We give the reason by printing the summary.
             if ($new->getVersion() - $old->getVersion() == 1) {
                 $html->pushContent(HTML::p(_("Version "), $new->getVersion(), _(" was created because: "), $new->get('summary')));
             }
//.........这里部分代码省略.........
开发者ID:hugcoday,项目名称:wiki,代码行数:101,代码来源:Diff.php

示例4: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     global $WikiTheme;
     $args = $this->getArgs($argstr, $request);
     if (empty($args['page'])) {
         $args['page'] = "*";
     }
     $form = $this->showForm($dbi, $request, $args);
     extract($args);
     if (empty($s)) {
         return $form;
     }
     $pagequery = new TextSearchQuery($page, $args['case_exact'], $args['regex']);
     $linkquery = new TextSearchQuery($s, $args['case_exact'], $args['regex']);
     $links = $dbi->linkSearch($pagequery, $linkquery, $direction == 'in' ? 'linkfrom' : 'linkto');
     $pagelist = new PageList($args['info'], $args['exclude'], $args);
     $pagelist->_links = array();
     while ($link = $links->next()) {
         $pagelist->addPage($link['pagename']);
         $pagelist->_links[] = $link;
     }
     $pagelist->addColumnObject(new _PageList_Column_LinkSearch_link('link', _("Link"), $pagelist));
     if (!$noheader) {
         // We put the form into the caption just to be able to return one pagelist object,
         // and to still have the convenience form at the top. we could workaround this by
         // putting the form as WikiFormRich into the actionpage. but thid doesnt look as
         // nice as this here.
         $pagelist->setCaption(HTML($noform ? '' : HTML($form, HTML::hr()), fmt("LinkSearch result for \"%s\" in pages \"%s\", direction %s", $s, $page, $direction)));
     }
     return $pagelist;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:31,代码来源:LinkSearch.php

示例5: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     global $WikiTheme;
     $this->_supported_operators = array(':=', '<', '<=', '>', '>=', '!=', '==', '=~');
     $args = $this->getArgs($argstr, $request);
     $posted = $request->getArg('semsearch');
     $request->setArg('semsearch', false);
     if ($request->isPost() and isset($posted['help'])) {
         $request->redirect(WikiURL(_("Help/SemanticSearchAdvancedPlugin"), array('redirectfrom' => $basepage), true));
     }
     $allrelations = $dbi->listRelations();
     $form = $this->showForm($dbi, $request, $args, $allrelations);
     if (isset($this->_norelations_warning)) {
         $form->pushContent(HTML::div(array('class' => 'warning'), _("Warning:") . $this->_norelations_warning));
     }
     extract($args);
     // For convenience, peace and harmony we allow GET requests also.
     if (!$args['s']) {
         // check for good GET request
         return $form;
     }
     // nobody called us, so just display our form
     // In reality we have to iterate over all found pages.
     // To makes things shorter extract the next AND required expr and
     // iterate only over this, then recurse into the next AND expr.
     // => Split into an AND and OR expression tree.
     $parsed_relations = $this->detectRelationsAndAttributes($args['s']);
     $regex = '';
     if ($parsed_relations) {
         $regex = preg_grep("/[\\*\\?]/", $parsed_relations);
     } else {
         $this->error("Invalid query: No relations or attributes in the query {$s} found");
     }
     $pagelist = new PageList($args['info'], $args['exclude'], $args);
     if (!$noheader) {
         $pagelist->setCaption(HTML($noform ? '' : HTML($form, HTML::hr()), fmt("Semantic %s Search Result for \"%s\" in pages \"%s\"", '', $s, $page)));
     }
     if (!$regex and $missing = array_diff($parsed_relations, $allrelations)) {
         return $pagelist;
     }
     $relquery = new TextSearchQuery(join(" ", $parsed_relations));
     if (!$relquery->match(join(" ", $allrelations))) {
         return $pagelist;
     }
     $pagequery = new TextSearchQuery($page, $args['case_exact'], $args['regex']);
     // if we have only numeric or text ops we can optimize.
     //$parsed_attr_ops = $this->detectAttrOps($args['s']);
     //TODO: writeme
     $linkquery = new TextSearchQuery($s, $args['case_exact'], $args['regex']);
     $links = $dbi->linkSearch($pagequery, $linkquery, 'relation', $relquery);
     $pagelist->_links = array();
     while ($link = $links->next()) {
         $pagelist->addPage($link['pagename']);
         $pagelist->_links[] = $link;
     }
     $pagelist->addColumnObject(new _PageList_Column_SemanticSearch_relation('relation', _("Relation"), $pagelist));
     $pagelist->addColumnObject(new _PageList_Column_SemanticSearch_link('link', _("Link"), $pagelist));
     return $pagelist;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:59,代码来源:SemanticSearchAdvanced.php

示例6: setaclForm

 function setaclForm(&$header, $post_args, $pagehash)
 {
     $acl = $post_args['acl'];
     //FIXME: find intersection of all pages perms, not just from the last pagename
     $pages = array();
     foreach ($pagehash as $name => $checked) {
         if ($checked) {
             $pages[] = $name;
         }
     }
     $perm_tree = pagePermissions($name);
     $table = pagePermissionsAclFormat($perm_tree, !empty($pages));
     $header->pushContent(HTML::strong(_("Selected Pages: ")), HTML::tt(join(', ', $pages)), HTML::br());
     $first_page = $GLOBALS['request']->_dbi->getPage($name);
     $owner = $first_page->getOwner();
     list($type, $perm) = pagePermissionsAcl($perm_tree[0], $perm_tree);
     //if (DEBUG) $header->pushContent(HTML::pre("Permission tree for $name:\n",print_r($perm_tree,true)));
     if ($type == 'inherited') {
         $type = sprintf(_("page permission inherited from %s"), $perm_tree[1][0]);
     } elseif ($type == 'page') {
         $type = _("individual page permission");
     } elseif ($type == 'default') {
         $type = _("default page permission");
     }
     $header->pushContent(HTML::strong(_("Type") . ': '), HTML::tt($type), HTML::br());
     $header->pushContent(HTML::strong(_("ACL") . ': '), HTML::tt($perm->asAclLines()), HTML::br());
     $header->pushContent(HTML::p(HTML::strong(_("Description") . ': '), _("Selected Grant checkboxes allow access, unselected checkboxes deny access."), _("To ignore delete the line."), _("To add check 'Add' near the dropdown list.")));
     $header->pushContent($table);
     //
     // display array of checkboxes for existing perms
     // and a dropdown for user/group to add perms.
     // disabled if inherited,
     // checkbox to disable inheritance,
     // another checkbox to progate new permissions to all childs (if there exist some)
     //Todo:
     // warn if more pages are selected and they have different perms
     //$header->pushContent(HTML::input(array('name' => 'admin_setacl[acl]',
     //                                       'value' => $post_args['acl'])));
     $header->pushContent(HTML::br());
     if (!empty($pages) and defined('EXPERIMENTAL') and EXPERIMENTAL) {
         $checkbox = HTML::input(array('type' => 'checkbox', 'name' => 'admin_setacl[updatechildren]', 'value' => 1));
         if (!empty($post_args['updatechildren'])) {
             $checkbox->setAttr('checked', 'checked');
         }
         $header->pushContent($checkbox, _("Propagate new permissions to all subpages?"), HTML::raw("&nbsp;&nbsp;"), HTML::em(_("(disable individual page permissions, enable inheritance)?")), HTML::br(), HTML::em(_("(Currently not working)")));
     }
     $header->pushContent(HTML::hr());
     return $header;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:49,代码来源:WikiAdminSetAcl.php

示例7: getDiff

 function getDiff()
 {
     require_once 'lib/diff.php';
     $html = HTML();
     $diff = new Diff($this->current->getContent(), explode("\n", $this->getContent()));
     if ($diff->isEmpty()) {
         $html->pushContent(HTML::hr(), HTML::p('[', _("Versions are identical"), ']'));
     } else {
         // New CSS formatted unified diffs
         $fmt = new HtmlUnifiedDiffFormatter();
         $html->pushContent($fmt->format($diff));
     }
     return $html;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:14,代码来源:editpage.php

示例8: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     extract($this->getArgs($argstr, $request));
     if (is_array($versions)) {
         // Version selection from pageinfo.php display:
         rsort($versions);
         list($version, $previous) = $versions;
     }
     // abort if page doesn't exist
     $page = $request->getPage($pagename);
     $current = $page->getCurrentRevision();
     if ($current->getVersion() < 1) {
         $html = HTML(HTML::p(fmt("I'm sorry, there is no such page as %s.", WikiLink($pagename, 'unknown'))));
         return $html;
         //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(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('pagename' => $pagename, '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($this->PageInfoRow(_("Newer page:"), $new, $request), $this->PageInfoRow(_("Older page:"), $old, $request)));
     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.
             //$fmt = new TableUnifiedDiffFormatter;
             $html->pushContent($fmt->format($diff));
         }
     }
     //$html = HTML::tt(fmt('%s: %s', $salutation, WikiLink($name, 'auto')),
     //                 THE_END);
//.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:tuleap,代码行数:101,代码来源:Diff.php

示例9: 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(false);
    if ($current->getVersion() < 1) {
        $html = HTML::div(array('class' => 'wikitext', 'id' => 'difftext'), HTML::p(fmt("I'm sorry, there is no such page as %s.", WikiLink($pagename, 'unknown'))));
        require_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('class' => 'wikitext', 'id' => 'difftext'), 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(_("Content of versions "), $old->getVersion(), _(" and "), $new->getVersion(), _(" is identical.")));
            // If two consecutive versions have the same content, it is because the page was
            // renamed, or metadata changed: ACL, owner, markup.
            // We give the reason by printing the summary.
            if ($new->getVersion() - $old->getVersion() == 1) {
//.........这里部分代码省略.........
开发者ID:hugcoday,项目名称:wiki,代码行数:101,代码来源:diff.php

示例10: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     extract($this->getArgs($argstr, $request));
     $page = $dbi->getPage($pagename);
     $current = $page->getCurrentRevision();
     $source = $current->getPackedContent();
     if (empty($source)) {
         return $this->error(fmt("empty source"));
     }
     if ($basepage == _("SpellCheck")) {
         return $this->error(fmt("Cannot SpellCheck myself"));
     }
     $lang = $page->get('lang');
     if (empty($lang)) {
         $lang = $GLOBALS['LANG'];
     }
     $html = HTML();
     if (!function_exists('pspell_new_config')) {
         // use the aspell commandline interface
         include_once "lib/WikiPluginCached.php";
         $args = "";
         $source = preg_replace("/^/m", "^", $source);
         if (ASPELL_DATA_DIR) {
             $args .= " --data-dir=" . ASPELL_DATA_DIR;
         }
         // MAYBE TODO: do we have the language dictionary?
         $args .= " --lang=" . $lang;
         // use -C or autosplit wikiwords in the text
         $commandLine = ASPELL_EXE . " -a -C {$args} ";
         $cache = new WikiPluginCached();
         $code = $cache->filterThroughCmd($source, $commandLine);
         if (empty($code)) {
             return $this->error(fmt("Couldn't start commandline '%s'", $commandLine));
         }
         $sugg = array();
         foreach (preg_split("/\n/", $code) as $line) {
             if (preg_match("/^& (\\w+) \\d+ \\d+: (.+)\$/", $line, $m)) {
                 $sugg[$m[1]] = preg_split("/, /", $m[2]);
             }
         }
         /*$pre = HTML::pre(HTML::raw($code));
           $html->pushContent($pre);*/
     } else {
         $sugg = pspell_check($source, $lang);
     }
     //$html->pushContent(HTML::hr(),HTML::h1(_("Spellcheck")));
     $page = $request->getPage();
     if ($version) {
         $revision = $page->getRevision($version);
         if (!$revision) {
             NoSuchRevision($request, $page, $version);
         }
     } else {
         $revision = $page->getCurrentRevision();
     }
     $GLOBALS['request']->setArg('suggestions', $sugg);
     include_once "lib/BlockParser.php";
     $ori_html = TransformText($revision, $revision->get('markup'), $page);
     $GLOBALS['request']->setArg('suggestions', false);
     $html->pushContent($ori_html, HTML::hr(), HTML::h1(_("SpellCheck result")));
     $list = HTML::ul();
     foreach ($sugg as $word => $suggs) {
         $w = HTML::span(array('class' => 'spell-wrong'), $word);
         // TODO: optional replace-link. jscript or request button with word replace.
         $r = HTML();
         foreach ($suggs as $s) {
             $r->pushContent(HTML::a(array('class' => 'spell-sugg', 'href' => "javascript:do_replace('{$word}','{$s}')"), $s), ", ");
         }
         $list->pushContent(HTML::li($w, ": ", $r));
     }
     $html->pushContent($list);
     return $html;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:73,代码来源:SpellCheck.php

示例11: RevertPage

function RevertPage(&$request)
{
    $mesg = HTML::div();
    $pagename = $request->getArg('pagename');
    $version = $request->getArg('version');
    if (!$version) {
        PrintXML(HTML::p(fmt("Revert"), " ", WikiLink($pagename)), HTML::p(_("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::p(fmt("Revert"), " ", WikiLink($pagename)), $mesg);
        flush();
        return;
    }
    if ($currversion == $version) {
        $mesg->pushContent(' ', _("same version page"));
        PrintXML(HTML::p(fmt("Revert"), " ", WikiLink($pagename)), $mesg);
        flush();
        return;
    }
    if ($request->getArg('cancel')) {
        $mesg->pushContent(' ', _("Cancelled"));
        PrintXML(HTML::p(fmt("Revert"), " ", WikiLink($pagename)), $mesg);
        flush();
        return;
    }
    if (!$request->getArg('verify')) {
        $mesg->pushContent(HTML::p(fmt("Are you sure to revert %s to version {$version}?", WikiLink($pagename))), 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::fieldset($mesg), HTML::hr(), $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();
    $mesg = HTML::span();
    $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:hugcoday,项目名称:wiki,代码行数:57,代码来源:loadsave.php

示例12: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     /* ignore fatal on loading */
     /*
     global $ErrorManager;
     $ErrorManager->pushErrorHandler(new WikiMethodCb($this,'_error_handler'));
     */
     // Require the XML_FOAF_Parser class. This is a pear library not included with phpwiki.
     // see doc/README.foaf
     if (findFile('XML/FOAF/Parser.php', 'missing_ok')) {
         require_once 'XML/FOAF/Parser.php';
     }
     //$ErrorManager->popErrorHandler();
     if (!class_exists('XML_FOAF_Parser')) {
         return $this->error(_("required pear library XML/FOAF/Parser.php not found in include_path"));
     }
     extract($this->getArgs($argstr, $request));
     // Get our FOAF File from the foaf plugin argument or $_GET['foaf']
     if (empty($foaf)) {
         $foaf = $request->getArg('foaf');
     }
     $chooser = HTML::form(array('method' => 'get', 'action' => $request->getURLtoSelf()), HTML::h4(_("FOAF File URI")), HTML::input(array('id' => 'foaf', 'name' => 'foaf', 'type' => 'text', 'size' => '80', 'value' => $foaf)), HTML::br(), HTML::input(array('id' => 'pretty', 'name' => 'pretty', 'type' => 'radio', 'checked' => 'checked'), _("Pretty HTML")), HTML::input(array('id' => 'original', 'name' => 'original', 'type' => 'radio'), _("Original URL (Redirect)")), HTML::br(), HTML::input(array('type' => 'submit', 'value' => _("Parse FOAF"))));
     if (empty($foaf)) {
         return $chooser;
     } else {
         //Error Checking
         if (substr($foaf, 0, 7) != "http://") {
             return $this->error(_("foaf must be a URI starting with http://"));
         }
         // Start of output
         if (!empty($original)) {
             $request->redirect($foaf);
         } else {
             $foaffile = url_get_contents($foaf);
             if (!$foaffile) {
                 //TODO: get errormsg
                 return HTML(HTML::p("Resource isn't available: Something went wrong, probably a 404!"));
             }
             // Create new Parser object
             $parser = new XML_FOAF_Parser();
             // Parser FOAF into $foaffile
             $parser->parseFromMem($foaffile);
             $a = $parser->toArray();
             $html = HTML(HTML::h1(@$a[0]["name"]), HTML::table(HTML::thead(), HTML::tbody(@$a[0]["title"] ? HTML::tr(HTML::td(_("Title")), HTML::td($a[0]["title"])) : null, @$a[0]["homepage"][0] ? $this->iterateHTML($a[0], "homepage", $a["dc"]) : null, @$a[0]["weblog"][0] ? $this->iterateHTML($a[0], "weblog", $a["dc"]) : null, HTML::tr(HTML::td("Full Name"), @$a[0]["name"][0] ? HTML::td(@$a[0]["name"]) : null), @$a[0]["nick"][0] ? $this->iterateHTML($a[0], "nick", $a["dc"]) : null, @$a[0]["mboxsha1sum"][0] ? $this->iterateHTML($a[0], "mboxsha1sum", $a["dc"]) : null, @$a[0]["depiction"][0] ? $this->iterateHTML($a[0], "depiction", $a["dc"]) : null, @$a[0]["seealso"][0] ? $this->iterateHTML($a[0], "seealso", $a["dc"]) : null, HTML::tr(HTML::td("Source"), HTML::td(HTML::a(array('href' => @$foaf), "RDF"))))));
             if (DEBUG) {
                 $html->pushContent(HTML::hr(), $chooser);
             }
             return $html;
         }
     }
 }
开发者ID:neymanna,项目名称:fusionforge,代码行数:51,代码来源:FoafViewer.php

示例13: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     $this->disallowed_extensions = explode("\n", "ad[ep]\nasd\nba[st]\nchm\ncmd\ncom\ncgi\ncpl\ncrt\ndll\neml\nexe\nhlp\nhta\nin[fs]\nisp\njse?\nlnk\nmd[betw]\nms[cipt]\nnws\nocx\nops\npcd\np[ir]f\nphp\npl\npy\nreg\nsc[frt]\nsh[bsm]?\nswf\nurl\nvb[esx]?\nvxd\nws[cfh]");
     //removed "\{[[:xdigit:]]{8}(?:-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}\}"
     $args = $this->getArgs($argstr, $request);
     extract($args);
     $file_dir = getUploadFilePath();
     //$url_prefix = SERVER_NAME . DATA_PATH;
     $form = HTML::form(array('action' => $request->getPostURL(), 'enctype' => 'multipart/form-data', 'method' => 'post'));
     $contents = HTML::div(array('class' => 'wikiaction'));
     $contents->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'MAX_FILE_SIZE', 'value' => MAX_UPLOAD_SIZE)));
     /// MV add pv
     /// @todo: have a generic method to transmit pv
     if (!empty($_REQUEST['pv'])) {
         $contents->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'pv', 'value' => $_REQUEST['pv'])));
     }
     $contents->pushContent(HTML::input(array('name' => 'userfile', 'type' => 'file', 'size' => '50')));
     $contents->pushContent(HTML::raw(" "));
     $contents->pushContent(HTML::input(array('value' => _("Upload"), 'type' => 'submit')));
     $form->pushContent($contents);
     $message = HTML();
     if ($request->isPost() and $this->only_authenticated) {
         // Make sure that the user is logged in.
         $user = $request->getUser();
         if (!$user->isAuthenticated()) {
             $message->pushContent(HTML::h2(_("ACCESS DENIED: You must log in to upload files.")), HTML::br(), HTML::br());
             $result = HTML();
             $result->pushContent($form);
             $result->pushContent($message);
             return $result;
         }
     }
     $userfile = $request->getUploadedFile('userfile');
     if ($userfile) {
         $userfile_name = $userfile->getName();
         $userfile_name = trim(basename($userfile_name));
         $userfile_tmpname = $userfile->getTmpName();
         $err_header = HTML::h2(fmt("ERROR uploading '%s': ", $userfile_name));
         /// MV add
         /// Wiki attachments
         $wa = new WikiAttachment(GROUP_ID);
         $rev = $wa->createRevision($userfile_name, $userfile->getSize(), $userfile->getType(), $userfile->getTmpName());
         if ($rev >= 0) {
             $prev = $rev + 1;
             $interwiki = new PageType_interwikimap();
             $link = $interwiki->link("Upload:{$prev}/{$userfile_name}");
             $message->pushContent(HTML::h2(_("File successfully uploaded.")));
             $message->pushContent(HTML::ul(HTML::li($link)));
             // the upload was a success and we need to mark this event in the "upload log"
             if ($logfile) {
                 $upload_log = $file_dir . basename($logfile);
                 $this->log($userfile, $upload_log, $message);
             }
             if ($autolink) {
                 require_once "lib/loadsave.php";
                 $pagehandle = $dbi->getPage($page);
                 if ($pagehandle->exists()) {
                     // don't replace default contents
                     $current = $pagehandle->getCurrentRevision();
                     $version = $current->getVersion();
                     $text = $current->getPackedContent();
                     $newtext = $text . "\n* [Upload:{$userfile_name}]";
                     $meta = $current->_data;
                     $meta['summary'] = sprintf(_("uploaded %s"), $userfile_name);
                     $pagehandle->save($newtext, $version + 1, $meta);
                 }
             }
         } else {
             $message->pushContent($err_header);
             $message->pushContent(HTML::br(), _("Uploading failed."), HTML::br());
         }
     } else {
         $message->pushContent(HTML::br(), HTML::br());
     }
     /// {{{ Codendi Specific
     // URL arguments
     if (array_key_exists('offset', $_REQUEST)) {
         $offset = $_REQUEST['offset'];
     } else {
         $offset = 0;
     }
     if (array_key_exists('limit', $_REQUEST)) {
         $limit = $_REQUEST['limit'];
     } else {
         $limit = 10;
     }
     $attchTab = HTML::table(array('border' => '1', 'width' => '100%'));
     $attchTab->pushContent(HTML::tr(HTML::th(_("Attachment")), HTML::th(_("Number of revision"))));
     $wai =& WikiAttachment::getListWithCounter(GROUP_ID, user_getid(), array('offset' => $offset, 'nb' => $limit));
     $wai->rewind();
     while ($wai->valid()) {
         $wa =& $wai->current();
         $filename = basename($wa->getFilename());
         $url = getUploadDataPath() . urlencode($filename);
         $line = HTML::tr();
         $line->pushContent(HTML::td(HTML::a(array('href' => $url), "Attach:" . $filename)));
         $line->pushContent(HTML::td($wa->count()));
         $attchTab->pushContent($line);
         $wai->next();
     }
//.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:tuleap,代码行数:101,代码来源:UpLoad.php

示例14: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     if (isa($request, 'MockRequest')) {
         return '';
     }
     $user =& $request->_user;
     $post_args = $request->getArg('admin_reset');
     $userid = $request->getArg('user');
     $isadmin = $user->isAdmin();
     if ($request->isPost()) {
         if (!$userid) {
             $alert = new Alert(_("Warning:"), _("You need to specify the userid!"));
             $alert->show();
             return $this->doForm($request);
         }
         @($reset = $post_args['reset']);
         if ($reset and $userid and !empty($post_args['verify'])) {
             if ($user->isAdmin()) {
                 return $this->doReset($userid);
             } else {
                 return $this->doEmail($request, $userid);
             }
         } elseif ($reset and empty($post_args['verify'])) {
             $buttons = HTML::p(Button('submit:admin_reset[reset]', $isadmin ? _("Yes") : _("Send email"), $isadmin ? 'wikiadmin' : 'button'), HTML::Raw('&nbsp;'), Button('submit:admin_reset[cancel]', _("Cancel"), 'button'));
             $header = HTML::strong("Verify");
             if (!$user->isAdmin()) {
                 // check for email
                 if ($userid == $user->UserName() and $user->isAuthenticated()) {
                     $alert = new Alert(_("Already logged in"), HTML(fmt("Changing passwords is done at "), WikiLink(_("UserPreferences"))));
                     $alert->show();
                     return;
                 }
                 $thisuser = WikiUser($userid);
                 $prefs = $thisuser->getPreferences();
                 $email = $prefs->get('email');
                 if (!$email) {
                     $alert = new Alert(_("Error"), HTML(fmt("No email stored for user %s.", $userid), HTML::br(), fmt("You need to ask an Administrator to reset this password. See below: "), HTML::br(), WikiLink(ADMIN_USER)));
                     $alert->show();
                     return;
                 }
                 $verified = $thisuser->_prefs->_prefs['email']->getraw('emailVerified');
                 if (!$verified) {
                     $header->pushContent(HTML::br(), "Warning: This users email address is unverified!");
                 }
             }
             return $this->doForm($request, $header, HTML(HTML::hr(), fmt("Do you really want to reset the password of user %s?", $userid), $isadmin ? '' : _("An email will be sent."), HiddenInputs(array('admin_reset[verify]' => 1, 'user' => $userid)), $buttons));
         } else {
             return $this->doForm($request);
         }
     } else {
         return $this->doForm($request);
     }
 }
开发者ID:neymanna,项目名称:fusionforge,代码行数:54,代码来源:PasswordReset.php

示例15: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     $user =& $request->_user;
     if (isa($request, 'MockRequest')) {
         return '';
     }
     if (!$request->isActionPage($request->getArg('pagename')) and (!isset($user->_prefs->_method) or !in_array($user->_prefs->_method, array('ADODB', 'SQL'))) or in_array($request->getArg('action'), array('zip', 'ziphtml', 'dumphtml')) or isa($user, '_ForbiddenUser')) {
         $no_args = $this->getDefaultArguments();
         // ?
         //            foreach ($no_args as $key => $value) {
         //                $no_args[$value] = false;
         //            }
         $no_args['errmsg'] = HTML(HTML::h2(_("Error: The user HomePage must be a valid WikiWord. Sorry, UserPreferences cannot be saved."), HTML::hr()));
         $no_args['isForm'] = false;
         return Template('userprefs', $no_args);
     }
     $userid = $user->UserName();
     if ($user->isAuthenticated() and !empty($userid)) {
         $pref =& $request->_prefs;
         $args['isForm'] = true;
         //trigger_error("DEBUG: reading prefs from getPreferences".print_r($pref));
         if ($request->isPost()) {
             $errmsg = '';
             $delete = $request->getArg('delete');
             if ($delete and $request->getArg('verify')) {
                 // deleting prefs, verified
                 $default_prefs = $pref->defaultPreferences();
                 $default_prefs['userid'] = $user->UserName();
                 $user->setPreferences($default_prefs);
                 $request->_setUser($user);
                 $request->setArg("verify", false);
                 $request->setArg("delete", false);
                 $alert = new Alert(_("Message"), _("Your UserPreferences have been successfully deleted."));
                 $alert->show();
                 return;
             } elseif ($delete and !$request->getArg('verify')) {
                 return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), HiddenInputs(array('verify' => 1)), HiddenInputs($request->getArgs()), HTML::p(_("Do you really want to delete all your UserPreferences?")), HTML::p(Button('submit:delete', _("Yes"), 'delete'), HTML::Raw('&nbsp;'), Button('cancel', _("Cancel"))));
             } elseif ($rp = $request->getArg('pref')) {
                 // replace only changed prefs in $pref with those from request
                 if (!empty($rp['passwd']) and $rp['passwd2'] != $rp['passwd']) {
                     $errmsg = _("Wrong password. Try again.");
                 } else {
                     //trigger_error("DEBUG: reading prefs from request".print_r($rp));
                     //trigger_error("DEBUG: writing prefs with setPreferences".print_r($pref));
                     if (empty($rp['passwd'])) {
                         unset($rp['passwd']);
                     }
                     // fix to set system pulldown's. empty values don't get posted
                     if (empty($rp['theme'])) {
                         $rp['theme'] = '';
                     }
                     if (empty($rp['lang'])) {
                         $rp['lang'] = '';
                     }
                     $num = $user->setPreferences($rp);
                     if (!empty($rp['passwd'])) {
                         $passchanged = false;
                         if ($user->mayChangePass()) {
                             if (method_exists($user, 'storePass')) {
                                 $passchanged = $user->storePass($rp['passwd']);
                             }
                             if (!$passchanged and method_exists($user, 'changePass')) {
                                 $passchanged = $user->changePass($rp['passwd']);
                             }
                             if ($passchanged) {
                                 $errmsg = _("Password updated.");
                             } else {
                                 $errmsg = _("Password was not changed.");
                             }
                         } else {
                             $errmsg = _("Password cannot be changed.");
                         }
                     }
                     if (!$num) {
                         $errmsg .= " " . _("No changes.");
                     } else {
                         $request->_setUser($user);
                         $pref = $user->_prefs;
                         $errmsg .= sprintf(_("%d UserPreferences fields successfully updated."), $num);
                     }
                 }
                 $args['errmsg'] = HTML(HTML::h2($errmsg), HTML::hr());
             }
         }
         $args['available_themes'] = listAvailableThemes();
         $args['available_languages'] = listAvailableLanguages();
         return Template('userprefs', $args);
     } else {
         // wrong or unauthenticated user
         return $request->_notAuthorized(WIKIAUTH_BOGO);
         //return $user->PrintLoginForm ($request, $args, false, false);
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:94,代码来源:UserPreferences.php


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