mirror of
https://github.com/friendica/friendica
synced 2025-04-25 14:30:10 +00:00
Merge remote-tracking branch 'upstream/develop' into issue-1218
This commit is contained in:
commit
003e87b112
9 changed files with 45 additions and 35 deletions
|
@ -41,7 +41,9 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
|
|||
if ($matches[1] != "")
|
||||
$title = $matches[1];
|
||||
|
||||
$title = htmlentities($title, ENT_QUOTES, 'UTF-8', false);
|
||||
//$title = htmlentities($title, ENT_QUOTES, 'UTF-8', false);
|
||||
$title = bbcode(html_entity_decode($title), false, false, true);
|
||||
$title = str_replace(array("[", "]"), array("[", "]"), $title);
|
||||
|
||||
$image = "";
|
||||
if ($type != "video") {
|
||||
|
@ -1171,6 +1173,6 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
|
||||
$a->save_timestamp($stamp1, "parser");
|
||||
|
||||
return $Text;
|
||||
return trim($Text);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -823,6 +823,7 @@ function db_definition() {
|
|||
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
||||
"name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
|
||||
"locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||
"created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
|
||||
),
|
||||
"indexes" => array(
|
||||
"PRIMARY" => array("id"),
|
||||
|
|
|
@ -2668,14 +2668,14 @@ function item_is_remote_self($contact, &$datarray) {
|
|||
$datarray2 = $datarray;
|
||||
logger('remote-self start - Contact '.$contact['url'].' - '.$contact['remote_self'].' Item '.print_r($datarray, true), LOGGER_DEBUG);
|
||||
if ($contact['remote_self'] == 2) {
|
||||
$r = q("SELECT `id`,`url`,`name`,`photo`,`network` FROM `contact` WHERE `uid` = %d AND `self`",
|
||||
$r = q("SELECT `id`,`url`,`name`,`thumb` FROM `contact` WHERE `uid` = %d AND `self`",
|
||||
intval($contact['uid']));
|
||||
if (count($r)) {
|
||||
$datarray['contact-id'] = $r[0]["id"];
|
||||
|
||||
$datarray['owner-name'] = $r[0]["name"];
|
||||
$datarray['owner-link'] = $r[0]["url"];
|
||||
$datarray['owner-avatar'] = $r[0]["avatar"];
|
||||
$datarray['owner-avatar'] = $r[0]["thumb"];
|
||||
|
||||
$datarray['author-name'] = $datarray['owner-name'];
|
||||
$datarray['author-link'] = $datarray['owner-link'];
|
||||
|
|
|
@ -11,20 +11,22 @@ function lock_function($fn_name, $block = true, $wait_sec = 2, $timeout = 30) {
|
|||
$start = time();
|
||||
|
||||
do {
|
||||
q("LOCK TABLE locks WRITE");
|
||||
$r = q("SELECT locked FROM locks WHERE name = '%s' LIMIT 1",
|
||||
q("LOCK TABLE `locks` WRITE");
|
||||
$r = q("SELECT `locked`, `created` FROM `locks` WHERE `name` = '%s' LIMIT 1",
|
||||
dbesc($fn_name)
|
||||
);
|
||||
|
||||
if((count($r)) && (! $r[0]['locked'])) {
|
||||
q("UPDATE locks SET locked = 1 WHERE name = '%s'",
|
||||
if((count($r)) AND (!$r[0]['locked'] OR (strtotime($r[0]['created']) < time() - 3600))) {
|
||||
q("UPDATE `locks` SET `locked` = 1, `created` = '%s' WHERE `name` = '%s'",
|
||||
dbesc(datetime_convert()),
|
||||
dbesc($fn_name)
|
||||
);
|
||||
$got_lock = true;
|
||||
}
|
||||
elseif(! $r) { // the Boolean value for count($r) should be equivalent to the Boolean value of $r
|
||||
q("INSERT INTO locks ( name, locked ) VALUES ( '%s', 1 )",
|
||||
dbesc($fn_name)
|
||||
q("INSERT INTO `locks` (`name`, `created`, `locked`) VALUES ('%s', '%s', 1)",
|
||||
dbesc($fn_name),
|
||||
dbesc(datetime_convert())
|
||||
);
|
||||
$got_lock = true;
|
||||
}
|
||||
|
@ -37,7 +39,7 @@ function lock_function($fn_name, $block = true, $wait_sec = 2, $timeout = 30) {
|
|||
} while(($block) && (! $got_lock) && ((time() - $start) < $timeout));
|
||||
|
||||
logger('lock_function: function ' . $fn_name . ' with blocking = ' . $block . ' got_lock = ' . $got_lock . ' time = ' . (time() - $start), LOGGER_DEBUG);
|
||||
|
||||
|
||||
return $got_lock;
|
||||
}}
|
||||
|
||||
|
@ -65,7 +67,7 @@ function block_on_function_lock($fn_name, $wait_sec = 2, $timeout = 30) {
|
|||
|
||||
if(! function_exists('unlock_function')) {
|
||||
function unlock_function($fn_name) {
|
||||
$r = q("UPDATE locks SET locked = 0 WHERE name = '%s'",
|
||||
$r = q("UPDATE `locks` SET `locked` = 0, `created` = '0000-00-00 00:00:00' WHERE `name` = '%s'",
|
||||
dbesc($fn_name)
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue