Hmmm... Coś tu jest grubo namieszane, klucz musi być prawidłowy bo jest wpisany ok.. I został wygenerowany dziś rano.
Nieco dodałem i zmodyfikowałem to i niestety kolejne problemy się pojawiają:
Kod
<?php
class Allegro {
{.....}
$aukcje[$lp++]=array(
'id' => $aukcja['it-id'],
'name' => $aukcja['it-name'],
'price' => $price, //pobiera cenę
'time' => (time() + $aukcja['it-time-left']),
'foto_count' => $aukcja['it-foto-count'],
'img' => $obrazek,
'is_auctions'=>$is_auctions
);
}
return true;
}
private function getAuctionsFromAllegroRaw($offset=0)
{
$msg=array(
'user-id' => "14165349",
'webapi-key' => WEBAPI_KEY,
'country-id' => 1,
'user-email' => '',
'offset' => $offset);
$response= $this->soap->__soapCall('doGetUserItems', $msg);
if($response['user-item-count'] == 0) die('Brak aukcji !');
$this->howManyAuctions = $response['user-item-count'];
return $response;
}
private function getImage($url='')
{
if(empty($url)) return '';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
$output = curl_exec($ch);
return $output;
}
private function saveAuctions($aukcje=array())
{
$aukcje = serialize($aukcje);
$file =@ fopen($this->path.'aukcje.txt', "w") OR die('Nie udalo sie zapisac aukcji ! Brak pliku aukcje.txt z prawami do zapisu !');
fwrite($file, $aukcje);
fclose($file);
return;
$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ("Nie mogę się połączyć z memcache!");
if(!$memcache->set($this->allegro_login, $aukcje, false, $this->saveTime)) die("Nie udało się zapisać danych do memcache'a\"); // 30 minut
}
public function readAuctions()
{
if(!file_exists($this->path.'aukcje.txt')) die('Brak danych aukcji');
$this->aukcje = unserialize( file_get_contents( $this->path.'aukcje.txt') );
//echo 'Jest '.count($this->aukcje).' aukcji';
}
public function parsePanel()
{
session_start();
if(isset($_GET['aukcja']))
{
$id = intval($_GET['aukcja']);
$url = $this->getUrlAuction($id);
header('Location: '.$url);
exit;
}
// generacja obrazka
if(isset($_GET['img']))
{
$id = intval($_GET['img']);
$usun = false;
$id_aukcji = ($id - 1);
$do_konca = 'DO KOŃCA : ';
$act = time();
//print_r($end); exit;
$roznica = $this->aukcje[$id_aukcji]['time'] - $act;
//die($act.\' - \'.$end.\' = \'.$roznica);
if($roznica>86400)
{
$days = floor($roznica/86400);
$do_konca.=($days==1)?'1 DZIEŃ':$days.' DNI';
}
else {
if($roznica>3600)
$do_konca.=floor($roznica/3600).' godz.';
else {
$min = floor($roznica/60);
if($min>0)
$do_konca.=$min.' min.';
else {
$do_konca = 'ZAKOŃCZONA';
}
}
}
//echo date(\"Y-m-d H:i:s\", $aukcje[$id][\'time\']).\' \'; die($do_konca);
$img = imagecreatefromjpeg($this->path.'panel_bg.jpg');
$sW = imagesx( $img );
$sH = imagesy( $img );
$red = imagecolorallocate($img, 255, 0, 0);
$black = imagecolorallocate($img, 0, 0, 0);
$green = imagecolorallocate($img, 30, 60, 0);
$blue = imagecolorallocate($img, 0, 102, 153);
$bordo = imagecolorallocate($img, 206, 0, 0);
$size = 8;
$font = $this->path.'verdana.ttf';
//print_r($this->aukcje); exit;
$nazwy = explode("\n", wordwrap($aukcje[$id]['name'], 20, "\n"));
$kup_teraz =($this->aukcje[$id_aukcji]['is_auctions'])? 'KUP TERAZ '.$this->aukcje[$id_aukcji]['price'].'zł':'LICYTACJA '.$this->aukcje[$id_aukcji]['price'].'zł';
$white = imagecolorallocate($img, 0, 0, 0);
$posY = 130;
$posX=0;
foreach($nazwy as $nazwa)
{
$arr = imagettfbbox($size, 0, $font, $nazwa);
$width = abs($arr[2] - $arr[0]) + 5;
$height = abs($arr[1] - $arr[7]) + 1;
$posX = ($sW/2) - ($width/2);
//$posX = $width;
//$posY = $sH;
imagettftext($img, $size, 0, $posX, $posY - 5, $black, $font, $nazwa);
$posY+=$height + 3;
}
// KUP TERAZ
$size =(strlen($kup_teraz)>10)?9:8;
$arr = imagettfbbox($size, 0, $font, $kup_teraz);
$width = abs($arr[2] - $arr[0]) + 5;
$height = abs($arr[1] - $arr[7]) + 1;
$posY = ($sH - $height - 11);
$posX = ($sW/2) - ($width/2);
imagettftext($img, $size, 0, $posX, $posY, $bordo, $font, $kup_teraz);
// DO KOŃCA
$size = 6;
$arr = imagettfbbox($size, 0, $font, $do_konca);
$width = abs($arr[2] - $arr[0]) + 5;
$height = abs($arr[1] - $arr[7]) + 1;
$posY = ($sH - 7);
$posX = ($sW/2) - ($width/2);
imagettftext($img, $size, 0, $posX, $posY, $green, $font, $do_konca);
// Zdjęcie
if(file_exists($this->aukcje[$id_aukcji]['img']))
{
$miniaturka = imagecreatefromjpeg($this->aukcje[$id_aukcji]['img']);
$zW = imagesx( $miniaturka );
$zH = imagesy( $miniaturka );
$dst_x = (($sW/2) - ($zW/2));
$dst_y = 12;
imagecopy( $img, $miniaturka, $dst_x, $dst_y, 0, 0, $zW, $zH );
imagedestroy( $miniaturka );
}
//else die($aukcje[$id_aukcji][\'img\']);
// Delete
// Output
$_SESSION['panel_aukcji'][$id] = $this->aukcje[$id_aukcji]['id'];
header(\'Content-Type: image/jpeg\');
imagejpeg($img, NULL, 100);
imagedestroy($img); exit;
}
return;
}
private function getRandomAuctionId()
{
$id = rand(1, count($this->aukcje) );
while($this->aukcje[$id]['time'] <= 0)
{
$id = rand(1, count($this->aukcje) );
}
return $id;
}
private function getUrlAuction($id=0)
{
// print_r($_SESSION);
if(!isset($_SESSION['panel_aukcji'][$id])) die('Nie ma takiej aukcji w pamięci!');
$dane =(string) $_SESSION['panel_aukcji'][$id];
return 'http://www.allegro.pl/item'.$_SESSION['panel_aukcji'][$id].'_aukcja.html';
}
public function printAuctions()
{
foreach($this->aukcje as $a)
{
echo date("Y-m-d H:i:s", $a['time']).", cena = ".$a['price']."<br />\n";
}
}
}
?>
Linia 162:
Kod
if(isset($_GET['aukcja']))
ERORR:
Kod
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/ogrodni2/public_html/panel/dodatki/allegro.php on line 162
Nie mam pojęcia co oznacza ten error, szukałem męczyłem się i nic..