Mercurial > defr > DualBlog
changeset 89:e37ef9a81737 tip
Merge
author | Franck Deroche <franck@defr.org> |
---|---|
date | Thu, 13 Dec 2018 00:55:42 +0100 |
parents | 1f2410012dbc (current diff) efb93800fe10 (diff) |
children | |
files | comment.php includes/class.dataaccess.php |
diffstat | 3 files changed, 15 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/comment.php Thu Dec 13 00:54:31 2018 +0100 +++ b/comment.php Thu Dec 13 00:55:42 2018 +0100 @@ -17,7 +17,7 @@ if(!empty($Comment) && $_SESSION['commentSeed'] != $Req->get('seed', null, 't')) die("L'ajout de commentaire doit se faire à partir du formulaire de ce blog"); - if(!is_null($Auteur) && $Auteur!='Votre Nom' && $Auteur != $Adresse && !empty($Comment) && strlen($Comment) > 6 && strpos($Comment, 'xanga') === false) { + if(!is_null($Auteur) && $Auteur!='Votre Nom' && $Auteur != $Adresse && !empty($Comment) && strlen($Comment) > 6) { // Prévention d'un "cassage" par ajout d'un commentaire incorrectement formaté $ip = $_SERVER['REMOTE_ADDR']; $Auteur = str_replace(array('<', '>'), array('<', '>'), $Auteur); @@ -37,8 +37,6 @@ else $visibleBool = false; - // Suppression d'un gros lourd - $visibleBool &= (ereg('^ma[0-9]+zda$', $Auteur) === false); $visible = $visibleBool ? 1 : 0; $doc = @DOMDocument::loadXML('<comment>' . stripslashes($Comment) . '</comment>'); @@ -60,7 +58,7 @@ else $Comment = htmlspecialchars($Comment); - $Data->debugQuery(" + $Data->Query(" INSERT INTO Commentaires(MessId, Auteur, Adresse, AdresseMail, Comment, DateComment, ip, Visible) VALUES({$id}, '{$Auteur}', '{$Adresse}', '{$AdresseMail}', '{$Comment}', '{$DateComment}', '{$ip}', $visible) ");
--- a/includes/akismet.class.php Thu Dec 13 00:54:31 2018 +0100 +++ b/includes/akismet.class.php Thu Dec 13 00:55:42 2018 +0100 @@ -124,8 +124,8 @@ // Constructor - function AkismetHttpClient($host, $blogUrl, $apiKey, $port = 80) { - $this->host = $host; + function __construct($host, $blogUrl, $apiKey, $port = 80) { + $this->host = $apiKey . '.' . $host; $this->port = $port; $this->blogUrl = $blogUrl; $this->apiKey = $apiKey; @@ -139,7 +139,7 @@ if($this->con && !$this->isError(AKISMET_SERVER_NOT_FOUND)) { $request = strToUpper($type)." /{$this->akismetVersion}/$path HTTP/1.1\r\n" . - "Host: ".((!empty($this->apiKey)) ? $this->apiKey."." : null)."{$this->host}\r\n" . + "Host: {$this->host}\r\n" . "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n" . "Content-Length: ".strlen($request)."\r\n" . "User-Agent: Akismet PHP4 Class\r\n" . @@ -166,8 +166,8 @@ // Connect to the Akismet server and store that connection in the instance variable $con function _connect() { - if(!($this->con = @fsockopen($this->host, $this->port))) { - $this->setError(AKISMET_SERVER_NOT_FOUND, "Could not connect to akismet server."); + if(!($this->con = @fsockopen('ssl://' . $this->host, $this->port, $errno, $errstr))) { + $this->setError(AKISMET_SERVER_NOT_FOUND, "Could not connect to akismet server: " . $errstr); } } @@ -187,7 +187,7 @@ // The controlling class. This is the ONLY class the user should instantiate in // order to use the Akismet service! class Akismet extends AkismetObject { - var $apiPort = 80; + var $apiPort = 443; var $akismetServer = 'rest.akismet.com'; var $akismetVersion = '1.1'; var $http; @@ -223,13 +223,13 @@ * @param String[] $comment A formatted comment array to be examined by the Akismet service * @return Akismet */ - function Akismet($blogUrl, $apiKey, $comment = array()) { + function __construct($blogUrl, $apiKey, $comment = array()) { $this->blogUrl = $blogUrl; $this->apiKey = $apiKey; $this->setComment($comment); // Connect to the Akismet server and populate errors if they exist - $this->http = new AkismetHttpClient($this->akismetServer, $blogUrl, $apiKey); + $this->http = new AkismetHttpClient($this->akismetServer, $blogUrl, $apiKey, $this->apiPort); if($this->http->errorsExist()) { $this->errors = array_merge($this->errors, $this->http->getErrors()); } @@ -385,4 +385,4 @@ } -?> \ No newline at end of file +?>
--- a/includes/class.dataaccess.php Thu Dec 13 00:54:31 2018 +0100 +++ b/includes/class.dataaccess.php Thu Dec 13 00:55:42 2018 +0100 @@ -47,10 +47,10 @@ } function debugQuery($query, $id=0) { - $rv = $this->Query($query, $id); - if(mysql_errno() !== 0) - echo("<span class='menu'>\n Query : {$query}<br />\n MySQL Answer : " . mysql_error() . "</span>"); - return $rv; + $rv = $this->Query($query, $id); + if(mysqli_errno($this->link) !== 0) + echo("<span class='menu'>\n Query : {$query}<br />\n MySQL Answer : " . mysql_error() . "</span>"); + return $rv; } function GetRow($id=0) {