2 // PukiWiki - Yet another WikiWikiWeb clone.
3 // $Id: tdiary.skin.php,v 1.13 2005/01/16 06:49:34 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'
66 case 'black-lingerie':
69 case 'book2-feminine':
99 case 'white-lingerie':
102 $title_design_date = 0; // Select text design
110 $title_design_date = 2;
114 // Sidebar: default position
115 if (defined('TDIARY_SIDEBAR_POSITION')) {
116 $sidebar = TDIARY_SIDEBAR_POSITION;
118 // Themes including sidebar CSS < (AllTheme / 2)
119 // $ grep div.sidebar */*.css | cut -d: -f1 | cut -d/ -f1 | sort | uniq
121 // 75 list-sidebar.txt
123 $sidebar = 'another'; // Default: Show as an another page below
124 switch(TDIARY_THEME){
125 case '3minutes': /*FALLTHROUGH*/
135 case 'book2-feminine':
189 case 'smoking_black':
190 case 'smoking_white':
197 case 'tinybox_green':
200 $sidebar = 'bottom'; // This is the default position of tDiary's.
204 // Adjust sidebar's default position
205 switch(TDIARY_THEME){
207 // Assuming sidebar is above of the body
208 case 'autumn': /*FALLTHROUGH*/
210 case 'dice': // Sidebar text (white) seems unreadable
214 case 'paper': // Sidebar text (white) seems unreadable
216 case 'tinybox': // For MSIE with narrow window width, seems meanless
217 case 'tinybox_green': // The same
221 // Strict separation between sidebar and main contents needed
222 case '3minutes': /*FALLTHROUGH*/
240 case 'moo': // For MSIE, strict seems meanless
243 case 's-blue': // For MSIE, strict seems meanless
255 // They have sidevar-design, but can not show it at the 'side' of the contents
256 case 'babypink': /*FALLTHROUGH*/
266 case 'smoking_black':
267 $sidebar = 'another'; // Show as an another page below
271 // Check menu (sidebar) is ready and $menubar is there
272 $menu = (arg_check('read') && is_page($GLOBALS['menubar']) &&
273 exist_plugin_convert('menu'));
275 $menu_body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
276 '<h3 $1><span class="sanchor"></span> $2</h3>',
277 do_plugin_convert('menu'));
280 $lang = & $_LANG['skin'];
283 // Decide charset for CSS
284 $css_charset = 'iso-8859-1';
286 case 'ja': $css_charset = 'Shift_JIS'; break;
289 // Output HTTP headers
290 pkwk_common_headers();
291 header('Cache-control: no-cache');
292 header('Pragma: no-cache');
293 header('Content-Type: text/html; charset=' . CONTENT_CHARSET);
295 // Output HTML DTD, <html>, and receive content-type
296 if (isset($pkwk_dtd)) {
297 $meta_content_type = pkwk_output_dtd($pkwk_dtd);
299 $meta_content_type = pkwk_output_dtd();
304 <?php echo $meta_content_type ?>
305 <meta http-equiv="content-style-type" content="text/css" />
306 <?php if (! $is_read) { ?> <meta name="robots" content="NOINDEX,NOFOLLOW" /><?php } ?>
307 <?php if (PKWK_ALLOW_JAVASCRIPT && isset($javascript)) { ?> <meta http-equiv="Content-Script-Type" content="text/javascript" /><?php } ?>
309 <title><?php echo $title ?> - <?php echo $page_title ?></title>
311 <link rel="stylesheet" href="skin/theme/base.css" type="text/css" media="all" />
312 <link rel="stylesheet" href="skin/theme/<?php echo $theme ?>/<?php echo $theme ?>.css" type="text/css" media="all" />
313 <link rel="stylesheet" href="skin/tdiary.css.php?charset=<?php echo $css_charset ?>" type="text/css" media="screen" charset="<?php echo $css_charset ?>" />
314 <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 ?>" />
316 <link rel="alternate" type="application/rss+xml" title="RSS" href="<?php echo $link['rss'] ?>" /><?php // RSS auto-discovery ?>
318 <?php if (PKWK_ALLOW_JAVASCRIPT && $trackback_javascript) { ?> <script type="text/javascript" src="skin/trackback.js"></script><?php } ?>
320 <?php echo $head_tag ?>
322 <body><!-- Theme:<?php echo htmlspecialchars($theme) . ' Sidebar:' . $sidebar ?> -->
324 <?php if ($menu && $sidebar == 'strict') { ?>
326 <div class="sidebar">
328 <?php echo $menu_body ?>
330 </div><!-- class="sidebar" -->
332 <div class="pkwk_body">
334 <?php } // if ($menu && $sidebar == 'strict') ?>
336 <!-- Navigation buttuns -->
337 <div id="navigator"></div>
338 <div class="adminmenu">
340 function _navigator($key, $value = '', $javascript = ''){
341 $lang = $GLOBALS['_LANG']['skin'];
342 $link = $GLOBALS['_LINK'];
343 if (! isset($lang[$key])) { echo 'LANG NOT FOUND'; return FALSE; }
344 if (! isset($link[$key])) { echo 'LINK NOT FOUND'; return FALSE; }
345 if (! PKWK_ALLOW_JAVASCRIPT) $javascript = '';
347 echo '<span class="adminmenu"><a href="' . $link[$key] . '" ' . $javascript . '>' .
348 (($value === '') ? $lang[$key] : $value) .
354 <?php _navigator('top') ?>
356 <?php if ($is_page) { ?>
357 <?php _navigator('edit') ?>
358 <?php if ($is_read && $function_freeze) { ?>
359 <?php (! $is_freeze) ? _navigator('freeze') : _navigator('unfreeze') ?>
361 <?php _navigator('diff') ?>
362 <?php if ($do_backup) { ?>
363 <?php _navigator('backup') ?>
365 <?php if ((bool)ini_get('file_uploads')) { ?>
366 <?php _navigator('upload') ?>
368 <?php _navigator('reload') ?>
372 <?php _navigator('new') ?>
373 <?php _navigator('list') ?>
374 <?php if (arg_check('list')) { ?>
375 <?php _navigator('filelist') ?>
377 <?php _navigator('search') ?>
378 <?php _navigator('recent') ?>
379 <?php _navigator('help') ?>
381 <?php if ($trackback) { ?>
382 <?php _navigator('trackback', $lang['trackback'] . '(' . tb_count($_page) . ')',
383 ($trackback_javascript == 1) ? 'onClick="OpenTrackback(this.href); return false"' : '') ?>
385 <?php if ($referer) { ?>
386 <?php _navigator('refer') ?>
390 <h1><?php echo $page_title ?></h1>
392 <div class="calendar">
393 <?php if ($is_page && TDIARY_CALENDAR_DESIGN !== NULL) { ?>
394 <?php if(TDIARY_CALENDAR_DESIGN) { ?>
395 <a href="<?php echo $link['reload'] ?>"><span class="small"><?php echo $link['reload'] ?></span></a>
397 <?php require_once(PLUGIN_DIR . 'topicpath.inc.php'); echo plugin_topicpath_inline(); ?>
403 <?php if ($menu && $sidebar == 'top') { ?>
404 <!-- Sidebar compat top -->
405 <div class="sidebar">
407 <?php echo $menu_body ?>
409 </div><!-- class="sidebar" -->
410 <?php } // if ($menu && $sidebar == 'top') ?>
413 <?php if ($menu && ($sidebar == 'top' || $sidebar == 'bottom')) { ?>
414 <div class="pkwk_body">
423 // Page title (page name)
425 if ($disable_backlink) {
427 $title = htmlspecialchars($_page);
429 $title = $page; // Search, or something message
435 $title = htmlspecialchars($_page);
438 $title_date = $title_text = '';
439 switch($title_design_date){
440 case 1: $title_date = & $title; break;
441 case 0: $title_text = & $title; break;
443 // Show both (for debug or someting)
444 $title_date = & $title;
445 $title_text = & $title;
449 <h2><span class="date"><?php echo $title_date ?></span>
450 <span class="title"><?php echo $title_text ?></span></h2>
453 <div class="section">
455 // For read and preview: tDiary have no <h2> inside body
456 $body = preg_replace('#<h2 ([^>]*)>(.*?)<a class="anchor_super" ([^>]*)>.*?</a></h2>#',
457 '<h3 $1><a $3><span class="sanchor">_</span></a> $2</h3>', $body);
458 $body = preg_replace('#<h([34]) ([^>]*)>(.*?)<a class="anchor_super" ([^>]*)>.*?</a></h\1>#',
459 '<h$1 $2><a $4>_</a> $3</h$1>', $body);
460 $body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
461 '<h3 $1><span class="sanchor">_</span> $2</h3>', $body);
466 // Edit, preview, search, etc
467 echo preg_replace('/(<form) (action="' . preg_quote($script, '/') .
468 ')/', '$1 class="update" $2', $body);
472 </div><!-- class="body" -->
475 <?php if ($notes != '') { ?>
476 <div class="comment"><!-- Design for tDiary "Comments" -->
477 <div class="caption"> </div>
478 <div class="commentbody"><br/>
480 $notes = preg_replace('#<span class="small">(.*?)</span>#', '<p>$1</p>', $notes);
481 echo preg_replace('#<a (id="notefoot_[^>]*)>(.*?)</a>#',
482 '<div class="commentator"><a $1><span class="canchor"></span> ' .
483 '<span class="commentator">$2</span></a>' .
484 '<span class="commenttime"></span></div>', $notes);
490 <?php if ($attaches != '') { ?>
491 <div class="comment">
492 <div class="caption"> </div>
493 <div class="commentshort">
494 <?php echo $attaches ?>
499 <?php if ($related != '') { ?>
500 <div class="comment">
501 <div class="caption"> </div>
502 <div class="commentshort">
503 Link: <?php echo $related ?>
508 <!-- Design for tDiary "Today's referrer" -->
509 <div class="referer"><?php if ($lastmodified != '') echo 'Last-modified: ' . $lastmodified; ?></div>
511 </div><!-- class="day" -->
516 <?php if ($menu && $sidebar == 'another') { ?>
517 </div><!-- class="main" -->
518 </div><!-- class="pkwk_body" -->
520 <!-- Sidebar another -->
521 <div class="pkwk_body">
523 <div class="calendar"></div>
526 <h2><span class="date"></span><span class="title"> </span></h2>
528 <div class="section">
529 <?php echo $menu_body ?>
532 <div class="referer"></div>
535 </div><!-- class="pkwk_body" -->
537 <div class="pkwk_body">
539 <?php } // if ($menu && $sidebar == 'another') ?>
542 <?php if ($menu && ($sidebar == 'top' || $sidebar == 'bottom')) { ?>
543 </div><!-- class="main" -->
544 </div><!-- class="pkwk_body" -->
548 <?php if ($menu && $sidebar == 'bottom') { ?>
549 <!-- Sidebar compat bottom -->
550 <div class="sidebar">
552 <?php echo $menu_body ?>
554 </div><!-- class="sidebar" -->
555 <?php } // if ($menu && $sidebar == 'bottom') ?>
559 <?php if (PKWK_SKIN_SHOW_TOOLBAR) { ?>
563 // Set toolbar-specific images
564 $_IMAGE['skin']['reload'] = 'reload.png';
565 $_IMAGE['skin']['new'] = 'new.png';
566 $_IMAGE['skin']['edit'] = 'edit.png';
567 $_IMAGE['skin']['freeze'] = 'freeze.png';
568 $_IMAGE['skin']['unfreeze'] = 'unfreeze.png';
569 $_IMAGE['skin']['diff'] = 'diff.png';
570 $_IMAGE['skin']['upload'] = 'file.png';
571 $_IMAGE['skin']['copy'] = 'copy.png';
572 $_IMAGE['skin']['rename'] = 'rename.png';
573 $_IMAGE['skin']['top'] = 'top.png';
574 $_IMAGE['skin']['list'] = 'list.png';
575 $_IMAGE['skin']['search'] = 'search.png';
576 $_IMAGE['skin']['recent'] = 'recentchanges.png';
577 $_IMAGE['skin']['backup'] = 'backup.png';
578 $_IMAGE['skin']['help'] = 'help.png';
579 $_IMAGE['skin']['rss'] = 'rss.png';
580 $_IMAGE['skin']['rss10'] = & $_IMAGE['skin']['rss'];
581 $_IMAGE['skin']['rss20'] = 'rss20.png';
582 $_IMAGE['skin']['rdf'] = 'rdf.png';
584 function _toolbar($key, $x = 20, $y = 20){
585 $lang = & $GLOBALS['_LANG']['skin'];
586 $link = & $GLOBALS['_LINK'];
587 $image = & $GLOBALS['_IMAGE']['skin'];
588 if (! isset($lang[$key]) ) { echo 'LANG NOT FOUND'; return FALSE; }
589 if (! isset($link[$key]) ) { echo 'LINK NOT FOUND'; return FALSE; }
590 if (! isset($image[$key])) { echo 'IMAGE NOT FOUND'; return FALSE; }
592 echo '<a href="' . $link[$key] . '">' .
593 '<img src="' . IMAGE_DIR . $image[$key] . '" width="' . $x . '" height="' . $y . '" ' .
594 'alt="' . $lang[$key] . '" title="' . $lang[$key] . '" />' .
599 <?php _toolbar('top') ?>
601 <?php if ($is_page) { ?>
603 <?php _toolbar('edit') ?>
604 <?php if ($is_read && $function_freeze) { ?>
605 <?php if (! $is_freeze) { _toolbar('freeze'); } else { _toolbar('unfreeze'); } ?>
607 <?php _toolbar('diff') ?>
608 <?php if ($do_backup) { ?>
609 <?php _toolbar('backup') ?>
611 <?php if ((bool)ini_get('file_uploads')) { ?>
612 <?php _toolbar('upload') ?>
614 <?php _toolbar('copy') ?>
615 <?php _toolbar('rename') ?>
616 <?php _toolbar('reload') ?>
619 <?php _toolbar('new') ?>
620 <?php _toolbar('list') ?>
621 <?php _toolbar('search') ?>
622 <?php _toolbar('recent') ?>
623 <?php _toolbar('help') ?>
624 <?php _toolbar('rss10', 36, 14) ?>
626 <?php } // PKWK_SKIN_SHOW_TOOLBAR ?>
628 <!-- Copyright etc -->
629 Site admin: <a href="<?php echo $modifierlink ?>"><?php echo $modifier ?></a><p />
630 <?php echo S_COPYRIGHT ?>.
631 Powered by PHP <?php echo PHP_VERSION ?><br />
632 HTML convert time: <?php echo $taketime ?> sec.
634 </div><!-- class="footer" -->
636 <?php if ($menu && ($sidebar != 'top' && $sidebar != 'bottom')) { ?>
637 </div><!-- class="main" -->
638 </div><!-- class="pkwk_body" -->