OSDN Git Service

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