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


PHP _html_escape函数代码示例

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


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

示例1: endElement

 function endElement($parser, $tagName)
 {
     if ($tagName == "ITEM") {
         //if ($this->status) print "[$this->status] ";
         $title = trim($this->title);
         if (!empty($this->title_width) && function_exists('mb_strimwidth')) {
             $title = mb_strimwidth($title, 0, $this->title_width, '...', $this->charset);
         }
         $title = sprintf("<a href='%s' title='%s' target='_content'>%s</a>", trim($this->link), _html_escape($this->title), _html_escape($title));
         #printf("<p>%s</p>",
         #  _html_escape(trim($this->description)));
         if ($this->date) {
             $date = trim($this->date);
             $date[10] = " ";
             # 2003-07-11T12:08:33+09:00
             # http://www.w3.org/TR/NOTE-datetime
             $zone = str_replace(":", "", substr($date, 19));
             $time = strtotime(substr($date, 0, 19) . $zone);
             $date = date($this->date_fmt, $time);
         }
         echo '<li><span data-timestamp="' . $time . '" class="date">', $date, '</span> ', $title, '</li>', "\n";
         $this->title = "";
         $this->description = "";
         $this->link = "";
         $this->date = "";
         $this->status = "";
         $this->insideitem = false;
     }
 }
开发者ID:ahastudio,项目名称:moniwiki,代码行数:29,代码来源:rss.php

示例2: macro_Revert

function macro_Revert($formatter, $value, $options = array())
{
    $options['info_actions'] = array('recall' => 'view', 'revert' => 'revert');
    $options['title'] = '<h3>' . sprintf(_("Old Revisions of the %s"), _html_escape($formatter->page->name)) . '</h3>';
    $out = $formatter->macro_repl('Info', '', $options);
    return $out;
}
开发者ID:ahastudio,项目名称:moniwiki,代码行数:7,代码来源:revert.php

示例3: macro_PageHits

function macro_PageHits($formatter = "", $value)
{
    global $DBInfo;
    if (!$DBInfo->use_counter) {
        return "[[PageHits is not activated. set \$use_counter=1; in the config.php]]";
    }
    $pages = $DBInfo->getPageLists();
    sort($pages);
    $hits = array();
    foreach ($pages as $page) {
        $hits[$page] = $DBInfo->counter->pageCounter($page);
    }
    if (!empty($value) and ($value == 'reverse' or $value[0] == 'r')) {
        asort($hits);
    } else {
        arsort($hits);
    }
    $out = '';
    while (list($name, $hit) = each($hits)) {
        if (!$hit) {
            $hit = 0;
        }
        $name = $formatter->link_tag(_rawurlencode($name), "", _html_escape($name));
        $out .= "<li>{$name} . . . . [{$hit}]</li>\n";
    }
    return "<ol>\n" . $out . "</ol>\n";
}
开发者ID:reviforks,项目名称:moniwiki,代码行数:27,代码来源:PageHits.php

示例4: macro_PageLinks

function macro_PageLinks($formatter, $options = "")
{
    global $DBInfo;
    $pages = $DBInfo->getPageLists();
    $pagelinks = $formatter->pagelinks;
    // save
    $save = $formatter->sister_on;
    $formatter->sister_on = 0;
    $out = "<ul>\n";
    $cache = new Cache_text("pagelinks");
    foreach ($pages as $page) {
        $lnks = $cache->fetch($page);
        if ($lnks !== false) {
            $out .= "<li>" . $formatter->link_tag($page, '', _html_escape($page)) . ": ";
            $links = implode(' ', $lnks);
            $links = preg_replace_callback("/(" . $formatter->wordrule . ")/", array(&$formatter, 'link_repl'), $links);
            $out .= $links . "</li>\n";
        }
    }
    $out .= "</ul>\n";
    $formatter->pagelinks = $pagelinks;
    // restore
    $formatter->sister_on = $save;
    return $out;
}
开发者ID:reviforks,项目名称:moniwiki,代码行数:25,代码来源:PageLinks.php

示例5: macro_InputForm

function macro_InputForm($formatter, $value, $options = array())
{
    $out = '';
    $type = 'select';
    $name = 'val[]';
    if (empty($value)) {
        return "</form>\n";
    }
    if (strpos($value, ':') !== false) {
        list($type, $value) = explode(':', $value, 2);
    }
    if (!in_array($type, array('form', 'select', 'input', 'submit', 'checkbox', 'radio'))) {
        $type = 'select';
    }
    $myname = $name;
    $val = _html_escale($value);
    switch ($type) {
        case 'form':
            #list($method,$action,$dum)=explode(':',$value);
            $tmp = explode(':', $value);
            $method = $tmp[0];
            $action = $tmp[1];
            $method = in_array(strtolower($method), array('post', 'get')) ? $method : 'get';
            $url = $formatter->link_url($formatter->page->urlname);
            $out = "<form method='{$method}' action='{$url}'>\n" . "<input type='hidden' name='action' value='{$action}' />\n";
            break;
        case 'submit':
            $out .= "<input type='{$type}' name='{$name}' value=\"{$val}\" />\n";
            break;
        case 'input':
            list($myname, $size, $value) = explode(':', $value, 3);
            $size = $size ? "size='{$size}'" : '';
            $out .= "<input type='{$type}' {$size}name='{$myname}' value=\"{$val}\" />\n";
            break;
        case 'select':
        default:
            list($myname, $value) = explode(':', $value);
            $list = explode(',', $value);
            $out .= '<option>----</option>' . "\n";
            foreach ($list as $l) {
                $l = _html_escape(trim($l));
                if (($p = strrpos($l, ' ')) !== false and substr($l, $p + 1) == 1) {
                    $check = ' selected="selected"';
                    $l = substr($l, 0, -1);
                } else {
                    $check = '';
                }
                $out .= "<option value=\"" . $l . "\"{$check}>" . _($l) . "</option>\n";
            }
            $out = "<select name='{$myname}'>" . $out . "</select>\n";
            break;
    }
    return $out;
}
开发者ID:ahastudio,项目名称:moniwiki,代码行数:54,代码来源:InputForm.php

示例6: macro_PageHits

function macro_PageHits($formatter, $value = '', $params = array())
{
    global $DBInfo, $Config;
    if (empty($Config['use_counter'])) {
        return "[[PageHits is not activated. set \$use_counter=1; in the config.php]]";
    }
    $perpage = !empty($Config['counter_per_page']) ? intval($Config['counter_per_page']) : 200;
    if (!empty($params['p'])) {
        $p = intval($params['p']);
    } else {
        $p = 0;
    }
    if ($p < 0) {
        $p = 0;
    }
    $hits = $DBInfo->counter->getPageHits($perpage, $p);
    if (!empty($value) and ($value == 'reverse' or $value[0] == 'r')) {
        asort($hits);
    } else {
        arsort($hits);
    }
    $out = '';
    while (list($name, $hit) = each($hits)) {
        if (!$hit) {
            $hit = 0;
        }
        $name = $formatter->link_tag(_rawurlencode($name), "", _html_escape($name));
        $out .= "<li>{$name} . . . . [{$hit}]</li>\n";
    }
    $start = $perpage * $p;
    if ($start > 0) {
        $start = ' start="' . $start . '"';
    } else {
        $start = '';
    }
    $out = "<ol{$start}>\n" . $out . "</ol>\n";
    $prev = '';
    $next = '';
    if ($p > 0) {
        $prev = $formatter->link_tag($formatter->page->urlname, '?action=pagehits&amp;p=' . ($p - 1), _("&#171; Prev"));
    }
    $p++;
    if (count($hits) >= 0) {
        $next = $formatter->link_tag($formatter->page->urlname, '?action=pagehits&amp;p=' . $p, _("Next &#187;"));
    }
    return $out . $prev . ' ' . $next;
}
开发者ID:ahastudio,项目名称:moniwiki,代码行数:47,代码来源:PageHits.php

示例7: do_post_fixbacklinks

function do_post_fixbacklinks($formatter, $options = array())
{
    global $DBInfo;
    if ($_SERVER['REQUEST_METHOD'] == 'POST' && !$DBInfo->security->writable($options)) {
        $options['title'] = _("Page is not writable");
        return do_invalid($formatter, $options);
    }
    $options['name'] = trim($options['name']);
    $new = $options['name'];
    if (!empty($DBInfo->use_namespace) and $new[0] == '~' and ($p = strpos($new, '/')) !== false) {
        // Namespace renaming ~foo/bar -> foo~bar
        $dummy = substr($new, 1, $p - 1);
        $dummy2 = substr($new, $p + 1);
        $options['name'] = $dummy . '~' . $dummy2;
    }
    if (isset($options['name'][0]) and $options['name']) {
        if ($DBInfo->hasPage($options['name'])) {
            $formatter->send_header('', $options);
            $new_encodedname = _rawurlencode($options['name']);
            $fixed = 0;
            $msg = '';
            $title = sprintf(_("backlinks of \"%s\" page are fixed !"), $options['page']);
            $comment = sprintf(_("Fixed \"%s\" to \"%s\""), $options['page'], $options['name']);
            if ($options['pagenames'] and is_array($options['pagenames'])) {
                $regex = preg_quote($options['page']);
                //$options['minor'] = 1; # disable log
                foreach ($options['pagenames'] as $page) {
                    $p = new WikiPage($page);
                    if (!$p->exists()) {
                        continue;
                    }
                    $f = new Formatter($p);
                    $body = $p->_get_raw_body();
                    $nbody = preg_replace("/{$regex}/m", $options['name'], $body);
                    // FIXME
                    if ($nbody !== false && $body != $nbody) {
                        $f->page->write($nbody);
                        if (!$options['show_only']) {
                            $DBInfo->savePage($f->page, $comment, $options);
                        }
                        $msg .= sprintf(_("'%s' is changed"), $f->link_tag(_rawurlencode($page), "?action=highlight&amp;value=" . $new_encodedname, _html_escape($page))) . "<br />";
                        $fixed++;
                    }
                }
            }
            if ($fixed == 0) {
                $title = _("No pages are fixed!");
            }
            $formatter->send_title($title, '', $options);
            if ($fixed > 0) {
                print $msg;
                print sprintf(_("'%s' links are successfully fixed as '%s'."), _html_escape($options['page']), $formatter->link_tag($new_encodedname, "?action=highlight&amp;value=" . $new_encodedname, _html_escape($options['name'])));
            }
            $formatter->send_footer('', $options);
            return;
        } else {
            $title = sprintf(_("Fail to fix backlinks of \"%s\" !"), $options['page']);
            $options['msg'] = sprintf(_("New pagename \"%s\" is not exists!"), $options['name']);
            $formatter->send_header('', $options);
            $formatter->send_title($title, '', $options);
            $formatter->send_footer('', $options);
            return;
        }
    }
    $title = sprintf(_("Fix backlinks of \"%s\" ?"), $options['page']);
    $formatter->send_header('', $options);
    $formatter->send_title($title, '', $options);
    $obtn = _("Old name:");
    $nbtn = _("New name:");
    $pgname = _html_escape($options['page']);
    print "<form method='post'>\n        <table border='0'>\n        <tr><td align='right'>{$obtn} </td><td><b>{$pgname}</b></td></tr>\n        <tr><td align='right'>{$nbtn} </td><td><input name='name' /></td></tr>\n";
    if (!empty($options['value']) and $options['value'] == 'check_backlinks') {
        $button = _("Fix backlinks");
        print "<tr><td colspan='2'>\n";
        print check_backlinks($formatter, $options);
        print "</td></tr>\n";
    } else {
        $button = _("Check backlinks");
    }
    if ($DBInfo->security->is_protected("fixbacklinks", $options)) {
        print "<tr><td align='right'>" . _("Password") . ": </td><td><input type='password' name='passwd' /> " . _("Only WikiMaster can fix backlinks of this page") . "</td></tr>\n";
    }
    if (!empty($options['value']) and $options['value'] == 'check_backlinks') {
        print "<tr><td colspan='2'><input type='checkbox' name='show_only' checked='checked' />" . _("show only") . "</td></tr>\n";
    }
    print "<tr><td></td><td><input type='submit' name='button_fixbacklinks' value='{$button}' />";
    print "<input type='hidden' name='value' value='check_backlinks' />";
    print "</td></tr>\n";
    print "\n        </table>\n        <input type='hidden' name='action' value='fixbacklinks' />\n        </form>";
    $formatter->send_footer('', $options);
}
开发者ID:ahastudio,项目名称:moniwiki,代码行数:91,代码来源:fixbacklinks.php

示例8: macro_UploadedFiles


//.........这里部分代码省略.........
                            continue;
                        }
                        if (is_dir($pre1 . '/' . $d1)) {
                            $ndirs[] = $d1;
                        }
                    }
                    closedir($hd);
                }
            }
            closedir($handle);
        }
        $dirs = $ndirs;
        sort($dirs);
    }
    // count dirs
    $didx = 0;
    if (count($dirs)) {
        $out .= "<tr>";
        $didx++;
    }
    foreach ($dirs as $file) {
        $link = $formatter->link_url($file, "?action=uploadedfiles{$extra}", $file, $attr);
        $key = $DBInfo->pageToKeyname($file);
        // support hashed upload_dir
        $pre = '';
        if (!empty($DBInfo->use_hashed_upload_dir)) {
            $pre = get_hashed_prefix($key);
            if (!is_dir($dir . '/' . $pre . $key)) {
                $pre = '';
            }
        }
        $dirname = $dir . '/' . $pre . $key;
        $date = date("Y-m-d", filemtime($dirname));
        $file = _html_escape($file);
        if ($use_admin) {
            $out .= "<td class='wiki'><input type='{$checkbox}' name='files[{$idx}]' value=\"{$file}\" /></td>";
        }
        $out .= "<td class='wiki'><a href='{$link}'>{$file}/</a></td>";
        if ($use_fileinfo) {
            $out .= "<td align='right' class='wiki'>&nbsp;</td><td class='wiki'>{$date}</td>";
        }
        if ($didx % $col == 0) {
            $out .= "</tr>\n<tr>\n";
        }
        $idx++;
        $didx++;
    }
    if (isset($value[0]) and $value != 'UploadFile') {
        if ($js_tag) {
            #$attr=' target="_blank"';
            $extra = '&amp;popup=1&amp;tag=1';
        }
        if (!empty($options['needle'])) {
            $extra .= '&amp;q=' . $options['needle'];
        }
        $link = $formatter->link_tag('UploadFile', "?action=uploadedfiles&amp;value=top{$extra}", "<img src='" . $icon_dir . "/32/up.png' style='border:0' class='upper' alt='..' />", $attr);
        $out .= "<tr>";
        if ($use_admin) {
            $out .= "<td class='wiki'>&nbsp;</td>";
        }
        $out .= "<td class='wiki'>{$link}</td>";
        if ($use_fileinfo) {
            $date = date("Y-m-d", filemtime($dir . "/.."));
            $out .= "<td align='right' class='wiki'>&nbsp;</td><td class='wiki'>{$date}</td>";
        }
        if ($didx % $col == 0) {
开发者ID:sedrion,项目名称:moniwiki,代码行数:67,代码来源:UploadedFiles.php

示例9: macro_GoTo

function macro_GoTo($formatter = "", $value = "")
{
    $url = $formatter->link_url($formatter->page->urlname);
    $value = _html_escape($value);
    $msg = _("Go");
    return "<form method='get' action='{$url}'>\n    <input type='hidden' name='action' value='goto' />\n    <input name='value' size='30' value=\"{$value}\" />\n    <span class='button'><input type='submit' class='button' value='{$msg}' /></span>\n    </form>";
}
开发者ID:reviforks,项目名称:moniwiki,代码行数:7,代码来源:wikilib.php

示例10: macro_BBS


//.........这里部分代码省略.........
            if (preg_match('/^attachment:([^\\?]+)(\\?.*)?$/', $attachs[0], $m)) {
                $img = $formatter->macro_repl('Attachment', $m[1] . '?thumbwidth=100');
            }
            $subject = $formatter->link_tag($bpage, "?no={$nid}", $metas['Subject']);
        }
        $out = "<div class='simpleView'><table>\n" . "<tr><td class='img'>" . $img . "</td><td class='subject'>" . $subject . '</td></tr>' . "<tr><td colspan='2'></td>\n</tr></table></div>";
        return $out;
    }
    foreach ($nids as $nid) {
        if (!$nid or !$MyBBS->hasPage($nid)) {
            continue;
        }
        $fields = array('Name', 'Subject', 'Date', 'Email', 'HomePage', 'IP', 'Keywords');
        include_once 'lib/metadata.php';
        #Name: wkpark
        #Subject: Oh well
        #Date: 2006-04-29 42:04:39
        #Email: wkpark@gmail.com
        #HomePage:
        #IP: 2xx.xxx.xxx.x
        $body = $MyBBS->getPage($nid);
        if ($body != null) {
            $options['nosisters'] = 1;
            $MyBBS->counter->incCounter($nid, $options);
            list($metas, $body) = _get_metadata($body);
            $boundary = strtoupper(md5("COMMENT"));
            # XXX
            $copy = $body;
            list($comment, $copy) = explode("----" . $boundary . "\n", $copy, 2);
            while (!empty($comment)) {
                list($comment, $copy) = explode("----" . $boundary . "\n", $copy, 2);
                if (preg_match('/^Comment-Id:\\s*(\\d+)/i', $comment, $m)) {
                    list($myhead, $my) = explode("\n\n", $comment, 2);
                    $hidden .= '<pre style="display:none;" id="comment_text_' . $m[1] . '">' . _html_escape($my) . '</pre>';
                }
            }
            ob_start();
            # add some basic rule/repl for bts
            $rule = "/-{4}(?:" . $boundary . ")?\nComment-Id:\\s*(\\d+)\n" . "From:\\s*([^\n]+)\nDate:\\s*([^\n]+)\n\n/im";
            $repl = "----\n'''Comment-Id:''' [#c\\1][#c\\1 #\\1] by \\2 on [[DateTime(\\3)]] [reply \\1]\n\n";
            $body = preg_replace($rule, $repl, $body);
            $formatter->quote_style = 'bbs-comment';
            $options['usemeta'] = 1;
            #
            $q_save = $formatter->self_query;
            $query = '?no=' . $nid . '&amp;p=' . $options['p'];
            $formatter->self_query = $query;
            $save = $formatter->preview;
            $formatter->preview = 1;
            $save_markup = $formatter->format;
            ob_start();
            if ($conf['default_markup']) {
                $formatter->pi['#format'] = $conf['default_markup'];
            }
            $formatter->send_page($body, $options);
            $body = ob_get_contents();
            ob_end_clean();
            $formatter->pi['#format'] = $save_markup;
            $formatter->self_query = $q_save;
            $msg .= "<div class='bbsArticle'>" . '<div class="head"><h2>' . _("No") . ' ' . $nid . ': ' . $metas['Subject'] . '</h2></div>' . '<div class="body">' . '<div class="extra"> @ ' . $metas['Date'] . ' (' . _mask_hostname($metas['IP'], 3) . ')</div>' . '<div class="user"><h3>' . $metas['Name'] . '</h3></div>' . '<div class="article">' . $body . "</div>\n</div>\n" . '<div class="foot"><div></div></div>' . "</div>\n";
            $snid = $nid;
            $btn['edit'] = $formatter->link_tag($bpage, "?action=bbs&amp;mode=edit&amp;no=" . $nid, '<span>' . _("Edit") . '</span>', 'class="button"');
            $btn['delete'] = $formatter->link_tag($bpage, "?action=bbs&amp;mode=delete&amp;no=" . $nid, '<span>' . _("Delete") . '</span>', 'class="button"');
            if ($narticle == 1 and $conf['use_comment']) {
                $opts['action'] = 'bbs';
                $opts['no'] = $nid;
开发者ID:ahastudio,项目名称:moniwiki,代码行数:67,代码来源:bbs.php

示例11: macro_FullSearch

function macro_FullSearch($formatter, $value = "", &$opts)
{
    global $DBInfo;
    $needle = $value;
    if ($value === true) {
        $needle = $value = $formatter->page->name;
        $options['noexpr'] = 1;
    } else {
        # for MoinMoin compatibility with [[FullSearch("blah blah")]]
        #$needle = preg_replace("/^('|\")([^\\1]*)\\1/","\\2",$value);
        $needle = $value;
    }
    // for pagination
    $offset = '';
    if (!empty($opts['offset']) and is_numeric($opts['offset'])) {
        if ($opts['offset'] > 0) {
            $offset = $opts['offset'];
        }
    }
    $url = $formatter->link_url($formatter->page->urlname);
    $fneedle = _html_escape($needle);
    $tooshort = !empty($DBInfo->fullsearch_tooshort) ? $DBInfo->fullsearch_tooshort : 2;
    $m1 = _("Display context of search results");
    $m2 = _("Search BackLinks only");
    $m3 = _("Case-sensitive searching");
    $msg = _("Go");
    $bchecked = !empty($DBInfo->use_backlinks) ? 'checked="checked"' : '';
    $form = <<<EOF
<form method='get' action='{$url}'>
   <input type='hidden' name='action' value='fullsearch' />
   <input name='value' size='30' value="{$fneedle}" />
   <span class='button'><input type='submit' class='button' value='{$msg}' /></span><br />
   <input type='checkbox' name='backlinks' value='1' {$bchecked} />{$m2}<br />
   <input type='checkbox' name='context' value='20' />{$m1}<br />
   <input type='checkbox' name='case' value='1' />{$m3}<br />
   </form>
EOF;
    if (!isset($needle[0]) or !empty($opts['form'])) {
        # or blah blah
        $opts['msg'] = _("No search text");
        return $form;
    }
    $opts['form'] = $form;
    # XXX
    $excl = array();
    $incl = array();
    if (!empty($opts['noexpr'])) {
        $tmp = preg_split("/\\s+/", $needle);
        $needle = $value = join('|', $tmp);
        $raw_needle = implode(' ', $tmp);
        $needle = preg_quote($needle);
    } else {
        if (empty($opts['backlinks'])) {
            $terms = preg_split('/((?<!\\S)[-+]?"[^"]+?"(?!\\S)|\\S+)/s', $needle, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
            $common_words = array('the', 'that', 'where', 'what', 'who', 'how', 'too', 'are');
            $common = array();
            foreach ($terms as $term) {
                if (trim($term) == '') {
                    continue;
                }
                if (preg_match('/^([-+]?)("?)([^\\2]+?)\\2$/', $term, $match)) {
                    $word = str_replace(array('\\', '.', '*'), '', $match[3]);
                    $len = strlen($word);
                    if (!$match[1] and $match[2] != '"') {
                        if ($len < $tooshort or in_array($word, $common_words)) {
                            $common[] = $word;
                            continue;
                        }
                    }
                    if ($match[1] == '-') {
                        $excl[] = $word;
                    } else {
                        $incl[] = $word;
                    }
                }
            }
            $needle = implode('|', $incl);
            $needle = _preg_search_escape($needle);
            $raw_needle = implode(' ', $incl);
            $test = validate_needle($needle);
            if ($test === false) {
                // invalid regex
                $tmp = array_map('preg_quote', $incl);
                $needle = implode('|', $tmp);
            }
            $excl_needle = implode('|', $excl);
            $test = validate_needle($excl_needle);
            if ($test2 === false) {
                // invalid regex
                $tmp = array_map('preg_quote', $excl);
                $excl_needle = implode('|', $tmp);
            }
        } else {
            $cneedle = _preg_search_escape($needle);
            $test = validate_needle($cneedle);
            if ($test === false) {
                $needle = preg_quote($needle);
            } else {
                $needle = $cneedle;
            }
//.........这里部分代码省略.........
开发者ID:reviforks,项目名称:moniwiki,代码行数:101,代码来源:FullSearch.php

示例12: macro_RecentChanges


//.........这里部分代码省略.........
            $via_proxy = true;
            $real_ip = substr($addr, 0, $p);
            $log_proxy = '<span class="via-proxy">' . $real_ip . '</span>';
            $log = isset($log[0]) ? $log_proxy . ' ' . $log : $log_proxy;
            $dum = explode(',', $addr);
            $addr = array_pop($dum);
        }
        //    if ($ed_time < $time_cutoff)
        //      break;
        $group = '';
        if ($formatter->group) {
            if (!preg_match("/^({$formatter->group})(.*)\$/", $page_name, $match)) {
                continue;
            }
            $title = $match[2];
        } else {
            if (!empty($formatter->use_group) and ($p = strpos($page_name, '~')) !== false) {
                $title = substr($page_name, $p + 1);
                $group = ' (' . substr($page_name, 0, $p) . ')';
            } else {
                $title = $page_name;
            }
        }
        if (!empty($changed_time_fmt)) {
            if (empty($timesago)) {
                $date = gmdate($changed_time_fmt, $ed_time + $tz_offset);
            } else {
                $date = _timesago($ed_time, 'Y-m-d', $tz_offset);
            }
        }
        $pageurl = _rawurlencode($page_name);
        // get title
        $title0 = get_title($title) . $group;
        $title0 = _html_escape($title0);
        if ($rctype == 'list') {
            $attr = '';
        } else {
            $attr = " id='title-{$ii}'";
        }
        if (!empty($strimwidth) and strlen(get_title($title)) > $strimwidth and function_exists('mb_strimwidth')) {
            $title0 = mb_strimwidth($title0, 0, $strimwidth, '...', $DBInfo->charset);
        }
        $attr .= ' title="' . $title0 . '"';
        $title = $formatter->link_tag($pageurl, "", $title0, $target . $attr);
        // simple list format
        if ($rctype == 'list') {
            if (empty($logs[$page_key])) {
                $logs[$page_key] = array();
            }
            $logs[$page_key][$day] = 1;
            if (!$DBInfo->hasPage($page_name)) {
                $act = 'DELETE';
                $title = '<strike>' . $title . '</strike>';
            }
            $list[$page_name] = array($title, $date, $ed_time, $act);
            continue;
        }
        // print $ed_time."/".$bookmark."//";
        $diff = '';
        $updated = '';
        if ($act == 'UPLOAD') {
            $icon = $formatter->link_tag($pageurl, "?action=uploadedfiles", $formatter->icon['attach']);
        } else {
            if (!$DBInfo->hasPage($page_name)) {
                $icon = $formatter->link_tag($pageurl, "?action=info", $formatter->icon['del']);
                if (!empty($use_js)) {
开发者ID:ahastudio,项目名称:moniwiki,代码行数:67,代码来源:RecentChanges.php

示例13: explode

if (!isset($_GET['username'])) {
    /*
     * Change this to reflect site settings
     */
    echo "<rss version=\"2.0\">\n        <channel><title>{$xerte_toolkits_site->name}</title>\n        <link>{$xerte_toolkits_site->site_url}</link>\n        <description>" . RSS_DESCRIPTION . " " . $xerte_toolkits_site->name . "</description>\n        <language>" . RSS_LANGUAGE . "</language>\n        <image><title>{$xerte_toolkits_site->name}</title>\n        <url>{$xerte_toolkits_site->site_url}website_code/images/xerteLogo.jpg</url>\n        <link>{$xerte_toolkits_site->site_url}</link></image>";
} else {
    $temp_array = explode("_", $_GET['username']);
    $query_created_by = "select login_id from {$xerte_toolkits_site->database_table_prefix}logindetails where (firstname=? AND surname = ?)";
    $rows = db_query($query_created_by, array($temp_array[0], $temp_array[1]));
    if (sizeof($rows) == 0) {
        header("HTTP/1.0 404 Not Found");
        exit(0);
    } else {
        $folder_string = 'public';
        if (isset($_GET['folder_name'])) {
            $folder_string = " - " . _html_escape(str_replace("_", " ", $_GET['folder_name']));
        }
        echo "<rss version=\"2.0\">\n        <channel><title>{$xerte_toolkits_site->name}</title>\n        <link>{$xerte_toolkits_site->site_url}</link>\n        <description>" . RSS_DESCRIPTION . " " . $xerte_toolkits_site->name . "</description>\n        <language>" . RSS_LANGUAGE . "</language>\n        <image><title>{$xerte_toolkits_site->name}</title>\n        <url>{$xerte_toolkits_site->site_url}website_code/images/xerteLogo.jpg</url>\n        <link>{$xerte_toolkits_site->site_url}</link></image>";
        $row_create = $rows[0];
    }
}
$params = array();
if (!isset($_GET['username'])) {
    $query = "select {$xerte_toolkits_site->database_table_prefix}templatedetails.template_id,creator_id,date_created,template_name,description \n        FROM {$xerte_toolkits_site->database_table_prefix}templatedetails, {$xerte_toolkits_site->database_table_prefix}templatesyndication \n        WHERE {$query_modifier}='true' AND {$xerte_toolkits_site->database_table_prefix}templatedetails.template_id = {$xerte_toolkits_site->database_table_prefix}templatesyndication.template_id";
} else {
    if (!isset($_GET['folder_name'])) {
        $query = "select {$xerte_toolkits_site->database_table_prefix}templatedetails.template_id,creator_id,date_created,template_name,description \n            FROM {$xerte_toolkits_site->database_table_prefix}templatedetails, {$xerte_toolkits_site->database_table_prefix}templatesyndication \n            WHERE {$query_modifier}='true' AND creator_id=? AND {$xerte_toolkits_site->database_table_prefix}templatedetails.template_id = {$xerte_toolkits_site->database_table_prefix}templatesyndication.template_id";
        $params[] = $row_create['login_id'];
    } else {
        $row_folder = db_query_one("SELECT folder_id FROM {$xerte_toolkits_site->database_table_prefix}folderdetails WHERE folder_name = ?", array(str_replace("_", " ", $_GET['folder_name'])));
        if (empty($row_folder)) {
开发者ID:virginiarcruz,项目名称:xerteonlinetoolkits,代码行数:31,代码来源:rss.php

示例14: do_userinfo

function do_userinfo($formatter, $options)
{
    global $DBInfo;
    $user =& $DBInfo->user;
    $min_ttl = !empty($DBInfo->user_suspend_time_default) ? intval($DBInfo->user_suspend_time_default) : 60 * 30;
    $formatter->send_header('', $options);
    $allowed = $DBInfo->security_class == 'acl' && $DBInfo->security->is_allowed($options['action'], $options);
    $ismember = $user->is_member;
    $suspend = !empty($options['suspend']) ? true : false;
    $pause = !empty($options['pause']) ? true : false;
    $comment_btn = !empty($options['comment_btn']) ? true : false;
    $comment = !empty($options['comment']) ? trim($options['comment']) : '';
    $uids = (array) $options['uid'];
    if ($user->id == 'Anonymous') {
        $myid = $_SERVER['REMOTE_ADDR'];
    } else {
        $myid = $user->id;
    }
    if (!$ismember && $allowed) {
        // not a member users
        $suspend = false;
        if (empty($comment)) {
            $comment_btn = false;
        } else {
            $comment_btn = true;
        }
        // a normal user can pause himself
        if (sizeof($uids) > 1 || $uids[0] != $myid) {
            $pause = false;
        }
        // reset type
        $options['type'] = '';
    }
    // cleanup comment
    $comment = strtr($comment, array("\n" => ' ', "\t" => ' '));
    $comment = _html_escape($comment);
    // FIXME only owners can delete/suspend users
    $can_delete_user = in_array($user->id, $DBInfo->owners);
    if ($allowed || $ismember) {
        if (isset($_POST) and empty($options['act']) and isset($options['uid'])) {
            $udb =& $DBInfo->udb;
            $type = !empty($options['type']) ? $options['type'] : '';
            if (!in_array($type, array('wait', 'del'))) {
                $type = '';
            }
            // normal user not allowed to suspend, delete user
            if (!$can_delete_user) {
                $suspend = false;
                $type = '';
            }
            $change = array();
            if ($can_delete_user and !$pause and !$comment_btn) {
                foreach ($uids as $uid) {
                    $uid = _stripslashes($uid);
                    if ($type == 'del' || $type == 'wait' || $suspend) {
                        $ret = $udb->activateUser($uid, $suspend);
                    } else {
                        $ret = $udb->delUser($uid);
                    }
                    if ($ret) {
                        $change[] = $uid;
                    }
                }
            } else {
                if ($comment_btn and !empty($comment)) {
                    $mb = new Cache_Text('msgboard');
                    foreach ($uids as $uid) {
                        $info = $mb->fetch($uid, 0);
                        $ttl = 0;
                        if ($info === false) {
                            $info = array();
                            $info['comment'] = '';
                        }
                        // add comment
                        if (!empty($comment)) {
                            // upate comments
                            $comments = array();
                            if (!empty($info['comment'])) {
                                $comments = explode("\n", $info['comment']);
                            }
                            $comments[] = date('Y-m-d H:i', time()) . "\t" . $myid . "\t" . $comment;
                            if ($uid == '127.0.0.1' and sizeof($comments) > 500) {
                                array_shift($comments);
                            } else {
                                if (sizeof($comments) > 1000) {
                                    array_shift($comments);
                                }
                            }
                            $info['comment'] = implode("\n", $comments);
                        }
                        $mb->update($uid, $info);
                        $change[] = $uid;
                    }
                } else {
                    if (!empty($uids) && $pause) {
                        // user can suspend temporary himself
                        if ($ismember || sizeof($uids) == 1 && $uid == $user->id) {
                            $change = $uids;
                        }
                    }
//.........这里部分代码省略.........
开发者ID:sedrion,项目名称:moniwiki,代码行数:101,代码来源:userinfo.php

示例15: macro_Comment

function macro_Comment($formatter, $value, $options = array())
{
    global $DBInfo;
    if (!empty($options['nocomment'])) {
        return '';
    }
    // set as dynamic macro or not.
    if ($formatter->_macrocache and empty($options['call'])) {
        return $formatter->macro_cache_repl('Comment', $value);
    }
    if (empty($options['call'])) {
        $formatter->_dynamic_macros['@Comment'] = 1;
    }
    $user = $DBInfo->user;
    # get from COOKIE VARS
    $options['id'] = $user->id;
    $use_any = 0;
    if (!empty($DBInfo->use_textbrowsers)) {
        if (is_string($DBInfo->use_textbrowsers)) {
            $use_any = preg_match('/' . $DBInfo->use_textbrowsers . '/', $_SERVER['HTTP_USER_AGENT']) ? 1 : 0;
        } else {
            $use_any = preg_match('/Lynx|w3m|links/', $_SERVER['HTTP_USER_AGENT']) ? 1 : 0;
        }
    }
    $captcha = '';
    if (empty($use_any) and !empty($DBInfo->use_ticket) and $options['id'] == 'Anonymous') {
        $seed = md5(base64_encode(time()));
        $ticketimg = $formatter->link_url($formatter->page->urlname, '?action=ticket&amp;__seed=' . $seed);
        $captcha = <<<EXTRA
  <div class='captcha'><span class='captchaImg'><img src="{$ticketimg}" alt="captcha" /></span><input type="text" size="10" name="check" />
<input type="hidden" name="__seed" value="{$seed}" /></div>
EXTRA;
    }
    $hidden = '';
    if (empty($options['page'])) {
        $options['page'] = $formatter->page->name;
    }
    if (empty($options['action']) || $options['action'] == 'show') {
        $action = 'comment';
    } else {
        $action = $options['action'];
    }
    if (!empty($options['mode'])) {
        $hidden .= "<input type='hidden' name='mode' value='" . $options['mode'] . "' />\n";
    }
    if (!empty($options['no'])) {
        $hidden .= "<input type='hidden' name='no' value='" . $options['no'] . "' />\n";
    }
    if (!empty($options['p'])) {
        $hidden .= "<input type='hidden' name='p' value='" . $options['p'] . "' />\n";
    }
    if ($value) {
        $args = explode(',', $value);
        if (in_array('usemeta', $args)) {
            $use_meta = 1;
        }
        if (in_array('oneliner', $args)) {
            $oneliner = 1;
        }
    }
    if (!empty($options['usemeta']) or !empty($use_meta)) {
        $hidden .= "<input type='hidden' name='usemeta' value='1' />\n";
    }
    if (!$DBInfo->security->writable($options)) {
        return '';
    }
    if (!empty($options['mid'])) {
        $mymid = $options['mid'];
    } else {
        $mymid = $formatter->mid;
    }
    $emid = base64_encode($mymid . ',Comment,' . $value);
    $mid = $mymid;
    $cols = get_textarea_cols();
    $rows = (!empty($options['rows']) and $options['rows'] > 5) ? $options['rows'] : 5;
    $cols = (!empty($options['cols']) and $options['cols'] > 60) ? $options['cols'] : $cols;
    if (!empty($options['datestamp'])) {
        $datestamp = $options['datestamp'];
    } else {
        $datestamp = $formatter->page->mtime();
    }
    $savetext = !empty($options['savetext']) ? $options['savetext'] : '';
    $savetext = str_replace(array("&", "<"), array("&amp;", "&lt;"), $savetext);
    $url = $formatter->link_url($formatter->page->urlname);
    if ($emid) {
        $hidden .= '<input type="hidden" name="comment_id" value="' . $emid . '" />';
    }
    $form = "<form id='editform' method='post' action='{$url}'>\n<div>";
    if (!empty($use_meta)) {
        $form .= "<a id='add_comment' name='add_comment'></a>";
    }
    $comment = _("Comment");
    $preview_btn = _("Preview");
    $preview = '';
    $savetext = _html_escape($savetext);
    if (!empty($oneliner)) {
        $form .= <<<FORM
<input class='wiki' size='{$cols}' name="savetext" value="{$savetext}" />&nbsp;
FORM;
    } else {
//.........这里部分代码省略.........
开发者ID:ahastudio,项目名称:moniwiki,代码行数:101,代码来源:Comment.php


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