mirror of
https://github.com/processwire/processwire.git
synced 2025-08-13 10:15:28 +02:00
Fix issue processwire/processwire-issues#1041
This commit is contained in:
@@ -42,7 +42,7 @@ class PWGIFLZW {
|
|||||||
}
|
}
|
||||||
function LZWCommand(&$data, $bInit) {
|
function LZWCommand(&$data, $bInit) {
|
||||||
if($bInit) {
|
if($bInit) {
|
||||||
$this->SetCodeSize = ord($data{0});
|
$this->SetCodeSize = ord($data[0]);
|
||||||
$data = substr($data, 1);
|
$data = substr($data, 1);
|
||||||
$this->CodeSize = $this->SetCodeSize + 1;
|
$this->CodeSize = $this->SetCodeSize + 1;
|
||||||
$this->ClearCode = 1 << $this->SetCodeSize;
|
$this->ClearCode = 1 << $this->SetCodeSize;
|
||||||
@@ -147,11 +147,11 @@ class PWGIFLZW {
|
|||||||
}
|
}
|
||||||
$this->Buf[0] = $this->Buf[$this->LastByte - 2];
|
$this->Buf[0] = $this->Buf[$this->LastByte - 2];
|
||||||
$this->Buf[1] = $this->Buf[$this->LastByte - 1];
|
$this->Buf[1] = $this->Buf[$this->LastByte - 1];
|
||||||
$Count = ord($data{0});
|
$Count = ord($data[0]);
|
||||||
$data = substr($data, 1);
|
$data = substr($data, 1);
|
||||||
if($Count) {
|
if($Count) {
|
||||||
for($i = 0; $i < $Count; $i++) {
|
for($i = 0; $i < $Count; $i++) {
|
||||||
$this->Buf[2 + $i] = ord($data{$i});
|
$this->Buf[2 + $i] = ord($data[$i]);
|
||||||
}
|
}
|
||||||
$data = substr($data, $Count);
|
$data = substr($data, $Count);
|
||||||
} else {
|
} else {
|
||||||
@@ -187,7 +187,7 @@ class PWGIFCOLORTABLE {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if($this->extended) {
|
if($this->extended) {
|
||||||
$this->m_arColors[] = (ord($rgb{2}) << 16) + (ord($rgb{1}) << 8) + ord($rgb{0});
|
$this->m_arColors[] = (ord($rgb[2]) << 16) + (ord($rgb[1]) << 8) + ord($rgb[0]);
|
||||||
}
|
}
|
||||||
$this->m_nColors++;
|
$this->m_nColors++;
|
||||||
}
|
}
|
||||||
@@ -310,7 +310,7 @@ class PWGIFIMAGEHEADER {
|
|||||||
if(!$this->m_nWidth || !$this->m_nHeight) {
|
if(!$this->m_nWidth || !$this->m_nHeight) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$b = ord($lpData{8});
|
$b = ord($lpData[8]);
|
||||||
$this->m_bLocalClr = ($b & 0x80) ? true : false;
|
$this->m_bLocalClr = ($b & 0x80) ? true : false;
|
||||||
$this->m_bInterlace = ($b & 0x40) ? true : false;
|
$this->m_bInterlace = ($b & 0x40) ? true : false;
|
||||||
$this->m_bSorted = ($b & 0x20) ? true : false;
|
$this->m_bSorted = ($b & 0x20) ? true : false;
|
||||||
@@ -355,7 +355,7 @@ class PWGIFIMAGE {
|
|||||||
public function load($data, &$datLen) {
|
public function load($data, &$datLen) {
|
||||||
$datLen = 0;
|
$datLen = 0;
|
||||||
while(true) {
|
while(true) {
|
||||||
$b = ord($data{0});
|
$b = ord($data[0]);
|
||||||
$data = substr($data, 1);
|
$data = substr($data, 1);
|
||||||
$datLen++;
|
$datLen++;
|
||||||
switch($b) {
|
switch($b) {
|
||||||
@@ -399,7 +399,7 @@ class PWGIFIMAGE {
|
|||||||
}
|
}
|
||||||
function skipExt(&$data, &$extLen) {
|
function skipExt(&$data, &$extLen) {
|
||||||
$extLen = 0;
|
$extLen = 0;
|
||||||
$b = ord($data{0});
|
$b = ord($data[0]);
|
||||||
$data = substr($data, 1);
|
$data = substr($data, 1);
|
||||||
$extLen++;
|
$extLen++;
|
||||||
switch($b) {
|
switch($b) {
|
||||||
@@ -409,10 +409,10 @@ class PWGIFIMAGE {
|
|||||||
$this->m_bUser = ($b & 0x02) ? true : false;
|
$this->m_bUser = ($b & 0x02) ? true : false;
|
||||||
$this->m_bTrans = ($b & 0x01) ? true : false;
|
$this->m_bTrans = ($b & 0x01) ? true : false;
|
||||||
$this->m_nDelay = $this->w2i(substr($data, 2, 2));
|
$this->m_nDelay = $this->w2i(substr($data, 2, 2));
|
||||||
$this->m_nTrans = ord($data{4});
|
$this->m_nTrans = ord($data[4]);
|
||||||
break;
|
break;
|
||||||
case 0xFE: // Comment
|
case 0xFE: // Comment
|
||||||
$this->m_lpComm = substr($data, 1, ord($data{0}));
|
$this->m_lpComm = substr($data, 1, ord($data[0]));
|
||||||
break;
|
break;
|
||||||
case 0x01: // Plain text
|
case 0x01: // Plain text
|
||||||
break;
|
break;
|
||||||
@@ -420,13 +420,13 @@ class PWGIFIMAGE {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// SKIP DEFAULT AS DEFS MAY CHANGE
|
// SKIP DEFAULT AS DEFS MAY CHANGE
|
||||||
$b = ord($data{0});
|
$b = ord($data[0]);
|
||||||
$data = substr($data, 1);
|
$data = substr($data, 1);
|
||||||
$extLen++;
|
$extLen++;
|
||||||
while($b > 0) {
|
while($b > 0) {
|
||||||
$data = substr($data, $b);
|
$data = substr($data, $b);
|
||||||
$extLen += $b;
|
$extLen += $b;
|
||||||
$b = ord($data{0});
|
$b = ord($data[0]);
|
||||||
$data = substr($data, 1);
|
$data = substr($data, 1);
|
||||||
$extLen++;
|
$extLen++;
|
||||||
}
|
}
|
||||||
|
@@ -429,12 +429,16 @@ class PageTraversal {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
$row = reset($rows);
|
$row = reset($rows);
|
||||||
$result = $pages->getById(array($row['id']), array(
|
if($row && !empty($row['id'])) {
|
||||||
'template' => $page->wire('templates')->get($row['templates_id']),
|
$result = $pages->getById(array($row['id']), array(
|
||||||
'parent_id' => $row['parent_id'],
|
'template' => $page->wire('templates')->get($row['templates_id']),
|
||||||
'getOne' => true,
|
'parent_id' => $row['parent_id'],
|
||||||
'cache' => $page->loaderCache
|
'getOne' => true,
|
||||||
));
|
'cache' => $page->loaderCache
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
$result = $pages->newNullPage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
Reference in New Issue
Block a user