OSDN Git Service

ログインメッセージの部品変数を login.php から configurable_variables.php に移動。
[yanmah2/YANMAH2-season2-.git] / index.php
1 <?php
2 //YANMAH2 - Yet ANother Mobile Accelerated HatenaHaiku
3 //(c) 2014 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).
5 ?>
6 <?php
7 define("HELLO","world");
8 require_once "product_definitions.php";
9 require_once "configurable_variables.php";
10 require_once "common_functions.php";
11 ?>
12 <?php
13 require_once 'init_processor.php';
14 if (!isset($_SESSION['auth']) || $_SESSION['auth'] != TRUE){
15 // if ($_SESSION['image'] != 'on'){
16   $_SESSION = array();
17   if (isset($_COOKIE[session_name()])){
18         setcookie(session_name(), '', time() - 42000, dirname($_SERVER['SCRIPT_NAME']) . '/', $_SERVER["SERVER_NAME"]);
19   }
20   session_destroy();
21 // }
22 }
23 //session_regenerate_id(TRUE);
24 if (isset($_GET['with']) || isset($_GET['log'])){
25   require 'login_processor.php';
26 }
27 ?>
28 <?php
29 $selfcall = htmlspecialchars($_SERVER["PHP_SELF"], ENT_QUOTES);
30 $self_anchor = "http://{$_SERVER["SERVER_NAME"]}{$selfcall}";
31 if ($get_image == 'on'){
32                 $self_anchor_with_imagemode = $self_anchor . '?image=on';
33 } else {
34                 $self_anchor_with_imagemode = $self_anchor . '?image=off';
35 }
36 $relog_back = $self_anchor_with_imagemode . '&log=try';
37 $relogin = $self_anchor_with_imagemode . '&amp;with=haiku&amp;callback='.rawurlencode(rawurldecode($relog_back));
38 //echo ini_get("include_path");
39 $echo = <<<EOL
40 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
41    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
42 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
43 <head>
44         <meta http-equiv="Content-Type" content="text/html; charset={$meta_charset}" />
45         <meta http-equiv="Content-Style-Type" content="text/css" />
46         <meta http-equiv="Content-Script-Type" content="text/javascript" />
47         <meta name="viewport" content="initial-scale={$iscale}, minimum-scale=0.1" />
48         <title>{$site_name} {$site_name_caption}</title>
49         <link rel="stylesheet" href="{$style_sheet}" />
50         <link rel="icon" href="./favicon.ico" type="image/vnd.microsoft.icon" />
51         <link rel="shortcut icon" href="./favicon.ico" type="image/vnd.microsoft.icon" />
52         <link rel="apple-touch-icon" href="./apple-touch-icon.png" />
53 </head>
54 <body>
55 EOL;
56 ?>
57 <?php
58 $echo = $echo . echoCommonHeader('#com-ftr', $self_anchor_with_imagemode) . "<hr />\n";
59 $echo = $echo . '<div id="header">';
60 $echo = $echo . "<h1 id=\"index-head\" class=\"head1\">{$site_name}</h1>\n";
61 $echo = $echo . "<p class=\"caption\">by <abbr title=\"{$product_name_full}\">{$product_name_abbr}</abbr> Ver.{$product_version}</p>\n";
62 $echo = $echo . <<<EOL
63 </div>
64 <div id="index-contents" class="contents">
65 EOL;
66 // var_dump($_SESSION);
67 if (isset($_SESSION['oauth_stat'])){
68   $echo = $echo . '<div class="oauth-res">'."\n";
69   if ($_SESSION['oauth_stat'] === TRUE) {
70         $echo = $echo . "<span>アクセストークンを更新しました。</span>\n";
71   } else {
72         $echo = $echo . "<span>アクセストークンを取得できませんでした。</span>\n";
73         $echo = $echo . "<blockquote>{$_SESSION['oauth_stat']}</blockquote>";
74   }
75   $echo = $echo . '</div>'."\n";
76 }
77 if (isset($_SESSION['auth']) && $_SESSION['auth'] === TRUE){
78   $echo = $echo . <<<EOL
79   <div class="index-content">
80   <h2 id="users-index-head">ユーザーのページ</h2>
81   <ul>
82 EOL;
83 //   if (isset($_SESSION['auth']) && $_SESSION['auth'] === TRUE){
84     $echo = $echo . "<li><a href=\"./entries.php?following={$_SESSION['hatenaid']}\n";
85   //   if (isset($_GET['image']) && $_GET['image'] == 'on') $echo = $echo . '&amp;image=on';
86     $echo = $echo . "\" class=\"user\">{$_SESSION['hatenaid']} のアンテナ</a></li>\n";
87     $echo = $echo . "<li><a href=\"./entries.php?user={$_SESSION['hatenaid']}";
88   //   if (isset($_GET['image']) && $_GET['image'] == 'on') $echo = $echo . '&amp;image=on';
89     $echo = $echo . "\" class=\"user\">{$_SESSION['hatenaid']} のエントリー</a></li>\n";
90     $echo = $echo . "<li><a href=\"./entries.php?favours={$_SESSION['hatenaid']}";
91   //   if (isset($_GET['image']) && $_GET['image'] == 'on') $echo = $echo . "&amp;image=on";
92     $echo = $echo . "\" class=\"user\">{$_SESSION['hatenaid']} のお気に入り</a></li>\n";
93     $echo = $echo . "<li><a href=\"{$relogin}\" class=\"user\">再認証</a></li>";
94 //   } else {
95 //     $echo = $echo . '<li><form method="get" action="./entries.php">';
96 //     $echo = $echo . '<label for="userflw">id:</label><input type="text" name="following" maxlength="32" id="userflw"/><label for="userflw">のアンテナを</label><input type="submit" value="表示" />';
97 //   //   if (isset($_GET['image']) && $_GET['image'] == 'on') $echo = $echo . '<input type="hidden" name="image" value="on" />';
98 //     $echo = $echo . '</form></li>'."\n";
99 //     $echo = $echo . '<li><form method="get" action="./entries.php">';
100 //     $echo = $echo . '<label for="username">id:</label><input type="text" name="user" maxlength="32" id="username"/><label for="username">のエントリーを</label><input type="submit" value="表示" />';
101 //     if (isset($_GET['image']) && $_GET['image'] == 'on') $echo = $echo . '<input type="hidden" name="image" value="on" />';
102 //     $echo = $echo . '</form></li>'."\n";
103 //   }
104
105   // $echo = $echo . "<li><a href=\"./config.php";
106   // if (isset($get_image) && $get_image == 'on') $echo = $echo . '?image=on';
107   // $echo = $echo . "\" class=\"user\">YANMAH2 の設定</a></li>\n";
108   $echo = $echo . "</ul>\n</div>\n";
109   $echo = $echo . <<<EOL
110   <div class="index-content content">
111   <h2 id="entries-index-head">みんなのページ</h2>
112   <ul>
113 EOL;
114   $echo = $echo . '<li><a href="./entries.php';
115   // if(isset($_GET['image']) && $_GET['image'] == 'on') $echo = $echo . '?image=on';
116   $echo = $echo . '" class="entries">みんなのエントリー</a></li>';
117   $echo = $echo . '<li><a href="./entries.php?album=public';
118   // if(isset($_GET['image']) && $_GET['image'] == 'on') $echo = $echo . '&amp;image=on';
119   $echo = $echo . '" class="entries">みんなのアルバム</a></li>';
120   $echo = $echo . '<li><a href="./entries.php?users=public';
121   // if(isset($_GET['image']) && $_GET['image'] == 'on') $echo = $echo . '&amp;image=on';
122   $echo = $echo . '" class="entries">ユーザー一覧</a></li>';
123   $echo = $echo . "</ul>\n</div>\n";
124   $echo = $echo . <<<EOL
125   <div class="index-content">
126   <h2 id="keywords-index-head">キーワード</h2>
127   <ul>
128   <li><form method="get" action="./keywords.php" accept-charset="{$meta_charset}">
129   <label for="go2keyword">キーワード</label><input type="text" name="word" maxlength="170" id="go2keyword" /><label for="go2keyword">を</label>
130   <input type="submit" value="検索" />
131 EOL;
132   // if (isset($_GET['image']) && $_GET['image'] == 'on') $echo = $echo . '<input type="hidden" name="image" value="on" />';
133   $echo = $echo . '</form></li>';
134   // $request_url = "{$api_base_url}keywords/hot.xml".'?without_related_keywords=1';
135   // $use_cache = FALSE;
136   // require_once 'keywords_processor.php';
137 //   if (isset($_SESSION['auth']) && $_SESSION['auth'] === TRUE){
138           $echo = $echo . '<li><a href="./keywords.php?user=' . $_SESSION['hatenaid'];
139           $echo = $echo . '" class="keyword">' . $_SESSION['hatenaid'] . ' のお気に入りキーワード</a></li>' . "\n";
140 //   }
141   $echo = $echo . '<li><a href="./keywords.php';
142   // if(isset($_GET['image']) && $_GET['image'] == 'on') $echo = $echo . '?image=on';
143   $echo = $echo . '" class="keyword">キーワード一覧</a></li>';
144   $echo = $echo . "</ul>\n</div>\n";
145 } else {
146   $echo = $echo . "<div class=\"index-content\">\n<ul>";
147   $echo = $echo . '<li><a href="./login.php?return='.rawurlencode(rawurldecode($self_anchor_with_imagemode)).'" class="navigation-link">ログイン</a></li>'."\n";
148   $echo = $echo . "</ul>\n</div>\n";
149 }
150 $echo = $echo . "</div>\n<hr />\n";
151 ?>
152 <?php
153 $echo = $echo . echoCommonFooter('#com-hdr');
154 $echo = $echo . $footer;
155 $echo = $echo . '</body></html>';
156 echo mb_convert_encoding($echo, $charcode, 'UTF-8');
157 if (isset($_SESSION['oauth_stat'])) unset($_SESSION['oauth_stat']);
158 ?>