<?php
-/* Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012 Arun Persaud <arun@nubati.net>
+/* Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Arun Persaud <arun@nubati.net>
*
* This file is part of e-DoKo.
*
function DB_open()
{
- $version_needed = 3;
+ $version_needed = 5;
global $DB,$DB_user,$DB_host,$DB_database,$DB_password;
$DB = @mysql_connect($DB_host,$DB_user, $DB_password);
switch($pref[0])
{
case 'cardset':
- /* licence only valid until then */
- if($pref[1]=='altenburg' && (time()-strtotime( '2012-12-31 23:59:59')<0) )
- $PREF['cardset']='altenburg';
break;
case 'email':
break;
}
}
- $_SESSION['language'] = $PREF['language'];
+
return $PREF;
}
return;
}
+function DB_delete_recovery_passwords($userid)
+{
+ DB_query("DELETE FROM Recovery WHERE user_id=".DB_quote_smart($userid));
+ return;
+}
+
function DB_get_card_name($card)
{
if($card==0)
return $r[0];
}
-function DB_digest_insert_email($To,$message)
+function DB_digest_insert_email($To,$message,$type,$gameid)
{
- DB_query("INSERT INTO digest_email VALUES (NULL,".DB_quote_smart($To).",NULL,".DB_quote_smart($message).")");
+ if($type == GAME_YOUR_TURN)
+ DB_query("INSERT INTO digest_email VALUES (NULL,".DB_quote_smart($To).",NULL,'your_turn',$gameid,".DB_quote_smart($message).")");
+ else
+ DB_query("INSERT INTO digest_email VALUES (NULL,".DB_quote_smart($To).",NULL,'misc',NULL,".DB_quote_smart($message).")");
return;
}
{
$messages = array();
- $result = DB_query("SELECT id,content FROM digest_email Where email='$email'");
+ $result = DB_query("SELECT id,content,type,game_id FROM digest_email Where email='$email'");
while($r = DB_fetch_array($result))
$messages[]=$r;