function plugin_read_action() { global $vars, $_read_msg; $page = isset($vars['page']) ? Utility::stripBracket($vars['page']) : null; $ret = array('msg' => null, 'body' => null); $id = isset($vars['id']) ? $vars['id'] : null; if (!$page) { return $ret; } // 読み込むことができるページか $wiki = Factory::Wiki($page); if ($wiki->isReadable(true)) { return array('msg' => Utility::htmlsc($page), 'body' => $wiki->render($id)); //return $ret; } global $referer; $referer = 0; // InterWikiNameに含まれるページか? // ?adv:FrontPageみたいな感じでアクセス if (preg_match('/^' . RendererDefines::INTERWIKINAME_PATTERN . '$/', $page, $match)) { $url = InterWikiName::getInterWikiUrl($match[2], $match[3]); if ($url == false) { return array('msg' => $_read_msg['title_invalied'], 'body' => sprintf($_read_msg['msg_ibvaliediw'], $match[2])); } Utility::redirect($url); return; } // AutoAliasに含まれるページか? $realpage = AutoAlias::getAutoAlias($page); if (count($realpage) === 1) { // AutoAliasの指定先のページを指定 $a_wiki = Factory::Wiki($realpage); if ($a_wiki->isValied()) { Utility::redirect($a_wiki->link()); return; } else { if (Utility::isUri($realpage)) { Utility::redirect($realpage); return; } } } else { if (count($realpage) >= 2) { $body = '<p>'; $body .= $_read_msg['msg_invalidwn'] . '<br />'; foreach ($realpage as $entry) { $link[] = '[[' . $entry . '>' . $entry . ']]&br;'; } $body .= InlineFactory::Wiki(join("\n", $link)); $body .= '</p>'; return array('msg' => $_read_msg['title_invalied'], 'body' => $body); } } Utility::notfound(); exit; }
public function __toString() { $term = Utility::stripBracket($this->name); $wiki = Factory::Wiki($term); $glossary = self::getGlossary($term, true); if (!$wiki->has()) { return '<abbr class="glossary" title="' . $glossary . '">' . $this->name . '</abbr>'; } return '<abbr class="glossary" title="' . $glossary . '"><a href="' . $wiki->uri() . '">' . $this->name . '</a></abbr>'; }
function plugin_unfreeze_action() { global $vars, $function_freeze, $_unfreeze_msg; $page = isset($vars['page']) ? $vars['page'] : ''; $wiki = Factory::Wiki($page); if (!$function_freeze || !$wiki->isEditable(false, true) || !$wiki->isValied($page)) { return array('msg' => $_unfreeze_msg['title_disabled'], 'body' => '<p class="alert alert-danger">You have no permission to unfreeze this page.</p>'); } $pass = isset($vars['pass']) ? $vars['pass'] : NULL; $msg = ''; $body = array(); if (!$wiki->isFreezed()) { // Unfreezed already $msg = str_replace('$1', Utility::htmlsc(Utility::stripBracket($page)), $_unfreeze_msg['title_isunfreezed']); $body[] = '<p class="alert alert-info">' . $msg . '</p>'; } else { if (!Auth::check_role('role_contents_admin') || $pass !== NULL && Auth::login($pass)) { // BugTrack2/255 $wiki->checkReadable(); // Unfreeze $postdata = $wiki->get(); array_shift($postdata); $wiki->set($postdata); // Update if (PLUGIN_UNFREEZE_EDIT) { // BugTrack2/255 $wiki->checkEditable(true); // $vars['cmd'] = 'read'; // To show 'Freeze' link $vars['cmd'] = 'edit'; } else { $vars['cmd'] = 'read'; } $msg = str_replace('$1', Utility::htmlsc(Utility::stripBracket($page)), $_unfreeze_msg['title_unfreezed']); $body[] = !IS_AJAX ? '' : '<p class="alert alert-success">' . $msg . '</p>'; $body[] = '<div class="pull-right"><a href="' . $wiki->uri() . '" class="btn btn-primary">OK</a></div>'; Utility::redirect($wiki->uri()); exit; } else { // Show unfreeze form $msg = $_unfreeze_msg['title_unfreeze']; $body[] = $pass === NULL ? '' : '<p class="alert alert-danger">' . $_unfreeze_msg['msg_invalidpass'] . '</p>' . "\n"; $body[] = '<fieldset>'; $body[] = '<legend>' . $_unfreeze_msg['msg_unfreezing'] . '</legend>'; $body[] = '<form action="' . Router::get_script_uri() . '" method="post" class="form-inline plugin-freeze-form">'; $body[] = '<input type="hidden" name="cmd" value="unfreeze" />'; $body[] = '<input type="hidden" name="page" value="' . Utility::htmlsc($page) . '" />'; $body[] = '<input type="password" name="pass" size="12" class="form-control" />'; $body[] = '<button type="submit" class="btn btn-primary" name="ok"><span class="fa fa-lock"></span>' . $_unfreeze_msg['btn_unfreeze'] . '</button>'; $body[] = '</form>'; $body[] = '</fieldset>'; } } return array('msg' => $msg, 'body' => join("\n", $body)); }
function plugin_freeze_action() { global $vars, $function_freeze, $_freeze_msg; $page = isset($vars['page']) ? $vars['page'] : null; if (is_null($page)) { return array('msg' => 'Not Found', 'body' => 'Page not found'); } $wiki = Factory::Wiki($page); if (!$function_freeze || !$wiki->isEditable(true) || !$wiki->has()) { return array('msg' => $_freeze_msg['title_disabled'], 'body' => '<p class="alert alert-danger">You have no permission to freeze this page.</p>'); } $pass = isset($vars['pass']) ? $vars['pass'] : NULL; $msg = ''; $body = array(); if ($wiki->isFreezed()) { // Freezed already $msg = str_replace('$1', Utility::htmlsc(Utility::stripBracket($page)), $_freeze_msg['title_isfreezed']); $body[] = '<p class="alert alert-info">' . $msg . '</p>'; } else { if (!Auth::check_role('role_contents_admin') || $pass !== NULL && Auth::login($pass)) { // Freeze $postdata = $wiki->get(); array_unshift($postdata, "#freeze"); //凍結をページに付加 $wiki->set($postdata, true); // Update //$wiki->is_freezed(); $vars['cmd'] = 'read'; $msg = str_replace('$1', Utility::htmlsc(Utility::stripBracket($page)), $_freeze_msg['title_freezed']); $body[] = !IS_AJAX ? '' : '<p class="alert alert-success">' . $msg . '</p><div class="pull-right"><a href="' . $wiki->uri() . '" class="btn btn-primary">OK</a></div>'; } else { // Show a freeze form $msg = $_freeze_msg['title_freeze']; $body[] = $pass === NULL ? '' : '<p class="alert alert-warning">' . $_freeze_msg['msg_invalidpass'] . '</p>'; $body[] = '<fieldset>'; $body[] = '<legend>' . $_freeze_msg['msg_freezing'] . '</legend>'; $body[] = '<form action="' . Router::get_script_uri() . '" method="post" class="form-inline plugin-freeze-form">'; $body[] = '<input type="hidden" name="cmd" value="freeze" />'; $body[] = '<input type="hidden" name="page" value="' . Utility::htmlsc($page) . '" />'; $body[] = '<input type="password" name="pass" size="12" class="form-control" />'; $body[] = '<button type="submit" class="btn btn-primary" name="ok"><span class="fa fa-lock"></span>' . $_freeze_msg['btn_freeze'] . '</button>'; $body[] = '</form>'; $body[] = '</fieldset>'; } } return array('msg' => $msg, 'body' => join("\n", $body)); }
function plugin_tooltip_inline($args) { $args = func_get_args(); $glossary = array_pop($args); $term = array_shift($args); if (empty($glossary)) { $glossary = Glossary::getGlossary($term); // $debug .= "B=$glossary/"; if ($glossary === FALSE) { $glossary = plugin_tooltip_get_page_title($term); if ($glossary === FALSE) { $glossary = ''; } } } $s_glossary = Utility::htmlsc($glossary); $page = Utility::stripBracket($term); $wiki = Factory::Wiki($page); if ($wiki->isValied() && $wiki->isReadable()) { return '<abbr class="glossary" title="' . $s_glossary . ' ' . $wiki->passage(false, false) . '"><a href="' . $wiki->uri() . '">' . $term . '</a></abbr>'; } return '<abbr title="' . $s_glossary . '">' . $term . '</abbr>'; }
function strip_bracket($str) { return Utility::stripBracket($str); }
/** * 権限をチェック * @param string $page ページ名 * @param string $type チェックする権限(AUTH_TYPE_READ or AUTH_TYPE_EDIT) * @param boolean $authenticate 認証画面を出すか? * @param string $username ユーザ名(認証状態のユーザ名が優先される) * @param string $groupname グループ名(認証状態のユーザのグループが優先される) * @return boolean */ public static function auth($page, $type = self::AUTH_TYPE_READ, $authenticate = false, $username = '', $groupname = '') { global $_title; global $auth_method_type, $read_auth_pages, $edit_auth_pages, $read_auth_pages_accept_ip, $edit_auth_pages_accept_ip; // マッチさせる文字列 $target_str = ''; // 認証の判定条件 switch ($auth_method_type) { case self::AUTH_METHOD_PAGENAME: // ページ名で判断 $target_str = $page; break; case self::AUTH_METHOD_CONTENTS: // ページのソースで判断 $target_str = Factory::Wiki($page)->get(true); break; default: throw new Exception('Auth::auth() : $auth_method_type = ' . $auth_method_type . ' is invalied or unmounted!.'); break; } // 認証のタイプによってメッセージを分ける switch ($type) { case self::AUTH_TYPE_READ: // IPをチェック if (self::checkAcceptIp($read_auth_pages_accept_ip, $target_str)) { return true; } $auth_pages = $read_auth_pages; $title_cannot = $_title['cannotread']; break; case self::AUTH_TYPE_EDIT: if (self::checkAcceptIp($edit_auth_pages_accept_ip, $target_str)) { return true; } $auth_pages = $edit_auth_pages; $title_cannot = $_title['cannotedit']; break; default: throw new Exception('Auth::auth() : $type = ' . $type . ' is invalied!.'); break; } $user_list = $group_list = $role = $matched = ''; // ページから認証条件を読む // $auth_pages = array( // 'ページ名の正規表現' => array( // 'user' => array(ユーザ名のリスト), // 'group' => array(グループのリスト), // 'role' => array(役割のリスト) // ), // ... // ); foreach ($auth_pages as $pattern => $val) { if ($matched = preg_match($pattern, $target_str)) { // 認証条件に対象文字列がヒットした if (is_array($val)) { $user_list = empty($val['user']) ? null : explode(',', $val['user']); $group_list = empty($val['group']) ? null : explode(',', $val['group']); $role = empty($val['role']) ? null : $val['role']; } else { $user_list = empty($val) ? null : explode(',', $val); } break; } } // 制限対象のページでない場合ここで終了 if (empty($user_list) && empty($group_list) && empty($role)) { return true; } // マッチしない場合は対象外 if ($matched === 0) { return true; } if ($authenticate) { $ret = self::authenticate(); if (!$ret === true) { // 認証失敗 Utility::dieMessage(str_replace('$1', Utility::htmlsc(Utility::stripBracket($page)), $title_cannot), 'Not Auth', Response::STATUS_CODE_401); exit; } } // ユーザの情報を取得 $info = self::get_user_info(); if (empty($username)) { // ユーザ名などが入力されていない場合、ユーザ情報からパラメーターを取得する $username = $info['key']; } if (empty($groupname)) { $groupname = $info['group']; } // 未認証者 if (empty($username)) { return false; } // ユーザ名検査 if (!empty($user_list) && in_array($username, $user_list)) { return true; } // グループ検査 if (!empty($group_list) && !empty($groupname) && in_array($groupname, $group_list)) { return true; } // role 検査 if (!empty($role) && !self::is_check_role($role)) { return true; } // そうでない場合はナシ return false; }
function plugin_bugtrack_list_pageinfo($page, $no = NULL, $recurse = TRUE) { global $_plugin_bugtrack; if ($no === NULL) { $no = preg_match('/\\/([0-9]+)$/', $page, $matches) ? $matches[1] : 0; } $source = Factory::Wiki($page)->get(); // Check 'moved' page _just once_ $regex = '/move\\s*to\\s*(' . RendererDefines::WIKINAME_PATTERN . '|' . RendererDefines::INTERWIKINAME_PATTERN . '|\\[\\[' . RendererDefines::BRACKETNAME_PATTERN . '\\]\\])/'; $match = array(); if ($recurse && preg_match($regex, $source[0], $match)) { return plugin_bugtrack_list_pageinfo(Utility::stripBracket($match[1]), $no, FALSE); } $body = join("\n", $source); foreach (array('summary', 'name', 'priority', 'state', 'category') as $item) { $regex = '/-\\s*' . preg_quote($_plugin_bugtrack[$item], '/') . '\\s*:(.*)/'; if (preg_match($regex, $body, $matches)) { if ($item == 'name') { ${$item} = Utility::stripBracket(trim($matches[1])); } else { ${$item} = trim($matches[1]); } } else { ${$item} = ''; // Data not found } } if (preg_match("/\\*([^\n]*)/", $body, $matches)) { $summary = Rules::removeHeading($matches[0]); } return array($page, $no, $summary, $name, $priority, $state, $category); }
function plugin_ref_body($args) { global $vars; $page = isset($vars['page']) ? $vars['page'] : ''; $params = array('left' => FALSE, 'center' => FALSE, 'right' => FALSE, 'justify' => FALSE, 'around' => FALSE, 'noicon' => FALSE, 'noimg' => FALSE, 'nolink' => FALSE, 'zoom' => FALSE, 'rounded' => FALSE, 'circle' => FALSE, 'thumbnail' => FALSE, 'novideo' => FALSE, 'noaudio' => FALSE, 'autoplay' => FALSE, '_align' => PLUGIN_REF_DEFAULT_ALIGN, '_size' => True, '_w' => 0, '_h' => 0, '_%' => 0, '_title' => null, '_body' => null, '_error' => null, '_class' => ''); // [Page_name/maybe-separated-with/slashes/]AttachedFileName.sfx or URI $name = array_shift($args); // ファイル名 // 第一引数が InterWiki か if (Utility::isInterWiki($name)) { preg_match('/^' . RendererDefines::INTERWIKINAME_PATTERN . '$/', $name, $intermatch); $intername = $intermatch[2]; $interparam = $intermatch[3]; $interurl = InterWikiName::getInterWikiUrl($intername, $interparam); if ($interurl !== FALSE) { $name = $interurl; } } $is_url = Utility::isUri($name); // アドレスか? // 画像 $seems_image = !$params['noimg'] && preg_match(RendererDefines::IMAGE_EXTENTION_PATTERN, $name); // ビデオ $seems_video = !$params['novideo'] && preg_match(RendererDefines::VIDEO_EXTENTION_PATTERN, $name); // 音声 $seems_audio = !$params['noaudio'] && preg_match(RendererDefines::AUDIO_EXTENTION_PATTERN, $name); $file = ''; // Path to the attached file $is_file = FALSE; if (!$is_url) { if (!is_dir(UPLOAD_DIR)) { $params['_error'] = 'UPLOAD_DIR is not found.'; return $params; } // ページ名が空の時は処理しない if (empty($page)) { return ''; } $matches = array(); if (preg_match('#^(.+)/([^/]+)$#', $name, $matches)) { // Page_name/maybe-separated-with/slashes and AttachedFileName.sfx // #ref(ページ名/ファイル名) 新形式の表記 if ($matches[1] === '.' || $matches[1] === '..') { // 相対パスでの指定 $matches[1] .= '/'; // Restore relative paths } // ファイル名を取得 $name = $matches[2]; // AttachedFileName.sfx $page = Utility::getPageName($matches[1], $page); // strip is a compat } else { if (isset($args[0]) && !empty($args[0]) && !isset($params[$args[0]])) { // Is the second argument a page-name or a path-name? (compat) // #ref(ファイル名,ページ名) 古い形式の表記 $_page = array_shift($args); // 引用元のページ名 // Looks like WikiName, or double-bracket-inserted pagename? (compat) $is_bracket_bracket = preg_match('/^(' . RendererDefines::WIKINAME_PATTERN . '|\\[\\[' . RendererDefines::BRACKETNAME_PATTERN . '\\]\\])$/', $_page); $page = Utility::getPageName(Utility::stripBracket($_page), $page); // strip is a compat $a = new Attach($_page, $name); if (!$is_bracket_bracket || !$a->has()) { // Promote new design if ($is_file && is_file(UPLOAD_DIR . encode($page) . '_' . encode($name))) { // Because of race condition NOW $params['_error'] = 'The same file name "' . $name . '" at both page: "' . $page . '" and "' . $_page . '". Try ref(pagename/filename) to specify one of them'; } else { // Because of possibility of race condition, in the future $params['_error'] = 'The style &ref(filename,pagename) is ambiguous ' . 'and become obsolete. ' . 'Please try ref(pagename/filename)'; } return $params; } $page = $_page; // Suppose it } } // Attachオブジェクトを生成 $a = new Attach($page, $name); if (!$a->has()) { $params['_error'] = 'File not found: "' . Utility::htmlsc($name) . '" at page "' . Utility::htmlsc($page) . '"'; return $params; } } // 残りの引数の処理 if (!empty($args)) { $keys = array_keys($params); $params['_done'] = false; foreach ($args as $val) { list($_key, $_val) = array_pad(explode(':', $val, 2), 2, TRUE); $_key = trim(strtolower($_key)); if (is_string($_val)) { $_val = trim($_val); } if (in_array($_key, $keys) && $params['_done'] !== TRUE) { $params[$_key] = $_val; // Exist keys } elseif ($val != '') { $params['_args'][] = $val; // Not exist keys, in '_args' } } } $width = $height = 0; $url = $url2 = ''; if ($is_url) { // 外部リンクの場合 $url = $name; $url2 = $name; if (PKWK_DISABLE_INLINE_IMAGE_FROM_URI) { //$params['_error'] = 'PKWK_DISABLE_INLINE_IMAGE_FROM_URI prohibits this'; //return $params; $params['_body'] = '<a href="' . $url . '" rel="external">' . $s_url . '</a>'; return $params; } $matches = array(); $params['_title'] = preg_match('#([^/]+)$#', $url, $matches) ? $matches[1] : $url; } else { // Wikiの添付ファイルの場合 // Count downloads with attach plugin $url = Router::get_cmd_uri('attach', null, null, array('refer' => $page, 'openfile' => $name)); $url2 = ''; $params['_title'] = $name; if ($seems_image || $seems_video || $seems_audio) { // URI for in-line image output $url2 = $url; // With ref plugin (faster than attach) $url = Router::get_cmd_uri('ref', $page, null, array('src' => $name)); if ($seems_image) { // 画像の場合は、getimagesizeでサイズを読み取る $size = getimagesize($a->basename); if (is_array($size)) { $params['_w'] = $size[0]; $params['_h'] = $size[1]; } } } } // 拡張パラメータをチェック if (!empty($params['_args'])) { $_title = array(); foreach ($params['_args'] as $arg) { if (preg_match('/^([0-9]+)x([0-9]+)$/', $arg, $matches)) { $params['_size'] = TRUE; $params['_w'] = $matches[1]; $params['_h'] = $matches[2]; } else { if (preg_match('/^([0-9.]+)%$/', $arg, $matches) && $matches[1] > 0) { $params['_%'] = $matches[1]; } else { $_title[] = $arg; } } } } foreach (array('right', 'left', 'center', 'justify') as $align) { if (isset($params[$align])) { $params['_align'] = $align; unset($params[$align]); break; } } $s_title = isset($params['_title']) ? Inline::setLineRules(Utility::htmlsc($params['_title'])) : ''; $s_info = ''; if ($seems_image || $seems_video) { // 指定されたサイズを使用する $info = ''; if ($width === 0 && $height === 0) { $width = $params['_w']; $height = $params['_h']; } if ($params['_size']) { if ($params['zoom']) { $_w = $params['_w'] ? $width / $params['_w'] : 0; $_h = $params['_h'] ? $height / $params['_h'] : 0; $zoom = max($_w, $_h); if ($zoom) { $width = (int) ($width / $zoom); $height = (int) ($height / $zoom); } } else { $width = $params['_w'] ? $params['_w'] : $width; $height = $params['_h'] ? $params['_h'] : $height; } } if ($params['_%']) { $width = (int) ($width * $params['_%'] / 100); $height = (int) ($height * $params['_%'] / 100); } $info = $width && $height ? 'width="' . $width . '" height="' . $height . '" ' : ''; if ($seems_image) { $body = '<img src="' . $url . '" ' . 'alt="' . $s_title . '" ' . 'title="' . $s_title . '" ' . 'class="' . $params['_class'] . '" ' . $info . '/>'; } else { if ($seems_video) { $body = '<video src="' . $url . '" ' . 'alt="' . $s_title . '" ' . 'title="' . $s_title . '" ' . 'class="' . $params['_class'] . '" ' . $s_info . ' controls="controls" preload="auto">'; } } if (!isset($params['nolink']) && $url2) { $params['_body'] = '<a href="' . $url2 . '" title="' . $s_title . '"' . (IS_MOBILE ? ' data-ajax="false"' : '') . '>' . "\n" . $body . "\n" . '</a>'; } else { $params['_body'] = $body; } } else { if ($seems_audio) { // 音声 $body = '<audio src="' . $url . '" ' . 'alt="' . $s_title . '" ' . 'title="' . $s_title . '" ' . 'class="' . $params['_class'] . '" controls="controls" preload="auto" />'; if (!isset($params['nolink']) && $url2) { $params['_body'] = '<a href="' . $url2 . '" title="' . $s_title . '"' . (IS_MOBILE ? ' data-ajax="false"' : '') . '>' . "\n" . (isset($params['noicon']) ? '' : '<span class="fa fa-music"></span>') . $body . "\n" . '</a>'; } else { $params['_body'] = $body; } } else { // リンクを貼り付ける if (!$is_url && $is_file) { $s_info = Utility::htmlsc(get_date('Y/m/d H:i:s', filemtime($file)) . ' ' . sprintf('%01.1f', round(filesize($file) / 1024, 1)) . 'KB'); } $params['_body'] = '<a href="' . $url . '" title="' . $s_info . '"' . (IS_MOBILE ? ' data-ajax="false"' : '') . '>' . (isset($params['noicon']) ? '' : '<span class="fa fa-paperclip"></span>') . $s_title . '</a>'; } } return $params; }
function plugin_pcomment_convert() { global $vars; // global $_pcmt_messages; $_pcmt_messages = array('msg_name' => T_('Name: '), 'btn_comment' => T_('Post Comment'), 'msg_comment' => T_('Comment: '), 'msg_recent' => T_('Show recent %d comments.'), 'msg_all' => T_('Go to the comment page.'), 'msg_none' => T_('No comment.'), 'err_pagename' => T_('[[%s]] : not a valid page name.')); $params = array('noname' => FALSE, 'nodate' => FALSE, 'below' => FALSE, 'above' => FALSE, 'reply' => FALSE, '_args' => array()); $params = PluginRenderer::getPluginOption(func_get_args(), $params); // var_dump($params); $vars_page = isset($vars['page']) ? $vars['page'] : ''; $page = isset($params['_args'][1]) && !empty($params['_args'][1]) ? $params['_args'][0] : Utility::stripBracket(sprintf(PLUGIN_PCOMMENT_PAGE, $vars_page)); $count = isset($params['_args'][0]) ? intval($params['_args'][0]) : 0; if ($count == 0) { $count = PLUGIN_PCOMMENT_NUM_COMMENTS; } $_page = get_fullname(strip_bracket($page), $vars_page); $wiki = Factory::Wiki($_page); if (!$wiki->isValied()) { return sprintf($_pcmt_messages['err_pagename'], Utility::htmlsc($_page)); } $dir = PLUGIN_COMMENT_DIRECTION_DEFAULT; if ($params['below']) { $dir = 0; } elseif ($params['above']) { $dir = 1; } list($comments, $digest) = plugin_pcomment_get_comments($_page, $count, $dir, $params['reply']); $form = array(); // if (PKWK_READONLY) { if (!Auth::check_role('readonly') && isset($vars['page'])) { // Show a form $form[] = '<input type="hidden" name="cmd" value="pcomment" />'; $form[] = '<input type="hidden" name="digest" value="' . $digest . '" />'; $form[] = '<input type="hidden" name="refer" value="' . Utility::htmlsc($vars_page) . '" />'; $form[] = '<input type="hidden" name="page" value="' . Utility::htmlsc($page) . '" />'; $form[] = '<input type="hidden" name="nodate" value="' . Utility::htmlsc($params['nodate']) . '" />'; $form[] = '<input type="hidden" name="dir" value="' . $dir . '" />'; $form[] = '<input type="hidden" name="count" value="' . $count . '" />'; $form[] = '<div class="row">'; if ($params['noname'] === false) { $form[] = '<div class="col-md-3">'; list($nick, $link, $disabled) = plugin_pcomment_get_nick(); if ($params['reply']) { $form[] = '<div class="input-group">'; $form[] = '<span class="input-group-addon">'; $form[] = '<input type="radio" name="reply" value="0" tabindex="0" checked="checked" />'; $form[] = '</span>'; } $form[] = '<input type="text" name="name" value="' . $nick . '" ' . $disabled . ' class="form-control" size="' . PLUGIN_COMMENT_SIZE_NAME . '" placeholder="' . $_pcmt_messages['msg_name'] . '" />'; if ($params['reply']) { $form[] = '</div>'; } $form[] = '</div>'; $form[] = '<div class="col-md-9">'; $form[] = '<div class="input-group">'; } else { $form[] = '<div class="col-md-12">'; $form[] = '<div class="input-group">'; if ($params['reply']) { $form[] = '<span class="input-group-addon">'; $form[] = '<input type="radio" name="reply" value="0" tabindex="0" checked="checked" />'; $form[] = '</span>'; } } $form[] = '<textarea name="msg" cols="' . PLUGIN_COMMENT_SIZE_MSG . '" rows="1" class="form-control" placeholder="' . $_pcmt_messages['msg_comment'] . '"></textarea>'; $form[] = '<span class="input-group-btn">'; $form[] = '<button type="submit" class="btn btn-info">' . $_pcmt_messages['btn_comment'] . '</button>'; $form[] = '</span>'; $form[] = '</div>'; $form[] = '</div>'; $form[] = '</div>'; } if (PKWK_READONLY == Auth::ROLE_AUTH) { exist_plugin('login'); $form[] = do_plugin_inline('login'); } if (!$wiki->has()) { $link = make_pagelink($_page); $recent = $_pcmt_messages['msg_none']; } else { $msg = !empty($_pcmt_messages['msg_all']) ? $_pcmt_messages['msg_all'] : $_page; $link = make_pagelink($_page, $msg); $recent = !empty($count) ? sprintf($_pcmt_messages['msg_recent'], $count) : ''; } $string = !Auth::check_role('readonly') ? '<form action="' . get_script_uri() . '" method="post" class="plugin-pcomment-form form-inline" data-collision-check="false">' : ''; $string .= $dir ? '<p>' . $recent . ' ' . $link . '</p>' . "\n" . $comments . "\n" . join("\n", $form) : join("\n", $form) . "\n" . '<p>' . $recent . ' ' . $link . '</p>' . "\n" . $comments . "\n"; $string .= !Auth::check_role('readonly') ? '</form>' : ''; return IS_MOBILE ? '<div data-role="collapsible" data-theme="b" data-content-theme="d"><h4>' . $_pcmt_messages['msg_comment'] . '</h4>' . $string . '</div>' : '<div class="pcomment">' . $string . '</div>'; }
function plugin_calendar_action() { global $vars; global $_calendar_msg, $_labels; $vars['page'] = isset($vars['file']) ? $vars['file'] : '*'; $page = Utility::stripBracket($vars['page']); $date = $vars['date'] ? $vars['date'] : get_date('Ym'); $mode = $vars['mode'] ? $vars['mode'] : 'view'; $year = substr($date, 0, 4); $month = preg_replace('/^0/', '', substr($date, 4, 2)); $aryargs = array($vars['page'], $date); // $s_page = '<a href="'.get_page_uri($vars['page']).'">'.Utility::htmlsc($vars['page']).'</a>'; $s_page = Utility::htmlsc($vars['page']); $vars['page'] = $page; return array('msg' => sprintf($_calendar_msg['_page_title'], $s_page, $_labels['month'][$month][1], $year), 'body' => call_user_func_array('plugin_calendar_convert', $aryargs)); }
// Location で飛ぶようなプラグインの対応のため // 上のアクションプラグインの実行後に処理を実施 PluginRenderer::executePluginBlock('protect'); die('<var>PLUS_PROTECT_MODE</var> is set.'); } /////////////////////////////////////// // Page output $auth_key = Auth::get_user_info(); $base = $defaultpage; if (!empty($auth_key['home']) && isset($vars['page']) && ($vars['page'] == $defaultpage || $vars['page'] == $auth_key['home'])) { // ログイン時のホームページを基準とする(実際はあまり使われてないが) $base = $defaultpage = $auth_key['home']; } else { $base = isset($vars['page']) ? $vars['page'] : $defaultpage; } $s_base = Utility::htmlsc(Utility::stripBracket($base)); if (isset($retvars['msg']) && !empty($retvars['msg'])) { $title = str_replace('$1', $s_base, $retvars['msg']); $page = str_replace('$1', Factory::Wiki($base)->link('related'), $retvars['msg']); } else { $title = $s_base; $page = Factory::Wiki($base)->link('related'); } $http_code = isset($retvars['http_code']) ? $retvars['http_code'] : 200; if (isset($retvars['body']) && !empty($retvars['body'])) { $body = $retvars['body']; } else { if (!Factory::Wiki($base)->isValied()) { $base = $defaultpage; $title = $s_base; $page = Factory::Wiki($base)->link('related');