Bug à cause d'un mutex qui n'était pas libéré.
This commit is contained in:
parent
079ad32827
commit
26f07c457c
|
@ -128,8 +128,12 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="score" class="screen">
|
<div id="score" class="screen">
|
||||||
<h1 class="fitFont" style="width:100%; height:8%; top: 6%; position:absolute; margin:0; text-align:center;">Score total : <span class="scoreTotal"></span></h1>
|
<h1 class="fitFont" style="width:100%; height:8%; top: 6%; position:absolute; margin:0; text-align:center;">Score total : <span class="scoreTotal"></span></h1>
|
||||||
<div class="scores fitFont" style="width:100%; height:62%; top:20%; position:absolute;"></div>
|
<div class="scores fitFont" style="width:100%; height:50%; top:20%; position:absolute;"></div>
|
||||||
<p class="fitFont" style="text-align: center; width:90%; height:12%; top:86%; left:5%; position:absolute; margin:0; padding:0;">
|
<p class="fitFont" style="text-align: center; width:90%; height:12%; top:74%; left:5%; position:absolute; margin:0; padding:0;">
|
||||||
|
<a class="button" href="#" style="float:left;">J'♥ cette partie</a>
|
||||||
|
<a class="button" href="#" style="float:right;">J'♥ pas cette partie</a>
|
||||||
|
</p>
|
||||||
|
<p class="fitFont" style="clear:both; text-align: center; width:90%; height:12%; top:86%; left:5%; position:absolute; margin:0; padding:0;">
|
||||||
<a class="button" href="#frontpage">J'ai vu !</a>
|
<a class="button" href="#frontpage">J'ai vu !</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -32,6 +32,8 @@ require_once("ressources/db.inc");
|
||||||
* userPrefsDefaults();
|
* userPrefsDefaults();
|
||||||
* userPrefs($user);
|
* userPrefs($user);
|
||||||
* setUserPref($user, $key, $value);
|
* setUserPref($user, $key, $value);
|
||||||
|
* getJAimePgid($user, $pgid);
|
||||||
|
* setJAimePgid($user, $pgid, $value);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -711,4 +713,16 @@ function setUserPref($user, $key, $value) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getJAimePgid($user, $pgid) {
|
||||||
|
getDB()->querySingle("SELECT like FROM played_game WHERE login = '".SQLite3::escapeString($user)."' and pgid = ".longStrVal($pgid).";");
|
||||||
|
}
|
||||||
|
|
||||||
|
function setJAimePgid($user, $pgid, $value) {
|
||||||
|
$value = intval($value) / abs(intval($value) || 1); // Calcule le signe de $value : -1 ou 0 ou 1
|
||||||
|
$original = getJAimePgid($user, $pgid);
|
||||||
|
getDB()->querySingle("UPDATE played_game SET like = ".$value." WHERE login = '".SQLite3::escapeString($user)."' and pgid = ".longStrVal($pgid).";");
|
||||||
|
getDB()->querySingle("UPDATE game SET nb_like = nb_like".($original == 1 ? " - 1" : "").($value == 1 ? " + 1" : "")." WHERE login = '".SQLite3::escapeString($user)."' and pgid = ".longStrVal($pgid).";");
|
||||||
|
getDB()->querySingle("UPDATE game SET nb_dislike = nb_dislike".($original == -1 ? " - 1" : "").($value == -1 ? " + 1" : "")." WHERE login = '".SQLite3::escapeString($user)."' and pgid = ".longStrVal($pgid).";");
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -312,6 +312,7 @@ init(function() {
|
||||||
if (updating) return false;
|
if (updating) return false;
|
||||||
updating = true;
|
updating = true;
|
||||||
if (!runstate.game || state.pgid != runstate.game.pgid) {
|
if (!runstate.game || state.pgid != runstate.game.pgid) {
|
||||||
|
updating = false;
|
||||||
$('#game').trigger('goto');
|
$('#game').trigger('goto');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,6 +114,10 @@ function main()
|
||||||
} elseif ($action == 9) {
|
} elseif ($action == 9) {
|
||||||
session_destroy();
|
session_destroy();
|
||||||
echo '{"disconnected":true}';
|
echo '{"disconnected":true}';
|
||||||
|
} elseif ($action == 10) { // Set J'aime / J'aime pas
|
||||||
|
if (!isset($_GET['value']) || !isset($_GET['pgid']))
|
||||||
|
throw new Exception("La requête est incomplète", 2);
|
||||||
|
setJAimePgid($user, $_GET['pgid'], intval($_GET['value']));
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Commande inconnue", 2);
|
throw new Exception("Commande inconnue", 2);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user