Merge pull request #1065 from annando/master
Refreshing of the network page only when the page is at the beginning
This commit is contained in:
commit
cf0ebd952f
11 changed files with 89 additions and 72 deletions
|
|
@ -595,7 +595,7 @@ function bb_RemovePictureLinks($match) {
|
|||
$ch = @curl_init($match[1]);
|
||||
@curl_setopt($ch, CURLOPT_NOBODY, true);
|
||||
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
@curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Friendica)");
|
||||
@curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION.")");
|
||||
@curl_exec($ch);
|
||||
$curl_info = @curl_getinfo($ch);
|
||||
|
||||
|
|
@ -643,7 +643,7 @@ function bb_CleanPictureLinksSub($match) {
|
|||
$ch = @curl_init($match[1]);
|
||||
@curl_setopt($ch, CURLOPT_NOBODY, true);
|
||||
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
@curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Friendica)");
|
||||
@curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION.")");
|
||||
@curl_exec($ch);
|
||||
$curl_info = @curl_getinfo($ch);
|
||||
|
||||
|
|
@ -1069,25 +1069,26 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
if($saved_image)
|
||||
$Text = bb_replace_images($Text, $saved_image);
|
||||
|
||||
// Clean up the HTML by loading and saving the HTML with the DOM
|
||||
// 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;
|
||||
// Clean up the HTML by loading and saving the HTML with the DOM.
|
||||
// Bad structured html can break a whole page.
|
||||
// For performance reasons do it only with ativated item cache or at export.
|
||||
if (!$tryoembed OR (get_itemcachepath() != "")) {
|
||||
$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 = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">';
|
||||
// @$doc->loadHTML($doctype."<html><body>".$Text."</body></html>");
|
||||
$doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">';
|
||||
$encoding = '<?xml encoding="UTF-8">';
|
||||
@$doc->loadHTML($encoding.$doctype."<html><body>".$Text."</body></html>");
|
||||
$doc->encoding = 'UTF-8';
|
||||
$Text = $doc->saveHTML();
|
||||
$Text = str_replace(array("<html><body>", "</body></html>", $doctype, $encoding), array("", "", "", ""), $Text);
|
||||
|
||||
// $Text = $doc->saveHTML();
|
||||
// $Text = str_replace(array("<html><body>", "</body></html>", $doctype), array("", "", ""), $Text);
|
||||
$Text = str_replace('<br></li>','</li>', $Text);
|
||||
|
||||
// $Text = str_replace('<br></li>','</li>', $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('<br /><ul','<ul ', $Text);
|
||||
|
|
|
|||
|
|
@ -186,29 +186,29 @@ function delivery_run(&$argv, &$argc){
|
|||
// in the URI, AND it was a comment (not top_level) AND the parent originated elsewhere.
|
||||
// if $parent['wall'] == 1 we will already have the parent message in our array
|
||||
// and we will relay the whole lot.
|
||||
|
||||
|
||||
// expire sends an entire group of expire messages and cannot be forwarded.
|
||||
// However the conversation owner will be a part of the conversation and will
|
||||
// However the conversation owner will be a part of the conversation and will
|
||||
// be notified during this run.
|
||||
// Other DFRN conversation members will be alerted during polled updates.
|
||||
|
||||
// Diaspora members currently are not notified of expirations, and other networks have
|
||||
// either limited or no ability to process deletions. We should at least fix Diaspora
|
||||
// either limited or no ability to process deletions. We should at least fix Diaspora
|
||||
// by stringing togther an array of retractions and sending them onward.
|
||||
|
||||
|
||||
|
||||
|
||||
$localhost = $a->get_hostname();
|
||||
if(strpos($localhost,':'))
|
||||
$localhost = substr($localhost,0,strpos($localhost,':'));
|
||||
|
||||
/**
|
||||
*
|
||||
* Be VERY CAREFUL if you make any changes to the following line. Seemingly innocuous changes
|
||||
* have been known to cause runaway conditions which affected several servers, along with
|
||||
* permissions issues.
|
||||
* Be VERY CAREFUL if you make any changes to the following line. Seemingly innocuous changes
|
||||
* have been known to cause runaway conditions which affected several servers, along with
|
||||
* permissions issues.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
if((! $top_level) && ($parent['wall'] == 0) && (! $expire) && (stristr($target_item['uri'],$localhost))) {
|
||||
logger('relay denied for delivery agent.');
|
||||
|
||||
|
|
@ -216,9 +216,9 @@ function delivery_run(&$argv, &$argc){
|
|||
continue;
|
||||
}
|
||||
|
||||
if((strlen($parent['allow_cid']))
|
||||
|| (strlen($parent['allow_gid']))
|
||||
|| (strlen($parent['deny_cid']))
|
||||
if((strlen($parent['allow_cid']))
|
||||
|| (strlen($parent['allow_gid']))
|
||||
|| (strlen($parent['deny_cid']))
|
||||
|| (strlen($parent['deny_gid']))) {
|
||||
$public_message = false; // private recipients, not public
|
||||
}
|
||||
|
|
@ -229,7 +229,7 @@ function delivery_run(&$argv, &$argc){
|
|||
|
||||
if(count($r))
|
||||
$contact = $r[0];
|
||||
|
||||
|
||||
$hubxml = feed_hublinks();
|
||||
|
||||
logger('notifier: slaps: ' . print_r($slaps,true), LOGGER_DATA);
|
||||
|
|
@ -297,7 +297,7 @@ function delivery_run(&$argv, &$argc){
|
|||
}
|
||||
|
||||
$atom .= '</feed>' . "\r\n";
|
||||
|
||||
|
||||
logger('notifier: ' . $atom, LOGGER_DATA);
|
||||
$basepath = implode('/', array_slice(explode('/',$contact['url']),0,3));
|
||||
|
||||
|
|
@ -311,15 +311,15 @@ function delivery_run(&$argv, &$argc){
|
|||
else
|
||||
$sql_extra = sprintf(" AND `issued-id` = '%s' ", dbesc($contact['dfrn-id']));
|
||||
|
||||
$x = q("SELECT `contact`.*, `contact`.`uid` AS `importer_uid`,
|
||||
`contact`.`pubkey` AS `cpubkey`,
|
||||
`contact`.`prvkey` AS `cprvkey`,
|
||||
`contact`.`thumb` AS `thumb`,
|
||||
$x = q("SELECT `contact`.*, `contact`.`uid` AS `importer_uid`,
|
||||
`contact`.`pubkey` AS `cpubkey`,
|
||||
`contact`.`prvkey` AS `cprvkey`,
|
||||
`contact`.`thumb` AS `thumb`,
|
||||
`contact`.`url` as `url`,
|
||||
`contact`.`name` as `senderName`,
|
||||
`user`.*
|
||||
FROM `contact`
|
||||
INNER JOIN `user` ON `contact`.`uid` = `user`.`uid`
|
||||
`user`.*
|
||||
FROM `contact`
|
||||
INNER JOIN `user` ON `contact`.`uid` = `user`.`uid`
|
||||
WHERE `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
AND `contact`.`network` = '%s' AND `user`.`nickname` = '%s'
|
||||
$sql_extra
|
||||
|
|
@ -390,7 +390,7 @@ function delivery_run(&$argv, &$argc){
|
|||
if(! $item_contact)
|
||||
continue;
|
||||
|
||||
if(($top_level) && ($public_message) && ($item['author-link'] === $item['owner-link']) && (! $expire))
|
||||
if(($top_level) && ($public_message) && ($item['author-link'] === $item['owner-link']) && (! $expire))
|
||||
$slaps[] = atom_entry($item,'html',null,$owner,true);
|
||||
}
|
||||
|
||||
|
|
@ -426,7 +426,7 @@ function delivery_run(&$argv, &$argc){
|
|||
if($cmd === 'wall-new' || $cmd === 'comment-new') {
|
||||
|
||||
$it = null;
|
||||
if($cmd === 'wall-new')
|
||||
if($cmd === 'wall-new')
|
||||
$it = $items[0];
|
||||
else {
|
||||
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
|
|
@ -509,7 +509,7 @@ function delivery_run(&$argv, &$argc){
|
|||
case NETWORK_DIASPORA :
|
||||
if($public_message)
|
||||
$loc = 'public batch ' . $contact['batch'];
|
||||
else
|
||||
else
|
||||
$loc = $contact['name'];
|
||||
|
||||
logger('delivery: diaspora batch deliver: ' . $loc);
|
||||
|
|
|
|||
|
|
@ -404,8 +404,8 @@ intval($params['uid']), LOGGER_DEBUG);
|
|||
|
||||
$textversion = strip_tags(html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r", "\\n"), "\n",
|
||||
$body))),ENT_QUOTES,'UTF-8'));
|
||||
$htmlversion = html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r","\\n\\n" ,"\\n"),
|
||||
"<br />\n",$body))));
|
||||
$htmlversion = html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r","\\n\\n" ,"\\n"),
|
||||
"<br />\n",$body))),ENT_QUOTES,'UTF-8');
|
||||
|
||||
$datarray = array();
|
||||
$datarray['banner'] = $banner;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_
|
|||
}
|
||||
|
||||
@curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
|
||||
@curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Friendica)");
|
||||
@curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION.")");
|
||||
|
||||
|
||||
if(intval($timeout)) {
|
||||
|
|
@ -72,7 +72,7 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_
|
|||
$base = $s;
|
||||
$curl_info = @curl_getinfo($ch);
|
||||
$http_code = $curl_info['http_code'];
|
||||
// logger('fetch_url:' . $http_code . ' data: ' . $s);
|
||||
logger('fetch_url '.$url.': '.$http_code." ".$s, LOGGER_DATA);
|
||||
$header = '';
|
||||
|
||||
// Pull out multiple headers, e.g. proxy and continuation headers
|
||||
|
|
@ -134,7 +134,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0, $timeout = 0)
|
|||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
|
||||
curl_setopt($ch, CURLOPT_POST,1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Friendica)");
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION.")");
|
||||
|
||||
if(intval($timeout)) {
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
||||
|
|
@ -1163,8 +1163,7 @@ function original_url($url, $depth=1, $fetchbody = false) {
|
|||
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
//curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0');
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Friendica)");
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION.")");
|
||||
|
||||
$header = curl_exec($ch);
|
||||
$curl_info = @curl_getinfo($ch);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue