2 // PukiWiki - Yet another WikiWikiWeb clone.
3 // $Id: tdiary.skin.php,v 1.16 2005/01/23 11:54:26 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');
27 if (! defined('PKWK_READONLY')) die('PKWK_READONLY is not set');
30 $theme = TDIARY_THEME;
31 if ($theme == '' || $theme == 'TDIARY_THEME') {
32 die('Theme is not specified. Set "TDIARY_THEME" correctly');
34 $theme = rawurlencode($theme); // Supress all nasty letters
35 $theme_css = SKIN_DIR . 'theme/' . $theme . '/' . $theme . '.css';
36 if (! file_exists($theme_css)) {
37 echo 'tDiary theme wrapper: ';
38 echo 'Theme not found: ' . htmlspecialchars($theme_css) . '<br/>';
39 echo 'You can get tdiary-theme from: ';
40 echo 'http://sourceforge.net/projects/tdiary/';
45 // Adjust DTD (between theme(=CSS) and MSIE bug)
47 // PukiWiki default: PKWK_DTD_XHTML_1_1
48 // tDiary's default: PKWK_DTD_HTML_4_01_STRICT
51 $pkwk_dtd = PKWK_DTD_HTML_4_01_STRICT; // or centering will be ignored via MSIE
55 // Adjust reverse-link default design manually
56 $disable_backlink = FALSE;
58 case 'hatena': /*FALLTHROUGH*/
59 $disable_backlink = TRUE;
63 // Select CSS color theme (testing)
68 case 'black-lingerie':
90 case 'white-lingerie':
98 // Another theme needed?
103 case 'smoking_black':
107 // Select title design (which is fancy, date and text?)
108 $title_design_date = 1; // Default: Select the date desin, or 'the same design'
109 switch(TDIARY_THEME){
112 case 'black-lingerie':
115 case 'book2-feminine':
145 case 'white-lingerie':
148 $title_design_date = 0; // Select text design
156 $title_design_date = 2;
160 // Sidebar: default position
161 if (defined('TDIARY_SIDEBAR_POSITION')) {
162 $sidebar = TDIARY_SIDEBAR_POSITION;
164 // Themes including sidebar CSS < (AllTheme / 2)
165 // $ grep div.sidebar */*.css | cut -d: -f1 | cut -d/ -f1 | sort | uniq
167 // 75 list-sidebar.txt
169 $sidebar = 'another'; // Default: Show as an another page below
170 switch(TDIARY_THEME){
171 case '3minutes': /*FALLTHROUGH*/
181 case 'book2-feminine':
235 case 'smoking_black':
236 case 'smoking_white':
243 case 'tinybox_green':
246 $sidebar = 'bottom'; // This is the default position of tDiary's.
250 // Adjust sidebar's default position
251 switch(TDIARY_THEME){
253 // Assuming sidebar is above of the body
254 case 'autumn': /*FALLTHROUGH*/
256 case 'dice': // Sidebar text (white) seems unreadable
260 case 'paper': // Sidebar text (white) seems unreadable
262 case 'tinybox': // For MSIE with narrow window width, seems meanless
263 case 'tinybox_green': // The same
267 // Strict separation between sidebar and main contents needed
268 case '3minutes': /*FALLTHROUGH*/
287 case 'moo': // For MSIE, strict seems meanless
290 case 's-blue': // For MSIE, strict seems meanless
302 // They have sidevar-design, but can not show it at the 'side' of the contents
303 case 'babypink': /*FALLTHROUGH*/
313 case 'smoking_black':
314 $sidebar = 'another'; // Show as an another page below
318 // Check menu (sidebar) is ready and $menubar is there
319 $menu = (arg_check('read') && is_page($GLOBALS['menubar']) &&
320 exist_plugin_convert('menu'));
322 $menu_body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
323 '<h3 $1><span class="sanchor"></span> $2</h3>',
324 do_plugin_convert('menu'));
327 $lang = & $_LANG['skin'];
329 $rw = ! PKWK_READONLY;
331 // Decide charset for CSS
332 $css_charset = 'iso-8859-1';
334 case 'ja': $css_charset = 'Shift_JIS'; break;
337 // Output HTTP headers
338 pkwk_common_headers();
339 header('Cache-control: no-cache');
340 header('Pragma: no-cache');
341 header('Content-Type: text/html; charset=' . CONTENT_CHARSET);
343 // Output HTML DTD, <html>, and receive content-type
344 if (isset($pkwk_dtd)) {
345 $meta_content_type = pkwk_output_dtd($pkwk_dtd);
347 $meta_content_type = pkwk_output_dtd();
352 <?php echo $meta_content_type ?>
353 <meta http-equiv="content-style-type" content="text/css" />
354 <?php if (! $is_read) { ?> <meta name="robots" content="NOINDEX,NOFOLLOW" /><?php } ?>
355 <?php if (PKWK_ALLOW_JAVASCRIPT && isset($javascript)) { ?> <meta http-equiv="Content-Script-Type" content="text/javascript" /><?php } ?>
357 <title><?php echo $title ?> - <?php echo $page_title ?></title>
359 <link rel="stylesheet" href="skin/theme/base.css" type="text/css" media="all" />
360 <link rel="stylesheet" href="skin/theme/<?php echo $theme ?>/<?php echo $theme ?>.css" type="text/css" media="all" />
361 <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 ?>" />
362 <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 ?>" />
364 <link rel="alternate" type="application/rss+xml" title="RSS" href="<?php echo $link['rss'] ?>" /><?php // RSS auto-discovery ?>
366 <?php if (PKWK_ALLOW_JAVASCRIPT && $trackback_javascript) { ?> <script type="text/javascript" src="skin/trackback.js"></script><?php } ?>
368 <?php echo $head_tag ?>
370 <body><!-- Theme:<?php echo htmlspecialchars($theme) . ' Sidebar:' . $sidebar ?> -->
372 <?php if ($menu && $sidebar == 'strict') { ?>
374 <div class="sidebar">
376 <?php echo $menu_body ?>
378 </div><!-- class="sidebar" -->
380 <div class="pkwk_body">
382 <?php } // if ($menu && $sidebar == 'strict') ?>
384 <!-- Navigation buttuns -->
385 <div id="navigator"><div class="adminmenu">
387 function _navigator($key, $value = '', $javascript = ''){
388 $lang = $GLOBALS['_LANG']['skin'];
389 $link = $GLOBALS['_LINK'];
390 if (! isset($lang[$key])) { echo 'LANG NOT FOUND'; return FALSE; }
391 if (! isset($link[$key])) { echo 'LINK NOT FOUND'; return FALSE; }
392 if (! PKWK_ALLOW_JAVASCRIPT) $javascript = '';
394 echo '<span class="adminmenu"><a href="' . $link[$key] . '" ' . $javascript . '>' .
395 (($value === '') ? $lang[$key] : $value) .
401 <?php _navigator('top') ?>
403 <?php if ($is_page) { ?>
405 <?php _navigator('edit') ?>
406 <?php if ($is_read && $function_freeze) { ?>
407 <?php (! $is_freeze) ? _navigator('freeze') : _navigator('unfreeze') ?>
410 <?php _navigator('diff') ?>
411 <?php if ($do_backup) { ?>
412 <?php _navigator('backup') ?>
414 <?php if ($rw && (bool)ini_get('file_uploads')) { ?>
415 <?php _navigator('upload') ?>
417 <?php _navigator('reload') ?>
422 <?php _navigator('new') ?>
424 <?php _navigator('list') ?>
425 <?php if (arg_check('list')) { ?>
426 <?php _navigator('filelist') ?>
428 <?php _navigator('search') ?>
429 <?php _navigator('recent') ?>
430 <?php _navigator('help') ?>
432 <?php if ($trackback) { ?>
433 <?php _navigator('trackback', $lang['trackback'] . '(' . tb_count($_page) . ')',
434 ($trackback_javascript == 1) ? 'onClick="OpenTrackback(this.href); return false"' : '') ?>
436 <?php if ($referer) { ?>
437 <?php _navigator('refer') ?>
441 <h1><?php echo $page_title ?></h1>
443 <div class="calendar">
444 <?php if ($is_page && TDIARY_CALENDAR_DESIGN !== NULL) { ?>
445 <?php if(TDIARY_CALENDAR_DESIGN) { ?>
446 <a href="<?php echo $link['reload'] ?>"><span class="small"><?php echo $link['reload'] ?></span></a>
448 <?php require_once(PLUGIN_DIR . 'topicpath.inc.php'); echo plugin_topicpath_inline(); ?>
454 <?php if ($menu && $sidebar == 'top') { ?>
455 <!-- Sidebar compat top -->
456 <div class="sidebar">
458 <?php echo $menu_body ?>
460 </div><!-- class="sidebar" -->
461 <?php } // if ($menu && $sidebar == 'top') ?>
464 <?php if ($menu && ($sidebar == 'top' || $sidebar == 'bottom')) { ?>
465 <div class="pkwk_body">
474 // Page title (page name)
476 if ($disable_backlink) {
478 $title = htmlspecialchars($_page);
480 $title = $page; // Search, or something message
486 $title = htmlspecialchars($_page);
489 $title_date = $title_text = '';
490 switch($title_design_date){
491 case 1: $title_date = & $title; break;
492 case 0: $title_text = & $title; break;
494 // Show both (for debug or someting)
495 $title_date = & $title;
496 $title_text = & $title;
500 <h2><span class="date"><?php echo $title_date ?></span>
501 <span class="title"><?php echo $title_text ?></span></h2>
504 <div class="section">
506 // For read and preview: tDiary have no <h2> inside body
507 $body = preg_replace('#<h2 ([^>]*)>(.*?)<a class="anchor_super" ([^>]*)>.*?</a></h2>#',
508 '<h3 $1><a $3><span class="sanchor">_</span></a> $2</h3>', $body);
509 $body = preg_replace('#<h([34]) ([^>]*)>(.*?)<a class="anchor_super" ([^>]*)>.*?</a></h\1>#',
510 '<h$1 $2><a $4>_</a> $3</h$1>', $body);
511 $body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
512 '<h3 $1><span class="sanchor">_</span> $2</h3>', $body);
517 // Edit, preview, search, etc
518 echo preg_replace('/(<form) (action="' . preg_quote($script, '/') .
519 ')/', '$1 class="update" $2', $body);
523 </div><!-- class="body" -->
526 <?php if ($notes != '') { ?>
527 <div class="comment"><!-- Design for tDiary "Comments" -->
528 <div class="caption"> </div>
529 <div class="commentbody"><br/>
531 $notes = preg_replace('#<span class="small">(.*?)</span>#', '<p>$1</p>', $notes);
532 echo preg_replace('#<a (id="notefoot_[^>]*)>(.*?)</a>#',
533 '<div class="commentator"><a $1><span class="canchor"></span> ' .
534 '<span class="commentator">$2</span></a>' .
535 '<span class="commenttime"></span></div>', $notes);
541 <?php if ($attaches != '') { ?>
542 <div class="comment">
543 <div class="caption"> </div>
544 <div class="commentshort">
545 <?php echo $attaches ?>
550 <?php if ($related != '') { ?>
551 <div class="comment">
552 <div class="caption"> </div>
553 <div class="commentshort">
554 Link: <?php echo $related ?>
559 <!-- Design for tDiary "Today's referrer" -->
560 <div class="referer"><?php if ($lastmodified != '') echo 'Last-modified: ' . $lastmodified; ?></div>
562 </div><!-- class="day" -->
567 <?php if ($menu && $sidebar == 'another') { ?>
568 </div><!-- class="main" -->
569 </div><!-- class="pkwk_body" -->
571 <!-- Sidebar another -->
572 <div class="pkwk_body">
574 <div class="calendar"></div>
577 <h2><span class="date"></span><span class="title"> </span></h2>
579 <div class="section">
580 <?php echo $menu_body ?>
583 <div class="referer"></div>
586 </div><!-- class="pkwk_body" -->
588 <div class="pkwk_body">
590 <?php } // if ($menu && $sidebar == 'another') ?>
593 <?php if ($menu && ($sidebar == 'top' || $sidebar == 'bottom')) { ?>
594 </div><!-- class="main" -->
595 </div><!-- class="pkwk_body" -->
599 <?php if ($menu && $sidebar == 'bottom') { ?>
600 <!-- Sidebar compat bottom -->
601 <div class="sidebar">
603 <?php echo $menu_body ?>
605 </div><!-- class="sidebar" -->
606 <?php } // if ($menu && $sidebar == 'bottom') ?>
610 <?php if (PKWK_SKIN_SHOW_TOOLBAR) { ?>
614 // Set toolbar-specific images
615 $_IMAGE['skin']['reload'] = 'reload.png';
616 $_IMAGE['skin']['new'] = 'new.png';
617 $_IMAGE['skin']['edit'] = 'edit.png';
618 $_IMAGE['skin']['freeze'] = 'freeze.png';
619 $_IMAGE['skin']['unfreeze'] = 'unfreeze.png';
620 $_IMAGE['skin']['diff'] = 'diff.png';
621 $_IMAGE['skin']['upload'] = 'file.png';
622 $_IMAGE['skin']['copy'] = 'copy.png';
623 $_IMAGE['skin']['rename'] = 'rename.png';
624 $_IMAGE['skin']['top'] = 'top.png';
625 $_IMAGE['skin']['list'] = 'list.png';
626 $_IMAGE['skin']['search'] = 'search.png';
627 $_IMAGE['skin']['recent'] = 'recentchanges.png';
628 $_IMAGE['skin']['backup'] = 'backup.png';
629 $_IMAGE['skin']['help'] = 'help.png';
630 $_IMAGE['skin']['rss'] = 'rss.png';
631 $_IMAGE['skin']['rss10'] = & $_IMAGE['skin']['rss'];
632 $_IMAGE['skin']['rss20'] = 'rss20.png';
633 $_IMAGE['skin']['rdf'] = 'rdf.png';
635 function _toolbar($key, $x = 20, $y = 20){
636 $lang = & $GLOBALS['_LANG']['skin'];
637 $link = & $GLOBALS['_LINK'];
638 $image = & $GLOBALS['_IMAGE']['skin'];
639 if (! isset($lang[$key]) ) { echo 'LANG NOT FOUND'; return FALSE; }
640 if (! isset($link[$key]) ) { echo 'LINK NOT FOUND'; return FALSE; }
641 if (! isset($image[$key])) { echo 'IMAGE NOT FOUND'; return FALSE; }
643 echo '<a href="' . $link[$key] . '">' .
644 '<img src="' . IMAGE_DIR . $image[$key] . '" width="' . $x . '" height="' . $y . '" ' .
645 'alt="' . $lang[$key] . '" title="' . $lang[$key] . '" />' .
650 <?php _toolbar('top') ?>
652 <?php if ($is_page) { ?>
655 <?php _toolbar('edit') ?>
656 <?php if ($is_read && $function_freeze) { ?>
657 <?php if (! $is_freeze) { _toolbar('freeze'); } else { _toolbar('unfreeze'); } ?>
660 <?php _toolbar('diff') ?>
661 <?php if ($do_backup) { ?>
662 <?php _toolbar('backup') ?>
664 <?php if ($rw && (bool)ini_get('file_uploads')) { ?>
665 <?php _toolbar('upload') ?>
668 <?php _toolbar('copy') ?>
669 <?php _toolbar('rename') ?>
671 <?php _toolbar('reload') ?>
675 <?php _toolbar('new') ?>
677 <?php _toolbar('list') ?>
678 <?php _toolbar('search') ?>
679 <?php _toolbar('recent') ?>
680 <?php _toolbar('help') ?>
681 <?php _toolbar('rss10', 36, 14) ?>
683 <?php } // PKWK_SKIN_SHOW_TOOLBAR ?>
685 <!-- Copyright etc -->
686 Site admin: <a href="<?php echo $modifierlink ?>"><?php echo $modifier ?></a><p />
687 <?php echo S_COPYRIGHT ?>.
688 Powered by PHP <?php echo PHP_VERSION ?><br />
689 HTML convert time: <?php echo $taketime ?> sec.
691 </div><!-- class="footer" -->
693 <?php if ($menu && ($sidebar != 'top' && $sidebar != 'bottom')) { ?>
694 </div><!-- class="main" -->
695 </div><!-- class="pkwk_body" -->