// 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
function api_search($type)
{
$data = [];
+ $sql_extra = '';
if (!x($_REQUEST, 'q')) {
throw new BadRequestException("q parameter is required.");
$conversation_id = (x($_REQUEST, 'conversation_id') ? $_REQUEST['conversation_id'] : 0);
$start = $page * $count;
+ $sql_extra = '';
if ($exclude_replies && !$conversation_id) {
if ($max_id > 0) {
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)
);
$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(
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");
];
} else {
$res = [
- 'name' => $text,
+ 'name' => $txt,
'url' => ""
];
}
throw new ForbiddenException();
}
+ $a = get_app();
+
api_get_user($a);
$stringify_ids = defaults($_REQUEST, 'stringify_ids', false);
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);
// pagination
$start = $page * $count;
+ $sql_extra = "";
+
// filters
if ($box=="sentbox") {
$sql_extra = "`mail`.`from-url`='" . dbesc($profile_url) . "'";
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);
{
$best_contact = [];
- if (count($contact) == 0) {
+ if (count($contacts) == 0) {
return;
}
* @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();
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,
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);
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"])) {
}
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;
}
// 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 {
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'];
}