2 // PukiWiki - Yet another WikiWikiWeb clone.
3 // $Id: tdiary.skin.php,v 1.15 2005/01/22 15:03:33 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 CSS color theme (testing)
67 case 'black-lingerie':
89 case 'white-lingerie':
97 // Another theme needed?
102 case 'smoking_black':
106 // Select title design (which is fancy, date and text?)
107 $title_design_date = 1; // Default: Select the date desin, or 'the same design'
108 switch(TDIARY_THEME){
111 case 'black-lingerie':
114 case 'book2-feminine':
144 case 'white-lingerie':
147 $title_design_date = 0; // Select text design
155 $title_design_date = 2;
159 // Sidebar: default position
160 if (defined('TDIARY_SIDEBAR_POSITION')) {
161 $sidebar = TDIARY_SIDEBAR_POSITION;
163 // Themes including sidebar CSS < (AllTheme / 2)
164 // $ grep div.sidebar */*.css | cut -d: -f1 | cut -d/ -f1 | sort | uniq
166 // 75 list-sidebar.txt
168 $sidebar = 'another'; // Default: Show as an another page below
169 switch(TDIARY_THEME){
170 case '3minutes': /*FALLTHROUGH*/
180 case 'book2-feminine':
234 case 'smoking_black':
235 case 'smoking_white':
242 case 'tinybox_green':
245 $sidebar = 'bottom'; // This is the default position of tDiary's.
249 // Adjust sidebar's default position
250 switch(TDIARY_THEME){
252 // Assuming sidebar is above of the body
253 case 'autumn': /*FALLTHROUGH*/
255 case 'dice': // Sidebar text (white) seems unreadable
259 case 'paper': // Sidebar text (white) seems unreadable
261 case 'tinybox': // For MSIE with narrow window width, seems meanless
262 case 'tinybox_green': // The same
266 // Strict separation between sidebar and main contents needed
267 case '3minutes': /*FALLTHROUGH*/
286 case 'moo': // For MSIE, strict seems meanless
289 case 's-blue': // For MSIE, strict seems meanless
301 // They have sidevar-design, but can not show it at the 'side' of the contents
302 case 'babypink': /*FALLTHROUGH*/
312 case 'smoking_black':
313 $sidebar = 'another'; // Show as an another page below
317 // Check menu (sidebar) is ready and $menubar is there
318 $menu = (arg_check('read') && is_page($GLOBALS['menubar']) &&
319 exist_plugin_convert('menu'));
321 $menu_body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
322 '<h3 $1><span class="sanchor"></span> $2</h3>',
323 do_plugin_convert('menu'));
326 $lang = & $_LANG['skin'];
329 // Decide charset for CSS
330 $css_charset = 'iso-8859-1';
332 case 'ja': $css_charset = 'Shift_JIS'; break;
335 // Output HTTP headers
336 pkwk_common_headers();
337 header('Cache-control: no-cache');
338 header('Pragma: no-cache');
339 header('Content-Type: text/html; charset=' . CONTENT_CHARSET);
341 // Output HTML DTD, <html>, and receive content-type
342 if (isset($pkwk_dtd)) {
343 $meta_content_type = pkwk_output_dtd($pkwk_dtd);
345 $meta_content_type = pkwk_output_dtd();
350 <?php echo $meta_content_type ?>
351 <meta http-equiv="content-style-type" content="text/css" />
352 <?php if (! $is_read) { ?> <meta name="robots" content="NOINDEX,NOFOLLOW" /><?php } ?>
353 <?php if (PKWK_ALLOW_JAVASCRIPT && isset($javascript)) { ?> <meta http-equiv="Content-Script-Type" content="text/javascript" /><?php } ?>
355 <title><?php echo $title ?> - <?php echo $page_title ?></title>
357 <link rel="stylesheet" href="skin/theme/base.css" type="text/css" media="all" />
358 <link rel="stylesheet" href="skin/theme/<?php echo $theme ?>/<?php echo $theme ?>.css" type="text/css" media="all" />
359 <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 ?>" />
360 <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 ?>" />
362 <link rel="alternate" type="application/rss+xml" title="RSS" href="<?php echo $link['rss'] ?>" /><?php // RSS auto-discovery ?>
364 <?php if (PKWK_ALLOW_JAVASCRIPT && $trackback_javascript) { ?> <script type="text/javascript" src="skin/trackback.js"></script><?php } ?>
366 <?php echo $head_tag ?>
368 <body><!-- Theme:<?php echo htmlspecialchars($theme) . ' Sidebar:' . $sidebar ?> -->
370 <?php if ($menu && $sidebar == 'strict') { ?>
372 <div class="sidebar">
374 <?php echo $menu_body ?>
376 </div><!-- class="sidebar" -->
378 <div class="pkwk_body">
380 <?php } // if ($menu && $sidebar == 'strict') ?>
382 <!-- Navigation buttuns -->
383 <div id="navigator"></div>
384 <div class="adminmenu">
386 function _navigator($key, $value = '', $javascript = ''){
387 $lang = $GLOBALS['_LANG']['skin'];
388 $link = $GLOBALS['_LINK'];
389 if (! isset($lang[$key])) { echo 'LANG NOT FOUND'; return FALSE; }
390 if (! isset($link[$key])) { echo 'LINK NOT FOUND'; return FALSE; }
391 if (! PKWK_ALLOW_JAVASCRIPT) $javascript = '';
393 echo '<span class="adminmenu"><a href="' . $link[$key] . '" ' . $javascript . '>' .
394 (($value === '') ? $lang[$key] : $value) .
400 <?php _navigator('top') ?>
402 <?php if ($is_page) { ?>
403 <?php _navigator('edit') ?>
404 <?php if ($is_read && $function_freeze) { ?>
405 <?php (! $is_freeze) ? _navigator('freeze') : _navigator('unfreeze') ?>
407 <?php _navigator('diff') ?>
408 <?php if ($do_backup) { ?>
409 <?php _navigator('backup') ?>
411 <?php if ((bool)ini_get('file_uploads')) { ?>
412 <?php _navigator('upload') ?>
414 <?php _navigator('reload') ?>
418 <?php _navigator('new') ?>
419 <?php _navigator('list') ?>
420 <?php if (arg_check('list')) { ?>
421 <?php _navigator('filelist') ?>
423 <?php _navigator('search') ?>
424 <?php _navigator('recent') ?>
425 <?php _navigator('help') ?>
427 <?php if ($trackback) { ?>
428 <?php _navigator('trackback', $lang['trackback'] . '(' . tb_count($_page) . ')',
429 ($trackback_javascript == 1) ? 'onClick="OpenTrackback(this.href); return false"' : '') ?>
431 <?php if ($referer) { ?>
432 <?php _navigator('refer') ?>
436 <h1><?php echo $page_title ?></h1>
438 <div class="calendar">
439 <?php if ($is_page && TDIARY_CALENDAR_DESIGN !== NULL) { ?>
440 <?php if(TDIARY_CALENDAR_DESIGN) { ?>
441 <a href="<?php echo $link['reload'] ?>"><span class="small"><?php echo $link['reload'] ?></span></a>
443 <?php require_once(PLUGIN_DIR . 'topicpath.inc.php'); echo plugin_topicpath_inline(); ?>
449 <?php if ($menu && $sidebar == 'top') { ?>
450 <!-- Sidebar compat top -->
451 <div class="sidebar">
453 <?php echo $menu_body ?>
455 </div><!-- class="sidebar" -->
456 <?php } // if ($menu && $sidebar == 'top') ?>
459 <?php if ($menu && ($sidebar == 'top' || $sidebar == 'bottom')) { ?>
460 <div class="pkwk_body">
469 // Page title (page name)
471 if ($disable_backlink) {
473 $title = htmlspecialchars($_page);
475 $title = $page; // Search, or something message
481 $title = htmlspecialchars($_page);
484 $title_date = $title_text = '';
485 switch($title_design_date){
486 case 1: $title_date = & $title; break;
487 case 0: $title_text = & $title; break;
489 // Show both (for debug or someting)
490 $title_date = & $title;
491 $title_text = & $title;
495 <h2><span class="date"><?php echo $title_date ?></span>
496 <span class="title"><?php echo $title_text ?></span></h2>
499 <div class="section">
501 // For read and preview: tDiary have no <h2> inside body
502 $body = preg_replace('#<h2 ([^>]*)>(.*?)<a class="anchor_super" ([^>]*)>.*?</a></h2>#',
503 '<h3 $1><a $3><span class="sanchor">_</span></a> $2</h3>', $body);
504 $body = preg_replace('#<h([34]) ([^>]*)>(.*?)<a class="anchor_super" ([^>]*)>.*?</a></h\1>#',
505 '<h$1 $2><a $4>_</a> $3</h$1>', $body);
506 $body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
507 '<h3 $1><span class="sanchor">_</span> $2</h3>', $body);
512 // Edit, preview, search, etc
513 echo preg_replace('/(<form) (action="' . preg_quote($script, '/') .
514 ')/', '$1 class="update" $2', $body);
518 </div><!-- class="body" -->
521 <?php if ($notes != '') { ?>
522 <div class="comment"><!-- Design for tDiary "Comments" -->
523 <div class="caption"> </div>
524 <div class="commentbody"><br/>
526 $notes = preg_replace('#<span class="small">(.*?)</span>#', '<p>$1</p>', $notes);
527 echo preg_replace('#<a (id="notefoot_[^>]*)>(.*?)</a>#',
528 '<div class="commentator"><a $1><span class="canchor"></span> ' .
529 '<span class="commentator">$2</span></a>' .
530 '<span class="commenttime"></span></div>', $notes);
536 <?php if ($attaches != '') { ?>
537 <div class="comment">
538 <div class="caption"> </div>
539 <div class="commentshort">
540 <?php echo $attaches ?>
545 <?php if ($related != '') { ?>
546 <div class="comment">
547 <div class="caption"> </div>
548 <div class="commentshort">
549 Link: <?php echo $related ?>
554 <!-- Design for tDiary "Today's referrer" -->
555 <div class="referer"><?php if ($lastmodified != '') echo 'Last-modified: ' . $lastmodified; ?></div>
557 </div><!-- class="day" -->
562 <?php if ($menu && $sidebar == 'another') { ?>
563 </div><!-- class="main" -->
564 </div><!-- class="pkwk_body" -->
566 <!-- Sidebar another -->
567 <div class="pkwk_body">
569 <div class="calendar"></div>
572 <h2><span class="date"></span><span class="title"> </span></h2>
574 <div class="section">
575 <?php echo $menu_body ?>
578 <div class="referer"></div>
581 </div><!-- class="pkwk_body" -->
583 <div class="pkwk_body">
585 <?php } // if ($menu && $sidebar == 'another') ?>
588 <?php if ($menu && ($sidebar == 'top' || $sidebar == 'bottom')) { ?>
589 </div><!-- class="main" -->
590 </div><!-- class="pkwk_body" -->
594 <?php if ($menu && $sidebar == 'bottom') { ?>
595 <!-- Sidebar compat bottom -->
596 <div class="sidebar">
598 <?php echo $menu_body ?>
600 </div><!-- class="sidebar" -->
601 <?php } // if ($menu && $sidebar == 'bottom') ?>
605 <?php if (PKWK_SKIN_SHOW_TOOLBAR) { ?>
609 // Set toolbar-specific images
610 $_IMAGE['skin']['reload'] = 'reload.png';
611 $_IMAGE['skin']['new'] = 'new.png';
612 $_IMAGE['skin']['edit'] = 'edit.png';
613 $_IMAGE['skin']['freeze'] = 'freeze.png';
614 $_IMAGE['skin']['unfreeze'] = 'unfreeze.png';
615 $_IMAGE['skin']['diff'] = 'diff.png';
616 $_IMAGE['skin']['upload'] = 'file.png';
617 $_IMAGE['skin']['copy'] = 'copy.png';
618 $_IMAGE['skin']['rename'] = 'rename.png';
619 $_IMAGE['skin']['top'] = 'top.png';
620 $_IMAGE['skin']['list'] = 'list.png';
621 $_IMAGE['skin']['search'] = 'search.png';
622 $_IMAGE['skin']['recent'] = 'recentchanges.png';
623 $_IMAGE['skin']['backup'] = 'backup.png';
624 $_IMAGE['skin']['help'] = 'help.png';
625 $_IMAGE['skin']['rss'] = 'rss.png';
626 $_IMAGE['skin']['rss10'] = & $_IMAGE['skin']['rss'];
627 $_IMAGE['skin']['rss20'] = 'rss20.png';
628 $_IMAGE['skin']['rdf'] = 'rdf.png';
630 function _toolbar($key, $x = 20, $y = 20){
631 $lang = & $GLOBALS['_LANG']['skin'];
632 $link = & $GLOBALS['_LINK'];
633 $image = & $GLOBALS['_IMAGE']['skin'];
634 if (! isset($lang[$key]) ) { echo 'LANG NOT FOUND'; return FALSE; }
635 if (! isset($link[$key]) ) { echo 'LINK NOT FOUND'; return FALSE; }
636 if (! isset($image[$key])) { echo 'IMAGE NOT FOUND'; return FALSE; }
638 echo '<a href="' . $link[$key] . '">' .
639 '<img src="' . IMAGE_DIR . $image[$key] . '" width="' . $x . '" height="' . $y . '" ' .
640 'alt="' . $lang[$key] . '" title="' . $lang[$key] . '" />' .
645 <?php _toolbar('top') ?>
647 <?php if ($is_page) { ?>
649 <?php _toolbar('edit') ?>
650 <?php if ($is_read && $function_freeze) { ?>
651 <?php if (! $is_freeze) { _toolbar('freeze'); } else { _toolbar('unfreeze'); } ?>
653 <?php _toolbar('diff') ?>
654 <?php if ($do_backup) { ?>
655 <?php _toolbar('backup') ?>
657 <?php if ((bool)ini_get('file_uploads')) { ?>
658 <?php _toolbar('upload') ?>
660 <?php _toolbar('copy') ?>
661 <?php _toolbar('rename') ?>
662 <?php _toolbar('reload') ?>
665 <?php _toolbar('new') ?>
666 <?php _toolbar('list') ?>
667 <?php _toolbar('search') ?>
668 <?php _toolbar('recent') ?>
669 <?php _toolbar('help') ?>
670 <?php _toolbar('rss10', 36, 14) ?>
672 <?php } // PKWK_SKIN_SHOW_TOOLBAR ?>
674 <!-- Copyright etc -->
675 Site admin: <a href="<?php echo $modifierlink ?>"><?php echo $modifier ?></a><p />
676 <?php echo S_COPYRIGHT ?>.
677 Powered by PHP <?php echo PHP_VERSION ?><br />
678 HTML convert time: <?php echo $taketime ?> sec.
680 </div><!-- class="footer" -->
682 <?php if ($menu && ($sidebar != 'top' && $sidebar != 'bottom')) { ?>
683 </div><!-- class="main" -->
684 </div><!-- class="pkwk_body" -->