diff --git a/boot.php b/boot.php
index 4b2439d92..99eb3d0c1 100644
--- a/boot.php
+++ b/boot.php
@@ -139,6 +139,8 @@ 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_TWITTER', 'twit'); // Twitter
define ( 'NETWORK_PHANTOM', 'unkn'); // Place holder
@@ -161,6 +163,8 @@ $netgroup_ids = array(
NETWORK_XMPP => (-10),
NETWORK_MYSPACE => (-11),
NETWORK_GPLUS => (-12),
+ NETWORK_PUMPIO => (-13),
+ NETWORK_TWITTER => (-14),
NETWORK_PHANTOM => (-127),
);
diff --git a/include/Photo.php b/include/Photo.php
index 69b08f629..f1c9128d3 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/bbcode.php b/include/bbcode.php
index db931614c..f07c1aa6c 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -36,7 +36,11 @@ function stripcode_br_cb($s) {
function tryoembed($match){
$url = ((count($match)==2)?$match[1]:$match[2]);
-// logger("tryoembed: $url");
+
+ // 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);
@@ -423,8 +427,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);
@@ -638,19 +642,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) {
@@ -714,22 +718,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('
(.*?)<\/a>/is';
diff --git a/include/cli_startup.php b/include/cli_startup.php
index e069ec2c9..d43bc1c94 100644
--- a/include/cli_startup.php
+++ b/include/cli_startup.php
@@ -28,4 +28,4 @@ function cli_startup() {
load_hooks();
-}
\ No newline at end of file
+}
diff --git a/include/config.php b/include/config.php
index af44f6cc2..2664b78a8 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) {
@@ -68,7 +71,11 @@ function get_config($family, $key, $instore = false) {
if (apc_exists($family."|".$key)) {
$val = apc_fetch($family."|".$key);
$a->config[$family][$key] = $val;
- return $val;
+
+ if ($val === '!!')
+ return false;
+ else
+ return $val;
}
$ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
@@ -79,10 +86,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;
}}
@@ -182,9 +198,14 @@ function get_pconfig($uid,$family, $key, $instore = false) {
if (apc_exists($uid."|".$family."|".$key)) {
$val = apc_fetch($uid."|".$family."|".$key);
$a->config[$uid][$family][$key] = $val;
- return $val;
+
+ if ($val === '!!')
+ return false;
+ else
+ return $val;
}
+
$ret = q("SELECT `v` FROM `pconfig` WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' LIMIT 1",
intval($uid),
dbesc($family),
@@ -194,10 +215,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;
}}
diff --git a/include/contact_selectors.php b/include/contact_selectors.php
index 7e2f81dff..44ff7ab04 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);
diff --git a/include/delivery.php b/include/delivery.php
index d89cded9e..5e37ad2e0 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/expire.php b/include/expire.php
index 4c6fb7a19..a73272a2e 100644
--- a/include/expire.php
+++ b/include/expire.php
@@ -25,7 +25,6 @@ function expire_run(&$argv, &$argc){
load_config('config');
load_config('system');
-
$a->set_baseurl(get_config('system','url'));
diff --git a/include/notifier.php b/include/notifier.php
index a3286355d..74597c30d 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 f38f6b4c6..e7cae773c 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 e927430ea..9ba9c782b 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)) {