Fix unused code in include (second pass)

This commit is contained in:
Hypolite Petovan 2018-01-04 09:51:05 -05:00
parent 3b23f89ca2
commit 35a18f6825
7 changed files with 18 additions and 34 deletions

View file

@ -676,7 +676,7 @@ function check_db($via_worker)
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();
}
}
}

View file

@ -386,22 +386,20 @@ function populate_acl($user = null, $show_jotnets = false) {
}
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';
}
@ -410,7 +408,7 @@ function acl_lookup(App $a, $out_type = 'json') {
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 {
@ -453,7 +451,6 @@ function acl_lookup(App $a, $out_type = 'json') {
$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`
@ -466,28 +463,23 @@ function acl_lookup(App $a, $out_type = 'json') {
$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
@ -504,7 +496,6 @@ function acl_lookup(App $a, $out_type = 'json') {
);
foreach ($r as $g) {
// logger('acl: group: ' . $g['name'] . ' members: ' . $g['uids']);
$groups[] = array(
"type" => "g",
"photo" => "images/twopeople.png",
@ -521,7 +512,6 @@ function acl_lookup(App $a, $out_type = 'json') {
}
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'))
@ -593,7 +583,6 @@ function acl_lookup(App $a, $out_type = 'json') {
$r = array();
}
if (DBM::is_result($r)) {
$forums = array();
foreach ($r as $g) {

View file

@ -3520,8 +3520,6 @@ api_register_func('api/statusnet/version', 'api_statusnet_version', false);
*/
function api_ff_ids($type)
{
$a = get_app();
if (! api_user()) {
throw new ForbiddenException();
}
@ -3534,7 +3532,6 @@ function api_ff_ids($type)
WHERE `contact`.`uid` = %s AND NOT `contact`.`self`",
intval(api_user())
);
if (!DBM::is_result($r)) {
return;
}
@ -3919,12 +3916,10 @@ function api_oauth_request_token()
/**
* 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 {

View file

@ -505,7 +505,7 @@ function notification($params)
$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),

View file

@ -201,7 +201,7 @@ function html2plain($html, $wraplength = 75, $compact = false)
node2bbcode($doc, 'img', array('src' => '/(.+)/'), ' ', ' ');
}
node2bbcode($doc, 'iframe', array('src' => '/(.+)/'), ' $1 ', '', true);
node2bbcode($doc, 'iframe', array('src' => '/(.+)/'), ' $1 ', '');
$message = $doc->saveHTML();

View file

@ -1116,7 +1116,7 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
* 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)
@ -2220,12 +2220,12 @@ function drop_item($id, $interactive = true) {
// 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']));

View file

@ -196,7 +196,7 @@ function send_wallmessage($recipient = '', $body = '', $subject = '', $replyto =
$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']),