From 7f6f1d7092477edde9431cea7c3703ee72ef5eb5 Mon Sep 17 00:00:00 2001 From: Matthieu Codron Date: Mon, 29 Apr 2013 11:10:00 +0200 Subject: [PATCH 1/3] correct floIcon to work on big-endian architectures all unpacks where machine byte order dependant (by the use of S and L pack codes) using respectively v and V seems to correct the issue. should fix #255, #294 --- libs/floIcon.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/floIcon.php b/libs/floIcon.php index c35ca0f9da..708fbdd397 100644 --- a/libs/floIcon.php +++ b/libs/floIcon.php @@ -288,7 +288,7 @@ function getBestImage($height = 32, $width = 32) { function readICO($file, $offset = 0) { if (file_exists($file) && filesize($file) > 0 && $filePointer = fopen($file, "r")) { fseek($filePointer, $offset); - $header = unpack("SReserved/SType/SCount", fread($filePointer, 6)); + $header = unpack("vReserved/vType/vCount", fread($filePointer, 6)); for ($t = 0; $t < $header["Count"]; $t++) { $newImage = new floIconImage(); $newImage->readImageFromICO($filePointer, 6 + ($t * 16)); @@ -778,14 +778,14 @@ function readImageFromICO($filePointer, $entryOffset) { // Get the entry. fseek($filePointer, $entryOffset); $this->_entryIconFormat = fread($filePointer, 16); - $this->_entry = unpack("CWidth/CHeight/CColorCount/CReserved/SPlanes/SBitCount/LSizeInBytes/LFileOffset", $this->_entryIconFormat); + $this->_entry = unpack("CWidth/CHeight/CColorCount/CReserved/vPlanes/vBitCount/VSizeInBytes/VFileOffset", $this->_entryIconFormat); // Position the file pointer. fseek($filePointer, $this->_entry["FileOffset"]); // Get the header. $this->_headerIconFormat = fread($filePointer, 40); - $this->_header = unpack("LSize/LWidth/LHeight/SPlanes/SBitCount/LCompression/LImageSize/LXpixelsPerM/LYpixelsPerM/LColorsUsed/LColorsImportant", $this->_headerIconFormat); + $this->_header = unpack("VSize/VWidth/VHeight/vPlanes/vBitCount/VCompression/VImageSize/VXpixelsPerM/VYpixelsPerM/VColorsUsed/VColorsImportant", $this->_headerIconFormat); // Get the image. $this->_imageIconFormat = @fread($filePointer, $this->_entry["SizeInBytes"] - strlen($this->_headerIconFormat)); From 3f01a658f62ccbba4d0632e9e143895463891151 Mon Sep 17 00:00:00 2001 From: Thomas Muguet Date: Wed, 1 May 2013 02:12:45 +0200 Subject: [PATCH 2/3] Added spout for Facebook page feed --- spouts/facebook/page.php | 83 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 spouts/facebook/page.php diff --git a/spouts/facebook/page.php b/spouts/facebook/page.php new file mode 100644 index 0000000000..c46d02d2bf --- /dev/null +++ b/spouts/facebook/page.php @@ -0,0 +1,83 @@ + + */ +class page extends \spouts\rss\feed { + + /** + * name of source + * + * @var string + */ + public $name = 'Facebook page feed'; + + + /** + * description of this source type + * + * @var string + */ + public $description = 'Page wall'; + + + /** + * config params + * array of arrays with name, type, default value, required, validation type + * + * - Values for type: text, password, checkbox + * - Values for validation: alpha, email, numeric, int, alnum, notempty + * + * e.g. + * array( + * "id" => array( + * "title" => "URL", + * "type" => "text", + * "default" => "", + * "required" => true, + * "validation" => array("alnum") + * ), + * .... + * ) + * + * @var bool|mixed + */ + public $params = array( + "user" => array( + "title" => "Page name", + "type" => "text", + "default" => "", + "required" => true, + "validation" => array("notempty") + ) + ); + + + + // + // Source Methods + // + + + /** + * loads content for given source + * I supress all Warnings of SimplePie for ensuring + * working plugin in PHP Strict mode + * + * @return void + * @param mixed $params the params of this source + */ + public function load($params) { + $info = json_decode(file_get_contents("https://graph.facebook.com/" . $params['user']), TRUE); + + $rssParams = array("url" => "https://www.facebook.com/feeds/page.php?format=atom10&id=" . $info['id']); + return parent::load($rssParams); + } +} From 616e05ffb0413adedf4d606062c5da041f7a48b0 Mon Sep 17 00:00:00 2001 From: Thomas Muguet Date: Wed, 1 May 2013 02:38:02 +0200 Subject: [PATCH 3/3] Reverted comments, suppressed warnings --- spouts/facebook/page.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spouts/facebook/page.php b/spouts/facebook/page.php index c46d02d2bf..74856b0ec7 100644 --- a/spouts/facebook/page.php +++ b/spouts/facebook/page.php @@ -7,7 +7,9 @@ * * @package spouts * @subpackage facebook + * @copyright Copyright (c) Tobias Zeising (http://www.aditu.de) * @license GPLv3 (http://www.gnu.org/licenses/gpl-3.0.html) + * @author Tobias Zeising * @author Thomas Muguet */ class page extends \spouts\rss\feed { @@ -75,9 +77,10 @@ class page extends \spouts\rss\feed { * @param mixed $params the params of this source */ public function load($params) { - $info = json_decode(file_get_contents("https://graph.facebook.com/" . $params['user']), TRUE); + $content = @file_get_contents("https://graph.facebook.com/" . urlencode($params['user'])); + $data = json_decode($content, TRUE); - $rssParams = array("url" => "https://www.facebook.com/feeds/page.php?format=atom10&id=" . $info['id']); + $rssParams = array("url" => "https://www.facebook.com/feeds/page.php?format=atom10&id=" . $data['id']); return parent::load($rssParams); } }