OSDN Git Service

BugTrack2/62: Do remove the whole design, 'Showing TrackBack-ping list by html'.
[pukiwiki/pukiwiki.git] / skin / keitai.skin.php
1 <?php
2 // PukiWiki - Yet another WikiWikiWeb clone.
3 // $Id: keitai.skin.php,v 1.9 2005/05/01 02:43:27 henoheno Exp $
4 // Copyright (C) 2003-2005 PukiWiki Developers Team
5 // License: GPL v2 or (at your option) any later version
6 //
7 // Skin for Embedded devices
8
9 // ----
10 // Prohibit direct access
11 if (! defined('UI_LANG')) die('UI_LANG is not set');
12
13 global $max_size, $accesskey, $menubar;
14 $link = $_LINK;
15 $rw = ! PKWK_READONLY;
16
17 // Output HTTP headers
18 pkwk_headers_sent();
19 if(TRUE) {
20         // Force Shift JIS encode for Japanese embedded browsers and devices
21         header('Content-Type: text/html; charset=Shift_JIS');
22         $title = mb_convert_encoding($title, 'SJIS', SOURCE_ENCODING);
23         $body  = mb_convert_encoding($body,  'SJIS', SOURCE_ENCODING);
24 } else {
25         header('Content-Type: text/html; charset=' . CONTENT_CHARSET);
26 }
27
28 // Make 1KByte spare (for header, etc)
29 $max_size = --$max_size * 1024;
30
31 // Replace IMG tags (= images) with character strings
32 // With ALT option
33 $body = preg_replace('#(<div[^>]+>)?(<a[^>]+>)?<img[^>]*alt="([^"]+)"[^>]*>(?(2)</a>)(?(1)</div>)#i', '[$3]', $body);
34 // Without ALT option
35 $body = preg_replace('#(<div[^>]+>)?(<a[^>]+>)?<img[^>]+>(?(2)</a>)(?(1)</div>)#i', '[img]', $body);
36
37 // Page numbers, divided by this skin
38 $pageno = (isset($vars['p']) and is_numeric($vars['p'])) ? $vars['p'] : 0;
39 $pagecount = ceil(strlen($body) / $max_size);
40 $lastpage = $pagecount - 1;
41
42 // Top navigation (text) bar
43 $navi = array();
44 $navi[] = '<a href="' . $link['top']  . '" ' . $accesskey . '="0">0.Top</a>';
45 if ($rw) {
46         $navi[] = '<a href="' . $link['new']  . '" ' . $accesskey . '="1">1.New</a>';
47         $navi[] = '<a href="' . $link['edit'] . '" ' . $accesskey . '="2">2.Edit</a>';
48         if ($is_read and $function_freeze) {
49                 if (! $is_freeze) {
50                         $navi[] = '<a href="' . $link['freeze']   . '" ' . $accesskey . '="3">3.Freeze</a>';
51                 } else {
52                         $navi[] = '<a href="' . $link['unfreeze'] . '" ' . $accesskey . '="3">3.Unfreeze</a>';
53                 }
54         }
55 }
56 $navi[] = '<a href="' . $script . '?' . $menubar . '" ' . $accesskey . '="4">4.Menu</a>';
57 $navi[] = '<a href="' . $link['recent'] . '" ' . $accesskey . '="5">5.Recent</a>';
58
59 // Previous / Next block
60 if ($pagecount > 1) {
61         $prev = $pageno - 1;
62         $next = $pageno + 1;
63         if ($pageno > 0) {
64                 $navi[] = '<a href="' . $script . '?cmd=read&amp;page=' . $r_page . '&amp;p=' . $prev . '" ' . $accesskey . '="7">7.Prev</a>';
65         }
66         $navi[] = $next . '/' . $pagecount . ' ';
67         if ($pageno < $lastpage) {
68                 $navi[] = '<a href="' . $script . '?cmd=read&amp;page=' . $r_page . '&amp;p=' . $next . '" ' . $accesskey . '="8">8.Next</a>';
69         }
70 }
71
72 $navi = join(' | ', $navi);
73 $body = substr($body, $pageno * $max_size, $max_size);
74
75 // Output
76 ?><html><head><title><?php
77         echo $title
78 ?></title></head><body><?php
79         echo $navi
80 ?><hr><?php
81         echo $body
82 ?></body></html>