From d92a348cf049e9caf7f45fee388ac9d6ca15fe6e Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Fri, 9 Aug 2013 18:28:50 +0200 Subject: [PATCH 01/10] - Using APC to store config values (when present) - Enabling interlacing for pictures --- include/Photo.php | 4 ++++ include/config.php | 43 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/include/Photo.php b/include/Photo.php index 69b08f6291..f1c9128d36 100644 --- a/include/Photo.php +++ b/include/Photo.php @@ -534,6 +534,9 @@ class Photo { ob_start(); + // Enable interlacing + imageinterlace($this->image, true); + switch($this->getType()){ case "image/png": $quality = get_config('system','png_quality'); @@ -676,6 +679,7 @@ function guess_image_type($filename, $fromcurl=false) { */ $image = new Imagick($filename); $type = $image->getImageMimeType(); + $image->setInterlaceScheme(Imagick::INTERLACE_PLANE); } else { $ext = pathinfo($filename, PATHINFO_EXTENSION); $types = Photo::supportedTypes(); diff --git a/include/config.php b/include/config.php index af44f6cc2c..4f44de24fc 100644 --- a/include/config.php +++ b/include/config.php @@ -18,6 +18,9 @@ if(! function_exists('load_config')) { function load_config($family) { global $a; + + // To-Do: How to integrate APC here? + $r = q("SELECT * FROM `config` WHERE `cat` = '%s'", dbesc($family)); if(count($r)) { foreach($r as $rr) { @@ -67,9 +70,16 @@ function get_config($family, $key, $instore = false) { if (function_exists("apc_fetch") AND function_exists("apc_exists")) if (apc_exists($family."|".$key)) { $val = apc_fetch($family."|".$key); + //logger("APC: fetched stored value ".$family."|".$key, LOGGER_DEBUG); $a->config[$family][$key] = $val; - return $val; - } + + if ($val === '!!') + return false; + else + return $val; + } else + //logger("APC: cache miss for value ".$family."|".$key, LOGGER_DEBUG); + $ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1", dbesc($family), @@ -79,10 +89,19 @@ function get_config($family, $key, $instore = false) { // manage array value $val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']); $a->config[$family][$key] = $val; + + // If APC is enabled then store the data there + if (function_exists("apc_store")) + apc_store($family."|".$key, $val, 600); + return $val; } else { $a->config[$family][$key] = '!!'; + + // If APC is enabled then store the data there + if (function_exists("apc_store")) + apc_store($family."|".$key, '!!', 600); } return false; }} @@ -181,9 +200,16 @@ function get_pconfig($uid,$family, $key, $instore = false) { if (function_exists("apc_fetch") AND function_exists("apc_exists")) if (apc_exists($uid."|".$family."|".$key)) { $val = apc_fetch($uid."|".$family."|".$key); + //logger("APC: fetched stored value ".$uid."|".$family."|".$key, LOGGER_DEBUG); $a->config[$uid][$family][$key] = $val; - return $val; - } + + if ($val === '!!') + return false; + else + return $val; + } else + //logger("APC: cache miss for value ".$family."|".$key, LOGGER_DEBUG); + $ret = q("SELECT `v` FROM `pconfig` WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' LIMIT 1", intval($uid), @@ -194,10 +220,19 @@ function get_pconfig($uid,$family, $key, $instore = false) { if(count($ret)) { $val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']); $a->config[$uid][$family][$key] = $val; + + // If APC is enabled then store the data there + if (function_exists("apc_store")) + apc_store($uid."|".$family."|".$key, $val, 600); + return $val; } else { $a->config[$uid][$family][$key] = '!!'; + + // If APC is enabled then store the data there + if (function_exists("apc_store")) + apc_store($uid."|".$family."|".$key, '!!', 600); } return false; }} From e746c4955bd9b8230d1c5427cfaeb18c6e370a3a Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 11 Aug 2013 21:19:26 +0200 Subject: [PATCH 02/10] Added an option to configure the hostname manually. And there was a problem when APC wasn't present. --- include/cli_startup.php | 5 ++++- include/config.php | 5 +++-- include/cronhooks.php | 3 +++ include/delivery.php | 3 +++ include/expire.php | 2 ++ include/gprobe.php | 3 +++ include/notifier.php | 3 +++ include/onepoll.php | 3 +++ include/poller.php | 3 +++ include/queue.php | 3 +++ index.php | 3 +++ 11 files changed, 33 insertions(+), 3 deletions(-) diff --git a/include/cli_startup.php b/include/cli_startup.php index e069ec2c98..236fd14427 100644 --- a/include/cli_startup.php +++ b/include/cli_startup.php @@ -24,8 +24,11 @@ function cli_startup() { load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); + $a->set_baseurl(get_config('system','url')); load_hooks(); -} \ No newline at end of file +} diff --git a/include/config.php b/include/config.php index 4f44de24fc..ce30d2d192 100644 --- a/include/config.php +++ b/include/config.php @@ -77,7 +77,8 @@ function get_config($family, $key, $instore = false) { return false; else return $val; - } else + } + // else //logger("APC: cache miss for value ".$family."|".$key, LOGGER_DEBUG); @@ -207,7 +208,7 @@ function get_pconfig($uid,$family, $key, $instore = false) { return false; else return $val; - } else + } // else //logger("APC: cache miss for value ".$family."|".$key, LOGGER_DEBUG); diff --git a/include/cronhooks.php b/include/cronhooks.php index 15d49fe547..096e10b718 100644 --- a/include/cronhooks.php +++ b/include/cronhooks.php @@ -24,6 +24,9 @@ function cronhooks_run(&$argv, &$argc){ load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); + $lockpath = get_config('system','lockpath'); if ($lockpath != '') { $pidfile = new pidfile($lockpath, 'cron.lck'); diff --git a/include/delivery.php b/include/delivery.php index d89cded9eb..515f286e0f 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -27,6 +27,9 @@ function delivery_run(&$argv, &$argc){ load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); + load_hooks(); if($argc < 3) diff --git a/include/expire.php b/include/expire.php index 4c6fb7a19d..fe1007efd5 100644 --- a/include/expire.php +++ b/include/expire.php @@ -25,6 +25,8 @@ function expire_run(&$argv, &$argc){ load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); $a->set_baseurl(get_config('system','url')); diff --git a/include/gprobe.php b/include/gprobe.php index 0cf32e95fe..00a8e562af 100644 --- a/include/gprobe.php +++ b/include/gprobe.php @@ -24,6 +24,9 @@ function gprobe_run(&$argv, &$argc){ load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); + $a->set_baseurl(get_config('system','url')); load_hooks(); diff --git a/include/notifier.php b/include/notifier.php index a3286355dd..a90e180623 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -65,6 +65,9 @@ function notifier_run(&$argv, &$argc){ load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); + load_hooks(); if($argc < 3) diff --git a/include/onepoll.php b/include/onepoll.php index f38f6b4c61..737f70a286 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -37,6 +37,9 @@ function onepoll_run(&$argv, &$argc){ load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); + $a->set_baseurl(get_config('system','url')); load_hooks(); diff --git a/include/poller.php b/include/poller.php index e927430ea9..0bbead1891 100644 --- a/include/poller.php +++ b/include/poller.php @@ -30,6 +30,9 @@ function poller_run(&$argv, &$argc){ load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); + $maxsysload = intval(get_config('system','maxloadavg')); if($maxsysload < 1) $maxsysload = 50; diff --git a/include/queue.php b/include/queue.php index 64cccad21e..f277b3fbd4 100644 --- a/include/queue.php +++ b/include/queue.php @@ -25,6 +25,9 @@ function queue_run(&$argv, &$argc){ load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); + $a->set_baseurl(get_config('system','url')); load_hooks(); diff --git a/index.php b/index.php index 6b6e873ea6..67c0c495cf 100644 --- a/index.php +++ b/index.php @@ -53,6 +53,9 @@ if(!$install) { load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); + require_once("include/session.php"); load_hooks(); call_hooks('init_1'); From ed33d28e6149f7151dca9a9534baef3bcb936c12 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 12 Aug 2013 11:09:11 +0200 Subject: [PATCH 03/10] redoing the change concerning the hostname. --- include/cli_startup.php | 3 --- include/notifier.php | 3 --- include/onepoll.php | 3 --- include/poller.php | 3 --- include/queue.php | 3 --- index.php | 3 --- 6 files changed, 18 deletions(-) diff --git a/include/cli_startup.php b/include/cli_startup.php index 236fd14427..d43bc1c947 100644 --- a/include/cli_startup.php +++ b/include/cli_startup.php @@ -24,9 +24,6 @@ function cli_startup() { load_config('config'); load_config('system'); - if ($hostname = get_config('system', 'hostname')) - $a->set_hostname($hostname); - $a->set_baseurl(get_config('system','url')); load_hooks(); diff --git a/include/notifier.php b/include/notifier.php index a90e180623..a3286355dd 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -65,9 +65,6 @@ function notifier_run(&$argv, &$argc){ load_config('config'); load_config('system'); - if ($hostname = get_config('system', 'hostname')) - $a->set_hostname($hostname); - load_hooks(); if($argc < 3) diff --git a/include/onepoll.php b/include/onepoll.php index 737f70a286..f38f6b4c61 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -37,9 +37,6 @@ function onepoll_run(&$argv, &$argc){ load_config('config'); load_config('system'); - if ($hostname = get_config('system', 'hostname')) - $a->set_hostname($hostname); - $a->set_baseurl(get_config('system','url')); load_hooks(); diff --git a/include/poller.php b/include/poller.php index 0bbead1891..e927430ea9 100644 --- a/include/poller.php +++ b/include/poller.php @@ -30,9 +30,6 @@ function poller_run(&$argv, &$argc){ load_config('config'); load_config('system'); - if ($hostname = get_config('system', 'hostname')) - $a->set_hostname($hostname); - $maxsysload = intval(get_config('system','maxloadavg')); if($maxsysload < 1) $maxsysload = 50; diff --git a/include/queue.php b/include/queue.php index f277b3fbd4..64cccad21e 100644 --- a/include/queue.php +++ b/include/queue.php @@ -25,9 +25,6 @@ function queue_run(&$argv, &$argc){ load_config('config'); load_config('system'); - if ($hostname = get_config('system', 'hostname')) - $a->set_hostname($hostname); - $a->set_baseurl(get_config('system','url')); load_hooks(); diff --git a/index.php b/index.php index 67c0c495cf..6b6e873ea6 100644 --- a/index.php +++ b/index.php @@ -53,9 +53,6 @@ if(!$install) { load_config('config'); load_config('system'); - if ($hostname = get_config('system', 'hostname')) - $a->set_hostname($hostname); - require_once("include/session.php"); load_hooks(); call_hooks('init_1'); From e75f88d7fe964b5ff1a51867c8168cc1f7e3eed8 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 12 Aug 2013 11:12:00 +0200 Subject: [PATCH 04/10] Further redoings --- include/cronhooks.php | 3 --- include/delivery.php | 3 --- include/expire.php | 3 --- include/gprobe.php | 3 --- 4 files changed, 12 deletions(-) diff --git a/include/cronhooks.php b/include/cronhooks.php index 096e10b718..15d49fe547 100644 --- a/include/cronhooks.php +++ b/include/cronhooks.php @@ -24,9 +24,6 @@ function cronhooks_run(&$argv, &$argc){ load_config('config'); load_config('system'); - if ($hostname = get_config('system', 'hostname')) - $a->set_hostname($hostname); - $lockpath = get_config('system','lockpath'); if ($lockpath != '') { $pidfile = new pidfile($lockpath, 'cron.lck'); diff --git a/include/delivery.php b/include/delivery.php index 515f286e0f..d89cded9eb 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -27,9 +27,6 @@ function delivery_run(&$argv, &$argc){ load_config('config'); load_config('system'); - if ($hostname = get_config('system', 'hostname')) - $a->set_hostname($hostname); - load_hooks(); if($argc < 3) diff --git a/include/expire.php b/include/expire.php index fe1007efd5..a73272a2ef 100644 --- a/include/expire.php +++ b/include/expire.php @@ -25,9 +25,6 @@ function expire_run(&$argv, &$argc){ load_config('config'); load_config('system'); - if ($hostname = get_config('system', 'hostname')) - $a->set_hostname($hostname); - $a->set_baseurl(get_config('system','url')); diff --git a/include/gprobe.php b/include/gprobe.php index 00a8e562af..0cf32e95fe 100644 --- a/include/gprobe.php +++ b/include/gprobe.php @@ -24,9 +24,6 @@ function gprobe_run(&$argv, &$argc){ load_config('config'); load_config('system'); - if ($hostname = get_config('system', 'hostname')) - $a->set_hostname($hostname); - $a->set_baseurl(get_config('system','url')); load_hooks(); From 694ca8fc57a2e251062b9c05e302f19aa0c26e9d Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 12 Aug 2013 11:14:02 +0200 Subject: [PATCH 05/10] Code cleanup --- include/config.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/include/config.php b/include/config.php index ce30d2d192..2664b78a88 100644 --- a/include/config.php +++ b/include/config.php @@ -70,7 +70,6 @@ function get_config($family, $key, $instore = false) { if (function_exists("apc_fetch") AND function_exists("apc_exists")) if (apc_exists($family."|".$key)) { $val = apc_fetch($family."|".$key); - //logger("APC: fetched stored value ".$family."|".$key, LOGGER_DEBUG); $a->config[$family][$key] = $val; if ($val === '!!') @@ -78,9 +77,6 @@ function get_config($family, $key, $instore = false) { else return $val; } - // else - //logger("APC: cache miss for value ".$family."|".$key, LOGGER_DEBUG); - $ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1", dbesc($family), @@ -201,15 +197,13 @@ function get_pconfig($uid,$family, $key, $instore = false) { if (function_exists("apc_fetch") AND function_exists("apc_exists")) if (apc_exists($uid."|".$family."|".$key)) { $val = apc_fetch($uid."|".$family."|".$key); - //logger("APC: fetched stored value ".$uid."|".$family."|".$key, LOGGER_DEBUG); $a->config[$uid][$family][$key] = $val; if ($val === '!!') return false; else return $val; - } // else - //logger("APC: cache miss for value ".$family."|".$key, LOGGER_DEBUG); + } $ret = q("SELECT `v` FROM `pconfig` WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' LIMIT 1", From 209343d883d59dd7dd4c97056e32d6fdeae7ccec Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 24 Aug 2013 14:54:07 +0200 Subject: [PATCH 06/10] If "remove_multiplicated_lines" is set then some more linefeeds in lists are removed. --- include/bbcode.php | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/include/bbcode.php b/include/bbcode.php index 62759d192e..a536b53649 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -423,8 +423,8 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal // removing multiplicated newlines if (get_config("system", "remove_multiplicated_lines")) { - $search = array("\n\n\n", "\n ", " \n", "[/quote]\n\n", "\n[/quote]"); - $replace = array("\n\n", "\n", "\n", "[/quote]\n", "[/quote]"); + $search = array("\n\n\n", "\n ", " \n", "[/quote]\n\n", "\n[/quote]", "[/li]\n", "\n[li]", "\n[ul]", "[/ul]\n"); + $replace = array("\n\n", "\n", "\n", "[/quote]\n", "[/quote]", "[/li]", "[li]", "[ul]", "[/ul]"); do { $oldtext = $Text; $Text = str_replace($search, $replace, $Text); @@ -713,22 +713,29 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal // Only do it when it has to be done - for performance reasons // Update: Now it is done every time - since bad structured html can break a whole page //if (!$tryoembed) { -// $doc = new DOMDocument(); -// $doc->preserveWhiteSpace = false; + // $doc = new DOMDocument(); + // $doc->preserveWhiteSpace = false; -// $Text = mb_convert_encoding($Text, 'HTML-ENTITIES', "UTF-8"); + // $Text = mb_convert_encoding($Text, 'HTML-ENTITIES', "UTF-8"); -// $doctype = ''; -// @$doc->loadHTML($doctype."".$Text.""); + // $doctype = ''; + // @$doc->loadHTML($doctype."".$Text.""); -// $Text = $doc->saveHTML(); -// $Text = str_replace(array("", "", $doctype), array("", "", ""), $Text); + // $Text = $doc->saveHTML(); + // $Text = str_replace(array("", "", $doctype), array("", "", ""), $Text); -// $Text = str_replace('
','', $Text); + // $Text = str_replace('
','', $Text); -// $Text = mb_convert_encoding($Text, "UTF-8", 'HTML-ENTITIES'); + // $Text = mb_convert_encoding($Text, "UTF-8", 'HTML-ENTITIES'); //} + // Clean up some useless linebreaks in lists + //$Text = str_replace('

','', $Text); + //$Text = str_replace('
','', $Text); + //$Text = str_replace('
  • ','
  • ', $Text); + // $Text = str_replace('
    Date: Wed, 28 Aug 2013 08:56:48 +0200 Subject: [PATCH 07/10] Preparations for the pumpio synchronisation. --- boot.php | 2 ++ include/contact_selectors.php | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/boot.php b/boot.php index 4b2439d929..13ee7acdc2 100644 --- a/boot.php +++ b/boot.php @@ -139,6 +139,7 @@ define ( 'NETWORK_LINKEDIN', 'lnkd'); // LinkedIn define ( 'NETWORK_XMPP', 'xmpp'); // XMPP define ( 'NETWORK_MYSPACE', 'mysp'); // MySpace define ( 'NETWORK_GPLUS', 'goog'); // Google+ +define ( 'NETWORK_PUMPIO', 'pump'); // pump.io define ( 'NETWORK_PHANTOM', 'unkn'); // Place holder @@ -161,6 +162,7 @@ $netgroup_ids = array( NETWORK_XMPP => (-10), NETWORK_MYSPACE => (-11), NETWORK_GPLUS => (-12), + NETWORK_PUMPIO => (-13), NETWORK_PHANTOM => (-127), ); diff --git a/include/contact_selectors.php b/include/contact_selectors.php index 7e2f81dffe..44ff7ab040 100644 --- a/include/contact_selectors.php +++ b/include/contact_selectors.php @@ -84,7 +84,8 @@ function network_to_name($s) { NETWORK_XMPP => t('XMPP/IM'), NETWORK_MYSPACE => t('MySpace'), NETWORK_MAIL2 => t('Email'), - NETWORK_GPLUS => t('Google+') + NETWORK_GPLUS => t('Google+'), + NETWORK_PUMPIO => t('pump.io') ); call_hooks('network_to_name', $nets); From 9a1a666f2430a02279f26ebbb29814b3e8dd105b Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Wed, 4 Sep 2013 00:01:00 +0200 Subject: [PATCH 08/10] Some changes to let pumpio react similar to facebook. --- include/bbcode.php | 3 ++- include/delivery.php | 5 ++++- include/notifier.php | 5 ++++- include/onepoll.php | 8 ++++++-- include/poller.php | 5 +++-- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/include/bbcode.php b/include/bbcode.php index a536b53649..ca09cffec5 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -36,7 +36,8 @@ function stripcode_br_cb($s) { function tryoembed($match){ $url = ((count($match)==2)?$match[1]:$match[2]); -// logger("tryoembed: $url"); + + //logger("tryoembed: $url"); $o = oembed_fetch_url($url); diff --git a/include/delivery.php b/include/delivery.php index d89cded9eb..5e37ad2e0c 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -542,7 +542,7 @@ function delivery_run(&$argv, &$argc){ diaspora_send_relay($target_item,$owner,$contact,$public_message); break; - } + } elseif(($top_level) && (! $walltowall)) { // currently no workable solution for sending walltowall logger('delivery: diaspora status: ' . $loc); @@ -558,6 +558,9 @@ function delivery_run(&$argv, &$argc){ case NETWORK_FACEBOOK : if(get_config('system','dfrn_only')) break; + case NETWORK_PUMPIO : + if(get_config('system','dfrn_only')) + break; default: break; } diff --git a/include/notifier.php b/include/notifier.php index a3286355dd..74597c30d2 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -881,12 +881,15 @@ function notifier_run(&$argv, &$argc){ case NETWORK_FACEBOOK: if(get_config('system','dfrn_only')) break; + case NETWORK_PUMPIO: + if(get_config('system','dfrn_only')) + break; default: break; } } } - + // send additional slaps to mentioned remote tags (@foo@example.com) if($slap && count($url_recipients) && ($followup || $top_level) && $public_message && (! $expire)) { diff --git a/include/onepoll.php b/include/onepoll.php index f38f6b4c61..e7cae773ca 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -76,7 +76,7 @@ function onepoll_run(&$argv, &$argc){ $contacts = q("SELECT `contact`.* FROM `contact` WHERE ( `rel` = %d OR `rel` = %d ) AND `poll` != '' - AND NOT `network` IN ( '%s', '%s' ) + AND NOT `network` IN ( '%s', '%s', '%s' ) AND `contact`.`id` = %d AND `self` = 0 AND `contact`.`blocked` = 0 AND `contact`.`readonly` = 0 AND `contact`.`archive` = 0 LIMIT 1", @@ -84,6 +84,7 @@ function onepoll_run(&$argv, &$argc){ intval(CONTACT_IS_FRIEND), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_FACEBOOK), + dbesc(NETWORK_PUMPIO), intval($contact_id) ); @@ -526,6 +527,9 @@ function onepoll_run(&$argv, &$argc){ elseif($contact['network'] === NETWORK_FACEBOOK) { // This is picked up by the Facebook plugin on a cron hook. // Ignored here. + } elseif($contact['network'] === NETWORK_PUMPIO) { + // This is picked up by the pump.io plugin on a cron hook. + // Ignored here. } if($xml) { @@ -544,7 +548,7 @@ function onepoll_run(&$argv, &$argc){ // do it twice. Ensures that children of parents which may be later in the stream aren't tossed - + consume_feed($xml,$importer,$contact,$hub,1,2); $hubmode = 'subscribe'; diff --git a/include/poller.php b/include/poller.php index e927430ea9..9ba9c782b7 100644 --- a/include/poller.php +++ b/include/poller.php @@ -173,7 +173,7 @@ function poller_run(&$argv, &$argc){ $contacts = q("SELECT `contact`.`id` FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid` WHERE ( `rel` = %d OR `rel` = %d ) AND `poll` != '' - AND NOT `network` IN ( '%s', '%s' ) + AND NOT `network` IN ( '%s', '%s', '%s' ) $sql_extra AND `self` = 0 AND `contact`.`blocked` = 0 AND `contact`.`readonly` = 0 AND `contact`.`archive` = 0 @@ -181,7 +181,8 @@ function poller_run(&$argv, &$argc){ intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND), dbesc(NETWORK_DIASPORA), - dbesc(NETWORK_FACEBOOK) + dbesc(NETWORK_FACEBOOK), + dbesc(NETWORK_PUMPIO) ); if(! count($contacts)) { From 55b79e0891ed4ee2cb2579f56f2d9ef60b00fa9a Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Wed, 4 Sep 2013 07:39:03 +0200 Subject: [PATCH 09/10] Always embed the SSL version of youtube to avoid problems with Firefox. --- include/bbcode.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/include/bbcode.php b/include/bbcode.php index ca09cffec5..44a72c4835 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -37,6 +37,9 @@ function stripcode_br_cb($s) { function tryoembed($match){ $url = ((count($match)==2)?$match[1]:$match[2]); + // Always embed the SSL version + $url = str_replace("http://www.youtube.com/", "https://www.youtube.com/", $url); + //logger("tryoembed: $url"); $o = oembed_fetch_url($url); @@ -638,19 +641,19 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal // Youtube extensions if ($tryoembed) { - $Text = preg_replace_callback("/\[youtube\](https?:\/\/www.youtube.com\/watch\?v\=.*?)\[\/youtube\]/ism", 'tryoembed', $Text); - $Text = preg_replace_callback("/\[youtube\](www.youtube.com\/watch\?v\=.*?)\[\/youtube\]/ism", 'tryoembed', $Text); - $Text = preg_replace_callback("/\[youtube\](https?:\/\/youtu.be\/.*?)\[\/youtube\]/ism",'tryoembed',$Text); + $Text = preg_replace_callback("/\[youtube\](https?:\/\/www.youtube.com\/watch\?v\=.*?)\[\/youtube\]/ism", 'tryoembed', $Text); + $Text = preg_replace_callback("/\[youtube\](www.youtube.com\/watch\?v\=.*?)\[\/youtube\]/ism", 'tryoembed', $Text); + $Text = preg_replace_callback("/\[youtube\](https?:\/\/youtu.be\/.*?)\[\/youtube\]/ism",'tryoembed',$Text); } - $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/youtube\]/ism",'[youtube]$1[/youtube]',$Text); - $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/embed\/(.*?)\[\/youtube\]/ism",'[youtube]$1[/youtube]',$Text); + $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/youtube\]/ism",'[youtube]$1[/youtube]',$Text); + $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/embed\/(.*?)\[\/youtube\]/ism",'[youtube]$1[/youtube]',$Text); $Text = preg_replace("/\[youtube\]https?:\/\/youtu.be\/(.*?)\[\/youtube\]/ism",'[youtube]$1[/youtube]',$Text); if ($tryoembed) - $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", '', $Text); + $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", '', $Text); else - $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", "http://www.youtube.com/watch?v=$1", $Text); + $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", "https://www.youtube.com/watch?v=$1", $Text); if ($tryoembed) { From 159a7bda85d1514ed3a8d67cea7deca6ed96b437 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Thu, 5 Sep 2013 08:34:54 +0200 Subject: [PATCH 10/10] Prepearations for queueing of twitter messages --- boot.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boot.php b/boot.php index 13ee7acdc2..99eb3d0c17 100644 --- a/boot.php +++ b/boot.php @@ -140,6 +140,7 @@ define ( 'NETWORK_XMPP', 'xmpp'); // XMPP define ( 'NETWORK_MYSPACE', 'mysp'); // MySpace define ( 'NETWORK_GPLUS', 'goog'); // Google+ define ( 'NETWORK_PUMPIO', 'pump'); // pump.io +define ( 'NETWORK_TWITTER', 'twit'); // Twitter define ( 'NETWORK_PHANTOM', 'unkn'); // Place holder @@ -163,6 +164,7 @@ $netgroup_ids = array( NETWORK_MYSPACE => (-11), NETWORK_GPLUS => (-12), NETWORK_PUMPIO => (-13), + NETWORK_TWITTER => (-14), NETWORK_PHANTOM => (-127), );