Merge pull request #4438 from rabuzarus/20180211_-_fix_variables_part_one

fix undeclared variables or wrong variable names (/include) - part 1
This commit is contained in:
Hypolite Petovan 2018-02-11 22:00:42 -05:00 committed by GitHub
commit f68667e301
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 17 deletions

View File

@ -716,7 +716,7 @@ function navbar_complete(App $a) {
// check if searching in the local global contact table is enabled
$localsearch = Config::get('system','poco_local_search');
$search = $prefix.notags(trim($_REQUEST['search']));
$search = notags(trim($_REQUEST['search']));
$mode = $_REQUEST['smode'];
// don't search if search term has less than 2 characters

View File

@ -1610,6 +1610,7 @@ api_register_func('api/users/lookup', 'api_users_lookup', true);
function api_search($type)
{
$data = [];
$sql_extra = '';
if (!x($_REQUEST, 'q')) {
throw new BadRequestException("q parameter is required.");
@ -1791,6 +1792,7 @@ function api_statuses_public_timeline($type)
$conversation_id = (x($_REQUEST, 'conversation_id') ? $_REQUEST['conversation_id'] : 0);
$start = $page * $count;
$sql_extra = '';
if ($exclude_replies && !$conversation_id) {
if ($max_id > 0) {
@ -2147,7 +2149,6 @@ function api_statuses_repeat($type)
WHERE `item`.`visible` AND NOT `item`.`moderated` AND NOT `item`.`deleted`
AND NOT `item`.`private` AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
$sql_extra
AND `item`.`id`=%d",
intval($id)
);
@ -2267,8 +2268,10 @@ function api_statuses_mentions($type)
$myurl = substr($myurl, strpos($myurl, '://') + 3);
$myurl = str_replace('www.', '', $myurl);
$sql_extra = '';
if ($max_id > 0) {
$sql_extra = ' AND `item`.`id` <= ' . intval($max_id);
$sql_extra .= ' AND `item`.`id` <= ' . intval($max_id);
}
$r = q(
@ -2459,7 +2462,7 @@ function api_favorites_create_destroy($type)
throw new BadRequestException("Invalid action ".$action);
}
Item::update(['starred' => $item[0]['starred']], ['id' => $itemid]);
$r = Item::update(['starred' => $item[0]['starred']], ['id' => $itemid]);
if ($r === false) {
throw new InternalServerErrorException("DB error");
@ -2934,7 +2937,7 @@ function api_contactlink_to_array($txt)
];
} else {
$res = [
'name' => $text,
'name' => $txt,
'url' => ""
];
}
@ -3534,6 +3537,8 @@ function api_ff_ids($type)
throw new ForbiddenException();
}
$a = get_app();
api_get_user($a);
$stringify_ids = defaults($_REQUEST, 'stringify_ids', false);
@ -3660,7 +3665,7 @@ function api_direct_messages_new($type)
switch ($type) {
case "atom":
case "rss":
$data = api_rss_extra($a, $data, $user_info);
$data = api_rss_extra($a, $data, $sender);
}
return api_format_data("direct-messages", $type, $data);
@ -3792,6 +3797,8 @@ function api_direct_messages_box($type, $box, $verbose)
// pagination
$start = $page * $count;
$sql_extra = "";
// filters
if ($box=="sentbox") {
$sql_extra = "`mail`.`from-url`='" . dbesc($profile_url) . "'";
@ -4907,7 +4914,7 @@ function api_friendica_remoteauth()
goaway(
$contact['poll'] . '?dfrn_id=' . $dfrn_id
. '&dfrn_version=' . DFRN_PROTOCOL_VERSION
. '&type=profile&sec=' . $sec . $dest . $quiet
. '&type=profile&sec=' . $sec . $dest
);
}
api_register_func('api/friendica/remoteauth', 'api_friendica_remoteauth', true);
@ -5226,7 +5233,7 @@ function api_best_nickname(&$contacts)
{
$best_contact = [];
if (count($contact) == 0) {
if (count($contacts) == 0) {
return;
}
@ -5755,11 +5762,12 @@ api_register_func('api/friendica/direct_messages_setseen', 'api_friendica_direct
* @brief search for direct_messages containing a searchstring through api
*
* @param string $type Known types are 'atom', 'rss', 'xml' and 'json'
* @param string $box
* @return string (success: success=true if found and search_result contains found messages,
* success=false if nothing was found, search_result='nothing found',
* error: result=error with error message)
*/
function api_friendica_direct_messages_search($type)
function api_friendica_direct_messages_search($type, $box = "")
{
$a = get_app();

View File

@ -24,7 +24,7 @@ require_once 'include/text.php';
require_once 'mod/share.php';
require_once 'include/enotify.php';
function add_page_info_data($data) {
function add_page_info_data($data, $no_photos = false) {
Addon::callHooks('page_info_data', $data);
// It maybe is a rich content, but if it does have everything that a link has,
@ -92,7 +92,7 @@ function add_page_info_data($data) {
return "\n".$text.$hashtags;
}
function query_page_info($url, $no_photos = false, $photo = "", $keywords = false, $keyword_blacklist = "") {
function query_page_info($url, $photo = "", $keywords = false, $keyword_blacklist = "") {
$data = ParseUrl::getSiteinfoCached($url, true);
@ -120,8 +120,8 @@ function query_page_info($url, $no_photos = false, $photo = "", $keywords = fals
return $data;
}
function add_page_keywords($url, $no_photos = false, $photo = "", $keywords = false, $keyword_blacklist = "") {
$data = query_page_info($url, $no_photos, $photo, $keywords, $keyword_blacklist);
function add_page_keywords($url, $photo = "", $keywords = false, $keyword_blacklist = "") {
$data = query_page_info($url, $photo, $keywords, $keyword_blacklist);
$tags = "";
if (isset($data["keywords"]) && count($data["keywords"])) {
@ -141,9 +141,9 @@ function add_page_keywords($url, $no_photos = false, $photo = "", $keywords = fa
}
function add_page_info($url, $no_photos = false, $photo = "", $keywords = false, $keyword_blacklist = "") {
$data = query_page_info($url, $no_photos, $photo, $keywords, $keyword_blacklist);
$data = query_page_info($url, $photo, $keywords, $keyword_blacklist);
$text = add_page_info_data($data);
$text = add_page_info_data($data, $no_photos);
return $text;
}

View File

@ -402,7 +402,7 @@ class Feed {
// We always strip the title since it will be added in the page information
$item["title"] = "";
$item["body"] = $item["body"].add_page_info($item["plink"], false, $preview, ($contact["fetch_further_information"] == 2), $contact["ffi_keyword_blacklist"]);
$item["tag"] = add_page_keywords($item["plink"], false, $preview, ($contact["fetch_further_information"] == 2), $contact["ffi_keyword_blacklist"]);
$item["tag"] = add_page_keywords($item["plink"], $preview, ($contact["fetch_further_information"] == 2), $contact["ffi_keyword_blacklist"]);
$item["object-type"] = ACTIVITY_OBJ_BOOKMARK;
unset($item["attach"]);
} else {
@ -410,7 +410,7 @@ class Feed {
if (!empty($tags)) {
$item["tag"] = $tags;
} else {
$item["tag"] = add_page_keywords($item["plink"], false, $preview, true, $contact["ffi_keyword_blacklist"]);
$item["tag"] = add_page_keywords($item["plink"], $preview, true, $contact["ffi_keyword_blacklist"]);
}
$item["body"] .= "\n".$item['tag'];
}