OSDN Git Service

BugTrack/2247 External link cushion page - external_link (PHP4.x)
[pukiwiki/pukiwiki.git] / skin / tdiary.skin.php
index 03ff9d8..d1c0ab7 100644 (file)
@@ -1,11 +1,22 @@
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone.
-// $Id: tdiary.skin.php,v 1.13 2005/01/16 06:49:34 henoheno Exp $
+// tdiary.skin.php
+// Copyright
+//   2002-2017 PukiWiki Development Team
+//   2001-2002 Originally written by yu-ji
+// License: GPL v2 or (at your option) any later version
 //
-// tDiary-wrapper skin
+// tDiary-wrapper skin (Updated for tdiary-theme 2.1.2)
+
+// ------------------------------------------------------------
+// Settings (define before here, if you want)
+
+// Set site identities
+$_IMAGE['skin']['favicon']  = ''; // Sample: 'image/favicon.ico';
 
 // Select theme
-if (! defined('TDIARY_THEME')) define('TDIARY_THEME', 'loose-leaf'); // Default
+if (! defined('TDIARY_THEME'))
+       define('TDIARY_THEME', 'loose-leaf'); // Default
 
 // Show link(s) at your choice, with <div class="calendar"> design
 // NOTE: Some theme become looking worse with this!
@@ -15,33 +26,47 @@ if (! defined('TDIARY_THEME')) define('TDIARY_THEME', 'loose-leaf'); // Default
 if (! defined('TDIARY_CALENDAR_DESIGN'))
        define('TDIARY_CALENDAR_DESIGN', NULL); // NULL, 0, 1
 
+// Show / Hide navigation bar UI at your choice
+// NOTE: This is not stop their functionalities!
+if (! defined('PKWK_SKIN_SHOW_NAVBAR'))
+       define('PKWK_SKIN_SHOW_NAVBAR', 1); // 1, 0
+
 // Show toolbar at your choice, with <div class="footer"> design
 // NOTE: Some theme become looking worse with this!
 if (! defined('PKWK_SKIN_SHOW_TOOLBAR'))
        define('PKWK_SKIN_SHOW_TOOLBAR', 0); // 0, 1
 
-// --------
+// TDIARY_SIDEBAR_POSITION: See below
+
+// ------------------------------------------------------------
+// Code start
+
 // Prohibit direct access
 if (! defined('UI_LANG')) die('UI_LANG is not set');
 if (! isset($_LANG)) die('$_LANG is not set');
+if (! defined('PKWK_READONLY')) die('PKWK_READONLY is not set');
 
-// Check theme
-$theme = TDIARY_THEME;
-if ($theme == '' || $theme == 'TDIARY_THEME') {
+// ------------------------------------------------------------
+// Check tDiary theme
+
+if (! defined('TDIARY_THEME') || TDIARY_THEME == '') {
        die('Theme is not specified. Set "TDIARY_THEME" correctly');
 } else {
-       $theme = rawurlencode($theme); // Supress all nasty letters
+       $theme = rawurlencode(TDIARY_THEME); // Supress all nasty letters
        $theme_css = SKIN_DIR . 'theme/' . $theme . '/' . $theme . '.css';
        if (! file_exists($theme_css)) {
                echo 'tDiary theme wrapper: ';
-               echo 'Theme not found: ' . htmlspecialchars($theme_css) . '<br/>';
+               echo 'Theme not found: ' . htmlsc($theme_css) . '<br />';
                echo 'You can get tdiary-theme from: ';
-               echo 'http://sourceforge.net/projects/tdiary/';
+               echo 'http://www.tdiary.org/';
                exit;
         }
 }
 
-// Adjust DTD (between theme(=CSS) and MSIE bug)
+// ------------------------------------------------------------
+// tDiary theme: Exception
+
+// Adjust DTD (bug between these theme(=CSS) and MSIE)
 // NOTE:
 //    PukiWiki default: PKWK_DTD_XHTML_1_1
 //    tDiary's default: PKWK_DTD_HTML_4_01_STRICT
@@ -54,80 +79,185 @@ case 'christmas':
 // Adjust reverse-link default design manually
 $disable_backlink = FALSE;
 switch(TDIARY_THEME){
-case 'hatena': /*FALLTHROUGH*/
-       $disable_backlink = TRUE;
+case 'hatena':         /* FALLTHROUGH */
+case 'hatena-black':
+case 'hatena-brown':
+case 'hatena-darkgray':
+case 'hatena-green':
+case 'hatena-lightblue':
+case 'hatena-lightgray':
+case 'hatena-purple':
+case 'hatena-red':
+case 'hatena-white':
+case 'hatena_cinnamon':
+case 'hatena_japanese':
+case 'hatena_leaf':
+case 'hatena_water':
+       $disable_backlink = TRUE; // or very viewable title color
        break;
 }
 
-// Select title design (which is fancy, date and text?)
-$title_design_date = 1; // Default: Select the date desin, or 'the same design'
-switch(TDIARY_THEME){
-case '3minutes':
-case 'black-lingerie':
-case 'blog':
-case 'book':
-case 'book2-feminine':
-case 'book3-sky':
-case 'candy':
-case 'cards':
-case 'desert':
-case 'dot':
-case 'himawari':
-case 'light-blue':
-case 'lovely':
-case 'lovely_pink':
-case 'lr':
-case 'magic':
-case 'maroon':
-case 'midnight':
-case 'momonga':
-case 'nande-ya-nen':
-case 'narrow':
-case 'nebula':
-case 'orange':
-case 'parabola':
-case 'plum':
-case 'pool_side':
-case 'rainy-season':
-case 'right':
-case 's-blue':
-case 's-pink':
-case 'sky':
-case 'snow_man':
-case 'spring':
-case 'tag':
-case 'white-lingerie':
-case 'whiteout':
-case 'wood':
-       $title_design_date = 0; // Select text design   
-       break;
+// ------------------------------------------------------------
+// tDiary theme: Select CSS color theme (Now testing:black only)
 
-// Show both :)
-case 'arrow':
-case 'fluxbox':
-case 'fluxbox2':
-case 'fluxbox3':
-       $title_design_date = 2;
-       break;
+if (defined('TDIARY_COLOR_THEME')) {
+       $css_theme = rawurlencode(TDIARY_COLOR_THEME);
+} else {
+       $css_theme = '';
+
+       switch(TDIARY_THEME){
+       case 'alfa':
+       case 'bill':
+       case 'black-lingerie':
+       case 'blackboard':
+       case 'bubble':
+       case 'cosmos':
+       case 'darkness-pop':
+       case 'digital_gadgets':
+       case 'fine':
+       case 'fri':
+       case 'giza':
+       case 'hatena-black':
+       case 'hatena_savanna-blue':
+       case 'hatena_savanna-green':
+       case 'hatena_savanna-red':
+       case 'kaizou':
+       case 'lightning':
+       case 'lime':
+       case 'line':
+       case 'midnight':
+       case 'moo':
+       case 'nachtmusik':
+       case 'nebula':
+       case 'nippon':
+       case 'noel':
+       case 'petith-b':
+       case 'quiet_black':
+       case 'redgrid':
+       case 'starlight':
+       case 'tinybox_green':
+       case 'white-lingerie':
+       case 'white_flower':
+       case 'whiteout':
+       case 'wine':
+       case 'wood':
+       case 'xmastree':
+       case 'yukon':
+               $css_theme = 'black';
+
+       // Another theme needed?
+       case 'bluely':
+       case 'brown':
+       case 'deepblue':
+       case 'scarlet':
+       case 'smoking_black':
+               ;
+       }
+}
+
+// ------------------------------------------------------------
+// tDiary theme: Page title design (which is fancy, date and text?)
+
+if (defined('TDIARY_TITLE_DESIGN_DATE') &&
+    (TDIARY_TITLE_DESIGN_DATE  == 0 ||
+     TDIARY_TITLE_DESIGN_DATE  == 1 ||
+     TDIARY_TITLE_DESIGN_DATE  == 2)) {
+       $title_design_date = TDIARY_TITLE_DESIGN_DATE;
+} else {
+       $title_design_date = 1; // Default: Select the date desin, or 'the same design'
+       switch(TDIARY_THEME){
+       case '3minutes':        /* FALLTHROUGH */
+       case '90':
+       case 'aoikuruma':
+       case 'black-lingerie':
+       case 'blog':
+       case 'book':
+       case 'book2-feminine':
+       case 'book3-sky':
+       case 'candy':
+       case 'cards':
+       case 'desert':
+       case 'dot':
+       case 'himawari':
+       case 'kitchen-classic':
+       case 'kitchen-french':
+       case 'kitchen-natural':
+       case 'light-blue':
+       case 'lovely':
+       case 'lovely_pink':
+       case 'lr':
+       case 'magic':
+       case 'maroon':
+       case 'midnight':
+       case 'momonga':
+       case 'nande-ya-nen':
+       case 'narrow':
+       case 'natrium':
+       case 'nebula':
+       case 'orange':
+       case 'parabola':
+       case 'plum':
+       case 'pool_side':
+       case 'rainy-season':
+       case 'right':
+       case 's-blue':
+       case 's-pink':
+       case 'sky':
+       case 'sleepy_kitten':
+       case 'snow_man':
+       case 'spring':
+       case 'tag':
+       case 'tdiarynet':
+       case 'treetop':
+       case 'white-lingerie':
+       case 'white_flower':
+       case 'whiteout':
+       case 'wood':
+               $title_design_date = 0; // Select text design   
+               break;
+
+       case 'aqua':
+       case 'arrow':
+       case 'fluxbox':
+       case 'fluxbox2':
+       case 'fluxbox3':
+       case 'ymck':
+               $title_design_date = 2; // Show both :)
+               break;
+       }
 }
 
-// Sidebar: default position
+// ------------------------------------------------------------
+// tDiary 'Sidebar' position
+
+// Default position
 if (defined('TDIARY_SIDEBAR_POSITION')) {
        $sidebar = TDIARY_SIDEBAR_POSITION;
 } else {
-       // Themes including sidebar CSS < (AllTheme / 2)
+       $sidebar = 'another'; // Default: Show as an another page below
+
+       // List of themes having sidebar CSS < (AllTheme / 2)
        // $ grep div.sidebar */*.css | cut -d: -f1 | cut -d/ -f1 | sort | uniq
        // $ wc -l *.txt
-       //     75 list-sidebar.txt
-       //    193 list-all.txt
-       $sidebar = 'another'; // Default: Show as an another page below
+       //    142 list-sidebar.txt
+       //    286 list-all.txt
        switch(TDIARY_THEME){
        case '3minutes':        /*FALLTHROUGH*/
        case '3pink':
        case 'aoikuruma':
+       case 'aqua':
        case 'arrow':
+       case 'artnouveau-blue':
+       case 'artnouveau-green':
+       case 'artnouveau-red':
+       case 'asterisk-blue':
+       case 'asterisk-lightgray':
+       case 'asterisk-maroon':
+       case 'asterisk-orange':
+       case 'asterisk-pink':
        case 'autumn':
        case 'babypink':
+       case 'be_r5':
        case 'bill':
        case 'bistro_menu':
        case 'bluely':
@@ -135,26 +265,70 @@ if (defined('TDIARY_SIDEBAR_POSITION')) {
        case 'book2-feminine':
        case 'book3-sky':
        case 'bright-green':
+       case 'britannian':
        case 'bubble':
        case 'candy':
        case 'cat':
        case 'cherry':
+       case 'cherry_blossom':
+       case 'chiffon_leafgreen':
+       case 'chiffon_pink':
+       case 'chiffon_skyblue':
        case 'citrus':
        case 'clover':
+       case 'colorlabel':
        case 'cool_ice':
        case 'cosmos':
+       case 'curtain':
        case 'darkness-pop':
+       case 'delta':
        case 'diamond_dust':
        case 'dice':
+       case 'digital_gadgets':
+       case 'dot-lime':
+       case 'dot-orange':
+       case 'dot-pink':
+       case 'dot-sky':
+       case 'dotted_line-blue':
+       case 'dotted_line-green':
+       case 'dotted_line-red':
        case 'emboss':
        case 'flower':
        case 'gear':
        case 'germany':
        case 'gray2':
+       case 'green_leaves':
        case 'happa':
        case 'hatena':
+       case 'hatena-black':
+       case 'hatena-brown':
+       case 'hatena-darkgray':
+       case 'hatena-green':
+       case 'hatena-lightblue':
+       case 'hatena-lightgray':
+       case 'hatena-lime':
+       case 'hatena-orange':
+       case 'hatena-pink':
+       case 'hatena-purple':
+       case 'hatena-red':
+       case 'hatena-sepia':
+       case 'hatena-tea':
+       case 'hatena-white':
+       case 'hatena_cinnamon':
+       case 'hatena_japanese':
+       case 'hatena_leaf':
+       case 'hatena_rainyseason':
+       case 'hatena_savanna-blue':
+       case 'hatena_savanna-green':
+       case 'hatena_savanna-red':
+       case 'hatena_savanna-white':
+       case 'hatena_water':
        case 'himawari':
+       case 'jungler':
        case 'kaeru':
+       case 'kitchen-classic':
+       case 'kitchen-french':
+       case 'kitchen-natural':
        case 'kotatsu':
        case 'light-blue':
        case 'loose-leaf':
@@ -164,9 +338,11 @@ if (defined('TDIARY_SIDEBAR_POSITION')) {
        case 'momonga':
        case 'mono':
        case 'moo':
+       case 'natrium':
        case 'nippon':
        case 'note':
        case 'old-pavement':
+       case 'orange_flower':
        case 'pain':
        case 'pale':
        case 'paper':
@@ -179,6 +355,12 @@ if (defined('TDIARY_SIDEBAR_POSITION')) {
        case 'rainy-season':
        case 'rectangle':
        case 'repro':
+       case 'rim-daidaiiro':
+       case 'rim-fujiiro':
+       case 'rim-mizuiro':
+       case 'rim-sakurairo':
+       case 'rim-tanpopoiro':
+       case 'rim-wakabairo':
        case 'russet':
        case 's-blue':
        case 'sagegreen':
@@ -186,25 +368,38 @@ if (defined('TDIARY_SIDEBAR_POSITION')) {
        case 'scarlet':
        case 'sepia':
        case 'simple':
+       case 'sleepy_kitten':
        case 'smoking_black':
        case 'smoking_white':
        case 'spring':
        case 'sunset':
+       case 'tdiarynet':
        case 'teacup':
        case 'thin':
        case 'tile':
        case 'tinybox':
        case 'tinybox_green':
+       case 'treetop':
+       case 'white_flower':
        case 'wine':
        case 'yukon':
-               $sidebar = 'bottom';    // This is the default position of tDiary's.
+       case 'zef':
+               $sidebar = 'bottom'; // This is the default position of tDiary's.
                break;
        }
 
-       // Adjust sidebar's default position
+       // Manually adjust sidebar's default position
        switch(TDIARY_THEME){
 
-       // Assuming sidebar is above of the body
+       // 'bottom'
+       case '90': // But upper navigatin UI will be hidden by sidebar
+       case 'blackboard':
+       case 'quirky':
+       case 'quirky2':
+               $sidebar = 'bottom';
+               break;
+
+       // 'top': Assuming sidebar is above of the body
        case 'autumn':  /*FALLTHROUGH*/
        case 'cosmos':
        case 'dice':    // Sidebar text (white) seems unreadable
@@ -215,29 +410,86 @@ if (defined('TDIARY_SIDEBAR_POSITION')) {
        case 'sunset':
        case 'tinybox': // For MSIE with narrow window width, seems meanless
        case 'tinybox_green':   // The same
+       case 'ymck':
                $sidebar = 'top';
                break;
 
-       // Strict separation between sidebar and main contents needed
+       // 'strict': Strict separation between sidebar and main contents needed
        case '3minutes':        /*FALLTHROUGH*/
        case '3pink':
        case 'aoikuruma':
+       case 'aqua':
+       case 'artnouveau-blue':
+       case 'artnouveau-green':
+       case 'artnouveau-red':
+       case 'asterisk-blue':
+       case 'asterisk-lightgray':
+       case 'asterisk-maroon':
+       case 'asterisk-orange':
+       case 'asterisk-pink':
        case 'bill':
        case 'candy':
        case 'cat':
+       case 'chiffon_leafgreen':
+       case 'chiffon_pink':
+       case 'chiffon_skyblue':
+       case 'city':
        case 'clover':
+       case 'colorlabel':
        case 'cool_ice':
+       case 'dot-lime':
+       case 'dot-orange':
+       case 'dot-pink':
+       case 'dot-sky':
+       case 'dotted_line-blue':
+       case 'dotted_line-green':
+       case 'dotted_line-red':
        case 'flower':
        case 'germany':
+       case 'green-tea':
+       case 'hatena':
+       case 'hatena-black':
+       case 'hatena-brown':
+       case 'hatena-darkgray':
+       case 'hatena-green':
+       case 'hatena-lightblue':
+       case 'hatena-lightgray':
+       case 'hatena-lime':
+       case 'hatena-orange':
+       case 'hatena-pink':
+       case 'hatena-purple':
+       case 'hatena-red':
+       case 'hatena-sepia':
+       case 'hatena-tea':
+       case 'hatena-white':
+       case 'hiki':
        case 'himawari':
+       case 'kasumi':
+       case 'kitchen-classic':
+       case 'kitchen-french':
+       case 'kitchen-natural':
        case 'kotatsu':
+       case 'kurenai':
        case 'light-blue':
        case 'loose-leaf':
        case 'marguerite':
        case 'matcha':
+       case 'memo':
+       case 'memo2':
+       case 'memo3':
+       case 'mirage':
        case 'mizu':
        case 'mono':
        case 'moo':     // For MSIE, strict seems meanless
+       case 'navy':
+       case 'pict':
+       case 'pokke-blue':
+       case 'pokke-orange':
+       case 'query000':
+       case 'query011':
+       case 'query101':
+       case 'query110':
+       case 'query111or':
        case 'puppy':
        case 'rainy-season':
        case 's-blue':  // For MSIE, strict seems meanless
@@ -246,80 +498,86 @@ if (defined('TDIARY_SIDEBAR_POSITION')) {
        case 'scarlet':
        case 'sepia':
        case 'simple':
+       case 'smoking_gray':
        case 'spring':
        case 'teacup':
        case 'wine':
                $sidebar = 'strict';
                break;
 
-       // They have sidevar-design, but can not show it at the 'side' of the contents
+       // 'another': They have sidebar-design, but can not show it
+       //  at the 'side' of the contents
        case 'babypink':        /*FALLTHROUGH*/
        case 'bubble':
        case 'cherry':
        case 'darkness-pop':
        case 'diamond_dust':
        case 'gear':
+       case 'necktie':
        case 'pale':
        case 'pink-border':
        case 'rectangle':
        case 'russet':
        case 'smoking_black':
+       case 'zef':
                $sidebar = 'another'; // Show as an another page below
                break;
        }
+
+       // 'none': Show no sidebar
 }
 // Check menu (sidebar) is ready and $menubar is there
-$menu = (arg_check('read') && is_page($GLOBALS['menubar']) &&
-       exist_plugin_convert('menu'));
-if ($menu) {
-       $menu_body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
-               '<h3 $1><span class="sanchor"></span> $2</h3>',
-               do_plugin_convert('menu'));
+if ($sidebar == 'none') {
+       $menu = FALSE;
+} else {
+       $menu = (arg_check('read') && is_page($GLOBALS['menubar']) &&
+               exist_plugin_convert('menu'));
+       if ($menu) {
+               $menu_body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
+                       '<h3 $1><span class="sanchor"></span> $2</h3>',
+                       do_plugin_convert('menu'));
+       }
 }
 
+// ------------------------------------------------------------
+// Code continuing ...
+
 $lang  = & $_LANG['skin'];
 $link  = & $_LINK;
+$image = & $_IMAGE['skin'];
+$rw    = ! PKWK_READONLY;
 
-// Decide charset for CSS
-$css_charset = 'iso-8859-1';
-switch(UI_LANG){
-       case 'ja': $css_charset = 'Shift_JIS'; break;
-}
+// ------------------------------------------------------------
+// Output
 
-// Output HTTP headers
+// HTTP headers
 pkwk_common_headers();
 header('Cache-control: no-cache');
 header('Pragma: no-cache');
 header('Content-Type: text/html; charset=' . CONTENT_CHARSET);
 
-// Output HTML DTD, <html>, and receive content-type
-if (isset($pkwk_dtd)) {
-       $meta_content_type = pkwk_output_dtd($pkwk_dtd);
-} else {
-       $meta_content_type = pkwk_output_dtd();
-}
-
 ?>
+<!DOCTYPE html>
+<html lang="<?php echo LANG ?>">
 <head>
- <?php echo $meta_content_type ?>
- <meta http-equiv="content-style-type" content="text/css" />
-<?php if (! $is_read)  { ?> <meta name="robots" content="NOINDEX,NOFOLLOW" /><?php } ?>
-<?php if (PKWK_ALLOW_JAVASCRIPT && isset($javascript)) { ?> <meta http-equiv="Content-Script-Type" content="text/javascript" /><?php } ?>
+ <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CONTENT_CHARSET ?>" />
+<?php if ($nofollow || ! $is_read)  { ?> <meta name="robots" content="NOINDEX,NOFOLLOW" /><?php } ?>
+<?php if ($html_meta_referrer_policy) { ?> <meta name="referrer" content="<?php echo htmlsc(html_meta_referrer_policy) ?>" /><?php } ?>
 
  <title><?php echo $title ?> - <?php echo $page_title ?></title>
 
- <link rel="stylesheet" href="skin/theme/base.css" type="text/css" media="all" />
- <link rel="stylesheet" href="skin/theme/<?php echo $theme ?>/<?php echo $theme ?>.css" type="text/css" media="all" />
- <link rel="stylesheet" href="skin/tdiary.css.php?charset=<?php echo $css_charset ?>" type="text/css" media="screen" charset="<?php echo $css_charset ?>" />
- <link rel="stylesheet" href="skin/tdiary.css.php?charset=<?php echo $css_charset ?>&amp;media=print" type="text/css" media="print" charset="<?php echo $css_charset ?>" />
-
+ <link rel="SHORTCUT ICON" href="<?php echo $image['favicon'] ?>" />
+ <link rel="stylesheet" type="text/css" media="all" href="<?php echo SKIN_DIR ?>theme/base.css" />
+ <link rel="stylesheet" type="text/css" media="all" href="<?php echo SKIN_DIR ?>theme/<?php echo $theme ?>/<?php echo $theme ?>.css" />
+ <link rel="stylesheet" type="text/css" href="<?php echo SKIN_DIR ?>tdiary.css" />
+<?php if ($css_theme === 'black') { ?> <link rel="stylesheet" type="text/css" href="<?php echo SKIN_DIR ?>tdiary_black.css" /><?php } ?>
  <link rel="alternate" type="application/rss+xml" title="RSS" href="<?php echo $link['rss'] ?>" /><?php // RSS auto-discovery ?>
 
-<?php if (PKWK_ALLOW_JAVASCRIPT && $trackback_javascript) { ?> <script type="text/javascript" src="skin/trackback.js"></script><?php } ?>
-
 <?php echo $head_tag ?>
 </head>
-<body><!-- Theme:<?php echo htmlspecialchars($theme) . ' Sidebar:' . $sidebar ?> -->
+<body>
+<?php echo $html_scripting_data ?>
+<!-- Theme:<?php echo htmlsc($theme) . ' Sidebar:' . $sidebar ?> -->
 
 <?php if ($menu && $sidebar == 'strict') { ?>
 <!-- Sidebar top -->
@@ -334,15 +592,14 @@ if (isset($pkwk_dtd)) {
 <?php } // if ($menu && $sidebar == 'strict') ?>
 
 <!-- Navigation buttuns -->
-<div id="navigator"></div>
-<div class="adminmenu">
+<?php if (PKWK_SKIN_SHOW_NAVBAR) { ?>
+<div class="adminmenu"><div id="navigator">
 <?php
 function _navigator($key, $value = '', $javascript = ''){
        $lang = $GLOBALS['_LANG']['skin'];
        $link = $GLOBALS['_LINK'];
        if (! isset($lang[$key])) { echo 'LANG NOT FOUND'; return FALSE; }
        if (! isset($link[$key])) { echo 'LINK NOT FOUND'; return FALSE; }
-       if (! PKWK_ALLOW_JAVASCRIPT) $javascript = '';
 
        echo '<span class="adminmenu"><a href="' . $link[$key] . '" ' . $javascript . '>' .
                (($value === '') ? $lang[$key] : $value) .
@@ -354,22 +611,26 @@ function _navigator($key, $value = '', $javascript = ''){
  <?php _navigator('top') ?> &nbsp;
 
 <?php if ($is_page) { ?>
-   <?php _navigator('edit')   ?>
- <?php if ($is_read && $function_freeze) { ?>
-    <?php (! $is_freeze) ? _navigator('freeze') : _navigator('unfreeze') ?>
+  <?php if ($rw) { ?>
+       <?php _navigator('edit') ?>
+       <?php if ($is_read && $function_freeze) { ?>
+               <?php (! $is_freeze) ? _navigator('freeze') : _navigator('unfreeze') ?>
+       <?php } ?>
  <?php } ?>
    <?php _navigator('diff') ?>
  <?php if ($do_backup) { ?>
-   <?php _navigator('backup') ?>
+       <?php _navigator('backup') ?>
  <?php } ?>
- <?php if ((bool)ini_get('file_uploads')) { ?>
-   <?php _navigator('upload') ?>
+ <?php if ($rw && (bool)ini_get('file_uploads')) { ?>
+       <?php _navigator('upload') ?>
  <?php } ?>
-   <?php _navigator('reload')    ?>
+   <?php _navigator('reload') ?>
    &nbsp;
 <?php } ?>
 
-   <?php _navigator('new')  ?>
+ <?php if ($rw) { ?>
+       <?php _navigator('new') ?>
+ <?php } ?>
    <?php _navigator('list') ?>
  <?php if (arg_check('list')) { ?>
    <?php _navigator('filelist') ?>
@@ -377,22 +638,23 @@ function _navigator($key, $value = '', $javascript = ''){
    <?php _navigator('search') ?>
    <?php _navigator('recent') ?>
    <?php _navigator('help')   ?>
-
-<?php if ($trackback) { ?> &nbsp;
-   <?php _navigator('trackback', $lang['trackback'] . '(' . tb_count($_page) . ')',
-       ($trackback_javascript == 1) ? 'onClick="OpenTrackback(this.href); return false"' : '') ?>
-<?php } ?>
-<?php if ($referer)   { ?> &nbsp;
-   <?php _navigator('refer') ?>
-<?php } ?>
-</div>
+   <?php if ($enable_login) { ?>
+     <?php _navigator('login') ?>
+   <?php } ?>
+   <?php if ($enable_logout) { ?>
+     <?php _navigator('logout') ?>
+   <?php } ?>
+</div></div>
+<?php } else { ?>
+<div id="navigator"></div>
+<?php } // PKWK_SKIN_SHOW_NAVBAR ?>
 
 <h1><?php echo $page_title ?></h1>
 
 <div class="calendar">
 <?php if ($is_page && TDIARY_CALENDAR_DESIGN !== NULL) { ?>
        <?php if(TDIARY_CALENDAR_DESIGN) { ?>
-               <a href="<?php echo $link['reload'] ?>"><span class="small"><?php echo $link['reload'] ?></span></a>
+               <a href="<?php echo $link['canonical_url'] ?>"><span class="small"><?php echo $link['canonical_url'] ?></span></a>
        <?php } else { ?>
                <?php require_once(PLUGIN_DIR . 'topicpath.inc.php'); echo plugin_topicpath_inline(); ?>
        <?php } ?>
@@ -424,7 +686,7 @@ function _navigator($key, $value = '', $javascript = ''){
 $title = '';
 if ($disable_backlink) {
        if ($_page != '') {
-               $title = htmlspecialchars($_page);
+               $title = htmlsc($_page);
        } else {
                $title = $page; // Search, or something message
        }
@@ -432,7 +694,7 @@ if ($disable_backlink) {
        if ($page != '') {
                $title = $page;
        } else {
-               $title =  htmlspecialchars($_page);
+               $title = htmlsc($_page);
        }
 }
 $title_date = $title_text = '';
@@ -475,7 +737,7 @@ default:
 <?php if ($notes != '') { ?>
 <div class="comment"><!-- Design for tDiary "Comments" -->
        <div class="caption">&nbsp;</div>
-       <div class="commentbody"><br/>
+       <div class="commentbody"><br />
                <?php
                $notes = preg_replace('#<span class="small">(.*?)</span>#', '<p>$1</p>', $notes);
                echo preg_replace('#<a (id="notefoot_[^>]*)>(.*?)</a>#',
@@ -600,37 +862,44 @@ function _toolbar($key, $x = 20, $y = 20){
 
 <?php if ($is_page) { ?>
  &nbsp;
- <?php _toolbar('edit') ?>
- <?php if ($is_read && $function_freeze) { ?>
-  <?php if (! $is_freeze) { _toolbar('freeze'); } else { _toolbar('unfreeze'); } ?>
+ <?php if ($rw) { ?>
+       <?php _toolbar('edit') ?>
+       <?php if ($is_read && $function_freeze) { ?>
+               <?php if (! $is_freeze) { _toolbar('freeze'); } else { _toolbar('unfreeze'); } ?>
+       <?php } ?>
  <?php } ?>
  <?php _toolbar('diff') ?>
 <?php if ($do_backup) { ?>
-  <?php _toolbar('backup') ?>
+       <?php _toolbar('backup') ?>
 <?php } ?>
- <?php if ((bool)ini_get('file_uploads')) { ?>
-  <?php _toolbar('upload') ?>
+ <?php if ($rw && (bool)ini_get('file_uploads')) { ?>
+       <?php _toolbar('upload') ?>
+ <?php } ?>
+ <?php if ($rw) { ?>
+       <?php _toolbar('copy') ?>
+       <?php _toolbar('rename') ?>
  <?php } ?>
- <?php _toolbar('copy') ?>
- <?php _toolbar('rename') ?>
  <?php _toolbar('reload') ?>
 <?php } ?>
  &nbsp;
- <?php _toolbar('new')    ?>
+ <?php if ($rw) { ?>
+       <?php _toolbar('new') ?>
+ <?php } ?>
  <?php _toolbar('list')   ?>
  <?php _toolbar('search') ?>
  <?php _toolbar('recent') ?>
  &nbsp; <?php _toolbar('help') ?>
  &nbsp; <?php _toolbar('rss10', 36, 14) ?>
- <br/>
+ <br />
 <?php } // PKWK_SKIN_SHOW_TOOLBAR ?>
 
 <!-- Copyright etc -->
- Site admin: <a href="<?php echo $modifierlink ?>"><?php echo $modifier ?></a><p />
+ Site admin: <a href="<?php echo $modifierlink ?>"><?php echo $modifier ?></a>
+ <p>
  <?php echo S_COPYRIGHT ?>.
  Powered by PHP <?php echo PHP_VERSION ?><br />
- HTML convert time: <?php echo $taketime ?> sec.
-
+ HTML convert time: <?php echo elapsedtime() ?> sec.
+ </p>
 </div><!-- class="footer" -->
 
 <?php if ($menu && ($sidebar != 'top' && $sidebar != 'bottom')) { ?>
@@ -638,6 +907,5 @@ function _toolbar($key, $x = 20, $y = 20){
 </div><!-- class="pkwk_body" -->
 <?php } ?>
 
-
 </body>
 </html>