OSDN Git Service

Remove media selector, use media query
[pukiwiki/pukiwiki.git] / skin / tdiary.skin.php
1 <?php
2 // PukiWiki - Yet another WikiWikiWeb clone.
3 // tdiary.skin.php
4 // Copyright
5 //   2002-2016 PukiWiki Development Team
6 //   2001-2002 Originally written by yu-ji
7 // License: GPL v2 or (at your option) any later version
8 //
9 // tDiary-wrapper skin (Updated for tdiary-theme 2.1.2)
10
11 // ------------------------------------------------------------
12 // Settings (define before here, if you want)
13
14 // Set site identities
15 $_IMAGE['skin']['favicon']  = ''; // Sample: 'image/favicon.ico';
16
17 // Select theme
18 if (! defined('TDIARY_THEME'))
19         define('TDIARY_THEME', 'loose-leaf'); // Default
20
21 // Show link(s) at your choice, with <div class="calendar"> design
22 // NOTE: Some theme become looking worse with this!
23 //   NULL = Show nothing
24 //   0    = Show topicpath
25 //   1    = Show reload URL
26 if (! defined('TDIARY_CALENDAR_DESIGN'))
27         define('TDIARY_CALENDAR_DESIGN', NULL); // NULL, 0, 1
28
29 // Show / Hide navigation bar UI at your choice
30 // NOTE: This is not stop their functionalities!
31 if (! defined('PKWK_SKIN_SHOW_NAVBAR'))
32         define('PKWK_SKIN_SHOW_NAVBAR', 1); // 1, 0
33
34 // Show toolbar at your choice, with <div class="footer"> design
35 // NOTE: Some theme become looking worse with this!
36 if (! defined('PKWK_SKIN_SHOW_TOOLBAR'))
37         define('PKWK_SKIN_SHOW_TOOLBAR', 0); // 0, 1
38
39 // TDIARY_SIDEBAR_POSITION: See below
40
41 // ------------------------------------------------------------
42 // Code start
43
44 // Prohibit direct access
45 if (! defined('UI_LANG')) die('UI_LANG is not set');
46 if (! isset($_LANG)) die('$_LANG is not set');
47 if (! defined('PKWK_READONLY')) die('PKWK_READONLY is not set');
48
49 // ------------------------------------------------------------
50 // Check tDiary theme
51
52 if (! defined('TDIARY_THEME') || TDIARY_THEME == '') {
53         die('Theme is not specified. Set "TDIARY_THEME" correctly');
54 } else {
55         $theme = rawurlencode(TDIARY_THEME); // Supress all nasty letters
56         $theme_css = SKIN_DIR . 'theme/' . $theme . '/' . $theme . '.css';
57         if (! file_exists($theme_css)) {
58                 echo 'tDiary theme wrapper: ';
59                 echo 'Theme not found: ' . htmlsc($theme_css) . '<br />';
60                 echo 'You can get tdiary-theme from: ';
61                 echo 'http://www.tdiary.org/';
62                 exit;
63          }
64 }
65
66 // ------------------------------------------------------------
67 // tDiary theme: Exception
68
69 // Adjust DTD (bug between these theme(=CSS) and MSIE)
70 // NOTE:
71 //    PukiWiki default: PKWK_DTD_XHTML_1_1
72 //    tDiary's default: PKWK_DTD_HTML_4_01_STRICT
73 switch(TDIARY_THEME){
74 case 'christmas':
75         $pkwk_dtd = PKWK_DTD_HTML_4_01_STRICT; // or centering will be ignored via MSIE
76         break;
77 }
78
79 // Adjust reverse-link default design manually
80 $disable_backlink = FALSE;
81 switch(TDIARY_THEME){
82 case 'hatena':          /* FALLTHROUGH */
83 case 'hatena-black':
84 case 'hatena-brown':
85 case 'hatena-darkgray':
86 case 'hatena-green':
87 case 'hatena-lightblue':
88 case 'hatena-lightgray':
89 case 'hatena-purple':
90 case 'hatena-red':
91 case 'hatena-white':
92 case 'hatena_cinnamon':
93 case 'hatena_japanese':
94 case 'hatena_leaf':
95 case 'hatena_water':
96         $disable_backlink = TRUE; // or very viewable title color
97         break;
98 }
99
100 // ------------------------------------------------------------
101 // tDiary theme: Select CSS color theme (Now testing:black only)
102
103 if (defined('TDIARY_COLOR_THEME')) {
104         $css_theme = rawurlencode(TDIARY_COLOR_THEME);
105 } else {
106         $css_theme = '';
107
108         switch(TDIARY_THEME){
109         case 'alfa':
110         case 'bill':
111         case 'black-lingerie':
112         case 'blackboard':
113         case 'bubble':
114         case 'cosmos':
115         case 'darkness-pop':
116         case 'digital_gadgets':
117         case 'fine':
118         case 'fri':
119         case 'giza':
120         case 'hatena-black':
121         case 'hatena_savanna-blue':
122         case 'hatena_savanna-green':
123         case 'hatena_savanna-red':
124         case 'kaizou':
125         case 'lightning':
126         case 'lime':
127         case 'line':
128         case 'midnight':
129         case 'moo':
130         case 'nachtmusik':
131         case 'nebula':
132         case 'nippon':
133         case 'noel':
134         case 'petith-b':
135         case 'quiet_black':
136         case 'redgrid':
137         case 'starlight':
138         case 'tinybox_green':
139         case 'white-lingerie':
140         case 'white_flower':
141         case 'whiteout':
142         case 'wine':
143         case 'wood':
144         case 'xmastree':
145         case 'yukon':
146                 $css_theme = 'black';
147
148         // Another theme needed?
149         case 'bluely':
150         case 'brown':
151         case 'deepblue':
152         case 'scarlet':
153         case 'smoking_black':
154                 ;
155         }
156 }
157
158 // ------------------------------------------------------------
159 // tDiary theme: Page title design (which is fancy, date and text?)
160
161 if (defined('TDIARY_TITLE_DESIGN_DATE') &&
162     (TDIARY_TITLE_DESIGN_DATE  == 0 ||
163      TDIARY_TITLE_DESIGN_DATE  == 1 ||
164      TDIARY_TITLE_DESIGN_DATE  == 2)) {
165         $title_design_date = TDIARY_TITLE_DESIGN_DATE;
166 } else {
167         $title_design_date = 1; // Default: Select the date desin, or 'the same design'
168         switch(TDIARY_THEME){
169         case '3minutes':        /* FALLTHROUGH */
170         case '90':
171         case 'aoikuruma':
172         case 'black-lingerie':
173         case 'blog':
174         case 'book':
175         case 'book2-feminine':
176         case 'book3-sky':
177         case 'candy':
178         case 'cards':
179         case 'desert':
180         case 'dot':
181         case 'himawari':
182         case 'kitchen-classic':
183         case 'kitchen-french':
184         case 'kitchen-natural':
185         case 'light-blue':
186         case 'lovely':
187         case 'lovely_pink':
188         case 'lr':
189         case 'magic':
190         case 'maroon':
191         case 'midnight':
192         case 'momonga':
193         case 'nande-ya-nen':
194         case 'narrow':
195         case 'natrium':
196         case 'nebula':
197         case 'orange':
198         case 'parabola':
199         case 'plum':
200         case 'pool_side':
201         case 'rainy-season':
202         case 'right':
203         case 's-blue':
204         case 's-pink':
205         case 'sky':
206         case 'sleepy_kitten':
207         case 'snow_man':
208         case 'spring':
209         case 'tag':
210         case 'tdiarynet':
211         case 'treetop':
212         case 'white-lingerie':
213         case 'white_flower':
214         case 'whiteout':
215         case 'wood':
216                 $title_design_date = 0; // Select text design   
217                 break;
218
219         case 'aqua':
220         case 'arrow':
221         case 'fluxbox':
222         case 'fluxbox2':
223         case 'fluxbox3':
224         case 'ymck':
225                 $title_design_date = 2; // Show both :)
226                 break;
227         }
228 }
229
230 // ------------------------------------------------------------
231 // tDiary 'Sidebar' position
232
233 // Default position
234 if (defined('TDIARY_SIDEBAR_POSITION')) {
235         $sidebar = TDIARY_SIDEBAR_POSITION;
236 } else {
237         $sidebar = 'another'; // Default: Show as an another page below
238
239         // List of themes having sidebar CSS < (AllTheme / 2)
240         // $ grep div.sidebar */*.css | cut -d: -f1 | cut -d/ -f1 | sort | uniq
241         // $ wc -l *.txt
242         //    142 list-sidebar.txt
243         //    286 list-all.txt
244         switch(TDIARY_THEME){
245         case '3minutes':        /*FALLTHROUGH*/
246         case '3pink':
247         case 'aoikuruma':
248         case 'aqua':
249         case 'arrow':
250         case 'artnouveau-blue':
251         case 'artnouveau-green':
252         case 'artnouveau-red':
253         case 'asterisk-blue':
254         case 'asterisk-lightgray':
255         case 'asterisk-maroon':
256         case 'asterisk-orange':
257         case 'asterisk-pink':
258         case 'autumn':
259         case 'babypink':
260         case 'be_r5':
261         case 'bill':
262         case 'bistro_menu':
263         case 'bluely':
264         case 'book':
265         case 'book2-feminine':
266         case 'book3-sky':
267         case 'bright-green':
268         case 'britannian':
269         case 'bubble':
270         case 'candy':
271         case 'cat':
272         case 'cherry':
273         case 'cherry_blossom':
274         case 'chiffon_leafgreen':
275         case 'chiffon_pink':
276         case 'chiffon_skyblue':
277         case 'citrus':
278         case 'clover':
279         case 'colorlabel':
280         case 'cool_ice':
281         case 'cosmos':
282         case 'curtain':
283         case 'darkness-pop':
284         case 'delta':
285         case 'diamond_dust':
286         case 'dice':
287         case 'digital_gadgets':
288         case 'dot-lime':
289         case 'dot-orange':
290         case 'dot-pink':
291         case 'dot-sky':
292         case 'dotted_line-blue':
293         case 'dotted_line-green':
294         case 'dotted_line-red':
295         case 'emboss':
296         case 'flower':
297         case 'gear':
298         case 'germany':
299         case 'gray2':
300         case 'green_leaves':
301         case 'happa':
302         case 'hatena':
303         case 'hatena-black':
304         case 'hatena-brown':
305         case 'hatena-darkgray':
306         case 'hatena-green':
307         case 'hatena-lightblue':
308         case 'hatena-lightgray':
309         case 'hatena-lime':
310         case 'hatena-orange':
311         case 'hatena-pink':
312         case 'hatena-purple':
313         case 'hatena-red':
314         case 'hatena-sepia':
315         case 'hatena-tea':
316         case 'hatena-white':
317         case 'hatena_cinnamon':
318         case 'hatena_japanese':
319         case 'hatena_leaf':
320         case 'hatena_rainyseason':
321         case 'hatena_savanna-blue':
322         case 'hatena_savanna-green':
323         case 'hatena_savanna-red':
324         case 'hatena_savanna-white':
325         case 'hatena_water':
326         case 'himawari':
327         case 'jungler':
328         case 'kaeru':
329         case 'kitchen-classic':
330         case 'kitchen-french':
331         case 'kitchen-natural':
332         case 'kotatsu':
333         case 'light-blue':
334         case 'loose-leaf':
335         case 'marguerite':
336         case 'matcha':
337         case 'mizu':
338         case 'momonga':
339         case 'mono':
340         case 'moo':
341         case 'natrium':
342         case 'nippon':
343         case 'note':
344         case 'old-pavement':
345         case 'orange_flower':
346         case 'pain':
347         case 'pale':
348         case 'paper':
349         case 'parabola':
350         case 'pettan':
351         case 'pink-border':
352         case 'plum':
353         case 'puppy':
354         case 'purple_sun':
355         case 'rainy-season':
356         case 'rectangle':
357         case 'repro':
358         case 'rim-daidaiiro':
359         case 'rim-fujiiro':
360         case 'rim-mizuiro':
361         case 'rim-sakurairo':
362         case 'rim-tanpopoiro':
363         case 'rim-wakabairo':
364         case 'russet':
365         case 's-blue':
366         case 'sagegreen':
367         case 'savanna':
368         case 'scarlet':
369         case 'sepia':
370         case 'simple':
371         case 'sleepy_kitten':
372         case 'smoking_black':
373         case 'smoking_white':
374         case 'spring':
375         case 'sunset':
376         case 'tdiarynet':
377         case 'teacup':
378         case 'thin':
379         case 'tile':
380         case 'tinybox':
381         case 'tinybox_green':
382         case 'treetop':
383         case 'white_flower':
384         case 'wine':
385         case 'yukon':
386         case 'zef':
387                 $sidebar = 'bottom'; // This is the default position of tDiary's.
388                 break;
389         }
390
391         // Manually adjust sidebar's default position
392         switch(TDIARY_THEME){
393
394         // 'bottom'
395         case '90': // But upper navigatin UI will be hidden by sidebar
396         case 'blackboard':
397         case 'quirky':
398         case 'quirky2':
399                 $sidebar = 'bottom';
400                 break;
401
402         // 'top': Assuming sidebar is above of the body
403         case 'autumn':  /*FALLTHROUGH*/
404         case 'cosmos':
405         case 'dice':    // Sidebar text (white) seems unreadable
406         case 'happa':
407         case 'kaeru':
408         case 'note':
409         case 'paper':   // Sidebar text (white) seems unreadable
410         case 'sunset':
411         case 'tinybox': // For MSIE with narrow window width, seems meanless
412         case 'tinybox_green':   // The same
413         case 'ymck':
414                 $sidebar = 'top';
415                 break;
416
417         // 'strict': Strict separation between sidebar and main contents needed
418         case '3minutes':        /*FALLTHROUGH*/
419         case '3pink':
420         case 'aoikuruma':
421         case 'aqua':
422         case 'artnouveau-blue':
423         case 'artnouveau-green':
424         case 'artnouveau-red':
425         case 'asterisk-blue':
426         case 'asterisk-lightgray':
427         case 'asterisk-maroon':
428         case 'asterisk-orange':
429         case 'asterisk-pink':
430         case 'bill':
431         case 'candy':
432         case 'cat':
433         case 'chiffon_leafgreen':
434         case 'chiffon_pink':
435         case 'chiffon_skyblue':
436         case 'city':
437         case 'clover':
438         case 'colorlabel':
439         case 'cool_ice':
440         case 'dot-lime':
441         case 'dot-orange':
442         case 'dot-pink':
443         case 'dot-sky':
444         case 'dotted_line-blue':
445         case 'dotted_line-green':
446         case 'dotted_line-red':
447         case 'flower':
448         case 'germany':
449         case 'green-tea':
450         case 'hatena':
451         case 'hatena-black':
452         case 'hatena-brown':
453         case 'hatena-darkgray':
454         case 'hatena-green':
455         case 'hatena-lightblue':
456         case 'hatena-lightgray':
457         case 'hatena-lime':
458         case 'hatena-orange':
459         case 'hatena-pink':
460         case 'hatena-purple':
461         case 'hatena-red':
462         case 'hatena-sepia':
463         case 'hatena-tea':
464         case 'hatena-white':
465         case 'hiki':
466         case 'himawari':
467         case 'kasumi':
468         case 'kitchen-classic':
469         case 'kitchen-french':
470         case 'kitchen-natural':
471         case 'kotatsu':
472         case 'kurenai':
473         case 'light-blue':
474         case 'loose-leaf':
475         case 'marguerite':
476         case 'matcha':
477         case 'memo':
478         case 'memo2':
479         case 'memo3':
480         case 'mirage':
481         case 'mizu':
482         case 'mono':
483         case 'moo':     // For MSIE, strict seems meanless
484         case 'navy':
485         case 'pict':
486         case 'pokke-blue':
487         case 'pokke-orange':
488         case 'query000':
489         case 'query011':
490         case 'query101':
491         case 'query110':
492         case 'query111or':
493         case 'puppy':
494         case 'rainy-season':
495         case 's-blue':  // For MSIE, strict seems meanless
496         case 'sagegreen':
497         case 'savanna':
498         case 'scarlet':
499         case 'sepia':
500         case 'simple':
501         case 'smoking_gray':
502         case 'spring':
503         case 'teacup':
504         case 'wine':
505                 $sidebar = 'strict';
506                 break;
507
508         // 'another': They have sidebar-design, but can not show it
509         //  at the 'side' of the contents
510         case 'babypink':        /*FALLTHROUGH*/
511         case 'bubble':
512         case 'cherry':
513         case 'darkness-pop':
514         case 'diamond_dust':
515         case 'gear':
516         case 'necktie':
517         case 'pale':
518         case 'pink-border':
519         case 'rectangle':
520         case 'russet':
521         case 'smoking_black':
522         case 'zef':
523                 $sidebar = 'another'; // Show as an another page below
524                 break;
525         }
526
527         // 'none': Show no sidebar
528 }
529 // Check menu (sidebar) is ready and $menubar is there
530 if ($sidebar == 'none') {
531         $menu = FALSE;
532 } else {
533         $menu = (arg_check('read') && is_page($GLOBALS['menubar']) &&
534                 exist_plugin_convert('menu'));
535         if ($menu) {
536                 $menu_body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
537                         '<h3 $1><span class="sanchor"></span> $2</h3>',
538                         do_plugin_convert('menu'));
539         }
540 }
541
542 // ------------------------------------------------------------
543 // Code continuing ...
544
545 $lang  = & $_LANG['skin'];
546 $link  = & $_LINK;
547 $image = & $_IMAGE['skin'];
548 $rw    = ! PKWK_READONLY;
549
550 // ------------------------------------------------------------
551 // Output
552
553 // HTTP headers
554 pkwk_common_headers();
555 header('Cache-control: no-cache');
556 header('Pragma: no-cache');
557 header('Content-Type: text/html; charset=' . CONTENT_CHARSET);
558
559 // HTML DTD, <html>, and receive content-type
560 if (isset($pkwk_dtd)) {
561         $meta_content_type = pkwk_output_dtd($pkwk_dtd);
562 } else {
563         $meta_content_type = pkwk_output_dtd();
564 }
565
566 ?>
567 <head>
568  <?php echo $meta_content_type ?>
569  <meta http-equiv="content-style-type" content="text/css" />
570 <?php if ($nofollow || ! $is_read)  { ?> <meta name="robots" content="NOINDEX,NOFOLLOW" /><?php } ?>
571 <?php if (PKWK_ALLOW_JAVASCRIPT && isset($javascript)) { ?> <meta http-equiv="Content-Script-Type" content="text/javascript" /><?php } ?>
572
573  <title><?php echo $title ?> - <?php echo $page_title ?></title>
574
575  <link rel="SHORTCUT ICON" href="<?php echo $image['favicon'] ?>" />
576  <link rel="stylesheet" type="text/css" media="all" href="<?php echo SKIN_DIR ?>theme/base.css" />
577  <link rel="stylesheet" type="text/css" media="all" href="<?php echo SKIN_DIR ?>theme/<?php echo $theme ?>/<?php echo $theme ?>.css" />
578  <link rel="stylesheet" type="text/css" href="<?php echo SKIN_DIR ?>tdiary.css.php?color=<?php echo $css_theme ?>" />
579  <link rel="alternate" type="application/rss+xml" title="RSS" href="<?php echo $link['rss'] ?>" /><?php // RSS auto-discovery ?>
580
581 <?php echo $head_tag ?>
582 </head>
583 <body><!-- Theme:<?php echo htmlsc($theme) . ' Sidebar:' . $sidebar ?> -->
584
585 <?php if ($menu && $sidebar == 'strict') { ?>
586 <!-- Sidebar top -->
587 <div class="sidebar">
588         <div id="menubar">
589                 <?php echo $menu_body ?>
590         </div>
591 </div><!-- class="sidebar" -->
592
593 <div class="pkwk_body">
594 <div class="main">
595 <?php } // if ($menu && $sidebar == 'strict') ?>
596
597 <!-- Navigation buttuns -->
598 <?php if (PKWK_SKIN_SHOW_NAVBAR) { ?>
599 <div class="adminmenu"><div id="navigator">
600 <?php
601 function _navigator($key, $value = '', $javascript = ''){
602         $lang = $GLOBALS['_LANG']['skin'];
603         $link = $GLOBALS['_LINK'];
604         if (! isset($lang[$key])) { echo 'LANG NOT FOUND'; return FALSE; }
605         if (! isset($link[$key])) { echo 'LINK NOT FOUND'; return FALSE; }
606         if (! PKWK_ALLOW_JAVASCRIPT) $javascript = '';
607
608         echo '<span class="adminmenu"><a href="' . $link[$key] . '" ' . $javascript . '>' .
609                 (($value === '') ? $lang[$key] : $value) .
610                 '</a></span>';
611
612         return TRUE;
613 }
614 ?>
615  <?php _navigator('top') ?> &nbsp;
616
617 <?php if ($is_page) { ?>
618   <?php if ($rw) { ?>
619         <?php _navigator('edit') ?>
620         <?php if ($is_read && $function_freeze) { ?>
621                 <?php (! $is_freeze) ? _navigator('freeze') : _navigator('unfreeze') ?>
622         <?php } ?>
623  <?php } ?>
624    <?php _navigator('diff') ?>
625  <?php if ($do_backup) { ?>
626         <?php _navigator('backup') ?>
627  <?php } ?>
628  <?php if ($rw && (bool)ini_get('file_uploads')) { ?>
629         <?php _navigator('upload') ?>
630  <?php } ?>
631    <?php _navigator('reload') ?>
632    &nbsp;
633 <?php } ?>
634
635  <?php if ($rw) { ?>
636         <?php _navigator('new') ?>
637  <?php } ?>
638    <?php _navigator('list') ?>
639  <?php if (arg_check('list')) { ?>
640    <?php _navigator('filelist') ?>
641  <?php } ?>
642    <?php _navigator('search') ?>
643    <?php _navigator('recent') ?>
644    <?php _navigator('help')   ?>
645    <?php if ($enable_login) { ?>
646      <?php _navigator('login') ?>
647    <?php } ?>
648    <?php if ($enable_logout) { ?>
649      <?php _navigator('logout') ?>
650    <?php } ?>
651 </div></div>
652 <?php } else { ?>
653 <div id="navigator"></div>
654 <?php } // PKWK_SKIN_SHOW_NAVBAR ?>
655
656 <h1><?php echo $page_title ?></h1>
657
658 <div class="calendar">
659 <?php if ($is_page && TDIARY_CALENDAR_DESIGN !== NULL) { ?>
660         <?php if(TDIARY_CALENDAR_DESIGN) { ?>
661                 <a href="<?php echo $link['reload'] ?>"><span class="small"><?php echo $link['reload'] ?></span></a>
662         <?php } else { ?>
663                 <?php require_once(PLUGIN_DIR . 'topicpath.inc.php'); echo plugin_topicpath_inline(); ?>
664         <?php } ?>
665 <?php } ?>
666 </div>
667
668
669 <?php if ($menu && $sidebar == 'top') { ?>
670 <!-- Sidebar compat top -->
671 <div class="sidebar">
672         <div id="menubar">
673                 <?php echo $menu_body ?>
674         </div>
675 </div><!-- class="sidebar" -->
676 <?php } // if ($menu && $sidebar == 'top') ?>
677
678
679 <?php if ($menu && ($sidebar == 'top' || $sidebar == 'bottom')) { ?>
680 <div class="pkwk_body">
681 <div class="main">
682 <?php } ?>
683
684 <hr class="sep" />
685
686 <div class="day">
687
688 <?php
689 // Page title (page name)
690 $title = '';
691 if ($disable_backlink) {
692         if ($_page != '') {
693                 $title = htmlsc($_page);
694         } else {
695                 $title = $page; // Search, or something message
696         }
697 } else {
698         if ($page != '') {
699                 $title = $page;
700         } else {
701                 $title = htmlsc($_page);
702         }
703 }
704 $title_date = $title_text = '';
705 switch($title_design_date){
706 case 1: $title_date = & $title; break;
707 case 0: $title_text = & $title; break;
708 default:
709         // Show both (for debug or someting)
710         $title_date = & $title;
711         $title_text = & $title;
712         break;
713 }
714 ?>
715 <h2><span class="date"><?php  echo $title_date ?></span>
716     <span class="title"><?php echo $title_text ?></span></h2>
717
718 <div class="body">
719         <div class="section">
720 <?php
721         // For read and preview: tDiary have no <h2> inside body
722         $body = preg_replace('#<h2 ([^>]*)>(.*?)<a class="anchor_super" ([^>]*)>.*?</a></h2>#',
723                 '<h3 $1><a $3><span class="sanchor">_</span></a> $2</h3>', $body);
724         $body = preg_replace('#<h([34]) ([^>]*)>(.*?)<a class="anchor_super" ([^>]*)>.*?</a></h\1>#',
725                 '<h$1 $2><a $4>_</a> $3</h$1>', $body);
726         $body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
727                 '<h3 $1><span class="sanchor">_</span> $2</h3>', $body);
728         if ($is_read) {
729                 // Read
730                 echo $body;
731         } else {
732                 // Edit, preview, search, etc
733                 echo preg_replace('/(<form) (action="' . preg_quote($script, '/') .
734                         ')/', '$1 class="update" $2', $body);
735         }
736 ?>
737         </div>
738 </div><!-- class="body" -->
739
740
741 <?php if ($notes != '') { ?>
742 <div class="comment"><!-- Design for tDiary "Comments" -->
743         <div class="caption">&nbsp;</div>
744         <div class="commentbody"><br />
745                 <?php
746                 $notes = preg_replace('#<span class="small">(.*?)</span>#', '<p>$1</p>', $notes);
747                 echo preg_replace('#<a (id="notefoot_[^>]*)>(.*?)</a>#',
748                         '<div class="commentator"><a $1><span class="canchor"></span> ' .
749                         '<span class="commentator">$2</span></a>' .
750                         '<span class="commenttime"></span></div>', $notes);
751                 ?>
752         </div>
753 </div>
754 <?php } ?>
755
756 <?php if ($attaches != '') { ?>
757 <div class="comment">
758         <div class="caption">&nbsp;</div>
759         <div class="commentshort">
760                 <?php echo $attaches ?>
761         </div>
762 </div>
763 <?php } ?>
764
765 <?php if ($related != '') { ?>
766 <div class="comment">
767         <div class="caption">&nbsp;</div>
768         <div class="commentshort">
769                 Link: <?php echo $related ?>
770         </div>
771 </div>
772 <?php } ?>
773
774 <!-- Design for tDiary "Today's referrer" -->
775 <div class="referer"><?php if ($lastmodified != '') echo 'Last-modified: ' . $lastmodified; ?></div>
776
777 </div><!-- class="day" -->
778
779 <hr class="sep" />
780
781
782 <?php if ($menu && $sidebar == 'another') { ?>
783 </div><!-- class="main" -->
784 </div><!-- class="pkwk_body" -->
785
786 <!-- Sidebar another -->
787 <div class="pkwk_body">
788         <h1>&nbsp;</h1>
789         <div class="calendar"></div>
790         <hr class="sep" />
791         <div class="day">
792                 <h2><span class="date"></span><span class="title">&nbsp;</span></h2>
793                 <div class="body">
794                         <div class="section">
795                                 <?php echo $menu_body ?>
796                         </div>
797                 </div>
798                 <div class="referer"></div>
799         </div>
800         <hr class="sep" />
801 </div><!-- class="pkwk_body" -->
802
803 <div class="pkwk_body">
804 <div class="main">
805 <?php } // if ($menu && $sidebar == 'another') ?>
806
807
808 <?php if ($menu && ($sidebar == 'top' || $sidebar == 'bottom')) { ?>
809 </div><!-- class="main" -->
810 </div><!-- class="pkwk_body" -->
811 <?php } ?>
812
813
814 <?php if ($menu && $sidebar == 'bottom') { ?>
815 <!-- Sidebar compat bottom -->
816 <div class="sidebar">
817         <div id="menubar">
818                 <?php echo $menu_body ?>
819         </div>
820 </div><!-- class="sidebar" -->
821 <?php } // if ($menu && $sidebar == 'bottom') ?>
822
823
824 <div class="footer">
825 <?php if (PKWK_SKIN_SHOW_TOOLBAR) { ?>
826 <!-- Toolbar -->
827 <?php
828
829 // Set toolbar-specific images
830 $_IMAGE['skin']['reload']   = 'reload.png';
831 $_IMAGE['skin']['new']      = 'new.png';
832 $_IMAGE['skin']['edit']     = 'edit.png';
833 $_IMAGE['skin']['freeze']   = 'freeze.png';
834 $_IMAGE['skin']['unfreeze'] = 'unfreeze.png';
835 $_IMAGE['skin']['diff']     = 'diff.png';
836 $_IMAGE['skin']['upload']   = 'file.png';
837 $_IMAGE['skin']['copy']     = 'copy.png';
838 $_IMAGE['skin']['rename']   = 'rename.png';
839 $_IMAGE['skin']['top']      = 'top.png';
840 $_IMAGE['skin']['list']     = 'list.png';
841 $_IMAGE['skin']['search']   = 'search.png';
842 $_IMAGE['skin']['recent']   = 'recentchanges.png';
843 $_IMAGE['skin']['backup']   = 'backup.png';
844 $_IMAGE['skin']['help']     = 'help.png';
845 $_IMAGE['skin']['rss']      = 'rss.png';
846 $_IMAGE['skin']['rss10']    = & $_IMAGE['skin']['rss'];
847 $_IMAGE['skin']['rss20']    = 'rss20.png';
848 $_IMAGE['skin']['rdf']      = 'rdf.png';
849
850 function _toolbar($key, $x = 20, $y = 20){
851         $lang  = & $GLOBALS['_LANG']['skin'];
852         $link  = & $GLOBALS['_LINK'];
853         $image = & $GLOBALS['_IMAGE']['skin'];
854         if (! isset($lang[$key]) ) { echo 'LANG NOT FOUND';  return FALSE; }
855         if (! isset($link[$key]) ) { echo 'LINK NOT FOUND';  return FALSE; }
856         if (! isset($image[$key])) { echo 'IMAGE NOT FOUND'; return FALSE; }
857
858         echo '<a href="' . $link[$key] . '">' .
859                 '<img src="' . IMAGE_DIR . $image[$key] . '" width="' . $x . '" height="' . $y . '" ' .
860                         'alt="' . $lang[$key] . '" title="' . $lang[$key] . '" />' .
861                 '</a>';
862         return TRUE;
863 }
864 ?>
865  <?php _toolbar('top') ?>
866
867 <?php if ($is_page) { ?>
868  &nbsp;
869  <?php if ($rw) { ?>
870         <?php _toolbar('edit') ?>
871         <?php if ($is_read && $function_freeze) { ?>
872                 <?php if (! $is_freeze) { _toolbar('freeze'); } else { _toolbar('unfreeze'); } ?>
873         <?php } ?>
874  <?php } ?>
875  <?php _toolbar('diff') ?>
876 <?php if ($do_backup) { ?>
877         <?php _toolbar('backup') ?>
878 <?php } ?>
879  <?php if ($rw && (bool)ini_get('file_uploads')) { ?>
880         <?php _toolbar('upload') ?>
881  <?php } ?>
882  <?php if ($rw) { ?>
883         <?php _toolbar('copy') ?>
884         <?php _toolbar('rename') ?>
885  <?php } ?>
886  <?php _toolbar('reload') ?>
887 <?php } ?>
888  &nbsp;
889  <?php if ($rw) { ?>
890         <?php _toolbar('new') ?>
891  <?php } ?>
892  <?php _toolbar('list')   ?>
893  <?php _toolbar('search') ?>
894  <?php _toolbar('recent') ?>
895  &nbsp; <?php _toolbar('help') ?>
896  &nbsp; <?php _toolbar('rss10', 36, 14) ?>
897  <br />
898 <?php } // PKWK_SKIN_SHOW_TOOLBAR ?>
899
900 <!-- Copyright etc -->
901  Site admin: <a href="<?php echo $modifierlink ?>"><?php echo $modifier ?></a><p />
902  <?php echo S_COPYRIGHT ?>.
903  Powered by PHP <?php echo PHP_VERSION ?><br />
904  HTML convert time: <?php echo elapsedtime() ?> sec.
905
906 </div><!-- class="footer" -->
907
908 <?php if ($menu && ($sidebar != 'top' && $sidebar != 'bottom')) { ?>
909 </div><!-- class="main" -->
910 </div><!-- class="pkwk_body" -->
911 <?php } ?>
912
913
914 </body>
915 </html>