2 /* Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012 Arun Persaud <arun@nubati.net>
4 * This file is part of e-DoKo.
6 * e-DoKo is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * e-DoKo is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with e-DoKo. If not, see <http://www.gnu.org/licenses/>.
21 /* get some information from the database */
22 error_reporting(E_ALL);
24 /* start a session, if it is not already running.
25 * This way people don't have to log in all the times.
26 * The session variables can also be read out from different
27 * php scripts, so that the code can be easily split up across several files
30 include_once("config.php"); /* needs to be first in list, since other includes use this */
31 include_once("./include/output.php"); /* html output only */
32 include_once("./include/db.php"); /* database only */
33 include_once("./include/functions.php"); /* the rest */
35 /* make sure that user has set all variables in config.php */
38 /* open the database */
42 echo "Database error, can't connect... Please wait a while and try again. ".
43 "If the problem doesn't go away feel free to contact $ADMIN_NAME at $ADMIN_EMAIL.";
51 if(!myisset("uid","token"))
57 $id = $_REQUEST['uid'];
58 $token = get_user_token($id);
60 if($token == $_REQUEST['token'])
66 echo "No valid userid";
70 header("Content-Type: text/xml");
73 <feed xmlns="http://www.w3.org/2005/Atom">
74 <title>E-DoKo Feed</title>
78 $PREF = DB_get_PREF($id);
79 $lang = $PREF['language'];
84 putenv("LC_ALL=de_DE");
85 setlocale(LC_ALL, "de_DE");
86 // Specify location of translation tables
87 bindtextdomain("edoko", "./locale");
95 echo '<subtitle>'._('Know when it is your turn')."</subtitle>\n";
97 global $WIKI,$INDEX, $HOST;
99 /* output last creation date */
100 echo "<link href=\"$HOST/$INDEX\" />\n";
101 echo "<link rel=\"self\" href=\"".$HOST.htmlentities($_SERVER['REQUEST_URI'])."\" />\n";
102 $date = DB_query_array("Select create_date from User order by create_date ASC limit 1");
104 $timestamp = strtotime($date);
105 echo "<id>tag:".$_SERVER['SERVER_NAME'].",".date("Y-m-d",$timestamp).":$INDEX</id>\n";
106 echo "<updated>".date(DATE_ATOM)."</updated>\n";
108 echo "<name>$ADMIN_NAME $date $timestamp</name>\n";
109 echo "<email>$ADMIN_EMAIL</email>\n";
110 echo "</author>\n\n";
113 /* output the entries */
116 $result = DB_query("SELECT Hand.hash,Hand.game_id,Game.player from Hand".
117 " LEFT JOIN Game On Hand.game_id=Game.id".
118 " WHERE Hand.user_id='$id'".
119 " AND ( Game.player='$id' OR ISNULL(Game.player) )".
120 " AND ( Game.status='pre' OR Game.status='play' )".
121 " ORDER BY Game.session" );
123 while( $r = DB_fetch_array($result))
126 echo "<title>"._('game').' '.DB_format_gameid($r[1])."</title>\n";
127 $url=$INDEX."?action=game&me=".$r[0];
128 echo "<link href=\"".$HOST.$url."\" />\n";
129 $date = DB_get_game_timestamp($r[1]);
130 $timestamp = strtotime($date);
131 $date = date("Y-m-d",$timestamp);
132 echo "<id>tag:doko.nubati.net,$date:$url</id>\n";
133 echo "<updated>".date(DATE_ATOM,$timestamp)."</updated>\n";
134 echo '<summary>'._('Please use the link to access the game.')."</summary>\n";