コード例 #1
0
function plugin_ajaxrss_action()
{
    global $get;
    if ($get['t'] == 'js') {
        $output = plugin_ajaxrss_output_js();
        // Feeding start
        pkwk_common_headers();
        //		header('Content-type: text/javascript');
        print $output;
    } else {
        if ($get['t'] == 'url') {
            $output = plugin_ajaxrss_output_url(decode($get['q']));
            // Feeding start
            pkwk_common_headers();
            header('Content-type: application/xml');
            if (!preg_match('/\\<\\?xml/', $output, $matches)) {
                print '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
            }
            print $output;
        } else {
            $output = plugin_ajaxrss_output_xml();
            // Feeding start
            pkwk_common_headers();
            header('Content-type: application/xml');
            if (!preg_match('/\\<\\?xml/', $output, $matches)) {
                print '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
            }
            print $output;
        }
    }
    exit;
}
コード例 #2
0
/**
 * Markdon Syntax
 *
 * @author     sonots
 * @license    http://www.gnu.org/licenses/gpl.html GPL v2
 * @link       http://lsx.sourceforge.jp/?Plugin%2Fmarkdown.inc.php
 * @version    $Id: markdown.inc.php,v 1.2 2007-02-24 16:28:39Z sonots $
 * @package    plugin
 */
function plugin_markdown_convert()
{
    if (defined('PLUGIN_DIR') && file_exists(PLUGIN_DIR . 'markdown.php')) {
        $markdown = PLUGIN_DIR . 'markdown.php';
    } elseif (defined('EXT_PLUGIN_DIR') && file_exists(EXT_PLUGIN_DIR . 'markdown.php')) {
        $markdown = EXT_PLUGIN_DIR . 'markdown.php';
    } else {
        return "markdown(): markdown.php does not exist under " . PLUGIN_DIR . ' or ' . EXT_PLUGIN_DIR;
    }
    $args = func_get_args();
    $body = array_pop($args);
    $noskin = in_array("noskin", $args);
    global $vars;
    if (!(PKWK_READONLY > 0 or is_freeze($vars['page']) or plugin_markdown_is_edit_auth($vars['page']))) {
        $body = htmlspecialchars($body);
    }
    require_once $markdown;
    $body = Markdown($body);
    if ($noskin) {
        pkwk_common_headers();
        print $body;
        exit;
    }
    return $body;
}
コード例 #3
0
function plugin_cache_ref_action()
{
    global $vars;
    $usage = 'Usage: plugin=cache_ref&amp;src=filename';
    if (!isset($vars['src'])) {
        return array('msg' => 'Invalid argument', 'body' => $usage);
    }
    $filename = $vars['src'];
    $ref = CACHE_DIR . $filename;
    if (!file_exists($ref)) {
        return array('msg' => 'Cache file not found', 'body' => $usage);
    }
    $got = @getimagesize($ref);
    if (!isset($got[2])) {
        $got[2] = FALSE;
    }
    switch ($got[2]) {
        case 1:
            $type = 'image/gif';
            break;
        case 2:
            $type = 'image/jpeg';
            break;
        case 3:
            $type = 'image/png';
            break;
        case 4:
            $type = 'application/x-shockwave-flash';
            break;
        default:
            return array('msg' => 'Seems not an image', 'body' => $usage);
    }
    // Care for Japanese-character-included file name
    if (LANG == 'ja_JP') {
        switch (UA_NAME . '/' . UA_PROFILE) {
            case 'Opera/default':
                // Care for using _auto-encode-detecting_ function
                $filename = mb_convert_encoding($filename, 'UTF-8', 'auto');
                break;
            case 'MSIE/default':
                $filename = mb_convert_encoding($filename, 'SJIS', 'auto');
                break;
        }
    }
    $file = htmlspecialchars($filename);
    $size = filesize($ref);
    // Output
    pkwk_common_headers();
    header('Content-Disposition: inline; filename="' . $filename . '"');
    header('Content-Length: ' . $size);
    header('Content-Type: ' . $type);
    // @readfile($ref);
    plus_readfile($ref);
    exit;
}
コード例 #4
0
ファイル: gmapfun.inc.php プロジェクト: big2men/qhm
function plugin_gmapfun_action()
{
    global $vars;
    $page = $vars['page'];
    $body = '';
    if (is_page($page)) {
        $body = convert_html(get_source($page));
        $qt = get_qt();
        $before = $qt->getv('beforescript');
    }
    pkwk_common_headers();
    print $before . $body;
    exit;
}
コード例 #5
0
function plugin_preview_action()
{
    global $vars;
    $page = isset($vars['page']) ? $vars['page'] : '';
    if (is_page($page)) {
        check_readable($page, true, true);
        $source = get_source($page);
        array_splice($source, 10);
        $body = convert_html($source);
        pkwk_common_headers();
        header('Content-type: text/xml');
        print '<' . '?xml version="1.0" encoding="UTF-8"?' . ">\n";
        print $body;
    }
    exit;
}
コード例 #6
0
function plugin_monobook_login_action()
{
    global $vars, $auth_users, $_msg_auth, $_monobook_login_messages;
    if (!isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['PHP_AUTH_PW']) && isset($_SERVER['HTTP_AUTHORIZATION'])) {
        list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
    }
    if (auth::check_role('readonly') || !isset($_SERVER['PHP_AUTH_USER']) || !isset($auth_users[$_SERVER['PHP_AUTH_USER']]) || !isset($_SERVER['PHP_AUTH_PW']) || pkwk_hash_compute($_SERVER['PHP_AUTH_PW'], $auth_users[$_SERVER['PHP_AUTH_USER']]) !== $auth_users[$_SERVER['PHP_AUTH_USER']]) {
        pkwk_common_headers();
        header('WWW-Authenticate: Basic realm="' . $_msg_auth . '"');
        header('HTTP/1.0 401 Unauthorized');
        $msg = $_monobook_login_messages['auth_failed'];
        return array('msg' => $msg, 'body' => '<p>' . $msg . '</p>');
    } elseif (isset($vars['refer']) && is_page($vars['refer'])) {
        header('Location: ' . get_script_uri() . '?' . rawurlencode($vars['refer']));
    }
    return;
}
コード例 #7
0
function plugin_tooltip_action()
{
    global $vars;
    $term = $vars['q'];
    if (trim($term) == '') {
        exit;
    }
    $glossary = plugin_tooltip_get_glossary($term, '', TRUE);
    if ($glossary == FALSE) {
        exit;
    }
    $s_glossary = convert_html($glossary);
    pkwk_common_headers();
    header('Content-type: text/xml');
    print '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
    print $s_glossary;
    exit;
}
コード例 #8
0
function plugin_htmlp_convert()
{
    $args = func_get_args();
    $body = array_pop($args);
    if (substr($body, -1) != "\r") {
        return '<p>htmlp(): no argument(s).</p>';
    }
    require_once 'htmlpurifier/library/HTMLPurifier.auto.php';
    $purifier = new HTMLPurifier();
    $body = $purifier->purify($body);
    $noskin = in_array("noskin", $args);
    if ($noskin) {
        pkwk_common_headers();
        print $body;
        exit;
    }
    return $body;
}
コード例 #9
0
function plugin_xbel_action()
{
    global $vars, $page_title, $rss_description, $whatsnew;
    $adm = empty($vars['adm']) ? 'page' : $vars['adm'];
    // ユーザ認証されていない
    $id = auth::check_auth();
    if (empty($id)) {
        $adm = 'recent';
    }
    $data = <<<EOD
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xbel PUBLIC "+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML" "http://www.python.org/topics/xml/dtds/xbel-1.0.dtd">
<xbel version="1.0">
<title><![CDATA[{$page_title}]]></title>
<desc><![CDATA[{$rss_description}]]></desc>


EOD;
    change_uri('', 1);
    // Force absoluteURI.
    switch ($adm) {
        case 'list':
            $pages = xbel::get_data();
            break;
        case 'recent':
            $pages = array($whatsnew);
            break;
            // list
        // list
        default:
            $page = empty($vars['page']) ? $whatsnew : $vars['page'];
            $pages = array($page);
            unset($page);
    }
    foreach ($pages as $page) {
        $links = xbel::get_link_list($page);
        $data .= xbel::put_body($links, $page);
    }
    $data .= "</xbel>\n";
    pkwk_common_headers();
    header('Content-type: application/xml');
    print $data;
    exit;
}
コード例 #10
0
ファイル: htmlinsert.inc.php プロジェクト: logue/pukiwiki_adv
 function action()
 {
     global $vars;
     list($page, $variables, $this->action_options) = $this->parse_args_action($vars, $this->default_action_options);
     if ($page == '') {
         return array('msg' => $this->plugin, 'body' => '<p class="alert alert-warning">#' . $this->plugin() . ': No page is specified.</p>');
     }
     $source = $this->htmlinsert($page, $variables);
     if ($this->error != "") {
         return array('msg' => $this->plugin, 'body' => '<p class="alert alert-warning">#' . $this->plugin() . ': ' . $this->error . '</p>');
     }
     // no skin
     pkwk_common_headers();
     if ($this->action_options['content_type'] != '') {
         header('Content-Type: ' . htmlsc($this->action_options['content_type']));
     }
     print $source;
     exit;
 }
コード例 #11
0
/**
 * Write HTML
 *
 * @author     sonots
 * @license    http://www.gnu.org/licenses/gpl.html GPL v2
 * @link       http://lsx.sourceforge.jp/?Plugin%2Fhtml.inc.php
 * @version    $Id: html.inc.php,v 2.2 2007-03-20 23:44:19Z sonots $
 * @package    plugin
 */
function plugin_html_convert()
{
    $args = func_get_args();
    $body = array_pop($args);
    if (substr($body, -1) != "\r") {
        return '<p>html(): no argument(s).</p>';
    }
    $page = $GLOBALS['vars']['page'];
    if (!plugin_html_is_edit_restricted($page)) {
        return "<p>html(): Current page, {$page}, must be edit_authed or frozen or whole system must be PKWK_READONLY.</p>";
    }
    $noskin = in_array("noskin", $args);
    if ($noskin) {
        pkwk_common_headers();
        print $body;
        exit;
    }
    return $body;
}
コード例 #12
0
function plugin_mceedit_realview()
{
    global $vars;
    $vars['msg'] = preg_replace(PLUGIN_EDIT_FREEZE_REGEX, '', $vars['msg']);
    $postdata = $vars['msg'];
    if ($postdata) {
        $postdata = make_str_rules($postdata);
        $postdata = explode("\n", $postdata);
        $postdata = drop_submit(convert_html($postdata));
    }
    // Feeding start
    pkwk_common_headers();
    header('Content-type: text/xml; charset=UTF-8');
    print '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
    print $postdata;
    $longtaketime = getmicrotime() - MUTIME;
    $taketime = sprintf('%01.03f', $longtaketime);
    print '<span class="small1">(Time:' . $taketime . ')</span>';
    exit;
}
コード例 #13
0
 /**
  * Action Plugin Main Function
  */
 function action()
 {
     global $vars;
     $page = $vars['page'];
     unset($vars['page']);
     if (!isset($page) || $page == '') {
         return array('msg' => $this->plugin, 'body' => '<p>' . $this->error_message(5) . '</p>');
     }
     $argoptions = $vars;
     unset($argoptions['cmd']);
     list($options, $variables) = $this->evaluate_options($argoptions, $this->defoptions);
     $source = $this->htmlinsert($page, $variables);
     if (!is_string($source)) {
         return array('msg' => $this->plugin, 'body' => '<p>' . $this->error_message($source) . '</p>');
     }
     // no skin
     pkwk_common_headers();
     if (!empty($options['content_type'])) {
         header('Content-Type: ' . htmlspecialchars($options['content_type']));
     }
     print $source;
     exit;
 }
コード例 #14
0
ファイル: commu_html.inc.php プロジェクト: big2men/qhm
function plugin_commu_html_convert()
{
    global $vars;
    //キャッシュを無効に
    if (QHM_VERSION < 4.6) {
        global $enable_cache;
        $enable_cache = false;
    } else {
        $qt = get_qt();
        $qt->enable_cache = false;
    }
    $page = $vars['page'];
    if (!(PKWK_READONLY > 0 or is_freeze($page) or plugin_commu_html_is_edit_auth($page))) {
        return "<p>commu_html(): Current page, {$page}, must be edit_authed or frozen or whole system must be PKWK_READONLY.</p>";
    }
    $args = func_get_args();
    $body = array_pop($args);
    $noskin = in_array("noskin", $args);
    $s = array();
    $r = array();
    $cnt = 0;
    if (isset($_SESSION['commu_user'])) {
        foreach ($_SESSION['commu_user'] as $key => $val) {
            $s[$cnt] = '/<%' . $key . '%>/';
            $r[$cnt] = mb_convert_encoding($val, "UTF-8", "UTF-8,EUC-JP");
            $cnt++;
        }
        $body = preg_replace($s, $r, $body);
    }
    if ($noskin) {
        pkwk_common_headers();
        print $body;
        exit;
    }
    return $body;
}
コード例 #15
0
 /**
  * Output contents without skin
  *
  * PukiWiki API Extension
  *
  * @access public
  * @static
  * @param string $body html
  * @param string $content_type e.g., 'text/html', 'text/css', 'text/javascript'
  * @return void exit
  * @uses pkwk_common_headers (PukiWiki lib/html.php)
  * @version $Id: v 1.0 2008-06-05 11:14:46 sonots $
  */
 function pkwk_output_noskin($body, $content_type = 'text/html')
 {
     pkwk_common_headers();
     header('Content-Type: ' . $content_type);
     print $body;
     exit;
 }
コード例 #16
0
ファイル: func.php プロジェクト: big2men/qhm
function output_site_close_message($site_name, $login_url)
{
    global $qhm_adminmenu;
    $qhm_sign = $qhm_adminmenu < 2 ? '<a href="' . h($login_url) . '">QHM</a>' : 'QHM';
    pkwk_common_headers();
    $qm = get_qm();
    $closetitle = $qm->m['func']['close_title'];
    $closemsg = $qm->m['func']['close_message'];
    header('Content-Type: text/html; charset=utf-8');
    print <<<EOD
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title>{$closetitle} : {$site_name} (Close this site)</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="GENERATOR" content="Quick Homepage Maker" />
  <style>
  body{
  \tbackground-color:#ccc;
  \tcolor:#333;
  \tfont-family: "Arial", "San-serif";
  \tfont-size: 10pt;
  \tline-height:1.5em;
  }
  #wrapper {
  \tbackground-color:#fff;
  \tpadding:20px;
  \tmargin:20px auto;
  \twidth:500px;
  \tborder: 1px solid #aaa;
  }
  #wrapper h1{
  \tfont-size:12pt;
  }
  #login{
  \t\tcolor:#999;
  \t\tfont-size:11px;
  \t\ttext-align:right;
  }
  #login a{
  \t\tcolor:#999;
\t\ttext-decoration:none;
  }
  </style>
 </head>
 <body>
 <div id="wrapper">
 <h1>{$closetitle}</h1>
 <p>{$closemsg}</p>
 <br />

 <h1>Closed</h1>
 <p>Sorry, but this site is now closed</p>

 <div id="login">powered by {$qhm_sign}</div>
 </div>
 </body>
</html>
EOD;
    exit;
}
コード例 #17
0
ファイル: rss.inc.php プロジェクト: nsmr0604/pukiwiki
function plugin_rss_action()
{
    global $vars, $rss_max, $page_title, $whatsnew, $trackback;
    $version = isset($vars['ver']) ? $vars['ver'] : '';
    switch ($version) {
        case '':
            $version = '0.91';
            break;
            // Default
        // Default
        case '1':
            $version = '1.0';
            break;
            // Sugar
        // Sugar
        case '2':
            $version = '2.0';
            break;
            // Sugar
        // Sugar
        case '0.91':
            /* FALLTHROUGH */
        /* FALLTHROUGH */
        case '1.0':
            /* FALLTHROUGH */
        /* FALLTHROUGH */
        case '2.0':
            break;
        default:
            die('Invalid RSS version!!');
    }
    $recent = CACHE_DIR . 'recent.dat';
    if (!file_exists($recent)) {
        die('recent.dat is not found');
    }
    $lang = LANG;
    $page_title_utf8 = mb_convert_encoding($page_title, 'UTF-8', SOURCE_ENCODING);
    $self = get_script_uri();
    // Creating <item>
    $items = $rdf_li = '';
    foreach (file_head($recent, $rss_max) as $line) {
        list($time, $page) = explode("\t", rtrim($line));
        $r_page = rawurlencode($page);
        $title = mb_convert_encoding($page, 'UTF-8', SOURCE_ENCODING);
        switch ($version) {
            case '0.91':
                /* FALLTHROUGH */
            /* FALLTHROUGH */
            case '2.0':
                $date = get_date('D, d M Y H:i:s T', $time);
                $date = $version == '0.91' ? ' <description>' . $date . '</description>' : ' <pubDate>' . $date . '</pubDate>';
                $items .= <<<EOD
<item>
 <title>{$title}</title>
 <link>{$self}?{$r_page}</link>
{$date}
</item>

EOD;
                break;
            case '1.0':
                // Add <item> into <items>
                $rdf_li .= '    <rdf:li rdf:resource="' . $self . '?' . $r_page . '" />' . "\n";
                $date = substr_replace(get_date('Y-m-d\\TH:i:sO', $time), ':', -2, 0);
                $trackback_ping = '';
                if ($trackback) {
                    $tb_id = md5($r_page);
                    $trackback_ping = ' <trackback:ping>' . $self . '?tb_id=' . $tb_id . '</trackback:ping>';
                }
                $items .= <<<EOD
<item rdf:about="{$self}?{$r_page}">
 <title>{$title}</title>
 <link>{$self}?{$r_page}</link>
 <dc:date>{$date}</dc:date>
 <dc:identifier>{$self}?{$r_page}</dc:identifier>
{$trackback_ping}
</item>

EOD;
                break;
        }
    }
    // Feeding start
    pkwk_common_headers();
    header('Content-type: application/xml');
    print '<?xml version="1.0" encoding="UTF-8"?>' . "\n\n";
    $r_whatsnew = rawurlencode($whatsnew);
    switch ($version) {
        case '0.91':
            print '<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"' . ' "http://my.netscape.com/publish/formats/rss-0.91.dtd">' . "\n";
            /* FALLTHROUGH */
        /* FALLTHROUGH */
        case '2.0':
            print <<<EOD
<rss version="{$version}">
 <channel>
  <title>{$page_title_utf8}</title>
  <link>{$self}?{$r_whatsnew}</link>
  <description>PukiWiki RecentChanges</description>
  <language>{$lang}</language>

{$items}
 </channel>
</rss>
EOD;
            break;
        case '1.0':
            $xmlns_trackback = $trackback ? '  xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"' : '';
            print <<<EOD
<rdf:RDF
  xmlns:dc="http://purl.org/dc/elements/1.1/"
{$xmlns_trackback}
  xmlns="http://purl.org/rss/1.0/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xml:lang="{$lang}">
 <channel rdf:about="{$self}?{$r_whatsnew}">
  <title>{$page_title_utf8}</title>
  <link>{$self}?{$r_whatsnew}</link>
  <description>PukiWiki RecentChanges</description>
  <items>
   <rdf:Seq>
{$rdf_li}
   </rdf:Seq>
  </items>
 </channel>

{$items}
</rdf:RDF>
EOD;
            break;
    }
    exit;
}
コード例 #18
0
/**
 * [アクション] 動画(HLS)再生用のキーを返す
 *
 * 注意: exitを呼ぶので、処理の最後に呼び出すこと
 *
 * @return void
 */
function plugin_movieviewer_action_download_hls_key()
{
    pkwk_common_headers();
    header('Content-type: application/octet-stream');
    $settings = MovieViewerSettings::loadFromYaml(PLUGIN_MOVIEVIEWER_PATH_TO_SETTINGS);
    $decrypter = new MovieViewerAwsTranscorderEncriptionKeyDecypter($settings->aws['kms'], $settings->aws['transcoder']);
    print $decrypter->execute();
    exit;
}
コード例 #19
0
ファイル: tb.inc.php プロジェクト: nsmr0604/pukiwiki
function plugin_tb_output_htmllist($tb_id)
{
    pkwk_common_headers();
    echo 'This function had been removed now. It will be created soon.<br />' . "\n";
    echo 'Sorry for your inconvenience.';
    exit;
    // ----
    // Skeleton Logic
    global $script;
    global $_tb_date;
    $page = tb_id2page($tb_id);
    if ($page === false) {
        return false;
    }
    $data = tb_get(tb_get_filename($page));
    // Sort: The first is the latest
    usort($data, create_function('$a,$b', 'return $b[0] - $a[0];'));
    $tb_body = '';
    foreach ($data as $x) {
        if (count($x) != 5) {
            continue;
        }
        // Ignore incorrect record
        list($time, $url, $title, $excerpt, $blog_name) = $x;
        if ($title == '') {
            $title = 'no title';
        }
        $time = date($_tb_date, $time + LOCALZONE);
        // May 2, 2003 11:25 AM
        $tb_body .= <<<EOD
EOD;
    }
    // Output start
    pkwk_common_headers();
    // BugTrack/466 Care for MSIE trouble
    // Logically correct, but MSIE will treat the data like 'file downloading'
    //header('Content-type: application/xhtml+xml; charset=UTF-8');
    header('Content-type: text/html; charset=UTF-8');
    // Works well
    $meta_content_type = pkwk_output_dtd(PKWK_DTD_XHTML_1_0_TRANSITIONAL, 'UTF-8');
    $msg = <<<EOD
<head>
 {$meta_content_type}
</head>
<body>
 {$script}?tb_id={$tb_id}<br /><br />
 {$tb_body}
</body>
</html>
EOD;
    echo mb_convert_encoding($msg, 'UTF-8', SOURCE_ENCODING);
    exit;
}
コード例 #20
0
ファイル: auth.php プロジェクト: aterai/pukiwiki-plus-i18n
function digest_auth($page, $auth_flag, $exit_flag, $auth_pages, $title_cannot)
{
    global $auth_users, $auth_method_type, $auth_type;
    global $realm;
    if (auth::is_page_auth($page, $auth_flag, $auth_pages, '', '')) {
        return true;
    }
    // No limit
    //$user_list = get_auth_page_users($page, $auth_pages);
    //if (empty($user_list)) return true; // No limit
    if (!auth::check_role('role_adm_contents')) {
        return true;
    }
    // 既にコンテンツ管理者
    if (auth::auth_digest($auth_users)) {
        return true;
    }
    // Auth failed
    if ($auth_flag || $exit_flag) {
        pkwk_common_headers();
    }
    if ($auth_flag) {
        header('HTTP/1.1 401 Unauthorized');
        header('WWW-Authenticate: Digest realm="' . $realm . '", qop="auth", nonce="' . uniqid() . '", opaque="' . md5($realm) . '"');
    }
    if ($exit_flag) {
        $body = $title = str_replace('$1', htmlspecialchars(strip_bracket($page)), $title_cannot);
        $page = str_replace('$1', make_search($page), $title_cannot);
        catbody($title, $page, $body);
        exit;
    }
    return false;
}
コード例 #21
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;
}
コード例 #22
0
 /**
  * Action Plugin Main Function
  */
 function action()
 {
     global $vars;
     if (isset($vars['pcmd']) && $vars['pcmd'] == 'css') {
         pkwk_common_headers();
         header('Content-Type: text/css');
         foreach ($this->css as $key => $val) {
             print $key . " {\n";
             print str_replace(';', ";\n", $val);
             print '}' . "\n";
         }
         exit;
     }
     return array('title' => $this->plugin, 'body' => 'nothing to do');
 }
コード例 #23
0
ファイル: ref2.inc.php プロジェクト: big2men/qhm
function plugin_ref2_action()
{
    global $vars;
    $qm = get_qm();
    if (!isset($vars['page']) || !isset($vars['src'])) {
        return array('msg' => $qm->m['plg_ref']['title_invalid_args'], 'body' => $qm->m['plg_ref2']['err_usage_action']);
    }
    $page = $vars['page'];
    $filename = $vars['src'];
    $ref = UPLOAD_DIR . encode($page) . '_' . encode(preg_replace('#^.*/#', '', $filename));
    if (!file_exists($ref)) {
        return array('msg' => $qm->m['plg_ref']['title_notfound'], 'body' => $qm->m['plg_ref2']['err_usage_action']);
    }
    $got = @getimagesize($ref);
    if (!isset($got[2])) {
        $got[2] = FALSE;
    }
    switch ($got[2]) {
        case 1:
            $type = 'image/gif';
            break;
        case 2:
            $type = 'image/jpeg';
            break;
        case 3:
            $type = 'image/png';
            break;
        case 4:
            $type = 'application/x-shockwave-flash';
            break;
        default:
            return array('msg' => $qm->m['plg_ref']['title_notimage'], 'body' => $qm->m['plg_ref2']['err_usage_action']);
    }
    // Care for Japanese-character-included file name
    if (LANG == 'ja') {
        switch (UA_NAME . '/' . UA_PROFILE) {
            case 'Opera/default':
                // Care for using _auto-encode-detecting_ function
                $filename = mb_convert_encoding($filename, 'UTF-8', 'auto');
                break;
            case 'MSIE/default':
                $filename = mb_convert_encoding($filename, 'SJIS', 'auto');
                break;
        }
    }
    $file = htmlspecialchars($filename);
    $size = filesize($ref);
    // Output
    pkwk_common_headers();
    header('Content-Disposition: inline; filename="' . $filename . '"');
    header('Content-Length: ' . $size);
    header('Content-Type: ' . $type);
    @readfile($ref);
    exit;
}
コード例 #24
0
ファイル: attach.inc.php プロジェクト: geoemon2k/source_wiki
 function open()
 {
     $this->getstatus();
     $this->status['count'][$this->age]++;
     $this->putstatus();
     $filename = $this->file;
     // Care for Japanese-character-included file name
     if (LANG == 'ja') {
         switch (UA_NAME . '/' . UA_PROFILE) {
             case 'Opera/default':
                 // Care for using _auto-encode-detecting_ function
                 $filename = mb_convert_encoding($filename, 'UTF-8', 'auto');
                 break;
             case 'MSIE/default':
                 $filename = mb_convert_encoding($filename, 'SJIS', 'auto');
                 break;
         }
     }
     $utf8filename = mb_convert_encoding($filename, 'UTF-8', 'auto');
     ini_set('default_charset', '');
     mb_http_output('pass');
     pkwk_common_headers();
     header('Content-Disposition: inline; filename="' . $filename . '"; filename*=utf-8\'\'' . rawurlencode($utf8filename));
     header('Content-Length: ' . $this->size);
     header('Content-Type: ' . $this->type);
     @readfile($this->filename);
     exit;
 }
コード例 #25
0
ファイル: init.php プロジェクト: orangeal2o3/pukiwiki-plugin
    $encode = mb_detect_encoding($_GET['encode_hint']);
    mb_convert_variables(SOURCE_ENCODING, $encode, $_GET);
}
/////////////////////////////////////////////////
// QUERY_STRINGを取得
$arg = '';
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) {
    $arg =& $_SERVER['QUERY_STRING'];
} else {
    if (isset($_SERVER['argv']) && !empty($_SERVER['argv'])) {
        $arg =& $_SERVER['argv'][0];
    }
}
if (PKWK_QUERY_STRING_MAX && strlen($arg) > PKWK_QUERY_STRING_MAX) {
    // Something nasty attack?
    pkwk_common_headers();
    echo 'Query string too long';
    exit;
}
$arg = input_filter($arg);
// \0 除去
// unset QUERY_STRINGs
foreach (array('QUERY_STRING', 'argv', 'argc') as $key) {
    unset(${$key}, $_SERVER[$key], $HTTP_SERVER_VARS[$key]);
}
// $_SERVER['REQUEST_URI'] is used at func.php NOW
unset($REQUEST_URI, $HTTP_SERVER_VARS['REQUEST_URI']);
// mb_convert_variablesのバグ(?)対策: 配列で渡さないと落ちる
$arg = array($arg);
mb_convert_variables(SOURCE_ENCODING, 'auto', $arg);
$arg = $arg[0];
コード例 #26
0
ファイル: qform.inc.php プロジェクト: big2men/qhm
function plugin_qform_action()
{
    global $vars, $script;
    $id = $vars['id'];
    $path = $_SESSION['qform']['_FILES'][$id]['path'];
    $name = $_SESSION['qform']['_FILES'][$id]['name'];
    if ($path != '' && file_exists($path)) {
        $got = @getimagesize($path);
        if (!isset($got[2])) {
            $got[2] = FALSE;
        }
        switch ($got[2]) {
            case 1:
                $type = 'image/gif';
                break;
            case 2:
                $type = 'image/jpeg';
                break;
            case 3:
                $type = 'image/png';
                break;
            case 4:
                $type = 'application/x-shockwave-flash';
                break;
            default:
                $type = get_mimetype($name);
        }
        $file = htmlspecialchars($name);
        $size = filesize($path);
        pkwk_common_headers();
        header('Content-Disposition: inline; filename="' . $file . '"');
        header('Content-Length: ' . $size);
        header('Content-Type: ' . $type);
        @readfile($path);
    } else {
        echo 'No data';
    }
    exit;
}
コード例 #27
0
ファイル: rss.inc.php プロジェクト: logue/pukiwiki_adv
function plugin_rss_action()
{
    global $vars, $rss_max, $rss_description, $page_title, $whatsnew, $trackback;
    $version = isset($vars['ver']) ? $vars['ver'] : '2.0';
    switch ($version) {
        case '1':
            $version = '1.0';
            break;
            // Sugar
        // Sugar
        case '2':
            $version = '2.0';
            break;
            // Sugar
        // Sugar
        case '0.91':
            /* FALLTHROUGH */
        /* FALLTHROUGH */
        case '1.0':
            /* FALLTHROUGH */
        /* FALLTHROUGH */
        case '2.0':
        default:
            break;
    }
    $lang = LANG;
    $page_title_utf8 = mb_convert_encoding($page_title, 'UTF-8', SOURCE_ENCODING);
    $self = get_script_absuri();
    $rss_description_utf8 = mb_convert_encoding(htmlspecialchars($rss_description), 'UTF-8', SOURCE_ENCODING);
    // Creating <item>
    $items = $rdf_li = '';
    $recent = CACHE_DIR . PKWK_MAXSHOW_CACHE;
    if (!file_exists($recent)) {
        die('PKWK_MAXSHOW_CACHE is not found');
    }
    foreach (file_head($recent, $rss_max) as $line) {
        list($time, $page) = explode("\t", rtrim($line));
        $items .= plugin_rss_generate_item($version, $time, $page);
    }
    // Feeding start
    pkwk_common_headers($time);
    //	header('Content-type: application/xml');
    header('Content-type: text/html');
    print '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
    $url_whatsnew = get_page_absuri($whatsnew);
    switch ($version) {
        case '0.91':
            print '<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"' . ' "http://my.netscape.com/publish/formats/rss-0.91.dtd">' . "\n";
            /* FALLTHROUGH */
        /* FALLTHROUGH */
        case '2.0':
            print <<<EOD
<rss version="{$version}">
\t<channel>
\t\t<title><![CDATA[{$page_title_utf8}]]></title>
\t\t<link>{$url_whatsnew}</link>
\t\t<description><![CDATA[{$rss_description_utf8}]]></description>
\t\t<language>{$lang}</language>
{$items}
\t</channel>
</rss>
EOD;
            break;
        case '1.0':
            $xmlns_trackback = $trackback ? 'xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"' : '';
            print <<<EOD
<rdf:RDF
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  {$xmlns_trackback}
  xmlns="http://purl.org/rss/1.0/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xml:lang="{$lang}">
\t<channel rdf:about="{$url_whatsnew}">
\t\t<title><![CDATA[{$page_title_utf8}]]></title>
\t\t<link>{$url_whatsnew}</link>
\t\t<description><![CDATA[{$rss_description_utf8}]]></description>
\t\t<items>
\t\t\t<rdf:Seq>
{$rdf_li}
\t\t\t</rdf:Seq>
\t\t</items>
\t</channel>
{$items}
</rdf:RDF>
EOD;
            break;
    }
    exit;
}
コード例 #28
0
ファイル: auth.php プロジェクト: nsmr0604/pukiwiki
function basic_auth($page, $auth_flag, $exit_flag, $auth_pages, $title_cannot)
{
    global $auth_method_type, $auth_users, $_msg_auth;
    // Checked by:
    $target_str = '';
    if ($auth_method_type == 'pagename') {
        $target_str = $page;
        // Page name
    } elseif ($auth_method_type == 'contents') {
        $target_str = join('', get_source($page));
        // Its contents
    }
    $user_list = array();
    foreach ($auth_pages as $key => $val) {
        if (preg_match($key, $target_str)) {
            $user_list = array_merge($user_list, explode(',', $val));
        }
    }
    if (empty($user_list)) {
        return true;
    }
    // No limit
    $matches = array();
    if (!isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['PHP_AUTH_PW']) && isset($_SERVER['HTTP_AUTHORIZATION']) && preg_match('/^Basic (.*)$/', $_SERVER['HTTP_AUTHORIZATION'], $matches)) {
        // Basic-auth with $_SERVER['HTTP_AUTHORIZATION']
        list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode($matches[1]));
    }
    if (PKWK_READONLY || !isset($_SERVER['PHP_AUTH_USER']) || !in_array($_SERVER['PHP_AUTH_USER'], $user_list) || !isset($auth_users[$_SERVER['PHP_AUTH_USER']]) || pkwk_hash_compute($_SERVER['PHP_AUTH_PW'], $auth_users[$_SERVER['PHP_AUTH_USER']]) !== $auth_users[$_SERVER['PHP_AUTH_USER']]) {
        // Auth failed
        pkwk_common_headers();
        if ($auth_flag) {
            header('WWW-Authenticate: Basic realm="' . $_msg_auth . '"');
            header('HTTP/1.0 401 Unauthorized');
        }
        if ($exit_flag) {
            $body = $title = str_replace('$1', htmlsc(strip_bracket($page)), $title_cannot);
            $page = str_replace('$1', make_search($page), $title_cannot);
            catbody($title, $page, $body);
            exit;
        }
        return false;
    } else {
        return true;
    }
}
コード例 #29
0
ファイル: func.php プロジェクト: KimuraYoichi/PukiWiki
function die_message($msg)
{
    $title = $page = 'Runtime error';
    $body = <<<EOD
<h3>Runtime error</h3>
<strong>Error message : {$msg}</strong>
EOD;
    pkwk_common_headers();
    if (defined('SKIN_FILE') && file_exists(SKIN_FILE) && is_readable(SKIN_FILE)) {
        catbody($title, $page, $body);
    } else {
        header('Content-Type: text/html; charset=euc-jp');
        print <<<EOD
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title>{$title}</title>
  <meta http-equiv="content-type" content="text/html; charset=euc-jp">
 </head>
 <body>
 {$body}
 </body>
</html>
EOD;
    }
    exit;
}
コード例 #30
0
ファイル: html.inc.php プロジェクト: big2men/qhm
function plugin_html_convert()
{
    global $script, $vars;
    $qm = get_qm();
    $qt = get_qt();
    $page = isset($vars['page_alt']) ? $vars['page_alt'] : $vars['page'];
    $ids = $qt->getv('plugin_html_id');
    if (!$ids) {
        $ids = array($page => 0);
    }
    $id = ++$ids[$page];
    $qt->setv('plugin_html_id', $ids);
    if (!(PKWK_READONLY > 0 or is_freeze($page) or plugin_html_is_edit_auth($page))) {
        return $qm->replace('fmt_msg_not_editable', '#html', $page);
    }
    $args = func_get_args();
    $body = array_pop($args);
    $size = '';
    $class = 'autofit_iframe';
    foreach ($args as $arg) {
        if ($arg == 'noskin') {
            $noskin = true;
            break;
        } else {
            if ($arg == 'iframe') {
                $iframe = true;
            } else {
                if (preg_match('/^(\\d+)(?:x(\\d+))?$/', $arg, $mts)) {
                    $x = "width:{$mts[1]}px;";
                    $y = isset($mts[2]) ? "height:{$mts[2]}px;" : '';
                    $size = $x . $y;
                    $class = '';
                }
            }
        }
    }
    if ($noskin) {
        pkwk_common_headers();
        print $body;
        exit;
    } else {
        if ($iframe) {
            $qt->setv('jquery_include', true);
            exist_plugin('iframe');
            $qt->appendv_once('plugin_iframe', 'beforescript', PLUGIN_IFRAME_FIT_IFRAME_JS);
            $r_page = rawurlencode($page);
            $body = '<iframe src="' . $script . '?cmd=html&page=' . $r_page . '&id=' . $id . '" frameborder="0" class="' . $class . '" style="' . $size . '"></iframe>';
        }
    }
    return $body;
}