Merge https://github.com/friendica/friendica into pull
This commit is contained in:
commit
f1c579e74a
56 changed files with 15356 additions and 38323 deletions
|
@ -559,6 +559,8 @@
|
|||
$_REQUEST['body'] = requestdata('status');
|
||||
//$_REQUEST['body'] = urldecode(requestdata('status'));
|
||||
|
||||
$_REQUEST['title'] = requestdata('title');
|
||||
|
||||
$parent = requestdata('in_reply_to_status_id');
|
||||
if(ctype_digit($parent))
|
||||
$_REQUEST['parent'] = $parent;
|
||||
|
|
|
@ -3,7 +3,24 @@
|
|||
require_once("include/oembed.php");
|
||||
require_once('include/event.php');
|
||||
|
||||
function cleancss($input) {
|
||||
|
||||
$cleaned = "";
|
||||
|
||||
$input = strtolower($input);
|
||||
|
||||
for ($i = 0; $i < strlen($input); $i++) {
|
||||
$char = substr($input, $i, 1);
|
||||
|
||||
if (($char >= "a") and ($char <= "z"))
|
||||
$cleaned .= $char;
|
||||
|
||||
if (!(strpos(" #;:0123456789", $char) === false))
|
||||
$cleaned .= $char;
|
||||
}
|
||||
|
||||
return($cleaned);
|
||||
}
|
||||
|
||||
function stripcode_br_cb($s) {
|
||||
return '[code]' . str_replace('<br />', '', $s[1]) . '[/code]';
|
||||
|
|
|
@ -231,7 +231,7 @@ function q($sql) {
|
|||
unset($args[0]);
|
||||
|
||||
if($db && $db->connected) {
|
||||
$stmt = vsprintf($sql,$args);
|
||||
$stmt = @vsprintf($sql,$args); // Disabled warnings
|
||||
//logger("dba: q: $stmt", LOGGER_ALL);
|
||||
if($stmt === false)
|
||||
logger('dba: vsprintf error: ' . print_r(debug_backtrace(),true), LOGGER_DEBUG);
|
||||
|
|
|
@ -859,7 +859,8 @@ function diaspora_post($importer,$xml,$msg) {
|
|||
$datarray['parent'] = 0;
|
||||
$datarray['owner-name'] = $contact['name'];
|
||||
$datarray['owner-link'] = $contact['url'];
|
||||
$datarray['owner-avatar'] = $contact['thumb'];
|
||||
//$datarray['owner-avatar'] = $contact['thumb'];
|
||||
$datarray['owner-avatar'] = ((x($contact,'thumb')) ? $contact['thumb'] : $contact['photo']);
|
||||
$datarray['author-name'] = $contact['name'];
|
||||
$datarray['author-link'] = $contact['url'];
|
||||
$datarray['author-avatar'] = $contact['thumb'];
|
||||
|
@ -962,8 +963,8 @@ function diaspora_reshare($importer,$xml,$msg) {
|
|||
$details = '[url=' . $person['url'] . ']' . $person['name'] . '[/url]';
|
||||
else
|
||||
$details = $orig_author;
|
||||
|
||||
$prefix = html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8') . $details . "\n";
|
||||
|
||||
$prefix = html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8') . $details . "\n";
|
||||
|
||||
|
||||
// allocate a guid on our system - we aren't fixing any collisions.
|
||||
|
@ -1021,11 +1022,22 @@ function diaspora_reshare($importer,$xml,$msg) {
|
|||
$datarray['parent'] = 0;
|
||||
$datarray['owner-name'] = $contact['name'];
|
||||
$datarray['owner-link'] = $contact['url'];
|
||||
$datarray['owner-avatar'] = $contact['thumb'];
|
||||
$datarray['author-name'] = $contact['name'];
|
||||
$datarray['author-link'] = $contact['url'];
|
||||
$datarray['author-avatar'] = $contact['thumb'];
|
||||
$datarray['body'] = $prefix . $body;
|
||||
$datarray['owner-avatar'] = ((x($contact,'thumb')) ? $contact['thumb'] : $contact['photo']);
|
||||
if (intval(get_config('system','diaspora_newreshare'))) {
|
||||
// Let reshared messages look like wall-to-wall posts
|
||||
// we have to set an additional value in the item in the future
|
||||
// to distinct the wall-to-wall-posts from reshared/repeated messages
|
||||
$datarray['author-name'] = $person['name'];
|
||||
$datarray['author-link'] = $person['url'];
|
||||
$datarray['author-avatar'] = ((x($person,'thumb')) ? $person['thumb'] : $person['photo']);
|
||||
$datarray['body'] = $body;
|
||||
} else {
|
||||
$datarray['author-name'] = $contact['name'];
|
||||
$datarray['author-link'] = $contact['url'];
|
||||
$datarray['author-avatar'] = $contact['thumb'];
|
||||
$datarray['body'] = $prefix . $body;
|
||||
}
|
||||
|
||||
$datarray['tag'] = $str_tags;
|
||||
$datarray['app'] = 'Diaspora';
|
||||
|
||||
|
@ -1116,7 +1128,8 @@ function diaspora_asphoto($importer,$xml,$msg) {
|
|||
$datarray['parent'] = 0;
|
||||
$datarray['owner-name'] = $contact['name'];
|
||||
$datarray['owner-link'] = $contact['url'];
|
||||
$datarray['owner-avatar'] = $contact['thumb'];
|
||||
//$datarray['owner-avatar'] = $contact['thumb'];
|
||||
$datarray['owner-avatar'] = ((x($contact,'thumb')) ? $contact['thumb'] : $contact['photo']);
|
||||
$datarray['author-name'] = $contact['name'];
|
||||
$datarray['author-link'] = $contact['url'];
|
||||
$datarray['author-avatar'] = $contact['thumb'];
|
||||
|
@ -1864,7 +1877,8 @@ EOT;
|
|||
|
||||
$arr['owner-name'] = $parent_item['name'];
|
||||
$arr['owner-link'] = $parent_item['url'];
|
||||
$arr['owner-avatar'] = $parent_item['thumb'];
|
||||
//$arr['owner-avatar'] = $parent_item['thumb'];
|
||||
$arr['owner-avatar'] = ((x($parent_item,'thumb')) ? $parent_item['thumb'] : $parent_item['photo']);
|
||||
|
||||
$arr['author-name'] = $person['name'];
|
||||
$arr['author-link'] = $person['url'];
|
||||
|
|
|
@ -92,6 +92,9 @@ function collecturls($message) {
|
|||
if ((strpos($treffer[1], "//plus.google.com/") !== false) and (strpos($treffer[1], "/posts") !== false))
|
||||
$ignore = false;
|
||||
|
||||
if ((strpos($treffer[1], "//plus.google.com/") !== false) and (strpos($treffer[1], "/photos") !== false))
|
||||
$ignore = false;
|
||||
|
||||
if (!$ignore)
|
||||
$urls[$treffer[1]] = $treffer[1];
|
||||
}
|
||||
|
|
|
@ -379,10 +379,12 @@ function title_is_body($title, $body) {
|
|||
|
||||
$title = strip_tags($title);
|
||||
$title = trim($title);
|
||||
$title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
|
||||
$title = str_replace(array("\n", "\r", "\t", " "), array("","","",""), $title);
|
||||
|
||||
$body = strip_tags($body);
|
||||
$body = trim($body);
|
||||
$body = html_entity_decode($body, ENT_QUOTES, 'UTF-8');
|
||||
$body = str_replace(array("\n", "\r", "\t", " "), array("","","",""), $body);
|
||||
|
||||
if (strlen($title) < strlen($body))
|
||||
|
@ -793,6 +795,8 @@ function get_atom_elements($feed,$item) {
|
|||
// There is some better way to parse this array - but it didn't worked for me.
|
||||
$child = $item->feed->data["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["feed"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["entry"][0]["child"]["http://activitystrea.ms/spec/1.0/"][object][0]["child"];
|
||||
if (is_array($child)) {
|
||||
logger('get_atom_elements: Looking for status.net repeated message');
|
||||
|
||||
$message = $child["http://activitystrea.ms/spec/1.0/"]["object"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["content"][0]["data"];
|
||||
$author = $child[SIMPLEPIE_NAMESPACE_ATOM_10]["author"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10];
|
||||
$uri = $author["uri"][0]["data"];
|
||||
|
@ -801,6 +805,8 @@ function get_atom_elements($feed,$item) {
|
|||
$avatar = $avatar["href"];
|
||||
|
||||
if (($name != "") and ($uri != "") and ($avatar != "") and ($message != "")) {
|
||||
logger('get_atom_elements: fixing sender of repeated message');
|
||||
|
||||
$res["owner-name"] = $res["author-name"];
|
||||
$res["owner-link"] = $res["author-link"];
|
||||
$res["owner-avatar"] = $res["author-avatar"];
|
||||
|
|
|
@ -823,15 +823,13 @@ function scale_external_images($s, $include_link = true, $scale_replace = false)
|
|||
$scaled = $mtch[1];
|
||||
$i = fetch_url($scaled);
|
||||
|
||||
$cache = get_config('system','itemcache');
|
||||
if (($cache != '') and is_dir($cache)) {
|
||||
$cachefile = $cache."/".hash("md5", $scaled);
|
||||
$cachefile = get_cachefile(hash("md5", $scaled));
|
||||
if ($cachefile != '')
|
||||
file_put_contents($cachefile, $i);
|
||||
}
|
||||
|
||||
// guess mimetype from headers or filename
|
||||
$type = guess_image_type($mtch[1],true);
|
||||
|
||||
|
||||
if($i) {
|
||||
$ph = new Photo($i, $type);
|
||||
if($ph->is_valid()) {
|
||||
|
|
|
@ -102,18 +102,8 @@ function poller_run(&$argv, &$argc){
|
|||
// clear old cache
|
||||
Cache::clear();
|
||||
|
||||
// clear item cache files if they are older than one day
|
||||
$cache = get_config('system','itemcache');
|
||||
if (($cache != '') and is_dir($cache)) {
|
||||
if ($dh = opendir($cache)) {
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
$fullpath = $cache."/".$file;
|
||||
if ((filetype($fullpath) == "file") and filectime($fullpath) < (time() - 86400))
|
||||
unlink($fullpath);
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
}
|
||||
// clear old item cache files
|
||||
clear_cache();
|
||||
|
||||
$manual_id = 0;
|
||||
$generation = 0;
|
||||
|
@ -128,7 +118,7 @@ function poller_run(&$argv, &$argc){
|
|||
$restart = true;
|
||||
$generation = intval($argv[2]);
|
||||
if(! $generation)
|
||||
killme();
|
||||
killme();
|
||||
}
|
||||
|
||||
if(($argc > 1) && intval($argv[1])) {
|
||||
|
|
|
@ -962,13 +962,11 @@ if(! function_exists('prepare_body')) {
|
|||
function prepare_body($item,$attach = false) {
|
||||
|
||||
$a = get_app();
|
||||
call_hooks('prepare_body_init', $item);
|
||||
call_hooks('prepare_body_init', $item);
|
||||
|
||||
$cache = get_config('system','itemcache');
|
||||
|
||||
if (($cache != '')) {
|
||||
$cachefile = $cache."/".$item["guid"]."-".strtotime($item["edited"])."-".hash("crc32", $item['body']);
|
||||
$cachefile = get_cachefile($item["guid"]."-".strtotime($item["edited"])."-".hash("crc32", $item['body']));
|
||||
|
||||
if (($cachefile != '')) {
|
||||
if (file_exists($cachefile))
|
||||
$s = file_get_contents($cachefile);
|
||||
else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue