From 09ac53ee541b28ef9cd04f04174f59fe7bfe100b Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Sun, 12 Aug 2012 13:39:13 +0000
Subject: [PATCH] Użycie funkcji http_build_query do tworzenia zapytań do botmastera w klasie BotAPIGG.

---
 class/BotAPIGG.php |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/class/BotAPIGG.php b/class/BotAPIGG.php
index c8108e1..f375de3 100644
--- a/class/BotAPIGG.php
+++ b/class/BotAPIGG.php
@@ -6,7 +6,7 @@
 	function __construct($msg, $httpcode, $content) {
 		$this->httpcode = $httpcode;
 		$this->content = $content;
-		parent::__construct($msg);
+		parent::__construct($msg.' Błąd '.$httpcode);
 	}
 	
 	function __get($name) {
@@ -44,7 +44,7 @@
 }
 
 class BotAPIGG extends config {
-	private $token;
+	private static $token;
 	
 	const STATUS_DOSTEPNY = 2;
 	const STATUS_DOSTEPNY_DESC = 4;
@@ -151,10 +151,10 @@
 		
 		$tok = $this->httpQuery('https://'.$token['host'].'/setStatus/'.$auth['numer'], array(
 			CURLOPT_POST => TRUE,
-			CURLOPT_POSTFIELDS => array(
+			CURLOPT_POSTFIELDS => http_build_query(array(
 				'status' => $status,
 				'desc' => $desc,
-			),
+			), '', '&'),
 		));
 		
 		if( (string)$tok->status != '0') {
@@ -183,19 +183,19 @@
 		
 		$tok = $this->httpQuery('https://'.$token['host'].'/botmaster/setUrl/'.$auth['numer'], array(
 			CURLOPT_POST => TRUE,
-			CURLOPT_POSTFIELDS => array('hash' => $hash),
+			CURLOPT_POSTFIELDS => http_build_query(array('hash' => $hash), '', '&'),
 		), TRUE, FALSE);
 		
 		return $tok;
 	}
 	
-	function existsImage() {
+	function existsImage($hash) {
 		$auth = $this->APIs['Gadu-Gadu'];
 		$token = $this->getToken();
 		
 		$tok = $this->httpQuery('https://'.$token['host'].'/botmaster/setUrl/'.$auth['numer'], array(
 			CURLOPT_POST => TRUE,
-			CURLOPT_POSTFIELDS => array('hash' => $hash),
+			CURLOPT_POSTFIELDS => http_build_query(array('hash' => $hash), '', '&'),
 		), TRUE, FALSE);
 		
 		if( (string)$tok->status != '0') {

--
Gitblit v1.9.1