Removed many "limit 1" at update and delete queries since they were superflous und generated massiv logfile entries
This commit is contained in:
parent
53c06a3625
commit
759015e5fd
6 changed files with 88 additions and 85 deletions
|
@ -1141,7 +1141,7 @@ function item_store($arr,$force_parent = false) {
|
||||||
// Set parent id - and also make sure to inherit the parent's ACL's.
|
// Set parent id - and also make sure to inherit the parent's ACL's.
|
||||||
|
|
||||||
$r = q("UPDATE `item` SET `parent` = %d, `allow_cid` = '%s', `allow_gid` = '%s',
|
$r = q("UPDATE `item` SET `parent` = %d, `allow_cid` = '%s', `allow_gid` = '%s',
|
||||||
`deny_cid` = '%s', `deny_gid` = '%s', `private` = %d, `deleted` = %d WHERE `id` = %d LIMIT 1",
|
`deny_cid` = '%s', `deny_gid` = '%s', `private` = %d, `deleted` = %d WHERE `id` = %d",
|
||||||
intval($parent_id),
|
intval($parent_id),
|
||||||
dbesc($allow_cid),
|
dbesc($allow_cid),
|
||||||
dbesc($allow_gid),
|
dbesc($allow_gid),
|
||||||
|
@ -1168,7 +1168,7 @@ function item_store($arr,$force_parent = false) {
|
||||||
|
|
||||||
// update the commented timestamp on the parent
|
// update the commented timestamp on the parent
|
||||||
|
|
||||||
q("UPDATE `item` set `commented` = '%s', `changed` = '%s' WHERE `id` = %d LIMIT 1",
|
q("UPDATE `item` set `commented` = '%s', `changed` = '%s' WHERE `id` = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($parent_id)
|
intval($parent_id)
|
||||||
|
@ -1293,7 +1293,7 @@ function tag_deliver($uid,$item_id) {
|
||||||
// mmh.. no mention.. community page or private group... no wall.. no origin.. top-post (not a comment)
|
// mmh.. no mention.. community page or private group... no wall.. no origin.. top-post (not a comment)
|
||||||
// delete it!
|
// delete it!
|
||||||
logger("tag_deliver: no-mention top-level post to communuty or private group. delete.");
|
logger("tag_deliver: no-mention top-level post to communuty or private group. delete.");
|
||||||
q("DELETE FROM item WHERE id = %d and uid = %d limit 1",
|
q("DELETE FROM item WHERE id = %d and uid = %d",
|
||||||
intval($item_id),
|
intval($item_id),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
|
@ -1363,7 +1363,7 @@ function tag_deliver($uid,$item_id) {
|
||||||
$forum_mode = (($prvgroup) ? 2 : 1);
|
$forum_mode = (($prvgroup) ? 2 : 1);
|
||||||
|
|
||||||
q("update item set wall = 1, origin = 1, forum_mode = %d, `owner-name` = '%s', `owner-link` = '%s', `owner-avatar` = '%s',
|
q("update item set wall = 1, origin = 1, forum_mode = %d, `owner-name` = '%s', `owner-link` = '%s', `owner-avatar` = '%s',
|
||||||
`private` = %d, `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' where id = %d limit 1",
|
`private` = %d, `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' where id = %d",
|
||||||
intval($forum_mode),
|
intval($forum_mode),
|
||||||
dbesc($c[0]['name']),
|
dbesc($c[0]['name']),
|
||||||
dbesc($c[0]['url']),
|
dbesc($c[0]['url']),
|
||||||
|
@ -1514,7 +1514,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
|
||||||
if($perm) {
|
if($perm) {
|
||||||
if((($perm == 'rw') && (! intval($contact['writable'])))
|
if((($perm == 'rw') && (! intval($contact['writable'])))
|
||||||
|| (($perm == 'r') && (intval($contact['writable'])))) {
|
|| (($perm == 'r') && (intval($contact['writable'])))) {
|
||||||
q("update contact set writable = %d where id = %d limit 1",
|
q("update contact set writable = %d where id = %d",
|
||||||
intval(($perm == 'rw') ? 1 : 0),
|
intval(($perm == 'rw') ? 1 : 0),
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
|
@ -1776,7 +1776,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'
|
q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'
|
||||||
WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
WHERE `uid` = %d AND `id` = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc($a->get_baseurl() . '/photo/' . $hash . '-4.'.$img->getExt()),
|
dbesc($a->get_baseurl() . '/photo/' . $hash . '-4.'.$img->getExt()),
|
||||||
dbesc($a->get_baseurl() . '/photo/' . $hash . '-5.'.$img->getExt()),
|
dbesc($a->get_baseurl() . '/photo/' . $hash . '-5.'.$img->getExt()),
|
||||||
|
@ -1793,7 +1793,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
|
|
||||||
$x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
$x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d",
|
||||||
dbesc(notags(trim($new_name))),
|
dbesc(notags(trim($new_name))),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($contact['uid']),
|
intval($contact['uid']),
|
||||||
|
@ -1846,7 +1846,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
||||||
|
|
||||||
// update bdyear
|
// update bdyear
|
||||||
|
|
||||||
q("UPDATE `contact` SET `bdyear` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
q("UPDATE `contact` SET `bdyear` = '%s' WHERE `uid` = %d AND `id` = %d",
|
||||||
dbesc(substr($birthday,0,4)),
|
dbesc(substr($birthday,0,4)),
|
||||||
intval($contact['uid']),
|
intval($contact['uid']),
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
|
@ -1867,7 +1867,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
||||||
$community_page = intval($rawtags[0]['data']);
|
$community_page = intval($rawtags[0]['data']);
|
||||||
}
|
}
|
||||||
if(is_array($contact) && intval($contact['forum']) != $community_page) {
|
if(is_array($contact) && intval($contact['forum']) != $community_page) {
|
||||||
q("update contact set forum = %d where id = %d limit 1",
|
q("update contact set forum = %d where id = %d",
|
||||||
intval($community_page),
|
intval($community_page),
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
|
@ -1930,7 +1930,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
||||||
if(trim($tag) !== trim($xo->body))
|
if(trim($tag) !== trim($xo->body))
|
||||||
$newtags[] = trim($tag);
|
$newtags[] = trim($tag);
|
||||||
}
|
}
|
||||||
q("update item set tag = '%s' where id = %d limit 1",
|
q("update item set tag = '%s' where id = %d",
|
||||||
dbesc(implode(',',$newtags)),
|
dbesc(implode(',',$newtags)),
|
||||||
intval($i[0]['id'])
|
intval($i[0]['id'])
|
||||||
);
|
);
|
||||||
|
@ -1954,7 +1954,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
||||||
else {
|
else {
|
||||||
$r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s',
|
$r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s',
|
||||||
`body` = '', `title` = ''
|
`body` = '', `title` = ''
|
||||||
WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
WHERE `uri` = '%s' AND `uid` = %d",
|
||||||
dbesc($when),
|
dbesc($when),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc($uri),
|
dbesc($uri),
|
||||||
|
@ -1975,7 +1975,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
||||||
intval($importer['uid'])
|
intval($importer['uid'])
|
||||||
);
|
);
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d LIMIT 1",
|
q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d",
|
||||||
intval($r[0]['id'])
|
intval($r[0]['id'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2066,7 +2066,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
||||||
if(datetime_convert('UTC','UTC',$datarray['edited']) < $r[0]['edited'])
|
if(datetime_convert('UTC','UTC',$datarray['edited']) < $r[0]['edited'])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
|
||||||
dbesc($datarray['title']),
|
dbesc($datarray['title']),
|
||||||
dbesc($datarray['body']),
|
dbesc($datarray['body']),
|
||||||
dbesc($datarray['tag']),
|
dbesc($datarray['tag']),
|
||||||
|
@ -2086,7 +2086,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
||||||
dbesc($parent_uri),
|
dbesc($parent_uri),
|
||||||
intval($importer['uid'])
|
intval($importer['uid'])
|
||||||
);
|
);
|
||||||
$r = q("UPDATE `item` SET `last-child` = %d , `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
$r = q("UPDATE `item` SET `last-child` = %d , `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
|
||||||
intval($allow[0]['data']),
|
intval($allow[0]['data']),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc($item_id),
|
dbesc($item_id),
|
||||||
|
@ -2135,7 +2135,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
||||||
if($xo->id && $xo->content) {
|
if($xo->id && $xo->content) {
|
||||||
$newtag = '#[url=' . $xo->id . ']'. $xo->content . '[/url]';
|
$newtag = '#[url=' . $xo->id . ']'. $xo->content . '[/url]';
|
||||||
if(! (stristr($r[0]['tag'],$newtag))) {
|
if(! (stristr($r[0]['tag'],$newtag))) {
|
||||||
q("UPDATE item SET tag = '%s' WHERE id = %d LIMIT 1",
|
q("UPDATE item SET tag = '%s' WHERE id = %d",
|
||||||
dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . $newtag),
|
dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . $newtag),
|
||||||
intval($r[0]['id'])
|
intval($r[0]['id'])
|
||||||
);
|
);
|
||||||
|
@ -2215,7 +2215,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
||||||
if(datetime_convert('UTC','UTC',$datarray['edited']) < $r[0]['edited'])
|
if(datetime_convert('UTC','UTC',$datarray['edited']) < $r[0]['edited'])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
|
||||||
dbesc($datarray['title']),
|
dbesc($datarray['title']),
|
||||||
dbesc($datarray['body']),
|
dbesc($datarray['body']),
|
||||||
dbesc($datarray['tag']),
|
dbesc($datarray['tag']),
|
||||||
|
@ -2230,7 +2230,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
||||||
|
|
||||||
$allow = $item->get_item_tags( NAMESPACE_DFRN, 'comment-allow');
|
$allow = $item->get_item_tags( NAMESPACE_DFRN, 'comment-allow');
|
||||||
if($allow && $allow[0]['data'] != $r[0]['last-child']) {
|
if($allow && $allow[0]['data'] != $r[0]['last-child']) {
|
||||||
$r = q("UPDATE `item` SET `last-child` = %d , `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
$r = q("UPDATE `item` SET `last-child` = %d , `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
|
||||||
intval($allow[0]['data']),
|
intval($allow[0]['data']),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc($item_id),
|
dbesc($item_id),
|
||||||
|
@ -2415,7 +2415,7 @@ function local_delivery($importer,$data) {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'
|
q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'
|
||||||
WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
WHERE `uid` = %d AND `id` = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc($a->get_baseurl() . '/photo/' . $hash . '-4.'.$img->getExt()),
|
dbesc($a->get_baseurl() . '/photo/' . $hash . '-4.'.$img->getExt()),
|
||||||
dbesc($a->get_baseurl() . '/photo/' . $hash . '-5.'.$img->getExt()),
|
dbesc($a->get_baseurl() . '/photo/' . $hash . '-5.'.$img->getExt()),
|
||||||
|
@ -2432,7 +2432,7 @@ function local_delivery($importer,$data) {
|
||||||
intval($importer['id'])
|
intval($importer['id'])
|
||||||
);
|
);
|
||||||
|
|
||||||
$x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
$x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d",
|
||||||
dbesc(notags(trim($new_name))),
|
dbesc(notags(trim($new_name))),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($importer['importer_uid']),
|
intval($importer['importer_uid']),
|
||||||
|
@ -2691,7 +2691,7 @@ function local_delivery($importer,$data) {
|
||||||
$community_page = intval($rawtags[0]['data']);
|
$community_page = intval($rawtags[0]['data']);
|
||||||
}
|
}
|
||||||
if(intval($importer['forum']) != $community_page) {
|
if(intval($importer['forum']) != $community_page) {
|
||||||
q("update contact set forum = %d where id = %d limit 1",
|
q("update contact set forum = %d where id = %d",
|
||||||
intval($community_page),
|
intval($community_page),
|
||||||
intval($importer['id'])
|
intval($importer['id'])
|
||||||
);
|
);
|
||||||
|
@ -2822,7 +2822,7 @@ function local_delivery($importer,$data) {
|
||||||
if(trim($tag) !== trim($xo->body))
|
if(trim($tag) !== trim($xo->body))
|
||||||
$newtags[] = trim($tag);
|
$newtags[] = trim($tag);
|
||||||
}
|
}
|
||||||
q("update item set tag = '%s' where id = %d limit 1",
|
q("update item set tag = '%s' where id = %d",
|
||||||
dbesc(implode(',',$newtags)),
|
dbesc(implode(',',$newtags)),
|
||||||
intval($i[0]['id'])
|
intval($i[0]['id'])
|
||||||
);
|
);
|
||||||
|
@ -2846,7 +2846,7 @@ function local_delivery($importer,$data) {
|
||||||
else {
|
else {
|
||||||
$r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s',
|
$r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s',
|
||||||
`body` = '', `title` = ''
|
`body` = '', `title` = ''
|
||||||
WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
WHERE `uri` = '%s' AND `uid` = %d",
|
||||||
dbesc($when),
|
dbesc($when),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc($uri),
|
dbesc($uri),
|
||||||
|
@ -2867,7 +2867,7 @@ function local_delivery($importer,$data) {
|
||||||
intval($importer['importer_uid'])
|
intval($importer['importer_uid'])
|
||||||
);
|
);
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d LIMIT 1",
|
q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d",
|
||||||
intval($r[0]['id'])
|
intval($r[0]['id'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2970,7 +2970,7 @@ function local_delivery($importer,$data) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
logger('received updated comment' , LOGGER_DEBUG);
|
logger('received updated comment' , LOGGER_DEBUG);
|
||||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
|
||||||
dbesc($datarray['title']),
|
dbesc($datarray['title']),
|
||||||
dbesc($datarray['body']),
|
dbesc($datarray['body']),
|
||||||
dbesc($datarray['tag']),
|
dbesc($datarray['tag']),
|
||||||
|
@ -3046,7 +3046,7 @@ function local_delivery($importer,$data) {
|
||||||
intval($importer['importer_uid'])
|
intval($importer['importer_uid'])
|
||||||
);
|
);
|
||||||
if(count($i) && ! intval($i[0]['blocktags'])) {
|
if(count($i) && ! intval($i[0]['blocktags'])) {
|
||||||
q("UPDATE item SET tag = '%s', `edited` = '%s' WHERE id = %d LIMIT 1",
|
q("UPDATE item SET tag = '%s', `edited` = '%s' WHERE id = %d",
|
||||||
dbesc($tagp[0]['tag'] . (strlen($tagp[0]['tag']) ? ',' : '') . $newtag),
|
dbesc($tagp[0]['tag'] . (strlen($tagp[0]['tag']) ? ',' : '') . $newtag),
|
||||||
intval($tagp[0]['id']),
|
intval($tagp[0]['id']),
|
||||||
dbesc(datetime_convert())
|
dbesc(datetime_convert())
|
||||||
|
@ -3079,7 +3079,7 @@ function local_delivery($importer,$data) {
|
||||||
intval($r[0]['parent'])
|
intval($r[0]['parent'])
|
||||||
);
|
);
|
||||||
|
|
||||||
$r2 = q("UPDATE `item` SET `last-child` = 1, `changed` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
$r2 = q("UPDATE `item` SET `last-child` = 1, `changed` = '%s' WHERE `uid` = %d AND `id` = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($importer['importer_uid']),
|
intval($importer['importer_uid']),
|
||||||
intval($posted_id)
|
intval($posted_id)
|
||||||
|
@ -3144,7 +3144,7 @@ function local_delivery($importer,$data) {
|
||||||
if(datetime_convert('UTC','UTC',$datarray['edited']) < $r[0]['edited'])
|
if(datetime_convert('UTC','UTC',$datarray['edited']) < $r[0]['edited'])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
|
||||||
dbesc($datarray['title']),
|
dbesc($datarray['title']),
|
||||||
dbesc($datarray['body']),
|
dbesc($datarray['body']),
|
||||||
dbesc($datarray['tag']),
|
dbesc($datarray['tag']),
|
||||||
|
@ -3164,7 +3164,7 @@ function local_delivery($importer,$data) {
|
||||||
dbesc($parent_uri),
|
dbesc($parent_uri),
|
||||||
intval($importer['importer_uid'])
|
intval($importer['importer_uid'])
|
||||||
);
|
);
|
||||||
$r = q("UPDATE `item` SET `last-child` = %d , `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
$r = q("UPDATE `item` SET `last-child` = %d , `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
|
||||||
intval($allow[0]['data']),
|
intval($allow[0]['data']),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc($item_id),
|
dbesc($item_id),
|
||||||
|
@ -3209,7 +3209,7 @@ function local_delivery($importer,$data) {
|
||||||
// extract tag, if not duplicate, add to parent item
|
// extract tag, if not duplicate, add to parent item
|
||||||
if($xo->content) {
|
if($xo->content) {
|
||||||
if(! (stristr($r[0]['tag'],trim($xo->content)))) {
|
if(! (stristr($r[0]['tag'],trim($xo->content)))) {
|
||||||
q("UPDATE item SET tag = '%s' WHERE id = %d LIMIT 1",
|
q("UPDATE item SET tag = '%s' WHERE id = %d",
|
||||||
dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . '#[url=' . $xo->id . ']'. $xo->content . '[/url]'),
|
dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . '#[url=' . $xo->id . ']'. $xo->content . '[/url]'),
|
||||||
intval($r[0]['id'])
|
intval($r[0]['id'])
|
||||||
);
|
);
|
||||||
|
@ -3320,7 +3320,7 @@ function local_delivery($importer,$data) {
|
||||||
if(datetime_convert('UTC','UTC',$datarray['edited']) < $r[0]['edited'])
|
if(datetime_convert('UTC','UTC',$datarray['edited']) < $r[0]['edited'])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
|
||||||
dbesc($datarray['title']),
|
dbesc($datarray['title']),
|
||||||
dbesc($datarray['body']),
|
dbesc($datarray['body']),
|
||||||
dbesc($datarray['tag']),
|
dbesc($datarray['tag']),
|
||||||
|
@ -3335,7 +3335,7 @@ function local_delivery($importer,$data) {
|
||||||
|
|
||||||
$allow = $item->get_item_tags( NAMESPACE_DFRN, 'comment-allow');
|
$allow = $item->get_item_tags( NAMESPACE_DFRN, 'comment-allow');
|
||||||
if($allow && $allow[0]['data'] != $r[0]['last-child']) {
|
if($allow && $allow[0]['data'] != $r[0]['last-child']) {
|
||||||
$r = q("UPDATE `item` SET `last-child` = %d , `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
$r = q("UPDATE `item` SET `last-child` = %d , `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
|
||||||
intval($allow[0]['data']),
|
intval($allow[0]['data']),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc($item_id),
|
dbesc($item_id),
|
||||||
|
@ -3443,7 +3443,7 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
|
||||||
if(is_array($contact)) {
|
if(is_array($contact)) {
|
||||||
if(($contact['network'] == NETWORK_OSTATUS && $contact['rel'] == CONTACT_IS_SHARING)
|
if(($contact['network'] == NETWORK_OSTATUS && $contact['rel'] == CONTACT_IS_SHARING)
|
||||||
|| ($sharing && $contact['rel'] == CONTACT_IS_FOLLOWER)) {
|
|| ($sharing && $contact['rel'] == CONTACT_IS_FOLLOWER)) {
|
||||||
$r = q("UPDATE `contact` SET `rel` = %d, `writable` = 1 WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
$r = q("UPDATE `contact` SET `rel` = %d, `writable` = 1 WHERE `id` = %d AND `uid` = %d",
|
||||||
intval(CONTACT_IS_FRIEND),
|
intval(CONTACT_IS_FRIEND),
|
||||||
intval($contact['id']),
|
intval($contact['id']),
|
||||||
intval($importer['uid'])
|
intval($importer['uid'])
|
||||||
|
@ -3522,7 +3522,7 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
|
||||||
function lose_follower($importer,$contact,$datarray,$item) {
|
function lose_follower($importer,$contact,$datarray,$item) {
|
||||||
|
|
||||||
if(($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_SHARING)) {
|
if(($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_SHARING)) {
|
||||||
q("UPDATE `contact` SET `rel` = %d WHERE `id` = %d LIMIT 1",
|
q("UPDATE `contact` SET `rel` = %d WHERE `id` = %d",
|
||||||
intval(CONTACT_IS_SHARING),
|
intval(CONTACT_IS_SHARING),
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
|
@ -3535,7 +3535,7 @@ function lose_follower($importer,$contact,$datarray,$item) {
|
||||||
function lose_sharer($importer,$contact,$datarray,$item) {
|
function lose_sharer($importer,$contact,$datarray,$item) {
|
||||||
|
|
||||||
if(($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_FOLLOWER)) {
|
if(($contact['rel'] == CONTACT_IS_FRIEND) || ($contact['rel'] == CONTACT_IS_FOLLOWER)) {
|
||||||
q("UPDATE `contact` SET `rel` = %d WHERE `id` = %d LIMIT 1",
|
q("UPDATE `contact` SET `rel` = %d WHERE `id` = %d",
|
||||||
intval(CONTACT_IS_FOLLOWER),
|
intval(CONTACT_IS_FOLLOWER),
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
|
@ -3574,7 +3574,7 @@ function subscribe_to_hub($url,$importer,$contact,$hubmode = 'subscribe') {
|
||||||
logger('subscribe_to_hub: ' . $hubmode . ' ' . $contact['name'] . ' to hub ' . $url . ' endpoint: ' . $push_url . ' with verifier ' . $verify_token);
|
logger('subscribe_to_hub: ' . $hubmode . ' ' . $contact['name'] . ' to hub ' . $url . ' endpoint: ' . $push_url . ' with verifier ' . $verify_token);
|
||||||
|
|
||||||
if(! strlen($contact['hub-verify'])) {
|
if(! strlen($contact['hub-verify'])) {
|
||||||
$r = q("UPDATE `contact` SET `hub-verify` = '%s' WHERE `id` = %d LIMIT 1",
|
$r = q("UPDATE `contact` SET `hub-verify` = '%s' WHERE `id` = %d",
|
||||||
dbesc($verify_token),
|
dbesc($verify_token),
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
|
@ -4047,7 +4047,7 @@ function drop_item($id,$interactive = true) {
|
||||||
logger('delete item: ' . $item['id'], LOGGER_DEBUG);
|
logger('delete item: ' . $item['id'], LOGGER_DEBUG);
|
||||||
// delete the item
|
// delete the item
|
||||||
|
|
||||||
$r = q("UPDATE `item` SET `deleted` = 1, `title` = '', `body` = '', `edited` = '%s', `changed` = '%s' WHERE `id` = %d LIMIT 1",
|
$r = q("UPDATE `item` SET `deleted` = 1, `title` = '', `body` = '', `edited` = '%s', `changed` = '%s' WHERE `id` = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($item['id'])
|
intval($item['id'])
|
||||||
|
@ -4089,7 +4089,7 @@ function drop_item($id,$interactive = true) {
|
||||||
// If item is a link to an event, nuke the event record.
|
// If item is a link to an event, nuke the event record.
|
||||||
|
|
||||||
if(intval($item['event-id'])) {
|
if(intval($item['event-id'])) {
|
||||||
q("DELETE FROM `event` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
q("DELETE FROM `event` WHERE `id` = %d AND `uid` = %d",
|
||||||
intval($item['event-id']),
|
intval($item['event-id']),
|
||||||
intval($item['uid'])
|
intval($item['uid'])
|
||||||
);
|
);
|
||||||
|
@ -4162,7 +4162,7 @@ function drop_item($id,$interactive = true) {
|
||||||
intval($item['uid'])
|
intval($item['uid'])
|
||||||
);
|
);
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d LIMIT 1",
|
q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d",
|
||||||
intval($r[0]['id'])
|
intval($r[0]['id'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ function lock_function($fn_name, $block = true, $wait_sec = 2, $timeout = 30) {
|
||||||
);
|
);
|
||||||
|
|
||||||
if((count($r)) && (! $r[0]['locked'])) {
|
if((count($r)) && (! $r[0]['locked'])) {
|
||||||
q("UPDATE locks SET locked = 1 WHERE name = '%s' LIMIT 1",
|
q("UPDATE locks SET locked = 1 WHERE name = '%s'",
|
||||||
dbesc($fn_name)
|
dbesc($fn_name)
|
||||||
);
|
);
|
||||||
$got_lock = true;
|
$got_lock = true;
|
||||||
|
@ -65,7 +65,7 @@ function block_on_function_lock($fn_name, $wait_sec = 2, $timeout = 30) {
|
||||||
|
|
||||||
if(! function_exists('unlock_function')) {
|
if(! function_exists('unlock_function')) {
|
||||||
function unlock_function($fn_name) {
|
function unlock_function($fn_name) {
|
||||||
$r = q("UPDATE locks SET locked = 0 WHERE name = '%s' LIMIT 1",
|
$r = q("UPDATE locks SET locked = 0 WHERE name = '%s'",
|
||||||
dbesc($fn_name)
|
dbesc($fn_name)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -783,7 +783,7 @@ function add_fcontact($arr,$update = false) {
|
||||||
`alias` = '%s',
|
`alias` = '%s',
|
||||||
`pubkey` = '%s',
|
`pubkey` = '%s',
|
||||||
`updated` = '%s'
|
`updated` = '%s'
|
||||||
WHERE `url` = '%s' AND `network` = '%s' LIMIT 1",
|
WHERE `url` = '%s' AND `network` = '%s'",
|
||||||
dbesc($arr['name']),
|
dbesc($arr['name']),
|
||||||
dbesc($arr['photo']),
|
dbesc($arr['photo']),
|
||||||
dbesc($arr['request']),
|
dbesc($arr['request']),
|
||||||
|
|
|
@ -142,7 +142,7 @@ function onepoll_run(&$argv, &$argc){
|
||||||
// But this may be our first communication, so set the writable flag if it isn't set already.
|
// But this may be our first communication, so set the writable flag if it isn't set already.
|
||||||
|
|
||||||
if(! intval($contact['writable']))
|
if(! intval($contact['writable']))
|
||||||
q("update contact set writable = 1 where id = %d limit 1", intval($contact['id']));
|
q("update contact set writable = 1 where id = %d", intval($contact['id']));
|
||||||
|
|
||||||
|
|
||||||
$url = $contact['poll'] . '?dfrn_id=' . $idtosend
|
$url = $contact['poll'] . '?dfrn_id=' . $idtosend
|
||||||
|
@ -166,7 +166,7 @@ function onepoll_run(&$argv, &$argc){
|
||||||
mark_for_death($contact);
|
mark_for_death($contact);
|
||||||
|
|
||||||
// set the last-update so we don't keep polling
|
// set the last-update so we don't keep polling
|
||||||
$r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1",
|
$r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
|
@ -179,7 +179,7 @@ function onepoll_run(&$argv, &$argc){
|
||||||
|
|
||||||
mark_for_death($contact);
|
mark_for_death($contact);
|
||||||
|
|
||||||
$r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1",
|
$r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
|
@ -196,7 +196,7 @@ function onepoll_run(&$argv, &$argc){
|
||||||
// set the last-update so we don't keep polling
|
// set the last-update so we don't keep polling
|
||||||
|
|
||||||
|
|
||||||
$r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1",
|
$r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
|
@ -213,7 +213,7 @@ function onepoll_run(&$argv, &$argc){
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(((float) $res->dfrn_version > 2.21) && ($contact['poco'] == '')) {
|
if(((float) $res->dfrn_version > 2.21) && ($contact['poco'] == '')) {
|
||||||
q("update contact set poco = '%s' where id = %d limit 1",
|
q("update contact set poco = '%s' where id = %d",
|
||||||
dbesc(str_replace('/profile/','/poco/', $contact['url'])),
|
dbesc(str_replace('/profile/','/poco/', $contact['url'])),
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
|
@ -267,7 +267,7 @@ function onepoll_run(&$argv, &$argc){
|
||||||
$stat_writeable = 1;
|
$stat_writeable = 1;
|
||||||
|
|
||||||
if($stat_writeable != $contact['writable']) {
|
if($stat_writeable != $contact['writable']) {
|
||||||
q("UPDATE `contact` SET `writable` = %d WHERE `id` = %d LIMIT 1",
|
q("UPDATE `contact` SET `writable` = %d WHERE `id` = %d",
|
||||||
intval($stat_writeable),
|
intval($stat_writeable),
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
|
@ -305,7 +305,7 @@ function onepoll_run(&$argv, &$argc){
|
||||||
unset($password);
|
unset($password);
|
||||||
logger("Mail: Connect to " . $mailconf[0]['user']);
|
logger("Mail: Connect to " . $mailconf[0]['user']);
|
||||||
if($mbox) {
|
if($mbox) {
|
||||||
q("UPDATE `mailacct` SET `last_check` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
q("UPDATE `mailacct` SET `last_check` = '%s' WHERE `id` = %d AND `uid` = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($mailconf[0]['id']),
|
intval($mailconf[0]['id']),
|
||||||
intval($importer_uid)
|
intval($importer_uid)
|
||||||
|
@ -347,7 +347,7 @@ function onepoll_run(&$argv, &$argc){
|
||||||
// Only delete when mails aren't automatically moved or deleted
|
// Only delete when mails aren't automatically moved or deleted
|
||||||
if (($mailconf[0]['action'] != 1) AND ($mailconf[0]['action'] != 3))
|
if (($mailconf[0]['action'] != 1) AND ($mailconf[0]['action'] != 3))
|
||||||
if($meta->deleted && ! $r[0]['deleted']) {
|
if($meta->deleted && ! $r[0]['deleted']) {
|
||||||
q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `id` = %d LIMIT 1",
|
q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `id` = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($r[0]['id'])
|
intval($r[0]['id'])
|
||||||
);
|
);
|
||||||
|
@ -496,7 +496,7 @@ function onepoll_run(&$argv, &$argc){
|
||||||
dbesc($datarray['parent-uri']),
|
dbesc($datarray['parent-uri']),
|
||||||
intval($importer_uid)
|
intval($importer_uid)
|
||||||
);
|
);
|
||||||
q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d LIMIT 1",
|
q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d",
|
||||||
intval($stored_item)
|
intval($stored_item)
|
||||||
);
|
);
|
||||||
switch ($mailconf[0]['action']) {
|
switch ($mailconf[0]['action']) {
|
||||||
|
@ -536,7 +536,7 @@ function onepoll_run(&$argv, &$argc){
|
||||||
logger('poller: received xml : ' . $xml, LOGGER_DATA);
|
logger('poller: received xml : ' . $xml, LOGGER_DATA);
|
||||||
if((! strstr($xml,'<?xml')) && (! strstr($xml,'<rss'))) {
|
if((! strstr($xml,'<?xml')) && (! strstr($xml,'<rss'))) {
|
||||||
logger('poller: post_handshake: response from ' . $url . ' did not contain XML.');
|
logger('poller: post_handshake: response from ' . $url . ' did not contain XML.');
|
||||||
$r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1",
|
$r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
|
@ -574,7 +574,7 @@ function onepoll_run(&$argv, &$argc){
|
||||||
|
|
||||||
$updated = datetime_convert();
|
$updated = datetime_convert();
|
||||||
|
|
||||||
$r = q("UPDATE `contact` SET `last-update` = '%s', `success_update` = '%s' WHERE `id` = %d LIMIT 1",
|
$r = q("UPDATE `contact` SET `last-update` = '%s', `success_update` = '%s' WHERE `id` = %d",
|
||||||
dbesc($updated),
|
dbesc($updated),
|
||||||
dbesc($updated),
|
dbesc($updated),
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
|
|
|
@ -494,10 +494,13 @@ var num = $pageno;
|
||||||
|
|
||||||
$(window).scroll(function(e){
|
$(window).scroll(function(e){
|
||||||
|
|
||||||
//if ($(window).scrollTop() == $(document).height() - $(window).height()){
|
// First method that is expected to work - but has problems with Chrome
|
||||||
if ($(window).scrollTop() > $("section").height() - $(window).height()){
|
if ($(window).scrollTop() == $(document).height() - $(window).height())
|
||||||
|
loadcontent();
|
||||||
|
|
||||||
|
// This method works with Chrome
|
||||||
|
if ($(window).scrollTop() > (($("section").height() + $("header").height() + $("footer").height()) - $(window).height()))
|
||||||
loadcontent();
|
loadcontent();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -796,7 +796,7 @@ function network_content(&$a, $update = 0) {
|
||||||
// Fetch a page full of parent items for this page
|
// Fetch a page full of parent items for this page
|
||||||
|
|
||||||
if($update) {
|
if($update) {
|
||||||
$r = q("SELECT `parent` AS `item_id`, `contact`.`uid` AS `contact_uid`
|
$r = q("SELECT `item`.`parent` AS `item_id`, `contact`.`uid` AS `contact_uid`
|
||||||
FROM $sql_table LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
FROM $sql_table LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND
|
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND
|
||||||
(`item`.`deleted` = 0 OR item.verb = '" . ACTIVITY_LIKE ."' OR item.verb = '" . ACTIVITY_DISLIKE . "')
|
(`item`.`deleted` = 0 OR item.verb = '" . ACTIVITY_LIKE ."' OR item.verb = '" . ACTIVITY_DISLIKE . "')
|
||||||
|
|
Loading…
Reference in a new issue