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