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
*/
$_REQUEST['profile_uid'] = $uid;
$_REQUEST['api_source'] = true;
- $txt = requestdata('status') ?? '';
+ $txt = $_REQUEST['status'] ?? '';
if ((strpos($txt, '<') !== false) || (strpos($txt, '>') !== false)) {
$txt = HTML::toBBCodeVideo($txt);
$a = DI::app();
// convert $_POST array items to the form we use for web posts.
- if (requestdata('htmlstatus')) {
- $txt = requestdata('htmlstatus') ?? '';
+ if (!empty($_REQUEST['htmlstatus'])) {
+ $txt = $_REQUEST['htmlstatus'];
if ((strpos($txt, '<') !== false) || (strpos($txt, '>') !== false)) {
$txt = HTML::toBBCodeVideo($txt);
$_REQUEST['body'] = HTML::toBBCode($txt);
}
} 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 ...
if ($parent == -1) {
$_REQUEST['parent_uri'] = $parent;
}
- if (requestdata('lat') && requestdata('long')) {
- $_REQUEST['coord'] = sprintf("%s %s", requestdata('lat'), requestdata('long'));
+ if (!empty($_REQUEST['lat']) && !empty($_REQUEST['long'])) {
+ $_REQUEST['coord'] = sprintf("%s %s", $_REQUEST['lat'], $_REQUEST['long']);
}
$_REQUEST['profile_uid'] = $uid;
}
}
- if (requestdata('media_ids')) {
- $ids = explode(',', requestdata('media_ids') ?? '');
+ if (!empty($_REQUEST['media_ids'])) {
+ $ids = explode(',', $_REQUEST['media_ids']);
} elseif (!empty($_FILES['media'])) {
// upload the image if we have one
$picture = wall_upload_post($a, false);
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.
*