2 // PukiWiki - Yet another WikiWikiWeb clone.
3 // $Id: tdiary.skin.php,v 1.12 2005/01/16 04:27:00 henoheno Exp $
8 if (! defined('TDIARY_THEME')) define('TDIARY_THEME', 'loose-leaf'); // Default
10 // Show link(s) at your choice, with <div class="calendar"> design
11 // NOTE: Some theme become looking worse with this!
12 // NULL = Show nothing
14 // 1 = Show reload URL
15 if (! defined('TDIARY_CALENDAR_DESIGN'))
16 define('TDIARY_CALENDAR_DESIGN', NULL); // NULL, 0, 1
18 // Show toolbar at your choice, with <div class="footer"> design
19 // NOTE: Some theme become looking worse with this!
20 if (! defined('PKWK_SKIN_SHOW_TOOLBAR'))
21 define('PKWK_SKIN_SHOW_TOOLBAR', 0); // 0, 1
24 // Prohibit direct access
25 if (! defined('UI_LANG')) die('UI_LANG is not set');
26 if (! isset($_LANG)) die('$_LANG is not set');
29 $theme = TDIARY_THEME;
30 if ($theme == '' || $theme == 'TDIARY_THEME') {
31 die('Theme is not specified. Set "TDIARY_THEME" correctly');
33 $theme = rawurlencode($theme); // Supress all nasty letters
34 $theme_css = SKIN_DIR . 'theme/' . $theme . '/' . $theme . '.css';
35 if (! file_exists($theme_css)) {
36 echo 'tDiary theme wrapper: ';
37 echo 'Theme not found: ' . htmlspecialchars($theme_css) . '<br/>';
38 echo 'You can get tdiary-theme from: ';
39 echo 'http://sourceforge.net/projects/tdiary/';
44 // Adjust DTD (between theme(=CSS) and MSIE bug)
46 // PukiWiki default: PKWK_DTD_XHTML_1_1
47 // tDiary's default: PKWK_DTD_HTML_4_01_STRICT
50 $pkwk_dtd = PKWK_DTD_HTML_4_01_STRICT; // or centering will be ignored via MSIE
54 // Adjust reverse-link default design manually
55 $disable_reverse_link = FALSE;
57 case 'hatena': /*FALLTHROUGH*/
60 $disable_reverse_link = TRUE;
64 // Sidebar: default position
65 if (defined('TDIARY_SIDEBAR_POSITION')) {
66 $sidebar = TDIARY_SIDEBAR_POSITION;
68 // Themes including sidebar CSS < (AllTheme / 2)
69 // $ grep div.sidebar */*.css | cut -d: -f1 | cut -d/ -f1 | sort | uniq
71 // 75 list-sidebar.txt
73 $sidebar = 'another'; // Default: Show as an another page below
75 case '3minutes': /*FALLTHROUGH*/
85 case 'book2-feminine':
139 case 'smoking_black':
140 case 'smoking_white':
147 case 'tinybox_green':
150 $sidebar = 'bottom'; // This is the default position of tDiary's.
154 // Adjust sidebar's default position
155 switch(TDIARY_THEME){
157 // Assuming sidebar is above of the body
158 case 'autumn': /*FALLTHROUGH*/
160 case 'dice': // Sidebar text (white) seems unreadable
164 case 'paper': // Sidebar text (white) seems unreadable
166 case 'tinybox': // For MSIE with narrow window width, seems meanless
167 case 'tinybox_green': // The same
171 // Strict separation between sidebar and main contents needed
172 case '3minutes': /*FALLTHROUGH*/
190 case 'moo': // For MSIE, strict seems meanless
193 case 's-blue': // For MSIE, strict seems meanless
205 // They have sidevar-design, but can not show it at the 'side' of the contents
206 case 'babypink': /*FALLTHROUGH*/
216 case 'smoking_black':
217 $sidebar = 'another'; // Show as an another page below
221 // Check menu (sidebar) is ready and $menubar is there
222 $menu = (arg_check('read') && is_page($GLOBALS['menubar']) &&
223 exist_plugin_convert('menu'));
225 $menu_body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
226 '<h3 $1><span class="sanchor"></span> $2</h3>',
227 do_plugin_convert('menu'));
230 $lang = & $_LANG['skin'];
233 // Decide charset for CSS
234 $css_charset = 'iso-8859-1';
236 case 'ja': $css_charset = 'Shift_JIS'; break;
239 // Output HTTP headers
240 pkwk_common_headers();
241 header('Cache-control: no-cache');
242 header('Pragma: no-cache');
243 header('Content-Type: text/html; charset=' . CONTENT_CHARSET);
245 // Output HTML DTD, <html>, and receive content-type
246 if (isset($pkwk_dtd)) {
247 $meta_content_type = pkwk_output_dtd($pkwk_dtd);
249 $meta_content_type = pkwk_output_dtd();
254 <?php echo $meta_content_type ?>
255 <meta http-equiv="content-style-type" content="text/css" />
256 <?php if (! $is_read) { ?> <meta name="robots" content="NOINDEX,NOFOLLOW" /><?php } ?>
257 <?php if (PKWK_ALLOW_JAVASCRIPT && isset($javascript)) { ?> <meta http-equiv="Content-Script-Type" content="text/javascript" /><?php } ?>
259 <title><?php echo "$title - $page_title" ?></title>
261 <link rel="stylesheet" href="skin/theme/base.css" type="text/css" media="all" />
262 <link rel="stylesheet" href="skin/theme/<?php echo $theme ?>/<?php echo $theme ?>.css" type="text/css" media="all" />
263 <link rel="stylesheet" href="skin/tdiary.css.php?charset=<?php echo $css_charset ?>" type="text/css" media="screen" charset="<?php echo $css_charset ?>" />
264 <link rel="stylesheet" href="skin/tdiary.css.php?charset=<?php echo $css_charset ?>&media=print" type="text/css" media="print" charset="<?php echo $css_charset ?>" />
266 <link rel="alternate" type="application/rss+xml" title="RSS" href="<?php echo $link['rss'] ?>" /><?php // RSS auto-discovery ?>
268 <?php if (PKWK_ALLOW_JAVASCRIPT && $trackback_javascript) { ?> <script type="text/javascript" src="skin/trackback.js"></script><?php } ?>
270 <?php echo $head_tag ?>
272 <body><!-- Theme:<?php echo htmlspecialchars($theme) . ' Sidebar:' . $sidebar ?> -->
274 <?php if ($menu && $sidebar == 'strict') { ?>
276 <div class="sidebar">
278 <?php echo $menu_body ?>
280 </div><!-- class="sidebar" -->
282 <div class="pkwk_body">
284 <?php } // if ($menu && $sidebar == 'strict') ?>
286 <!-- Navigation buttuns -->
287 <div id="navigator"></div>
288 <div class="adminmenu">
290 function _navigator($key, $value = '', $javascript = ''){
291 $lang = $GLOBALS['_LANG']['skin'];
292 $link = $GLOBALS['_LINK'];
293 if (! isset($lang[$key])) { echo 'LANG NOT FOUND'; return FALSE; }
294 if (! isset($link[$key])) { echo 'LINK NOT FOUND'; return FALSE; }
295 if (! PKWK_ALLOW_JAVASCRIPT) $javascript = '';
297 echo '<span class="adminmenu"><a href="' . $link[$key] . '" ' . $javascript . '>' .
298 (($value === '') ? $lang[$key] : $value) .
304 <?php _navigator('top') ?>
306 <?php if ($is_page) { ?>
307 <?php _navigator('edit') ?>
308 <?php if ($is_read && $function_freeze) { ?>
309 <?php (! $is_freeze) ? _navigator('freeze') : _navigator('unfreeze') ?>
311 <?php _navigator('diff') ?>
312 <?php if ($do_backup) { ?>
313 <?php _navigator('backup') ?>
315 <?php if ((bool)ini_get('file_uploads')) { ?>
316 <?php _navigator('upload') ?>
318 <?php _navigator('reload') ?>
322 <?php _navigator('new') ?>
323 <?php _navigator('list') ?>
324 <?php if (arg_check('list')) { ?>
325 <?php _navigator('filelist') ?>
327 <?php _navigator('search') ?>
328 <?php _navigator('recent') ?>
329 <?php _navigator('help') ?>
331 <?php if ($trackback) { ?>
332 <?php _navigator('trackback', $lang['trackback'] . '(' . tb_count($_page) . ')',
333 ($trackback_javascript == 1) ? 'onClick="OpenTrackback(this.href); return false"' : '') ?>
335 <?php if ($referer) { ?>
336 <?php _navigator('refer') ?>
340 <h1><?php echo $page_title ?></h1>
342 <div class="calendar">
343 <?php if ($is_page && TDIARY_CALENDAR_DESIGN !== NULL) { ?>
344 <?php if(TDIARY_CALENDAR_DESIGN) { ?>
345 <a href="<?php echo $link['reload'] ?>"><span class="small"><?php echo $link['reload'] ?></span></a>
347 <?php require_once(PLUGIN_DIR . 'topicpath.inc.php'); echo plugin_topicpath_inline(); ?>
353 <?php if ($menu && $sidebar == 'top') { ?>
354 <!-- Sidebar compat top -->
355 <div class="sidebar">
357 <?php echo $menu_body ?>
359 </div><!-- class="sidebar" -->
360 <?php } // if ($menu && $sidebar == 'top') ?>
363 <?php if ($menu && ($sidebar == 'top' || $sidebar == 'bottom')) { ?>
364 <div class="pkwk_body">
372 <h2><span class="date"></span> <span class="title"><?php
373 if ($disable_reverse_link === TRUE) {
375 echo htmlspecialchars($_page);
377 echo $page; // Search, or something message
383 echo htmlspecialchars($_page);
389 <div class="section">
391 // For read and preview: tDiary have no <h2> inside body
392 $body = preg_replace('#<h2 ([^>]*)>(.*?)<a class="anchor_super" ([^>]*)>.*?</a></h2>#',
393 '<h3 $1><a $3><span class="sanchor">_</span></a> $2</h3>', $body);
394 $body = preg_replace('#<h([34]) ([^>]*)>(.*?)<a class="anchor_super" ([^>]*)>.*?</a></h\1>#',
395 '<h$1 $2><a $4>_</a> $3</h$1>', $body);
396 $body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
397 '<h3 $1><span class="sanchor">_</span> $2</h3>', $body);
402 // Edit, preview, search, etc
403 echo preg_replace('/(<form) (action="' . preg_quote($script, '/') .
404 ')/', '$1 class="update" $2', $body);
408 </div><!-- class="body" -->
411 <?php if ($notes != '') { ?>
412 <div class="comment"><!-- Design for tDiary "Comments" -->
413 <div class="caption"> </div>
414 <div class="commentbody"><br/>
416 $notes = preg_replace('#<span class="small">(.*?)</span>#', '<p>$1</p>', $notes);
417 echo preg_replace('#<a (id="notefoot_[^>]*)>(.*?)</a>#',
418 '<div class="commentator"><a $1><span class="canchor"></span> ' .
419 '<span class="commentator">$2</span></a>' .
420 '<span class="commenttime"></span></div>', $notes);
426 <?php if ($attaches != '') { ?>
427 <div class="comment">
428 <div class="caption"> </div>
429 <div class="commentshort">
430 <?php echo $attaches ?>
435 <?php if ($related != '') { ?>
436 <div class="comment">
437 <div class="caption"> </div>
438 <div class="commentshort">
439 Link: <?php echo $related ?>
444 <!-- Design for tDiary "Today's referrer" -->
445 <div class="referer"><?php if ($lastmodified != '') echo 'Last-modified: ' . $lastmodified; ?></div>
447 </div><!-- class="day" -->
452 <?php if ($menu && $sidebar == 'another') { ?>
453 </div><!-- class="main" -->
454 </div><!-- class="pkwk_body" -->
456 <!-- Sidebar another -->
457 <div class="pkwk_body">
459 <div class="calendar"></div>
462 <h2><span class="date"></span><span class="title"> </span></h2>
464 <div class="section">
465 <?php echo $menu_body ?>
468 <div class="referer"></div>
471 </div><!-- class="pkwk_body" -->
473 <div class="pkwk_body">
475 <?php } // if ($menu && $sidebar == 'another') ?>
478 <?php if ($menu && ($sidebar == 'top' || $sidebar == 'bottom')) { ?>
479 </div><!-- class="main" -->
480 </div><!-- class="pkwk_body" -->
484 <?php if ($menu && $sidebar == 'bottom') { ?>
485 <!-- Sidebar compat bottom -->
486 <div class="sidebar">
488 <?php echo $menu_body ?>
490 </div><!-- class="sidebar" -->
491 <?php } // if ($menu && $sidebar == 'bottom') ?>
495 <?php if (PKWK_SKIN_SHOW_TOOLBAR) { ?>
499 // Set toolbar-specific images
500 $_IMAGE['skin']['reload'] = 'reload.png';
501 $_IMAGE['skin']['new'] = 'new.png';
502 $_IMAGE['skin']['edit'] = 'edit.png';
503 $_IMAGE['skin']['freeze'] = 'freeze.png';
504 $_IMAGE['skin']['unfreeze'] = 'unfreeze.png';
505 $_IMAGE['skin']['diff'] = 'diff.png';
506 $_IMAGE['skin']['upload'] = 'file.png';
507 $_IMAGE['skin']['copy'] = 'copy.png';
508 $_IMAGE['skin']['rename'] = 'rename.png';
509 $_IMAGE['skin']['top'] = 'top.png';
510 $_IMAGE['skin']['list'] = 'list.png';
511 $_IMAGE['skin']['search'] = 'search.png';
512 $_IMAGE['skin']['recent'] = 'recentchanges.png';
513 $_IMAGE['skin']['backup'] = 'backup.png';
514 $_IMAGE['skin']['help'] = 'help.png';
515 $_IMAGE['skin']['rss'] = 'rss.png';
516 $_IMAGE['skin']['rss10'] = & $_IMAGE['skin']['rss'];
517 $_IMAGE['skin']['rss20'] = 'rss20.png';
518 $_IMAGE['skin']['rdf'] = 'rdf.png';
520 function _toolbar($key, $x = 20, $y = 20){
521 $lang = & $GLOBALS['_LANG']['skin'];
522 $link = & $GLOBALS['_LINK'];
523 $image = & $GLOBALS['_IMAGE']['skin'];
524 if (! isset($lang[$key]) ) { echo 'LANG NOT FOUND'; return FALSE; }
525 if (! isset($link[$key]) ) { echo 'LINK NOT FOUND'; return FALSE; }
526 if (! isset($image[$key])) { echo 'IMAGE NOT FOUND'; return FALSE; }
528 echo '<a href="' . $link[$key] . '">' .
529 '<img src="' . IMAGE_DIR . $image[$key] . '" width="' . $x . '" height="' . $y . '" ' .
530 'alt="' . $lang[$key] . '" title="' . $lang[$key] . '" />' .
535 <?php _toolbar('top') ?>
537 <?php if ($is_page) { ?>
539 <?php _toolbar('edit') ?>
540 <?php if ($is_read && $function_freeze) { ?>
541 <?php if (! $is_freeze) { _toolbar('freeze'); } else { _toolbar('unfreeze'); } ?>
543 <?php _toolbar('diff') ?>
544 <?php if ($do_backup) { ?>
545 <?php _toolbar('backup') ?>
547 <?php if ((bool)ini_get('file_uploads')) { ?>
548 <?php _toolbar('upload') ?>
550 <?php _toolbar('copy') ?>
551 <?php _toolbar('rename') ?>
552 <?php _toolbar('reload') ?>
555 <?php _toolbar('new') ?>
556 <?php _toolbar('list') ?>
557 <?php _toolbar('search') ?>
558 <?php _toolbar('recent') ?>
559 <?php _toolbar('help') ?>
560 <?php _toolbar('rss10', 36, 14) ?>
562 <?php } // PKWK_SKIN_SHOW_TOOLBAR ?>
564 <!-- Copyright etc -->
565 Site admin: <a href="<?php echo $modifierlink ?>"><?php echo $modifier ?></a><p />
566 <?php echo S_COPYRIGHT ?>.
567 Powered by PHP <?php echo PHP_VERSION ?><br />
568 HTML convert time: <?php echo $taketime ?> sec.
570 </div><!-- class="footer" -->
572 <?php if ($menu && ($sidebar != 'top' && $sidebar != 'bottom')) { ?>
573 </div><!-- class="main" -->
574 </div><!-- class="pkwk_body" -->