Replaced "requestdata"
This commit is contained in:
parent
ab28fa32aa
commit
c9b14b260f
2 changed files with 10 additions and 59 deletions
|
@ -683,23 +683,6 @@ function group_create($name, $uid, $users = [])
|
||||||
return ['success' => true, 'gid' => $gid, 'name' => $name, 'status' => $status, 'wrong users' => $errorusers];
|
return ['success' => true, 'gid' => $gid, 'name' => $name, 'status' => $status, 'wrong users' => $errorusers];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get data from $_POST or $_GET
|
|
||||||
*
|
|
||||||
* @param string $k
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
function requestdata($k)
|
|
||||||
{
|
|
||||||
if (!empty($_POST[$k])) {
|
|
||||||
return $_POST[$k];
|
|
||||||
}
|
|
||||||
if (!empty($_GET[$k])) {
|
|
||||||
return $_GET[$k];
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TWITTER API
|
* TWITTER API
|
||||||
*/
|
*/
|
||||||
|
@ -765,7 +748,7 @@ function api_statuses_mediap($type)
|
||||||
|
|
||||||
$_REQUEST['profile_uid'] = $uid;
|
$_REQUEST['profile_uid'] = $uid;
|
||||||
$_REQUEST['api_source'] = true;
|
$_REQUEST['api_source'] = true;
|
||||||
$txt = requestdata('status') ?? '';
|
$txt = $_REQUEST['status'] ?? '';
|
||||||
|
|
||||||
if ((strpos($txt, '<') !== false) || (strpos($txt, '>') !== false)) {
|
if ((strpos($txt, '<') !== false) || (strpos($txt, '>') !== false)) {
|
||||||
$txt = HTML::toBBCodeVideo($txt);
|
$txt = HTML::toBBCodeVideo($txt);
|
||||||
|
@ -814,8 +797,8 @@ function api_statuses_update($type)
|
||||||
$a = DI::app();
|
$a = DI::app();
|
||||||
|
|
||||||
// convert $_POST array items to the form we use for web posts.
|
// convert $_POST array items to the form we use for web posts.
|
||||||
if (requestdata('htmlstatus')) {
|
if (!empty($_REQUEST['htmlstatus'])) {
|
||||||
$txt = requestdata('htmlstatus') ?? '';
|
$txt = $_REQUEST['htmlstatus'];
|
||||||
if ((strpos($txt, '<') !== false) || (strpos($txt, '>') !== false)) {
|
if ((strpos($txt, '<') !== false) || (strpos($txt, '>') !== false)) {
|
||||||
$txt = HTML::toBBCodeVideo($txt);
|
$txt = HTML::toBBCodeVideo($txt);
|
||||||
|
|
||||||
|
@ -828,12 +811,12 @@ function api_statuses_update($type)
|
||||||
$_REQUEST['body'] = HTML::toBBCode($txt);
|
$_REQUEST['body'] = HTML::toBBCode($txt);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$_REQUEST['body'] = requestdata('status');
|
$_REQUEST['body'] = $_REQUEST['status'] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$_REQUEST['title'] = requestdata('title');
|
$_REQUEST['title'] = $_REQUEST['title'] ?? null;
|
||||||
|
|
||||||
$parent = requestdata('in_reply_to_status_id');
|
$parent = $_REQUEST['in_reply_to_status_id'] ?? null;
|
||||||
|
|
||||||
// Twidere sends "-1" if it is no reply ...
|
// Twidere sends "-1" if it is no reply ...
|
||||||
if ($parent == -1) {
|
if ($parent == -1) {
|
||||||
|
@ -846,8 +829,8 @@ function api_statuses_update($type)
|
||||||
$_REQUEST['parent_uri'] = $parent;
|
$_REQUEST['parent_uri'] = $parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requestdata('lat') && requestdata('long')) {
|
if (!empty($_REQUEST['lat']) && !empty($_REQUEST['long'])) {
|
||||||
$_REQUEST['coord'] = sprintf("%s %s", requestdata('lat'), requestdata('long'));
|
$_REQUEST['coord'] = sprintf("%s %s", $_REQUEST['lat'], $_REQUEST['long']);
|
||||||
}
|
}
|
||||||
$_REQUEST['profile_uid'] = $uid;
|
$_REQUEST['profile_uid'] = $uid;
|
||||||
|
|
||||||
|
@ -896,8 +879,8 @@ function api_statuses_update($type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requestdata('media_ids')) {
|
if (!empty($_REQUEST['media_ids'])) {
|
||||||
$ids = explode(',', requestdata('media_ids') ?? '');
|
$ids = explode(',', $_REQUEST['media_ids']);
|
||||||
} elseif (!empty($_FILES['media'])) {
|
} elseif (!empty($_FILES['media'])) {
|
||||||
// upload the image if we have one
|
// upload the image if we have one
|
||||||
$picture = wall_upload_post($a, false);
|
$picture = wall_upload_post($a, false);
|
||||||
|
|
|
@ -902,38 +902,6 @@ class ApiTest extends FixtureTest
|
||||||
api_account_verify_credentials('json');
|
api_account_verify_credentials('json');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test the requestdata() function.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testRequestdata()
|
|
||||||
{
|
|
||||||
self::assertNull(requestdata('variable_name'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test the requestdata() function with a POST parameter.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testRequestdataWithPost()
|
|
||||||
{
|
|
||||||
$_POST['variable_name'] = 'variable_value';
|
|
||||||
self::assertEquals('variable_value', requestdata('variable_name'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test the requestdata() function with a GET parameter.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testRequestdataWithGet()
|
|
||||||
{
|
|
||||||
$_GET['variable_name'] = 'variable_value';
|
|
||||||
self::assertEquals('variable_value', requestdata('variable_name'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the api_statuses_mediap() function.
|
* Test the api_statuses_mediap() function.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue