-
Notifications
You must be signed in to change notification settings - Fork 1
/
project.php
156 lines (128 loc) · 3.94 KB
/
project.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<?php
$pid = $_GET["id"];
function dbg($str)
{
echo "\n<!-- DEBUG\n", $str, "\n-->\n";
}
function dvar($var)
{
echo "\n<!-- DEBUG\n";
var_dump($var);
echo "\n-->\n";
}
// Include config file
require_once "config.php";
// Include relevant classes
require_once $basedir."/include/Database.class.php";
require_once $basedir."/include/ProjectView.class.php";
$db = new Database($dbfile);
$project = $db->fetchProject($pid);
$view = new ProjectView($project);
$script = $view->getScript($payname_token, $site_url);
$onload = "onload=\"initOptions()\"";
$page_title = "Prot-o-thon : Aidez au développement du ".$project->title." !";
include $basedir."/template/header.php";
?>
<div class="row-fluid">
<div class="span10 offset1">
<?php
if ($_GET["return"] == "0")
{
$url = 'https://plus.payname.fr/api/paiement-information?token=';
$url .= $payname_token."&hash=".$project->proto_hash;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$decoded = json_decode($response, true);
if ($decoded["success"] == true)
{
if ($decoded["status"] == "failed")
{
echo '<div class="alert alert-danger"><i class="fa fa-times"></i> Votre paiement a été refusé. S\'il s\'agit d\'une erreur, n\'hésitez pas à réessayer !</div>';
}
elseif($decoded["status"] == "finished")
{
$db->markProtoSold($project);
echo '<div class="alert alert-success"><i class="fa fa-check-circle"></i> Merci pour votre soutien ! Nous vous contacterons par mail d\'ici peu.</div>';
}
else
{
echo '<div class="alert"><i class="fa fa-exclamation-triangle"></i> Votre paiement n\'a pas été finalisé.</div>';
}
}
}
elseif($_GET["return"] == "1")
{
echo "<div class=\"alert alert-success\">\n";
echo "<i class=\"fa fa-check-circle\"></i> Merci pour votre soutien ! Votre contribution sera prise en compte d'ici peu.\n";
echo "</div>";
}
$db->close();
?>
<div class="heading"><h1><?php echo $project->title; ?></h1></div>
<div class="insidem">
<!-- component -->
<div class="row-fluid">
<div class="span8">
<img src="<?php echo $project->image; ?>" width="80%" class="img-rounded project-image">
<br>
<div class="description">
<?php $view->printSummary(); ?>
<br>
</div>
</div>
<div class="span4">
<div class="reward" title="Prototype">
<?php $view->printProto(); ?>
</div>
<div class="reward" title="Projet">
<p>Soutenez la réalisation de ce projet et sa diffusion en Open Source .</p>
<p>Le montant de votre participation est entièrement libre.</p>
<div class="row-fluid">
<div class="progress">
<div class="bar" style="width: <?php echo $project->project_progress; ?>%">
<div class="progressText"><?php echo $project->project_raised; ?>/<?php echo $project->project_price; ?>€</div>
</div>
</div>
</div>
<div class="row-fluid">
<a class="span5 offset7 btn btn-info btn-block" href="<?php echo $project->project_link; ?>">Contribuer</a>
</div>
</div>
</div>
</div>
<hr>
<div class="row-fluid">
<div class="span8">
<br>
<div class="description">
<?php $view->printDesc(); ?>
</div>
</div>
<div class="span4">
<?php $view->optionsDesc(); ?>
</div>
</div>
<div class="clearfix"></div>
<!-- end insidem div -->
</div>
<div class="clearm"></div>
<div class="clearfix"> </div>
<!-- end mid block main content span -->
</div>
<div class="span1 leftborder hidden-phone hidden-tablet"></div>
<div class="span1 rightborder hidden-phone hidden-tablet"></div>
<!-- end mid block row-fluid class -->
</div>
<div class="details row-fluid">
<div class="container-fluid span10 offset1">
<div class="row-fluid">
<div class="span12">
<?php $view->printSpecs(); ?>
</div>
</div>
</div>
<!-- end details block -->
</div>
<?php include $basedir."/template/footer.php"; ?>