function get_a_tag() { if (defined('HYP_K_TAI_RENDER') && HYP_K_TAI_RENDER && HypCommonFunc::get_version() >= '20080620') { HypCommonFunc::loadClass('HypKTaiRender'); $r = new HypKTaiRender(); $r->set_myRoot(XOOPS_URL); $msg['easylogin'] = $this->root->k_tai_conf['msg']['easylogin'] ? $this->root->k_tai_conf['msg']['easylogin'] : '******'; $msg['logout'] = $this->root->k_tai_conf['msg']['logout'] ? $this->root->k_tai_conf['msg']['logout'] : 'Logout'; if (!empty($r->vars['ua']['isKTai'])) { if (!$this->root->userinfo['uid']) { $add = '_EASYLOGIN'; if ($r->vars['ua']['carrier'] === 'docomo') { $add .= '&guid=ON'; } $url = $r->myRoot . $r->removeSID($_SERVER['REQUEST_URI']); $url .= (strpos($url, '?') === FALSE ? '?' : '&') . $add; $url = str_replace('&', '&', $url); return '<a href="' . $url . '">' . $msg['easylogin'] . '</a>'; } else { $guid = $r->vars['ua']['carrier'] === 'docomo' ? '&guid=ON' : ''; return '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $this->root->userinfo['uid'] . $guid . '">' . $this->root->userinfo['uname_s'] . '</a> <a href="' . XOOPS_URL . '/user.php?op=logout">' . $msg['logout'] . '</a>'; } } } return ''; }
function preFilter() { $ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; // Set const "HYP_IS_BOT_UA" if ($ua && preg_match($this->bot_ua_reg, $ua)) { define('HYP_IS_BOT_UA', true); } // Use K_TAI Render if (!empty($this->use_k_tai_render)) { if (isset($_GET['_hypktaipc'])) { if (!$_GET['_hypktaisw']) { setcookie('_hypktaipc', '', 1, '/'); unset($_COOKIE['_hypktaipc']); } } $_k_tai_ua_regex = isset($this->k_tai_conf['ua_regex#' . XOOPS_URL]) ? $this->k_tai_conf['ua_regex#' . XOOPS_URL] : $this->k_tai_conf['ua_regex']; if (empty($_COOKIE['_hypktaipc']) && $ua && preg_match($_k_tai_ua_regex, $ua)) { // Reset each site values. foreach (array_keys($this->k_tai_conf) as $key) { if (strpos($key, '#') === FALSE) { $sitekey = $key . '#' . XOOPS_URL; if (isset($this->k_tai_conf[$sitekey])) { $this->k_tai_conf[$key] = $this->k_tai_conf[$sitekey]; } } } // Set HypKTaiRender HypCommonFunc::loadClass('HypKTaiRender'); $this->HypKTaiRender =& HypKTaiRender::getSingleton(); $this->HypKTaiRender->set_myRoot(XOOPS_URL); $this->HypKTaiRender->Config_emojiDir = XOOPS_URL . '/images/emoji'; $this->HypKTaiRender->Config_redirect = $this->k_tai_conf['redirect']; $this->HypKTaiRender->Config_showImgHosts = $this->k_tai_conf['showImgHosts']; $this->HypKTaiRender->Config_directImgHosts = $this->k_tai_conf['directImgHosts']; $this->HypKTaiRender->Config_directLinkHosts = $this->k_tai_conf['directLinkHosts']; $this->HypKTaiRender->Config_hypCommonURL = XOOPS_URL . '/class/hyp_common'; $this->HypKTaiRender->Config_icons = array_merge($this->HypKTaiRender->Config_icons, $this->k_tai_conf['icon']); $this->HypKTaiRender->pagekey = $this->k_tai_conf['getKeys']['page']; $this->HypKTaiRender->hashkey = $this->k_tai_conf['getKeys']['hash']; $this->HypKTaiRender->Config_pictSizeMax = $this->k_tai_conf['pictSizeMax']; $this->HypKTaiRender->Config_docomoGuidTTL = $this->k_tai_conf['docomoGuidTTL']; $this->HypKTaiRender->marge_urlRewites('urlRewrites', $this->k_tai_conf['urlRewrites']); $this->HypKTaiRender->marge_urlRewites('urlImgRewrites', $this->k_tai_conf['urlImgRewrites']); // use jquery mobile? $this->HypKTaiRender->Config_jquery = $use_jqm = in_array($this->HypKTaiRender->vars['ua']['carrier'], explode(',', $this->k_tai_conf['jquery_profiles'])); $this->HypKTaiRender->Config_jquery_remove_flash = $this->k_tai_conf['jquery_remove_flash']; $this->HypKTaiRender->Config_jquery_resolve_table = $this->k_tai_conf['jquery_resolve_table']; $this->HypKTaiRender->Config_jquery_image_convert = $this->k_tai_conf['jquery_image_convert']; // jQuery use: 2, Normal: 1 define('HYP_K_TAI_RENDER', $use_jqm ? 2 : 1); // theme & template set if ($use_jqm && isset($this->k_tai_conf['themeSets']['jqm']) && $this->k_tai_conf['themeSets']['jqm']) { $this->k_tai_conf['themeSet'] = $this->k_tai_conf['themeSets']['jqm']; } if (isset($this->k_tai_conf['themeSets'][$this->HypKTaiRender->vars['ua']['carrier']]) && $this->k_tai_conf['themeSets'][$this->HypKTaiRender->vars['ua']['carrier']]) { $this->k_tai_conf['themeSet'] = $this->k_tai_conf['themeSets'][$this->HypKTaiRender->vars['ua']['carrier']]; } if ($use_jqm && isset($this->k_tai_conf['templateSets']['jqm']) && $this->k_tai_conf['templateSets']['jqm']) { $this->k_tai_conf['templateSet'] = $this->k_tai_conf['templateSets']['jqm']; } if (isset($this->k_tai_conf['templateSets'][$this->HypKTaiRender->vars['ua']['carrier']]) && $this->k_tai_conf['templateSets'][$this->HypKTaiRender->vars['ua']['carrier']]) { $this->k_tai_conf['templateSet'] = $this->k_tai_conf['templateSets'][$this->HypKTaiRender->vars['ua']['carrier']]; } if ($use_jqm && isset($this->k_tai_conf['templates']['jqm']) && $this->k_tai_conf['templates']['jqm']) { $this->k_tai_conf['template'] = $this->k_tai_conf['templates']['jqm']; } // keitai render template if ($use_jqm && isset($this->k_tai_conf['rebuildsEx']['jqm']) && $this->k_tai_conf['rebuildsEx']['jqm']) { $this->k_tai_conf['rebuilds'] = array_merge($this->k_tai_conf['rebuilds'], $this->k_tai_conf['rebuildsEx']['jqm']); } // jqm.css if ($use_jqm && !empty($this->k_tai_conf['jqm_css'])) { $use_jqm_css = false; list($this->k_tai_conf['jqm_css'], $time) = explode(':', $this->k_tai_conf['jqm_css'], 2); $jqm_css = '/class/hyp_common/cache/' . $this->k_tai_conf['jqm_css']; if (!is_file(XOOPS_ROOT_PATH . $jqm_css) || filemtime(XOOPS_ROOT_PATH . $jqm_css) < $time) { if (@copy(XOOPS_TRUST_PATH . '/uploads/hyp_common/' . urlencode(substr(XOOPS_URL, 7)) . '_' . $this->k_tai_conf['jqm_css'], XOOPS_ROOT_PATH . $jqm_css)) { $this->k_tai_conf['jqm_css'] = XOOPS_URL . $jqm_css; } else { $this->k_tai_conf['jqm_css'] = ''; } } else { $this->k_tai_conf['jqm_css'] = XOOPS_URL . $jqm_css; } } //jqm block control if ($use_jqm && !empty($this->k_tai_conf['useJqmBlockCtl'])) { $this->k_tai_conf['disabledBlockIds'] = $this->k_tai_conf['disabledBlockIds_jqm']; $this->k_tai_conf['limitedBlockIds'] = $this->k_tai_conf['limitedBlockIds_jqm']; $this->k_tai_conf['showBlockIds'] = $this->k_tai_conf['showBlockIds_jqm']; } // Session setting @ini_set('session.use_trans_sid', 0); if (!$this->HypKTaiRender->vars['ua']['allowCookie']) { $parseUrl = parse_url(XOOPS_URL); if (@$_SERVER['HTTP_HOST'] !== $parseUrl['host']) { header('HTTP', true, 400); exit('400 Bad Request'); } @ini_set('session.use_cookies', '0'); @ini_set('session.use_only_cookies', '0'); } else { @ini_set('session.use_cookies', '1'); @ini_set('session.use_only_cookies', '1'); } // HTTP_REFERER if (!empty($_POST) && empty($_SERVER['HTTP_REFERER'])) { $_SERVER['HTTP_REFERER'] = XOOPS_URL . '/'; } } else { define('HYP_K_TAI_RENDER', FALSE); } } // xpWiki renderer setting if (defined('XOOPS_CUBE_LEGACY') && !defined('XPWIKI_RENDERER_DIR') && $this->xpwiki_render_dirname) { define('XPWIKI_RENDERER_DIR', $this->xpwiki_render_dirname); if (!defined('XPWIKI_RENDERER_USE_WIKIHELPER')) { define('XPWIKI_RENDERER_USE_WIKIHELPER', $this->xpwiki_render_use_wikihelper); } define('XPWIKI_RENDERER_USE_WIKIHELPER_BBCODE', XPWIKI_RENDERER_USE_WIKIHELPER && $this->xpwiki_render_use_wikihelper_bbcode); $this->mController->mSetupTextFilter->add('Hyp_TextFilter::getInstance', XCUBE_DELEGATE_PRIORITY_FINAL - 2); } else { define('XPWIKI_RENDERER_USE_WIKIHELPER_BBCODE', false); } }
function plugin_rss_action() { $version = isset($this->root->vars['ver']) ? strtolower($this->root->vars['ver']) : ''; $base = isset($this->root->vars['p']) ? $this->root->vars['p'] : ''; $s_base = $base ? '/' . $base : ''; $uid = !empty($this->root->vars['u']) ? strval(intval($this->root->vars['u'])) : ''; $cache_clear = isset($this->root->vars['cc']); switch ($version) { case '': $version = '1.0'; break; // Default // Default case '1': $version = '1.0'; break; // Sugar // Sugar case '2': $version = '2.0'; break; // Sugar // Sugar case 'atom': /* FALLTHROUGH */ /* FALLTHROUGH */ case '0.91': /* FALLTHROUGH */ /* FALLTHROUGH */ case '1.0': /* FALLTHROUGH */ /* FALLTHROUGH */ case '2.0': break; default: die('Invalid RSS version!!'); } $count = empty($this->root->vars['count']) ? $this->root->rss_max : (int) $this->root->vars['count']; $count = max($count, 1); $count = min($count, $this->maxcount); // キャッシュファイル名 $c_file = $this->cont['CACHE_DIR'] . 'plugin/' . md5($version . $base . $count . $uid . $this->cont['ROOT_URL']) . $this->cont['UI_LANG'] . '.rss'; if (!$cache_clear && is_file($c_file)) { $filetime = filemtime($c_file); $etag = md5($c_file . $filetime); if ($etag === @$_SERVER["HTTP_IF_NONE_MATCH"] && $this->cont['UA_PROFILE'] !== 'keitai') { // バッファをクリア $this->func->clear_output_buffer(); header("HTTP/1.1 304 Not Modified"); header("Etag: " . $etag); header('Cache-Control: private'); header('Pragma:'); //header('Expires:'); exit; } $out = file_get_contents($c_file); } else { // バッファリング ob_start(); $lang = $this->cont['LANG']; $page_title = $this->func->htmlspecialchars($this->root->siteinfo['sitename'] . '::' . $this->root->module_title . $s_base); $self = $this->func->get_script_uri(); $maketime = $date = substr_replace($this->func->get_date('Y-m-d\\TH:i:sO'), ':', -2, 0); $buildtime = $this->func->get_date('r'); $pubtime = 0; $rss_css = $this->cont['LOADER_URL'] . '?src=rss.' . $this->cont['UI_LANG'] . '.xml'; // Creating <item> $items = $rdf_li = ''; // ゲスト扱いで一覧を取得 $nolisting = !$base || $base[0] !== ':'; $where = $uid ? '`uid`="' . $uid . '"' : ''; $lines = $this->func->get_existpages(FALSE, $base ? $base . '/' : '', array('limit' => $count, 'order' => ' ORDER BY editedtime DESC', 'nolisting' => $nolisting, 'withtime' => TRUE, 'asguest' => TRUE, 'where' => $where)); foreach ($lines as $line) { list($time, $page) = explode("\t", rtrim($line)); $r_page = rawurlencode($page); $link = $this->func->get_page_uri($page, true, 'keitai'); $title = $this->func->htmlspecialchars($this->root->pagename_num2str ? preg_replace('/\\/(?:[0-9\\-]+|[B0-9][A-Z0-9]{9})$/', '/' . $this->func->strip_emoji(htmlspecialchars_decode($this->func->get_heading($page))), $page) : $page); if ($base) { $title = substr($title, strlen($base) + 1); } if (!$pubtime) { $pubtime = $this->func->get_date('r', $time); } switch ($version) { case '0.91': $date = $this->func->get_date('r', $time); $items .= <<<EOD <item> <title>{$title}</title> <link>{$link}</link> <description>{$date}</description> </item> EOD; break; case '2.0': list($description, $html, $pginfo) = $this->get_content($page); $author = $this->func->htmlspecialchars($pginfo['uname']); $date = $this->func->get_date('r', $time); $items .= <<<EOD <item> <title>{$title}</title> <link>{$link}</link> <guid>{$link}</guid> <pubDate>{$date}</pubDate> <description>{$description}</description> <content:encoded><![CDATA[ {$html} ]]></content:encoded> </item> EOD; break; case '1.0': // Add <item> into <items> list($description, $html, $pginfo, $tags) = $this->get_content($page); $author = $this->func->htmlspecialchars($pginfo['uname']); $tag = ''; if ($tags) { $tags = array_map('$this->func->htmlspecialchars', array_map('rtrim', $tags)); $tag = '<dc:subject>' . join("</dc:subject>\n <dc:subject>", $tags) . '</dc:subject>'; } $rdf_li .= ' <rdf:li rdf:resource="' . $link . '" />' . "\n"; $date = substr_replace($this->func->get_date('Y-m-d\\TH:i:sO', $time), ':', -2, 0); $trackback_ping = ''; /* if ($this->root->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>{$link}</link> <dc:date>{$date}</dc:date> <dc:creator>{$author}</dc:creator> {$tag} <description>{$description}</description> <content:encoded><![CDATA[ {$html} ]]></content:encoded> <dc:identifier>{$self}?{$r_page}</dc:identifier> {$trackback_ping} </item> EOD; break; case 'atom': list($description, $html, $pginfo, $tags) = $this->get_content($page); $author = $this->func->htmlspecialchars($pginfo['uname']); $tag = ''; if ($tags) { $tags = array_map('$this->func->htmlspecialchars', array_map('rtrim', $tags)); foreach ($tags as $_tag) { $tag .= '<category term="' . str_replace('"', '\\"', $_tag) . '"/>' . "\n"; } } $date = substr_replace($this->func->get_date('Y-m-d\\TH:i:sO', $time), ':', -2, 0); $id = $link; $items .= <<<EOD <entry> <title type="html">{$title}</title> <link rel="alternate" type="text/html" href="{$link}" /> <id>{$id}</id> <updated>{$date}</updated> <published>{$date}</published> {$tag} <author> <name>{$author}</name> </author> <summary type="html">{$description}</summary> <content type="html"><![CDATA[ {$html} ]]></content> </entry> EOD; break; } } // Feeding start print '<?xml version="1.0" encoding="UTF-8"?>' . "\n\n"; //$r_whatsnew = rawurlencode($this->root->whatsnew); $link = $base ? $this->func->get_page_uri($base, true) : $self; switch ($version) { case '0.91': print <<<EOD <!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd"> <rss version="{$version}"> <channel> <title>{$page_title}</title> <link>{$link}</link> <description>xpWiki RecentChanges</description> <language>{$lang}</language> {$items} </channel> </rss> EOD; break; case '2.0': print <<<EOD <rss version="{$version}" xmlns:content="http://purl.org/rss/1.0/modules/content/"> <channel> <title>{$page_title}</title> <link>{$link}</link> <description>xpWiki RecentChanges</description> <language>{$lang}</language> <image> <url>{$self}module_icon.php</url> <title>{$page_title}</title> <link>{$link}</link> <description>{$page_title}</description> </image> <pubDate>{$pubtime}</pubDate> <lastBuildDate>{$buildtime}</lastBuildDate> <generator>xpWiki</generator> {$items} </channel> </rss> EOD; break; case '1.0': $xmlns_trackback = $this->root->trackback ? ' xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"' : ''; print <<<EOD <?xml-stylesheet type="text/xsl" media="screen" href="{$rss_css}" ?> <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#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xml:lang="{$lang}"> <channel rdf:about="{$link}"> <title>{$page_title}</title> <link>{$link}</link> <description>xpWiki RecentChanges</description> <dc:date>{$maketime}</dc:date> <image rdf:resource="{$self}module_icon.php" /> <items> <rdf:Seq> {$rdf_li} </rdf:Seq> </items> </channel> <image rdf:about="{$self}module_icon.php"> <title>{$page_title}</title> <link>{$link}</link> <url>{$self}module_icon.php</url> </image> {$items} </rdf:RDF> EOD; break; case 'atom': $rpage = $base ? '&p=' . rawurlencode($base) : ''; $feedurl = $this->cont['HOME_URL'] . '?cmd=rss' . $rpage . '&ver=atom'; $rpage = $base ? '&p=' . rawurlencode($base) : ''; $modifier = $this->func->htmlspecialchars($this->root->modifier); print <<<EOD <feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{$lang}"> <title>{$page_title}</title> <link rel="alternate" type="text/html" href="{$link}" /> <link rel="self" type="application/atom+xml" href="{$feedurl}" /> <id>{$self}</id> <updated>{$maketime}</updated> <subtitle>xpWiki RecentChanges</subtitle> <generator uri="http://hypweb.net/">xpWiki</generator> <rights>hypweb.net</rights> <author> <name>{$modifier}</name> <uri>{$this->root->modifierlink}</uri> </author> {$items} </feed> EOD; break; } $out = mb_convert_encoding(ob_get_contents(), 'UTF-8', $this->cont['CONTENT_CHARSET']); ob_end_clean(); // NULLバイト除去 $out = $this->func->input_filter($out); if ($this->cont['UA_PROFILE'] === 'default') { //キャッシュ書き込み if ($fp = @fopen($c_file, "wb")) { fputs($fp, $out); fclose($fp); } $filetime = filemtime($c_file); } else { $filetime = time(); } $etag = md5($c_file . $filetime); } if ($this->cont['UA_PROFILE'] === 'keitai' || defined('HYP_K_TAI_RENDER') && HYP_K_TAI_RENDER === 1) { HypCommonFunc::loadClass('HypRss2Html'); $r = new HypRss2Html($out); $out = $r->getHtml(); $out = mb_convert_encoding($out, 'SJIS', $r->encoding); HypCommonFunc::loadClass('HypKTaiRender'); if (HypCommonFunc::get_version() < '20080925') { $r = new HypKTaiRender(); } else { $r =& HypKTaiRender::getSingleton(); } $r->set_myRoot($this->root->siteinfo['host']); $r->Config_hypCommonURL = $this->cont['ROOT_URL'] . 'class/hyp_common'; $r->Config_redirect = $this->root->k_tai_conf['redirect']; $r->Config_emojiDir = $this->cont['ROOT_URL'] . 'images/emoji'; if (!empty($this->root->k_tai_conf['showImgHosts'])) { $r->Config_showImgHosts = $this->root->k_tai_conf['showImgHosts']; } if (!empty($this->root->k_tai_conf['directLinkHosts'])) { $r->Config_directLinkHosts = $this->root->k_tai_conf['directLinkHosts']; } if ($this->cont['PKWK_ENCODING_HINT']) { $r->Config_encodeHintWord = $this->cont['PKWK_ENCODING_HINT']; } if (!empty($this->root->k_tai_conf['googleAdsense']['config'])) { $r->Config_googleAdSenseConfig = $this->root->k_tai_conf['googleAdsense']['config']; $r->Config_googleAdSenseBelow = $this->root->k_tai_conf['googleAdsense']['below']; } $r->inputEncode = 'SHIFT_JIS'; $r->outputEncode = 'SJIS'; $r->outputMode = 'xhtml'; $r->langcode = $this->cont['LANG']; $r->inputHtml = $out; $r->doOptimize(); $out = $r->outputBody; // バッファをクリア $this->func->clear_output_buffer(); header('Content-Type: text/html; charset=Shift_JIS'); header('Content-Length: ' . strlen($out)); header('Cache-Control: no-cache'); } else { header('Content-Type: application/xml; charset=utf-8'); header('Content-Length: ' . strlen($out)); header('Cache-Control: private'); header('Pragma:'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $filetime) . ' GMT'); header('Etag: ' . $etag); } echo $out; exit; }
///////////////////////////////////////////////// // ブラウザ調整前のデフォルト値 // max_size (SKINで使用) $root->max_size = 5; // SKINで使用, KByte // cols: テキストエリアのカラム数 rows: 行数 $root->cols = 22; $root->rows = 5; // i_mode // ref でのイメージサイズの最大px $root->keitai_display_width = 240; $root->keitai_img_px = 200; $root->keitai_imageTwiceDisplayWidth = 0; if (strtolower($root->keitai_output_filter) !== 'pass' && HypCommonFunc::get_version() >= '20090611') { HypCommonFunc::loadClass('HypKTaiRender'); $ktairender =& HypKTaiRender::getSingleton(); if (!empty($ktairender->vars['ua']['width'])) { $root->keitai_display_width = $ktairender->vars['ua']['width']; $root->keitai_imageTwiceDisplayWidth = $ktairender->Config_imageTwiceDisplayWidth; } } ///////////////////////////////////////////////// // ブラウザに合わせた調整 $root->ua_name = $user_agent['name']; $root->ua_vers = $user_agent['vers']; $root->ua_agent = $user_agent['agent']; $root->matches = array(); // Browser-name only switch ($root->ua_name) { // NetFront / Compact NetFront // DoCoMo Net For MOBILE: iモード対応HTMLの考え方: ユーザエージェント
function output_popup($body) { // set target $body = preg_replace('/(<a[^>]+)(href=(?:"|\')[^#])/isS', '$1target="' . (intval($this->root->vars['popup']) === 1 ? '_parent' : htmlspecialchars(substr($this->root->vars['popup'], 0, 30))) . '" $2', $body); // Head Tags list($head_pre_tag, $head_tag) = $this->get_additional_headtags(); $css_charset = $this->cont['CSS_CHARSET']; $class = 'xpwiki_' . $this->root->mydirname; $navigator = $this->root->mydirname . '_navigator'; $cssprefix = $this->root->css_prefix ? 'pre=' . rawurlencode($this->root->css_prefix) . '&' : ''; // Set Ktai renderer's option. if (defined('HYP_K_TAI_RENDER') && HYP_K_TAI_RENDER) { $keitai_render =& HypKTaiRender::getSingleton(); $keitai_render->Config_googleAdSenseConfig = ''; } header('Content-Type: text/html; charset=' . $this->cont['CONTENT_CHARSET']); // HTML DTD, <html>, and receive content-type if (isset($this->root->pkwk_dtd)) { $meta_content_type = $this->pkwk_output_dtd($this->root->pkwk_dtd); } else { $meta_content_type = $this->pkwk_output_dtd(); } $html = <<<EOD <head> {$meta_content_type} <meta http-equiv="content-style-type" content="text/css" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> {$head_pre_tag} <link rel="stylesheet" type="text/css" media="all" href="{$this->cont['LOADER_URL']}?skin={$this->cont['SKIN_NAME']}&charset={$css_charset}&pw={$this->root->pre_width}&{$cssprefix}src={$this->root->main_css}" charset="{$css_charset}" /> <link rel="stylesheet" type="text/css" media="print" href="{$this->cont['LOADER_URL']}?skin={$this->cont['SKIN_NAME']}&charset={$css_charset}&pw={$this->root->pre_width}&media=print&{$cssprefix}src={$this->root->main_css}" charset="{$css_charset}" /> {$head_tag} <title></title> </head> <body class="popup_body_{$this->cont['UA_PROFILE']}"> <div class="{$class}" id="{$navigator}"> <div class="body"><div id="xpwiki_body"> {$body} </div></div> </div> </body> </html> EOD; echo $html; exit; }
function page_write($page, $postdata, $notimestamp = FALSE) { $_user_abort_last = ignore_user_abort(TRUE); $is_freeze = $this->is_freeze($page); if ($this->cont['PKWK_READONLY'] || empty($this->root->rtf['no_checkauth_on_write']) && (!$this->check_readable_page($page, FALSE, FALSE) || $this->root->plugin_follow_freeze && $is_freeze || $this->root->plugin_follow_editauth && !$this->check_editable_page($page, FALSE, FALSE))) { return; // Do nothing } if (isset($this->root->rtf['no_checkauth_on_write']) && $this->root->rtf['no_checkauth_on_write'] === 'dofreeze') { $is_freeze = TRUE; $this->pginfo_freeze_db_write($page, 1); } $oldpostdata = $this->is_page($page) ? $this->get_source($page, TRUE, TRUE) : ''; $esummary = ''; $touch = FALSE; if (is_null($postdata)) { $postdata = $oldpostdata; $touch = TRUE; //$notimestamp = FALSE; } $postdata = trim($postdata, "\r\n"); if ($is_freeze) { // remove "#freeze" $postdata = preg_replace('/^#freeze\\s*$/m', '', $postdata); } $empty_page_making = FALSE; // set mode. use at custum events. if (!$this->is_page($page) && ($postdata || $touch)) { $mode = "insert"; // Empty page making by plugin. if ($postdata === "\t" || $touch) { $postdata = ''; $empty_page_making = TRUE; } } else { if ($postdata === '') { $mode = "delete"; $this->root->post['alias'] = ''; } else { $mode = "update"; } } $need_autolink_update = false; if (!$empty_page_making && !$touch) { // onPageWriteBefore $this->do_onPageWriteBefore($page, $postdata, $notimestamp, $mode); $postdata = $this->make_str_rules($postdata); // Page aliases if ($this->root->vars['cmd'] === 'edit' && isset($this->root->post['alias'])) { $need_autolink_update = $this->put_page_alias($page, $this->root->post['alias']); } } if ($postdata) { $reading = $this->root->vars['cmd'] === 'edit' && !empty($this->root->vars['reading']) && $this->get_page_reading($page) !== $this->root->vars['reading'] ? $this->root->vars['reading'] : ''; $rm_postdata = $this->remove_pginfo($postdata); // Page order $pgorder = NULL; if ($this->root->vars['cmd'] === 'edit' && isset($this->root->post['pgorder'])) { $pgorder = min(9, max(0, floatval($this->root->post['pgorder']))); if ($this->get_page_order($page) === $pgorder) { $pgorder = NULL; } } if ($mode === 'update') { // need_autolink_update or :config/AutoLink if ($need_autolink_update || $page === $this->cont['PKWK_CONFIG_PREFIX'] . 'AutoLink') { $this->autolink_dat_update(); $this->delete_caches(); if ($need_autolink_update) { $this->need_update_plaindb($page, 'insert'); } } // ¥Ú¡¼¥¸¤ÎÆâÍÆÊѹ¹¤¬¤Ê¤¤¾ì¹ç²¿¤â¤·¤Ê¤¤ if (!$reading && is_null($pgorder) && !$touch && rtrim($rm_postdata, "\r\n") === rtrim($this->remove_pginfo($oldpostdata), "\r\n")) { return; } } } // Set edit summary if ($this->root->vars['cmd'] === 'edit' && isset($this->root->vars['esummary'])) { $esummary = $this->root->vars['esummary']; $esummary = str_replace(array("\r", "\n", "\t"), ' ', $esummary); $esummary = $this->htmlspecialchars($esummary); } else { if (!empty($this->root->rtf['esummary'])) { $esummary = $this->root->rtf['esummary']; $esummary = str_replace(array("\r", "\n", "\t"), ' ', $esummary); } else { $plugin_name = !empty($this->root->vars['cmd']) ? $this->root->vars['cmd'] : (!empty($this->root->vars['plugin']) ? $this->root->vars['plugin'] : ''); if ($plugin_name && !in_array($plugin_name, array('edit', 'read'))) { $esummary = str_replace('$name', $plugin_name, $this->root->plugin_edit_summary); if ($touch) { $esummary .= ' (Only touched)'; } else { if ($empty_page_making) { $esummary .= ' (Created empty)'; } } } } } $esummary_this = $esummary; // Get pginfo $pginfo = $this->get_pginfo($page); // Create backup if (!$this->make_backup($page, $mode === 'delete', $notimestamp)) { // no rotate if ($pginfo['esummary']) { if ($esummary && strpos($pginfo['esummary'], $esummary) === FALSE) { $esummary = $pginfo['esummary'] . ', ' . $esummary; } else { $esummary = $pginfo['esummary']; } } } if ($notimestamp && $esummary_this) { $esummary .= ' at ' . $this->root->now; } if ($mode !== 'delete') { // Set pginfo // ´ÉÍýÎΰèÀßÄê (#xoopsadmin) if (preg_match('/^#xoopsadmin\\b.*$/sm', $postdata)) { $pginfo['einherit'] = $pginfo['vinherit'] = 0; $pginfo['eaids'] = $pginfo['egids'] = $pginfo['vaids'] = $pginfo['vgids'] = 'none'; } if ($mode === 'insert') { if ($pginfo['eaids'] !== 'none' && $pginfo['eaids'] !== 'all') { $_aids = array(); foreach (explode('&', $pginfo['eaids']) as $_aid) { $_aid = intval($_aid); if ($_aid && $_aid != $this->root->userinfo['uid'] && !$this->check_admin($_aid)) { $_aids[] = $_aid; } } $pginfo['eaids'] = $_aids ? join('&', $_aids) : 'none'; } if ($pginfo['vaids'] !== 'none' && $pginfo['vaids'] !== 'all') { $_aids = array(); foreach (explode('&', $pginfo['vaids']) as $_aid) { $_aid = intval($_aid); if ($_aid && $_aid != $this->root->userinfo['uid'] && !$this->check_admin($_aid)) { $_aids[] = $_aid; } } $pginfo['vaids'] = $_aids ? join('&', $_aids) : 'none'; } } $pginfo['lastuid'] = $this->root->userinfo['uid']; $pginfo['lastucd'] = $this->root->userinfo['ucd']; $pginfo['lastuname'] = $this->root->userinfo['uname_s']; if ($this->root->cookie['name'] && $this->root->userinfo['uname'] !== $this->root->cookie['name']) { $pginfo['lastuname'] = $this->htmlspecialchars($this->root->cookie['name']); if ($mode === 'insert') { $pginfo['uname'] = $pginfo['lastuname']; } if ($this->root->siteinfo['anonymous'] !== $this->root->cookie['name']) { $pginfo['lastuname'] .= '(' . $pginfo['lastuname'] . ')'; } } $pginfo['lastuname'] = $this->htmlspecialchars($pginfo['lastuname']); if (!is_null($pgorder)) { $pginfo['pgorder'] = $pgorder; } $pginfo['esummary'] = $esummary; $pginfo_str = '#pginfo(' . join("\t", $pginfo) . ')' . "\n"; $postdata = $pginfo_str . $rm_postdata; // ¥Ú¡¼¥¸Æ¬Ê¸»úÆÉ¤ß if ($reading) { $pginfo['reading'] = $reading; } // Is freeze? if ($is_freeze) { $postdata = '#freeze' . "\n" . $postdata; } } // Create and write diff $diffdata = $this->do_diff($oldpostdata, $postdata); $this->file_write($this->cont['DIFF_DIR'], $page, $diffdata); if (!$touch) { // delete recent add data if ($mode === 'delete') { $this->push_page_changes($page, '', TRUE); // Update RecentDeleted (Add the $page) $this->add_recent($page, $this->root->whatsdeleted, '', $this->root->maxshow_deleted); } else { // ÄɲÃÍúÎòÊݸ $this->push_page_changes($page, preg_replace('/^[^+].*\\n/m', '', $diffdata)); } } // Create wiki text $this->file_write($this->cont['DATA_DIR'], $page, $postdata, $notimestamp); // Clear page cache. $this->clear_page_cache($page); // Clear fstat cache. clearstatcache(); // pginfo DB write if (empty($pginfo)) { $pginfo = $this->get_pginfo($page); } $this->pginfo_db_write($page, $mode, $pginfo, $notimestamp, $empty_page_making); if (!$empty_page_making && !$touch) { /* if ($this->root->trackback) { // TrackBack Ping $_diff = explode("\n", $diffdata); $plus = join("\n", preg_replace('/^\+/', '', preg_grep('/^\+/', $_diff))); $minus = join("\n", preg_replace('/^-/', '', preg_grep('/^-/', $_diff))); $this->tb_send($page, $plus, $minus); } */ // Update autoalias.dat (AutoAliasName) if ($this->root->autoalias && $page === $this->root->aliaspage) { $aliases = $this->get_autoaliases(); if (empty($aliases)) { // Remove @unlink($this->cont['CACHE_DIR'] . $this->cont['PKWK_AUTOALIAS_REGEX_CACHE']); } else { // Create or Update $this->autolink_pattern_write($this->cont['CACHE_DIR'] . $this->cont['PKWK_AUTOALIAS_REGEX_CACHE'], $this->get_autolink_pattern(array_keys($aliases), $this->root->autoalias, false, true)); } } // Update interwiki.dat if ($this->root->interwiki && $page === $this->root->interwiki) { $this->interwiki_dat_update(explode("\n", $postdata)); } // onPageWriteAfter $this->do_onPageWriteAfter($page, $postdata, $notimestamp, $mode, $diffdata); // ¹¹¿·ÄÌÃΥ᡼¥ë $page_url = $this->get_page_uri($page, true, 'default'); $page_url_m = $this->get_page_uri($page, true, 'keitai'); if ($page_url !== $page_url_m) { $page_url .= ' ( ' . $page_url_m . ' )'; } $diff_compact = preg_replace('/^[^+-].*\\n/m', '', $diffdata); if ($this->root->notify) { $footer['ACTION'] = 'Page update'; $footer['PAGE'] = $page; $footer['USER_AGENT'] = TRUE; $footer['REMOTE_ADDR'] = TRUE; // K-TAI if ($this->cont['UA_PROFILE'] === 'keitai' && !defined('HYP_WIZMOBILE_USE') && strtolower($root->keitai_output_filter) !== 'pass' && HypCommonFunc::get_version() >= '20080925') { HypCommonFunc::loadClass('HypKTaiRender'); $ktai_render =& HypKTaiRender::getSingleton(); if ($ktai_render->vars['ua']['uid']) { $footer['KTAI_UID'] = md5($ktai_render->vars['ua']['uid']); } else { $footer['KTAI_UID'] = 'Unknown'; } } $this->pkwk_mail_notify($this->root->notify_subject, $page_url . "\n\n" . ($this->root->notify_diff_only ? $diff_compact : $diffdata), $footer); } if (empty($this->root->rtf['no_system_notification'])) { // System notification $tags['POST_URL'] = $page_url; $tags['PAGE_NAME'] = $page; $tags['POST_DATA'] = $postdata; $tags['POSTER_NAME'] = $this->root->userinfo['uname']; $tags['POST_DIFF'] = preg_replace('/^/m', ' ', $diff_compact); if ($mode === 'insert') { $tags['POST_DIFF'] = 'New page.'; } else { if ($mode === 'update') { } else { if ($mode === 'delete') { $tags['POST_DATA'] = 'Page deleted.'; } } } $this->system_notification($page, 'page', $this->get_pgid_by_name($page), 'page_update', $tags); list($pgid1, $pgid2) = $this->get_pgids_by_name($page); $this->system_notification($page, 'page1', $pgid1, 'page_update', $tags); if ($pgid2) { $this->system_notification($page, 'page2', $pgid2, 'page_update', $tags); } $this->system_notification($page, 'global', 0, 'page_update', $tags); } if ($mode !== 'delete' && (!empty($this->root->post['edit_form_twitter']) || !empty($this->root->rtf['twitter_update'])) && $this->check_readable_page($page, FALSE, FALSE, 0)) { $_page = $this->root->pagename_num2str ? preg_replace('/\\/(?:[0-9\\-]+|[B0-9][A-Z0-9]{9})$/', '/' . $this->get_heading($page), $page) : $page; $twitter_msg = '[' . $this->root->module['title'] . '] ' . $_page . ($esummary_this ? ' - ' . $esummary_this : ''); $this->twitter_update($twitter_msg, $page); } } ignore_user_abort($_user_abort_last); }
"><?php echo $this->root->modifier; ?> </a></p> </div> <?php $footer = ob_get_contents(); ob_end_clean(); if ($this->root->runmode === 'standalone') { $ctype = 'text/html'; if (HypCommonFunc::get_version() >= '20080617.2') { HypCommonFunc::loadClass('HypKTaiRender'); if (HypCommonFunc::get_version() >= '20080925') { $r =& HypKTaiRender::getSingleton(); } else { $r = new HypKTaiRender(); } $r->set_myRoot($this->root->siteinfo['host']); $r->Config_hypCommonURL = $this->cont['ROOT_URL'] . 'class/hyp_common'; $r->Config_redirect = $this->root->k_tai_conf['redirect']; $r->Config_emojiDir = $this->cont['ROOT_URL'] . 'images/emoji'; if (!empty($this->root->k_tai_conf['showImgHosts'])) { $r->Config_showImgHosts = $this->root->k_tai_conf['showImgHosts']; } if (!empty($this->root->k_tai_conf['directImgHosts'])) { $r->Config_directImgHosts = $this->root->k_tai_conf['directImgHosts']; } if (!empty($this->root->k_tai_conf['directLinkHosts'])) { $r->Config_directLinkHosts = $this->root->k_tai_conf['directLinkHosts']; } if ($this->cont['PKWK_ENCODING_HINT']) {