2 // PukiWiki - Yet another WikiWikiWeb clone.
3 // $Id: tdiary.skin.php,v 1.18 2005/02/05 07:19:05 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 / Hide navigation bar UI at your choice
19 // NOTE: This is not stop their functionalities!
20 if (! defined('PKWK_SKIN_SHOW_NAVBAR'))
21 define('PKWK_SKIN_SHOW_NAVBAR', 1); // 1, 0
23 // Show toolbar at your choice, with <div class="footer"> design
24 // NOTE: Some theme become looking worse with this!
25 if (! defined('PKWK_SKIN_SHOW_TOOLBAR'))
26 define('PKWK_SKIN_SHOW_TOOLBAR', 0); // 0, 1
29 // Prohibit direct access
30 if (! defined('UI_LANG')) die('UI_LANG is not set');
31 if (! isset($_LANG)) die('$_LANG is not set');
32 if (! defined('PKWK_READONLY')) die('PKWK_READONLY is not set');
35 $theme = TDIARY_THEME;
36 if ($theme == '' || $theme == 'TDIARY_THEME') {
37 die('Theme is not specified. Set "TDIARY_THEME" correctly');
39 $theme = rawurlencode($theme); // Supress all nasty letters
40 $theme_css = SKIN_DIR . 'theme/' . $theme . '/' . $theme . '.css';
41 if (! file_exists($theme_css)) {
42 echo 'tDiary theme wrapper: ';
43 echo 'Theme not found: ' . htmlspecialchars($theme_css) . '<br/>';
44 echo 'You can get tdiary-theme from: ';
45 echo 'http://sourceforge.net/projects/tdiary/';
50 // Adjust DTD (between theme(=CSS) and MSIE bug)
52 // PukiWiki default: PKWK_DTD_XHTML_1_1
53 // tDiary's default: PKWK_DTD_HTML_4_01_STRICT
56 $pkwk_dtd = PKWK_DTD_HTML_4_01_STRICT; // or centering will be ignored via MSIE
60 // Adjust reverse-link default design manually
61 $disable_backlink = FALSE;
63 case 'hatena': /*FALLTHROUGH*/
64 $disable_backlink = TRUE;
68 // Select CSS color theme (testing)
73 case 'black-lingerie':
95 case 'white-lingerie':
101 $css_theme = 'black';
103 // Another theme needed?
108 case 'smoking_black':
112 // Select title design (which is fancy, date and text?)
113 $title_design_date = 1; // Default: Select the date desin, or 'the same design'
114 switch(TDIARY_THEME){
117 case 'black-lingerie':
120 case 'book2-feminine':
150 case 'white-lingerie':
153 $title_design_date = 0; // Select text design
161 $title_design_date = 2;
165 // Sidebar: default position
166 if (defined('TDIARY_SIDEBAR_POSITION')) {
167 $sidebar = TDIARY_SIDEBAR_POSITION;
169 // Themes including sidebar CSS < (AllTheme / 2)
170 // $ grep div.sidebar */*.css | cut -d: -f1 | cut -d/ -f1 | sort | uniq
172 // 75 list-sidebar.txt
174 $sidebar = 'another'; // Default: Show as an another page below
175 switch(TDIARY_THEME){
176 case '3minutes': /*FALLTHROUGH*/
186 case 'book2-feminine':
240 case 'smoking_black':
241 case 'smoking_white':
248 case 'tinybox_green':
251 $sidebar = 'bottom'; // This is the default position of tDiary's.
255 // Adjust sidebar's default position
256 switch(TDIARY_THEME){
258 // Assuming sidebar is above of the body
259 case 'autumn': /*FALLTHROUGH*/
261 case 'dice': // Sidebar text (white) seems unreadable
265 case 'paper': // Sidebar text (white) seems unreadable
267 case 'tinybox': // For MSIE with narrow window width, seems meanless
268 case 'tinybox_green': // The same
272 // Strict separation between sidebar and main contents needed
273 case '3minutes': /*FALLTHROUGH*/
292 case 'moo': // For MSIE, strict seems meanless
295 case 's-blue': // For MSIE, strict seems meanless
307 // They have sidevar-design, but can not show it at the 'side' of the contents
308 case 'babypink': /*FALLTHROUGH*/
318 case 'smoking_black':
319 $sidebar = 'another'; // Show as an another page below
323 // Check menu (sidebar) is ready and $menubar is there
324 $menu = (arg_check('read') && is_page($GLOBALS['menubar']) &&
325 exist_plugin_convert('menu'));
327 $menu_body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
328 '<h3 $1><span class="sanchor"></span> $2</h3>',
329 do_plugin_convert('menu'));
332 $lang = & $_LANG['skin'];
334 $rw = ! PKWK_READONLY;
336 // Decide charset for CSS
337 $css_charset = 'iso-8859-1';
339 case 'ja': $css_charset = 'Shift_JIS'; break;
342 // Output HTTP headers
343 pkwk_common_headers();
344 header('Cache-control: no-cache');
345 header('Pragma: no-cache');
346 header('Content-Type: text/html; charset=' . CONTENT_CHARSET);
348 // Output HTML DTD, <html>, and receive content-type
349 if (isset($pkwk_dtd)) {
350 $meta_content_type = pkwk_output_dtd($pkwk_dtd);
352 $meta_content_type = pkwk_output_dtd();
357 <?php echo $meta_content_type ?>
358 <meta http-equiv="content-style-type" content="text/css" />
359 <?php if (! $is_read) { ?> <meta name="robots" content="NOINDEX,NOFOLLOW" /><?php } ?>
360 <?php if (PKWK_ALLOW_JAVASCRIPT && isset($javascript)) { ?> <meta http-equiv="Content-Script-Type" content="text/javascript" /><?php } ?>
362 <title><?php echo $title ?> - <?php echo $page_title ?></title>
364 <link rel="stylesheet" href="skin/theme/base.css" type="text/css" media="all" />
365 <link rel="stylesheet" href="skin/theme/<?php echo $theme ?>/<?php echo $theme ?>.css" type="text/css" media="all" />
366 <link rel="stylesheet" href="skin/tdiary.css.php?charset=<?php echo $css_charset ?>&color=<?php echo $css_theme ?>" type="text/css" media="screen" charset="<?php echo $css_charset ?>" />
367 <link rel="stylesheet" href="skin/tdiary.css.php?charset=<?php echo $css_charset ?>&color=<?php echo $css_theme ?>&media=print" type="text/css" media="print" charset="<?php echo $css_charset ?>" />
369 <link rel="alternate" type="application/rss+xml" title="RSS" href="<?php echo $link['rss'] ?>" /><?php // RSS auto-discovery ?>
371 <?php if (PKWK_ALLOW_JAVASCRIPT && $trackback_javascript) { ?> <script type="text/javascript" src="skin/trackback.js"></script><?php } ?>
373 <?php echo $head_tag ?>
375 <body><!-- Theme:<?php echo htmlspecialchars($theme) . ' Sidebar:' . $sidebar ?> -->
377 <?php if ($menu && $sidebar == 'strict') { ?>
379 <div class="sidebar">
381 <?php echo $menu_body ?>
383 </div><!-- class="sidebar" -->
385 <div class="pkwk_body">
387 <?php } // if ($menu && $sidebar == 'strict') ?>
389 <!-- Navigation buttuns -->
390 <?php if (PKWK_SKIN_SHOW_NAVBAR) { ?>
391 <div class="adminmenu"><div id="navigator">
393 function _navigator($key, $value = '', $javascript = ''){
394 $lang = $GLOBALS['_LANG']['skin'];
395 $link = $GLOBALS['_LINK'];
396 if (! isset($lang[$key])) { echo 'LANG NOT FOUND'; return FALSE; }
397 if (! isset($link[$key])) { echo 'LINK NOT FOUND'; return FALSE; }
398 if (! PKWK_ALLOW_JAVASCRIPT) $javascript = '';
400 echo '<span class="adminmenu"><a href="' . $link[$key] . '" ' . $javascript . '>' .
401 (($value === '') ? $lang[$key] : $value) .
407 <?php _navigator('top') ?>
409 <?php if ($is_page) { ?>
411 <?php _navigator('edit') ?>
412 <?php if ($is_read && $function_freeze) { ?>
413 <?php (! $is_freeze) ? _navigator('freeze') : _navigator('unfreeze') ?>
416 <?php _navigator('diff') ?>
417 <?php if ($do_backup) { ?>
418 <?php _navigator('backup') ?>
420 <?php if ($rw && (bool)ini_get('file_uploads')) { ?>
421 <?php _navigator('upload') ?>
423 <?php _navigator('reload') ?>
428 <?php _navigator('new') ?>
430 <?php _navigator('list') ?>
431 <?php if (arg_check('list')) { ?>
432 <?php _navigator('filelist') ?>
434 <?php _navigator('search') ?>
435 <?php _navigator('recent') ?>
436 <?php _navigator('help') ?>
438 <?php if ($trackback) { ?>
439 <?php _navigator('trackback', $lang['trackback'] . '(' . tb_count($_page) . ')',
440 ($trackback_javascript == 1) ? 'onClick="OpenTrackback(this.href); return false"' : '') ?>
442 <?php if ($referer) { ?>
443 <?php _navigator('refer') ?>
447 <div id="navigator"></div>
448 <?php } // PKWK_SKIN_SHOW_NAVBAR ?>
450 <h1><?php echo $page_title ?></h1>
452 <div class="calendar">
453 <?php if ($is_page && TDIARY_CALENDAR_DESIGN !== NULL) { ?>
454 <?php if(TDIARY_CALENDAR_DESIGN) { ?>
455 <a href="<?php echo $link['reload'] ?>"><span class="small"><?php echo $link['reload'] ?></span></a>
457 <?php require_once(PLUGIN_DIR . 'topicpath.inc.php'); echo plugin_topicpath_inline(); ?>
463 <?php if ($menu && $sidebar == 'top') { ?>
464 <!-- Sidebar compat top -->
465 <div class="sidebar">
467 <?php echo $menu_body ?>
469 </div><!-- class="sidebar" -->
470 <?php } // if ($menu && $sidebar == 'top') ?>
473 <?php if ($menu && ($sidebar == 'top' || $sidebar == 'bottom')) { ?>
474 <div class="pkwk_body">
483 // Page title (page name)
485 if ($disable_backlink) {
487 $title = htmlspecialchars($_page);
489 $title = $page; // Search, or something message
495 $title = htmlspecialchars($_page);
498 $title_date = $title_text = '';
499 switch($title_design_date){
500 case 1: $title_date = & $title; break;
501 case 0: $title_text = & $title; break;
503 // Show both (for debug or someting)
504 $title_date = & $title;
505 $title_text = & $title;
509 <h2><span class="date"><?php echo $title_date ?></span>
510 <span class="title"><?php echo $title_text ?></span></h2>
513 <div class="section">
515 // For read and preview: tDiary have no <h2> inside body
516 $body = preg_replace('#<h2 ([^>]*)>(.*?)<a class="anchor_super" ([^>]*)>.*?</a></h2>#',
517 '<h3 $1><a $3><span class="sanchor">_</span></a> $2</h3>', $body);
518 $body = preg_replace('#<h([34]) ([^>]*)>(.*?)<a class="anchor_super" ([^>]*)>.*?</a></h\1>#',
519 '<h$1 $2><a $4>_</a> $3</h$1>', $body);
520 $body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
521 '<h3 $1><span class="sanchor">_</span> $2</h3>', $body);
526 // Edit, preview, search, etc
527 echo preg_replace('/(<form) (action="' . preg_quote($script, '/') .
528 ')/', '$1 class="update" $2', $body);
532 </div><!-- class="body" -->
535 <?php if ($notes != '') { ?>
536 <div class="comment"><!-- Design for tDiary "Comments" -->
537 <div class="caption"> </div>
538 <div class="commentbody"><br/>
540 $notes = preg_replace('#<span class="small">(.*?)</span>#', '<p>$1</p>', $notes);
541 echo preg_replace('#<a (id="notefoot_[^>]*)>(.*?)</a>#',
542 '<div class="commentator"><a $1><span class="canchor"></span> ' .
543 '<span class="commentator">$2</span></a>' .
544 '<span class="commenttime"></span></div>', $notes);
550 <?php if ($attaches != '') { ?>
551 <div class="comment">
552 <div class="caption"> </div>
553 <div class="commentshort">
554 <?php echo $attaches ?>
559 <?php if ($related != '') { ?>
560 <div class="comment">
561 <div class="caption"> </div>
562 <div class="commentshort">
563 Link: <?php echo $related ?>
568 <!-- Design for tDiary "Today's referrer" -->
569 <div class="referer"><?php if ($lastmodified != '') echo 'Last-modified: ' . $lastmodified; ?></div>
571 </div><!-- class="day" -->
576 <?php if ($menu && $sidebar == 'another') { ?>
577 </div><!-- class="main" -->
578 </div><!-- class="pkwk_body" -->
580 <!-- Sidebar another -->
581 <div class="pkwk_body">
583 <div class="calendar"></div>
586 <h2><span class="date"></span><span class="title"> </span></h2>
588 <div class="section">
589 <?php echo $menu_body ?>
592 <div class="referer"></div>
595 </div><!-- class="pkwk_body" -->
597 <div class="pkwk_body">
599 <?php } // if ($menu && $sidebar == 'another') ?>
602 <?php if ($menu && ($sidebar == 'top' || $sidebar == 'bottom')) { ?>
603 </div><!-- class="main" -->
604 </div><!-- class="pkwk_body" -->
608 <?php if ($menu && $sidebar == 'bottom') { ?>
609 <!-- Sidebar compat bottom -->
610 <div class="sidebar">
612 <?php echo $menu_body ?>
614 </div><!-- class="sidebar" -->
615 <?php } // if ($menu && $sidebar == 'bottom') ?>
619 <?php if (PKWK_SKIN_SHOW_TOOLBAR) { ?>
623 // Set toolbar-specific images
624 $_IMAGE['skin']['reload'] = 'reload.png';
625 $_IMAGE['skin']['new'] = 'new.png';
626 $_IMAGE['skin']['edit'] = 'edit.png';
627 $_IMAGE['skin']['freeze'] = 'freeze.png';
628 $_IMAGE['skin']['unfreeze'] = 'unfreeze.png';
629 $_IMAGE['skin']['diff'] = 'diff.png';
630 $_IMAGE['skin']['upload'] = 'file.png';
631 $_IMAGE['skin']['copy'] = 'copy.png';
632 $_IMAGE['skin']['rename'] = 'rename.png';
633 $_IMAGE['skin']['top'] = 'top.png';
634 $_IMAGE['skin']['list'] = 'list.png';
635 $_IMAGE['skin']['search'] = 'search.png';
636 $_IMAGE['skin']['recent'] = 'recentchanges.png';
637 $_IMAGE['skin']['backup'] = 'backup.png';
638 $_IMAGE['skin']['help'] = 'help.png';
639 $_IMAGE['skin']['rss'] = 'rss.png';
640 $_IMAGE['skin']['rss10'] = & $_IMAGE['skin']['rss'];
641 $_IMAGE['skin']['rss20'] = 'rss20.png';
642 $_IMAGE['skin']['rdf'] = 'rdf.png';
644 function _toolbar($key, $x = 20, $y = 20){
645 $lang = & $GLOBALS['_LANG']['skin'];
646 $link = & $GLOBALS['_LINK'];
647 $image = & $GLOBALS['_IMAGE']['skin'];
648 if (! isset($lang[$key]) ) { echo 'LANG NOT FOUND'; return FALSE; }
649 if (! isset($link[$key]) ) { echo 'LINK NOT FOUND'; return FALSE; }
650 if (! isset($image[$key])) { echo 'IMAGE NOT FOUND'; return FALSE; }
652 echo '<a href="' . $link[$key] . '">' .
653 '<img src="' . IMAGE_DIR . $image[$key] . '" width="' . $x . '" height="' . $y . '" ' .
654 'alt="' . $lang[$key] . '" title="' . $lang[$key] . '" />' .
659 <?php _toolbar('top') ?>
661 <?php if ($is_page) { ?>
664 <?php _toolbar('edit') ?>
665 <?php if ($is_read && $function_freeze) { ?>
666 <?php if (! $is_freeze) { _toolbar('freeze'); } else { _toolbar('unfreeze'); } ?>
669 <?php _toolbar('diff') ?>
670 <?php if ($do_backup) { ?>
671 <?php _toolbar('backup') ?>
673 <?php if ($rw && (bool)ini_get('file_uploads')) { ?>
674 <?php _toolbar('upload') ?>
677 <?php _toolbar('copy') ?>
678 <?php _toolbar('rename') ?>
680 <?php _toolbar('reload') ?>
684 <?php _toolbar('new') ?>
686 <?php _toolbar('list') ?>
687 <?php _toolbar('search') ?>
688 <?php _toolbar('recent') ?>
689 <?php _toolbar('help') ?>
690 <?php _toolbar('rss10', 36, 14) ?>
692 <?php } // PKWK_SKIN_SHOW_TOOLBAR ?>
694 <!-- Copyright etc -->
695 Site admin: <a href="<?php echo $modifierlink ?>"><?php echo $modifier ?></a><p />
696 <?php echo S_COPYRIGHT ?>.
697 Powered by PHP <?php echo PHP_VERSION ?><br />
698 HTML convert time: <?php echo $taketime ?> sec.
700 </div><!-- class="footer" -->
702 <?php if ($menu && ($sidebar != 'top' && $sidebar != 'bottom')) { ?>
703 </div><!-- class="main" -->
704 </div><!-- class="pkwk_body" -->