示例#1
0
/**
 * make_backup
 * バックアップを作成する
 *
 * @access    public
 * @param     String    $page        ページ名
 * @param     Boolean   $delete      TRUE:バックアップを削除する
 *
 * @return    Void
 */
function make_backup($page, $delete = FALSE)
{
    global $cycle, $maxage;
    global $do_backup, $del_backup;
    // if (PKWK_READONLY || ! $do_backup) return;
    if (auth::check_role('readonly') || !$do_backup) {
        return;
    }
    if ($del_backup && $delete) {
        _backup_delete($page);
        return;
    }
    if (!is_page($page)) {
        return;
    }
    $lastmod = _backup_get_filetime($page);
    if ($lastmod == 0 || UTIME - $lastmod > 60 * 60 * $cycle) {
        $backups = get_backup($page);
        $count = count($backups) + 1;
        // 直後に1件追加するので、(最大件数 - 1)を超える要素を捨てる
        if ($count > $maxage) {
            array_splice($backups, 0, $count - $maxage);
        }
        $strout = '';
        foreach ($backups as $age => $data) {
            // BugTrack/685 by UPK
            //$strout .= PKWK_SPLITTER . ' ' . $data['time'] . "\n"; // Splitter format
            $strout .= PKWK_SPLITTER . ' ' . $data['time'] . ' ' . $data['real'] . "\n";
            // Splitter format
            $strout .= join('', $data['data']);
            unset($backups[$age]);
        }
        $strout = preg_replace("/([^\n])\n*\$/", "\$1\n", $strout);
        // Escape 'lines equal to PKWK_SPLITTER', by inserting a space
        $body = preg_replace('/^(' . preg_quote(PKWK_SPLITTER) . "\\s\\d+(\\s(\\d+)|))\$/", '$1 ', get_source($page));
        // BugTrack/685 by UPK
        // $body = PKWK_SPLITTER . ' ' . get_filetime($page) . "\n" . join('', $body);
        $body = PKWK_SPLITTER . ' ' . get_filetime($page) . ' ' . UTIME . "\n" . join('', $body);
        $body = preg_replace("/\n*\$/", "\n", $body);
        $fp = _backup_fopen($page, 'wb') or die_message('Cannot open ' . htmlspecialchars(_backup_get_filename($page)) . '<br />Maybe permission is not writable or filename is too long');
        _backup_fputs($fp, $strout);
        _backup_fputs($fp, $body);
        _backup_fclose($fp);
    }
}
示例#2
0
function plugin_lastmod_inline()
{
    global $vars;
    global $WikiName, $BracketName;
    $args = func_get_args();
    if ($args[0]) {
        if (preg_match("/^({$WikiName}|\\[\\[{$BracketName}\\]\\])\$/", $args[0])) {
            $_page = get_fullname(strip_bracket($args[0]), $vars["page"]);
        } else {
            return FALSE;
        }
    } else {
        $_page = $vars["page"];
    }
    if (!is_page($_page)) {
        return FALSE;
    }
    return format_date(get_filetime($_page));
}
示例#3
0
function plugin_lastmod_inline()
{
    global $vars, $WikiName, $BracketName;
    $args = func_get_args();
    $page = $args[0];
    if ($page == '') {
        $page = $vars['page'];
        // Default: page itself
    } else {
        if (preg_match("/^({$WikiName}|{$BracketName})\$/", strip_bracket($page))) {
            $page = get_fullname(strip_bracket($page), $vars['page']);
        } else {
            return false;
        }
    }
    if (!is_page($page)) {
        return false;
    }
    return format_date(get_filetime($page));
}
 /**
  * Get timestamp of a page
  *
  * @access public
  * @static
  * @param string $page
  * @return string
  */
 function timestamp($page)
 {
     return get_filetime($page);
 }
 function addRow($pagename, $rescan = FALSE)
 {
     // Generate/Regenerate regex if needed
     if ($this->_generate_regex() === FALSE) {
         return FALSE;
     }
     if (isset($this->_added[$pagename])) {
         return TRUE;
     }
     $this->_added[$pagename] = TRUE;
     $source = plugin_tracker_get_source($pagename, TRUE);
     if ($source === FALSE) {
         $source = '';
     }
     // Compat: 'move to [[page]]' (like bugtrack plugin)
     $matches = array();
     if (!$rescan && !empty($source) && preg_match('/move\\sto\\s(.+)/', $source, $matches)) {
         $to_page = strip_bracket(trim($matches[1]));
         if (is_page($to_page)) {
             unset($source, $matches);
             // Release
             return $this->addRow($to_page, TRUE);
             // Recurse(Rescan) once
         }
     }
     // Default column
     $filetime = get_filetime($pagename);
     $row = array('_page' => $pagename, '_real' => $pagename, '_update' => $filetime, '_past' => $filetime);
     // Load / Redefine cell
     $matches = array();
     if (preg_match($this->pattern, $source, $matches)) {
         array_shift($matches);
         // $matches[0] = all of the captured string
         foreach ($this->pattern_fields as $key => $fieldname) {
             $row[$fieldname] = trim($matches[$key]);
             unset($matches[$key]);
         }
         $this->rows[] = $row;
     } else {
         if (PLUGIN_TRACKER_LIST_SHOW_ERROR_PAGE) {
             $this->rows[] = $row;
             // Error
         }
     }
     return TRUE;
 }
示例#6
0
function plugin_new_inline()
{
    global $vars, $_plugin_new_elapses;
    $retval = '';
    $args = func_get_args();
    $date = strip_autolink(array_pop($args));
    // {date} always exists
    if ($date !== '') {
        // Show 'New!' message by the time of the $date string
        if (func_num_args() > 2) {
            return '&new([nodate]){date};';
        }
        $timestamp = strtotime($date);
        if ($timestamp === -1) {
            return '&new([nodate]){date}: Invalid date string;';
        }
        $timestamp -= ZONETIME;
        $retval = in_array('nodate', $args) ? '' : htmlsc($date);
    } else {
        // Show 'New!' message by the timestamp of the page
        if (func_num_args() > 3) {
            return '&new(pagename[,nolink]);';
        }
        $name = strip_bracket(!empty($args) ? array_shift($args) : $vars['page']);
        $page = get_fullname($name, $vars['page']);
        $nolink = in_array('nolink', $args);
        if (substr($page, -1) == '/') {
            // Check multiple pages started with "$page"
            $timestamp = 0;
            $regex = '/^' . preg_quote($page, '/') . '/';
            foreach (preg_grep($regex, get_existpages()) as $page) {
                // Get the latest pagename and its timestamp
                $_timestamp = get_filetime($page);
                if ($timestamp < $_timestamp) {
                    $timestamp = $_timestamp;
                    $retval = $nolink ? '' : make_pagelink($page);
                }
            }
            if ($timestamp == 0) {
                return '&new(pagename/[,nolink]): No such pages;';
            }
        } else {
            // Check a page
            if (is_page($page)) {
                $timestamp = get_filetime($page);
                $retval = $nolink ? '' : make_pagelink($page, $name);
            } else {
                return '&new(pagename[,nolink]): No such page;';
            }
        }
    }
    // Add 'New!' string by the elapsed time
    $erapse = UTIME - $timestamp;
    foreach ($_plugin_new_elapses as $limit => $tag) {
        if ($erapse <= $limit) {
            $retval .= sprintf($tag, get_passage($timestamp));
            break;
        }
    }
    if ($date !== '') {
        // Show a date string
        return sprintf(PLUGIN_NEW_DATE_FORMAT, $retval);
    } else {
        // Show a page name
        return $retval;
    }
}
<?php

if ($lastmodified) {
    $filetime = get_filetime($title);
    // refer lib/func.php#get_passage
    static $units = array('分' => 60, '時間' => 24, '日' => 1);
    $time = max(0, (UTIME - $filetime) / 60);
    // minutes
    foreach ($units as $unit => $card) {
        if ($time < $card) {
            break;
        }
        $time /= $card;
    }
    $time = floor($time);
    $pg_passage = $filetime != 0 ? $time . $unit . '前' : '';
    echo '<p id="last-modified">';
    if ($card == "60" && $time <= $fresh_time) {
        echo '今さっき更新 ';
    } elseif ($card == "1" && $time <= "2") {
        if ($time == "1") {
            echo '昨日更新';
        } elseif ($time == "2") {
            echo '一昨日更新';
        }
    } else {
        if ($pg_passage) {
            echo 'だいたい' . $pg_passage . 'に更新';
        } else {
            echo '今さっき更新';
        }
示例#8
0
function plugin_ls2_1_get_headings($page, &$params, $level = 1, $include = false, $prefix, $top_level = 1, &$pages)
{
    global $script;
    static $_ls2_anchor = 0;
    // すでにこのページの見出しを表示したかどうかのフラグ
    $is_done = isset($params["page_{$page}"]) && $params["page_{$page}"] > 0;
    if (!$is_done) {
        $params["page_{$page}"] = ++$_ls2_anchor;
    }
    $s_page = htmlspecialchars($page);
    $title = $s_page . ' ' . get_pg_passage($page, false);
    $r_page = rawurlencode($page);
    $href = $script . '?' . $r_page;
    // relative オプション。リンク名制御。
    if ($params['relative']) {
        // パターンの最後の / 以下を取り除く。例) sample/test/d -> sample/test
        // $prefix_dir = preg_replace('/[^\/]+$/','',$prefix);
        if (($pos = strrpos($prefix, '/')) !== false) {
            $prefix_dir = substr($prefix, 0, $pos + 1);
        }
        // ページ名からそのパターンをとり除く。
        // $s_page = ereg_replace("^$prefix_dir",'',$s_page);
        $s_page = substr($s_page, strlen($prefix_dir));
        // relative オプションと hierarchy オプションが同時に指定された場合は
        // パターンを取り除くだけでなく、上位の存在しているページ名も取り除く。
        if ($params['display'] == 'hierarchy') {
            $tmp = $s_page;
            // depth オプションが指定されていた場合 $top_level が変わります。
            while (substr_count($tmp, "/") > $top_level - 1) {
                // 一階層ずつとりのぞく
                if (($pos = strrpos($tmp, '/')) !== false) {
                    $tmp = substr($tmp, 0, $pos);
                }
                // 上位のページが存在していれば、その文字列を取り除き、相対名にする。
                if (in_array($prefix_dir . $tmp, $pages)) {
                    // $s_page = ereg_replace("^$tmp/",'',$s_page);
                    $s_page = substr($s_page, strlen("{$tmp}/"));
                    break;
                }
            }
        }
    }
    // date オプション。更新日時の追加。
    $date = '';
    if ($params['date']) {
        $date = format_date(get_filetime($page));
    }
    // new オプション。New! 表示の追加。
    $new = '';
    if ($params['new']) {
        global $_plugin_new_elapses;
        $timestamp = get_filetime($page) - LOCALZONE;
        $erapse = UTIME - $timestamp;
        foreach ($_plugin_new_elapses as $limit => $tag) {
            if ($erapse <= $limit) {
                $new .= sprintf($tag, get_passage($timestamp));
                break;
            }
        }
    }
    plugin_ls2_1_list_push($params, $level);
    // LI TAG. display オプションに依る。plugin_ls2_1_list_push にも。
    if ($params['display'] == 'inline') {
        $litag = '';
    } else {
        $litag = '<li>';
    }
    array_push($params['result'], $litag);
    // include されたページの場合
    if ($include) {
        $ret = 'include ';
    } else {
        $ret = '';
    }
    // すでに表示済みなら必ずファイル内探索処理はせずに抜ける
    if ($is_done) {
        $ret .= '<a href="' . $href . '" title="' . $title . '">' . $s_page . '</a> ';
        $ret .= '<a href="#list_' . $params["page_{$page}"] . '"><sup>&uarr;</sup></a>';
        array_push($params['result'], $ret);
        return;
    }
    $ret .= '<a id="list_' . $params["page_{$page}"] . '" href="' . $href . '" title="' . $title . '">' . $s_page . '</a>';
    if ($date != '') {
        $ret .= " {$date}";
    }
    if ($new != '') {
        $ret .= " {$new}";
    }
    array_push($params['result'], $ret);
    // title オプション、include オプション時はファイル内探索もする
    if ($params['title'] || $params['include']) {
        $anchor = PLUGIN_LS2_1_ANCHOR_ORIGIN;
        $matches = array();
        // 全体で title_number 個ではなく各ファイル単位で title_number 個
        $title_counter = 0;
        foreach (get_source($page) as $line) {
            if ($params['title'] && preg_match('/^(\\*{1,3})/', $line, $matches)) {
                if ($params['title_number']) {
                    // ただの件数制限なので途中で抜けても $anchor には不整合はでないはず
                    if ($title_counter >= $params['title_number']) {
                        if (!$params['include']) {
                            break;
                        } else {
                            continue;
                        }
                    }
                    $title_counter++;
                }
                // $line は 'remove footnotes and HTML tags' される。見出し行のアンカーが返されるが正直いらない。
                $id = make_heading($line);
                $hlevel = strlen($matches[1]);
                $id = PLUGIN_LS2_1_ANCHOR_PREFIX . $anchor++;
                plugin_ls2_1_list_push($params, $level + $hlevel);
                array_push($params['result'], $litag);
                array_push($params['result'], '<a href="' . $href . $id . '">' . $line . '</a>');
            } else {
                if ($params['include'] && preg_match('/^#include\\((.+)\\)/', $line, $matches) && is_page($matches[1])) {
                    plugin_ls2_1_get_headings($matches[1], $params, $level + $hlevel + 1, true, $prefix, $top_level, $pages);
                }
            }
        }
    }
}
示例#9
0
function plugin_backup_convert()
{
    global $vars, $script;
    //	global $_msg_backuplist, $_msg_diff, $_msg_nowdiff, $_msg_source, $_msg_nobackup;
    //	global $_title_backup_delete;
    $page = isset($vars['page']) ? $vars['page'] : '';
    check_readable($page, false);
    $_msg_backuplist = _('List of Backups');
    $_msg_diff = _('diff');
    $_msg_nowdiff = _('diff current');
    $_msg_source = _('source');
    $_msg_nobackup = _('There are no backup(s) of $1.');
    $_title_backup_delete = _('Deleting backup of $1');
    // Get arguments
    $with_label = TRUE;
    $args = func_get_args();
    while (isset($args[0])) {
        switch (array_shift($args)) {
            case 'default':
                $diff_mode = 0;
                break;
            case 'nowdiff':
                $diff_mode = 1;
                break;
            case 'visualdiff':
                $diff_mode = 2;
                break;
            case 'label':
                $with_label = TRUE;
                break;
            case 'nolabel':
                $with_label = FALSE;
                break;
        }
    }
    $r_page = rawurlencode($page);
    $s_page = htmlspecialchars($page);
    $retval = array();
    $date = get_date("m/d", get_filetime($page));
    if ($with_label) {
        $retval[0] = <<<EOD
<form class="center_form" action=""><div><label>Versions:
<select onchange="javascript:location.href=this[this.selectedIndex].value">

EOD;
        $retval[1] = "\n";
        $retval[2] = <<<EOD
</select></label></div>
</form>

EOD;
    } else {
        $retval[0] = <<<EOD
<form class="center_form" action=""><div>
<select onchange="javascript:location.href=this[this.selectedIndex].value">

EOD;
        $retval[1] = "\n";
        $retval[2] = <<<EOD
</select>
</div></form>

EOD;
    }
    $backups = _backup_file_exists($page) ? get_backup($page) : array();
    if (count($backups) == 0) {
        $retval[1] .= '<option value="' . get_page_uri($page) . '" selected="selected">' . _('->') . " {$date}(No.1)</option>\n";
        return join('', $retval);
    }
    $maxcnt = count($backups) + 1;
    $retval[1] .= '<option value="' . get_page_uri($page) . '" selected="selected">' . _('->') . " {$date}(No.{$maxcnt})</option>\n";
    $backups = array_reverse($backups, True);
    foreach ($backups as $age => $data) {
        $time = isset($data['real']) ? $data['real'] : $data['time'];
        $date = get_date('m/d', $time);
        $href = $script . '?cmd=backup&amp;page=' . $r_page . '&amp;age=' . $age;
        $retval[1] .= '<option value="' . $href;
        switch ($diff_mode) {
            case 2:
                $retval[1] .= '&amp;action=visualdiff';
                break;
            case 1:
                $retval[1] .= '&amp;action=nowdiff';
                break;
        }
        $retval[1] .= '">' . $date . ' (No.' . $age . ')</option>' . "\n";
    }
    return join('', $retval);
}
示例#10
0
/**
 * 'Search' main function
 *
 * @param string $word search word
 * @param enum $type 'AND' or 'OR'
 * @param boolean $non_format get the matched pages in array, not html
 * @param string $base search only pages whose prefixes are $base . '/' 
 * @return string|array the search result in html or the matched pages
 * @uses get_search_words
 * @uses get_existpages
 * @uses auth::check_role
 * @see search.inc.php
 * @global string script. PukiWiki Script URI. @see get_script_uri()
 * @global string whatsnew. RecentChanges
 * @global string non_list. ignore pages
 * @global string search_non_list. non_list for searching
 * @global boolean search_auth. search authorized pages, too
 * @global boolean show_passage. show time passage in the html result
 * @global boolean search_word_color. link pages which highlight search words
 * @global boolean ajax. use ajax to show search results in pages on mouse
 * @global array _string. messages
 */
function do_search($word, $type = 'AND', $non_format = FALSE, $base = '')
{
    global $script, $whatsnew, $non_list, $search_non_list, $search_auth, $show_passage, $search_word_color, $ajax, $_string;
    //	       $_msg_andresult, $_msg_orresult, $_msg_notfoundresult;
    $retval = array();
    $b_type = $type == 'AND';
    // AND:TRUE OR:FALSE
    $keys = get_search_words(preg_split('/\\s+/', $word, -1, PREG_SPLIT_NO_EMPTY));
    foreach ($keys as $key => $value) {
        $keys[$key] = '/' . $value . '/S';
    }
    $pages = get_existpages();
    // Avoid
    if ($base != '') {
        $pages = preg_grep('/^' . preg_quote($base, '/') . '/S', $pages);
    }
    if (!$search_non_list) {
        $pages = array_diff($pages, preg_grep('/' . $non_list . '/S', $pages));
    }
    $pages = array_flip($pages);
    unset($pages[$whatsnew]);
    // SAFE_MODE の場合は、コンテンツ管理者以上のみ、カテゴリページ(:)も検索可能
    $role_adm_contents = auth::check_role('safemode') ? auth::check_role('role_adm_contents') : FALSE;
    $count = count($pages);
    foreach (array_keys($pages) as $page) {
        $b_match = FALSE;
        // Search hidden for page name
        if (substr($page, 0, 1) == ':' && $role_adm_contents) {
            unset($pages[$page]);
            --$count;
            continue;
        }
        // Search for page name
        if (!$non_format) {
            foreach ($keys as $key) {
                $b_match = preg_match($key, $page);
                if ($b_type xor $b_match) {
                    break;
                }
                // OR
            }
            if ($b_match) {
                continue;
            }
        }
        // Search auth for page contents
        if ($search_auth && !check_readable($page, false, false)) {
            unset($pages[$page]);
            --$count;
            continue;
        }
        // Search for page contents
        foreach ($keys as $key) {
            $b_match = preg_match($key, get_source($page, TRUE, TRUE));
            if ($b_match xor $b_type) {
                break;
            }
            // OR
        }
        if ($b_match) {
            continue;
        }
        unset($pages[$page]);
        // Miss
    }
    unset($role_adm_contents);
    if ($non_format) {
        return array_keys($pages);
    }
    $r_word = rawurlencode($word);
    $s_word = htmlspecialchars($word);
    if (empty($pages)) {
        return str_replace('$1', $s_word, $_string['notfoundresult']);
    }
    ksort($pages);
    $retval = '<ul>' . "\n";
    foreach (array_keys($pages) as $page) {
        $r_page = rawurlencode($page);
        $s_page = htmlspecialchars($page);
        $passage = $show_passage ? ' ' . get_passage(get_filetime($page)) : '';
        if ($search_word_color) {
            $uri = $script . '?' . 'cmd=read&amp;page=' . $r_page . '&amp;word=' . $r_word;
            if ($ajax && UA_PROFILE == 'default') {
                $pre = $script . '?' . 'cmd=preview&amp;page=' . $r_page . '&amp;word=' . $r_word;
                $pre = ' onmouseover="showGlossaryPopup(' . "'" . $pre . "'" . ',event,0.2);" onmouseout="hideGlossaryPopup();"';
            } else {
                $pre = '';
            }
        } else {
            $uri = $script . '?' . $r_page;
            $pre = '';
        }
        $retval .= ' <li><a href="' . $uri . '"' . $pre . '>' . $s_page . '</a>' . $passage . '</li>' . "\n";
    }
    $retval .= '</ul>' . "\n";
    $retval .= str_replace('$1', $s_word, str_replace('$2', count($pages), str_replace('$3', $count, $b_type ? $_string['andresult'] : $_string['orresult'])));
    return $retval;
}
示例#11
0
文件: html.php 项目: big2men/qhm
function catbody($title, $page, $body)
{
    global $script, $script_ssl, $vars, $arg, $defaultpage, $whatsnew, $help_page, $hr;
    global $attach_link, $related_link, $cantedit, $function_freeze;
    global $search_word_color, $_msg_word, $foot_explain, $note_hr, $head_tags;
    global $trackback, $trackback_javascript, $referer, $javascript;
    global $nofollow, $non_list;
    global $_LANG, $_LINK, $_IMAGE;
    global $pkwk_dtd;
    // XHTML 1.1, XHTML1.0, HTML 4.01 Transitional...
    global $page_title;
    // Title of this site
    global $do_backup;
    // Do backup or not
    global $modifier;
    // Site administrator's  web page
    global $modifierlink;
    // Site administrator's name
    global $owneraddr;
    // Site owner address
    global $ownertel;
    // Site owner tel
    global $headcopy;
    // Site headcopy
    global $menuadmin;
    // Menu Administrate Page
    global $style_type, $style_name, $logo_image, $logo_header;
    global $keywords, $description, $accesstag, $ga_tracking_id, $killer_fg, $killer_bg, $noindex, $accesstag_moved;
    //for skin by hokuken
    global $qhm_adminmenu;
    // Site administration menu 20 JUN 2007
    global $custom_meta;
    // Insert meta tag for specific meta tag
    global $adcode;
    // AD code (exp. Google Adwords, Analytics ... )  25 JLY 2007 by hokuken.com
    global $nowindow;
    // Disable including external_link.js
    global $killer_page2;
    // for Killer page Design 2
    global $no_qhm_licence;
    // qhm licence
    global $include_skin_file_path;
    //orignal skin setting
    global $qhm_access_key;
    global $reg_exp_host;
    global $unload_confirm, $check_login;
    global $enable_wp_theme, $enable_wp_theme_name, $wp_add_css;
    //WordPress用のテーマ
    global $mobile_redirect, $googlemaps_apikey;
    global $other_plugins, $other_plugin_categories;
    global $default_script, $init_scripts;
    global $enable_smart_style, $smart_name;
    // smart phone
    global $is_update;
    global $enable_fitvids;
    // body部分以外は、元々の$script を使う(通常のリンク設定)を使う
    // 結果、$body内は、script_sslを使ったリンクになるが、ナビ、メニューなどは、元の$scriptを必ず使う
    $script = $init_scripts['normal'];
    $script_ssl = $init_scripts['ssl'];
    if (!file_exists(SKIN_FILE) || !is_readable(SKIN_FILE)) {
        die_message('SKIN_FILE is not found');
    }
    $_LINK = $_IMAGE = array();
    // Add JavaScript header when ...
    if ($trackback && $trackback_javascript) {
        $javascript = 1;
    }
    // Set something If you want
    if (!PKWK_ALLOW_JAVASCRIPT) {
        unset($javascript);
    }
    $_page = isset($vars['page']) ? $vars['page'] : '';
    $r_page = rawurlencode($_page);
    //QHM Template
    $qt = get_qt();
    if (!$qt->set_page) {
        $qt->set_page($_page);
    }
    //QHM Messages
    $qm = get_qm();
    // Set $_LINK for skin
    $_LINK['add'] = "{$script}?cmd=add&amp;page={$r_page}";
    $_LINK['backup'] = "{$script}?cmd=backup&amp;page={$r_page}";
    $_LINK['copy'] = "{$script}?plugin=template&amp;refer={$r_page}";
    $_LINK['diff'] = "{$script}?cmd=diff&amp;page={$r_page}";
    $_LINK['edit'] = "{$script}?cmd=edit&amp;page={$r_page}";
    $_LINK['filelist'] = "{$script}?cmd=filelist";
    $_LINK['freeze'] = "{$script}?cmd=freeze&amp;page={$r_page}";
    $_LINK['help'] = "{$script}?" . rawurlencode($help_page);
    $_LINK['list'] = "{$script}?cmd=list";
    $_LINK['new'] = "{$script}?plugin=newpage&amp;refer={$r_page}";
    $_LINK['rdf'] = "{$script}?cmd=rss&amp;ver=1.0";
    $_LINK['recent'] = "{$script}?" . rawurlencode($whatsnew);
    $_LINK['refer'] = "{$script}?plugin=referer&amp;page={$r_page}";
    $_LINK['reload'] = "{$script}?{$r_page}";
    $_LINK['rename'] = "{$script}?plugin=rename&amp;refer={$r_page}";
    $_LINK['delete'] = "{$script}?plugin=delete&amp;page={$r_page}";
    $_LINK['rss'] = "{$script}?cmd=rss";
    $_LINK['rss10'] = "{$script}?cmd=rss&amp;ver=1.0";
    // Same as 'rdf'
    $_LINK['rss20'] = "{$script}?cmd=rss&amp;ver=2.0";
    $_LINK['search'] = "{$script}?cmd=search";
    $_LINK['top'] = dirname($script . 'dummy.php') . '/';
    if ($trackback) {
        $tb_id = tb_get_id($_page);
        $_LINK['trackback'] = "{$script}?plugin=tb&amp;__mode=view&amp;tb_id={$tb_id}";
    }
    $_LINK['unfreeze'] = "{$script}?cmd=unfreeze&amp;page={$r_page}";
    $_LINK['upload'] = "{$script}?plugin=attach&amp;pcmd=upload&amp;page={$r_page}";
    $_LINK['menuadmin'] = "{$script}?" . rawurlencode($menuadmin);
    //Hokuken.com original
    $_LINK['qhm_adminmenu'] = qhm_get_script_path() . "?cmd=qhmauth";
    $_LINK['qhm_logout'] = "{$script}?cmd=qhmlogout";
    $_LINK['qhm_setting'] = "{$script}?cmd=qhmsetting";
    $_LINK['edit_menu'] = "{$script}?cmd=edit&amp;page=MenuBar";
    $_LINK['edit_menu2'] = "{$script}?cmd=edit&amp;page=MenuBar2";
    $_LINK['edit_navi'] = "{$script}?cmd=edit&amp;page=SiteNavigator";
    $_LINK['edit_navi2'] = "{$script}?cmd=edit&amp;page=SiteNavigator2";
    $_LINK['edit_header'] = "{$script}?cmd=edit&amp;page=SiteHeader";
    $_LINK['yetlist'] = "{$script}?cmd=yetlist";
    // Compat: Skins for 1.4.4 and before
    $link_add =& $_LINK['add'];
    $link_new =& $_LINK['new'];
    // New!
    $link_edit =& $_LINK['edit'];
    $link_diff =& $_LINK['diff'];
    $link_top =& $_LINK['top'];
    $link_list =& $_LINK['list'];
    $link_filelist =& $_LINK['filelist'];
    $link_search =& $_LINK['search'];
    $link_whatsnew =& $_LINK['recent'];
    $link_backup =& $_LINK['backup'];
    $link_help =& $_LINK['help'];
    $link_trackback =& $_LINK['trackback'];
    // New!
    $link_rdf =& $_LINK['rdf'];
    // New!
    $link_rss =& $_LINK['rss'];
    $link_rss10 =& $_LINK['rss10'];
    // New!
    $link_rss20 =& $_LINK['rss20'];
    // New!
    $link_freeze =& $_LINK['freeze'];
    $link_unfreeze =& $_LINK['unfreeze'];
    $link_upload =& $_LINK['upload'];
    $link_template =& $_LINK['copy'];
    $link_refer =& $_LINK['refer'];
    // New!
    $link_rename =& $_LINK['rename'];
    $link_delete =& $_LINK['delete'];
    $link_menuadmin =& $_LINK['menuadmin'];
    //Hokuken.com original
    $link_copy =& $_LINK['copy'];
    $link_qhm_adminmenu =& $_LINK['qhm_adminmenu'];
    //Hokuken.com original
    $link_qhm_logout =& $_LINK['qhm_logout'];
    //Hokuken.com original
    $link_qhm_setting =& $_LINK['qhm_setting'];
    //Hokuken.com original
    $link_edit_menu =& $_LINK['edit_menu'];
    //Hokuken.com original
    $link_edit_menu2 =& $_LINK['edit_menu2'];
    $link_edit_navi =& $_LINK['edit_navi'];
    //Hokuken.com original
    $link_edit_navi2 =& $_LINK['edit_navi2'];
    //Hokuken.com original
    $link_edit_header =& $_LINK['edit_header'];
    //Hokuken.com original
    $link_yetlist =& $_LINK['yetlist'];
    //Hokuken.com original
    // Init flags
    $is_page = is_pagename($_page) && $_page != $whatsnew;
    $is_read = arg_check('read') && is_page($_page);
    $is_freeze = is_freeze($_page);
    // Last modification date (string) of the page
    $lastmodified = $is_read ? format_date(get_filetime($_page)) . ' ' . get_pg_passage($_page, FALSE) : '';
    // List of attached files to the page
    $attaches = $attach_link && $is_read && exist_plugin_action('attach') ? attach_filelist() : '';
    // List of related pages
    $related = $related_link && $is_read ? make_related($_page) : '';
    // List of footnotes
    ksort($foot_explain, SORT_NUMERIC);
    $notes = !empty($foot_explain) ? $note_hr . join("\n", $foot_explain) : '';
    // Tags will be inserted into <head></head>
    $head_tag = !empty($head_tags) ? join("\n", $head_tags) . "\n" : '';
    // 1.3.x compat
    // Last modification date (UNIX timestamp) of the page
    $fmt = $is_read ? get_filetime($_page) + LOCALZONE : 0;
    // Search words
    if ($search_word_color && isset($vars['word'])) {
        $body = '<div class="small">' . $_msg_word . htmlspecialchars($vars['word']) . '</div>' . $hr . "\n" . $body;
        // BugTrack2/106: Only variables can be passed by reference from PHP 5.0.5
        // with array_splice(), array_flip()
        $words = preg_split('/\\s+/', $vars['word'], -1, PREG_SPLIT_NO_EMPTY);
        $words = array_splice($words, 0, 10);
        // Max: 10 words
        $words = array_flip($words);
        $keys = array();
        foreach ($words as $word => $id) {
            $keys[$word] = strlen($word);
        }
        arsort($keys, SORT_NUMERIC);
        $keys = get_search_words(array_keys($keys), TRUE);
        $id = 0;
        foreach ($keys as $key => $pattern) {
            $s_key = htmlspecialchars($key);
            $pattern = '/' . '<textarea[^>]*>.*?<\\/textarea>' . '|' . '<[^>]*>' . '|' . '&[^;]+;' . '|' . '(' . $pattern . ')' . '/sS';
            $decorate_Nth_word = create_function('$matches', 'return (isset($matches[1])) ? ' . '\'<strong class="word' . $id . '">\' . $matches[1] . \'</strong>\' : ' . '$matches[0];');
            $body = preg_replace_callback($pattern, $decorate_Nth_word, $body);
            $notes = preg_replace_callback($pattern, $decorate_Nth_word, $notes);
            ++$id;
        }
    }
    //-----------------------------------------------------------------------
    //
    // customized by hokuken for QHM (2009/1/28)
    //
    //-----------------------------------------------------------------------
    //----------------- 携帯の場合の処理 --------------------------------------
    if (preg_match('/keitai.skin.php$/', SKIN_FILE)) {
        require LIB_DIR . 'qhm_init.php';
        require LIB_DIR . 'qhm_init_main.php';
        require SKIN_FILE;
        return;
    }
    //------------------- IF UA is mobile, end here -----------------------
    //---------- KILLERPAGE: でもKILLERPAGE2:に統合 いつか消したい --------------
    if ($killer_fg != '') {
        //load common setting and output header
        require LIB_DIR . 'qhm_init.php';
        $killer_page2['fg'] = $killer_fg;
        $killer_page2['bg'] = $killer_bg;
        $killer_page2['width'] = 700;
        $killer_page2['padding'] = 60;
        $killer_page2['bg_body'] = '#fff';
        $killer_page2['fg_body'] = '#000';
        require LIB_DIR . 'qhm_init_killer.php';
        $longtaketime = getmicrotime() - MUTIME;
        $taketime = sprintf('%01.03f', $longtaketime);
        $qt->setv('taketime', $taketime);
    }
    //--------------------------- いつか消したい end here ----------------
    ///////////////////////////////////////////////////////////////////
    //
    // Main
    //
    //common setting
    require LIB_DIR . 'qhm_init.php';
    $qt->enable_cache = $qt->getv('editable') ? false : $qt->enable_cache;
    $qt->set_encode($shiftjis || $eucjp ? true : false);
    if ($shiftjis) {
        $output_encode = 'Shift_JIS';
    } else {
        if ($eucjp) {
            $output_encode = 'EUC-JP';
        } else {
            $output_encode = CONTENT_CHARSET;
        }
    }
    define('WORDPRESS_CHARSET', $output_encode);
    //output common header (available change encode)
    $qt->setv('meta_content_type', qhm_output_dtd($pkwk_dtd, CONTENT_CHARSET, $output_encode));
    //------- KILLERPAGE2: セールスレター型デザイン -------------------
    if (isset($killer_page2['fg']) != '') {
        require LIB_DIR . 'qhm_init_killer.php';
        //JQuery Include
        $jquery_script = '';
        $jquery_cookie_script = '';
        if ($qt->getv('jquery_include')) {
            $jquery_script = '<script type="text/javascript" src="js/jquery.js"></script>';
            $jquery_cookie_script = '<script type="text/javascript" src="js/jquery.cookie.js"></script>';
        }
        $bootstrap_style = $bootstrap_script = '';
        if ($qt->getv('bootstrap_script')) {
            $bootstrap_style = $qt->getv('bootstrap_style');
            $bootstrap_script = $qt->getv('bootstrap_script');
        }
        $qt->setv('jquery_script', $bootstrap_style . $jquery_script . $bootstrap_script);
        $qt->setv('jquery_cookie_script', $jquery_cookie_script);
        $longtaketime = getmicrotime() - MUTIME;
        $taketime = sprintf('%01.03f', $longtaketime);
        $qt->setv('taketime', $taketime);
        $qt->read('skin/killerpage2/pukiwiki.skin.php');
        return;
    }
    //-------------------------------------------------------------
    // ---- include main design skin file ----
    if (isset($_SESSION['temp_skin']) && strlen($_SESSION['temp_skin']) > 0) {
        $style_type = $_SESSION['temp_style_type'];
    }
    //pluginでデザインが指定されている場合
    if ($include_skin_file_path != '') {
        $style_name = $include_skin_file_path;
    }
    require LIB_DIR . 'qhm_init_main.php';
    // meta:GENERATOR
    $generator_tag = '<meta name="GENERATOR" content="Quick Homepage Maker; version=' . QHM_VERSION . '; haik=' . (is_bootstrap_skin() ? 'true' : 'false') . '" />' . "\n";
    $qt->prependv_once('generator_tag', 'beforescript', $generator_tag);
    //-------------------------------------------------
    // ogp タグを挿入
    //-------------------------------------------------
    if (exist_plugin('ogp')) {
        plugin_ogp_set_template($body);
    }
    //独自のテンプレートファイルをチェック
    $skin_file = SKIN_DIR . "{$style_name}/pukiwiki.skin.php";
    if ($qt->getv('layout_name')) {
        $layout_file = $qt->getv('layout_name') . '.skin.php';
        $layout_path = SKIN_DIR . "{$style_name}/{$layout_file}";
        if (file_exists($layout_path)) {
            $skin_file = $layout_path;
        }
    } else {
        $layout_prefix = 'content';
        if ($_page === $defaultpage) {
            $layout_prefix = 'default';
        } else {
            if (is_qblog()) {
                $layout_prefix = 'article';
            }
        }
        $layout_name = isset($style_config["{$layout_prefix}_layout"]) ? $style_config["{$layout_prefix}_layout"] : "";
        $layout_path = SKIN_DIR . "{$style_name}/{$layout_name}.skin.php";
        if (file_exists($layout_path)) {
            $skin_file = $layout_path;
        }
    }
    if (!file_exists($skin_file)) {
        $skin_file = SKIN_FILE;
        //デフォルトの位置
    }
    // Read design config for customize
    $style_config = read_skin_config($style_name);
    $skin_custom_vars = get_skin_custom_vars($style_name);
    $custom_css = make_custom_css($style_name);
    $qt->prependv('beforescript', $custom_css);
    if (isset($style_config['bootstrap']) && $style_config['bootstrap'] !== false) {
        $qt->setv('jquery_include', true);
    }
    // Default Eyecatch
    if (isset($skin_custom_vars['default_eyecatch']) && $skin_custom_vars['default_eyecatch'] && $qt->getv('main_visual') === '' && exist_plugin('eyecatch')) {
        $bg_image = $color = '';
        if (isset($skin_custom_vars['eyecatch_bgimage'])) {
            $bg_image = $skin_custom_vars['eyecatch_bgimage'];
            $bg_image = is_url($bg_image, TRUE, TRUE) || file_exists(get_file_path($bg_image)) ? $bg_image : '';
        }
        if (isset($skin_custom_vars['enable_eyecatch_bgimage']) && !$skin_custom_vars['enable_eyecatch_bgimage']) {
            $bg_image = '';
        }
        if (isset($skin_custom_vars['eyecatch_color'])) {
            $color = 'color=' . $skin_custom_vars['eyecatch_color'];
        }
        if (is_qblog()) {
            $title_copy = $qblog_title;
        } else {
            if (isset($skin_custom_vars['eyecatch_title_type']) && trim($skin_custom_vars['eyecatch_title_type']) == 'site') {
                $title_copy = $page_title;
            } else {
                if ($_page === $defaultpage) {
                    $title_copy = $page_title;
                } else {
                    $title_copy = get_page_title($_page);
                }
            }
        }
        $content = <<<EOD
! {$title_copy}
EOD;
        plugin_eyecatch_convert($bg_image, $color, '__default', $content);
    }
    if ($qt->getv('no_eyecatch')) {
        $qt->setv('main_visual', "<!-- no eyecatch -->");
    }
    // Determine emptiness of eyecatch
    $qt->setv('eyecatch_is_empty', $qt->getv('no_eyecatch') || $qt->getv('main_visual') === '');
    if (isset($skin_custom_vars['palette_color']) && trim($skin_custom_vars['palette_color'])) {
        $qt->setv('palette_color', trim($skin_custom_vars['palette_color']));
        $qt->setv('palette_color_class', 'haik-palette-' . trim($skin_custom_vars['palette_color']));
    }
    //JQuery Include
    $jquery_script = '';
    $jquery_cookie_script = '';
    if ($qt->getv('jquery_include')) {
        $jquery_script = '<script type="text/javascript" src="js/jquery.js"></script>';
        $jquery_cookie_script = '<script type="text/javascript" src="js/jquery.cookie.js"></script>';
    }
    if ($qt->getv('bootstrap_script')) {
        $bootstrap_script = $qt->getv('bootstrap_script');
    }
    $qt->setv('jquery_script', $jquery_script . $bootstrap_script);
    $qt->setv('jquery_cookie_script', $jquery_cookie_script);
    $longtaketime = getmicrotime() - MUTIME;
    $taketime = sprintf('%01.03f', $longtaketime);
    $qt->setv('taketime', $taketime);
    //UniversalAnalytics Tracking Code
    if ($code = $qt->getv('ga_universal_analytics')) {
        $qt->appendv('beforescript', $code);
    }
    //------------------------------------------------------------------
    // WordPressデザイン
    if ($enable_wp_theme && ($vars['cmd'] != 'qhmsetting' && $vars['plugin'] != 'qhmsetting')) {
        define('TEMPLATEPATH', 'skin/wordpress/' . $enable_wp_theme_name);
        include LIB_DIR . 'wp_adapter.php';
        wp_load_functions();
        $skin_file = get_wp_skin_file();
    }
    //-------------------------------------------------------------------
    //-------------------------------------------------------------------
    // 	プレビュー用のskinファイルを表示
    $tmpfilename = '';
    if (isset($_SESSION['temp_skin']) && strlen($_SESSION['temp_skin']) > 0) {
        $tmpfilename = $skin_file = tempnam(realpath(CACHEQHM_DIR), 'qhmdesign');
        file_put_contents($skin_file, $_SESSION['temp_skin']);
        $qt->setv('default_css', $bootstrap_css . $_SESSION['temp_css']);
        $qt->setv('style_path', $_SESSION['temp_style_path']);
    }
    //-------------------------------------------------------------------
    //skinファイルを読み込んで、表示
    $qt->read($skin_file, $_page);
    // 一時ファイルの削除
    if (file_exists($tmpfilename) && strpos(basename($tmpfilename), 'qhmdesign') === 0) {
        unlink($tmpfilename);
    }
}
示例#12
0
function catbody($title,$page,$body)
{
	global $script,$vars,$arg,$defaultpage,$whatsnew,$help_page,$hr;
	global $related_link,$cantedit,$function_freeze,$search_word_color,$_msg_word;
	global $foot_explain,$note_hr,$head_tags;
	
	global $html_transitional; // FALSE:XHTML1.1 TRUE:XHTML1.0 Transitional
	global $page_title;        // ホームページのタイトル
	global $do_backup;         // バックアップを行うかどうか
	global $modifier;          // 編集者のホームページ
	global $modifierlink;      // 編集者の名前

	$_page = $vars['page'];
	$r_page = rawurlencode($_page);
	
	$link_add      = "$script?cmd=add&amp;page=$r_page";
	$link_edit     = "$script?cmd=edit&amp;page=$r_page";
	$link_diff     = "$script?cmd=diff&amp;page=$r_page";
	$link_top      = "$script?".rawurlencode($defaultpage);
	$link_list     = "$script?cmd=list";
	$link_filelist = "$script?cmd=filelist";
	$link_search   = "$script?cmd=search";
	$link_whatsnew = "$script?".rawurlencode($whatsnew);
	$link_backup   = "$script?cmd=backup&amp;page=$r_page";
	$link_help     = "$script?".rawurlencode($help_page);
	$link_rss      = "$script?cmd=rss10";
	$link_freeze   = "$script?cmd=freeze&amp;page=$r_page";
	$link_unfreeze = "$script?cmd=unfreeze&amp;page=$r_page";
	$link_upload   = "$script?plugin=attach&amp;pcmd=upload&amp;page=$r_page";
	$link_template = "$script?plugin=template&amp;refer=$r_page";
	$link_rename   = "$script?plugin=rename&amp;refer=$r_page";
	
	// ページの表示時TRUE(バックアップの表示、RecentChangesの表示を除く)
	$is_page = (is_pagename($_page) and !arg_check('backup') and $_page != $whatsnew);
	
	// ページの読み出し時TRUE
	$is_read = (arg_check('read') and is_page($_page));
	
	// ページが凍結されているときTRUE
	$is_freeze = is_freeze($_page);
	
	// ページの最終更新時刻(文字列)
	$lastmodified = $is_read ?
		get_date('D, d M Y H:i:s T',get_filetime($_page)).' '.get_pg_passage($_page,FALSE) : '';
	
	// 関連するページのリスト
	$related = ($is_read and $related_link) ? make_related($_page) : '';
	
	// 添付ファイルのリスト
	$attaches = ($is_read and exist_plugin_action('attach')) ? attach_filelist() : '';
	
	// 注釈のリスト
	ksort($foot_explain,SORT_NUMERIC);
	$notes = count($foot_explain) ? $note_hr.join("\n",$foot_explain) : '';
	
	// <head>内に追加するタグ
	$head_tag = count($head_tags) ? join("\n",$head_tags)."\n" : '';
	
	// 1.3.x compat
	// ページの最終更新時刻(UNIX timestamp)
	$fmt = $is_read ? get_filetime($_page) + LOCALZONE : 0;

	//単語検索
	if ($search_word_color and array_key_exists('word',$vars))
	{
		$body = '<div class="small">'.$_msg_word.htmlspecialchars($vars['word'])."</div>$hr\n$body";
		$words = array_flip(array_splice(preg_split('/\s+/',$vars['word'],-1,PREG_SPLIT_NO_EMPTY),0,10));
		$keys = array();
		foreach ($words as $word=>$id)
		{
			$keys[$word] = strlen($word);
		}
		arsort($keys,SORT_NUMERIC);
		$keys = get_search_words(array_keys($keys),TRUE);
		$id = 0;
		foreach ($keys as $key=>$pattern)
		{
			$s_key = htmlspecialchars($key);
			$pattern = "/(<[^>]*>)|($pattern)/";
			$callback = create_function(
				'$arr',
				'return $arr[1] ? $arr[1] : "<strong class=\"word'.$id++.'\">{$arr[2]}</strong>";'
			);
			$body = preg_replace_callback($pattern,$callback,$body);
			$notes = preg_replace_callback($pattern,$callback,$notes);
		}
	}
	
	$longtaketime = getmicrotime() - MUTIME;
	$taketime = sprintf('%01.03f',$longtaketime);
	
	if (!file_exists(SKIN_FILE)||!is_readable(SKIN_FILE))
	{
		die_message(SKIN_FILE.'(skin file) is not found.');
	}
	require(SKIN_FILE);
}
示例#13
0
function plugin_sitemap_action()
{
    global $whatsnew, $non_list;
    global $vars;
    $prefix = isset($vars['page']) ? strip_bracket($vars['page']) : '';
    $script = get_script_uri();
    $recent = CACHE_DIR . 'recent.dat';
    $sitemapcache = CACHE_DIR . 'sitemap.' . ($prefix != '' ? encode($prefix) . '.' : '') . 'xml';
    if (!file_exists($recent) or !file_exists($sitemapcache) or filemtime($recent) >= filemtime($sitemapcache)) {
        // Get all pages
        $pages = array();
        foreach (get_existpages() as $page) {
            if ($page != $whatsnew and !preg_match("/{$non_list}/", $page) and ($prefix == '' or strpos($page, $prefix . '/') === 0) and (PLUGIN_SITEMAP_PAGE_ALLOW == '' or preg_match('/' . PLUGIN_SITEMAP_PAGE_ALLOW . '/', $page)) and (PLUGIN_SITEMAP_PAGE_DISALLOW == '' or !preg_match('/' . PLUGIN_SITEMAP_PAGE_DISALLOW . '/', $page))) {
                if (check_readable($page, false, false)) {
                    $pages[$page] = get_filetime($page);
                }
            }
        }
        // Sort by time
        arsort($pages, SORT_NUMERIC);
        // <url>
        $urls = '';
        $count = PLUGIN_SITEMAP_MAXSHOW;
        foreach ($pages as $page => $time) {
            if ($count > 0) {
                $r_page = rawurlencode($page);
                $link = $script . '?' . $r_page;
                $date = gmdate('Y-m-d\\TH:i:s', $time + ZONETIME) . '+00:00';
                $priority = '';
                $changefreq = '';
                $show = true;
                $_priority = 0.5;
                if (PLUGIN_SITEMAP_READ_PAGES) {
                    foreach (get_source($page) as $line) {
                        if (substr($line, 0, 1) == ' ') {
                            continue;
                        }
                        if (substr($line, 0, 2) == '//') {
                            continue;
                        }
                        if (preg_match('/^#([^\\(]+)(?:\\((.*)\\))?/', $line, $matches)) {
                            if (PLUGIN_SITEMAP_PLUGIN_PRIORITY_UP != '' and preg_match('/^' . PLUGIN_SITEMAP_PLUGIN_PRIORITY_UP . '$/', $matches[1], $matches2)) {
                                $_priority += 0.2;
                            }
                            if (PLUGIN_SITEMAP_PLUGIN_PRIORITY_DOWN != '' and preg_match('/^' . PLUGIN_SITEMAP_PLUGIN_PRIORITY_DOWN . '$/', $matches[1], $matches2)) {
                                $_priority -= 0.1;
                            }
                            if ($matches[1] == 'sitemap') {
                                $_priority = 0.5;
                                if (preg_match('/\\b(\\d\\.\\d)\\b/', $matches[2], $matches2)) {
                                    $_priority = floatval($matches2[1]);
                                }
                                if (preg_match('/\\b(always|hourly|daily|weekly|monthly|yearly|never)\\b/', $matches[2], $matches2)) {
                                    $changefreq = $matches2[1];
                                }
                                if (preg_match('/\\bnone\\b/', $matches[2], $matches2)) {
                                    $show = false;
                                }
                                break;
                            } elseif (preg_match('/^' . PLUGIN_SITEMAP_PLUGIN_NO_FOLLOW . '$/', $matches[1], $matches2)) {
                                $show = false;
                            }
                        } elseif (preg_match('/&([^\\(]+)(?:\\((.*)\\))?;/', $line, $matches)) {
                            if (PLUGIN_SITEMAP_PLUGIN_PRIORITY_UP != '' and preg_match('/^' . PLUGIN_SITEMAP_PLUGIN_PRIORITY_UP . '$/', $matches[1], $matches2)) {
                                $_priority += 0.2;
                            }
                            if (PLUGIN_SITEMAP_PLUGIN_PRIORITY_DOWN != '' and preg_match('/^' . PLUGIN_SITEMAP_PLUGIN_PRIORITY_DOWN . '$/', $matches[1], $matches2)) {
                                $_priority -= 0.1;
                            }
                        }
                    }
                }
                if ($_priority > 1) {
                    $_priority = 1;
                }
                if ($_priority < 0) {
                    $_priority = 0;
                }
                $priority = sprintf('%1.1f', $_priority);
                if ($show) {
                    $urls .= "  <url>\n";
                    if ($link != '') {
                        $urls .= "    <loc>{$link}</loc>\n";
                    }
                    if ($date != '') {
                        $urls .= "    <lastmod>{$date}</lastmod>\n";
                    }
                    if ($changefreq != '') {
                        $urls .= "    <changefreq>{$changefreq}</changefreq>\n";
                    }
                    if ($priority != '') {
                        $urls .= "    <priority>{$priority}</priority>\n";
                    }
                    $urls .= "  </url>\n";
                    $count--;
                }
            } else {
                break;
            }
        }
        $xml = <<<EOD
<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
 xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{$urls}</urlset>
EOD;
        $fp = fopen($sitemapcache, 'w');
        flock($fp, LOCK_EX);
        rewind($fp);
        fputs($fp, $xml);
        flock($fp, LOCK_UN);
        fclose($fp);
    } else {
        $xml = implode('', file($sitemapcache));
    }
    // Output sitemap XML
    header('Content-type: application/xml');
    print $xml;
    exit;
}
示例#14
0
function plugin_adm_auth_wkgrp_convert()
{
    global $_adm_auth_wkgrp_msg, $_LANG;
    if (Auth::check_role('role_adm')) {
        return '';
    }
    if (!PLUGIN_ADM_AUTH_WKGRP_USE_WRITE_FUNC) {
        return '';
    }
    $config_page_name = ':config/' . CONFIG_AUTH_WKGRP;
    $msg = '';
    $script = Router::get_script_uri();
    $cmd_view = Router::get_page_uri($config_page_name);
    $cmd_edit = Router::get_cmd_uri('edit', $config_page_name);
    $cmd_guiedit = Router::get_cmd_uri('guiedit', $config_page_name);
    $cmd_check = Router::get_cmd_uri('adm_auth_wkgrp', '', '', array('pcmd' => 'check'));
    $cmd_import = Router::get_cmd_uri('adm_auth_wkgrp', '', '', array('pcmd' => 'import'));
    $filetime_auth_wkgrp = filemtime(PKWK_AUTH_WKGRP_FILE);
    $date_auth_wkgrp = format_date($filetime_auth_wkgrp);
    if (is_page($config_page_name)) {
        $filetime_config_page = get_filetime($config_page_name);
        $date_config_page = format_date($filetime_config_page);
        $guide_msg = $filetime_config_page > $filetime_auth_wkgrp ? '<strong>' . $_adm_auth_wkgrp_msg['msg_gen'] . '</strong>' : '';
        $link_page = <<<EOD
[<a href="{$cmd_edit}">{$_LANG['skin']['edit']}</a>]
[<a href="{$cmd_guiedit}">{$_LANG['skin']['guiedit']}</a>]

EOD;
        $link_file = <<<EOD
<form action="{$script}" method="post" class="adm_auth_wkgrp_form">
\t<input type="hidden" name="cmd" value="adm_auth_wkgrp" />
\t<input type="hidden" name="pcmd" value="gen" />
\t<input type="submit" class="btn btn-secondary" value="{$_adm_auth_wkgrp_msg['btn_gen']}" />
\t{$guide_msg}
</form>

EOD;
    } else {
        $date_config_page = 'N/A';
        $link_page = '[<a href="' . $cmd_import . '">' . $_adm_auth_wkgrp_msg['msg_import'] . '</a>]';
        $link_file = '';
    }
    $rc = <<<EOD
<div class="adm_auth_wkgrp">
\t<fieldset>
\t\t<legend>{$_adm_auth_wkgrp_msg['head_title']}</legend>
\t\t<table class="table">
\t\t\t<thead>
\t\t\t\t<tr>
\t\t\t\t\t<th>
\t\t\t\t\t\t{$_adm_auth_wkgrp_msg['msg_head_page']}
\t\t\t\t\t\t(<a href="{$cmd_view}">{$_adm_auth_wkgrp_msg['msg_view']}</a>)
\t\t\t\t\t</td>
\t\t\t\t\t<th>
\t\t\t\t\t\t{$_adm_auth_wkgrp_msg['msg_head_file']}
\t\t\t\t\t\t(<a href="{$cmd_check}">{$_adm_auth_wkgrp_msg['msg_check']}</a>)
\t\t\t\t\t</td>
\t\t\t\t</tr>
\t\t\t</thead>
\t\t\t<tbody>
\t\t\t\t<tr>
\t\t\t\t\t<td>{$_adm_auth_wkgrp_msg['msg_head_update']}: {$date_config_page}</td>
\t\t\t\t\t<td>{$_adm_auth_wkgrp_msg['msg_head_gen']}: {$date_auth_wkgrp}</td>
\t\t\t\t</tr>
\t\t\t\t<tr>
\t\t\t\t\t<td>{$link_page}</td>
\t\t\t\t\t<td>{$link_file}</td>
\t\t\t\t</tr>
\t\t\t</tbody>
\t\t</table>
\t</fieldset>
</div>
EOD;
    return $rc;
}
示例#15
0
function header_lastmod($page=NULL)
{
	global $lastmod;
	
	if ($lastmod and is_page($page))
	{
		header('Last-Modified: '.date('D, d M Y H:i:s',get_filetime($page)).' GMT');
	}
}
示例#16
0
function catbody($title, $page, $body)
{
    global $script;
    // MUST BE SKIN.FILE. Do not delete line.
    global $vars, $arg, $defaultpage, $whatsnew, $help_page, $hr;
    global $attach_link, $related_link, $function_freeze;
    global $search_word_color, $foot_explain, $note_hr, $head_tags, $foot_tags;
    global $trackback, $referer, $javascript;
    global $newtitle, $newbase, $language, $use_local_time;
    // Plus! skin extension
    global $nofollow;
    global $_LANG, $_LINK, $_IMAGE;
    global $pkwk_dtd;
    // XHTML 1.1, XHTML1.0, HTML 4.01 Transitional...
    global $page_title;
    // Title of this site
    global $do_backup;
    // Do backup or not
    global $modifier;
    // Site administrator's  web page
    global $modifierlink;
    // Site administrator's name
    global $skin_file, $menubar, $sidebar;
    global $_string;
    if (!defined('SKIN_FILE') || !file_exists(SKIN_FILE) || !is_readable(SKIN_FILE)) {
        if (!file_exists($skin_file) || !is_readable($skin_file)) {
            die_message(SKIN_FILE . '(skin file) is not found.');
        } else {
            define('SKIN_FILE', $skin_file);
        }
    }
    $_LINK = $_IMAGE = array();
    // Add JavaScript header when ...
    if (!PKWK_ALLOW_JAVASCRIPT) {
        unset($javascript);
    }
    $_page = isset($vars['page']) ? $vars['page'] : '';
    $r_page = rawurlencode($_page);
    // Set $_LINK for skin
    $_LINK['add'] = get_cmd_uri('add', $_page);
    $_LINK['backup'] = get_cmd_uri('backup', $_page);
    $_LINK['brokenlink'] = get_cmd_uri('brokenlink', $_page);
    $_LINK['copy'] = get_cmd_uri('template', '', '', 'refer=' . $r_page);
    $_LINK['diff'] = get_cmd_uri('diff', $_page);
    $_LINK['edit'] = get_cmd_uri('edit', $_page);
    $_LINK['guiedit'] = get_cmd_uri('guiedit', $_page);
    $_LINK['filelist'] = get_cmd_uri('filelist');
    $_LINK['freeze'] = get_cmd_uri('freeze', $_page);
    $_LINK['help'] = get_cmd_uri('help');
    $_LINK['linklist'] = get_cmd_uri('linklist', $_page);
    $_LINK['list'] = get_cmd_uri('list');
    $_LINK['log_login'] = get_cmd_uri('logview', '', '', 'kind=login');
    $_LINK['log_browse'] = get_cmd_uri('logview', $_page, '', 'kind=browse');
    $_LINK['log_update'] = get_cmd_uri('logview', $_page);
    $_LINK['log_down'] = get_cmd_uri('logview', $_page, '', 'kind=download');
    $_LINK['log_check'] = get_cmd_uri('logview', $_page, '', 'kind=check');
    $_LINK['menu'] = get_page_uri($menubar);
    $_LINK['new'] = get_cmd_uri('newpage', '', '', 'refer=' . $r_page);
    $_LINK['newsub'] = get_cmd_uri('newpage_subdir', '', '', 'directory=' . $r_page);
    $_LINK['print'] = get_cmd_uri('print', $_page);
    $_LINK['full'] = get_cmd_uri('print', $_page) . '&amp;nohead&amp;nofoot';
    $_LINK['read'] = get_page_uri($_page);
    $_LINK['recent'] = get_page_uri($whatsnew);
    $_LINK['refer'] = get_cmd_uri('referer', $_page);
    $_LINK['reload'] = get_page_absuri($_page);
    // 本当は、get_script_uri でいいけど、絶対パスでないと、スキンに影響が出る
    $_LINK['reload_rel'] = get_page_uri($_page);
    $_LINK['rename'] = get_cmd_uri('rename', '', '', 'refer=' . $r_page);
    $_LINK['skeylist'] = get_cmd_uri('skeylist', $_page);
    $_LINK['search'] = get_cmd_uri('search');
    $_LINK['side'] = get_page_uri($sidebar);
    $_LINK['source'] = get_cmd_uri('source', $_page);
    $_LINK['template'] = get_cmd_uri('template', '', '', 'refer=' . $r_page);
    $_LINK['top'] = get_page_uri($defaultpage);
    if ($trackback) {
        $tb_id = tb_get_id($_page);
        $_LINK['trackback'] = get_cmd_uri('tb', '', '', '__mode=view&tb_id=' . $tb_id);
    }
    $_LINK['unfreeze'] = get_cmd_uri('unfreeze', $_page);
    $_LINK['upload'] = get_cmd_uri('attach', $_page, '', 'pcmd=upload');
    // link rel="alternate" にも利用するため absuri にしておく
    $_LINK['rdf'] = get_cmd_absuri('rss', '', 'ver=1.0');
    $_LINK['rss'] = get_cmd_absuri('rss');
    $_LINK['rss10'] = get_cmd_absuri('rss', '', 'ver=1.0');
    // Same as 'rdf'
    $_LINK['rss20'] = get_cmd_absuri('rss', '', 'ver=2.0');
    $_LINK['mixirss'] = get_cmd_absuri('mixirss');
    // Same as 'rdf' for mixi
    // Compat: Skins for 1.4.4 and before
    $link_add =& $_LINK['add'];
    $link_backup =& $_LINK['backup'];
    $link_brokenlink =& $_LINK['brokenlink'];
    $link_template =& $_LINK['copy'];
    $link_diff =& $_LINK['diff'];
    $link_edit =& $_LINK['edit'];
    $link_guiedit =& $_LINK['guiedit'];
    $link_filelist =& $_LINK['filelist'];
    $link_freeze =& $_LINK['freeze'];
    $link_help =& $_LINK['help'];
    $link_linklist =& $_LINK['linklist'];
    $link_list =& $_LINK['list'];
    $link_log_login =& $_LINK['log_login'];
    $link_log_browse =& $_LINK['log_browse'];
    $link_log_update =& $_LINK['log_update'];
    $link_log_down =& $_LINK['log_down'];
    $link_log_check =& $_LINK['log_check'];
    $link_menu =& $_LINK['menu'];
    $link_new =& $_LINK['new'];
    $link_newsub =& $_LINK['newsub'];
    $link_print =& $_LINK['print'];
    $link_full =& $_LINK['full'];
    $link_read =& $_LINK['read'];
    $link_whatsnew =& $_LINK['recent'];
    $link_refer =& $_LINK['refer'];
    $link_reload =& $_LINK['reload'];
    $link_reload_rel =& $_LINK['reload_rel'];
    $link_rename =& $_LINK['rename'];
    $link_skeylist =& $_LINK['skeylist'];
    $link_search =& $_LINK['search'];
    $link_side =& $_LINK['side'];
    $link_source =& $_LINK['source'];
    $link_top =& $_LINK['top'];
    if ($trackback) {
        $link_trackback =& $_LINK['trackback'];
    }
    $link_unfreeze =& $_LINK['unfreeze'];
    $link_upload =& $_LINK['upload'];
    //
    $link_rdf =& $_LINK['rdf'];
    $link_rss =& $_LINK['rss'];
    $link_rss10 =& $_LINK['rss10'];
    $link_rss20 =& $_LINK['rss20'];
    $link_mixirss =& $_LINK['mixirss'];
    // Init flags
    $is_page = is_pagename($_page) && !arg_check('backup') && !is_cantedit($_page);
    $is_read = arg_check('read') && is_page($_page);
    $is_freeze = is_freeze($_page);
    // Last modification date (string) of the page
    $lastmodified = $is_read ? get_date('D, d M Y H:i:s T', get_filetime($_page)) . ' ' . get_pg_passage($_page, FALSE) : '';
    // List of attached files to the page
    $attaches = '';
    if ($attach_link && $is_read && exist_plugin_action('attach')) {
        if (do_plugin_init('attach') !== FALSE) {
            $attaches = attach_filelist();
        }
    }
    // List of related pages
    $related = $related_link && $is_read ? make_related($_page) : '';
    // List of footnotes
    ksort($foot_explain, SORT_NUMERIC);
    $notes = !empty($foot_explain) ? $note_hr . join("\n", $foot_explain) : '';
    // Tags will be inserted into <head></head>
    $head_tag = !empty($head_tags) ? join("\n", $head_tags) . "\n" : '';
    $foot_tag = !empty($foot_tags) ? join("\n", $foot_tags) . "\n" : '';
    // 1.3.x compat
    // Last modification date (UNIX timestamp) of the page
    $fmt = $is_read ? get_filetime($_page) : 0;
    // Search words
    if ($search_word_color && isset($vars['word'])) {
        $body = '<div class="small">' . $_string['word'] . htmlspecialchars($vars['word']) . '</div>' . $hr . "\n" . $body;
        // BugTrack2/106: Only variables can be passed by reference from PHP 5.0.5
        $words = preg_split('/\\s+/', $vars['word'], -1, PREG_SPLIT_NO_EMPTY);
        $words = array_splice($words, 0, 10);
        // Max: 10 words
        $words = array_flip($words);
        $keys = array();
        foreach ($words as $word => $id) {
            $keys[$word] = strlen($word);
        }
        arsort($keys, SORT_NUMERIC);
        $keys = get_search_words(array_keys($keys), TRUE);
        $id = 0;
        foreach ($keys as $key => $pattern) {
            $s_key = htmlspecialchars($key);
            $pattern = '/' . '<textarea[^>]*>.*?<\\/textarea>' . '|' . '<[^>]*>' . '|' . '&[^;]+;' . '|' . '(' . $pattern . ')' . '/sS';
            $decorate_Nth_word = create_function('$matches', 'return (isset($matches[1])) ? ' . '\'<strong class="word' . $id . '">\' . $matches[1] . \'</strong>\' : ' . '$matches[0];');
            $body = preg_replace_callback($pattern, $decorate_Nth_word, $body);
            $notes = preg_replace_callback($pattern, $decorate_Nth_word, $notes);
            ++$id;
        }
    }
    // Compat: 'HTML convert time' without time about MenuBar and skin
    $taketime = elapsedtime();
    require SKIN_FILE;
}
示例#17
0
function do_search_fuzzy($word, $type = 'AND', $non_format = FALSE, $non_fuzzy = FALSE)
{
    global $whatsnew, $non_list, $search_non_list;
    global $search_auth, $search_fuzzy;
    static $fuzzypattern = array('ヴァ' => 'バ', 'ヴィ' => 'ビ', 'ヴェ' => 'ベ', 'ヴォ' => 'ボ', 'ヴ' => 'ブ', 'ヰ' => 'イ', 'ヱ' => 'エ', 'ヵ' => 'カ', 'ァ' => 'ア', 'ィ' => 'イ', 'ゥ' => 'ウ', 'ェ' => 'エ', 'ォ' => 'オ', 'ャ' => 'ヤ', 'ュ' => 'ユ', 'ョ' => 'ヨ');
    $retval = array();
    $b_type = $type == 'AND';
    // AND:TRUE OR:FALSE
    $keys = get_search_words(preg_split('/\\s+/', $word, -1, PREG_SPLIT_NO_EMPTY));
    $_pages = get_existpages();
    $pages = array();
    $non_list_pattern = '/' . $non_list . '/';
    foreach ($_pages as $page) {
        if ($page == $whatsnew || !$search_non_list && preg_match($non_list_pattern, $page)) {
            continue;
        }
        // 検索対象ページの制限をかけるかどうか (ページ名は制限外)
        if ($search_auth && !check_readable($page, false, false)) {
            $source = get_source();
            // 検索対象ページ内容を空に。
        } else {
            $source = get_source($page);
        }
        if (!$non_format) {
            array_unshift($source, $page);
        }
        // ページ名も検索対象に
        $b_match = FALSE;
        //miko modified
        if (!$search_fuzzy || $non_fuzzy) {
            foreach ($keys as $key) {
                $tmp = preg_grep('/' . $key . '/', $source);
                $b_match = !empty($tmp);
                if ($b_match xor $b_type) {
                    break;
                }
            }
            if ($b_match) {
                $pages[$page] = get_filetime($page);
            }
        } else {
            $fuzzy_from = array_keys($fuzzypattern);
            $fuzzy_to = array_values($fuzzypattern);
            $words = preg_split('/\\s+/', $word, -1, PREG_SPLIT_NO_EMPTY);
            $_source = mb_strtolower(mb_convert_kana(join("\n", $source), 'KVCas'));
            for ($i = 0; $i < count($fuzzy_from); $i++) {
                $_source = mb_ereg_replace($fuzzy_from[$i], $fuzzy_to[$i], $_source);
            }
            $_source = mb_ereg_replace('[ッー・゛゜、。]', '', $_source);
            foreach ($keys as $key) {
                $_keyword = mb_strtolower(mb_convert_kana($word, 'KVCas'));
                for ($i = 0; $i < count($fuzzy_from); $i++) {
                    $_keyword = mb_ereg_replace($fuzzy_from[$i], $fuzzy_to[$i], $_keyword);
                }
                $_keyword = mb_ereg_replace('[ッー・゛゜、。]', '', $_keyword);
                $b_match = mb_ereg(mb_ereg_quote($_keyword), $_source);
            }
            if ($b_match) {
                $pages[$page] = get_filetime($page);
            }
        }
        //miko modified
    }
    if ($non_format) {
        return array_keys($pages);
    }
    $r_word = rawurlencode($word);
    $s_word = htmlspecialchars($word);
    if (empty($pages)) {
        return str_replace('$1', $s_word, $_string['notfoundresult']);
    }
    ksort($pages);
    $retval = '<ul>' . "\n";
    foreach ($pages as $page => $time) {
        $s_page = htmlspecialchars($page);
        $passage = get_passage($time);
        $retval .= ' <li><a href="' . get_page_uri($page, '', 'word=' . $r_word) . '">' . $s_page . '</a>' . $passage . '</li>' . "\n";
    }
    $retval .= '</ul>' . "\n";
    $retval .= str_replace('$1', $s_word, str_replace('$2', count($pages), str_replace('$3', count($_pages), $b_type ? $_string['andresult'] : $_string['orresult'])));
    return $retval;
}
function plugin_adm_auth_wkgrp_convert()
{
    global $script, $_adm_auth_wkgrp_msg, $_LANG;
    if (auth::check_role('role_adm')) {
        return '';
    }
    if (!PLUGIN_ADM_AUTH_WKGRP_USE_WRITE_FUNC) {
        return '';
    }
    $config_page_name = ':config/' . CONFIG_AUTH_WKGRP;
    $msg = '';
    $cmd_view = get_page_uri($config_page_name);
    $cmd_edit = get_cmd_uri('edit', $config_page_name);
    $cmd_guiedit = get_cmd_uri('guiedit', $config_page_name);
    $cmd_check = get_cmd_uri('adm_auth_wkgrp', '', '', array('pcmd' => 'check'));
    $cmd_import = get_cmd_uri('adm_auth_wkgrp', '', '', array('pcmd' => 'import'));
    $filetime_auth_wkgrp = filemtime(PKWK_AUTH_WKGRP_FILE);
    $date_auth_wkgrp = format_date($filetime_auth_wkgrp);
    if (is_page($config_page_name)) {
        $filetime_config_page = get_filetime($config_page_name);
        $date_config_page = format_date($filetime_config_page);
        $guide_msg = $filetime_config_page > $filetime_auth_wkgrp ? '<strong>' . $_adm_auth_wkgrp_msg['msg_gen'] . '</strong>' : '';
        $link_page = <<<EOD
      [<a href="{$cmd_edit}">{$_LANG['skin']['edit']}</a>]
      [<a href="{$cmd_guiedit}">{$_LANG['skin']['guiedit']}</a>]

EOD;
        $link_file = <<<EOD
      <form action="{$script}" method="post">
       <div>
        <input type="hidden" name="plugin" value="adm_auth_wkgrp" />
        <input type="hidden" name="pcmd" value="gen" />
        <input type="submit" value="{$_adm_auth_wkgrp_msg['btn_gen']}" />
{$guide_msg}
       </div>
      </form>

EOD;
    } else {
        $date_config_page = 'N/A';
        $link_page = <<<EOD
      [<a href="{$cmd_import}">{$_adm_auth_wkgrp_msg['msg_import']}</a>]

EOD;
        $link_file = '';
    }
    $rc = <<<EOD
<div>
 <fieldset>
  <legend>{$_adm_auth_wkgrp_msg['head_title']}</legend>
   <table class="style_table" border="0" cellspacing="1" style="width:100%;">
   <thead>
    <tr>
     <td class="style_td" style="width:50%;">
       {$_adm_auth_wkgrp_msg['msg_head_page']}
       (<a href="{$cmd_view}">{$_adm_auth_wkgrp_msg['msg_view']}</a>)
     </td>
     <td class="style_td" style="width:50%;">
       {$_adm_auth_wkgrp_msg['msg_head_file']}
       (<a href="{$cmd_check}">{$_adm_auth_wkgrp_msg['msg_check']}</a>)
     </td>
    </tr>
   </thead>

   <tbody>
    <tr>
     <td class="style_td" style="width:50%;">
      {$_adm_auth_wkgrp_msg['msg_head_update']}: {$date_config_page}
     </td>
     <td class="style_td" style="width:50%;">
      {$_adm_auth_wkgrp_msg['msg_head_gen']}: {$date_auth_wkgrp}
     </td>
    </tr>
    <tr>
     <td class="style_td" style="width:50%;">
{$link_page}
     </td>
     <td class="style_td" style="width:50%;">
{$link_file}
     </td>
    </tr>
   </tbody>
   </table>
 </fieldset>
</div>

EOD;
    return $rc;
}
示例#19
0
function header_lastmod($page = NULL)
{
    global $lastmod;
    if ($lastmod && is_page($page)) {
        pkwk_headers_sent();
        header('Last-Modified: ' . date('D, d M Y H:i:s', get_filetime($page)) . ' GMT');
    }
}
示例#20
0
function make_pagelink($page, $alias = '', $anchor = '', $refer = '', $isautolink = FALSE)
{
    global $vars, $link_compact, $related, $_symbol_noexists;
    $s_page = htmlspecialchars(strip_bracket($page));
    if (!is_page($page)) {
        $realpages = get_autoaliases(strip_bracket($page));
        foreach ($realpages as $realpage) {
            if (is_page($realpage)) {
                $page = $realpage;
                break;
            }
        }
    }
    $s_alias = $alias == '' ? $s_page : $alias;
    if ($page == '') {
        return '<a href="' . $anchor . '">' . $s_alias . '</a>';
    }
    //	if ($page == '') return open_uri_in_new_window('<a href="' . $anchor . '">' . $s_alias . '</a>', 'make_pagelink');
    $r_refer = $refer == '' ? '' : '&amp;refer=' . rawurlencode($refer);
    if (!isset($related[$page]) && $page != $vars['page'] && is_page($page)) {
        $related[$page] = get_filetime($page);
    }
    if ($isautolink || is_page($page)) {
        // Hyperlink to the page
        if ($link_compact) {
            $title = '';
        } else {
            $title = ' title="' . $s_page . get_pg_passage($page, FALSE) . '"';
        }
        // AutoLink marker
        if ($isautolink) {
            $al_left = '<!--autolink--><span class="autolink">';
            $al_right = '</span><!--/autolink-->';
        } else {
            $al_left = $al_right = '';
        }
        return $al_left . '<a ' . 'href="' . get_page_uri($page) . $anchor . '"' . $title . '>' . $s_alias . '</a>' . $al_right;
        //		return open_uri_in_new_window($al_left .
        //			'<a href="' . get_page_uri($page) . $anchor . '"' . $title . '>' .
        //			$s_alias . '</a>' . $al_right, 'make_pagelink');
    } else {
        // Dangling link
        // if (PKWK_READONLY) return $s_alias; // No dacorations
        if (auth::check_role('readonly')) {
            return $s_alias;
        }
        // No dacorations
        $retval = $s_alias . '<a href="' . get_cmd_uri('edit', $page) . $r_refer . '">' . $_symbol_noexists . '</a>';
        if ($link_compact) {
            return $retval;
            //			return open_uri_in_new_window($retval, 'make_pagelink_e');
        } else {
            return '<span class="noexists">' . $retval . '</span>';
        }
    }
}
示例#21
0
function catbody($title, $page, $body)
{
    global $script, $vars, $arg, $defaultpage, $whatsnew, $help_page, $hr;
    global $attach_link, $related_link, $cantedit, $function_freeze;
    global $search_word_color, $_msg_word, $foot_explain, $note_hr, $head_tags;
    global $trackback, $trackback_javascript, $referer, $javascript;
    global $nofollow;
    global $_LANG, $_LINK, $_IMAGE;
    global $pkwk_dtd;
    // XHTML 1.1, XHTML1.0, HTML 4.01 Transitional...
    global $page_title;
    // Title of this site
    global $do_backup;
    // Do backup or not
    global $modifier;
    // Site administrator's  web page
    global $modifierlink;
    // Site administrator's name
    if (!file_exists(SKIN_FILE) || !is_readable(SKIN_FILE)) {
        die_message('SKIN_FILE is not found');
    }
    $_LINK = $_IMAGE = array();
    // Add JavaScript header when ...
    if ($trackback && $trackback_javascript) {
        $javascript = 1;
    }
    // Set something If you want
    if (!PKWK_ALLOW_JAVASCRIPT) {
        unset($javascript);
    }
    $_page = isset($vars['page']) ? $vars['page'] : '';
    $r_page = rawurlencode($_page);
    // Set $_LINK for skin
    $_LINK['add'] = "{$script}?cmd=add&amp;page={$r_page}";
    $_LINK['backup'] = "{$script}?cmd=backup&amp;page={$r_page}";
    $_LINK['copy'] = "{$script}?plugin=template&amp;refer={$r_page}";
    $_LINK['diff'] = "{$script}?cmd=diff&amp;page={$r_page}";
    $_LINK['edit'] = "{$script}?cmd=edit&amp;page={$r_page}";
    $_LINK['filelist'] = "{$script}?cmd=filelist";
    $_LINK['freeze'] = "{$script}?cmd=freeze&amp;page={$r_page}";
    $_LINK['help'] = "{$script}?" . rawurlencode($help_page);
    $_LINK['list'] = "{$script}?cmd=list";
    $_LINK['new'] = "{$script}?plugin=newpage&amp;refer={$r_page}";
    $_LINK['rdf'] = "{$script}?cmd=rss&amp;ver=1.0";
    $_LINK['recent'] = "{$script}?" . rawurlencode($whatsnew);
    $_LINK['refer'] = "{$script}?plugin=referer&amp;page={$r_page}";
    $_LINK['reload'] = "{$script}?{$r_page}";
    $_LINK['rename'] = "{$script}?plugin=rename&amp;refer={$r_page}";
    $_LINK['rss'] = "{$script}?cmd=rss";
    $_LINK['rss10'] = "{$script}?cmd=rss&amp;ver=1.0";
    // Same as 'rdf'
    $_LINK['rss20'] = "{$script}?cmd=rss&amp;ver=2.0";
    $_LINK['search'] = "{$script}?cmd=search";
    $_LINK['top'] = "{$script}?" . rawurlencode($defaultpage);
    if ($trackback) {
        $tb_id = tb_get_id($_page);
        $_LINK['trackback'] = "{$script}?plugin=tb&amp;__mode=view&amp;tb_id={$tb_id}";
    }
    $_LINK['unfreeze'] = "{$script}?cmd=unfreeze&amp;page={$r_page}";
    $_LINK['upload'] = "{$script}?plugin=attach&amp;pcmd=upload&amp;page={$r_page}";
    // Compat: Skins for 1.4.4 and before
    $link_add =& $_LINK['add'];
    $link_new =& $_LINK['new'];
    // New!
    $link_edit =& $_LINK['edit'];
    $link_diff =& $_LINK['diff'];
    $link_top =& $_LINK['top'];
    $link_list =& $_LINK['list'];
    $link_filelist =& $_LINK['filelist'];
    $link_search =& $_LINK['search'];
    $link_whatsnew =& $_LINK['recent'];
    $link_backup =& $_LINK['backup'];
    $link_help =& $_LINK['help'];
    $link_trackback =& $_LINK['trackback'];
    // New!
    $link_rdf =& $_LINK['rdf'];
    // New!
    $link_rss =& $_LINK['rss'];
    $link_rss10 =& $_LINK['rss10'];
    // New!
    $link_rss20 =& $_LINK['rss20'];
    // New!
    $link_freeze =& $_LINK['freeze'];
    $link_unfreeze =& $_LINK['unfreeze'];
    $link_upload =& $_LINK['upload'];
    $link_template =& $_LINK['copy'];
    $link_refer =& $_LINK['refer'];
    // New!
    $link_rename =& $_LINK['rename'];
    // Init flags
    $is_page = is_pagename($_page) && !arg_check('backup') && $_page != $whatsnew;
    $is_read = arg_check('read') && is_page($_page);
    $is_freeze = is_freeze($_page);
    // Last modification date (string) of the page
    $lastmodified = $is_read ? format_date(get_filetime($_page)) . ' ' . get_pg_passage($_page, FALSE) : '';
    // List of attached files to the page
    $attaches = $attach_link && $is_read && exist_plugin_action('attach') ? attach_filelist() : '';
    // List of related pages
    $related = $related_link && $is_read ? make_related($_page) : '';
    // List of footnotes
    ksort($foot_explain, SORT_NUMERIC);
    $notes = !empty($foot_explain) ? $note_hr . join("\n", $foot_explain) : '';
    // Tags will be inserted into <head></head>
    $head_tag = !empty($head_tags) ? join("\n", $head_tags) . "\n" : '';
    // 1.3.x compat
    // Last modification date (UNIX timestamp) of the page
    $fmt = $is_read ? get_filetime($_page) + LOCALZONE : 0;
    // Search words
    if ($search_word_color && isset($vars['word'])) {
        $body = '<div class="small">' . $_msg_word . htmlsc($vars['word']) . '</div>' . $hr . "\n" . $body;
        // BugTrack2/106: Only variables can be passed by reference from PHP 5.0.5
        // with array_splice(), array_flip()
        $words = preg_split('/\\s+/', $vars['word'], -1, PREG_SPLIT_NO_EMPTY);
        $words = array_splice($words, 0, 10);
        // Max: 10 words
        $words = array_flip($words);
        $keys = array();
        foreach ($words as $word => $id) {
            $keys[$word] = strlen($word);
        }
        arsort($keys, SORT_NUMERIC);
        $keys = get_search_words(array_keys($keys), TRUE);
        $id = 0;
        foreach ($keys as $key => $pattern) {
            $s_key = htmlsc($key);
            $pattern = '/' . '<textarea[^>]*>.*?<\\/textarea>' . '|' . '<[^>]*>' . '|' . '&[^;]+;' . '|' . '(' . $pattern . ')' . '/sS';
            $decorate_Nth_word = create_function('$matches', 'return (isset($matches[1])) ? ' . '\'<strong class="word' . $id . '">\' . $matches[1] . \'</strong>\' : ' . '$matches[0];');
            $body = preg_replace_callback($pattern, $decorate_Nth_word, $body);
            $notes = preg_replace_callback($pattern, $decorate_Nth_word, $notes);
            ++$id;
        }
    }
    $longtaketime = getmicrotime() - MUTIME;
    $taketime = sprintf('%01.03f', $longtaketime);
    require SKIN_FILE;
}
示例#22
0
function plugin_backup_convert()
{
    global $vars;
    global $_backup_messages;
    global $js_blocks, $plugin_backup_count;
    $page = isset($vars['page']) ? $vars['page'] : null;
    if (empty($page)) {
        return;
    }
    check_readable($page, false);
    // Get arguments
    $with_label = TRUE;
    $diff_mode = 0;
    $args = func_get_args();
    while (isset($args[0])) {
        switch (array_shift($args)) {
            case 'default':
                $diff_mode = 0;
                break;
            case 'nowdiff':
                $diff_mode = 1;
                break;
            case 'visualdiff':
                $diff_mode = 2;
                break;
            case 'label':
                $with_label = TRUE;
                break;
            case 'nolabel':
                $with_label = FALSE;
                break;
        }
    }
    $mode = 'nowdiff';
    switch ($diff_mode) {
        case 2:
            $mode = 'visualdiff';
            break;
        case 1:
            $mode = 'nowdiff';
            break;
    }
    $r_page = rawurlencode($page);
    $s_page = Utility::htmlsc($page);
    $retval = array();
    $date = get_date("m/d", get_filetime($page));
    $backups = Factory::Backup($page)->has() ? Factory::Backup($page)->get() : array();
    $retval[] = '<form action="' . Router::get_script_uri() . '" method="get" class="autosubmit form-inline plugin-backup-form">';
    $retval[] = '<input type="hidden" name="cmd" value="backup" />';
    $retval[] = '<input type="hidden" name="action" value="' . $mode . '" />';
    $retval[] = '<input type="hidden" name="page" value="' . $s_page . '" />';
    $retval[] = '<div class="input-group">';
    $retval[] = $with_label ? '<label for="age">' . $_backup_messages['msg_version'] . '</label>' : '';
    $retval[] = '<select id="age" name="age" class="form-control">';
    //$retval[] = '<option value="" selected="selected" data-placeholder="true" disabled="disabled">'.$_backup_messages['msg_backup'].'</option>';
    if (count($backups) == 0) {
        $retval[] = '<option value="" selected="selected" disabled="disabled">' . $_backup_messages['msg_arrow'] . ' ' . $date . '(No.1)</option>';
    } else {
        $maxcnt = count($backups) + 1;
        $retval[] = '<option value="" selected="selected" disabled="disabled">' . $_backup_messages['msg_arrow'] . ' ' . $date . '(No.' . $maxcnt . ')</option>';
        $backups = array_reverse($backups, True);
        foreach ($backups as $age => $data) {
            if (isset($data['real'])) {
                $time = $data['real'];
            } else {
                if (isset($data['time'])) {
                    $time = $data['time'];
                } else {
                    break;
                }
            }
            $date = get_date('m/d', $time);
            $retval[] = '<option value="' . $age . '">' . $date . ' (No.' . $age . ')</option>';
        }
    }
    $retval[] = '</select>';
    $retval[] = '<span class="input-group-btn"><button type="submit" class="btn btn-success"><span class="fa fa-chevron-right"></span></button></span>';
    $retval[] = '</div>';
    $retval[] = '</form>';
    return join("\n", $retval);
}
示例#23
0
 function add($page, $name)
 {
     static $moved = array();
     // 無限ループ防止
     if (array_key_exists($name, $this->rows)) {
         return;
     }
     $source = plugin_tracker_get_source($page);
     if (preg_match('/move\\sto\\s(.+)/', $source[0], $matches)) {
         $page = strip_bracket(trim($matches[1]));
         if (array_key_exists($page, $moved) or !is_page($page)) {
             return;
         }
         $moved[$page] = TRUE;
         return $this->add($page, $name);
     }
     $source = join('', preg_replace('/^(\\*{1,3}.*)\\[#[A-Za-z][\\w-]+\\](.*)$/', '$1$2', $source));
     // デフォルト値
     $this->rows[$name] = array('_page' => "[[{$page}]]", '_refer' => $this->page, '_real' => $name, '_update' => get_filetime($page), '_past' => get_filetime($page));
     if ($this->rows[$name]['_match'] = preg_match("/{$this->pattern}/s", $source, $matches)) {
         array_shift($matches);
         foreach ($this->pattern_fields as $key => $field) {
             $this->rows[$name][$field] = trim($matches[$key]);
         }
     }
 }
示例#24
0
 function get_filetime($page)
 {
     return get_filetime($page);
 }
 /**
  * Get page created time
  *
  * PukiWiki API Extension
  *
  * @access public
  * @static
  * @param string $page pagename
  * @return int timestamp
  * @see get_filetime($page)
  * @version $Id: v 1.0 2008-06-05 11:14:46 sonots $
  */
 function get_filecreatetime($page)
 {
     if (_backup_file_exists($page)) {
         // PukiWiki Trick
         // This is not a created time exactly, but the closest time
         $backup = get_backup($page, 1);
         // 1st age
         return $backup['time'];
     } else {
         return get_filetime($page);
     }
 }
示例#26
0
function links_update($page)
{
    // if (PKWK_READONLY) return; // Do nothing
    if (auth::check_role('readonly')) {
        return;
    }
    // Do nothing
    if (ini_get('safe_mode') == '0') {
        set_time_limit(0);
    }
    $time = is_page($page, TRUE) ? get_filetime($page) : 0;
    $rel_old = array();
    $rel_file = CACHE_DIR . encode($page) . '.rel';
    $rel_file_exist = file_exists($rel_file);
    if ($rel_file_exist === TRUE) {
        $lines = file($rel_file);
        unlink($rel_file);
        if (isset($lines[0])) {
            $rel_old = explode("\t", rtrim($lines[0]));
        }
    }
    $rel_new = array();
    // 参照先
    $rel_auto = array();
    // オートリンクしている参照先
    $links = links_get_objects($page, TRUE);
    foreach ($links as $_obj) {
        if (!isset($_obj->type) || $_obj->type != 'pagename' || $_obj->name == $page || $_obj->name == '') {
            continue;
        }
        if (is_a($_obj, 'Link_autolink')) {
            // 行儀が悪い
            $rel_auto[] = $_obj->name;
        } else {
            if (is_a($_obj, 'Link_autoalias')) {
                $_aliases = get_autoaliases($_obj->name);
                foreach ($_aliases as $_alias) {
                    if (is_pagename($_alias)) {
                        $rel_auto[] = $_alias;
                    }
                }
            } else {
                $rel_new[] = $_obj->name;
            }
        }
    }
    $rel_new = array_unique($rel_new);
    // autolinkしか向いていないページ
    $rel_auto = array_diff(array_unique($rel_auto), $rel_new);
    // 全ての参照先ページ
    $rel_new = array_merge($rel_new, $rel_auto);
    // .rel:$pageが参照しているページの一覧
    if ($time) {
        // ページが存在している
        if (!empty($rel_new)) {
            $fp = fopen($rel_file, 'w') or die_message('cannot write ' . htmlspecialchars($rel_file));
            fputs($fp, join("\t", $rel_new));
            fclose($fp);
        }
    }
    // .ref:$_pageを参照しているページの一覧
    links_add($page, array_diff($rel_new, $rel_old), $rel_auto);
    links_delete($page, array_diff($rel_old, $rel_new));
    global $WikiName, $autolink, $nowikiname, $search_non_list;
    // $pageが新規作成されたページで、AutoLinkの対象となり得る場合
    if ($time && !$rel_file_exist && $autolink && (preg_match("/^{$WikiName}\$/", $page) ? $nowikiname : strlen($page) >= $autolink)) {
        // $pageを参照していそうなページを一斉更新する(おい)
        $search_non_list = 1;
        $pages = do_search($page, 'AND', TRUE, TRUE);
        foreach ($pages as $_page) {
            if ($_page != $page) {
                links_update($_page);
            }
        }
    }
    $ref_file = CACHE_DIR . encode($page) . '.ref';
    // $pageが削除されたときに、
    if (!$time && file_exists($ref_file)) {
        foreach (file($ref_file) as $line) {
            list($ref_page, $ref_auto) = explode("\t", rtrim($line));
            // $pageをAutoLinkでしか参照していないページを一斉更新する(おいおい)
            if ($ref_auto) {
                links_delete($ref_page, array($page));
            }
        }
    }
}
示例#27
0
function do_search($word, $type = 'AND', $non_format = FALSE, $base = '')
{
    global $script, $whatsnew, $non_list, $search_non_list;
    global $_msg_andresult, $_msg_orresult, $_msg_notfoundresult;
    global $search_auth, $show_passage;
    $retval = array();
    $b_type = $type == 'AND';
    // AND:TRUE OR:FALSE
    $keys = get_search_words(preg_split('/\\s+/', $word, -1, PREG_SPLIT_NO_EMPTY));
    foreach ($keys as $key => $value) {
        $keys[$key] = '/' . $value . '/S';
    }
    $pages = get_existpages();
    // Avoid
    if ($base != '') {
        $pages = preg_grep('/^' . preg_quote($base, '/') . '/S', $pages);
    }
    if (!$search_non_list) {
        $pages = array_diff($pages, preg_grep('/' . $non_list . '/S', $pages));
    }
    $pages = array_flip($pages);
    unset($pages[$whatsnew]);
    $count = count($pages);
    foreach (array_keys($pages) as $page) {
        $b_match = FALSE;
        // Search for page name
        if (!$non_format) {
            foreach ($keys as $key) {
                $b_match = preg_match($key, $page);
                if ($b_type xor $b_match) {
                    break;
                }
                // OR
            }
            if ($b_match) {
                continue;
            }
        }
        // Search auth for page contents
        if ($search_auth && !check_readable($page, false, false)) {
            unset($pages[$page]);
            --$count;
        }
        // Search for page contents
        foreach ($keys as $key) {
            $b_match = preg_match($key, get_source($page, TRUE, TRUE));
            if ($b_type xor $b_match) {
                break;
            }
            // OR
        }
        if ($b_match) {
            continue;
        }
        unset($pages[$page]);
        // Miss
    }
    if ($non_format) {
        return array_keys($pages);
    }
    $r_word = rawurlencode($word);
    $s_word = htmlspecialchars($word);
    if (empty($pages)) {
        return str_replace('$1', $s_word, $_msg_notfoundresult);
    }
    ksort($pages);
    $retval = '<ul>' . "\n";
    foreach (array_keys($pages) as $page) {
        $r_page = rawurlencode($page);
        $s_page = htmlspecialchars($page);
        $passage = $show_passage ? ' ' . get_passage(get_filetime($page)) : '';
        $retval .= ' <li><a href="' . $script . '?cmd=read&amp;page=' . $r_page . '&amp;word=' . $r_word . '">' . $s_page . '</a>' . $passage . '</li>' . "\n";
    }
    $retval .= '</ul>' . "\n";
    $retval .= str_replace('$1', $s_word, str_replace('$2', count($pages), str_replace('$3', $count, $b_type ? $_msg_andresult : $_msg_orresult)));
    return $retval;
}
示例#28
0
function plugin_print_action()
{
    global $defaultpage, $page_title, $newtitle;
    global $use_local_time, $language;
    global $head_tags, $foot_tags, $pkwk_dtd;
    global $vars;
    global $fixed_heading_edited, $autoglossary, $_symbol_paraedit, $_symbol_paraguiedit;
    global $_symbol_noexists;
    global $foot_explain, $note_hr;
    if (empty($vars['page']) || !is_page($vars['page'])) {
        return '';
    }
    $page = $vars['page'];
    check_readable($page, false);
    $head = isset($vars['nohead']) ? 0 : 1;
    $foot = isset($vars['nofoot']) ? 0 : 1;
    $noa = isset($vars['noa']) ? 1 : 0;
    $fixed_heading_edited = $autoglossary = 0;
    $_symbol_paraedit = $_symbol_paraguiedit = '&nbsp;';
    $body = convert_html(get_source($page));
    // Yetlist
    $noexists_pattern = '#<span class="noexists">([^<]*)<a[^>]+>' . preg_quote($_symbol_noexists, '#') . '</a></span>#';
    $body = preg_replace($noexists_pattern, '$1', $body);
    // List of footnotes
    ksort($foot_explain, SORT_NUMERIC);
    $notes = !empty($foot_explain) ? $note_hr . join("\n", $foot_explain) : '';
    if ($noa) {
        $body = strip_a($body);
        $notes = strip_a($notes);
    }
    // Tags will be inserted into <head></head>
    $head_tag = !empty($head_tags) ? join("\n", $head_tags) . "\n" : '';
    $foot_tag = !empty($foot_tags) ? join("\n", $foot_tags) . "\n" : '';
    $css_charset = 'utf-8';
    switch (UI_LANG) {
        case 'ja_JP':
            $css_charset = 'Shift_JIS';
            break;
    }
    // Output header
    pkwk_common_headers();
    header('Cache-Control: no-cache');
    header('Pragma: no-cache');
    header('Content-Type: text/html; charset=' . CONTENT_CHARSET);
    header('ETag: ' . md5(MUTIME));
    // Output HTML DTD, <html>, and receive content-type
    $meta_content_type = isset($pkwk_dtd) ? pkwk_output_dtd($pkwk_dtd) : pkwk_output_dtd();
    $CONTENT_CHARSET = CONTENT_CHARSET;
    $SKIN_URI = SKIN_URI;
    $IMAGE_URI = IMAGE_URI;
    // Plus! not use $meta_content_type. because meta-content-type is most browser not used. umm...
    echo <<<EOD
<head>
 <meta http-equiv="content-type" content="application/xhtml+xml; charset={$CONTENT_CHARSET}" />
 <meta http-equiv="content-style-type" content="text/css" />
 <meta http-equiv="content-script-type" content="text/javascript" />
 <meta name="robots" content="NOINDEX,NOFOLLOW" />

EOD;
    // $newtitle - TITLE: (convert_html)
    if ($newtitle != '') {
        $h1 = $newtitle . ' - ' . $page_title;
    } elseif ($page == $defaultpage) {
        $h1 = $page_title;
    } else {
        $h1 = $page . ' - ' . $page_title;
    }
    echo ' <title>' . $h1 . '</title>' . "\n";
    echo <<<EOD
 <link rel="stylesheet" href="{$SKIN_URI}default.css" type="text/css" media="screen" charset="{$css_charset}" />
 <link rel="stylesheet" href="{$SKIN_URI}print.css" type="text/css" media="print" charset="{$css_charset}" />
 <script type="text/javascript">
 <!--

EOD;
    if (exist_plugin_convert('js_init')) {
        echo do_plugin_convert('js_init');
    }
    echo <<<EOD
 // -->
 </script>
 <script type="text/javascript" src="{$SKIN_URI}lang/{$language}.js"></script>
 <script type="text/javascript" src="{$SKIN_URI}default.js"></script>

EOD;
    if (!$use_local_time) {
        echo <<<EOD
 <script type="text/javascript" src="{$SKIN_URI}tzCalculation_LocalTimeZone.js"></script>

EOD;
    }
    echo $head_tag;
    echo <<<EOD
</head>
<body>

EOD;
    /*
    	if ($head) {
    		echo <<<EOD
    <div id="header">
     <h1 class="title">$h1</h1>
    </div>
    
    EOD;
    	}
    */
    if ($head) {
        // Last modification date (string) of the page
        $lastmodified = get_date('D, d M Y H:i:s T', get_filetime($page)) . ' ' . get_pg_passage($page, FALSE);
        // <span style="font-size: large;line-height: 1;margin: 0px;padding: 0px;">$h1</span>
        $PRINT_HEAD_BGCOLOR = PRINT_HEAD_BGCOLOR;
        $PRINT_HEAD_BORDER = PRINT_HEAD_BORDER;
        echo <<<EOD
<div style="background-color: {$PRINT_HEAD_BGCOLOR};border: 1px {$PRINT_HEAD_BORDER} solid;padding: 6px 8px;margin: 6px 1%;">
\t<h1 class="title">{$h1}</h1>
\t<p style="font-size:10px;text-align:right;">Last-Modified: {$lastmodified}</p>
</div>

EOD;
    }
    echo <<<EOD
<div id="contents">
<table class="contents" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
  <td class="ctable" valign="top">
    <div id="body">

EOD;
    echo $body;
    echo <<<EOD
    </div>
  </td>
</tr>
</table>
</div>

EOD;
    if ($notes) {
        echo <<<EOD
<div id="note">
{$notes}
</div>

EOD;
    }
    if ($foot) {
        echo print_foot_area();
    }
    if (exist_plugin_convert('tz')) {
        echo do_plugin_convert('tz');
    }
    echo $foot_tag;
    echo <<<EOD
</body>
</html>

EOD;
    die;
}
示例#29
0
function make_pagelink($page, $alias = '', $anchor = '', $refer = '', $isautolink = FALSE)
{
    global $script, $vars, $link_compact, $related, $_symbol_noexists;
    $s_page = htmlspecialchars(strip_bracket($page));
    $s_alias = $alias == '' ? $s_page : $alias;
    if ($page == '') {
        return '<a href="' . $anchor . '">' . $s_alias . '</a>';
    }
    $r_page = rawurlencode($page);
    $r_refer = $refer == '' ? '' : '&amp;refer=' . rawurlencode($refer);
    if (!isset($related[$page]) && $page != $vars['page'] && is_page($page)) {
        $related[$page] = get_filetime($page);
    }
    if ($isautolink || is_page($page)) {
        // Hyperlink to the page
        if ($link_compact) {
            $title = '';
        } else {
            $title = ' title="' . $s_page . get_pg_passage($page, FALSE) . '"';
        }
        // AutoLink marker
        if ($isautolink) {
            $al_left = '<!--autolink-->';
            $al_right = '<!--/autolink-->';
        } else {
            $al_left = $al_right = '';
        }
        return $al_left . '<a ' . 'href="' . $script . '?' . $r_page . $anchor . '"' . $title . '>' . $s_alias . '</a>' . $al_right;
    } else {
        // Dangling link
        if (PKWK_READONLY) {
            return $s_alias;
        }
        // No dacorations
        $retval = $s_alias . '<a href="' . $script . '?cmd=edit&amp;page=' . $r_page . $r_refer . '">' . $_symbol_noexists . '</a>';
        if ($link_compact) {
            return $retval;
        } else {
            return '<span class="noexists">' . $retval . '</span>';
        }
    }
}
示例#30
0
function get_the_time($param = '')
{
    $qt = get_qt();
    $t = get_filetime($qt->getv('_page'));
    switch ($param) {
        case 'm':
        case 'd':
        case 'y':
            return date($param, $t);
        default:
            return date("Y-m-d", $t);
    }
}