aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMichael <icarus@dabo.de>2012-02-23 20:53:22 +0100
committerMichael <icarus@dabo.de>2012-02-23 20:53:22 +0100
commit0409b5cdba003b6ce90d5ad0181e81c06af95ab1 (patch)
treec677adb7c0e8140bdb1e115a95d1aa23fdf734ed /include
parent311e35731c52102cbce3befc6343f179080ad38c (diff)
parent8cacff69858c2ad097bafb80c93405e79c311edf (diff)
downloadvolse-hubzilla-0409b5cdba003b6ce90d5ad0181e81c06af95ab1.tar.gz
volse-hubzilla-0409b5cdba003b6ce90d5ad0181e81c06af95ab1.tar.bz2
volse-hubzilla-0409b5cdba003b6ce90d5ad0181e81c06af95ab1.zip
Merge remote branch 'upstream/master'
Conflicts: include/bbcode.php
Diffstat (limited to 'include')
-rwxr-xr-xinclude/Scrape.php2
-rwxr-xr-xinclude/acl_selectors.php2
-rwxr-xr-xinclude/api.php50
-rwxr-xr-xinclude/bb2diaspora.php4
-rwxr-xr-xinclude/bbcode.php8
-rwxr-xr-xinclude/diaspora.php26
-rwxr-xr-xinclude/enotify.php56
-rwxr-xr-xinclude/html2bbcode.php2
-rwxr-xr-xinclude/items.php34
-rwxr-xr-xinclude/nav.php5
-rwxr-xr-xinclude/poller.php6
-rwxr-xr-xinclude/template_processor.php28
-rwxr-xr-xinclude/text.php28
13 files changed, 205 insertions, 46 deletions
diff --git a/include/Scrape.php b/include/Scrape.php
index e42d22afc..52405ae2d 100755
--- a/include/Scrape.php
+++ b/include/Scrape.php
@@ -314,7 +314,7 @@ function scrape_feed($url) {
*
* PROBE_DIASPORA has a bias towards returning Diaspora information
* while PROBE_NORMAL has a bias towards dfrn/zot - in the case where
- * an address (such as a Friendika address) supports more than one type
+ * an address (such as a Friendica address) supports more than one type
* of network.
*
*/
diff --git a/include/acl_selectors.php b/include/acl_selectors.php
index d8f530daf..6070b7db2 100755
--- a/include/acl_selectors.php
+++ b/include/acl_selectors.php
@@ -157,7 +157,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
$o = '';
- // When used for private messages, we limit correspondence to mutual DFRN/Friendika friends and the selector
+ // When used for private messages, we limit correspondence to mutual DFRN/Friendica friends and the selector
// to one recipient. By default our selector allows multiple selects amongst all contacts.
$sql_extra = '';
diff --git a/include/api.php b/include/api.php
index 1d3e5c186..013f4b97a 100755
--- a/include/api.php
+++ b/include/api.php
@@ -183,7 +183,7 @@
'updated' => api_date(null),
'atom_updated' => datetime_convert('UTC','UTC','now',ATOM_TIME),
'language' => $user_info['language'],
- 'logo' => $a->get_baseurl()."/images/friendika-32.png",
+ 'logo' => $a->get_baseurl()."/images/friendica-32.png",
);
return $arr;
@@ -457,7 +457,49 @@
return null;
}
- // TODO - media uploads
+/*Waitman Gobble Mod*/
+ function api_statuses_mediap(&$a, $type) {
+ if (local_user()===false) {
+ logger('api_statuses_update: no user');
+ return false;
+ }
+ $user_info = api_get_user($a);
+
+ $_REQUEST['type'] = 'wall';
+ $_REQUEST['profile_uid'] = local_user();
+ $_REQUEST['api_source'] = true;
+ $txt = urldecode(requestdata('status'));
+
+ require_once('library/HTMLPurifier.auto.php');
+ require_once('include/html2bbcode.php');
+
+ if((strpos($txt,'<') !== false) || (strpos($txt,'>') !== false)) {
+ $txt = html2bb_video($txt);
+ $config = HTMLPurifier_Config::createDefault();
+ $config->set('Cache.DefinitionImpl', null);
+ $purifier = new HTMLPurifier($config);
+ $txt = $purifier->purify($txt);
+ }
+ $txt = html2bbcode($txt);
+
+ $a->argv[1]=$user_info['screen_name']; //should be set to username?
+
+ $_REQUEST['hush']='yeah'; //tell wall_upload function to return img info instead of echo
+ require_once('mod/wall_upload.php');
+ $bebop = wall_upload_post($a);
+
+ //now that we have the img url in bbcode we can add it to the status and insert the wall item.
+ $_REQUEST['body']=$txt."\n\n".$bebop;
+ require_once('mod/item.php');
+ item_post($a);
+
+ // this should output the last post (the one we just posted).
+ return api_status_show($a,$type);
+ }
+ api_register_func('api/statuses/mediap','api_statuses_mediap', true);
+/*Waitman Gobble Mod*/
+
+
function api_statuses_update(&$a, $type) {
if (local_user()===false) {
logger('api_statuses_update: no user');
@@ -743,7 +785,7 @@
if (local_user()===false) return false;
$user_info = api_get_user($a);
- // in friendika starred item are private
+ // in friendica starred item are private
// return favorites only for self
logger('api_favorites: self:' . $user_info['self']);
@@ -916,7 +958,7 @@
function api_statusnet_config(&$a,$type) {
$name = $a->config['sitename'];
$server = $a->get_hostname();
- $logo = $a->get_baseurl() . '/images/friendika-64.png';
+ $logo = $a->get_baseurl() . '/images/friendica-64.png';
$email = $a->config['admin_email'];
$closed = (($a->config['register_policy'] == REGISTER_CLOSED) ? 'true' : 'false');
$private = (($a->config['system']['block_public']) ? 'true' : 'false');
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index 70d4bec9a..bcef86616 100755
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -14,8 +14,8 @@ require_once('include/html2bbcode.php');
function diaspora2bb($s) {
// for testing purposes: Collect raw markdown articles
- $file = tempnam("/tmp/friendica/", "markdown");
- file_put_contents($file, $s);
+ // $file = tempnam("/tmp/friendica/", "markdown");
+ // file_put_contents($file, $s);
$s = html_entity_decode($s,ENT_COMPAT,'UTF-8');
diff --git a/include/bbcode.php b/include/bbcode.php
index eef1cde1f..47822d093 100755
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -194,7 +194,11 @@ function bbcode($Text,$preserve_nl = false) {
// Check for [quote] text
// handle nested quotes
$endlessloop = 0;
+<<<<<<< HEAD
while ((strpos($Text, "[/quote]") !== false) and (strpos($Text, "[quote]") !== false) and (++$endlessloop < 20))
+=======
+ while (strpos($Text, "[/quote]") !== false and strpos($Text, "[quote]") !== false and (++$endlessloop < 20))
+>>>>>>> upstream/master
$Text = preg_replace("/\[quote\](.*?)\[\/quote\]/ism","$QuoteLayout", $Text);
// Check for [quote=Author] text
@@ -203,7 +207,11 @@ function bbcode($Text,$preserve_nl = false) {
// handle nested quotes
$endlessloop = 0;
+<<<<<<< HEAD
while ((strpos($Text, "[/quote]")!== false) and (strpos($Text, "[quote=") !== false) and (++$endlessloop < 20))
+=======
+ while (strpos($Text, "[/quote]") !== false and strpos($Text, "[quote=") !== false and (++$endlessloop < 20))
+>>>>>>> upstream/master
$Text = preg_replace("/\[quote=[\"\']*(.*?)[\"\']*\](.*?)\[\/quote\]/ism",
"<blockquote><strong>" . $t_wrote . "</strong> $2</blockquote>",
$Text);
diff --git a/include/diaspora.php b/include/diaspora.php
index a8e02e509..92f3500f2 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -451,7 +451,7 @@ function diaspora_request($importer,$xml) {
// perhaps we were already sharing with this person. Now they're sharing with us.
// That makes us friends.
- if($contact['rel'] == CONTACT_IS_FOLLOWER) {
+ if($contact['rel'] == CONTACT_IS_FOLLOWER && $importer['page-flags'] != PAGE_COMMUNITY) {
q("UPDATE `contact` SET `rel` = %d, `writable` = 1 WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval(CONTACT_IS_FRIEND),
intval($contact['id']),
@@ -619,6 +619,18 @@ function diaspora_request($importer,$xml) {
return;
}
+function diaspora_post_allow($importer,$contact) {
+ if(($contact['blocked']) || ($contact['readonly']))
+ return false;
+ if($contact['rel'] == CONTACT_IS_SHARING || $contact['rel'] == CONTACT_IS_FRIEND)
+ return true;
+ if($contact['rel'] == CONTACT_IS_FOLLOWER)
+ if($importer['page-flags'] == PAGE_COMMUNITY)
+ return true;
+ return false;
+}
+
+
function diaspora_post($importer,$xml) {
$a = get_app();
@@ -629,7 +641,7 @@ function diaspora_post($importer,$xml) {
if(! $contact)
return;
- if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) {
+ if(! diaspora_post_allow($importer,$contact)) {
logger('diaspora_post: Ignoring this author.');
return 202;
}
@@ -748,7 +760,7 @@ function diaspora_reshare($importer,$xml) {
if(! $contact)
return;
- if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) {
+ if(! diaspora_post_allow($importer,$contact)) {
logger('diaspora_reshare: Ignoring this author: ' . $diaspora_handle . ' ' . print_r($xml,true));
return 202;
}
@@ -900,7 +912,7 @@ function diaspora_asphoto($importer,$xml) {
if(! $contact)
return;
- if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) {
+ if(! diaspora_post_allow($importer,$contact)) {
logger('diaspora_asphoto: Ignoring this author.');
return 202;
}
@@ -1001,7 +1013,7 @@ function diaspora_comment($importer,$xml,$msg) {
return;
}
- if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) {
+ if(! diaspora_post_allow($importer,$contact)) {
logger('diaspora_comment: Ignoring this author.');
return 202;
}
@@ -1446,7 +1458,7 @@ function diaspora_photo($importer,$xml,$msg) {
return;
}
- if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) {
+ if(! diaspora_post_allow($importer,$contact)) {
logger('diaspora_photo: Ignoring this author.');
return 202;
}
@@ -1503,7 +1515,7 @@ function diaspora_like($importer,$xml,$msg) {
return;
}
- if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) {
+ if(! diaspora_post_allow($importer,$contact)) {
logger('diaspora_like: Ignoring this author.');
return 202;
}
diff --git a/include/enotify.php b/include/enotify.php
index a8e6e3de6..1eb3b5476 100755
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -28,18 +28,18 @@ function notification($params) {
$subject = sprintf( t('New mail received at %s'),$sitename);
$preamble = sprintf( t('%s sent you a new private message at %s.'),$params['source_name'],$sitename);
- $epreamble = sprintf( t('%s sent you a private message.'),'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]');
+ $epreamble = sprintf( t('%s sent you %s.'),'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]', '[url=$itemlink]' . t('a private message') . '[/url]');
$sitelink = t('Please visit %s to view and/or reply to your private messages.');
- $tsitelink = sprintf( $sitelink, $siteurl . '/message' );
- $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '/message">' . $sitename . '</a>');
- $itemlink = $siteurl . '/message';
+ $tsitelink = sprintf( $sitelink, $siteurl . '/message/' . $params['item']['id'] );
+ $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '/message/' . $params['item']['id'] . '">' . $sitename . '</a>');
+ $itemlink = $siteurl . '/message/' . $params['item']['id'];
}
if($params['type'] == NOTIFY_COMMENT) {
$subject = sprintf( t('%s commented on an item at %s'), $params['source_name'], $sitename);
$preamble = sprintf( t('%s commented on an item/conversation you have been following.'), $params['source_name']);
- $epreamble = sprintf( t('%s commented on an item/conversation you have been following.'), '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]');
+ $epreamble = sprintf( t('%s commented in %s.'), '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]', '[url=$itemlink]' . t('a watched conversation') . '[/url]');
$sitelink = t('Please visit %s to view and/or reply to the conversation.');
$tsitelink = sprintf( $sitelink, $siteurl );
@@ -49,7 +49,7 @@ function notification($params) {
if($params['type'] == NOTIFY_WALL) {
$preamble = $subject = sprintf( t('%s posted to your profile wall at %s') , $params['source_name'], $sitename);
- $epreamble = sprintf( t('%s posted to your profile wall') , '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]');
+ $epreamble = sprintf( t('%s posted to %s') , '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]', '[url=$itemlink]' . t('your profile wall.') . '[/url]');
$sitelink = t('Please visit %s to view and/or reply to the conversation.');
$tsitelink = sprintf( $sitelink, $siteurl );
@@ -59,7 +59,7 @@ function notification($params) {
if($params['type'] == NOTIFY_TAGSELF) {
$preamble = $subject = sprintf( t('%s tagged you at %s') , $params['source_name'], $sitename);
- $epreamble = sprintf( t('%s tagged you') , '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]');
+ $epreamble = sprintf( t('%s %s.') , '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]', '[url=' . $params['link'] . ']' . t('tagged you') . '[/url]');
$sitelink = t('Please visit %s to view and/or reply to the conversation.');
$tsitelink = sprintf( $sitelink, $siteurl );
@@ -69,7 +69,7 @@ function notification($params) {
if($params['type'] == NOTIFY_TAGSHARE) {
$preamble = $subject = sprintf( t('%s tagged your post at %s') , $params['source_name'], $sitename);
- $epreamble = sprintf( t('%s tagged your post') , '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]');
+ $epreamble = sprintf( t('%s tagged %s') , '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]', '[url=$itemlink]' . t('your post') . '[/url]' );
$sitelink = t('Please visit %s to view and/or reply to the conversation.');
$tsitelink = sprintf( $sitelink, $siteurl );
@@ -80,7 +80,7 @@ function notification($params) {
if($params['type'] == NOTIFY_INTRO) {
$subject = sprintf( t('Introduction received at %s'), $sitename);
$preamble = sprintf( t('You\'ve received an introduction from \'%s\' at %s'), $params['source_name'], $sitename);
- $epreamble = sprintf( t('You\'ve received an introduction from %s'), '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]');
+ $epreamble = sprintf( t('You\'ve received %s from %s.'), '[url=$itemlink]' . t('an introduction') . '[/url]' , '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]');
$body = sprintf( t('You may visit their profile at %s'),$params['source_link']);
$sitelink = t('Please visit %s to approve or reject the introduction.');
@@ -92,7 +92,8 @@ function notification($params) {
if($params['type'] == NOTIFY_SUGGEST) {
$subject = sprintf( t('Friend suggestion received at %s'), $sitename);
$preamble = sprintf( t('You\'ve received a friend suggestion from \'%s\' at %s'), $params['source_name'], $sitename);
- $epreamble = sprintf( t('You\'ve received a friend suggestion for %s from %s'),
+ $epreamble = sprintf( t('You\'ve received %s for %s from %s.'),
+ '[url=$itemlink]' . t('a friend suggestion') . '[/url]',
'[url=' . $params['item']['url'] . ']' . $params['item']['name'] . '[/url]',
'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]');
$body = t('Name:') . ' ' . $params['item']['name'] . "\n";
@@ -115,15 +116,27 @@ function notification($params) {
require_once('include/html2bbcode.php');
+ do {
+ $dups = false;
+ $hash = random_string();
+ $r = q("SELECT `id` FROM `notify` WHERE `hash` = '%s' LIMIT 1",
+ dbesc($hash));
+ if(count($r))
+ $dups = true;
+ } while($dups == true);
+
+
+
+
// create notification entry in DB
- $r = q("insert into notify (name,url,photo,date,msg,uid,link,type,verb,otype)
+ $r = q("insert into notify (hash,name,url,photo,date,uid,link,type,verb,otype)
values('%s','%s','%s','%s','%s',%d,'%s',%d,'%s','%s')",
+ dbesc($hash),
dbesc($params['source_name']),
dbesc($params['source_link']),
dbesc($params['source_photo']),
dbesc(datetime_convert()),
- dbesc($epreamble),
intval($params['uid']),
dbesc($itemlink),
intval($params['type']),
@@ -131,6 +144,25 @@ function notification($params) {
dbesc($params['otype'])
);
+ $r = q("select id from notify where hash = '%s' and uid = %d limit 1",
+ dbesc($hash),
+ intval($params['uid'])
+ );
+ if($r)
+ $notify_id = $r[0]['id'];
+ else
+ return;
+
+ $itemlink = $a->get_baseurl() . '/notify/view/' . $notify_id;
+ $msg = replace_macros($epreamble,array('$itemlink' => $itemlink));
+ $r = q("update notify set msg = '%s' where id = %d and uid = %d limit 1",
+ dbesc($msg),
+ intval($notify_id),
+ intval($params['uid'])
+ );
+
+
+
// send email notification if notification preferences permit
require_once('bbcode.php');
diff --git a/include/html2bbcode.php b/include/html2bbcode.php
index 4297ff2f9..d8f1a24f1 100755
--- a/include/html2bbcode.php
+++ b/include/html2bbcode.php
@@ -204,7 +204,7 @@ function html2bbcode($message)
node2bbcode($doc, 'a', array('href'=>'/(.+)/'), '[url=$1]', '[/url]');
- node2bbcode($doc, 'img', array('src'=>'/(.+)/', 'width'=>'/(\d+)/', 'height'=>'/(\d+)/'), '[img$2x$3]$1', '[/img]');
+ node2bbcode($doc, 'img', array('src'=>'/(.+)/', 'width'=>'/(\d+)/', 'height'=>'/(\d+)/'), '[img=$2x$3]$1', '[/img]');
node2bbcode($doc, 'img', array('src'=>'/(.+)/'), '[img]$1', '[/img]');
diff --git a/include/items.php b/include/items.php
index f4837449d..347826042 100755
--- a/include/items.php
+++ b/include/items.php
@@ -1551,8 +1551,9 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
}
$force_parent = false;
- if($contact['network'] === NETWORK_OSTATUS) {
- $force_parent = true;
+ if($contact['network'] === NETWORK_OSTATUS || stristr($contact['url'],'twitter.com')) {
+ if($contact['network'] === NETWORK_OSTATUS)
+ $force_parent = true;
if(strlen($datarray['title']))
unset($datarray['title']);
$r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
@@ -1700,7 +1701,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
if(! is_array($contact))
return;
- if($contact['network'] === NETWORK_OSTATUS || stristr($permalink,'twitter.com')) {
+ if($contact['network'] === NETWORK_OSTATUS || stristr($contact['url'],'twitter.com')) {
if(strlen($datarray['title']))
unset($datarray['title']);
$datarray['last-child'] = 1;
@@ -2040,13 +2041,12 @@ function local_delivery($importer,$data) {
}
if($is_reply) {
-
$community = false;
if($importer['page-flags'] == PAGE_COMMUNITY) {
$sql_extra = '';
$community = true;
- logger('local_delivery: community reply');
+ logger('local_delivery: possible community reply');
}
else
$sql_extra = " and contact.self = 1 and item.wall = 1 ";
@@ -2054,7 +2054,9 @@ function local_delivery($importer,$data) {
// was the top-level post for this reply written by somebody on this site?
// Specifically, the recipient?
- $r = q("select `item`.`id`, `item`.`uri`, `item`.`tag`,
+ $is_a_remote_comment = false;
+
+ $r = q("select `item`.`id`, `item`.`uri`, `item`.`tag`, `item`.`forum_mode`,`item`.`origin`,`item`.`wall`,
`contact`.`name`, `contact`.`url`, `contact`.`thumb` from `item`
LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uri` = '%s' AND `item`.`parent-uri` = '%s'
@@ -2065,16 +2067,29 @@ function local_delivery($importer,$data) {
dbesc($parent_uri),
intval($importer['importer_uid'])
);
+ if($r && count($r))
+ $is_a_remote_comment = true;
+
+ // Does this have the characteristics of a community comment?
+ // If it's a reply to a wall post on a community page it's a
+ // valid community comment. Also forum_mode makes it valid for sure.
+ // If neither, it's not.
+
+ if($is_a_remote_comment && $community) {
+ if((! $r[0]['forum_mode']) && (! $r[0]['wall'])) {
+ $is_a_remote_comment = false;
+ logger('local_delivery: not a community reply');
+ }
+ }
- if($r && count($r)) {
-
+ if($is_a_remote_comment) {
logger('local_delivery: received remote comment');
$is_like = false;
// remote reply to our post. Import and then notify everybody else.
$datarray = get_atom_elements($feed,$item);
- // TODO: make this next part work against both delivery threads of a community post
+ // TODO: make this next part work against both delivery threads of a community post
// if((! link_compare($datarray['author-link'],$importer['url'])) && (! $community)) {
// logger('local_delivery: received relay claiming to be from ' . $importer['url'] . ' however comment author url is ' . $datarray['author-link'] );
@@ -2188,6 +2203,7 @@ function local_delivery($importer,$data) {
}
}
+
return 0;
// NOTREACHED
}
diff --git a/include/nav.php b/include/nav.php
index 95dd37ba6..511ca07fc 100755
--- a/include/nav.php
+++ b/include/nav.php
@@ -116,7 +116,8 @@ function nav(&$a) {
if($_SESSION['page_flags'] == PAGE_NORMAL) {
$nav['introductions'] = array('notifications/intros', t('Introductions'), "", t('Friend Requests'));
$nav['notifications'] = array('notifications', t('Notifications'), "", t('Notifications'));
- $nav['notifications']['all']=array('notifications/network', t('See all notifications', "", ""));
+ $nav['notifications']['all']=array('notifications/system', t('See all notifications'), "", "");
+ $nav['notifications']['mark'] = array('', t('Mark all system notifications seen'), '','');
}
@@ -148,7 +149,7 @@ function nav(&$a) {
$banner = get_config('system','banner');
if($banner === false)
- $banner .= '<a href="http://friendica.com"><img id="logo-img" src="images/friendika-32.png" alt="logo" /></a><span id="logo-text"><a href="http://friendica.com">Friendica</a></span>';
+ $banner .= '<a href="http://friendica.com"><img id="logo-img" src="images/friendica-32.png" alt="logo" /></a><span id="logo-text"><a href="http://friendica.com">Friendica</a></span>';
$tpl = get_markup_template('nav.tpl');
diff --git a/include/poller.php b/include/poller.php
index 0ea0c9231..3e7a1e9b4 100755
--- a/include/poller.php
+++ b/include/poller.php
@@ -194,8 +194,8 @@ function poller_run($argv, $argc){
$update = true;
break;
}
-// if((! $update) && (! $force))
-// continue;
+ if((! $update) && (! $force))
+ continue;
}
// Check to see if we are running out of memory - if so spawn a new process and kill this one
@@ -349,7 +349,7 @@ function poller_run($argv, $argc){
|| ($contact['network'] === NETWORK_DIASPORA)
|| ($contact['network'] === NETWORK_FEED) ) {
- // Upgrading DB fields from an older Friendika version
+ // Upgrading DB fields from an older Friendica version
// Will only do this once per notify-enabled OStatus contact
// or if relationship changes
diff --git a/include/template_processor.php b/include/template_processor.php
index 25f7703a2..0d476f0e6 100755
--- a/include/template_processor.php
+++ b/include/template_processor.php
@@ -10,7 +10,7 @@
var $done = false;
var $d = false;
var $lang = null;
-
+ var $debug=false;
private function _preg_error(){
switch(preg_last_error()){
@@ -160,6 +160,30 @@
return $s;
}
+ private function _str_replace($str){
+ #$this->search,$this->replace,
+ $searchs = $this->search;
+ foreach($searchs as $search){
+ $search = "|".preg_quote($search)."(\|[a-zA-Z0-9_]*)*|";
+ $m = array();
+ if (preg_match_all($search, $str,$m)){
+ foreach ($m[0] as $match){
+ $toks = explode("|",$match);
+ $val = $this->_get_var($toks[0]);
+ for($k=1; $k<count($toks); $k++){
+ $func = $toks[$k];
+ if (function_exists($func)) $val = $func($val);
+ }
+ if (count($toks)>1){
+ $str = str_replace( $match, $val, $str);
+ }
+ }
+ }
+
+ }
+ return str_replace($this->search,$this->replace, $str);
+ }
+
public function replace($s, $r) {
$this->r = $r;
@@ -180,7 +204,7 @@
$os = ""; $count=0;
while($os!=$s && $count<10){
$os=$s; $count++;
- $s = str_replace($this->search,$this->replace, $s);
+ $s = $this->_str_replace($s);
}
return template_unescape($s);
}
diff --git a/include/text.php b/include/text.php
index b9813cfa9..0f7d2f731 100755
--- a/include/text.php
+++ b/include/text.php
@@ -675,12 +675,24 @@ function linkify($s) {
* @Parameter: string $s
*
* Returns string
+ *
+ * It is expected that this function will be called using HTML text.
+ * We will escape text between HTML pre and code blocks from being
+ * processed.
+ *
+ * At a higher level, the bbcode [nosmile] tag can be used to prevent this
+ * function from being executed by the prepare_text() routine when preparing
+ * bbcode source for HTML display
+ *
*/
if(! function_exists('smilies')) {
function smilies($s, $sample = false) {
$a = get_app();
+ $s = preg_replace_callback('/<pre>(.*?)<\/pre>/ism','smile_encode',$s);
+ $s = preg_replace_callback('/<code>(.*?)<\/code>/ism','smile_encode',$s);
+
$texts = array(
'&lt;3',
'&lt;/3',
@@ -759,7 +771,7 @@ function smilies($s, $sample = false) {
'<img src="' . $a->get_baseurl() . '/images/smiley-facepalm.gif" alt=":facepalm" />',
'<img src="' . $a->get_baseurl() . '/images/smiley-bangheaddesk.gif" alt=":headdesk" />',
'<a href="http://project.friendika.com">~friendika <img src="' . $a->get_baseurl() . '/images/friendika-16.png" alt="~friendika" /></a>',
- '<a href="http://friendica.com">~friendica <img src="' . $a->get_baseurl() . '/images/friendika-16.png" alt="~friendica" /></a>',
+ '<a href="http://friendica.com">~friendica <img src="' . $a->get_baseurl() . '/images/friendica-16.png" alt="~friendica" /></a>',
'<a href="http://diasporafoundation.org">Diaspora<img src="' . $a->get_baseurl() . '/images/diaspora.png" alt="Diaspora*" /></a>',
);
@@ -776,11 +788,23 @@ function smilies($s, $sample = false) {
else {
$s = str_replace($params['texts'],$params['icons'],$params['string']);
}
-
+
+ $s = preg_replace_callback('/<pre>(.*?)<\/pre>/ism','smile_decode',$s);
+ $s = preg_replace_callback('/<code>(.*?)<\/code>/ism','smile_decode',$s);
+
return $s;
}}
+function smile_encode($m) {
+ return(str_replace($m[1],base64url_encode($m[1]),$m[0]));
+}
+
+function smile_decode($m) {
+ return(str_replace($m[1],base64url_decode($m[1]),$m[0]));
+}
+
+
if(! function_exists('day_translate')) {