if ($build != DB_UPDATE_VERSION) {
// When we cannot execute the database update via the worker, we will do it directly
if (!Worker::add(PRIORITY_CRITICAL, 'DBUpdate') && $via_worker) {
- update_db(get_app());
+ update_db();
}
}
}
}
-function acl_lookup(App $a, $out_type = 'json') {
-
+function acl_lookup(App $a, $out_type = 'json')
+{
if (!local_user()) {
return '';
}
- $start = (x($_REQUEST,'start') ? $_REQUEST['start'] : 0);
- $count = (x($_REQUEST,'count') ? $_REQUEST['count'] : 100);
- $search = (x($_REQUEST,'search') ? $_REQUEST['search'] : "");
- $type = (x($_REQUEST,'type') ? $_REQUEST['type'] : "");
- $mode = (x($_REQUEST,'smode') ? $_REQUEST['smode'] : "");
- $conv_id = (x($_REQUEST,'conversation') ? $_REQUEST['conversation'] : null);
+ $start = defaults($_REQUEST, 'start' , 0);
+ $count = defaults($_REQUEST, 'count' , 100);
+ $search = defaults($_REQUEST, 'search' , '');
+ $type = defaults($_REQUEST, 'type' , '');
+ $conv_id = defaults($_REQUEST, 'conversation', null);
// For use with jquery.textcomplete for private mail completion
-
- if (x($_REQUEST, 'query') && strlen($_REQUEST['query'])) {
+ if (x($_REQUEST, 'query')) {
if (! $type) {
$type = 'm';
}
logger("Searching for ".$search." - type ".$type, LOGGER_DEBUG);
- if ($search != "") {
+ if ($search != '') {
$sql_extra = "AND `name` LIKE '%%".dbesc($search)."%%'";
$sql_extra2 = "AND (`attag` LIKE '%%".dbesc($search)."%%' OR `name` LIKE '%%".dbesc($search)."%%' OR `nick` LIKE '%%".dbesc($search)."%%')";
} else {
$contact_count = (int)$r[0]['c'];
} elseif ($type == 'm') {
// autocomplete for Private Messages
-
$r = q("SELECT COUNT(*) AS c FROM `contact`
WHERE `uid` = %d AND NOT `self`
AND NOT `blocked` AND NOT `pending` AND NOT `archive`
$contact_count = (int)$r[0]['c'];
} elseif ($type == 'a') {
-
// autocomplete for Contacts
-
$r = q("SELECT COUNT(*) AS c FROM `contact`
WHERE `uid` = %d AND NOT `self`
AND NOT `pending` $sql_extra2" ,
intval(local_user())
);
$contact_count = (int)$r[0]['c'];
-
} else {
$contact_count = 0;
}
-
- $tot = $group_count+$contact_count;
+ $tot = $group_count + $contact_count;
$groups = array();
$contacts = array();
if ($type == '' || $type == 'g') {
-
/// @todo We should cache this query.
// This can be done when we can delete cache entries via wildcard
$r = q("SELECT `group`.`id`, `group`.`name`, GROUP_CONCAT(DISTINCT `group_member`.`contact-id` SEPARATOR ',') AS uids
);
foreach ($r as $g) {
-// logger('acl: group: ' . $g['name'] . ' members: ' . $g['uids']);
$groups[] = array(
"type" => "g",
"photo" => "images/twopeople.png",
}
if ($type == '') {
-
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv`, (`prv` OR `forum`) AS `frm` FROM `contact`
WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
AND `success_update` >= `failure_update` AND NOT (`network` IN ('%s', '%s'))
$r = array();
}
-
if (DBM::is_result($r)) {
$forums = array();
foreach ($r as $g) {
*/
function api_ff_ids($type)
{
- $a = get_app();
-
if (! api_user()) {
throw new ForbiddenException();
}
WHERE `contact`.`uid` = %s AND NOT `contact`.`self`",
intval(api_user())
);
-
if (!DBM::is_result($r)) {
return;
}
/**
* Returns an OAuth Access Token.
*
- * @param string $type Return type (atom, rss, xml, json)
- *
* @return array|string
* @see https://oauth.net/core/1.0/#auth_step3
*/
-function api_oauth_access_token($type)
+function api_oauth_access_token()
{
$oauth1 = new FKOAuth1();
try {
$itemlink = System::baseUrl().'/notify/view/'.$notify_id;
$msg = replace_macros($epreamble, array('$itemlink' => $itemlink));
$msg_cache = format_notification_message($datarray['name_cache'], strip_tags(bbcode($msg)));
- $r = q("UPDATE `notify` SET `msg` = '%s', `msg_cache` = '%s' WHERE `id` = %d AND `uid` = %d",
+ q("UPDATE `notify` SET `msg` = '%s', `msg_cache` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($msg),
dbesc($msg_cache),
intval($notify_id),
node2bbcode($doc, 'img', array('src' => '/(.+)/'), ' ', ' ');
}
- node2bbcode($doc, 'iframe', array('src' => '/(.+)/'), ' $1 ', '', true);
+ node2bbcode($doc, 'iframe', array('src' => '/(.+)/'), ' $1 ', '');
$message = $doc->saveHTML();
* It is done after the transaction to avoid dead locks.
*/
if ($arr['last-child']) {
- $r = q("UPDATE `item` SET `last-child` = 0 WHERE `parent-uri` = '%s' AND `uid` = %d AND `id` != %d",
+ q("UPDATE `item` SET `last-child` = 0 WHERE `parent-uri` = '%s' AND `uid` = %d AND `id` != %d",
dbesc($arr['uri']),
intval($arr['uid']),
intval($current_post)
// Now delete them
if ($parentid != "") {
- $r = q("DELETE FROM `sign` WHERE `iid` IN (%s)", dbesc($parentid));
+ q("DELETE FROM `sign` WHERE `iid` IN (%s)", dbesc($parentid));
}
// If it's the parent of a comment thread, kill all the kids
if ($item['uri'] == $item['parent-uri']) {
- $r = dba::update('item', array('deleted' => true, 'title' => '', 'body' => '',
+ dba::update('item', array('deleted' => true, 'title' => '', 'body' => '',
'edited' => datetime_convert(), 'changed' => datetime_convert()),
array('parent-uri' => $item['parent-uri'], 'uid' => $item['uid']));
$convid = $r['id'];
- $r = q("INSERT INTO `mail` ( `uid`, `guid`, `convid`, `from-name`, `from-photo`, `from-url`,
+ q("INSERT INTO `mail` ( `uid`, `guid`, `convid`, `from-name`, `from-photo`, `from-url`,
`contact-id`, `title`, `body`, `seen`, `reply`, `replied`, `uri`, `parent-uri`, `created`, `unknown`)
VALUES ( %d, '%s', %d, '%s', '%s', '%s', %d, '%s', '%s', %d, %d, %d, '%s', '%s', '%s', %d )",
intval($recipient['uid']),