2 // PukiWiki - Yet another WikiWikiWeb clone.
3 // $Id: tdiary.skin.php,v 1.14 2005/01/19 13:49:19 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_backlink = FALSE;
57 case 'hatena': /*FALLTHROUGH*/
58 $disable_backlink = TRUE;
62 // Select title design (which is fancy, date and text?)
63 $title_design_date = 1; // Default: Select the date desin, or 'the same design'
67 case 'black-lingerie':
70 case 'book2-feminine':
100 case 'white-lingerie':
103 $title_design_date = 0; // Select text design
111 $title_design_date = 2;
115 // Sidebar: default position
116 if (defined('TDIARY_SIDEBAR_POSITION')) {
117 $sidebar = TDIARY_SIDEBAR_POSITION;
119 // Themes including sidebar CSS < (AllTheme / 2)
120 // $ grep div.sidebar */*.css | cut -d: -f1 | cut -d/ -f1 | sort | uniq
122 // 75 list-sidebar.txt
124 $sidebar = 'another'; // Default: Show as an another page below
125 switch(TDIARY_THEME){
126 case '3minutes': /*FALLTHROUGH*/
136 case 'book2-feminine':
190 case 'smoking_black':
191 case 'smoking_white':
198 case 'tinybox_green':
201 $sidebar = 'bottom'; // This is the default position of tDiary's.
205 // Adjust sidebar's default position
206 switch(TDIARY_THEME){
208 // Assuming sidebar is above of the body
209 case 'autumn': /*FALLTHROUGH*/
211 case 'dice': // Sidebar text (white) seems unreadable
215 case 'paper': // Sidebar text (white) seems unreadable
217 case 'tinybox': // For MSIE with narrow window width, seems meanless
218 case 'tinybox_green': // The same
222 // Strict separation between sidebar and main contents needed
223 case '3minutes': /*FALLTHROUGH*/
241 case 'moo': // For MSIE, strict seems meanless
244 case 's-blue': // For MSIE, strict seems meanless
256 // They have sidevar-design, but can not show it at the 'side' of the contents
257 case 'babypink': /*FALLTHROUGH*/
267 case 'smoking_black':
268 $sidebar = 'another'; // Show as an another page below
272 // Check menu (sidebar) is ready and $menubar is there
273 $menu = (arg_check('read') && is_page($GLOBALS['menubar']) &&
274 exist_plugin_convert('menu'));
276 $menu_body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
277 '<h3 $1><span class="sanchor"></span> $2</h3>',
278 do_plugin_convert('menu'));
281 $lang = & $_LANG['skin'];
284 // Decide charset for CSS
285 $css_charset = 'iso-8859-1';
287 case 'ja': $css_charset = 'Shift_JIS'; break;
290 // Output HTTP headers
291 pkwk_common_headers();
292 header('Cache-control: no-cache');
293 header('Pragma: no-cache');
294 header('Content-Type: text/html; charset=' . CONTENT_CHARSET);
296 // Output HTML DTD, <html>, and receive content-type
297 if (isset($pkwk_dtd)) {
298 $meta_content_type = pkwk_output_dtd($pkwk_dtd);
300 $meta_content_type = pkwk_output_dtd();
305 <?php echo $meta_content_type ?>
306 <meta http-equiv="content-style-type" content="text/css" />
307 <?php if (! $is_read) { ?> <meta name="robots" content="NOINDEX,NOFOLLOW" /><?php } ?>
308 <?php if (PKWK_ALLOW_JAVASCRIPT && isset($javascript)) { ?> <meta http-equiv="Content-Script-Type" content="text/javascript" /><?php } ?>
310 <title><?php echo $title ?> - <?php echo $page_title ?></title>
312 <link rel="stylesheet" href="skin/theme/base.css" type="text/css" media="all" />
313 <link rel="stylesheet" href="skin/theme/<?php echo $theme ?>/<?php echo $theme ?>.css" type="text/css" media="all" />
314 <link rel="stylesheet" href="skin/tdiary.css.php?charset=<?php echo $css_charset ?>" type="text/css" media="screen" charset="<?php echo $css_charset ?>" />
315 <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 ?>" />
317 <link rel="alternate" type="application/rss+xml" title="RSS" href="<?php echo $link['rss'] ?>" /><?php // RSS auto-discovery ?>
319 <?php if (PKWK_ALLOW_JAVASCRIPT && $trackback_javascript) { ?> <script type="text/javascript" src="skin/trackback.js"></script><?php } ?>
321 <?php echo $head_tag ?>
323 <body><!-- Theme:<?php echo htmlspecialchars($theme) . ' Sidebar:' . $sidebar ?> -->
325 <?php if ($menu && $sidebar == 'strict') { ?>
327 <div class="sidebar">
329 <?php echo $menu_body ?>
331 </div><!-- class="sidebar" -->
333 <div class="pkwk_body">
335 <?php } // if ($menu && $sidebar == 'strict') ?>
337 <!-- Navigation buttuns -->
338 <div id="navigator"></div>
339 <div class="adminmenu">
341 function _navigator($key, $value = '', $javascript = ''){
342 $lang = $GLOBALS['_LANG']['skin'];
343 $link = $GLOBALS['_LINK'];
344 if (! isset($lang[$key])) { echo 'LANG NOT FOUND'; return FALSE; }
345 if (! isset($link[$key])) { echo 'LINK NOT FOUND'; return FALSE; }
346 if (! PKWK_ALLOW_JAVASCRIPT) $javascript = '';
348 echo '<span class="adminmenu"><a href="' . $link[$key] . '" ' . $javascript . '>' .
349 (($value === '') ? $lang[$key] : $value) .
355 <?php _navigator('top') ?>
357 <?php if ($is_page) { ?>
358 <?php _navigator('edit') ?>
359 <?php if ($is_read && $function_freeze) { ?>
360 <?php (! $is_freeze) ? _navigator('freeze') : _navigator('unfreeze') ?>
362 <?php _navigator('diff') ?>
363 <?php if ($do_backup) { ?>
364 <?php _navigator('backup') ?>
366 <?php if ((bool)ini_get('file_uploads')) { ?>
367 <?php _navigator('upload') ?>
369 <?php _navigator('reload') ?>
373 <?php _navigator('new') ?>
374 <?php _navigator('list') ?>
375 <?php if (arg_check('list')) { ?>
376 <?php _navigator('filelist') ?>
378 <?php _navigator('search') ?>
379 <?php _navigator('recent') ?>
380 <?php _navigator('help') ?>
382 <?php if ($trackback) { ?>
383 <?php _navigator('trackback', $lang['trackback'] . '(' . tb_count($_page) . ')',
384 ($trackback_javascript == 1) ? 'onClick="OpenTrackback(this.href); return false"' : '') ?>
386 <?php if ($referer) { ?>
387 <?php _navigator('refer') ?>
391 <h1><?php echo $page_title ?></h1>
393 <div class="calendar">
394 <?php if ($is_page && TDIARY_CALENDAR_DESIGN !== NULL) { ?>
395 <?php if(TDIARY_CALENDAR_DESIGN) { ?>
396 <a href="<?php echo $link['reload'] ?>"><span class="small"><?php echo $link['reload'] ?></span></a>
398 <?php require_once(PLUGIN_DIR . 'topicpath.inc.php'); echo plugin_topicpath_inline(); ?>
404 <?php if ($menu && $sidebar == 'top') { ?>
405 <!-- Sidebar compat top -->
406 <div class="sidebar">
408 <?php echo $menu_body ?>
410 </div><!-- class="sidebar" -->
411 <?php } // if ($menu && $sidebar == 'top') ?>
414 <?php if ($menu && ($sidebar == 'top' || $sidebar == 'bottom')) { ?>
415 <div class="pkwk_body">
424 // Page title (page name)
426 if ($disable_backlink) {
428 $title = htmlspecialchars($_page);
430 $title = $page; // Search, or something message
436 $title = htmlspecialchars($_page);
439 $title_date = $title_text = '';
440 switch($title_design_date){
441 case 1: $title_date = & $title; break;
442 case 0: $title_text = & $title; break;
444 // Show both (for debug or someting)
445 $title_date = & $title;
446 $title_text = & $title;
450 <h2><span class="date"><?php echo $title_date ?></span>
451 <span class="title"><?php echo $title_text ?></span></h2>
454 <div class="section">
456 // For read and preview: tDiary have no <h2> inside body
457 $body = preg_replace('#<h2 ([^>]*)>(.*?)<a class="anchor_super" ([^>]*)>.*?</a></h2>#',
458 '<h3 $1><a $3><span class="sanchor">_</span></a> $2</h3>', $body);
459 $body = preg_replace('#<h([34]) ([^>]*)>(.*?)<a class="anchor_super" ([^>]*)>.*?</a></h\1>#',
460 '<h$1 $2><a $4>_</a> $3</h$1>', $body);
461 $body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
462 '<h3 $1><span class="sanchor">_</span> $2</h3>', $body);
467 // Edit, preview, search, etc
468 echo preg_replace('/(<form) (action="' . preg_quote($script, '/') .
469 ')/', '$1 class="update" $2', $body);
473 </div><!-- class="body" -->
476 <?php if ($notes != '') { ?>
477 <div class="comment"><!-- Design for tDiary "Comments" -->
478 <div class="caption"> </div>
479 <div class="commentbody"><br/>
481 $notes = preg_replace('#<span class="small">(.*?)</span>#', '<p>$1</p>', $notes);
482 echo preg_replace('#<a (id="notefoot_[^>]*)>(.*?)</a>#',
483 '<div class="commentator"><a $1><span class="canchor"></span> ' .
484 '<span class="commentator">$2</span></a>' .
485 '<span class="commenttime"></span></div>', $notes);
491 <?php if ($attaches != '') { ?>
492 <div class="comment">
493 <div class="caption"> </div>
494 <div class="commentshort">
495 <?php echo $attaches ?>
500 <?php if ($related != '') { ?>
501 <div class="comment">
502 <div class="caption"> </div>
503 <div class="commentshort">
504 Link: <?php echo $related ?>
509 <!-- Design for tDiary "Today's referrer" -->
510 <div class="referer"><?php if ($lastmodified != '') echo 'Last-modified: ' . $lastmodified; ?></div>
512 </div><!-- class="day" -->
517 <?php if ($menu && $sidebar == 'another') { ?>
518 </div><!-- class="main" -->
519 </div><!-- class="pkwk_body" -->
521 <!-- Sidebar another -->
522 <div class="pkwk_body">
524 <div class="calendar"></div>
527 <h2><span class="date"></span><span class="title"> </span></h2>
529 <div class="section">
530 <?php echo $menu_body ?>
533 <div class="referer"></div>
536 </div><!-- class="pkwk_body" -->
538 <div class="pkwk_body">
540 <?php } // if ($menu && $sidebar == 'another') ?>
543 <?php if ($menu && ($sidebar == 'top' || $sidebar == 'bottom')) { ?>
544 </div><!-- class="main" -->
545 </div><!-- class="pkwk_body" -->
549 <?php if ($menu && $sidebar == 'bottom') { ?>
550 <!-- Sidebar compat bottom -->
551 <div class="sidebar">
553 <?php echo $menu_body ?>
555 </div><!-- class="sidebar" -->
556 <?php } // if ($menu && $sidebar == 'bottom') ?>
560 <?php if (PKWK_SKIN_SHOW_TOOLBAR) { ?>
564 // Set toolbar-specific images
565 $_IMAGE['skin']['reload'] = 'reload.png';
566 $_IMAGE['skin']['new'] = 'new.png';
567 $_IMAGE['skin']['edit'] = 'edit.png';
568 $_IMAGE['skin']['freeze'] = 'freeze.png';
569 $_IMAGE['skin']['unfreeze'] = 'unfreeze.png';
570 $_IMAGE['skin']['diff'] = 'diff.png';
571 $_IMAGE['skin']['upload'] = 'file.png';
572 $_IMAGE['skin']['copy'] = 'copy.png';
573 $_IMAGE['skin']['rename'] = 'rename.png';
574 $_IMAGE['skin']['top'] = 'top.png';
575 $_IMAGE['skin']['list'] = 'list.png';
576 $_IMAGE['skin']['search'] = 'search.png';
577 $_IMAGE['skin']['recent'] = 'recentchanges.png';
578 $_IMAGE['skin']['backup'] = 'backup.png';
579 $_IMAGE['skin']['help'] = 'help.png';
580 $_IMAGE['skin']['rss'] = 'rss.png';
581 $_IMAGE['skin']['rss10'] = & $_IMAGE['skin']['rss'];
582 $_IMAGE['skin']['rss20'] = 'rss20.png';
583 $_IMAGE['skin']['rdf'] = 'rdf.png';
585 function _toolbar($key, $x = 20, $y = 20){
586 $lang = & $GLOBALS['_LANG']['skin'];
587 $link = & $GLOBALS['_LINK'];
588 $image = & $GLOBALS['_IMAGE']['skin'];
589 if (! isset($lang[$key]) ) { echo 'LANG NOT FOUND'; return FALSE; }
590 if (! isset($link[$key]) ) { echo 'LINK NOT FOUND'; return FALSE; }
591 if (! isset($image[$key])) { echo 'IMAGE NOT FOUND'; return FALSE; }
593 echo '<a href="' . $link[$key] . '">' .
594 '<img src="' . IMAGE_DIR . $image[$key] . '" width="' . $x . '" height="' . $y . '" ' .
595 'alt="' . $lang[$key] . '" title="' . $lang[$key] . '" />' .
600 <?php _toolbar('top') ?>
602 <?php if ($is_page) { ?>
604 <?php _toolbar('edit') ?>
605 <?php if ($is_read && $function_freeze) { ?>
606 <?php if (! $is_freeze) { _toolbar('freeze'); } else { _toolbar('unfreeze'); } ?>
608 <?php _toolbar('diff') ?>
609 <?php if ($do_backup) { ?>
610 <?php _toolbar('backup') ?>
612 <?php if ((bool)ini_get('file_uploads')) { ?>
613 <?php _toolbar('upload') ?>
615 <?php _toolbar('copy') ?>
616 <?php _toolbar('rename') ?>
617 <?php _toolbar('reload') ?>
620 <?php _toolbar('new') ?>
621 <?php _toolbar('list') ?>
622 <?php _toolbar('search') ?>
623 <?php _toolbar('recent') ?>
624 <?php _toolbar('help') ?>
625 <?php _toolbar('rss10', 36, 14) ?>
627 <?php } // PKWK_SKIN_SHOW_TOOLBAR ?>
629 <!-- Copyright etc -->
630 Site admin: <a href="<?php echo $modifierlink ?>"><?php echo $modifier ?></a><p />
631 <?php echo S_COPYRIGHT ?>.
632 Powered by PHP <?php echo PHP_VERSION ?><br />
633 HTML convert time: <?php echo $taketime ?> sec.
635 </div><!-- class="footer" -->
637 <?php if ($menu && ($sidebar != 'top' && $sidebar != 'bottom')) { ?>
638 </div><!-- class="main" -->
639 </div><!-- class="pkwk_body" -->