mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-25 12:43:40 +00:00
Merge pull request #101 from annando/master
fbpost, fromgplus, suppressing errors
This commit is contained in:
commit
84b97f12da
5 changed files with 44 additions and 8 deletions
|
@ -1027,6 +1027,10 @@ function fbpost_fetchwall($a, $uid) {
|
||||||
|
|
||||||
$feed = fetch_url($url);
|
$feed = fetch_url($url);
|
||||||
$data = json_decode($feed);
|
$data = json_decode($feed);
|
||||||
|
|
||||||
|
if (!is_array($data->data))
|
||||||
|
return;
|
||||||
|
|
||||||
$items = array_reverse($data->data);
|
$items = array_reverse($data->data);
|
||||||
|
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
|
@ -1042,6 +1046,9 @@ function fbpost_fetchwall($a, $uid) {
|
||||||
if(isset($item->privacy) && ($item->privacy->value !== 'EVERYONE') && ($item->privacy->value !== ''))
|
if(isset($item->privacy) && ($item->privacy->value !== 'EVERYONE') && ($item->privacy->value !== ''))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (($post_to_page != $item->from->id) AND ((int)$post_to_page != 0))
|
||||||
|
continue;
|
||||||
|
|
||||||
$_SESSION["authenticated"] = true;
|
$_SESSION["authenticated"] = true;
|
||||||
$_SESSION["uid"] = $uid;
|
$_SESSION["uid"] = $uid;
|
||||||
|
|
||||||
|
|
|
@ -275,6 +275,9 @@ function fromgplus_handleattachments($item) {
|
||||||
$post .= "\n[url=".$thumb->url."][img]".$image."[/img][/url]\n";
|
$post .= "\n[url=".$thumb->url."][img]".$image."[/img][/url]\n";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "audio":
|
||||||
|
$post .= "\n\n[bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n";
|
||||||
|
break;
|
||||||
//default:
|
//default:
|
||||||
// die($attachment->objectType);
|
// die($attachment->objectType);
|
||||||
}
|
}
|
||||||
|
@ -298,6 +301,9 @@ function fromgplus_fetch($a, $uid) {
|
||||||
|
|
||||||
$lastdate = 0;
|
$lastdate = 0;
|
||||||
|
|
||||||
|
if (!is_array($activities->items))
|
||||||
|
return;
|
||||||
|
|
||||||
$reversed = array_reverse($activities->items);
|
$reversed = array_reverse($activities->items);
|
||||||
|
|
||||||
foreach($reversed as $item) {
|
foreach($reversed as $item) {
|
||||||
|
|
|
@ -56,20 +56,24 @@ function privacy_image_cache_init() {
|
||||||
$thumb = false;
|
$thumb = false;
|
||||||
|
|
||||||
// Look for filename in the arguments
|
// Look for filename in the arguments
|
||||||
if (isset($a->argv[1]) OR isset($a->argv[2])) {
|
if (isset($a->argv[1]) OR isset($a->argv[2]) OR isset($a->argv[3])) {
|
||||||
if (isset($a->argv[2]))
|
if (isset($a->argv[3]))
|
||||||
|
$url = $a->argv[3];
|
||||||
|
elseif (isset($a->argv[2]))
|
||||||
$url = $a->argv[2];
|
$url = $a->argv[2];
|
||||||
else
|
else
|
||||||
$url = $a->argv[1];
|
$url = $a->argv[1];
|
||||||
|
|
||||||
$pos = strrpos($url, "==.");
|
$pos = strrpos($url, "=.");
|
||||||
if ($pos)
|
if ($pos)
|
||||||
$url = substr($url, 0, $pos+2);
|
$url = substr($url, 0, $pos+1);
|
||||||
|
|
||||||
|
$url = str_replace(array(".jpg", ".jpeg", ".gif", ".png"), array("","","",""), $url);
|
||||||
|
|
||||||
$url = base64_decode(strtr($url, '-_', '+/'), true);
|
$url = base64_decode(strtr($url, '-_', '+/'), true);
|
||||||
|
|
||||||
if ($url)
|
if ($url)
|
||||||
$_REQUEST['url'] = $url;
|
$_REQUEST['url'] = $url;
|
||||||
|
|
||||||
$thumb = (isset($a->argv[3]) and ($a->argv[3] == "thumb"));
|
$thumb = (isset($a->argv[3]) and ($a->argv[3] == "thumb"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,9 +205,15 @@ function privacy_image_cache_init() {
|
||||||
|
|
||||||
function privacy_image_cache_cachename($url, $writemode = false) {
|
function privacy_image_cache_cachename($url, $writemode = false) {
|
||||||
global $_SERVER;
|
global $_SERVER;
|
||||||
// echo $url;
|
|
||||||
// $mime = image_type_to_mime_type(exif_imagetype($url));
|
$pos = strrpos($url, ".");
|
||||||
// echo $mime;
|
if ($pos) {
|
||||||
|
$extension = strtolower(substr($url, $pos+1));
|
||||||
|
$pos = strpos($extension, "?");
|
||||||
|
if ($pos)
|
||||||
|
$extension = substr($extension, 0, $pos);
|
||||||
|
}
|
||||||
|
|
||||||
$basepath = $_SERVER["DOCUMENT_ROOT"]."/privacy_image_cache";
|
$basepath = $_SERVER["DOCUMENT_ROOT"]."/privacy_image_cache";
|
||||||
|
|
||||||
$path = substr(hash("md5", $url), 0, 2);
|
$path = substr(hash("md5", $url), 0, 2);
|
||||||
|
@ -216,6 +226,11 @@ function privacy_image_cache_cachename($url, $writemode = false) {
|
||||||
|
|
||||||
$path .= "/".strtr(base64_encode($url), '+/', '-_');
|
$path .= "/".strtr(base64_encode($url), '+/', '-_');
|
||||||
|
|
||||||
|
$extensions = array("jpg", "jpeg", "gif", "png");
|
||||||
|
|
||||||
|
if (in_array($extension, $extensions))
|
||||||
|
$path .= ".".$extension;
|
||||||
|
|
||||||
return($path);
|
return($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -819,6 +819,10 @@ function statusnet_fetchtimeline($a, $uid) {
|
||||||
$parameters["since_id"] = $lastid;
|
$parameters["since_id"] = $lastid;
|
||||||
|
|
||||||
$items = $connection->get('statuses/user_timeline', $parameters);
|
$items = $connection->get('statuses/user_timeline', $parameters);
|
||||||
|
|
||||||
|
if (!is_array($items))
|
||||||
|
return;
|
||||||
|
|
||||||
$posts = array_reverse($items);
|
$posts = array_reverse($items);
|
||||||
|
|
||||||
if (count($posts)) {
|
if (count($posts)) {
|
||||||
|
|
|
@ -613,6 +613,10 @@ function twitter_fetchtimeline($a, $uid) {
|
||||||
$parameters["since_id"] = $lastid;
|
$parameters["since_id"] = $lastid;
|
||||||
|
|
||||||
$items = $connection->get('statuses/user_timeline', $parameters);
|
$items = $connection->get('statuses/user_timeline', $parameters);
|
||||||
|
|
||||||
|
if (!is_array($items))
|
||||||
|
return;
|
||||||
|
|
||||||
$posts = array_reverse($items);
|
$posts = array_reverse($items);
|
||||||
|
|
||||||
if (count($posts)) {
|
if (count($posts)) {
|
||||||
|
|
Loading…
Reference in a new issue