{"action":"created","comment":{"url":"https://api.github.com/repos/afup/web/pulls/comments/39636076","id":39636076,"diff_hunk":"@@ -0,0 +1,79 @@\n+<?php\n+require_once '../../include/prepend.inc.php';\n+require_once dirname(__FILE__) . '/_config.inc.php';\n+require_once dirname(__FILE__) . '/../../../sources/Afup/Bootstrap/_Common.php';\n+require_once dirname(__FILE__).'/../../../sources/Afup/AFUP_Inscriptions_Forum.php';\n+require_once dirname(__FILE__).'/../../../sources/Afup/AFUP_Facturation_Forum.php';\n+\n+$forum_inscriptions = new AFUP_Inscriptions_Forum($bdd);\n+$forum_facturation = new AFUP_Facturation_Forum($bdd);\n+\n+if (in_array($_SERVER['REMOTE_ADDR'], ['195.101.99.73', '195.101.99.76', '194.2.160.66', '194.2.122.158','195.25.7.146', '195.25.7.166']) === false) {\n+    /// Ici sont rencensees les IP indiquées par paybox dans leur doc\n+    die('...');\n+}\n+\n+\n+$status = $_GET['status'];\n+$etat = AFUP_FORUM_ETAT_ERREUR;\n+\n+if ($status === '00000') {\n+    $etat = AFUP_FORUM_ETAT_REGLE;\n+} elseif ($status === '00015') {\n+    // Designe un paiement deja effectue : on a surement deja eu le retour donc on s'arrete\n+    die;\n+} elseif ($status === '00117') {\n+    $etat = AFUP_FORUM_ETAT_ANNULE;\n+} elseif (substr($status, 0, 3) === '001') {\n+    $etat = AFUP_FORUM_ETAT_REFUSE;\n+}\n+\n+$forum_inscriptions->modifierEtatInscription($_GET['cmd'], $etat);\n+$forum_facturation->enregistrerInformationsTransaction($_GET['cmd'], $_GET['autorisation'], $_GET['transaction']);\n+\n+if ($etat === AFUP_FORUM_ETAT_REGLE && $forum_facturation->estFacture($_GET['cmd'])) {\n+    $facture = $forum_facturation->obtenir($_GET['cmd']);\n+\n+    // Send the invoice\n+    $forum_facturation->envoyerFacture($facture);\n+\n+    // Send register confirmation\n+    $mail = new AFUP_Mail();\n+    $registrations = $forum_inscriptions->getRegistrationsByReference($facture['reference']);\n+\n+    foreach ($registrations as $registration) {\n+        $receiver = array(\n+            'email' => $registration['email'],\n+            'name'  => sprintf('%s %s', $registration['prenom'], $registration['nom']),\n+        );\n+        $data = $registration;\n+\n+        if (!$mail->send('confirmation-inscription-forum-php-2015', $receiver, $data)) {\n+            $message = <<<HTML\n+Impossible d'envoyer la confirmation d'inscription après paiement pour le forum en cours.<br>\n+Facture : {$registration['reference']}<br/>\n+Contact : {$registration['prenom']} {$registration['nom']} &lt;{$registration['email']}&gt;\n+HTML;\n+            $mail->sendSimpleMessage(\n+                \"Impossible d'envoyer la confirmation\",\n+                $message,\n+                array(\n+                    array(\n+                        'name' => 'Trésorier AFUP',\n+                        'email' => 'tresocier@afup.org',\n+                    ),\n+                    array(\n+                        'name' => 'Communication AFUP',\n+                        'email' => 'communication@afup.org',\n+                    ),\n+                )\n+            );\n+        }\n+    }\n+\n+} else {","path":"htdocs/pages/forumphp2015/paybox_retour.php","position":74,"original_position":74,"commit_id":"d151bb369046ee0058d977a3ff8c2eadf2086090","original_commit_id":"d151bb369046ee0058d977a3ff8c2eadf2086090","user":{"login":"jacquesbh","id":858611,"avatar_url":"https://avatars.githubusercontent.com/u/858611?v=3","gravatar_id":"","url":"https://api.github.com/users/jacquesbh","html_url":"https://github.com/jacquesbh","followers_url":"https://api.github.com/users/jacquesbh/followers","following_url":"https://api.github.com/users/jacquesbh/following{/other_user}","gists_url":"https://api.github.com/users/jacquesbh/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquesbh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquesbh/subscriptions","organizations_url":"https://api.github.com/users/jacquesbh/orgs","repos_url":"https://api.github.com/users/jacquesbh/repos","events_url":"https://api.github.com/users/jacquesbh/events{/privacy}","received_events_url":"https://api.github.com/users/jacquesbh/received_events","type":"User","site_admin":false},"body":"Ce `else` il est pas censé être pour le `if (!$mail->send('confirmation-inscription-forum-php-2015', $receiver, $data))` ??","created_at":"2015-09-16T14:27:52Z","updated_at":"2015-09-16T14:27:52Z","html_url":"https://github.com/afup/web/pull/127#discussion_r39636076","pull_request_url":"https://api.github.com/repos/afup/web/pulls/127","_links":{"self":{"href":"https://api.github.com/repos/afup/web/pulls/comments/39636076"},"html":{"href":"https://github.com/afup/web/pull/127#discussion_r39636076"},"pull_request":{"href":"https://api.github.com/repos/afup/web/pulls/127"}}},"pull_request":{"url":"https://api.github.com/repos/afup/web/pulls/127","id":45176527,"html_url":"https://github.com/afup/web/pull/127","diff_url":"https://github.com/afup/web/pull/127.diff","patch_url":"https://github.com/afup/web/pull/127.patch","issue_url":"https://api.github.com/repos/afup/web/issues/127","number":127,"state":"open","locked":false,"title":"Paybox : retour serveur à serveur","user":{"login":"xavierleune","id":2320425,"avatar_url":"https://avatars.githubusercontent.com/u/2320425?v=3","gravatar_id":"","url":"https://api.github.com/users/xavierleune","html_url":"https://github.com/xavierleune","followers_url":"https://api.github.com/users/xavierleune/followers","following_url":"https://api.github.com/users/xavierleune/following{/other_user}","gists_url":"https://api.github.com/users/xavierleune/gists{/gist_id}","starred_url":"https://api.github.com/users/xavierleune/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xavierleune/subscriptions","organizations_url":"https://api.github.com/users/xavierleune/orgs","repos_url":"https://api.github.com/users/xavierleune/repos","events_url":"https://api.github.com/users/xavierleune/events{/privacy}","received_events_url":"https://api.github.com/users/xavierleune/received_events","type":"User","site_admin":false},"body":"Activation du mode de retour serveur à serveur sur présence du paramètre $_GET['repondre_a'] sur la page de post de l'inscription.\r\n\r\nCela permet de faire alors une redirection vers le wordpress plutôt que le site legacy.","created_at":"2015-09-16T14:14:51Z","updated_at":"2015-09-16T14:27:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eab24da8918f8411d2258c5a7de1ba7ae5f2e28c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/afup/web/pulls/127/commits","review_comments_url":"https://api.github.com/repos/afup/web/pulls/127/comments","review_comment_url":"https://api.github.com/repos/afup/web/pulls/comments{/number}","comments_url":"https://api.github.com/repos/afup/web/issues/127/comments","statuses_url":"https://api.github.com/repos/afup/web/statuses/d151bb369046ee0058d977a3ff8c2eadf2086090","head":{"label":"afup:feature/paiement","ref":"feature/paiement","sha":"d151bb369046ee0058d977a3ff8c2eadf2086090","user":{"login":"afup","id":1090307,"avatar_url":"https://avatars.githubusercontent.com/u/1090307?v=3","gravatar_id":"","url":"https://api.github.com/users/afup","html_url":"https://github.com/afup","followers_url":"https://api.github.com/users/afup/followers","following_url":"https://api.github.com/users/afup/following{/other_user}","gists_url":"https://api.github.com/users/afup/gists{/gist_id}","starred_url":"https://api.github.com/users/afup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afup/subscriptions","organizations_url":"https://api.github.com/users/afup/orgs","repos_url":"https://api.github.com/users/afup/repos","events_url":"https://api.github.com/users/afup/events{/privacy}","received_events_url":"https://api.github.com/users/afup/received_events","type":"Organization","site_admin":false},"repo":{"id":16863464,"name":"web","full_name":"afup/web","owner":{"login":"afup","id":1090307,"avatar_url":"https://avatars.githubusercontent.com/u/1090307?v=3","gravatar_id":"","url":"https://api.github.com/users/afup","html_url":"https://github.com/afup","followers_url":"https://api.github.com/users/afup/followers","following_url":"https://api.github.com/users/afup/following{/other_user}","gists_url":"https://api.github.com/users/afup/gists{/gist_id}","starred_url":"https://api.github.com/users/afup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afup/subscriptions","organizations_url":"https://api.github.com/users/afup/orgs","repos_url":"https://api.github.com/users/afup/repos","events_url":"https://api.github.com/users/afup/events{/privacy}","received_events_url":"https://api.github.com/users/afup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/afup/web","description":"The current AFUP's website","fork":false,"url":"https://api.github.com/repos/afup/web","forks_url":"https://api.github.com/repos/afup/web/forks","keys_url":"https://api.github.com/repos/afup/web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/afup/web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/afup/web/teams","hooks_url":"https://api.github.com/repos/afup/web/hooks","issue_events_url":"https://api.github.com/repos/afup/web/issues/events{/number}","events_url":"https://api.github.com/repos/afup/web/events","assignees_url":"https://api.github.com/repos/afup/web/assignees{/user}","branches_url":"https://api.github.com/repos/afup/web/branches{/branch}","tags_url":"https://api.github.com/repos/afup/web/tags","blobs_url":"https://api.github.com/repos/afup/web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/afup/web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/afup/web/git/refs{/sha}","trees_url":"https://api.github.com/repos/afup/web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/afup/web/statuses/{sha}","languages_url":"https://api.github.com/repos/afup/web/languages","stargazers_url":"https://api.github.com/repos/afup/web/stargazers","contributors_url":"https://api.github.com/repos/afup/web/contributors","subscribers_url":"https://api.github.com/repos/afup/web/subscribers","subscription_url":"https://api.github.com/repos/afup/web/subscription","commits_url":"https://api.github.com/repos/afup/web/commits{/sha}","git_commits_url":"https://api.github.com/repos/afup/web/git/commits{/sha}","comments_url":"https://api.github.com/repos/afup/web/comments{/number}","issue_comment_url":"https://api.github.com/repos/afup/web/issues/comments{/number}","contents_url":"https://api.github.com/repos/afup/web/contents/{+path}","compare_url":"https://api.github.com/repos/afup/web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/afup/web/merges","archive_url":"https://api.github.com/repos/afup/web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/afup/web/downloads","issues_url":"https://api.github.com/repos/afup/web/issues{/number}","pulls_url":"https://api.github.com/repos/afup/web/pulls{/number}","milestones_url":"https://api.github.com/repos/afup/web/milestones{/number}","notifications_url":"https://api.github.com/repos/afup/web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/afup/web/labels{/name}","releases_url":"https://api.github.com/repos/afup/web/releases{/id}","created_at":"2014-02-15T13:41:32Z","updated_at":"2015-05-25T11:43:55Z","pushed_at":"2015-09-16T14:14:51Z","git_url":"git://github.com/afup/web.git","ssh_url":"git@github.com:afup/web.git","clone_url":"https://github.com/afup/web.git","svn_url":"https://github.com/afup/web","homepage":null,"size":204051,"stargazers_count":6,"watchers_count":6,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":17,"forks":16,"open_issues":17,"watchers":6,"default_branch":"master"}},"base":{"label":"afup:master","ref":"master","sha":"59fc8674b89ac387b520dc0a842da4bf6a688240","user":{"login":"afup","id":1090307,"avatar_url":"https://avatars.githubusercontent.com/u/1090307?v=3","gravatar_id":"","url":"https://api.github.com/users/afup","html_url":"https://github.com/afup","followers_url":"https://api.github.com/users/afup/followers","following_url":"https://api.github.com/users/afup/following{/other_user}","gists_url":"https://api.github.com/users/afup/gists{/gist_id}","starred_url":"https://api.github.com/users/afup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afup/subscriptions","organizations_url":"https://api.github.com/users/afup/orgs","repos_url":"https://api.github.com/users/afup/repos","events_url":"https://api.github.com/users/afup/events{/privacy}","received_events_url":"https://api.github.com/users/afup/received_events","type":"Organization","site_admin":false},"repo":{"id":16863464,"name":"web","full_name":"afup/web","owner":{"login":"afup","id":1090307,"avatar_url":"https://avatars.githubusercontent.com/u/1090307?v=3","gravatar_id":"","url":"https://api.github.com/users/afup","html_url":"https://github.com/afup","followers_url":"https://api.github.com/users/afup/followers","following_url":"https://api.github.com/users/afup/following{/other_user}","gists_url":"https://api.github.com/users/afup/gists{/gist_id}","starred_url":"https://api.github.com/users/afup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afup/subscriptions","organizations_url":"https://api.github.com/users/afup/orgs","repos_url":"https://api.github.com/users/afup/repos","events_url":"https://api.github.com/users/afup/events{/privacy}","received_events_url":"https://api.github.com/users/afup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/afup/web","description":"The current AFUP's website","fork":false,"url":"https://api.github.com/repos/afup/web","forks_url":"https://api.github.com/repos/afup/web/forks","keys_url":"https://api.github.com/repos/afup/web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/afup/web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/afup/web/teams","hooks_url":"https://api.github.com/repos/afup/web/hooks","issue_events_url":"https://api.github.com/repos/afup/web/issues/events{/number}","events_url":"https://api.github.com/repos/afup/web/events","assignees_url":"https://api.github.com/repos/afup/web/assignees{/user}","branches_url":"https://api.github.com/repos/afup/web/branches{/branch}","tags_url":"https://api.github.com/repos/afup/web/tags","blobs_url":"https://api.github.com/repos/afup/web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/afup/web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/afup/web/git/refs{/sha}","trees_url":"https://api.github.com/repos/afup/web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/afup/web/statuses/{sha}","languages_url":"https://api.github.com/repos/afup/web/languages","stargazers_url":"https://api.github.com/repos/afup/web/stargazers","contributors_url":"https://api.github.com/repos/afup/web/contributors","subscribers_url":"https://api.github.com/repos/afup/web/subscribers","subscription_url":"https://api.github.com/repos/afup/web/subscription","commits_url":"https://api.github.com/repos/afup/web/commits{/sha}","git_commits_url":"https://api.github.com/repos/afup/web/git/commits{/sha}","comments_url":"https://api.github.com/repos/afup/web/comments{/number}","issue_comment_url":"https://api.github.com/repos/afup/web/issues/comments{/number}","contents_url":"https://api.github.com/repos/afup/web/contents/{+path}","compare_url":"https://api.github.com/repos/afup/web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/afup/web/merges","archive_url":"https://api.github.com/repos/afup/web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/afup/web/downloads","issues_url":"https://api.github.com/repos/afup/web/issues{/number}","pulls_url":"https://api.github.com/repos/afup/web/pulls{/number}","milestones_url":"https://api.github.com/repos/afup/web/milestones{/number}","notifications_url":"https://api.github.com/repos/afup/web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/afup/web/labels{/name}","releases_url":"https://api.github.com/repos/afup/web/releases{/id}","created_at":"2014-02-15T13:41:32Z","updated_at":"2015-05-25T11:43:55Z","pushed_at":"2015-09-16T14:14:51Z","git_url":"git://github.com/afup/web.git","ssh_url":"git@github.com:afup/web.git","clone_url":"https://github.com/afup/web.git","svn_url":"https://github.com/afup/web","homepage":null,"size":204051,"stargazers_count":6,"watchers_count":6,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":17,"forks":16,"open_issues":17,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/afup/web/pulls/127"},"html":{"href":"https://github.com/afup/web/pull/127"},"issue":{"href":"https://api.github.com/repos/afup/web/issues/127"},"comments":{"href":"https://api.github.com/repos/afup/web/issues/127/comments"},"review_comments":{"href":"https://api.github.com/repos/afup/web/pulls/127/comments"},"review_comment":{"href":"https://api.github.com/repos/afup/web/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/afup/web/pulls/127/commits"},"statuses":{"href":"https://api.github.com/repos/afup/web/statuses/d151bb369046ee0058d977a3ff8c2eadf2086090"}}}}