function smarty_function_hyp_emoji_pad($params, &$smarty) { if (!function_exists('XC_CLASS_EXISTS') || !XC_CLASS_EXISTS('HypCommonFunc')) { return 'Class "HypCommonFunc" not exists.'; } if (empty($params['id'])) { return 'Parameter "id" is not set.'; } $id = $params['id']; $checkmsg = empty($params['msg']) ? '' : $params['msg']; $clearDisplayId = empty($params['showDomId']) ? '' : $params['showDomId']; $emojiurl = empty($params['emojiUrl']) ? '' : $params['emojiUrl']; $writeJS = empty($params['outputWithJS']) ? TRUE : (bool) $params['outputWithJS']; $emj_list = empty($params['emojiList']) ? NULL : $params['emojiList']; if (strtolower($emj_list) === 'all') { $emj_list = 'all'; } else { if (!empty($emj_list)) { $emj_list = explode(',', $emj_list); $emj_list = array_map('trim', $emj_list); $emj_list = array_map('intval', $emj_list); } } return HypCommonFunc::make_emoji_pad($id, $checkmsg, $clearDisplayId, $emojiurl, $writeJS, $emj_list); }
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 get_wakatigaki(&$str) { if (!$this->kakasi_path) { return false; } if ($this->tmp_dir) { // gc(ガベージコレクト) if (mt_rand(1, 100000) <= $this->gc_probability * 100) { if ($handle = opendir($this->tmp_dir)) { while (false !== ($file = readdir($handle))) { if (strpos($file, ".") === 0) { continue; } if (filemtime($this->tmp_dir . $file) < time() - $this->cache_expire * 3600) { unlink($this->tmp_dir . $file); } } closedir($handle); } } $tmpfile = $this->tmp_dir . md5($str) . ".tmp"; // キャッシュ if (file_exists($tmpfile)) { include_once dirname(__FILE__) . '/hyp_common_func.php'; HypCommonFunc::touch($tmpfile); $str = join("", file($tmpfile)); return true; } } $put = $str; $nwa = ""; $match = array(); if (preg_match_all("/((\"|').+?(?:\\2))/", $put, $match, PREG_PATTERN_ORDER)) { $match[1] = array_unique($match[1]); foreach ($match[1] as $rep) { $put = str_replace($rep, " ", $put); } $put = preg_replace("/ +/", " ", $put); $nwa = join(" ", $match[1]) . " "; } if (!$this->execute($put, "-w -c")) { return false; } $str = $nwa . $put; if ($this->tmp_dir) { if ($fp = fopen($tmpfile, "wb")) { fputs($fp, $str); fclose($fp); } } return true; }
function escape($str) { // Unescape already-escaped chars (<, >, &, ...) in RSS body before htmlspecialchars() $str = strtr($str, array_flip(get_html_translation_table(ENT_COMPAT))); // Escape $str = htmlspecialchars($str, ENT_COMPAT, HypCommonFunc::get_htmlspecialchars_encoding($this->encoding)); //echo $str; // Unescape $str = str_replace('&', '&', $str); // Encoding conversion //$this->func->encode_numericentity($str, $this->cont['SOURCE_ENCODING'], $this->encoding); $str = mb_convert_encoding($str, 'UTF-8', $this->encoding); return trim($str); }
function output($file, $mime, $size, $mtime) { $this->check_304($mtime); header('Content-Length: ' . $size); header('Content-Type: ' . $mime); header('Last-Modified: ' . gmdate("D, d M Y H:i:s", $mtime) . " GMT"); header('Etag: ' . $mtime); header('Cache-Control: private, max-age=' . XELFINDER_CACHE_TTL); header('Expires: ' . gmdate("D, d M Y H:i:s", XELFINDER_UNIX_TIME + XELFINDER_CACHE_TTL) . ' GMT'); header('Pragma:'); if (function_exists('XC_CLASS_EXISTS') && XC_CLASS_EXISTS('HypCommonFunc')) { HypCommonFunc::readfile($file); } else { readfile($file); } }
function GC_rdi($cachepath, $TTL, $showResult = FALSE) { HypCommonFunc::touch($cachepath . '/rdi.gc'); $i = 0; $i2 = 0; if ($handle = opendir($cachepath)) { while (false !== ($file = readdir($handle))) { if (substr($file, -4) === '.rdi') { $i2++; $target = $cachepath . '/' . $file; if (filemtime($target) < UNIX_TIME - $TTL) { unlink($target); $i++; } } } closedir($handle); } if ($showResult) { echo $i . '/' . $i2 . ' files removed.'; } }
function plugin_xmlrpc_action() { if ($this->root->use_xmlrpc) { if (strtoupper($_SERVER['REQUEST_METHOD']) !== 'POST') { if ($this->op_debug) { $this->debug($_GET); } return $this->rsd(); } if ($this->op_debug) { global $HTTP_RAW_POST_DATA; $this->debug($HTTP_RAW_POST_DATA); } $GLOBALS['xpWikiXmlRpcObj'] =& $this; $this->supportedMethods = array('blogger.newPost' => 'xpwiki_xmlrpc_blogger_newPost', 'blogger.editPost' => 'xpwiki_xmlrpc_blogger_editPost', 'blogger.deletePost' => 'xpwiki_xmlrpc_blogger_deletePost', 'blogger.getRecentPosts' => 'xpwiki_xmlrpc_blogger_getRecentPosts', 'blogger.getUsersBlogs' => 'xpwiki_xmlrpc_blogger_getUsersBlogs', 'blogger.getUserInfo' => 'xpwiki_xmlrpc_blogger_getUserInfo', 'metaWeblog.newPost' => 'xpwiki_xmlrpc_metaWeblog_newPost', 'metaWeblog.editPost' => 'xpwiki_xmlrpc_metaWeblog_editPost', 'metaWeblog.getPost' => 'xpwiki_xmlrpc_metaWeblog_getPost', 'metaWeblog.getRecentPosts' => 'xpwiki_xmlrpc_metaWeblog_getRecentPosts', 'metaWeblog.newMediaObject' => 'xpwiki_xmlrpc_metaWeblog_newMediaObject', 'metaWeblog.getCategories' => 'xpwiki_xmlrpc_return_empty', 'mt.getRecentPostTitles' => 'xpwiki_xmlrpc_mt_getRecentPostTitles', 'mt.getCategoryList' => 'xpwiki_xmlrpc_return_empty', 'mt.getPostCategories' => 'xpwiki_xmlrpc_return_empty', 'mt.setPostCategories' => 'xpwiki_xmlrpc_return_true', 'mt.supportedMethods' => 'xpwiki_xmlrpc_mt_supportedMethods', 'mt.getTrackbackPings' => 'xpwiki_xmlrpc_return_empty', 'mt.publishPost' => 'xpwiki_xmlrpc_return_true', 'mt.setNextScheduledPost' => 'xpwiki_xmlrpc_return_true'); HypCommonFunc::loadClass('IXR_Server'); $server =& new IXR_Server($this->supportedMethods); header('Content-Type: text/xml;charset=UTF-8'); $this->func->clear_output_buffer(); } return array('exit' => 'xmlrpc is not effective.'); }
function smarty_modifier_hyp_emoji_pad($id = '', $checkmsg = '', $clearDisplayId = '', $emojiurl = '', $writeJS = TRUE, $emj_list = NULL) { if (!function_exists('XC_CLASS_EXISTS') || !XC_CLASS_EXISTS('HypCommonFunc')) { return 'Class "HypCommonFunc" not exists.'; } if (empty($id)) { return 'Parameter "id" is not set.'; } $writeJS = (bool) $writeJS; $emj_list = empty($params['emojiList']) ? NULL : $params['emojiList']; if (is_string($emj_list)) { if (strtolower($emj_list) === 'all') { $emj_list = 'all'; } else { if (!empty($emj_list)) { $emj_list = explode(',', $emj_list); $emj_list = array_map('trim', $emj_list); $emj_list = array_map('intval', $emj_list); } } } return HypCommonFunc::make_emoji_pad($id, $checkmsg, $clearDisplayId, $emojiurl, $writeJS, $emj_list); }
function sendMail($spamlev) { global $xoopsUser; $info = array(); $info['TIME'] = date('r', time()); if (is_object($xoopsUser)) { $info['UID'] = (int) $xoopsUser->uid(); $info['UNAME'] = $xoopsUser->uname(); } else { $info['UID'] = 0; $info['UNAME'] = 'Guest'; } $info['REQUEST_URI'] = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; $info['HTTP_REFERER'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; $info['HTTP_USER_AGENT'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; $info['REMOTE_ADDR'] = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''; $info['SPAM LEVEL'] = $spamlev; $_info = ''; foreach ($info as $key => $value) { $_info .= $key . ': ' . $value . "\n"; } $_info .= str_repeat('-', 30) . "\n"; $post = $_POST; // Key:excerpt があればトラックかも->文字コード変換 if (isset($post['excerpt']) && function_exists('mb_convert_variables')) { if (isset($post['charset']) && $post['charset'] != '') { // TrackBack Ping で指定されていることがある // うまくいかない場合は自動検出に切り替え if (mb_convert_variables($this->encode, $post['charset'], $post) !== $post['charset']) { mb_convert_variables($this->encode, 'auto', $post); } } else { if (!empty($post)) { // 全部まとめて、自動検出/変換 mb_convert_variables($this->encode, 'auto', $post); } } } $message = $_info . '$_POST :' . "\n" . print_r($post, TRUE); $message .= "\n" . str_repeat('=', 30) . "\n\n"; if ($this->send_mail_interval) { $mail_tmp = XOOPS_TRUST_PATH . '/uploads/hyp_common/' . str_replace('/', '_', preg_replace('#https?://#i', '', XOOPS_URL)) . '.SPAM.hyp'; if (!file_exists($mail_tmp)) { HypCommonFunc::flock_put_contents($mail_tmp, $message); return; } else { $mtime = filemtime($mail_tmp); if ($mtime + $this->send_mail_interval * 60 > time()) { if (HypCommonFunc::flock_put_contents($mail_tmp, $message, 'ab')) { HypCommonFunc::touch($mail_tmp, $mtime); } return; } else { $message = HypCommonFunc::flock_get_contents($mail_tmp) . $message; unlink($mail_tmp); } } } $config_handler =& xoops_gethandler('config'); $xoopsConfig =& $config_handler->getConfigsByCat(XOOPS_CONF); $subject = '[' . $xoopsConfig['sitename'] . '] POST Spam Report'; $xoopsMailer =& getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setFromEmail($xoopsConfig['adminmail']); $xoopsMailer->setFromName($xoopsConfig['sitename']); $xoopsMailer->setSubject($subject); $xoopsMailer->setBody($message); $xoopsMailer->setToEmails($xoopsConfig['adminmail']); $xoopsMailer->send(); $xoopsMailer->reset(); }
<?php /* * Created on 2008/05/13 by nao-pon http://hypweb.net/ * $Id: jobstack.php,v 1.10 2011/10/31 16:04:47 nao-pon Exp $ */ error_reporting(0); ignore_user_abort(TRUE); $file = $mytrustdirpath . '/skin/image/gif/blank.gif'; header('Content-Type: image/gif'); header('Content-Length: ' . filesize($file)); header('Expires: Thu, 01 Dec 1994 16:00:00 GMT'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0'); header('Pragma: no-cache'); HypCommonFunc::readfile($file); flush(); include_once $mytrustdirpath . '/include.php'; $xpwiki = new XpWiki($mydirname); $xpwiki->init('#RenderMode'); $max_execution_time = intval(ini_get('max_execution_time')); // It is all as for the one executed soon. (ttl = 0) $sql = 'SELECT `key`, `data` FROM ' . $xpwiki->db->prefix($xpwiki->root->mydirname . '_cache') . ' WHERE `plugin`=\'jobstack\' AND `mtime` <= ' . $xpwiki->cont['UTC'] . ' AND `ttl`=0 ORDER BY `mtime` ASC LIMIT 1'; if ($res = $xpwiki->db->query($sql)) { $row = $xpwiki->db->fetchRow($res); while ($row) { if ($max_execution_time) { @ini_set('max_execution_time', (string) $max_execution_time); } xpwiki_jobstack_switch($xpwiki, $row); $res = $xpwiki->db->query($sql);
include_once "{$mytrustdirpath}/include.php"; $xpwiki = new XpWiki($mydirname); // initialize $xpwiki->init(); // XCL >= 2.2 Use "Legacy_Utils::formatPagetitle" if (defined('LEGACY_MODULE_VERSION') && version_compare(LEGACY_MODULE_VERSION, '2.2', '>=')) { $xpwiki->root->html_head_title = trim(str_replace('$module_title', '', $xpwiki->root->html_head_title), ' -'); } // execute $xpwiki->execute(); // gethtml $xpwiki->catbody(); // Add error message if ($xpwiki->root->userinfo['admin']) { $hyp_common_methods = get_class_methods('HypCommonFunc'); if (is_null($hyp_common_methods) || !in_array('get_version', $hyp_common_methods) || HypCommonFunc::get_version() < 20100725) { $xpwiki->admin_messages[] = '[Warning] Please install or update <a href="http://cvs.sourceforge.jp/cgi-bin/viewcvs.cgi/hypweb/XOOPS_TRUST/class/hyp_common.tar.gz?view=tar" title="Download">a newest HypCommonFunc</a> into "XOOPS_TRUST_PATH/class/".'; } if ($xpwiki->admin_messages) { $xpwiki->html = '<p style="color:red;font-weight:bold;">' . join('<br />', $xpwiki->admin_messages) . '</p><hr />' . $xpwiki->html; } } if ($xpwiki->runmode === 'xoops') { // For XCL >= 2.2.1.1 (clear cache of modinfo) // Is it XCL's bug? need check next // http://xoopscube.svn.sourceforge.net/viewvc/xoopscube/Package_Legacy/trunk/html/kernel/module.php?view=log if (defined('LEGACY_BASE_VERSION') && version_compare(LEGACY_BASE_VERSION, '2.2.1.1', '>=')) { $module_handler =& xoops_gethandler('module'); $thisModule =& $module_handler->getByDirname($xpwiki->root->mydirname); $thisModule->modinfo = null; }
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; }
function do_search($words, $type = 'AND', $non_format = FALSE, $base = '', $options = array()) { $def_options = array('db' => TRUE, 'field' => 'name,text', 'limit' => 0, 'offset' => 0, 'userid' => 0, 'spZen' => FALSE, 'context' => '', 'resultMax' => 0, 'msg_more_search' => ''); $options = array_merge($def_options, $options); if ($this->cont['LANG'] === 'ja' && function_exists("mb_convert_kana") && $options['spZen']) { $words = mb_convert_kana($words, 's'); } if (!$options['db']) { return parent::do_search($words, $type, $non_format, $base); } $keywords = preg_split('/\\s+/', $words, -1, PREG_SPLIT_NO_EMPTY); $fields = explode(',', $options['field']); $andor = $type === 'AND' ? 'AND' : 'OR'; $where_readable = $this->get_readable_where('p.'); $where = "p.editedtime != 0"; if ($base) { $where .= " AND p.name LIKE '" . addslashes($base) . "%'"; } if ($where_readable) { $where = "{$where} AND ({$where_readable})"; } $sel_desc = $options['context'] === 'db' ? ', t.plain' : ''; $sql = 'SELECT p.name, p.editedtime, p.title' . $sel_desc . ' FROM ' . $this->xpwiki->db->prefix($this->root->mydirname . "_pginfo") . " p INNER JOIN " . $this->xpwiki->db->prefix($this->root->mydirname . "_plain") . " t ON t.pgid=p.pgid WHERE ({$where}) "; if ($options['userid'] != 0) { $sql .= "AND (p.uid=" . $options['userid'] . ") "; } if (is_array($keywords) && $keywords) { // ±Ñ¿ô»ú¤ÏȾ³Ñ,¥«¥¿¥«¥Ê¤ÏÁ´³Ñ,¤Ò¤é¤¬¤Ê¤Ï¥«¥¿¥«¥Ê¤Ë $sql .= "AND ("; $i = 0; foreach ($keywords as $keyword) { if ($i++ !== 0) { $sql .= " {$andor} "; } if ($this->cont['LANG'] === 'ja' && function_exists("mb_convert_kana")) { // ±Ñ¿ô»ú¤ÏȾ³Ñ,¥«¥¿¥«¥Ê¤ÏÁ´³Ñ,¤Ò¤é¤¬¤Ê¤Ï¥«¥¿¥«¥Ê¤Ë $word = addslashes(mb_convert_kana($keyword, 'aKCV')); } else { $word = addslashes($keyword); } if (in_array('name', $fields) && in_array('text', $fields)) { $sql .= "(p.name_ci LIKE '%{$word}%' OR t.plain LIKE '%{$word}%')"; } else { if (in_array('name', $fields)) { $sql .= "p.name_ci LIKE '%{$word}%'"; } else { if (in_array('text', $fields)) { $sql .= "t.plain LIKE '%{$word}%'"; } } } } $sql .= ") "; } $result = $this->xpwiki->db->query($sql, $options['limit'], $options['offset']); $ret = array(); if (!$keywords) { $keywords = array(); } $sword = rawurlencode(join(' ', $keywords)); $pages = array(); if (in_array('source', $fields)) { foreach ($this->do_source_search($word, $type, true, $base) as $page) { $pages[$page] = ''; } } while ($myrow = $this->xpwiki->db->fetchArray($result)) { $pages[$myrow['name']] = array($myrow['editedtime'], $myrow['title']); if ($options['context'] === 'db') { $pages[$myrow['name']][2] = $myrow['plain']; } } if ($non_format) { return array_keys($pages); } $r_word = rawurlencode($words); $s_word = preg_replace('/&#(\\d+;)/', '&#$1', htmlspecialchars($words)); if (empty($pages)) { return str_replace('$1', $s_word, $this->root->_msg_notfoundresult); } ksort($pages); $count = count($this->get_existpages()); $resCount = count($pages); if ($options['resultMax'] && $resCount > $options['resultMax']) { $pages = array_splice($pages, 0, $options['resultMax']); } $retval = '<ul class="list1">' . "\n"; foreach ($pages as $page => $data) { if (empty($data[0])) { $data[0] = $this->get_filetime($page); } if (empty($data[1])) { $data[1] = $this->get_heading($page); } $s_page = htmlspecialchars($page); $passage = $this->root->show_passage ? ' ' . $this->get_passage($data[0]) : ''; $retval .= ' <li><a href="' . $this->get_page_uri($page, TRUE) . ($this->root->static_url ? '?' : '&') . 'word=' . $r_word . '">' . $s_page . '</a><small>' . $passage . '</small> [ ' . htmlspecialchars($data[1]) . ' ]' . "\n"; if ($options['context'] === 'db') { $retval .= '<div class="context">' . HypCommonFunc::make_context($data[2], $keywords) . '</div>'; } else { if ($options['context'] === 'conv') { $retval .= $this->get_page_context($page, $keywords); } } $retval .= '</li>'; } $retval .= '</ul>' . "\n"; $retval .= str_replace('$1', $s_word, str_replace('$2', $resCount, str_replace('$3', $count, $andor === 'AND' ? $this->root->_msg_andresult : $this->root->_msg_orresult))); if ($options['msg_more_search'] && $options['resultMax'] && $resCount > $options['resultMax']) { $retval .= $options['msg_more_search']; } return $retval; }
function do_upload($page, $fname, $tmpname, $copyright = FALSE, $pass = NULL, $notouch = FALSE, $options = NULL) { // ページが無ければ空ページを作成(他のプラグインから呼ばれた時のため) if (!$this->func->is_page($page)) { $this->func->make_empty_page($page, false); } $overwrite = !empty($options['overwrite']); $changelog = isset($options['changelog']) ? $options['changelog'] : ''; $add_mes = array(); $has_json_msg = false; // ファイル名の正規化 $fname = str_replace("", '', $fname); $fname = $this->func->basename(str_replace("\\", "/", $fname)); $_action = 'insert'; // style.css if ($fname === 'style.css' && $this->func->is_owner($page)) { if (is_file($tmpname)) { $_pagecss_file = $this->cont['CACHE_DIR'] . $this->func->get_pgid_by_name($page) . ".css"; if (is_file($_pagecss_file)) { unlink($_pagecss_file); } if (is_uploaded_file($tmpname) && move_uploaded_file($tmpname, $_pagecss_file) || @rename($tmpname, $_pagecss_file)) { $this->attach_chmod($_pagecss_file); // 空のファイルの場合はファイル削除 if (!trim(file_get_contents($_pagecss_file))) { unlink($_pagecss_file); return array('result' => TRUE, 'msg' => $this->root->_attach_messages['msg_unset_css'], 'has_json_msg' => TRUE); } else { $_data = file_get_contents($_pagecss_file); // 管理者以外は外部ファイルの参照を禁止するなどの書き換え if (!$this->root->userinfo['admin']) { $_data = preg_replace('#(?:url\\s*\\(\\s*[\'"]?(?:(?:ht|f)tps?:)?//[^\\)]+?\\)|@import[^;\\r\\n]*?;|@import|(?:ht|f)tps?://)#i', '', $_data); } if (file_put_contents($_pagecss_file, $_data)) { $add_mes[] = $this->root->_attach_messages['msg_set_css']; $has_json_msg = true; } // 元ファイルを添付ファイルとして保存 if ($tmpname = tempnam($this->cont['CACHE_DIR'], 'atf')) { file_put_contents($tmpname, $_data); $overwrite = true; } clearstatcache(); } } else { @unlink($tmpname); return array('result' => FALSE, 'msg' => $this->root->_attach_messages['err_exists']); } } } // ページオーナー権限がない場合は拡張子をチェック $allow_extensions = $this->get_allow_extensions(); if (empty($options['asSystem']) && !$overwrite && $allow_extensions && !$this->func->is_owner($page) && !preg_match("/\\.(" . join("|", $allow_extensions) . ")\$/i", $fname)) { return array('result' => FALSE, 'msg' => str_replace('$1', $this->func->htmlspecialchars(preg_replace('/.*\\.([^.]*)$/', "\$1", $fname)), $this->root->_attach_messages['err_extension'])); } $_size = @getimagesize($tmpname); // イメージファイルの内容をチェック if ($_size) { $checkStr = $this->func->file_get_contents($tmpname, FALSE, NULL, 0, 10240); if (preg_match('/<(?:script|\\?php)/i', $checkStr)) { return array('result' => FALSE, 'msg' => 'It isn\'t a image file.'); } // Flashファイルの検査 if ($this->cont['ATTACH_UPLOAD_FLASH_ADMIN_ONLY']) { if (!$this->root->userinfo['admin'] && ($_size[2] === 4 || $_size[2] === 13)) { return array('result' => FALSE, 'msg' => $this->root->_attach_messages['err_isflash']); } } } // オリジナルファイル名 $org_fname = $fname; // 格納ファイル名指定あり if (!empty($this->root->vars['filename'])) { $fname = $this->root->vars['filename']; } // 格納ファイル名文字数チェック(SQL varchar(255) - strlen('_\d\d\d')) $fname = function_exists('mb_strcut') ? mb_strcut($fname, 0, 251) : substr($fname, 0, 251); // ファイル名 文字数のチェック $fname = $this->regularize_fname($fname, $page); if (!$overwrite) { // ファイル名が存在する場合は、数字を付け加える if (preg_match("/^(.+)(\\.[^.]*)\$/", $fname, $match)) { $_fname = $match[1]; $_ext = $match[2]; } else { $_fname = $fname; $_ext = ''; } $fi = 0; do { $obj = new XpWikiAttachFile($this->xpwiki, $page, $fname); $fname = $_fname . '_' . $fi++ . $_ext; } while ($obj->exist); } else { $obj = new XpWikiAttachFile($this->xpwiki, $page, $fname); if (is_file($obj->filename)) { unlink($obj->filename); $_action = "update"; } } if (is_uploaded_file($tmpname)) { if (move_uploaded_file($tmpname, $obj->filename)) { $this->attach_chmod($obj->filename); } else { return array('result' => FALSE, 'msg' => $this->root->_attach_messages['err_noexist']); } } else { if (!is_file($tmpname) || !filesize($tmpname)) { if (is_file($tmpname)) { unlink($tmpname); } return array('result' => FALSE, 'msg' => $this->root->_attach_messages['err_noexist']); } if (rename($tmpname, $obj->filename)) { $this->attach_chmod($obj->filename); } else { unlink($tmpname); return array('result' => FALSE, 'msg' => $this->root->_attach_messages['err_noexist']); } } if ($this->func->is_page($page)) { if (!$notouch) { if (!$changelog) { $changelog = 'Attached file: ' . $this->func->htmlspecialchars($obj->file); } $this->root->rtf['page_touch'][$page][] = $changelog; } $this->func->clear_page_cache($page); } if (!empty($options['asSystem'])) { $_uid = 0; $_ucd = 'SYSTEM'; $_uname = 'System'; $_admins = 0; } else { $_uid = $this->root->userinfo['uid']; $_ucd = $this->root->userinfo['ucd']; $_uname = $this->root->userinfo['uname']; $_admins = (int) $this->func->check_admin($this->root->userinfo['uid']); } if ($_size && version_compare(HypCommonFunc::get_version(), '20150515', '>=')) { // 自動回転を試みる HypCommonFunc::rotateImage($obj->filename, 0, 95, $_size); if (!empty($this->root->vars['rmgps'])) { HypCommonFunc::removeExifGps($obj->filename, $_size); } } $obj->getstatus(); $obj->status['age'] = 0; $obj->status['pass'] = ($pass !== TRUE and $pass !== NULL) ? $pass : ''; $obj->status['copyright'] = $copyright; $obj->status['owner'] = $_uid; $obj->status['ucd'] = $_ucd; $obj->status['uname'] = $_uname; $obj->status['md5'] = md5_file($obj->filename); $obj->status['admins'] = $_admins; $obj->status['org_fname'] = $org_fname; $obj->status['imagesize'] = $obj->getimagesize($obj->filename); $obj->status['mime'] = $this->attach_mime_content_type($obj->filename, $obj->status); $obj->action = $_action; $obj->putstatus(); if (!empty($this->root->vars['refid'])) { $this->ref_replace($page, $this->root->vars['refid'], $obj->file, $obj->status['imagesize']); } return array('result' => TRUE, 'msg' => $add_mes ? join("\n", $add_mes) : $this->root->_attach_messages['msg_uploaded'], 'name' => $obj->file, 'has_json_msg' => $has_json_msg); }
function &_getMobilePictogramConverter() { if (!XC_CLASS_EXISTS('MobilePictogramConverter')) { HypCommonFunc::loadClass('MobilePictogramConverter'); } $mpc =& MobilePictogramConverter::factory_common(); $mpc->setImagePath($this->Config_emojiDir); $mpc->setFromCharset(strtoupper($this->outputEncode) === 'UTF-8' ? MPC_FROM_CHARSET_UTF8 : MPC_FROM_CHARSET_SJIS); $mpc->userAgent = $this->vars['ua']['agent']; return $mpc; }
function plugin_edit_write() { $_uname = empty($this->root->vars['uname']) || !empty($this->root->vars['anonymous']) ? $this->root->siteinfo['anonymous'] : $this->root->vars['uname']; if ($_uname) { if (!empty($this->root->vars['anonymous'])) { $this->root->cookie['name'] = $_uname; } else { // save name to cookie $this->func->save_name2cookie($_uname); } } $page = isset($this->root->vars['page']) ? $this->root->vars['page'] : ''; $add = isset($this->root->vars['add']) ? $this->root->vars['add'] : ''; $digest = isset($this->root->vars['digest']) ? $this->root->vars['digest'] : ''; $paraid = isset($this->root->vars['paraid']) ? $this->root->vars['paraid'] : ''; $original = ''; $this->root->vars['msg'] = preg_replace($this->cont['PLUGIN_EDIT_FREEZE_REGEX'], '', $this->root->vars['msg']); $this->root->vars['msg'] = $this->func->remove_pginfo($this->root->vars['msg']); $msg =& $this->root->vars['msg']; // Reference // Get original data from cache DB. if (!empty($this->root->vars['orgkey'])) { $original = (string) $this->func->cache_get_db($this->root->vars['orgkey'], 'edit', true); $original = $this->func->remove_pginfo($original); } // ParaEdit $hash = ''; if ($paraid) { if (!$original) { $original = $this->func->remove_pginfo($this->func->get_source($page, TRUE, TRUE)); } $source = preg_split('/([^\\n]*\\n)/', $original, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); if ($this->plugin_edit_parts($paraid, $source, $msg) !== FALSE) { $fullmsg = join('', $source); } else { // $this->root->vars['msg']だけがページに書き込まれてしまうのを防ぐ。 $fullmsg = rtrim($original) . "\n\n" . $msg; } $msg = $fullmsg; $hash = '#' . $paraid; } // 文末処理 $msg = rtrim($msg) . "\n"; // 改行・TAB・スペースのみだったら削除とみなす $msg = preg_replace('/^\\s+$/', '', $msg); // Page title if ($msg && !empty($this->root->post['pgtitle'])) { $msg = $this->root->title_setting_string . trim($this->root->post['pgtitle']) . "\n" . $msg; } $retvars = array(); // Collision Detection $oldpagesrc = $this->func->get_source($page, TRUE, TRUE); $oldpagemd5 = $this->func->get_digests($oldpagesrc); if ($digest != $oldpagemd5) { $this->root->vars['digest'] = $oldpagemd5; // Reset unset($this->root->vars['paraid']); // 更新が衝突したら全文編集に切り替え $oldpagesrc = $this->func->remove_pginfo($oldpagesrc); list($postdata_input, $auto) = $this->func->do_update_diff($oldpagesrc, $msg, $original); $retvars['msg'] = $this->root->_title_collided; $retvars['body'] = ($auto ? $this->root->_msg_collided_auto : $this->root->_msg_collided) . "\n"; $retvars['body'] .= $this->root->do_update_diff_table; $retvars['body'] .= $this->func->edit_form($page, $postdata_input, $oldpagemd5, FALSE); if (isset($this->root->vars['ajax'])) { $this->func->convert_finisher($retvars['body']); $body = <<<EOD <xpwiki> <content><![CDATA[{$retvars['body']}]]></content> <mode>preview</mode> </xpwiki> EOD; $this->func->send_xml($body); } return $retvars; } // Action? if ($add) { // Add if (isset($this->root->vars['add_top']) && $this->root->vars['add_top']) { $postdata = $msg . "\n\n" . $this->func->get_source($page, TRUE, TRUE); } else { $postdata = $this->func->get_source($page, TRUE, TRUE) . "\n\n" . $msg; } } else { // Edit or Remove $postdata =& $msg; // Reference } // NULL POSTING, OR removing existing page if (!$postdata) { $this->func->page_write($page, ''); if ($this->root->trackback) { $this->func->tb_delete($page); } if ($this->root->maxshow_deleted && $this->func->is_page($this->root->whatsdeleted)) { $url = $this->func->get_page_uri($this->root->whatsdeleted, true); } else { $url = $this->cont['HOME_URL']; } $title = str_replace('$1', $this->func->htmlspecialchars($page), $this->root->_title_deleted); if (isset($this->root->vars['ajax'])) { $url = $this->func->htmlspecialchars($url, ENT_QUOTES); $body = <<<EOD <xpwiki> <content><![CDATA[{$title}]]></content> <mode>delete</mode> <url>{$url}</url> </xpwiki> EOD; $this->func->send_xml($body); } $this->func->redirect_header($url, 1, $title); } // $notimeupdate: Checkbox 'Do not change timestamp' $notimestamp = isset($this->root->vars['notimestamp']) && $this->root->vars['notimestamp'] != ''; if ($this->root->notimeupdate > 1 && !$this->root->userinfo['admin']) { $notimestamp = false; } $this->func->page_write($page, $postdata, $this->root->notimeupdate != 0 && $notimestamp); if (isset($this->root->vars['ajax'])) { if (!empty($this->root->vars['nonconvert'])) { $body = ''; } else { $obj = new XpWiki($this->root->mydirname); $obj->init($page); $obj->root->userinfo['uname_s'] = $this->func->htmlspecialchars($this->root->cookie['name']); $obj->execute(); if (isset($obj->root->rtf['useJavascriptInHead'])) { $body = '<script src="" />'; } else { $body = $obj->body; // set target if (isset($this->root->vars['popup'])) { $body = preg_replace('/(<a[^>]+)(href=(?:"|\')[^#])/isS', '$1target="' . (intval($this->root->vars['popup']) === 1 ? '_parent' : $this->func->htmlspecialchars(substr($this->root->vars['popup'], 0, 30))) . '" $2', $body); } $body = str_replace(array('<![CDATA[', ']]>'), '', $body); } if (preg_match('/\\(\\([eisv]:[0-9a-f]{4}\\)\\)|\\[emj:\\d{1,4}(?::(?:im|ez|sb))?\\]/S', $body)) { if (!XC_CLASS_EXISTS('MobilePictogramConverter')) { HypCommonFunc::loadClass('MobilePictogramConverter'); } if (XC_CLASS_EXISTS('MobilePictogramConverter')) { $mpc =& MobilePictogramConverter::factory_common(); $mpc->setImagePath($this->cont['ROOT_URL'] . 'images/emoji'); $mpc->setString($body, FALSE); $body = $mpc->autoConvertModKtai(); } } } $body = <<<EOD <xpwiki> <content><![CDATA[{$body}]]></content> <mode>write</mode> </xpwiki> EOD; $this->func->send_xml($body); } $this->func->send_location($page, $hash); }
function word_highlight($body, $q_word, $enc = null, $msg = '', $extlink_class_name = 'ext', $word_max_len = 20) { if (is_null($enc)) { if (function_exists('mb_internal_encoding')) { $enc = mb_internal_encoding(); } else { if (defined('_CHARSET')) { $enc = _CHARSET; } else { $enc = 'EUC-JP'; } } } $enc = strtoupper($enc); // 外部リンクの場合 class="ext" を付加 if ($extlink_class_name) { $_body = preg_replace_callback('/(<script.*?<\\/script>)|(<a[^>]+?href=(?:"|\')?(?!https?:\\/\\/' . $_SERVER['HTTP_HOST'] . ')https?:[^>]+?)>/isS', create_function('$arr', 'return $arr[1]? $arr[1] : ((strpos($arr[2], \'class=\') === FALSE)? "$arr[2] class=\\"' . $extlink_class_name . '\\">" : "$arr[0]");'), $body); if ($_body) { $body = $_body; } // for RCRE error. } if (!$q_word || !$body) { return $body; } if (function_exists("xoops_gethandler")) { $config_handler =& xoops_gethandler('config'); $xoopsConfigSearch =& $config_handler->getConfigsByCat(XOOPS_CONF_SEARCH); } else { $xoopsConfigSearch['keyword_min'] = 3; } //検索語ハイライト $search_word = ''; //$words = array_flip(preg_split('/\s+/',$q_word,-1,PREG_SPLIT_NO_EMPTY)); $words = array_flip(HypCommonFunc::phrase_split($q_word)); $keys = array(); $cnt = 0; if (function_exists('mb_strlen')) { $strlen = create_function('$str', 'return mb_strlen("$str");'); } else { $strlen = create_function('$str', 'return strlen("$str");'); } foreach ($words as $word => $id) { $_len = $strlen($word); if ($_len < $xoopsConfigSearch['keyword_min']) { continue; } if ($_len > $word_max_len) { continue; } $keys[$word] = $strlen($word); $cnt++; if ($cnt > 10) { break; } } //arsort($keys,SORT_NUMERIC); $keys = HypGetQueryWord::get_search_words(array_keys($keys), false, $enc); $id = 0; $utf8 = $enc === 'UTF-8' ? 'u' : ''; $php5_1 = version_compare(PHP_VERSION, '5.1.0', '>='); foreach ($keys as $key => $pattern) { $s_key = preg_replace('/&#(\\d+;)/', '&#$1', htmlspecialchars($key)); $_count = 0; $pattern = $s_key[0] == '&' ? '/(<head.*?<\\/head>|<script.*?<\\/script>|<style.*?<\\/style>|<textarea.*?<\\/textarea>|<strong class="word\\d+">.*?<\\/strong>|<[^>]*>)|(' . $pattern . ')/isS' . $utf8 : '/(<head.*?<\\/head>|<script.*?<\\/script>|<style.*?<\\/style>|<textarea.*?<\\/textarea>|<strong class="word\\d+">.*?<\\/strong>|<[^>]*>|&(?:#[0-9]+|#x[0-9a-f]+|[0-9a-zA-Z]+);)|(' . $pattern . ')/isS' . $utf8; $GLOBALS['HypGetQueryWord_Highlighted'] = false; $_body = preg_replace_callback($pattern, create_function('$arr', 'if ($arr[1]) {return $arr[1];} else {$GLOBALS[\'HypGetQueryWord_Highlighted\'] = true; return \'<strong class="word' . $id . '">\'.$arr[2].\'</strong>\';}'), $body); if ($GLOBALS['HypGetQueryWord_Highlighted']) { $body = $_body; $search_word .= ' <strong class="word' . $id . '">' . $s_key . '</strong>'; $id++; } } if ($id) { $_count = 0; $body = str_replace('<!--HIGHLIGHT_SEARCH_WORD-->', '<div class="highlight_search_words">' . $msg . ': ' . $search_word . '</div>', $body, $_count); if (!$_count) { $body = preg_replace('/<body[^>]*?>/', '$0<div class="highlight_search_words">' . str_replace('\\', '\\\\', $msg) . ': ' . str_replace('\\', '\\\\', $search_word) . '</div>', $body); } } return $body; }
function GC_i4k($cachepath, $TTL, $showResult = FALSE) { HypCommonFunc::touch($cachepath . '/i4k.gc'); $i = 0; $i2 = 0; if ($handle = opendir($cachepath)) { $iua = ignore_user_abort(true); while (false !== ($file = readdir($handle))) { if (substr($file, -4) === '.i4k' || substr($file, -5) === '.i4ks') { $i2++; $target = $cachepath . '/' . $file; $del = false; if ($del || filemtime($target) < UNIX_TIME - $TTL) { unlink($target); $i++; } } } closedir($handle); ignore_user_abort($iua); } if ($showResult) { echo $i . '/' . $i2 . ' files removed.'; } }
function plugin_isbn_inline() { if (HypCommonFunc::get_version() < 20080224) { return '&amazon require "HypCommonFunc" >= Ver. 20080224'; } // 言語ファイルの読み込み $this->load_language(); $this->root->rtf['disable_render_cache'] = true; $prms = func_get_args(); $body = array_pop($prms); // {}内 $body = preg_replace('#</?(a|span)[^>]*>#i', '', $body); $body = preg_replace('#(?:alt|title)=("|\').*\\1#i', '', $body); list($isbn, $option) = array_pad($prms, 2, ""); $option = $this->func->htmlspecialchars($option); // for XSS $isbn = $this->func->htmlspecialchars($isbn); // for XSS $isbn = str_replace("-", "", $isbn); $tmpary = array(); $tmpary = $this->plugin_isbn_get_isbn_title($isbn); if ($tmpary[0][0] === "\t") { return trim($tmpary[0]) . $this->config['conflink']; } if ($tmpary[2]) { $price = "<div style=\"text-align:right;\">" . str_replace('$1', $tmpary[2], $this->msg['currency']) . "</div>"; } $title = $tmpary[0]; //$text = $this->func->htmlspecialchars(preg_replace('#</?(a|span)[^>]*>#i','',$option)); $alt = $this->plugin_isbn_get_caption($tmpary); $amazon_a = '<a href="' . str_replace(array('_ISBN_', 'AMAZON_ASE_ID'), array($isbn, $this->config['AMAZON_ASE_ID']), $this->config['ISBN_AMAZON_SHOP']) . '" target="_blank" title="' . $alt . '">'; $match = array(); if (!preg_match("/(s|l|m)?ima?ge?/i", $option, $match)) { if ($option || $body) { $title = $option . $body; } return $amazon_a . $title . '</a>'; } else { $size = ''; if (!empty($match[1])) { $size = strtoupper($match[1]); if ($size === 'M') { $size = ''; } else { $size .= '-'; } } $url = $this->plugin_isbn_cache_image_fetch($size . $isbn, $this->cont['CACHE_DIR']); return $amazon_a . '<img src="' . $url . '" alt="' . $alt . '" /></a>'; } }
function plugin_moblog_output() { if ($this->chk_fp) { flock($this->chk_fp, LOCK_UN); fclose($this->chk_fp); } $this->debug_write(); if ($this->output_mode === 'rss') { $rss = $this->func->get_plugin_instance('rss'); $rss->plugin_rss_action(); exit; } // clear output buffer $this->func->clear_output_buffer(); if (isset($this->root->get['debug']) && $this->admin) { echo 'Debug:<br />' . join('<br />', $this->debug); } else { // imgタグ呼び出し用 header("Content-Type: image/gif"); HypCommonFunc::readfile($this->root->mytrustdirpath . '/skin/image/gif/spacer.gif'); } exit; }
function show_form() { $user_pref = $this->func->get_user_pref($this->uid); $disabled = array(); if ($this->root->twitter_consumer_key && $this->root->twitter_consumer_secret && function_exists('curl_init') && version_compare(PHP_VERSION, '5.0.0', '>') && HypCommonFunc::get_version() >= '20100108') { HypCommonFunc::loadClass('TwitterOAuth'); $state = isset($_SESSION['oauth_state']) ? $_SESSION['oauth_state'] : ''; if (!empty($user_pref['twitter_access_token']) && !empty($user_pref['twitter_access_token_secret'])) { $to = new TwitterOAuth($this->root->twitter_consumer_key, $this->root->twitter_consumer_secret, $user_pref['twitter_access_token'], $user_pref['twitter_access_token_secret']); $content = $to->OAuthRequest('https://twitter.com/account/verify_credentials.xml', 'GET', array()); if (strpos($content, '<error>') === FALSE) { $state = 'ok'; } else { $user_pref['twitter_access_token'] = ''; $user_pref['twitter_access_token_secret'] = ''; } } if (!empty($this->root->get['oauth_token']) && $state === 'start') { $state = 'returned'; unset($_SESSION['oauth_state']); } if (isset($this->root->get['denied'])) { $state = 'denied'; unset($_SESSION['oauth_state']); } switch ($state) { case 'returned': $to = new TwitterOAuth($this->root->twitter_consumer_key, $this->root->twitter_consumer_secret, $_SESSION['oauth_request_token'], $_SESSION['oauth_request_token_secret']); $tok = $to->getAccessToken($this->root->get['oauth_verifier']); $user_pref['twitter_access_token'] = $tok['oauth_token']; $user_pref['twitter_access_token_secret'] = $tok['oauth_token_secret']; $this->msg['twitter_access_token_secret']['description'] = ''; break; case 'denied': $user_pref['twitter_access_token'] = ''; $user_pref['twitter_access_token_secret'] = ''; $this->msg['twitter_access_token_secret']['description'] = ''; break; case 'ok': $this->msg['twitter_access_token_secret']['description'] = ''; break; default: $to = new TwitterOAuth($this->root->twitter_consumer_key, $this->root->twitter_consumer_secret); $tok = $to->getRequestToken($this->root->script . '?cmd=user_pref'); if (!empty($tok['oauth_token'])) { $_SESSION['oauth_request_token'] = $token = $tok['oauth_token']; $_SESSION['oauth_request_token_secret'] = $tok['oauth_token_secret']; $_SESSION['oauth_state'] = "start"; $this->root->twitter_request_link = $to->getAuthorizeURL($token); } else { $disabled['twitter'] = true; } break; } } else { $disabled['twitter'] = true; } if (!empty($disabled['twitter'])) { unset($this->user_pref['twitter_access_token'], $this->user_pref['twitter_access_token_secret']); } // moblog if (!$this->root->use_moblog_user_pref) { unset($this->user_pref['moblog_mail_address'], $this->user_pref['moblog_base_page'], $this->user_pref['moblog_user_mail'], $this->user_pref['moblog_to_twitter'], $this->user_pref['moblog_auth_code']); } else { if (strpos($this->root->moblog_pop_mail, '*') === false) { unset($this->user_pref['moblog_user_mail']); } else { unset($this->user_pref['moblog_mail_address']); if (empty($user_pref['moblog_user_mail'])) { $user_tag = strtolower($this->make_user_tag()); $user_pref['moblog_user_mail'] = str_replace('*', $user_tag, $this->root->moblog_pop_mail); } $this->root->moblog_user_mail = htmlspecialchars($user_pref['moblog_user_mail']); $this->root->moblog_user_mail_rawurlenc = rawurlencode($user_pref['moblog_user_mail']); } if (!$user_pref['twitter_access_token']) { unset($this->user_pref['moblog_to_twitter']); } } // XML-RPC if (!$this->root->use_xmlrpc) { unset($this->user_pref['xmlrpc_pages'], $this->user_pref['xmlrpc_auth_key'], $this->user_pref['xmlrpc_to_twitter']); } else { if (empty($user_pref['xmlrpc_pages'])) { // Read user config $pages = array(); $config = new XpWikiConfig($this->xpwiki, $this->cont['PKWK_CONFIG_USER'] . '/' . $this->root->userinfo['uname']); $table = $config->read() ? $config->get('XML-RPC') : array(); foreach ($table as $row) { if (isset($row[1]) && strtolower(trim($row[0])) === 'myblog') { $page = $this->func->strip_bracket(trim($row[1])); $pages[] = htmlspecialchars($page); } } $user_pref['xmlrpc_pages'] = join("\n", $pages); } if (empty($user_pref['xmlrpc_auth_key'])) { $user_pref['xmlrpc_auth_key'] = substr($this->make_user_tag(), 0, 8); } if (!$user_pref['twitter_access_token']) { unset($this->user_pref['xmlrpc_to_twitter']); } } $script = $this->func->get_script_uri(); if ($this->user_pref) { $body = <<<EOD <div> <h2>{$this->msg['title_description']}</h2> {$this->msg['msg_description']} </div> <hr /> <div class="user_pref"> <form action="{$script}" method="post"> <table> EOD; //var_dump($user_pref); //exit; foreach ($this->user_pref as $key => $conf) { $caption = !empty($conf['caption']) ? $conf['caption'] : (!empty($this->msg[$key]['caption']) ? $this->msg[$key]['caption'] : $key); $description = !empty($conf['description']) ? $conf['description'] : (!empty($this->msg[$key]['description']) ? $this->msg[$key]['description'] : ''); $description = preg_replace('/\\{\\$root->(.+?)\\}/e', '$this->root->$1', $description); $value = isset($user_pref[$key]) ? $user_pref[$key] : ''; $value4disp = htmlspecialchars($value); $name4disp = htmlspecialchars($key); $real = ''; $extention = !empty($this->msg[$key]['extention']) ? $this->msg[$key]['extention'] : ''; list($form, $attr) = array_pad(explode(',', $conf['form'], 2), 2, ''); switch ($form) { case 'select': $forms = array(); if (!isset($conf['list']['group'])) { $conf['list']['group'][0] = $conf['list']; } foreach ($conf['list']['group'] as $label => $optgroup) { if (is_string($label)) { $forms[] = '<optgroup label="' . $label . '">'; } foreach ($optgroup as $list_cap => $list_val) { if ($value == $list_val) { $selected = ' selected="selected"'; } else { $selected = ''; } $forms[] = '<option value="' . $list_val . '"' . $selected . '>' . $list_cap . '</option>'; } if (is_string($label)) { $forms[] = '</optgroup>'; } } $form = '<select name="' . $name4disp . '" ' . $attr . '>' . join('', $forms) . '</select>'; break; case 'yesno': $conf['list'] = array($this->msg['Yes'] => 1, $this->msg['No'] => 0); case 'radio': $forms = array(); $i = 0; foreach ($conf['list'] as $list_cap => $list_val) { if ($value == $list_val) { $checked = ' checked="checked"'; } else { $checked = ''; } $forms[] = '<span class="nowrap"><input id="' . $name4disp . '_' . $i . '" type="radio" name="' . $name4disp . '" value="' . $list_val . '"' . $checked . ' /><label for="' . $name4disp . '_' . $i . '">' . $list_cap . '</label></span>'; $i++; } $form = join(' | ', $forms); break; case 'textarea': $form = '<textarea name="' . $name4disp . '" ' . $attr . ' rel="nowikihelper">' . $value4disp . '</textarea>'; break; case 'hidden': $form = '<input type="hidden" name="' . $name4disp . '" value="' . $value4disp . '" />' . $value4disp; break; case 'text': default: $style = ''; if ($conf['type'] === 'integer' || $conf['type'] === 'integer!0') { $style = ' style="text-align:right;"'; } $form = '<input type="text" name="' . $name4disp . '" value="' . $value4disp . '" ' . $attr . $style . ' />'; } $body .= <<<EOD <tr> <td style="font-weight:bold;padding-top:0.5em" id="{$key}">{$caption}</td> <td style="padding-top:0.5em">{$form}{$extention}</td> </tr> <tr style="border-bottom:1px dotted gray;"> <td colspan="2" style="padding-bottom:0.5em"><p>{$description}</p></td> </tr> EOD; } $body .= <<<EOD <tr> <td> </td> <td><input type="submit" name="submit" value="{$this->msg['btn_submit']}" /></td> </tr> </table> <input type="hidden" name="plugin" value="user_pref" /> <input type="hidden" name="pmode"\t value="post" /> </form> </div> EOD; } else { $body = 'There is no item.'; } return array('msg' => $this->msg['title_form'], 'body' => $body); }
} else { if (file_exists(XOOPS_TRUST_PATH . '/libs/' . $lib . '/index.php')) { include XOOPS_TRUST_PATH . '/libs/' . $lib . '/index.php'; } else { die('wrong request'); } } } else { $constpref = '_MI_' . strtoupper($mydirname); // load language files (main.php & admin.php) $langman->read('modinfo.php', $mydirname, $mytrustdirname); if (!empty($_POST)) { if (!$xoopsGTicket->check(true, $mydirname)) { redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors()); } HypCommonFunc::stripslashes_gpc($_POST); if (isset($_POST['page'])) { $_GET['page'] = $_POST['page']; } } // fork each pages of this module $page = preg_replace('/[^a-zA-Z0-9_-]/', '', @$_GET['page']); if (file_exists("{$mytrustdirpath}/admin/{$page}.php")) { // load $config include "{$mytrustdirpath}/admin/{$page}.php"; $op = ''; if (isset($_POST) && isset($_POST['op'])) { $op = $_POST['op']; } if ($op === 'save') { hypconfSaveConf($config);
function catbody() { $skin_protect_profile = false; if ($this->cont['SKIN_NAME'] !== 'default') { $skin_protect_profile = !in_array($this->cont['UA_PROFILE'], explode(',', str_replace(' ', '', $this->root->skin_change_profiles))); // Check Skin name if ($skin_protect_profile || !is_file($this->cont['SKIN_FILE']) || $this->root->runmode === 'xoops_admin') { $this->cont['SKIN_NAME'] = 'default'; $this->cont['SKIN_DIR'] = 'skin/' . $this->cont['SKIN_NAME'] . '/'; $this->cont['SKIN_FILE'] = $this->cont['DATA_HOME'] . $this->cont['SKIN_DIR'] . 'pukiwiki.skin.php'; } } // SKIN select from Cookie or Plugin. if ($this->cont['SKIN_CHANGER'] && !$skin_protect_profile && (!empty($this->root->cookie['skin']) || is_string($this->cont['SKIN_CHANGER'])) && in_array($this->cont['UA_PROFILE'], explode(',', str_replace(' ', '', $this->root->skin_change_profiles)))) { $this->cont['SKIN_NAME'] = empty($this->root->cookie['skin']) ? $this->cont['SKIN_CHANGER'] : $this->root->cookie['skin']; if (preg_match('/^[_0-9a-zA-Z-]+$/', $this->cont['SKIN_NAME'])) { if (substr($this->cont['SKIN_NAME'], 0, 3) === "tD-") { //tDiary's theme $theme_name = substr($this->cont['SKIN_NAME'], 3); $theme_css = $this->cont['DATA_HOME'] . $this->cont['TDIARY_DIR'] . $theme_name . '/' . $theme_name . '.css'; if (is_file($theme_css)) { $this->cont['SKIN_FILE'] = $this->cont['DATA_HOME'] . $this->cont['TDIARY_DIR'] . 'tdiary.skin.php'; $this->cont['TDIARY_THEME'] = $theme_name; } } else { //PukiWiki's skin $skindir = "skin/" . $this->cont['SKIN_NAME'] . "/"; $skin = $this->cont['DATA_HOME'] . $skindir . 'pukiwiki.skin.php'; if (is_file($skin)) { $this->cont['SKIN_DIR'] = $skindir; $this->cont['SKIN_FILE'] = $skin; } } } } if ($this->root->viewmode === 'print') { if (!empty($this->cont['TDIARY_THEME'])) { $skindir = 'skin/tdiary_theme/'; } else { $skindir = 'skin/' . $this->cont['SKIN_NAME'] . '/'; } $skin = $this->cont['DATA_HOME'] . $skindir . 'print.skin.php'; if (is_file($skin)) { $this->cont['SKIN_DIR'] = $skindir; $this->cont['SKIN_FILE'] = $skin; } else { $this->cont['SKIN_DIR'] = 'skin/default/'; $this->cont['SKIN_FILE'] = $this->root->mytrustdirpath . '/skin/print.skin.php'; } } // Set Skin Name for FCKeditor. $this->func->add_js_var_head('XpWiki.SkinName["' . $this->root->mydirname . '"]', $this->cont['SKIN_NAME']); // catbody ob_start(); $this->func->catbody($this->title, $this->skin_title, $this->body); $body = ob_get_contents(); @ob_end_clean(); if (!defined('HYP_K_TAI_RENDER') && preg_match('/\\(\\([eisv]:[0-9a-f]{4}\\)\\)|\\[emj:\\d{1,4}(?::(?:im|ez|sb))?\\]/S', $body)) { if (!XC_CLASS_EXISTS('MobilePictogramConverter')) { HypCommonFunc::loadClass('MobilePictogramConverter'); } if (XC_CLASS_EXISTS('MobilePictogramConverter')) { $mpc =& MobilePictogramConverter::factory_common(); $mpc->setString($body, FALSE); if (method_exists($mpc, 'modKtai2textPictMobile') && (defined('HYP_WIZMOBILE_USE') || class_exists('WizMobile'))) { // convert to [emj:xxx] $body = $mpc->modKtai2textPictMobile(); } else { $mpc->setImagePath($this->cont['ROOT_URL'] . 'images/emoji'); $mpc->userAgent = ''; // Always IMG output $body = $mpc->autoConvertModKtai(); } } } $this->html = $body; if (!empty($this->root->runmode)) { $this->runmode = $this->root->runmode; } $this->breadcrumbs_array = $this->func->get_breadcrumbs_array($this->page); $this->breadcrumbs_array[] = array('name' => preg_replace('#^' . preg_quote(preg_replace('#/[^/]+$#', '', $this->page) . '/', '#') . '#', '', $this->title), 'url' => ''); return; }
} ///////////////////////////////////////////////// // ブラウザ調整前のデフォルト値 // 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
function _sendQuery($params) { $url = $this->_getUrl($params); $timer = $this->cacheDir . 'hyp_hsa_' . $this->AccessKeyId . '.timer'; $loop = 0; if ($this->OneRequestPerSec) { while ($loop < $this->retry_count && is_file($timer) && filemtime($timer) >= time()) { $loop++; clearstatcache(); usleep($this->retry_interval * 1000); // 250ms } } if ($this->OneRequestPerSec && $loop >= $this->retry_count) { $this->xml = ''; $this->error = 'Request Error: Too busy.'; } else { if ($this->OneRequestPerSec) { HypCommonFunc::touch($timer); } $ht = new Hyp_HTTP_Request(); $ht->init(); $this->url = $ht->url = $url; $ht->get(); if ($ht->rc === 200 || $ht->rc === 403) { $data = $ht->data; $xm = new HypSimpleXML(); $this->xml = $xm->XMLstr_in($data); //var_dump($this->xml);exit(); if ($xm->error) { $this->error = $xm->error; } else { if ($error = @$this->xml['Items']['Request']['Errors']['Error']) { $this->error = mb_convert_encoding($error['Message'], $this->encoding, 'UTF-8'); } else { if ($error = @$this->xml['Items'][0]['Request']['Errors']['Error']) { $this->error = mb_convert_encoding($error['Message'], $this->encoding, 'UTF-8'); } else { if ($error = @$this->xml['OperationRequest']['Errors']['Error']) { $this->error = $error['Code'] . ': ' . mb_convert_encoding($error['Message'], $this->encoding, 'UTF-8'); } else { if ($error = @$this->xml['Error']) { $this->error = $error['Code'] . ': ' . mb_convert_encoding($error['Message'], $this->encoding, 'UTF-8'); } } } } } } else { $this->xml = ''; $this->error = 'HTTP Error: ' . $ht->rc; } } }
function make_thumb($o_file, $s_file, $width, $height, $quality) { return HypCommonFunc::make_thumb($o_file, $s_file, $width, $height, "1,95", FALSE, $quality); }
function make_thumbnail($url, $prms) { static $count = 0; if (!preg_match('#^https?://#', $url)) { $url = 'http://' . $url; } $target = $this->func->htmlspecialchars($prms['target']); $nolink = $prms['nolink']; $thumburl = $this->fetch_url . $url; $sha1 = sha1($thumburl); $prm_size = strtolower($prms['size']); if (!preg_match('/[sml]/', $prm_size)) { $prm_size = 's'; } $thumb_size = $this->thumb_size[$prm_size]; $size = $thumb_size['width'] . 'x' . $thumb_size['height']; $thumb_file = $this->cont['CACHE_DIR'] . 'ASIN_SITEIMAGE_' . $sha1 . '_' . $prm_size . '.jpg'; $cache = $this->cont['CACHE_DIR'] . 'plugin/' . $sha1 . '.siteimage'; $is_new = !is_file($cache); if ($is_new || $count < $this->get_max_once && filemtime($cache) + $this->cache_day * 86400 < $this->cont['UTC']) { $count++; $ht = new Hyp_HTTP_Request(); $ht->init(); $ht->ua = 'Mozilla/5.0'; $ht->url = $thumburl; $ht->get(); $image = ''; if ($ht->rc === 200) { $image = $ht->data; } $ht = NULL; if ($image && ($fp = fopen($cache, 'wb'))) { fwrite($fp, $image); fclose($fp); foreach (array('s', 'm', 'l') as $_size) { @unlink($this->cont['CACHE_DIR'] . 'ASIN_SITEIMAGE_' . $sha1 . '_' . $_size . '.jpg'); } if ($is_new) { $this->func->pkwk_touch_file($cache, $this->cont['UTC'] - $this->cache_day * 86400 + $this->cache1st_min * 60); } } } if (!is_file($thumb_file)) { copy($cache, $thumb_file); HypCommonFunc::ImageResize($thumb_file, $size); HypCommonFunc::ImageMagickRoundCorner($thumb_file, '', 5, 2); } $cache_url = str_replace($this->cont['DATA_HOME'], $this->cont['HOME_URL'], $thumb_file); $url = $this->func->htmlspecialchars($url); $title = preg_replace('#^https?://#i', '', $url); $ret = "<img src=\"" . $cache_url . "\" width=\"{$thumb_size['width']}\" height=\"{$thumb_size['height']}\" alt=\"{$title}\">"; if (!$nolink) { $ret = "<a class=\"siteimage\" href=\"{$url}\" target=\"{$target}\" title=\"{$title}\">" . $ret . "</a>"; } return $ret; }
if (defined('XOOPS_URL')) { $this->redirect_header(XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=update&module=' . $root->mydirname, 1, $title); } else { exit($title); } } } ///////////////////////////////////////////////// // ディレクトリのチェック $die = ''; foreach (array($const['DATA_DIR'], $const['DIFF_DIR'], $const['BACKUP_DIR'], $const['CACHE_DIR']) as $dir) { if (!is_writable($dir)) { $die .= 'Directory is not found or not writable (' . $dir . ')' . "\n"; } } if (!$root->can_not_connect_www && HypCommonFunc::get_version() >= '20080213') { $dir = $const['TRUST_PATH'] . 'class/hyp_common/favicon/cache'; if (!is_writable($dir)) { $die .= 'Directory is not found or not writable (' . $dir . ')' . "\n"; } } // 設定ファイルの変数チェック $temp = ''; foreach (array('rss_max', 'note_hr', 'related_link', 'show_passage', 'rule_related_str', 'load_template_func') as $var) { if (!isset($root->{$var})) { $temp .= '$' . $var . "\n"; } } if ($temp) { if ($die) { $die .= "\n";
<?php ignore_user_abort(true); // clear output buffer while (ob_get_level()) { ob_end_clean(); } header('Content-Type: text/javascript; charset=UTF-8'); header('Content-Length: 0'); header('Connection: close'); flush(); include_once $trustpath . '/class/hyp_common/hyp_common_func.php'; HypCommonFunc::spamdat_auto_update($trustpath); exit('');
function gc($get_tag = FALSE) { $dir = $this->cont['CACHE_DIR'] . 'plugin'; $gc = $this->cont['CACHE_DIR'] . 'plugin/aws.gc'; $interval = $this->config['cache_time'] * 60; if (!is_file($gc) || filemtime($gc) < $this->cont['UTC'] - $interval) { if ($get_tag) { return '<div style="float:left;"><img src="' . $this->root->script . '?plugin=aws&pcmd=gc" width="1" height="1" alt="" /></div>' . "\n"; } touch($gc); $attr = '.aws'; $attr_len = strlen($attr) * -1; $ttl = $this->config['cache_time'] * 60; $check = $this->cont['UTC'] - $ttl; if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if (substr($file, $attr_len) === $attr) { $target = $dir . '/' . $file; if (filemtime($target) < $check) { unlink($target); } } } closedir($dh); } } if ($get_tag) { return ''; } // clear output buffer $this->func->clear_output_buffer(); // imgタグ呼び出し用 header("Content-Type: image/gif"); HypCommonFunc::readfile($this->root->mytrustdirpath . '/skin/image/gif/spacer.gif'); }