Escape global namespaced get_app() calls

- Add deprecated status
This commit is contained in:
Hypolite Petovan 2018-12-27 19:22:35 -05:00
parent b8030313e5
commit 5e1ceb57de
52 changed files with 135 additions and 133 deletions

View file

@ -430,7 +430,7 @@ function api_call(App $a)
*/
function api_error($type, $e)
{
$a = get_app();
$a = \get_app();
$error = ($e->getMessage() !== "" ? $e->getMessage() : $e->httpdesc);
/// @TODO: https://dev.twitter.com/overview/api/response-codes
@ -963,7 +963,7 @@ function api_format_data($root_element, $type, $data)
function api_account_verify_credentials($type)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
@ -1027,7 +1027,7 @@ function requestdata($k)
*/
function api_statuses_mediap($type)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
Logger::log('api_statuses_update: no user');
@ -1075,7 +1075,7 @@ api_register_func('api/statuses/mediap', 'api_statuses_mediap', true, API_METHOD
*/
function api_statuses_update($type)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
Logger::log('api_statuses_update: no user');
@ -1217,7 +1217,7 @@ api_register_func('api/statuses/update_with_media', 'api_statuses_update', true,
*/
function api_media_upload()
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
Logger::log('no user');
@ -1261,7 +1261,7 @@ api_register_func('api/media/upload', 'api_media_upload', true, API_METHOD_POST)
*/
function api_status_show($type, $item_id = 0)
{
$a = get_app();
$a = \get_app();
$user_info = api_get_user($a);
@ -1360,7 +1360,7 @@ function api_status_show($type, $item_id = 0)
*/
function api_users_show($type)
{
$a = get_app();
$a = \get_app();
$user_info = api_get_user($a);
@ -1436,7 +1436,7 @@ api_register_func('api/externalprofile/show', 'api_users_show');
*/
function api_users_search($type)
{
$a = get_app();
$a = \get_app();
$userlist = [];
@ -1516,7 +1516,7 @@ api_register_func('api/users/lookup', 'api_users_lookup', true);
*/
function api_search($type)
{
$a = get_app();
$a = \get_app();
$user_info = api_get_user($a);
if (api_user() === false || $user_info === false) {
@ -1577,7 +1577,7 @@ api_register_func('api/search', 'api_search', true);
*/
function api_statuses_home_timeline($type)
{
$a = get_app();
$a = \get_app();
$user_info = api_get_user($a);
if (api_user() === false || $user_info === false) {
@ -1665,7 +1665,7 @@ api_register_func('api/statuses/friends_timeline', 'api_statuses_home_timeline',
*/
function api_statuses_public_timeline($type)
{
$a = get_app();
$a = \get_app();
$user_info = api_get_user($a);
if (api_user() === false || $user_info === false) {
@ -1747,7 +1747,7 @@ api_register_func('api/statuses/public_timeline', 'api_statuses_public_timeline'
*/
function api_statuses_networkpublic_timeline($type)
{
$a = get_app();
$a = \get_app();
$user_info = api_get_user($a);
if (api_user() === false || $user_info === false) {
@ -1802,7 +1802,7 @@ api_register_func('api/statuses/networkpublic_timeline', 'api_statuses_networkpu
*/
function api_statuses_show($type)
{
$a = get_app();
$a = \get_app();
$user_info = api_get_user($a);
if (api_user() === false || $user_info === false) {
@ -1875,7 +1875,7 @@ api_register_func('api/statuses/show', 'api_statuses_show', true);
*/
function api_conversation_show($type)
{
$a = get_app();
$a = \get_app();
$user_info = api_get_user($a);
if (api_user() === false || $user_info === false) {
@ -1954,7 +1954,7 @@ function api_statuses_repeat($type)
{
global $called_api;
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
@ -2019,7 +2019,7 @@ api_register_func('api/statuses/retweet', 'api_statuses_repeat', true, API_METHO
*/
function api_statuses_destroy($type)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
@ -2060,7 +2060,7 @@ api_register_func('api/statuses/destroy', 'api_statuses_destroy', true, API_METH
*/
function api_statuses_mentions($type)
{
$a = get_app();
$a = \get_app();
$user_info = api_get_user($a);
if (api_user() === false || $user_info === false) {
@ -2128,7 +2128,7 @@ api_register_func('api/statuses/replies', 'api_statuses_mentions', true);
*/
function api_statuses_user_timeline($type)
{
$a = get_app();
$a = \get_app();
$user_info = api_get_user($a);
if (api_user() === false || $user_info === false) {
@ -2206,7 +2206,7 @@ api_register_func('api/statuses/user_timeline', 'api_statuses_user_timeline', tr
*/
function api_favorites_create_destroy($type)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
@ -2284,7 +2284,7 @@ function api_favorites($type)
{
global $called_api;
$a = get_app();
$a = \get_app();
$user_info = api_get_user($a);
if (api_user() === false || $user_info === false) {
@ -2737,7 +2737,7 @@ function api_contactlink_to_array($txt)
*/
function api_format_items_activities($item, $type = "json")
{
$a = get_app();
$a = \get_app();
$activities = [
'like' => [],
@ -2859,7 +2859,7 @@ function api_format_items_profiles($profile_row)
*/
function api_format_items($r, $user_info, $filter_user = false, $type = "json")
{
$a = get_app();
$a = \get_app();
$ret = [];
@ -3049,7 +3049,7 @@ api_register_func('api/lists/subscriptions', 'api_lists_list', true);
*/
function api_lists_ownerships($type)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
@ -3093,7 +3093,7 @@ api_register_func('api/lists/ownerships', 'api_lists_ownerships', true);
*/
function api_lists_statuses($type)
{
$a = get_app();
$a = \get_app();
$user_info = api_get_user($a);
if (api_user() === false || $user_info === false) {
@ -3170,7 +3170,7 @@ api_register_func('api/lists/statuses', 'api_lists_statuses', true);
*/
function api_statuses_f($qtype)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
@ -3346,7 +3346,7 @@ api_register_func('api/friendships/incoming', 'api_friendships_incoming', true);
*/
function api_statusnet_config($type)
{
$a = get_app();
$a = \get_app();
$name = Config::get('config', 'sitename');
$server = $a->getHostName();
@ -3410,7 +3410,7 @@ function api_ff_ids($type)
throw new ForbiddenException();
}
$a = get_app();
$a = \get_app();
api_get_user($a);
@ -3478,7 +3478,7 @@ api_register_func('api/followers/ids', 'api_followers_ids', true);
*/
function api_direct_messages_new($type)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
@ -3566,7 +3566,7 @@ api_register_func('api/direct_messages/new', 'api_direct_messages_new', true, AP
*/
function api_direct_messages_destroy($type)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
@ -3724,7 +3724,7 @@ api_register_func('api/friendships/destroy', 'api_friendships_destroy', true, AP
*/
function api_direct_messages_box($type, $box, $verbose)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
}
@ -4353,7 +4353,7 @@ function api_account_update_profile_image($type)
Contact::updateSelfFromUserID(api_user(), true);
// Update global directory in background
$url = System::baseUrl() . '/profile/' . get_app()->user['nickname'];
$url = System::baseUrl() . '/profile/' . \get_app()->user['nickname'];
if ($url && strlen(Config::get('system', 'directory'))) {
Worker::add(PRIORITY_LOW, "Directory", $url);
}
@ -4668,7 +4668,7 @@ function post_photo_item($hash, $allow_cid, $deny_cid, $allow_gid, $deny_gid, $f
*/
function prepare_photo_data($type, $scale, $photo_id)
{
$a = get_app();
$a = \get_app();
$user_info = api_get_user($a);
if ($user_info === false) {
@ -5209,7 +5209,7 @@ function api_best_nickname(&$contacts)
*/
function api_friendica_group_show($type)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
@ -5274,7 +5274,7 @@ api_register_func('api/friendica/group_show', 'api_friendica_group_show', true);
*/
function api_friendica_group_delete($type)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
@ -5336,7 +5336,7 @@ api_register_func('api/friendica/group_delete', 'api_friendica_group_delete', tr
*/
function api_lists_destroy($type)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
@ -5452,7 +5452,7 @@ function group_create($name, $uid, $users = [])
*/
function api_friendica_group_create($type)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
@ -5481,7 +5481,7 @@ api_register_func('api/friendica/group_create', 'api_friendica_group_create', tr
*/
function api_lists_create($type)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
@ -5515,7 +5515,7 @@ api_register_func('api/lists/create', 'api_lists_create', true, API_METHOD_POST)
*/
function api_friendica_group_update($type)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
@ -5589,7 +5589,7 @@ api_register_func('api/friendica/group_update', 'api_friendica_group_update', tr
*/
function api_lists_update($type)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
@ -5635,7 +5635,7 @@ api_register_func('api/lists/update', 'api_lists_update', true, API_METHOD_POST)
*/
function api_friendica_activity($type)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
@ -5679,7 +5679,7 @@ api_register_func('api/friendica/activity/unattendmaybe', 'api_friendica_activit
*/
function api_friendica_notification($type)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
@ -5715,7 +5715,7 @@ function api_friendica_notification($type)
*/
function api_friendica_notification_seen($type)
{
$a = get_app();
$a = \get_app();
$user_info = api_get_user($a);
if (api_user() === false || $user_info === false) {
@ -5760,7 +5760,7 @@ api_register_func('api/friendica/notification', 'api_friendica_notification', tr
*/
function api_friendica_direct_messages_setseen($type)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
}
@ -5809,7 +5809,7 @@ api_register_func('api/friendica/direct_messages_setseen', 'api_friendica_direct
*/
function api_friendica_direct_messages_search($type, $box = "")
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();
@ -5872,7 +5872,7 @@ api_register_func('api/friendica/direct_messages_search', 'api_friendica_direct_
*/
function api_friendica_profile_show($type)
{
$a = get_app();
$a = \get_app();
if (api_user() === false) {
throw new ForbiddenException();