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 set_language($PREF['language']);
81 echo '<subtitle>'._('Know when it is your turn')."</subtitle>\n";
83 global $WIKI,$INDEX, $HOST;
85 /* output last creation date */
86 echo "<link href=\"$HOST/$INDEX\" />\n";
87 echo "<link rel=\"self\" href=\"".$HOST.htmlentities($_SERVER['REQUEST_URI'])."\" />\n";
88 $date = DB_query_array("Select create_date from User order by create_date ASC limit 1");
90 $timestamp = strtotime($date);
91 echo "<id>tag:".$_SERVER['SERVER_NAME'].",".date("Y-m-d",$timestamp).":$INDEX</id>\n";
92 echo "<updated>".date(DATE_ATOM)."</updated>\n";
94 echo "<name>$ADMIN_NAME $date $timestamp</name>\n";
95 echo "<email>$ADMIN_EMAIL</email>\n";
99 /* output the entries */
102 $result = DB_query("SELECT Hand.hash,Hand.game_id,Game.player from Hand".
103 " LEFT JOIN Game On Hand.game_id=Game.id".
104 " WHERE Hand.user_id='$id'".
105 " AND ( Game.player='$id' OR ISNULL(Game.player) )".
106 " AND ( Game.status='pre' OR Game.status='play' )".
107 " ORDER BY Game.session" );
109 while( $r = DB_fetch_array($result))
112 echo "<title>"._('game').' '.DB_format_gameid($r[1])."</title>\n";
113 $url=$INDEX."?action=game&me=".$r[0];
114 echo "<link href=\"".$HOST.$url."\" />\n";
115 $date = DB_get_game_timestamp($r[1]);
116 $timestamp = strtotime($date);
117 $date = date("Y-m-d",$timestamp);
118 echo "<id>tag:doko.nubati.net,$date:$url</id>\n";
119 echo "<updated>".date(DATE_ATOM,$timestamp)."</updated>\n";
120 echo '<summary>'._('Please use the link to access the game.')."</summary>\n";