Emoji picker, Search and Themes updates

This commit is contained in:
Daisuke
2020-04-13 11:30:51 -05:00
parent cf0ba1244d
commit 299c58692e
120 changed files with 224 additions and 9206 deletions

View File

@ -86,14 +86,14 @@ function emoji_list($val){
}
function starts_with($string,$search){
if (substr($string,0,strlen($search)) == $search){
if (substr(strtolower($string),0,strlen($search)) == strtolower($search)){
return true;
}
return false;
}
function contains($string,$search){
if (is_numeric(strpos($string,$search))){
if (is_numeric(strpos(strtolower($string),strtolower($search)))){
return true;
}
return false;
@ -147,6 +147,24 @@ function user_info($user) {
);
}
function api_getv2($url) {
global $srv;
global $token;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://$srv/api/v2/" . $url);
if (!is_null($token)) {
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer ' . $token
));
}
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
return json_decode($result, true);
}
/* a function to make an authenticated general GET api call to the logged-in instance */
function api_get($url) {
@ -742,6 +760,10 @@ function timeline($query) {
case "bookmarks":
$array = api_get("bookmarks?limit=25{$next}");
break;
case "search":
$array = api_getv2("search?limit=40&q=".$query['search']."{$next}")['statuses'];
break;
case "account":
$info = api_get("accounts/verify_credentials");
@ -859,14 +881,18 @@ function themes($mode,$name = false){
case "file":
$theme = sanitize($user_settings['theme']);
//if (file_exists("themes/$theme/$name")){
if (file_exists("themes/$theme/$name")){
return "themes/$theme/$name";
//}
} else {
return "$name";
}
case "get":
$theme = sanitize($user_settings['theme']);
//if (file_exists("themes/$theme/$name")){
if (file_exists("themes/$theme/$name")){
return file_get_contents("themes/$theme/$name");
//}
} else {
return file_get_contents("$name");
}
}
}
}