CMS
Version 3.9
redirect_form.inc
Go to the documentation of this file.
1
<?php
2
Fakoli::using
(
"redirect"
);
3
4
$menu_item
=
"Redirects"
;
5
6
$redirect_id
= checkNumeric($_GET[
"redirect_id"
]);
7
8
$redirect
=
new
Redirect
();
9
10
if
(
$redirect_id
)
11
{
12
$redirect
->load(
$redirect_id
);
13
}
14
15
$form
=
new
AutoForm(
$redirect
);
16
17
$form
->hide(
"user_id"
);
18
$form
->required(
"redirect_from"
,
"redirect_to"
);
19
$form
->allowDelete =
true
;
20
$form
->annotate(
"exemption_flag"
,
"Specifies the name of a flag that can be set on a user's session to exempt them from the redirect"
);
21
$roleSelect
=
new
CheckListFieldRenderer(
$form
,
"exempt_roles"
,
"Exempt Roles"
,
SiteRole::getRolesArray
());
22
$roleSelect
->setSize(350, 150, 10);
23
24
$form
->group(
"Redirect Settings"
,
"redirect_from"
,
"redirect_to"
,
"user_id"
,
"active"
,
"override"
,
"preserve_query_string"
);
25
$form
->group(
"Exemptions"
,
"exemption_flag"
,
"exempt_roles"
);
26
$form
->makeGroupCollapsible(
"Exemptions"
,
"override"
);
27
28
if
(
$method
==
"POST"
)
29
{
30
$_POST
[
"user_id"
] =
$user
->user_id;
31
if
(
$form
->save())
32
{
33
Fakoli::notifyOnNextPage
(
$form
->deleted ?
"Redirect remoted"
:
"Redirect added"
);
34
Cache::invalidate(
"resource_overrides"
);
35
redirect(
"/admin/redirects"
);
36
}
37
}
38
39
$script
.=
$form
->writeScript();
40
$form
->drawForm();
$_POST
$_POST["owner_id"]
Definition:
blog_form.inc:54
Fakoli\notifyOnNextPage
static notifyOnNextPage($message, $blocking=false, $button="OK", $onClick="null")
Schedules a notification message to be displayed to the user at the next full page load.
Definition:
core.inc:1223
Fakoli\using
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition:
core.inc:116
Redirect
Definition:
redirect.inc:8
SiteRole\getRolesArray
static getRolesArray()
Retrieves the array of roles and their names for the current site for use in a CMS form.
Definition:
role.inc:75
$user
global $user
Definition:
comment_form.inc:16
$method
$method
Pull out a simple reference to the request method.
Definition:
core.inc:1573
$form
if($redirect_id) $form
Definition:
redirect_form.inc:15
$redirect_id
$redirect_id
Definition:
redirect_form.inc:6
$roleSelect
$roleSelect
Definition:
redirect_form.inc:21
$redirect
$redirect
Definition:
redirect_form.inc:8
$menu_item
$menu_item
Definition:
redirect_form.inc:4
$script
if($method=="POST") $script
Definition:
redirect_form.inc:39
code
cms.sonjara.com
cms
components
redirect
admin
redirect_form.inc
Generated on Tue Mar 23 2021 15:36:14 for CMS by
1.9.1