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 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 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 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; }
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); }
function emojiFilter($str) { if ($str === '' || strpos($str, '<html') === FALSE) { return false; } if (preg_match('/\\(\\([eisv]:[0-9a-f]{4}\\)\\)|\\[emj:\\d{1,4}(?::(?:im|ez|sb))?\\]/S', $str)) { if (!XC_CLASS_EXISTS('MobilePictogramConverter')) { HypCommonFunc::loadClass('MobilePictogramConverter'); } $mpc =& MobilePictogramConverter::factory_common(); $mpc->setImagePath(XOOPS_URL . '/images/emoji'); $mpc->setString($str, FALSE); $str = $mpc->autoConvertModKtai(); if (!$str) { return false; } } $this->changeContentLength = true; return $str; }
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 plugin_moblog_action() { error_reporting(0); $this->debug = array(); $this->admin = $this->root->userinfo['admin']; $this->chk_fp = NULL; $this->output_mode = isset($this->root->vars['om']) && $this->root->vars['om'] === 'rss' ? 'rss' : 'img'; $host = $user = $pass = $port = ''; $execution_time = intval(ini_get('max_execution_time')); //設定ファイル読み込み if (isset($this->config['host'])) { $host = (string) $this->config['host']; } if (isset($this->config['mail'])) { $mail = (string) $this->config['mail']; } if (isset($this->config['user'])) { $user = (string) $this->config['user']; } if (isset($this->config['pass'])) { $pass = (string) $this->config['pass']; } if (isset($this->config['port'])) { $port = (int) $this->config['port']; } foreach (array('mail', 'host', 'port', 'user', 'pass') as $key) { $_key = 'moblog_pop_' . $key; if (!empty($this->root->{$_key})) { ${$key} = $this->root->{$_key}; } } if (!$host || !$user || !$pass || !$port) { $this->plugin_moblog_output(); } $ref_option = (string) $this->config['ref']; $maxbyte = (int) $this->config['maxbyte']; $body_limit = (int) $this->config['body_limit']; $refresh_min = (int) $this->config['refresh_min']; $nosubject = (string) $this->config['nosubject']; $deny = (array) $this->config['deny']; $deny_mailer = (string) $this->config['deny_mailer']; $deny_title = (string) $this->config['deny_title']; $deny_lang = (string) $this->config['deny_lang']; $subtype = (string) $this->config['subtype']; $viri = (string) $this->config['viri']; $del_ereg = (string) $this->config['del_ereg']; $word = (array) $this->config['word']; $imgonly = (int) $this->config['imgonly']; $chk_file = $this->cont['CACHE_DIR'] . "moblog.chk"; if (!is_file($chk_file)) { touch($chk_file); } else { if ($refresh_min * 60 > $this->cont['UTC'] - filemtime($chk_file) && empty($this->root->vars['now'])) { $this->plugin_moblog_output(); } else { $this->func->pkwk_touch_file($chk_file); } } if ($this->config['check_interval']) { $interval = max($this->config['check_interval'], $this->config['refresh_min']); $data = array('action' => 'plugin_func', 'plugin' => 'moblog', 'func' => 'plugin_moblog_action'); $this->func->regist_jobstack($data, 0, $interval * 60); } $this->chk_fp = fopen($chk_file, 'wb'); if (!flock($this->chk_fp, LOCK_EX)) { $this->plugin_moblog_output(); } // user_pref 読み込み $adr2page = (array) $this->config['adr2page']; $user_pref_all = $this->func->get_user_pref(); if ($user_pref_all) { foreach ($user_pref_all as $_uid => $_dat) { $_dat = unserialize($_dat); if (!empty($_dat['moblog_base_page'])) { if (!empty($_dat['moblog_mail_address'])) { $adr2page[strtolower($_dat['moblog_mail_address'])] = array($_dat['moblog_base_page'], $_uid); } else { if (!empty($_dat['moblog_user_mail'])) { $adr2page[strtolower($_dat['moblog_user_mail'])] = array($_dat['moblog_base_page'], $_uid); } } } } } // SMS(MMS) 経由のデーター読み込み if ($smsdata = $this->func->cache_get_db(null, 'moblog')) { foreach ($smsdata as $_data) { $_data = unserialize($_data); $adr2page = array_merge($adr2page, $_data); } } // attach プラグイン読み込み $attach = $this->func->get_plugin_instance('attach'); // wait 指定 $wait = empty($this->root->vars['wait']) ? 0 : (int) $this->root->vars['wait']; sleep(min(5, $wait)); // 接続開始 $err = ""; $num = $size = $errno = 0; $this->sock = fsockopen($host, $port, $err, $errno, 10) or $this->plugin_moblog_error_output('Could not connect to ' . $host . ':' . $port); $buf = fgets($this->sock, 512); if (substr($buf, 0, 3) != '+OK') { $this->plugin_moblog_error_output($buf); } $buf = $this->plugin_moblog_sendcmd("USER {$user}"); if (substr($buf, 0, 3) != '+OK') { $this->plugin_moblog_error_output($buf); } $buf = $this->plugin_moblog_sendcmd("PASS {$pass}"); if (substr($buf, 0, 3) != '+OK') { $this->plugin_moblog_error_output($buf); } $data = $this->plugin_moblog_sendcmd("STAT"); //STAT -件数とサイズ取得 +OK 8 1234 sscanf($data, '+OK %d %d', $num, $size); if ($num == "0") { $buf = $this->plugin_moblog_sendcmd("QUIT"); //バイバイ fclose($this->sock); $this->debug[] = 'No mail.'; $this->plugin_moblog_output(); } $this->debug[] = $num . ' message(s) found.'; $tmpfiles = array(); // 件数分 for ($i = 1; $i <= $num; $i++) { $line = $this->plugin_moblog_sendcmd("RETR {$i}"); //RETR n -n番目のメッセージ取得(ヘッダ含 $dat = ''; while (!preg_match("/^\\.\r\n/", $line) && $line !== false) { //EOFの.まで読む $line = fgets($this->sock, 4096); $dat .= $line; } $data = $this->plugin_moblog_sendcmd("DELE {$i}"); //DELE n n番目のメッセージ削除 $tmpfname = tempnam($this->cont['CACHE_DIR'], 'moblog'); file_put_contents($tmpfname, $dat); $tmpfiles[] = $tmpfname; } $buf = $this->plugin_moblog_sendcmd("QUIT"); //バイバイ fclose($this->sock); foreach ($tmpfiles as $tmpfname) { if ($execution_time) { @set_time_limit($execution_time); } $write = true; $subject = $from = $text = $atta = $part = $filename = $charset = ''; $this->user_pref = array(); $this->post_options = array(); $this->is_newpage = 0; $filenames = array(); $body_text = array(); $rotate = 0; $page = ''; $exifgeo = array(); $attach_only = false; $this->root->vars['refid'] = ''; unset($this->root->rtf['esummary'], $this->root->rtf['twitter_update']); $dat = file_get_contents($tmpfname); unlink($tmpfname); list($head, $body) = $this->plugin_moblog_mime_split($dat); // To:ヘッダ確認 $treg = array(); $to_ok = FALSE; if (preg_match("/^To:[ \t]*([^\r\n]+)/im", $head, $treg)) { $treg[1] = $this->plugin_moblog_addr_search($treg[1]); $mail_reg = preg_quote($mail, '/'); $mail_reg = '/' . str_replace('\\*', '[^@]*?', $mail_reg) . '/i'; //if ($mail === $treg[1]) { if (preg_match($mail_reg, $treg[1])) { $to = $treg[1]; $to_ok = TRUE; } else { if (preg_match("/^X-Forwarded-To:[ \t]*([^\r\n]+)/im", $head, $treg)) { //if ($mail === $treg[1]) { $treg[1] = $this->plugin_moblog_addr_search($treg[1]); if (preg_match($mail_reg, $treg[1])) { $to = $treg[1]; $to_ok = TRUE; } } } } if (!$to_ok) { $write = false; $this->debug[] = 'Bad To: ' . $to; } $to = strtolower($to); // Received-SPF: のチェック if ($this->config['allow_spf']) { if (preg_match('/^Received-SPF:\\s*([a-z]+)/im', $head, $match)) { if (!preg_match($this->config['allow_spf'], $match[1])) { $write = false; $this->debug[] = 'Bad SPF.'; } } } // メーラーのチェック $mreg = array(); if ($write && preg_match("#^(X-Mailer|X-Mail-Agent):[ \t]*([^\r\n]+)#im", $head, $mreg)) { if ($deny_mailer) { if (preg_match($deny_mailer, $mreg[2])) { $write = false; $this->debug[] = 'Bad mailer.'; } } } // キャラクターセットのチェック if ($write && preg_match('/charset\\s*=\\s*"?([^"\\r\\n]+)/i', $head, $mreg)) { $charset = $mreg[1]; if ($deny_lang) { if (preg_match($deny_lang, $charset)) { $write = false; $this->debug[] = 'Bad charset.'; } } } // 日付の抽出 $datereg = array(); preg_match("#^Date:[ \t]*([^\r\n]+)#im", $head, $datereg); $now = strtotime($datereg[1]); if ($now == -1) { $now = $this->cont['UTC']; } // 送信者アドレスの抽出 $freg = array(); if (preg_match("#^From:[ \t]*([^\r\n]+)#im", $head, $freg)) { $from = $this->plugin_moblog_addr_search($freg[1]); } elseif (preg_match("#^Reply-To:[ \t]*([^\r\n]+)#im", $head, $freg)) { $from = $this->plugin_moblog_addr_search($freg[1]); } elseif (preg_match("#^Return-Path:[ \t]*([^\r\n]+)#im", $head, $freg)) { $from = $this->plugin_moblog_addr_search($freg[1]); } $from = strtolower($from); // サブジェクトの抽出 $subreg = array(); if (preg_match("#^Subject:[ \t]*([^\r\n]+)#im", $head, $subreg)) { if (HypCommonFunc::get_version() >= '20081215') { if (!XC_CLASS_EXISTS('MobilePictogramConverter')) { HypCommonFunc::loadClass('MobilePictogramConverter'); } $mpc =& MobilePictogramConverter::factory_common(); } else { $mpc = null; } // 改行文字削除 $subject = str_replace(array("\r", "\n"), "", $subreg[1]); $subject = $this->mime_decode($subject, $mpc, $from); // ^\*\d+ 認証キー抽出 $_reg = '/^\\*(\\d+)/i'; if (preg_match($_reg, $subject, $match)) { $this->post_options['auth_code'] = $match[1]; $subject = trim(preg_replace($_reg, '', $subject, 1)); } // ページ指定コマンド検出 $_reg = '/@&([^&]+)&/'; if (preg_match($_reg, $subject, $match)) { $page = $match[1]; $subject = trim(preg_replace($_reg, '', $subject, 1)); } // ダイレクトページ指定コマンド検出 $_reg = '/@&([^\\$]+)\\$/'; if (preg_match($_reg, $subject, $match)) { $page = $match[1]; $subject = trim(preg_replace($_reg, '', $subject, 1)); $this->post_options['directpage'] = 1; } // 回転指定コマンド検出 $_reg = '/@(r|l)\\b/i'; if (preg_match($_reg, $subject, $match)) { $rotate = strtolower($match[1]) == "r" ? 1 : 3; $subject = trim(preg_replace($_reg, '', $subject, 1)); } $_reg = '/\\b(r|l)@/i'; // compat for old type if (preg_match($_reg, $subject, $match)) { $rotate = strtolower($match[1]) == "r" ? 1 : 3; $subject = trim(preg_replace($_reg, '', $subject, 1)); } // @new 新規ページ指定コマンド検出 $_reg = '/@new\\b/i'; if (preg_match($_reg, $subject)) { $this->post_options['new'] = true; $subject = trim(preg_replace($_reg, '', $subject, 1)); } // @p\d+ 対象ページ指定(過去へxページ)コマンド検出 $_reg = '/@p(\\d+)/i'; if (preg_match($_reg, $subject, $match)) { $this->post_options['page_past'] = $match[1]; $subject = trim(preg_replace($_reg, '', $subject)); } // マップ作成コマンド検出 $_reg = '/@map\\b/i'; if (preg_match($_reg, $subject, $match)) { $this->post_options['makemap'] = true; $subject = trim(preg_replace($_reg, '', $subject)); } // タグの抽出 $_reg = '/#([^#]*)/'; if (preg_match($_reg, $subject, $match)) { $_tag = trim($match[1]); if ($_tag) { $this->post_options['tag'] = $_tag; } $subject = trim(preg_replace($_reg, '', $subject, 1)); } // 未承諾広告カット if ($write && $deny_title) { if (preg_match($deny_title, $subject)) { $write = false; $this->debug[] = 'Bad title.'; } } } $today = getdate($now); $date = sprintf("/%04d-%02d-%02d-0", $today['year'], $today['mon'], $today['mday']); // 拒否アドレス if ($write) { for ($f = 0; $f < count($deny); $f++) { if (strpos($from, $deny[$f]) !== false) { $write = false; $this->debug[] = 'Bad from addr.'; } } } // 登録対象ページを設定 if ($write) { $uid = 0; if (!empty($adr2page[$to])) { if (!$page) { $page = is_array($adr2page[$to]) ? $adr2page[$to][0] : $adr2page[$to]; } if (is_array($adr2page[$to])) { $uid = $adr2page[$to][1]; if (!empty($adr2page[$to][2])) { $attach_only = true; $this->post_options['directpage'] = 1; if (!empty($adr2page[$to][3])) { $this->root->vars['refid'] = $adr2page[$to][3]; } } } } else { if (!empty($adr2page[$from])) { if (!$page) { $page = is_array($adr2page[$from]) ? $adr2page[$from][0] : $adr2page[$from]; } if (is_array($adr2page[$from])) { $uid = $adr2page[$from][1]; } } else { if (!$page) { $page = is_array($adr2page['other']) ? $adr2page['other'][0] : $adr2page['other']; } } } $uid = intval($uid); // userinfo を設定 $this->func->set_userinfo($uid); $this->root->userinfo['ucd'] = ''; $this->root->cookie['name'] = ''; // pginfo のキャッシュをクリア $this->func->get_pginfo($page, '', TRUE); if ($page) { $page = $this->get_pagename($page, $uid, $today); } if ($page) { if (!$this->func->is_pagename($page)) { $write = false; $this->debug[] = '"' . $page . '" is not the WikiName.'; } else { if (!$attach_only) { $this->user_pref = $this->func->get_user_pref($uid); if (!empty($this->user_pref['moblog_auth_code'])) { if ($this->user_pref['moblog_auth_code'] != $this->post_options['auth_code']) { $write = false; $this->debug[] = 'User auth key dose not mutch.'; } } } } } else { $write = false; $this->debug[] = 'Allow page not found.' . $page; } } if ($write) { // マルチパートならばバウンダリに分割 if (preg_match("#^Content-type:.*multipart/#im", $head)) { $boureg = array(); preg_match('#boundary="([^"]+)"#i', $head, $boureg); $body = str_replace($boureg[1], urlencode($boureg[1]), $body); $part = split("\r\n--" . urlencode($boureg[1]) . "-?-?", $body); $boureg2 = array(); if (preg_match('#boundary="([^"]+)"#i', $body, $boureg2)) { //multipart/altanative $body = str_replace($boureg2[1], urlencode($boureg2[1]), $body); $body = preg_replace("#\r\n--" . urlencode($boureg[1]) . "-?-?\r\n#i", "", $body); $part = split("\r\n--" . urlencode($boureg2[1]) . "-?-?", $body); } } else { $part[0] = $dat; // 普通のテキストメール } foreach ($part as $multi) { if (!$write) { break; } @(list($m_head, $m_body) = $this->plugin_moblog_mime_split($multi)); if (!$m_body) { continue; } $filename = ''; $m_body = preg_replace("/\r\n\\.\r\n\$/", "", $m_body); if (!preg_match("#^Content-type:(.+)\$#im", $m_head, $match)) { continue; } $match = trim($match[1]); list($type, $charset) = array_pad(explode(';', $match), 2, ''); if ($charset) { $charset = trim($charset); if (preg_match('/^charset=(.+)$/i', $charset)) { $charset = substr($charset, 8); } else { $charset = ''; } } list($main, $sub) = explode('/', trim($type)); $sub = strtolower($sub); // 本文をデコード if (strtolower($main) === 'text') { if (!empty($body_text['plain']) && $sub === 'html') { continue; } // キャラクターセットのチェック if ($charset) { if ($deny_lang) { if (preg_match($deny_lang, $charset)) { $write = false; $this->debug[] = 'Bad charset.'; break; } } } else { $charset = 'AUTO'; } if (preg_match("#^Content-Transfer-Encoding:.*base64#im", $m_head)) { $m_body = base64_decode($m_body); } if (preg_match("#^Content-Transfer-Encoding:.*quoted-printable#im", $m_head)) { $m_body = quoted_printable_decode($m_body); } if (HypCommonFunc::get_version() >= '20081215') { if (!isset($mpc)) { if (!XC_CLASS_EXISTS('MobilePictogramConverter')) { HypCommonFunc::loadClass('MobilePictogramConverter'); } $mpc =& MobilePictogramConverter::factory_common(); } $m_body = $mpc->mail2ModKtai($m_body, $from, $charset); } $text = trim(mb_convert_encoding($m_body, $this->cont['SOURCE_ENCODING'], $charset)); // 改行文字統一 $text = str_replace(array("\r\n", "\r"), array("\n", "\n"), $text); if ($sub === 'html') { $text = str_replace("\n", '', $text); $text = preg_replace('#<br([^>]+)?>#i', "\n", $text); $text = preg_replace('#</?(?:p|tr|table|div)([^>]+)?>#i', "\n\n", $text); $text = strip_tags($text); } // 改行3連続以上を #clear に置換 $text = preg_replace("/\n{3,}/", "\n#clear\n", $text); if ($write) { // 電話番号削除 //$text = preg_replace("#([[:digit:]]{11})|([[:digit:]\-]{13})#", "", $text); // 下線削除 $text = preg_replace('#' . $del_ereg . '#', '', $text); // mac削除 $text = preg_replace("#Content-type: multipart/appledouble;[[:space:]]boundary=(.*)#", "", $text); // 広告等削除 if (is_array($word)) { foreach ($word as $delstr) { $text = str_replace($delstr, "", $text); } } if (strlen($text) > $body_limit) { $text = substr($text, 0, $body_limit) . "..."; } } // ISBN, ASIN 変換 if (!empty($this->config['isbn'])) { $isbn = $this->config['isbn']; $text = preg_replace('/^([A-Za-z0-9]{10}|\\d{13})$/me', 'str_replace(\'__ISBN__\', \'$1\', \'' . $isbn . '\')', $text); } // キーワード@amazon 変換 if (!empty($this->config['amazon'])) { $amazon = $this->config['amazon']; $text = preg_replace('/^(.+)@amazon$/mei', 'str_replace(\'__KEYWORD__\', \'$1\', \'' . $amazon . '\')', $text); } $body_text[$sub][] = trim($text); } else { // ファイル名を抽出 $filereg = array(); if (preg_match("#name=\"?([^\"\n]+)\"?#i", $m_head, $filereg)) { $filename = trim($filereg[1]); $filename = $this->mime_decode($filename); } // 添付データをデコードして保存 if (preg_match("#^Content-Transfer-Encoding:.*base64#im", $m_head) && preg_match('#' . $subtype . '#i', $sub)) { $tmp = base64_decode($m_body); //$save_file = $this->cont['CACHE_DIR'].$this->func->encode($filename).".tmp"; if (strlen($tmp) < $maxbyte && $write && $attach) { $save_file = tempnam(rtrim($this->cont['UPLOAD_DIR'], '/'), 'moblog'); chmod($save_file, 0606); if (file_put_contents($save_file, $tmp, LOCK_EX)) { //Exif geo $exifgeo = $this->getExifGeo($save_file); list($usec) = explode(' ', microtime()); if (!$filename) { $filename = $this->cont['UTC'] . '_' . $usec . '.' . $sub; } //回転指定 if ($rotate) { HypCommonFunc::rotateImage($save_file, $rotate); } // ページが無ければ空ページを作成 if (!$this->func->is_page($page)) { $this->func->make_empty_page($page, false); } //$attach = $this->func->get_plugin_instance('attach'); $pass = null; if (!$uid) { list($pass) = explode('@', $from); } $res = $attach->do_upload($page, $filename, $save_file, false, $pass, true); if ($res['result']) { $filenames[] = array('name' => $res['name'], 'exifgeo' => $exifgeo); } else { $this->debug[] = $res['msg']; } } else { $write = false; $this->debug[] = 'Can not make temp-file.'; } } else { $write = false; $this->debug[] = 'Plugin attach was not found.'; } } } } if ($imgonly && !$filenames) { $write = false; $this->debug[] = 'Attach file was not found.'; } $subject = trim($subject); } if (!empty($body_text['plain'])) { $text = join("\n\n", $body_text['plain']); } else { if (!empty($body_text['html'])) { $text = join("\n\n", $body_text['html']); } else { $text = ''; } } // wikiページ書き込み if ($write && !$attach_only) { $this->plugin_moblog_page_write($page, $subject, $text, $filenames, $ref_option, $now); } } // imgタグ呼び出し $this->plugin_moblog_output(); }
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; }
} ///////////////////////////////////////////////// // ブラウザ調整前のデフォルト値 // 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 emoji2img($str) { static $mpc = null; if (preg_match('/\\(\\([eisv]:[0-9a-f]{4}\\)\\)|\\[emj:\\d{1,4}(?::(?:im|ez|sb))?\\]/S', $str)) { if (!$mpc) { if (!XC_CLASS_EXISTS('MobilePictogramConverter')) { HypCommonFunc::loadClass('MobilePictogramConverter'); } $mpc = MobilePictogramConverter::factory_common(); $mpc->setImagePath($this->cont['ROOT_URL'] . 'images/emoji'); } $mpc->setString($str, FALSE); $mpc->userAgent = ''; $str = $mpc->autoConvertModKtai(); } return $str; }
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); }
function add_sql($table) { if ($this->status != $this->cont['TARLIB_STATUS_CREATE']) { return ''; } // File is not created if (!HypCommonFunc::loadClass('MySQLDump')) { $this->func->die_message('Class "MySQLDump" was not found.'); } $db = $this->xpwiki->db; $removePrefix = $db->prefix($this->root->mydirname . '_'); $short_name = substr($table, strlen($removePrefix)); $this->dirs[] = 'DB@' . $short_name; $name = $this->cont['CACHE_DIR'] . $short_name . '.sql'; $dumper = new MySQLDump($db->conn, $name, false, false); $dumper->removePrefix = $removePrefix; $dumper->maxFileSize = $this->limitSize; //$dumper->maxFileSize = 1048576; //1M // ToDo fix notice error of "MySQLDump" class. $_error_level = error_reporting(0); $dumper->doDump($table); error_reporting($_error_level); foreach ($dumper->sqlFiles as $name) { $this->add_file($name, false, ''); } return 1; }
function getimagesize() { $size = false; $mime = ''; if ($this->type) { $mime = $this->type; } else { $mime = $this->pluginAttach->attach_mime_content_type($this->filename, $this->status); } list($type) = explode('/', $mime); $type = strtolower($type); if ($type === 'video' || $mime === 'application/vnd.rn-realmedia') { // $extension = 'ffmpeg'; // // load extension // $extension_soname = $extension . '.' . PHP_SHLIB_SUFFIX; // $extension_fullname = PHP_EXTENSION_DIR . '/' . $extension_soname; // if(! extension_loaded($extension) && ini_get('enable_dl') && ! ini_get('safe_mode') && function_exists('dl') && is_file($extension_fullname)) { // dl($extension_soname); // } // if (extension_loaded($extension)) { // $movie = new ffmpeg_movie($this->filename); // $duration = $movie->getDuration(); // $framerate = $movie->getFrameRate(); // $h = $movie->getFrameHeight(); // $w = $movie->getFrameWidth(); // $movie = null; // unset($movie); // $size = array(); // $size[0] = intval($w); // $size[1] = intval($h); // $size[2] = 0; // $size[3] = 'width="'.$size[0].'" height="'.$size[1].'"'; // $size['bits'] = null; // $size['channels'] = null; // $size['mime'] = $mime; // $size['duration'] = $duration; // $size['framerate'] = $framerate; // } else if (HypCommonFunc::loadClass('getID3')) { if (HypCommonFunc::loadClass('getID3')) { $getID3 = new getID3(); $info = $getID3->analyze($this->filename); if ($info && !empty($info['video'])) { $size = array(); $size[0] = intval($info['video']['resolution_x']); $size[1] = intval($info['video']['resolution_y']); $size[2] = 0; $size[3] = 'width="' . $size[0] . '" height="' . $size[1] . '"'; $size['bits'] = null; $size['channels'] = null; $size['mime'] = $mime; $size['duration'] = $info['playtime_seconds']; $size['framerate'] = $info['video']['frame_rate']; } $getID3 = null; unset($getID3); } } else { if ($type === 'image' || $mime === 'application/x-shockwave-flash') { $size = @getimagesize($this->filename); if (!$size) { $size = array(); $width = $height = 0; if (substr($mime, 6, 3) === 'svg') { $src = $this->func->file_get_contents($this->filename, false, null, 0, 4096); if (preg_match('#<svg([^>]+)>#i', $src, $match)) { if (preg_match('#width="([\\d.]+)(?:px)?"#i', $match[1], $dig)) { $width = $dig[1]; } if (preg_match('#height="([\\d.]+)(?:px)?"#i', $match[1], $dig)) { $height = $dig[1]; } } } $size[0] = $width; $size[1] = $height; $size[2] = 0; $size[3] = ''; $size['bits'] = null; $size['channels'] = null; $size['mime'] = $mime; } } } return $size; }