+ /* output old session if available */
+ if($maxgame)
+ {
+ /* is session active? */
+ if($gamestatus == 'pre' || $gamestatus== 'play' || time()-strtotime($gamemoddate) < 60*60*24*5 )
+ {
+ $output_active .= "<li> ";
+ if($gamestatus == 'pre')
+ $output_active .= '<span class="gamestatuspre gameid">';
+ else if($gamestatus == 'play')
+ $output_active .= '<span class="gamestatusplay gameid">';
+ else
+ $output_active .= '<span class="gamestatusover gameid">';
+ $output_active .= "<a href=\"$INDEX?action=game&me=$myhash\">".
+ DB_format_gameid($gameid).'</a></span> ';
+
+
+
+ /* who's turn is it? */
+ if( $gamestatus == 'pre' || $gamestatus == 'play')
+ {
+ $output_active .= '<span class="turn">';
+ if($userid==$myid || !$userid)
+ $output_active .= ' <strong>'._('your turn')."</strong>\n";
+ else
+ {
+ $name = DB_get_name('userid',$userid);
+
+ /* check vacaction status of this user */
+ if($vacation=check_vacation($userid))
+ {
+ $stop = substr($vacation[1],0,10);
+ $title = _('begin:').substr($vacation[0],0,10).' '._('end:').$vacation[1].' '.$vacation[2];
+ $output_active .= " <span class=\"vacation\" title=\"$title\">".
+ sprintf(_("%s's turn"),$name).' '._("(on vacation until $stop)")."</span>\n";
+ }
+ else
+ $output_active .= sprintf(_("%s's turn"),$name)."\n";
+
+ /* check if we need to send out a reminder */
+ if(DB_get_reminder($userid,$gameid)==0)
+ if(time()-strtotime($gamemoddate) > 60*60*24*7)
+ $output_active .= "<a href=\"$INDEX?action=reminder&me=".$myhash."\">"._('Send a reminder?').'</a> ';
+
+ };
+ $output_active .= '</span>';
+
+ if(time()-strtotime($gamemoddate) > 60*60*24*30)
+ $output_active .= "<a href=\"$INDEX?action=cancel&me=".$myhash."\">"._('Cancel?').'</a> ';
+ }
+
+ if($maxgame>1)
+ {
+ $output_active .= ' <span class="gamesshowsession"><a href="#">'._('show old').'</a></span>'.
+ ' <span class="gameshidesession"><a href="#">'._('hide old').'</a></span><br />'."\n";
+ $output_active .= ' <span class="gamessession">'.$sessionoutput.'</span>';
+ }
+
+ $output_active .= "</li>\n";
+
+ }
+ else
+ {
+ /* session is not active anymore */
+ $output_inactive .= "<li> $session:" ;
+ $output_inactive .= $sessionoutput.$gameoutput ;
+ $output_inactive .= "</li>\n";
+ }
+
+ /* reset all session variables */
+ $maxgame = 0;
+ $sessionoutput = "";
+ $gameoutput = "";
+
+ }
+
+ /* save game information */
+ $maxgame++;
+ $myhash = $r[0];
+ $gameid = $r[1];
+ $gamemoddate = $r[2];
+ $userid = $r[3];
+ $gamestatus = $r[4];
+ $gamefrequence = $r[5];
+ $session = $r[6];
+
+ /* create output */
+ $sessionoutput .= $gameoutput;
+ $gameoutput = " <span class=\"gamestatusover \"><a href=\"".$INDEX."?action=game&me=".$myhash."\">"
+ .$gamefrequence."</a></span>\n";
+
+ }
+ }
+
+ echo "<ul>\n ";
+ echo ' <li><span class="gameshowall"><a href="#">'._('show all').'</a></span> <span class="gamehideall"><a href="#">'._('hide all')."</a></span></li>\n";
+ echo $output_active;
+ echo ' <li><span class="gamesshowsession"><a href="#">'._('show inactive').'</a></span><span class="gameshidesession"><a href="#">'._('hide inactive').'</a></span><ul class="gamessession">'."$output_inactive </ul></li>";
+ echo "</ul>\n";
+
+ /* give a hint for new players */
+ if($count<10)
+ echo '<p class="newbiehint">'._('You can start new games using the link in the top right corner!')."</p>\n";
+
+ /* display last 5 users that have signed up to e-DoKo */
+ $names = DB_get_names_of_new_logins(5);
+ echo '<h4>'._('New Players').":</h4>\n<p>\n";
+ echo implode(", ",$names).",...\n";
+ echo "</p>\n";
+
+ /* display last 5 users that logged on */
+ echo '<h4>'._('Players last logged in').":</h4>\n<p>\n";
+
+ $names = DB_get_names_of_last_logins(7);
+ $emails = DB_get_emails_of_last_logins(7);
+ for($i=0;$i<7;$i++)
+ {
+ echo '<img class="gravatar" title="'.$names[$i].
+ '" src="http://www.gravatar.com/avatar/'.
+ md5(strtolower(trim($emails[$i])))."?d=identicon\" />\n";
+ }
+ echo "</p>\n";
+
+ echo "</div>\n";
+ }
+ else
+ {
+ echo '<div class="message">'."\n";
+ echo sprintf(_("Sorry email and password don't match. Please <a href=\"%s\">try again</a>."),$INDEX);
+ echo '</div>'."\n";
+ }
+ };