Merge remote-tracking branch 'upstream/develop' into 1506-tag-users
This commit is contained in:
commit
39d4856abb
2
boot.php
2
boot.php
|
@ -18,7 +18,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
|||
define ( 'FRIENDICA_CODENAME', 'Lily of the valley');
|
||||
define ( 'FRIENDICA_VERSION', '3.4.0' );
|
||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||
define ( 'DB_UPDATE_VERSION', 1184 );
|
||||
define ( 'DB_UPDATE_VERSION', 1185 );
|
||||
define ( 'EOL', "<br />\r\n" );
|
||||
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
||||
|
||||
|
|
10
database.sql
10
database.sql
|
@ -1,6 +1,6 @@
|
|||
-- ------------------------------------------
|
||||
-- Friendica 3.4.0 (Lily of the valley)
|
||||
-- DB_UPDATE_VERSION 1183
|
||||
-- DB_UPDATE_VERSION 1185
|
||||
-- ------------------------------------------
|
||||
|
||||
|
||||
|
@ -358,7 +358,12 @@ CREATE TABLE IF NOT EXISTS `group_member` (
|
|||
CREATE TABLE IF NOT EXISTS `guid` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
`guid` varchar(255) NOT NULL DEFAULT '',
|
||||
INDEX `guid` (`guid`)
|
||||
`plink` varchar(255) NOT NULL DEFAULT '',
|
||||
`uri` varchar(255) NOT NULL DEFAULT '',
|
||||
`network` varchar(32) NOT NULL DEFAULT '',
|
||||
INDEX `guid` (`guid`),
|
||||
INDEX `plink` (`plink`),
|
||||
INDEX `uri` (`uri`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
|
@ -587,6 +592,7 @@ CREATE TABLE IF NOT EXISTS `notify` (
|
|||
`msg` mediumtext NOT NULL,
|
||||
`uid` int(11) NOT NULL DEFAULT 0,
|
||||
`link` varchar(255) NOT NULL DEFAULT '',
|
||||
`iid` int(11) NOT NULL DEFAULT 0,
|
||||
`parent` int(11) NOT NULL DEFAULT 0,
|
||||
`seen` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`verb` varchar(255) NOT NULL DEFAULT '',
|
||||
|
|
|
@ -94,3 +94,7 @@ $a->config['system']['lockpath'] = "";
|
|||
|
||||
// Use the old style "share"
|
||||
// $a->config['system']['old_share'] = false;
|
||||
|
||||
//Deny public access to the local directory
|
||||
//$a->config['system']['block_local_dir'] = false;
|
||||
|
||||
|
|
|
@ -395,19 +395,27 @@
|
|||
'screen_name' => (($r[0]['nick']) ? $r[0]['nick'] : $r[0]['name']),
|
||||
'location' => NULL,
|
||||
'description' => NULL,
|
||||
'profile_image_url' => $r[0]["avatar"],
|
||||
'profile_image_url_https' => $r[0]["avatar"],
|
||||
'url' => $r[0]["url"],
|
||||
'protected' => false,
|
||||
'followers_count' => 0,
|
||||
'friends_count' => 0,
|
||||
'listed_count' => 0,
|
||||
'created_at' => api_date(0),
|
||||
'favourites_count' => 0,
|
||||
'utc_offset' => 0,
|
||||
'time_zone' => 'UTC',
|
||||
'statuses_count' => 0,
|
||||
'following' => false,
|
||||
'geo_enabled' => false,
|
||||
'verified' => false,
|
||||
'statuses_count' => 0,
|
||||
'lang' => '',
|
||||
'contributors_enabled' => false,
|
||||
'is_translator' => false,
|
||||
'is_translation_enabled' => false,
|
||||
'profile_image_url' => $r[0]["avatar"],
|
||||
'profile_image_url_https' => $r[0]["avatar"],
|
||||
'following' => false,
|
||||
'follow_request_sent' => false,
|
||||
'notifications' => false,
|
||||
'statusnet_blocking' => false,
|
||||
'notifications' => false,
|
||||
'statusnet_profile_url' => $r[0]["url"],
|
||||
|
@ -954,20 +962,29 @@
|
|||
$converted = api_convert_item($item);
|
||||
|
||||
$status_info = array(
|
||||
'text' => $converted["text"],
|
||||
'truncated' => false,
|
||||
'created_at' => api_date($lastwall['created']),
|
||||
'in_reply_to_status_id' => $in_reply_to_status_id,
|
||||
'in_reply_to_status_id_str' => $in_reply_to_status_id_str,
|
||||
'source' => (($lastwall['app']) ? $lastwall['app'] : 'web'),
|
||||
'id' => intval($lastwall['id']),
|
||||
'id_str' => (string) $lastwall['id'],
|
||||
'text' => $converted["text"],
|
||||
'source' => (($lastwall['app']) ? $lastwall['app'] : 'web'),
|
||||
'truncated' => false,
|
||||
'in_reply_to_status_id' => $in_reply_to_status_id,
|
||||
'in_reply_to_status_id_str' => $in_reply_to_status_id_str,
|
||||
'in_reply_to_user_id' => $in_reply_to_user_id,
|
||||
'in_reply_to_user_id_str' => $in_reply_to_user_id_str,
|
||||
'in_reply_to_screen_name' => $in_reply_to_screen_name,
|
||||
'geo' => NULL,
|
||||
'favorited' => $lastwall['starred'] ? true : false,
|
||||
'user' => $user_info,
|
||||
'geo' => NULL,
|
||||
'coordinates' => "",
|
||||
'place' => "",
|
||||
'contributors' => "",
|
||||
'is_quote_status' => false,
|
||||
'retweet_count' => 0,
|
||||
'favorite_count' => 0,
|
||||
'favorited' => $lastwall['starred'] ? true : false,
|
||||
'retweeted' => false,
|
||||
'possibly_sensitive' => false,
|
||||
'lang' => "",
|
||||
'statusnet_html' => $converted["html"],
|
||||
'statusnet_conversation_id' => $lastwall['parent'],
|
||||
);
|
||||
|
@ -2957,6 +2974,19 @@ function api_best_nickname(&$contacts) {
|
|||
|
||||
|
||||
/*
|
||||
To.Do:
|
||||
[pagename] => api/1.1/statuses/lookup.json
|
||||
[id] => 605138389168451584
|
||||
[include_cards] => true
|
||||
[cards_platform] => Android-12
|
||||
[include_entities] => true
|
||||
[include_my_retweet] => 1
|
||||
[include_rts] => 1
|
||||
[include_reply_count] => true
|
||||
[include_descendent_reply_count] => true
|
||||
|
||||
|
||||
|
||||
Not implemented by now:
|
||||
statuses/retweets_of_me
|
||||
friendships/create
|
||||
|
|
|
@ -1180,13 +1180,13 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
|
||||
$Text = preg_replace("/\[event\-summary\](.*?)\[\/event\-summary\]/ism",'',$Text);
|
||||
$Text = preg_replace("/\[event\-description\](.*?)\[\/event\-description\]/ism",'',$Text);
|
||||
$Text = preg_replace("/\[event\-start\](.*?)\[\/event\-start\]/ism",$sub,$Text);
|
||||
$Text = preg_replace("/\[event\-start\](.*?)\[\/event\-start\]/ism",$sub,$Text);
|
||||
$Text = preg_replace("/\[event\-finish\](.*?)\[\/event\-finish\]/ism",'',$Text);
|
||||
$Text = preg_replace("/\[event\-location\](.*?)\[\/event\-location\]/ism",'',$Text);
|
||||
$Text = preg_replace("/\[event\-adjust\](.*?)\[\/event\-adjust\]/ism",'',$Text);
|
||||
}
|
||||
|
||||
// Unhide all [noparse] contained bbtags unspacefying them
|
||||
// Unhide all [noparse] contained bbtags unspacefying them
|
||||
// and triming the [noparse] tag.
|
||||
|
||||
$Text = preg_replace_callback("/\[noparse\](.*?)\[\/noparse\]/ism", 'bb_unspacefy_and_trim',$Text);
|
||||
|
@ -1200,7 +1200,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
|
||||
// fix any escaped ampersands that may have been converted into links
|
||||
$Text = preg_replace("/\<([^>]*?)(src|href)=(.*?)\&\;(.*?)\>/ism",'<$1$2=$3&$4>',$Text);
|
||||
$Text = preg_replace("/\<([^>]*?)(src|href)=\"(?!http|ftp|mailto|cid)(.*?)\>/ism",'<$1$2="">',$Text);
|
||||
// $Text = preg_replace("/\<([^>]*?)(src|href)=\"(?!http|ftp|mailto|cid)(.*?)\>/ism",'<$1$2="">',$Text);
|
||||
|
||||
if($saved_image)
|
||||
$Text = bb_replace_images($Text, $saved_image);
|
||||
|
|
|
@ -687,10 +687,15 @@ function db_definition() {
|
|||
"fields" => array(
|
||||
"id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
||||
"guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||
"network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
|
||||
),
|
||||
"indexes" => array(
|
||||
"PRIMARY" => array("id"),
|
||||
"guid" => array("guid"),
|
||||
"plink" => array("plink"),
|
||||
"uri" => array("uri"),
|
||||
)
|
||||
);
|
||||
$database["hook"] = array(
|
||||
|
|
|
@ -1099,7 +1099,15 @@ function encode_rel_links($links) {
|
|||
return xmlify($o);
|
||||
}
|
||||
|
||||
function add_guid($item) {
|
||||
$r = q("SELECT `guid` FROM `guid` WHERE `guid` = '%s' LIMIT 1", dbesc($item["guid"]));
|
||||
if ($r)
|
||||
return;
|
||||
|
||||
q("INSERT INTO `guid` (`guid`,`plink`,`uri`,`network`) VALUES ('%s','%s','%s','%s')",
|
||||
dbesc($item["guid"]), dbesc($item["plink"]),
|
||||
dbesc($item["uri"]), dbesc($item["network"]));
|
||||
}
|
||||
|
||||
function item_store($arr,$force_parent = false, $notify = false, $dontcache = false) {
|
||||
|
||||
|
@ -1168,11 +1176,10 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
|
|||
}
|
||||
|
||||
// If there is no guid then take the same guid that was taken before for the same uri
|
||||
if ((trim($arr['guid']) == "") AND (trim($arr['uri']) != "")) {
|
||||
if ((trim($arr['guid']) == "") AND (trim($arr['uri']) != "") AND (trim($arr['network']) != "")) {
|
||||
logger('item_store: checking for an existing guid for uri '.$arr['uri'], LOGGER_DEBUG);
|
||||
$r = q("SELECT `guid` FROM `item` WHERE `uri` = '%s' AND `guid` != '' LIMIT 1",
|
||||
dbesc(trim($arr['uri']))
|
||||
);
|
||||
$r = q("SELECT `guid` FROM `guid` WHERE `uri` = '%s' AND `network` = '%s' LIMIT 1",
|
||||
dbesc(trim($arr['uri'])), dbesc(trim($arr['network'])));
|
||||
|
||||
if(count($r)) {
|
||||
$arr['guid'] = $r[0]["guid"];
|
||||
|
@ -1181,11 +1188,10 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
|
|||
}
|
||||
|
||||
// If there is no guid then take the same guid that was taken before for the same plink
|
||||
if ((trim($arr['guid']) == "") AND (trim($arr['plink']) != "")) {
|
||||
if ((trim($arr['guid']) == "") AND (trim($arr['plink']) != "") AND (trim($arr['network']) != "")) {
|
||||
logger('item_store: checking for an existing guid for plink '.$arr['plink'], LOGGER_DEBUG);
|
||||
$r = q("SELECT `guid` FROM `item` WHERE `plink` = '%s' AND `guid` != '' LIMIT 1",
|
||||
dbesc(trim($arr['plink']))
|
||||
);
|
||||
$r = q("SELECT `guid` FROM `guid` WHERE `plink` = '%s' AND `network` = '%s' LIMIT 1",
|
||||
dbesc(trim($arr['plink'])), dbesc(trim($arr['network'])));
|
||||
|
||||
if(count($r)) {
|
||||
$arr['guid'] = $r[0]["guid"];
|
||||
|
@ -1476,6 +1482,10 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
|
|||
);
|
||||
|
||||
if(count($r)) {
|
||||
|
||||
// Store the guid and other relevant data
|
||||
add_guid($arr);
|
||||
|
||||
$current_post = $r[0]['id'];
|
||||
logger('item_store: created item ' . $current_post);
|
||||
|
||||
|
@ -1697,12 +1707,12 @@ function item_body_set_hashtags(&$item) {
|
|||
// mask hashtags inside of url, bookmarks and attachments to avoid urls in urls
|
||||
$item["body"] = preg_replace_callback("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
|
||||
function ($match){
|
||||
return("[url=".$match[1]."]".str_replace("#", "#", $match[2])."[/url]");
|
||||
return("[url=".str_replace("#", "#", $match[1])."]".str_replace("#", "#", $match[2])."[/url]");
|
||||
},$item["body"]);
|
||||
|
||||
$item["body"] = preg_replace_callback("/\[bookmark\=([$URLSearchString]*)\](.*?)\[\/bookmark\]/ism",
|
||||
function ($match){
|
||||
return("[bookmark=".$match[1]."]".str_replace("#", "#", $match[2])."[/bookmark]");
|
||||
return("[bookmark=".str_replace("#", "#", $match[1])."]".str_replace("#", "#", $match[2])."[/bookmark]");
|
||||
},$item["body"]);
|
||||
|
||||
$item["body"] = preg_replace_callback("/\[attachment (.*)\](.*?)\[\/attachment\]/ism",
|
||||
|
@ -1714,6 +1724,7 @@ function item_body_set_hashtags(&$item) {
|
|||
$item["body"] = preg_replace("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
|
||||
"#$2", $item["body"]);
|
||||
|
||||
|
||||
foreach($tags as $tag) {
|
||||
if(strpos($tag,'#') !== 0)
|
||||
continue;
|
||||
|
@ -4956,17 +4967,17 @@ function first_post_date($uid,$wall = false) {
|
|||
/* modified posted_dates() {below} to arrange the list in years */
|
||||
function list_post_dates($uid, $wall) {
|
||||
$dnow = datetime_convert('',date_default_timezone_get(),'now','Y-m-d');
|
||||
|
||||
$dthen = first_post_date($uid, $wall);
|
||||
|
||||
$dthen = first_post_date($uid, $wall);
|
||||
if(! $dthen)
|
||||
return array();
|
||||
|
||||
|
||||
// Set the start and end date to the beginning of the month
|
||||
$dnow = substr($dnow,0,8).'01';
|
||||
$dthen = substr($dthen,0,8).'01';
|
||||
|
||||
|
||||
$ret = array();
|
||||
|
||||
|
||||
// Starting with the current month, get the first and last days of every
|
||||
// month down to and including the month of the first post
|
||||
while(substr($dnow, 0, 7) >= substr($dthen, 0, 7)) {
|
||||
|
@ -5021,19 +5032,19 @@ function posted_date_widget($url,$uid,$wall) {
|
|||
|
||||
/* if($wall && intval(get_pconfig($uid,'system','no_wall_archive_widget')))
|
||||
return $o;*/
|
||||
|
||||
|
||||
$visible_years = get_pconfig($uid,'system','archive_visible_years');
|
||||
if(! $visible_years)
|
||||
$visible_years = 5;
|
||||
|
||||
$visible_years = 5;
|
||||
|
||||
$ret = list_post_dates($uid,$wall);
|
||||
|
||||
|
||||
if(! count($ret))
|
||||
return $o;
|
||||
|
||||
$cutoff_year = intval(datetime_convert('',date_default_timezone_get(),'now','Y')) - $visible_years;
|
||||
$cutoff = ((array_key_exists($cutoff_year,$ret))? true : false);
|
||||
|
||||
|
||||
$o = replace_macros(get_markup_template('posted_date_widget.tpl'),array(
|
||||
'$title' => t('Archives'),
|
||||
'$size' => $visible_years,
|
||||
|
|
|
@ -193,8 +193,9 @@ function oembed_format_object($j){
|
|||
} else {
|
||||
// add <a> for html2bbcode conversion
|
||||
$ret .= "<a href='$embedurl' rel='oembed'>$embedurl</a>";
|
||||
$ret.="<br style='clear:left'></span>";
|
||||
$ret .= "<br style='clear:left'>";
|
||||
}
|
||||
$ret.="</span>";
|
||||
return mb_convert_encoding($ret, 'HTML-ENTITIES', mb_detect_encoding($ret));
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@ function directory_content(&$a) {
|
|||
|
||||
require_once("mod/proxy.php");
|
||||
|
||||
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
|
||||
if((get_config('system','block_public')) && (! local_user()) && (! remote_user()) ||
|
||||
(get_config('system','block_local_dir')) && (! local_user()) && (! remote_user())) {
|
||||
notice( t('Public access denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -865,6 +865,9 @@ function item_post(&$a) {
|
|||
// NOTREACHED
|
||||
}
|
||||
|
||||
// Store the guid and other relevant data
|
||||
add_guid($datarray);
|
||||
|
||||
$post_id = $r[0]['id'];
|
||||
logger('mod_item: saved item ' . $post_id);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ function poco_init(&$a) {
|
|||
|
||||
$system_mode = false;
|
||||
|
||||
if(intval(get_config('system','block_public')))
|
||||
if(intval(get_config('system','block_public')) || (get_config('system','block_local_dir')))
|
||||
http_status_exit(401);
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
define( 'UPDATE_VERSION' , 1184 );
|
||||
define( 'UPDATE_VERSION' , 1185 );
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue
Block a user