Merge pull request #5905 from nupplaphil/move_global_functions
Move global functions
This commit is contained in:
commit
07da170bcf
8 changed files with 66 additions and 90 deletions
|
@ -77,7 +77,7 @@ function admin_post(App $a)
|
|||
break;
|
||||
case 'themes':
|
||||
if ($a->argc < 2) {
|
||||
if (is_ajax()) {
|
||||
if ($a->isAjax()) {
|
||||
return;
|
||||
}
|
||||
goaway('admin/');
|
||||
|
@ -107,7 +107,7 @@ function admin_post(App $a)
|
|||
}
|
||||
|
||||
info(L10n::t('Theme settings updated.'));
|
||||
if (is_ajax()) {
|
||||
if ($a->isAjax()) {
|
||||
return;
|
||||
}
|
||||
$return_path = 'admin/themes/' . $theme;
|
||||
|
@ -286,7 +286,7 @@ function admin_content(App $a)
|
|||
$o = admin_page_summary($a);
|
||||
}
|
||||
|
||||
if (is_ajax()) {
|
||||
if ($a->isAjax()) {
|
||||
echo $o;
|
||||
killme();
|
||||
return '';
|
||||
|
@ -2536,7 +2536,7 @@ function admin_page_features_post(App $a)
|
|||
*/
|
||||
function admin_page_features(App $a)
|
||||
{
|
||||
if ((argc() > 1) && (argv(1) === 'features')) {
|
||||
if (($a->argc > 1) && ($a->getArgumentValue(1) === 'features')) {
|
||||
$arr = [];
|
||||
$features = Feature::get(false);
|
||||
|
||||
|
|
|
@ -36,12 +36,12 @@ function help_content(App $a)
|
|||
$path = '';
|
||||
// looping through the argv keys bigger than 0 to build
|
||||
// a path relative to /help
|
||||
for ($x = 1; $x < argc(); $x ++) {
|
||||
for ($x = 1; $x < $a->argc; $x ++) {
|
||||
if (strlen($path)) {
|
||||
$path .= '/';
|
||||
}
|
||||
|
||||
$path .= argv($x);
|
||||
$path .= $a->getArgumentValue($x);
|
||||
}
|
||||
$title = basename($path);
|
||||
$filename = $path;
|
||||
|
|
|
@ -876,13 +876,13 @@ function item_content(App $a)
|
|||
$o = '';
|
||||
|
||||
if (($a->argc == 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) {
|
||||
if (is_ajax()) {
|
||||
if ($a->isAjax()) {
|
||||
$o = Item::deleteForUser(['id' => $a->argv[2]], local_user());
|
||||
} else {
|
||||
$o = drop_item($a->argv[2]);
|
||||
}
|
||||
|
||||
if (is_ajax()) {
|
||||
if ($a->isAjax()) {
|
||||
// ajax return: [<item id>, 0 (no perm) | <owner id>]
|
||||
echo json_encode([intval($a->argv[2]), intval($o)]);
|
||||
killme();
|
||||
|
|
|
@ -26,7 +26,7 @@ function viewsrc_content(App $a)
|
|||
$item = Item::selectFirst(['body'], ['uid' => local_user(), 'id' => $item_id]);
|
||||
|
||||
if (DBA::isResult($item)) {
|
||||
if (is_ajax()) {
|
||||
if ($a->isAjax()) {
|
||||
echo str_replace("\n", '<br />', $item['body']);
|
||||
killme();
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue