Skip to content

Commit 637bab3

Browse files
author
Till Brehm
committed
Cleaned up FAQ module files to use global auth function instead of repeating the code in each file.
1 parent 96b7d78 commit 637bab3

File tree

7 files changed

+8
-26
lines changed

7 files changed

+8
-26
lines changed

interface/web/help/faq_delete.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
require_once '../../lib/app.inc.php';
1010

1111
// Check module permissions
12-
if(!stristr($_SESSION['s']['user']['modules'], 'help')) {
13-
header('Location: ../index.php');
14-
die;
15-
}
12+
$app->auth->check_module_permissions('admin');
1613

1714
// Load the form
1815
$app->uses('tform_actions');

interface/web/help/faq_edit.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
require_once '../../lib/app.inc.php';
99

1010
// Check the module permissions and redirect if not allowed.
11-
if(!stristr($_SESSION['s']['user']['modules'], 'help')) {
12-
header('Location: ../index.php');
13-
die;
14-
}
11+
$app->auth->check_module_permissions('admin');
1512

1613
// Load the templating and form classes
1714
$app->uses('tpl,tform,tform_actions');

interface/web/help/faq_list.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
$list_def_file = 'list/faq_list.php';
88

99
// Check the module permissions
10-
if(!stristr($_SESSION['s']['user']['modules'], 'help')) {
11-
header('Location: ../index.php');
12-
die();
13-
}
10+
$app->auth->check_module_permissions('help');
1411

1512
// Loading the class
1613
$app->uses('listform_actions');
@@ -31,7 +28,7 @@
3128

3229
if($hf_section) $res = $app->db->queryOneRecord("SELECT hfs_name FROM help_faq_sections WHERE hfs_id=?", $hf_section);
3330
// Start the form rendering and action ahndling
34-
echo "<h2>FAQ: ".$res['hfs_name']."</h2>";
31+
echo "<h2>FAQ: ".$app->functions->htmlentities($res['hfs_name'])."</h2>";
3532
if($hf_section) $app->listform_actions->onLoad();
3633

3734
?>

interface/web/help/faq_manage_questions_list.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
$list_def_file = "list/faq_manage_questions_list.php";
77

88
//* Check permissions for module
9-
$app->auth->check_module_permissions('help');
9+
$app->auth->check_module_permissions('admin');
1010

1111
//* Loading the class
1212
$app->uses('listform_actions');

interface/web/help/faq_sections_delete.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
require_once '../../lib/app.inc.php';
1010

1111
// Check module permissions
12-
if(!stristr($_SESSION['s']['user']['modules'], 'help')) {
13-
header('Location: ../index.php');
14-
die;
15-
}
12+
$app->auth->check_module_permissions('admin');
1613

1714
// Load the form
1815
$app->uses('tform_actions');

interface/web/help/faq_sections_edit.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
require_once '../../lib/app.inc.php';
99

1010
// Check the module permissions and redirect if not allowed.
11-
if(!stristr($_SESSION['s']['user']['modules'], 'help')) {
12-
header('Location: ../index.php');
13-
die;
14-
}
11+
$app->auth->check_module_permissions('admin');
1512

1613
// Load the templating and form classes
1714
$app->uses('tpl,tform,tform_actions');

interface/web/help/faq_sections_list.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
$list_def_file = 'list/faq_sections_list.php';
88

99
// Check the module permissions
10-
if(!stristr($_SESSION['s']['user']['modules'], 'help')) {
11-
header('Location: ../index.php');
12-
die();
13-
}
10+
$app->auth->check_module_permissions('admin');
1411

1512
// Loading the class
1613
$app->uses('listform_actions');

0 commit comments

Comments
 (0)