2 //YANMAH2 - Yet ANother Mobile Accelerated HatenaHaiku
3 //(c) 2019 YANMAH2 project
4 //This program is freesoftware. you can redistribute it and/or modify it under the terms of the [GNU Affero GPL v3](http://www.gnu.org/licenses/agpl.html).
7 define("HELLO","world");
8 require_once "product_definitions.php";
9 require_once "configurable_variables.php";
10 require_once "common_functions.php";
15 if (isset($_POST['count']) && preg_match("/^[0123456789]{1,3}$/", $_POST['count'])){
16 $pcount = $_POST['count'];
22 if (isset($_POST['showicon']) && preg_match("/^(yes|no)$/", $_POST['showicon'])){
23 $pshowicon = $_POST['showicon'];
29 if (isset($_POST['disbr']) && preg_match("/^(yes|no)$/", $_POST['disbr'])){
30 $pdisbr = $_POST['disbr'];
36 if (isset($_POST['starisjs']) && preg_match("/^(0|1)$/", $_POST['starisjs'])){
37 $pstarisjs = $_POST['starisjs'];
43 if (isset($_POST['elimit']) && preg_match("/^[0123456789]{1,3}$/", $_POST['elimit'])){
44 $pelimit = $_POST['elimit'];
50 // if (isset($_POST['hdomain']) && preg_match("/^(h|h1beta)(\.hatena\.ne\.jp|\.hatena\.com)$/", $_POST['hdomain'])){
51 // $phdomain = $_POST['hdomain'];
57 if (isset($_POST['iscale']) && preg_match("/^[[:digit:]]{1}\.{0,1}[[:digit:]]{0,1}$/", $_POST['iscale'])){
58 $piscale = $_POST['iscale'];
66 setcookie('y2config', 'count=' . $pcount . '&showicon=' . $pshowicon . '&disbr=' . $pdisbr . '&elimit=' . $pelimit . '&iscale=' . $piscale . '&starisjs=' . $pstarisjs, time()+60*60*24*365);
70 require_once 'init_processor.php';
71 // var_dump($_SESSION);
72 if (isset($_POST['count']) && preg_match("/^[0123456789]{1,3}$/", $_POST['count'])){
73 $y2count = $_POST['count'];
74 } elseif (isset($y2config['count']) && $y2config['count'] != '' && preg_match("/^[0123456789]{1,3}$/", $y2config['count'])){
75 $y2count = $y2config['count'];
79 if (isset($_POST['showicon']) && preg_match("/^(yes|no)$/", $_POST['showicon'])){
80 $showicon = $_POST['showicon'];
81 } elseif (isset($y2config['showicon']) && $y2config['showicon'] != '' && preg_match("/^(yes|no)$/", $y2config['showicon'])){
82 $showicon = $y2config['showicon'];
84 $showicon = 'default';
86 if (isset($_POST['disbr']) && preg_match("/^(yes|no)$/", $_POST['disbr'])){
87 $disbr = $_POST['disbr'];
88 } elseif (isset($y2config['disbr']) && $y2config['disbr'] != '' && preg_match("/^(yes|no)$/", $y2config['disbr'])) {
89 $disbr = $y2config['disbr'];
93 if (isset($_POST['starisjs']) && preg_match("/^(0|1)$/", $_POST['starisjs'])){
94 $starisjs = $_POST['starisjs'];
95 } elseif (isset($y2config['starisjs']) && $y2config['starisjs'] != '' && preg_match("/^(0|1)$/", $y2config['starisjs'])) {
96 $starisjs = $y2config['starisjs'];
105 if (isset($_POST['elimit']) && preg_match("/^[0123456789]{1,3}$/", $_POST['elimit'])){
106 $entry_limit = $_POST['elimit'];
107 } elseif (isset($y2config['elimit']) && $y2config['elimit'] != '' && preg_match("/^[0123456789]{1,3}$/", $y2config['elimit'])){
108 $entry_limit = $y2config['elimit'];
110 $entry_limit = $entry_limit;
112 // if (isset($_POST['hdomain']) && preg_match("/^(h|h1beta)(\.hatena\.ne\.jp|\.hatena\.com)$/", $_POST['hdomain'])){
113 // $hdomain = $_POST['hdomain'];
114 // } elseif (isset($y2config['hdomain']) && preg_match("/^(h|h1beta)(\.hatena\.ne\.jp|\.hatena\.com)$/", $y2config['hdomain'])){
115 // $hdomain = $y2config['hdomain'];
117 // $hdomain = 'default';
119 if (isset($_POST['iscale']) && preg_match("/^[[:digit:]]{1}\.{0,1}[[:digit:]]{0,1}$/", $_POST['iscale'])){
120 $iscale = $_POST['iscale'];
121 } elseif (isset($y2config['iscale']) && $y2config['iscale'] != '' && preg_match("/^[[:digit:]]{1}\.{0,1}[[:digit:]]{0,1}$/", $y2config['iscale'])){
122 $iscale = $y2config['iscale'];
128 if (!isset($_SESSION['auth']) || $_SESSION['auth'] != TRUE){
129 // if ($_SESSION['image'] != 'on'){
131 if (isset($_COOKIE[session_name()])){
132 setcookie(session_name(), '', time() - 42000, dirname($_SERVER['SCRIPT_NAME']) . '/', $_SERVER["SERVER_NAME"]);
139 $page_head = 'YANMAH2 の設定';
140 $selfcall = htmlspecialchars($_SERVER["PHP_SELF"], ENT_QUOTES);
141 $self_anchor = "http://{$_SERVER["SERVER_NAME"]}{$selfcall}";
142 if ($get_image == 'on'){
143 $self_anchor_with_imagemode = $self_anchor . '?image=on';
145 $self_anchor_with_imagemode = $self_anchor;
148 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
149 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
150 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
152 <meta http-equiv="Content-Type" content="text/html; charset={$meta_charset}" />
153 <meta http-equiv="Content-Style-Type" content="text/css" />
154 <meta http-equiv="Content-Script-Type" content="text/javascript" />
155 <meta name="viewport" content="initial-scale={$iscale}, minimum-scale=0.1" />
156 <title>{$page_head} - {$site_name} {$site_name_caption}</title>
157 <link rel="stylesheet" href="{$style_sheet}" />
158 <link rel="icon" href="./favicon.ico" type="image/vnd.microsoft.icon" />
159 <link rel="shortcut icon" href="./favicon.ico" type="image/vnd.microsoft.icon" />
160 <link rel="apple-touch-icon" href="./apple-touch-icon.png" />
167 // var_dump($_SESSION);
170 $echo = $echo . echoCommonHeader('./login.php', $self_anchor_with_imagemode) . "<hr />\n";
171 $echo = $echo . "<div id=\"header\" class=\"user_timeline\">\n";
172 $echo = $echo . "<h1 id=\"entries-head\" class=\"head1\">{$page_head}</h1>\n<hr />";
173 $echo = $echo . "</div>\n";
176 $echo = $echo . <<<EOL
177 <div class="cnf-blk">
180 <li>タイムライン一頁に表示するエントリの件数:$y2count</li>
181 <li>画像省略時もユーザのアイコンを表示する:$showicon</li>
182 <li>タイムラインで改行を減らす:$disbr</li>
183 <li>はてなスターを JavaScript で処理する:$star_is_js</li>
184 <li>各エントリの表示文字数制限の基準幅:$entry_limit</li>
185 <li>Viewport の initial-scale:$iscale</li>
192 $echo = $echo . '<form method="post" action="">';
193 $echo = $echo . <<<EOL
194 <div class="cnf-blk">
197 <label for="entries-count">タイムライン一頁に表示するエントリの件数:</label>
198 <select name="count" id="entries-count">
201 if (isset($y2count) && $y2count == '1') $echo = $echo . ' selected="selected"';
202 $echo = $echo . <<<EOL
206 if (isset($y2count) && $y2count == '5') $echo = $echo . ' selected="selected"';
207 $echo = $echo . <<<EOL
211 if (isset($y2count) && $y2count == '10') $echo = $echo . ' selected="selected"';
212 $echo = $echo . <<<EOL
216 if (isset($y2count) && $y2count == '15') $echo = $echo . ' selected="selected"';
217 $echo = $echo . <<<EOL
221 if (isset($y2count) && ($y2count == '20' || $y2count == 'default')) $echo = $echo . ' selected="selected"';
222 $echo = $echo . <<<EOL
226 if (isset($y2count) && $y2count == '25') $echo = $echo . ' selected="selected"';
227 $echo = $echo . <<<EOL
231 if (isset($y2count) && $y2count == '50') $echo = $echo . ' selected="selected"';
232 $echo = $echo. <<<EOL
236 if (isset($y2count) && $y2count == '100') $echo = $echo . ' selected="selected"';
237 $echo = $echo . <<<EOL
241 if (isset($y2count) && $y2count == '200') $echo = $echo . ' selected="selected"';
242 $echo = $echo . <<<EOL
249 $echo = $echo . <<<EOL
251 <label for="show-icon">画像省略時もユーザのアイコンを表示する:</label>
252 <select name="showicon" id="show-icon">
255 if (isset($showicon) && ($showicon == 'no' || $showicon == 'default')) $echo = $echo . ' selected="selected"';
256 $echo = $echo . <<<EOL
260 if (isset($showicon) && $showicon == 'yes') $echo = $echo . ' selected="selected"';
261 $echo = $echo . <<<EOL
268 $echo = $echo . <<<EOL
270 <label for="dis-break">タイムラインで改行を減らす:</label>
271 <select name="disbr" id="dis-break">
274 if (isset($disbr) && ($disbr == 'yes' || $disbr == 'default')) $echo = $echo . ' selected="selected"';
275 $echo = $echo . <<<EOL
279 if (isset($disbr) && $disbr == 'no') $echo = $echo . ' selected="selected"';
280 $echo = $echo . <<<EOL
287 $echo = $echo . <<<EOL
289 <label for="star-script">はてなスターを JavaScript で処理する:</label>
290 <select name="starisjs" id="star-script">
293 if (isset($starisjs) && ($starisjs == '0' || $starisjs == 'default')) $echo = $echo . ' selected="selected"';
294 $echo = $echo . <<<EOL
298 if (isset($starisjs) && $starisjs == '1') $echo = $echo . ' selected="selected"';
299 $echo = $echo . <<<EOL
306 $echo = $echo . <<<EOL
308 <label for="trim-width">各エントリの表示文字数制限の基準幅:</label>
309 <input type="text" name="elimit" id="trim-width" value="{$entry_limit}" size="3" maxlength="3" />
314 // $echo = $echo . <<<EOL
316 // <label for="haiku-domain">はてなハイクのドメイン:</label>
317 // <select name="hdomain" id="haiku-domain">
318 // <option value="h.hatena.ne.jp"
320 // if (isset($hdomain) && ($hdomain == 'h.hatena.ne.jp' || $hdomain == 'default')) $echo = $echo . ' selected="selected"';
321 // $echo = $echo . <<<EOL
323 // <option value="h.hatena.com"
325 // if (isset($hdomain) && $hdomain == 'h.hatena.com') $echo = $echo . ' selected="selected"';
326 // $echo = $echo . <<<EOL
331 // <option value="h1beta.hatena.ne.jp"
333 // if (isset($hdomain) && $hdomain == 'h1beta.hatena.ne.jp') $echo = $echo . ' selected="selected"';
334 // $echo = $echo . <<<EOL
335 // >.ne.jp(beta)</option>
336 // <option value="h1beta.hatena.com"
338 // if (isset($hdomain) && $hdomain == 'h1beta.hatena.com') $echo = $echo . ' selected="selected"';
339 // $echo = $echo . <<<EOL
340 // >.com(beta)</option>
343 $echo = $echo . <<<EOL
345 <label for="ini-scl">Viewport の initial-scale:</label>
346 <select name="iscale" id="ini-scl">
349 if (isset($iscale) && ($iscale == '1' || $iscale == 'default')) $echo = $echo . ' selected="selected"';
350 $echo = $echo . <<<EOL
354 if (isset($iscale) && $iscale == '0.8') $echo = $echo . ' selected="selected"';
355 $echo = $echo . <<<EOL
359 if (isset($iscale) && $iscale == '0.6') $echo = $echo . ' selected="selected"';
360 $echo = $echo . <<<EOL
364 if (isset($iscale) && $iscale == '0.4') $echo = $echo . ' selected="selected"';
365 $echo = $echo . <<<EOL
369 if (isset($iscale) && $iscale == '0.2') $echo = $echo . ' selected="selected"';
370 $echo = $echo . <<<EOL
377 $echo = $echo . '<input type="submit" value="OK" id="config-save" /><label for="config-save">(設定を Cookie に保存します)</label>';
378 $echo = $echo . "</form>\n</div>\n<hr />";
381 $navi_paging = FALSE;
382 $navi_imaging = FALSE;
383 require 'footer_include.php';
384 $echo = $echo . '</div></body></html>';
385 echo mb_convert_encoding($echo, $charcode, 'UTF-8');
386 if (isset($_SESSION['oauth_stat'])) unset($_SESSION['oauth_stat']);