forked from FrenchDilettante/pourquoijepirate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f5150cb
Showing
31 changed files
with
1,094 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<buildpath> | ||
<buildpathentry kind="src" path="fragments"/> | ||
<buildpathentry kind="src" path="model"/> | ||
<buildpathentry kind="src" path="root"/> | ||
<buildpathentry kind="src" path="www"/> | ||
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/> | ||
</buildpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>pqjep</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.wst.validation.validationbuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.dltk.core.scriptbuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.php.core.PHPNature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#Sat Jun 11 18:54:52 CEST 2011 | ||
eclipse.preferences.version=1 | ||
include_path=0;/pqjep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<? | ||
$selection = isset($_SESSION["selection"]) ? $_SESSION["selection"] : array("nom" => "", "liste" => array()); | ||
$select = false; | ||
foreach ($selection["liste"] as $s) { | ||
$select = $s == $c["id"]; | ||
if ($select) break; | ||
} | ||
?> | ||
|
||
<div class="fortune" data-id="<? echo $c['id'] ?>" id="fortune-<? echo $c["id"] ?>"> | ||
<span class="texte"><? echo $c['fortune'] ?></span> | ||
<div class="actions"> | ||
<span class="select"> | ||
<? if ($select) {?> | ||
★Sélectionné <a href="" onclick="deselect(<? echo $c["id"] ?>); return false;">(Retirer)</a> | ||
<? } else {?> | ||
<a href="" onclick="select(<? echo $c["id"] ?>); return false;">☆Sélectionner</a> | ||
<? }?> | ||
</span> | ||
<span class="votes"> | ||
<a href="" onclick="voter(<? echo $c["id"] ?>, 1); return false;">+<? echo $c["vote_p"] ?></a>/ | ||
<a href="" onclick="voter(<? echo $c["id"] ?>, -1); return false;">-<? echo $c["vote_m"] ?></a> | ||
</span> | ||
<span class="signaler"><a href="" onclick="signaler(<? echo $c['id'] ?>); return false;">Signaler</a></span> | ||
<a href="index.php?id=<? echo $c['id'] ?>">Raison #<? echo $c['id'] ?></a> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<link rel="stylesheet" type="text/css" href="main.css" /> | ||
<link href='http://fonts.googleapis.com/css?family=Playfair+Display' rel='stylesheet' type='text/css'> | ||
<script language="javascript" src="http://code.jquery.com/jquery-1.6.1.min.js"></script> | ||
<script language="javascript" src="fortune.js"></script> | ||
<script language="javascript"> | ||
function update() { | ||
restant = 500 - $("[name=fortune]").val().length; | ||
$("#carmax").html(restant + " caractères restants."); | ||
} | ||
</script> | ||
<!-- Piwik --> | ||
<script type="text/javascript"> | ||
var pkBaseURL = (("https:" == document.location.protocol) ? "https://dev.wmginfo.com/piwik/" : "http://dev.wmginfo.com/piwik/"); | ||
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); | ||
</script><script type="text/javascript"> | ||
try { | ||
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 6); | ||
piwikTracker.trackPageView(); | ||
piwikTracker.enableLinkTracking(); | ||
} catch( err ) {} | ||
</script><noscript><p><img src="http://dev.wmginfo.com/piwik/piwik.php?idsite=6" style="border:0" alt="" /></p></noscript> | ||
<!-- End Piwik Tracking Code --> | ||
<script type="text/javascript"> | ||
/* <![CDATA[ */ | ||
(function() { | ||
var s = document.createElement('script'), t = document.getElementsByTagName('script')[0]; | ||
s.type = 'text/javascript'; | ||
s.async = true; | ||
s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto'; | ||
t.parentNode.insertBefore(s, t); | ||
})(); | ||
/* ]]> */ | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<? | ||
$db_username=""; | ||
$db_password=""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<? | ||
require_once "../model/db.php"; | ||
|
||
try { | ||
$db = new PDO("mysql:host=localhost;dbname=pqjep", $db_username, $db_password); | ||
|
||
$c = array(); | ||
|
||
if (isset($_GET['id'])) { | ||
$stmt = $db->prepare("SELECT f.id id, SUM(vote_p) vote_p, SUM(vote_m) vote_m, fortune " | ||
."FROM fortune f " | ||
."LEFT OUTER JOIN vote v ON v.id_fortune = f.id " | ||
."WHERE f.id = :id " | ||
."GROUP BY f.id "); | ||
$stmt->bindParam(":id", $_GET["id"]); | ||
$stmt->execute(); | ||
while ($row = $stmt->fetch()) { | ||
$c["id"] = $row["id"]; | ||
$c["fortune"] = $row["fortune"]; | ||
$c["vote_p"] = $row["vote_p"] == null ? 0 : $row["vote_p"]; | ||
$c["vote_m"] = $row["vote_m"] == null ? 0 : $row["vote_m"]; | ||
} | ||
} else { | ||
$query = "SELECT f.id id, SUM(vote_p) vote_p, SUM(vote_m) vote_m, fortune " | ||
."FROM fortune f " | ||
."LEFT OUTER JOIN vote v ON v.id_fortune = f.id " | ||
."GROUP BY f.id " | ||
."ORDER BY RAND() " | ||
."LIMIT 1"; | ||
foreach ($db->query($query) as $row) { | ||
$c["id"] = $row["id"]; | ||
$c["fortune"] = $row["fortune"]; | ||
$c["vote_p"] = $row["vote_p"] == null ? 0 : $row["vote_p"]; | ||
$c["vote_m"] = $row["vote_m"] == null ? 0 : $row["vote_m"]; | ||
} | ||
} | ||
} catch (PDOException $e) { | ||
die("Erreur de base de données. D'oh."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<? | ||
require_once "../model/db.php"; | ||
|
||
try { | ||
$db = new PDO("mysql:host=localhost;dbname=pqjep", $db_username, $db_password); | ||
|
||
foreach ($db->query("SELECT COUNT(*) nb FROM fortune") as $row) { | ||
$count = round($row["nb"] / 10, 0); | ||
} | ||
|
||
$p = isset($_GET['p']) ? mysql_escape_string($_GET['p']) : 0; | ||
$p *= 10; | ||
if ($p < 0) { | ||
$p = 0; | ||
} | ||
|
||
$confessions = array(); | ||
$query = "SELECT f.id id, SUM(vote_p) vote_p, SUM(vote_m) vote_m, fortune " | ||
."FROM fortune f " | ||
."LEFT OUTER JOIN vote v ON v.id_fortune = f.id " | ||
."GROUP BY f.id " | ||
."ORDER BY date_ajout DESC " | ||
."LIMIT $p, 10"; | ||
foreach ($db->query($query) as $row) { | ||
$conf = array(); | ||
$conf['id'] = $row["id"]; | ||
$conf['fortune'] = $row["fortune"]; | ||
$conf["vote_p"] = $row["vote_p"] == null ? 0 : $row["vote_p"]; | ||
$conf["vote_m"] = $row["vote_m"] == null ? 0 : $row["vote_m"]; | ||
array_push($confessions, $conf); | ||
} | ||
} catch (PDOException $e) { | ||
die("Erreur de base de données. D'oh."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<? | ||
require_once "../model/db.php"; | ||
|
||
$selection = isset($_SESSION["selection"]) ? $_SESSION["selection"] : array("nom" => "", "liste" => array()); | ||
|
||
try { | ||
$db = new PDO("mysql:host=localhost;dbname=pqjep", $db_username, $db_password); | ||
|
||
$confessions = array(); | ||
$query = "SELECT f.id id, SUM(vote_p) vote_p, SUM(vote_m) vote_m, fortune " | ||
."FROM fortune f " | ||
."LEFT OUTER JOIN vote v ON v.id_fortune = f.id " | ||
."WHERE f.id = :id " | ||
."GROUP BY f.id "; | ||
|
||
$stmt = $db->prepare($query); | ||
|
||
foreach ($selection["liste"] as $s) { | ||
$stmt->bindParam(":id", $s); | ||
$stmt->execute(); | ||
|
||
if ($row = $stmt->fetch()) { | ||
$conf = array(); | ||
$conf['id'] = $row["id"]; | ||
$conf['fortune'] = $row["fortune"]; | ||
$conf["vote_p"] = $row["vote_p"] == null ? 0 : $row["vote_p"]; | ||
$conf["vote_m"] = $row["vote_m"] == null ? 0 : $row["vote_m"]; | ||
array_push($confessions, $conf); | ||
} | ||
} | ||
|
||
$count = round(count($confessions) / 10); | ||
} catch (PDOException $e) { | ||
die("Erreur de base de données. D'oh."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<? | ||
require_once "../model/db.php"; | ||
|
||
try { | ||
$db = new PDO("mysql:host=localhost;dbname=pqjep", $db_username, $db_password); | ||
|
||
foreach ($db->query("SELECT COUNT(*) nb FROM fortune") as $row) { | ||
$count = round($row["nb"] / 10, 0); | ||
} | ||
|
||
$p = isset($_GET['p']) ? mysql_escape_string($_GET['p']) : 0; | ||
$p *= 10; | ||
if ($p < 0) { | ||
$p = 0; | ||
} | ||
|
||
$confessions = array(); | ||
$query = "SELECT f.id id, SUM(vote_p) vote_p, SUM(vote_m) vote_m, fortune " | ||
."FROM fortune f " | ||
."LEFT OUTER JOIN vote v ON v.id_fortune = f.id " | ||
."GROUP BY f.id " | ||
."ORDER BY SUM(vote_p) DESC, date_ajout DESC " | ||
."LIMIT $p, 10"; | ||
foreach ($db->query($query) as $row) { | ||
$conf = array(); | ||
$conf['id'] = $row["id"]; | ||
$conf['fortune'] = $row["fortune"]; | ||
$conf["vote_p"] = $row["vote_p"] == null ? 0 : $row["vote_p"]; | ||
$conf["vote_m"] = $row["vote_m"] == null ? 0 : $row["vote_m"]; | ||
array_push($confessions, $conf); | ||
} | ||
} catch (PDOException $e) { | ||
die("Erreur de base de données. D'oh."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<? | ||
require_once "../model/db.php"; | ||
|
||
if (!isset($_GET["ids"])) { | ||
header("Location: liste.php"); | ||
} | ||
$ids = $_GET["ids"]; | ||
|
||
try { | ||
$db = new PDO("mysql:host=localhost;dbname=pqjep", $db_username, $db_password); | ||
|
||
$selection = array("nom" => "", "liste" => array()); | ||
|
||
$query = "SELECT nom " | ||
."FROM selection " | ||
."WHERE id = :id"; | ||
$stmt = $db->prepare($query); | ||
$stmt->bindParam(":id", $ids); | ||
$stmt->execute(); | ||
if ($row = $stmt->fetch()) { | ||
$selection["nom"] = $row["nom"]; | ||
} | ||
|
||
$query = "SELECT f.id id, SUM(vote_p) vote_p, SUM(vote_m) vote_m, fortune " | ||
."FROM fortune f " | ||
."LEFT OUTER JOIN vote v ON v.id_fortune = f.id " | ||
."INNER JOIN fortune_selection fs ON f.id = fs.id_fortune " | ||
."WHERE fs.id_selection = :ids " | ||
."GROUP BY f.id " | ||
."ORDER BY date_ajout DESC "; | ||
$stmt = $db->prepare($query); | ||
$stmt->bindParam(":ids", $ids); | ||
$stmt->execute(); | ||
$liste = array(); | ||
while($row = $stmt->fetch()) { | ||
$conf = array(); | ||
$conf['id'] = $row["id"]; | ||
$conf['fortune'] = $row["fortune"]; | ||
$conf["vote_p"] = $row["vote_p"] == null ? 0 : $row["vote_p"]; | ||
$conf["vote_m"] = $row["vote_m"] == null ? 0 : $row["vote_m"]; | ||
array_push($liste, $conf); | ||
} | ||
|
||
$selection["liste"] = $liste; | ||
} catch (PDOException $e) { | ||
die("Erreur de base de données. D'oh."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<? | ||
require_once '../model/db.php'; | ||
|
||
$id = $_GET["id"]; | ||
|
||
try { | ||
$db = new PDO("mysql:host=localhost;dbname=pqjep", $db_username, $db_password); | ||
|
||
$c = array(); | ||
|
||
$query = "SELECT f.id id, SUM(vote_p) vote_p, SUM(vote_m) vote_m, fortune " | ||
."FROM fortune f " | ||
."LEFT OUTER JOIN vote v ON v.id_fortune = f.id " | ||
."WHERE f.id = :id " | ||
."GROUP BY f.id"; | ||
$stmt = $db->prepare($query); | ||
$stmt->bindParam(":id", $id); | ||
$stmt->execute(); | ||
while ($row = $stmt->fetch()) { | ||
$c["id"] = $row["id"]; | ||
$c["fortune"] = $row["fortune"]; | ||
$c["vote_p"] = $row["vote_p"] == null ? 0 : $row["vote_p"]; | ||
$c["vote_m"] = $row["vote_m"] == null ? 0 : $row["vote_m"]; | ||
} | ||
|
||
include "../../fragments/fortune.php"; | ||
} catch (PDOException $e) { | ||
die("Erreur de base de données. D'oh."); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<? | ||
require_once '../model/db.php'; | ||
|
||
try { | ||
$db = new PDO("mysql:host=localhost;dbname=pqjep", $db_username, $db_password); | ||
|
||
$c = array(); | ||
|
||
$query = "SELECT f.id id, SUM(vote_p) vote_p, SUM(vote_m) vote_m, fortune " | ||
."FROM fortune f " | ||
."LEFT OUTER JOIN vote v ON v.id_fortune = f.id " | ||
."GROUP BY f.id " | ||
."ORDER BY RAND() " | ||
."LIMIT 1"; | ||
foreach ($db->query($query) as $row) { | ||
$c["id"] = $row["id"]; | ||
$c["fortune"] = $row["fortune"]; | ||
$c["vote_p"] = $row["vote_p"] == null ? 0 : $row["vote_p"]; | ||
$c["vote_m"] = $row["vote_m"] == null ? 0 : $row["vote_m"]; | ||
} | ||
|
||
include "../../fragments/fortune.php"; | ||
} catch (PDOException $e) { | ||
die("Erreur de base de données. D'oh."); | ||
} | ||
?> |
Oops, something went wrong.