Completed
Push — master ( 26776f...d9604e )
by Michael
11:31
created

notifications.php ➔ modifyEmlTpl()   F

Complexity

Conditions 20
Paths 4920

Size

Total Lines 172
Code Lines 127

Duplication

Lines 5
Ratio 2.91 %

Importance

Changes 0
Metric Value
cc 20
eloc 127
nc 4920
nop 0
dl 5
loc 172
rs 2
c 0
b 0
f 0

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 76 and the first side effect is on line 3.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
//$Id: notifications.php,v 1.7 2005/12/02 15:52:21 eric_juden Exp $
3
include('../../../include/cp_header.php');
4
include_once('admin_header.php');
5
require_once(XHELP_CLASS_PATH.'/session.php');
6
$_xhelpSession = new Session();
7
$hNotification =& xhelpGetHandler('notification');
8
9
global $xoopsModule;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
10 View Code Duplication
if(!$templates =& $_xhelpSession->get("xhelp_notifications")){
11
    $templates =& $xoopsModule->getInfo('_email_tpl');
12
    $_xhelpSession->set("xhelp_notifications", $templates);
13
}
14
$has_notifications = count($templates);
15
16
$aStaffSettings = array('2' => _AM_XHELP_STAFF_SETTING2, // '1' => _AM_XHELP_STAFF_SETTING1, -- removed because we don't need it
17
                            '3' => _AM_XHELP_STAFF_SETTING3, '4' => _AM_XHELP_STAFF_SETTING4);
18
$aUserSettings = array('1' => _AM_XHELP_USER_SETTING1, '2' => _AM_XHELP_USER_SETTING2);
19
20
// Also in profile.php
21
$aNotifications = array(XHELP_NOTIF_NEWTICKET => array(
22
                                     'name' => _AM_XHELP_NOTIF_NEW_TICKET,
23
                                     'email_tpl' => array('1'=>$templates[1],
24
                                                          '18'=>$templates[18], '20'=>$templates[20], '21'=>$templates[21],
25
                                                          '22'=>$templates[22], '23'=>$templates[23], '24'=>$templates[24])),
26
XHELP_NOTIF_DELTICKET => array(
27
                                     'name' => _AM_XHELP_NOTIF_DEL_TICKET,
28
                                     'email_tpl' => array('2'=>$templates[2], '12'=>$templates[12])),
29
XHELP_NOTIF_EDITTICKET => array(
30
                                     'name' => _AM_XHELP_NOTIF_MOD_TICKET,
31
                                     'email_tpl' => array('3'=>$templates[3], '13'=>$templates[13])),
32
XHELP_NOTIF_NEWRESPONSE => array(
33
                                     'name' => _AM_XHELP_NOTIF_NEW_RESPONSE,
34
                                     'email_tpl' => array('4'=>$templates[4], '14'=>$templates[14])),
35
XHELP_NOTIF_EDITRESPONSE => array(
36
                                     'name' => _AM_XHELP_NOTIF_MOD_RESPONSE,
37
                                     'email_tpl' => array('5'=>$templates[5], '15'=>$templates[15])),
38
XHELP_NOTIF_EDITSTATUS => array(
39
                                     'name' => _AM_XHELP_NOTIF_MOD_STATUS,
40
                                     'email_tpl' => array('6'=>$templates[6], '16'=>$templates[16])),
41
XHELP_NOTIF_EDITPRIORITY => array(
42
                                     'name' => _AM_XHELP_NOTIF_MOD_PRIORITY,
43
                                     'email_tpl' => array('7'=>$templates[7], '17'=>$templates[17])),
44
XHELP_NOTIF_EDITOWNER => array(
45
                                     'name' => _AM_XHELP_NOTIF_MOD_OWNER,
46
                                     'email_tpl' => array('8'=>$templates[8], '11'=>$templates[11])),
47
XHELP_NOTIF_CLOSETICKET => array(
48
                                     'name' => _AM_XHELP_NOTIF_CLOSE_TICKET,
49
                                     'email_tpl' => array('9'=>$templates[9], '19'=>$templates[19])),
50
XHELP_NOTIF_MERGETICKET => array(
51
                                     'name' => _AM_XHELP_NOTIF_MERGE_TICKET,
52
                                     'email_tpl' => array('10'=>$templates[10], '25'=>$templates[25])));
53
54
$op = 'default';
55
if (isset($_REQUEST['op'])){
56
    $op = $_REQUEST['op'];
57
}
58
59
switch($op){
60
    case "edit":
61
        edit();
62
        break;
63
64
    case "manage":
65
        manage();
66
        break;
67
68
    case "modifyEmlTpl":
69
        modifyEmlTpl();
70
        break;
71
72
    Default:
0 ignored issues
show
Coding Style introduced by
DEFAULT keyword must be lowercase; expected "default" but found "Default"

As per the PSR-2 coding standard,the default keyword must be written in lower case.

switch ($expr) {
    DEFAULT: { //wrong
        doSomething();
        break;
    }
}

switch ($expr) {
    default: //right
        doSomething();
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
73
        manage();
74
}
75
76
function edit()
0 ignored issues
show
Coding Style introduced by
edit uses the super-global variable $_REQUEST which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
Coding Style introduced by
edit uses the super-global variable $_SERVER which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
Coding Style introduced by
edit uses the super-global variable $_POST which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
Best Practice introduced by
The function edit() has been defined more than once; this definition is ignored, only the first definition in admin/mimetypes.php (L226-362) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
77
{
78
    global $xoopsModule, $_xhelpSession, $aNotifications, $has_notifications, $aStaffSettings,
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
79
    $aUserSettings, $hNotification;
80
81
    if(isset($_REQUEST['id'])){
82
        $id = intval($_REQUEST['id']);
83
    } else {
84
        // No id specified, return to manage page
85
        redirect_header(XHELP_ADMIN_URL."/notifications.php?op=manage", 3, _AM_XHELP_MESSAGE_NO_ID);
86
    }
87
88
    $settings =& $hNotification->get($id);
0 ignored issues
show
Bug introduced by
The variable $id does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
89
90
    xoops_cp_header();
91
    //echo $oAdminButton->renderButtons('manNotify');
92
    $indexAdmin = new ModuleAdmin();
93
    echo $indexAdmin->addNavigation('notifications.php');
94
95
    $_xhelpSession->set("xhelp_return_page", substr(strstr($_SERVER['REQUEST_URI'], 'admin/'), 6));
96
97
    if(isset($_POST['save_notification'])){
98
        $settings->setVar('staff_setting', intval($_POST['staff_setting']));
99
        $settings->setVar('user_setting', intval($_POST['user_setting']));
100
        if($_POST['staff_setting'] == XHELP_NOTIF_STAFF_DEPT){
101
            $settings->setVar('staff_options', $_POST['roles']);
102
        } else {
103
            $settings->setVar('staff_options', array());
104
        }
105
        $hNotification->insert($settings, true);
106
        header("Location: ".XHELP_ADMIN_URL."/notifications.php?op=edit&id=$id");
107
    }
108
109
    // Retrieve list of email templates
110 View Code Duplication
    if(!$templates =& $_xhelpSession->get("xhelp_notifications")){
111
        $templates =& $xoopsModule->getInfo('_email_tpl');
112
        $_xhelpSession->set("xhelp_notifications", $templates);
113
    }
114
    $notification = $aNotifications[$id];
115
116
    $staff_settings = xhelpGetMeta("notify_staff{$id}");
0 ignored issues
show
Unused Code introduced by
$staff_settings is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
117
    $user_settings = xhelpGetMeta("notify_user{$id}");
0 ignored issues
show
Unused Code introduced by
$user_settings is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
118
    $hRoles =& xhelpGetHandler('role');
119
    if($settings->getVar('staff_setting') == XHELP_NOTIF_STAFF_DEPT){
120
        $selectedRoles = $settings->getVar('staff_options');
121
    } else {
122
        $selectedRoles = array();
123
    }
124
    $roles =& $hRoles->getObjects();
125
126
    echo "<form method='post' action='".XHELP_ADMIN_URL."/notifications.php?op=edit&amp;id=".$id."'>";
127
    echo "<table width='100%' cellspacing='1' class='outer'>";
128
    echo "<tr><th colspan='2'>".$notification['name']."</th></tr>";
129
    echo "<tr><td class='head' width='20%'>"._AM_XHELP_TEXT_NOTIF_STAFF."</td>
130
              <td class='even' valign='top'>";
131
    echo "<table border='0'>";
132
    echo "<tr>";
133
    foreach($aStaffSettings as $value=>$setting){
134
        echo "<td valign='top'>";
135
        if($settings->getVar('staff_setting') == $value){
136
            $checked = "checked='checked'";
137
        } else {
138
            $checked = '';
139
        }
140
        echo "<input type='radio' name='staff_setting' id='staff".$value."' value='".$value."' $checked />
141
                          <label for='staff".$value."'>".$setting."</label>&nbsp;";
142
        if($value == XHELP_NOTIF_STAFF_DEPT){
143
            echo "<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
144
                        <select name='roles[]' multiple='multiple'>";
145
            foreach($roles as $role){
146
                $role_id = $role->getVar('id');
147
                if(in_array($role_id, $selectedRoles)){
148
                    echo "<option value='".$role_id."' selected='selected'>".$role->getVar('name')."</option>";
149
                } else {
150
                    echo "<option value='".$role_id."'>".$role->getVar('name')."</option>";
151
                }
152
            }
153
            echo "</select>";
154
        }
155
        echo "</td>";
156
    }
157
    echo "</tr></table>";
158
    echo "</td>
159
          </tr>";
160
    echo "<tr><td class='head' width='20%'>"._AM_XHELP_TEXT_NOTIF_USER."</td>
161
              <td class='even'>";
162
    foreach($aUserSettings as $value=>$setting){
163
        if($settings->getVar('user_setting') == $value){
164
            $checked = "checked='checked'";
165
        } else {
166
            $checked = '';
167
        }
168
        echo "<input type='radio' name='user_setting' id='user".$value."' value='".$value."' $checked />
169
                          <label for='user".$value."'>".$setting."</label>&nbsp;";
170
    }
171
    echo "</td>
172
          </tr>";
173
    echo "<tr>
174
              <td class='head'></td>
175
              <td class='even'><input type='submit' name='save_notification' value='"._AM_XHELP_BUTTON_SUBMIT."' /></td>
176
          </tr>";
177
    echo "</table></form><br />";
178
179
    echo "<table width='100%' cellspacing='1' class='outer'>";
180
    echo "<tr><th colspan='3'>"._AM_XHELP_TEXT_ASSOC_TPL."</th></tr>";
181
    echo "<tr class='head'><td>"._AM_XHELP_TEXT_TEMPLATE_NAME."</td>
182
                           <td>"._AM_XHELP_TEXT_DESCRIPTION."</td>
183
                           <td>"._AM_XHELP_TEXT_ACTIONS."</td></tr>";
184
    foreach($notification['email_tpl'] as $template){
185
        echo "<tr class='even'>
186
                  <td>".$template['title']."</a></td><td>".$template['description']."</td>
187
                  <td><a href='".XHELP_ADMIN_URL."/notifications.php?op=modifyEmlTpl&amp;file=".$template['mail_template'].".tpl'>
188
                      <img src='".XOOPS_URL."/modules/xhelp/images/button_edit.png' title='"._AM_XHELP_TEXT_EDIT."' name='editNotification' /></a>
189
                  </td>
190
              </tr>";
191
    }
192
    echo "</table>";
193
194
    xoops_cp_footer();
195
}
196
197
function manage()
0 ignored issues
show
Best Practice introduced by
The function manage() has been defined more than once; this definition is ignored, only the first definition in admin/faqAdapter.php (L29-86) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
198
{
199
    global $xoopsModule, $_xhelpSession, $aNotifications, $has_notifications, $xoopsDB, $aStaffSettings,
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
200
    $aUserSettings, $hNotification;
201
202
    xoops_cp_header();
203
    //echo $oAdminButton->renderButtons('manNotify');
204
    $indexAdmin = new ModuleAdmin();
205
    echo $indexAdmin->addNavigation('notifications.php');
206
207
    $settings =& $hNotification->getObjects(null, true);
208
209
    echo "<table width='100%' cellspacing='1' class='outer'>";
210
    echo "<tr><th colspan='3'>"._AM_XHELP_TEXT_MANAGE_NOTIFICATIONS."</th></tr>";
211
    if($has_notifications){
212
        echo "<tr class='head'>
213
                  <td>"._AM_XHELP_TEXT_NOTIF_NAME."</td>
214
                  <td>"._AM_XHELP_TEXT_SUBSCRIBED_MEMBERS."</td>
215
                  <td>"._AM_XHELP_TEXT_ACTIONS."</td>
216
              </tr>";
217
        foreach($aNotifications as $template_id=>$template){
218
            $cSettings = $settings[$template_id];
219
            $staff_setting = $cSettings->getVar('staff_setting');
220
            $user_setting = $cSettings->getVar('user_setting');
221
222
            // Build text of who gets notification
223
            if($user_setting == XHELP_NOTIF_USER_YES){
224
                if($staff_setting == XHELP_NOTIF_STAFF_NONE){
225
                    $sSettings = _AM_XHELP_TEXT_SUBMITTER;
226
                } else {
227
                    $sSettings = $aStaffSettings[$staff_setting]." "._AM_XHELP_TEXT_AND." "._AM_XHELP_TEXT_SUBMITTER;
228
                }
229
            } else {
230
                if($staff_setting == XHELP_NOTIF_STAFF_NONE){
231
                    $sSettings = '';
232
                } else {
233
                    $sSettings = $aStaffSettings[$staff_setting];
234
                }
235
            }
236
            // End Build text of who gets notification
237
238
            echo "<tr class='even'>
239
                     <td width='20%'>".$template['name']."</td>
240
                     <td>".$sSettings."</td>
241
                     <td>
242
                         <a href='notifications.php?op=edit&amp;id=".$template_id."'><img src='".XOOPS_URL."/modules/xhelp/images/button_edit.png' title='"._AM_XHELP_TEXT_EDIT."' name='editNotification' /></a>
243
                     </td>
244
                  </tr>";
245
        }
246
    } else {
247
        // No notifications found (Should never happen)
248
        echo "<tr><td class='even' colspan='3'>"._AM_XHELP_TEXT_NO_RECORDS."</td></tr>";
249
    }
250
    echo "</table>";
251
252
    xoops_cp_footer();
253
}
254
255
function modifyEmlTpl()
0 ignored issues
show
Coding Style introduced by
modifyEmlTpl uses the super-global variable $_GET which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
Coding Style introduced by
modifyEmlTpl uses the super-global variable $_POST which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
256
{
257
    global $xoopsConfig, $_xhelpSession;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
258
259
    if (is_dir(XOOPS_ROOT_PATH.'/modules/xhelp/language/'.$xoopsConfig['language'].'/mail_template')) {
260
        $opendir = opendir(XOOPS_ROOT_PATH.'/modules/xhelp/language/'.$xoopsConfig['language'].'/mail_template/');
261
        $dir = XOOPS_ROOT_PATH.'/modules/xhelp/language/'.$xoopsConfig['language'].'/mail_template/';
262
        $url = XOOPS_URL.'/modules/xhelp/language/'.$xoopsConfig['language'].'/mail_template/';
0 ignored issues
show
Unused Code introduced by
$url is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
263
    } else {
264
        $opendir = opendir(XOOPS_ROOT_PATH.'/modules/xhelp/language/english/mail_template/');
265
        $dir = XOOPS_ROOT_PATH.'/modules/xhelp/language/english/mail_template/';
266
        $url = XOOPS_URL.'/modules/xhelp/language/english/mail_template/';
0 ignored issues
show
Unused Code introduced by
$url is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
267
    }
268
269
    $notNames = array(
270
    _MI_XHELP_DEPT_NEWTICKET_NOTIFYTPL => array(_MI_XHELP_DEPT_NEWTICKET_NOTIFY, _MI_XHELP_DEPT_NEWTICKET_NOTIFYDSC, _MI_XHELP_DEPT_NEWTICKET_NOTIFYTPL),
271
    _MI_XHELP_DEPT_REMOVEDTICKET_NOTIFYTPL => array(_MI_XHELP_DEPT_REMOVEDTICKET_NOTIFY, _MI_XHELP_DEPT_REMOVEDTICKET_NOTIFYDSC, _MI_XHELP_DEPT_REMOVEDTICKET_NOTIFYTPL),
272
    _MI_XHELP_DEPT_NEWRESPONSE_NOTIFYTPL => array(_MI_XHELP_DEPT_NEWRESPONSE_NOTIFY, _MI_XHELP_DEPT_NEWRESPONSE_NOTIFYDSC, _MI_XHELP_DEPT_NEWRESPONSE_NOTIFYTPL),
273
    _MI_XHELP_DEPT_MODIFIEDRESPONSE_NOTIFYTPL => array(_MI_XHELP_DEPT_MODIFIEDRESPONSE_NOTIFY, _MI_XHELP_DEPT_MODIFIEDRESPONSE_NOTIFYDSC, _MI_XHELP_DEPT_MODIFIEDRESPONSE_NOTIFYTPL),
274
    _MI_XHELP_DEPT_MODIFIEDTICKET_NOTIFYTPL => array(_MI_XHELP_DEPT_MODIFIEDTICKET_NOTIFY, _MI_XHELP_DEPT_MODIFIEDTICKET_NOTIFYDSC, _MI_XHELP_DEPT_MODIFIEDTICKET_NOTIFYTPL),
275
    _MI_XHELP_DEPT_CHANGEDSTATUS_NOTIFYTPL => array(_MI_XHELP_DEPT_CHANGEDSTATUS_NOTIFY, _MI_XHELP_DEPT_CHANGEDSTATUS_NOTIFYDSC, _MI_XHELP_DEPT_CHANGEDSTATUS_NOTIFYTPL),
276
    _MI_XHELP_DEPT_CHANGEDPRIORITY_NOTIFYTPL => array(_MI_XHELP_DEPT_CHANGEDPRIORITY_NOTIFY, _MI_XHELP_DEPT_CHANGEDPRIORITY_NOTIFYDSC, _MI_XHELP_DEPT_CHANGEDPRIORITY_NOTIFYTPL),
277
    _MI_XHELP_DEPT_NEWOWNER_NOTIFYTPL => array(_MI_XHELP_DEPT_NEWOWNER_NOTIFY, _MI_XHELP_DEPT_NEWOWNER_NOTIFYDSC, _MI_XHELP_DEPT_NEWOWNER_NOTIFYTPL),
278
    _MI_XHELP_DEPT_CLOSETICKET_NOTIFYTPL => array(_MI_XHELP_DEPT_CLOSETICKET_NOTIFY, _MI_XHELP_DEPT_CLOSETICKET_NOTIFYDSC, _MI_XHELP_DEPT_CLOSETICKET_NOTIFYTPL),
279
    _MI_XHELP_TICKET_NEWOWNER_NOTIFYTPL => array(_MI_XHELP_TICKET_NEWOWNER_NOTIFY, _MI_XHELP_TICKET_NEWOWNER_NOTIFYDSC, _MI_XHELP_TICKET_NEWOWNER_NOTIFYTPL),
280
    _MI_XHELP_TICKET_REMOVEDTICKET_NOTIFYTPL => array(_MI_XHELP_TICKET_REMOVEDTICKET_NOTIFY, _MI_XHELP_TICKET_REMOVEDTICKET_NOTIFYDSC, _MI_XHELP_TICKET_REMOVEDTICKET_NOTIFYTPL),
281
    _MI_XHELP_TICKET_MODIFIEDTICKET_NOTIFYTPL => array(_MI_XHELP_TICKET_MODIFIEDTICKET_NOTIFY, _MI_XHELP_TICKET_MODIFIEDTICKET_NOTIFYDSC, _MI_XHELP_TICKET_MODIFIEDTICKET_NOTIFYTPL),
282
    _MI_XHELP_TICKET_NEWRESPONSE_NOTIFYTPL => array(_MI_XHELP_TICKET_NEWRESPONSE_NOTIFY, _MI_XHELP_TICKET_NEWRESPONSE_NOTIFYDSC, _MI_XHELP_TICKET_NEWRESPONSE_NOTIFYTPL),
283
    _MI_XHELP_TICKET_MODIFIEDRESPONSE_NOTIFYTPL => array(_MI_XHELP_TICKET_MODIFIEDRESPONSE_NOTIFY, _MI_XHELP_TICKET_MODIFIEDRESPONSE_NOTIFYDSC, _MI_XHELP_TICKET_MODIFIEDRESPONSE_NOTIFYTPL),
284
    _MI_XHELP_TICKET_CHANGEDSTATUS_NOTIFYTPL => array(_MI_XHELP_TICKET_CHANGEDSTATUS_NOTIFY, _MI_XHELP_TICKET_CHANGEDSTATUS_NOTIFYDSC, _MI_XHELP_TICKET_CHANGEDSTATUS_NOTIFYTPL),
285
    _MI_XHELP_TICKET_CHANGEDPRIORITY_NOTIFYTPL => array(_MI_XHELP_TICKET_CHANGEDPRIORITY_NOTIFY, _MI_XHELP_TICKET_CHANGEDPRIORITY_NOTIFYDSC, _MI_XHELP_TICKET_CHANGEDPRIORITY_NOTIFYTPL),
286
    _MI_XHELP_TICKET_NEWTICKET_NOTIFYTPL => array(_MI_XHELP_TICKET_NEWTICKET_NOTIFY, _MI_XHELP_TICKET_NEWTICKET_NOTIFYDSC, _MI_XHELP_TICKET_NEWTICKET_NOTIFYTPL),
287
    _MI_XHELP_TICKET_NEWTICKET_EMAIL_NOTIFYTPL => array(_MI_XHELP_TICKET_NEWTICKET_EMAIL_NOTIFY, _MI_XHELP_TICKET_NEWTICKET_EMAIL_NOTIFYDSC, _MI_XHELP_TICKET_NEWTICKET_EMAIL_NOTIFYTPL),
288
    _MI_XHELP_TICKET_CLOSETICKET_NOTIFYTPL => array(_MI_XHELP_TICKET_CLOSETICKET_NOTIFY, _MI_XHELP_TICKET_CLOSETICKET_NOTIFYDSC, _MI_XHELP_TICKET_CLOSETICKET_NOTIFYTPL),
289
    _MI_XHELP_TICKET_NEWUSER_NOTIFYTPL => array(_MI_XHELP_TICKET_NEWUSER_NOTIFY, _MI_XHELP_TICKET_NEWUSER_NOTIFYDSC, _MI_XHELP_TICKET_NEWUSER_NOTIFYTPL),
290
    _MI_XHELP_TICKET_NEWUSER_ACT1_NOTIFYTPL => array(_MI_XHELP_TICKET_NEWUSER_ACT1_NOTIFY, _MI_XHELP_TICKET_NEWUSER_ACT1_NOTIFYDSC, _MI_XHELP_TICKET_NEWUSER_ACT1_NOTIFYTPL),
291
    _MI_XHELP_TICKET_NEWUSER_ACT2_NOTIFYTPL => array(_MI_XHELP_TICKET_NEWUSER_ACT2_NOTIFY, _MI_XHELP_TICKET_NEWUSER_ACT2_NOTIFYDSC, _MI_XHELP_TICKET_NEWUSER_ACT2_NOTIFYTPL),
292
    _MI_XHELP_TICKET_EMAIL_ERROR_NOTIFYTPL => array(_MI_XHELP_TICKET_EMAIL_ERROR_NOTIFY, _MI_XHELP_TICKET_EMAIL_ERROR_NOTIFYDSC, _MI_XHELP_TICKET_EMAIL_ERROR_NOTIFYTPL),
293
    _MI_XHELP_DEPT_MERGE_TICKET_NOTIFYTPL => array(_MI_XHELP_DEPT_MERGE_TICKET_NOTIFY, _MI_XHELP_DEPT_MERGE_TICKET_NOTIFYDSC, _MI_XHELP_DEPT_MERGE_TICKET_NOTIFYTPL),
294
    _MI_XHELP_TICKET_MERGE_TICKET_NOTIFYTPL => array(_MI_XHELP_TICKET_MERGE_TICKET_NOTIFY, _MI_XHELP_TICKET_MERGE_TICKET_NOTIFYDSC, _MI_XHELP_TICKET_MERGE_TICKET_NOTIFYTPL));
295
296
    $notKeys = array_keys($notNames);
297
298
    while(($file = readdir($opendir)) != null) {
299
        //Do not Display .
300
        if (is_dir($file)) {
301
            continue;
302
        }
303
304
        if (!in_array($file, $notKeys)) {
305
            continue;
306
        }
307
         
308
        $aFile = Array();
309
        $aFile['name'] = $notNames[$file][0];
310
        $aFile['desc'] = $notNames[$file][1];
311
        $aFile['filename'] = $notNames[$file][2];
312
        $aFile['url'] = "index.php?op=modifyEmlTpl&amp;file=$file";
313
        $aFiles[] = $aFile;
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aFiles was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aFiles = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
314
    }
315
316
    if(!isset($_GET['file'])){
317
        xoops_cp_header();
318
        //echo $oAdminButton->renderButtons('manNotify');
319
        $indexAdmin = new ModuleAdmin();
320
        echo $indexAdmin->addNavigation('notifications.php');
321
322
        echo "<table width='100%' border='0' cellspacing='1' class='outer'>
323
              <tr><th colspan='2'><label>". _AM_XHELP_MENU_MODIFY_EMLTPL ."</label></th></tr>
324
              <tr class='head'><td>". _AM_XHELP_TEXT_TEMPLATE_NAME ."</td><td>". _AM_XHELP_TEXT_DESCRIPTION ."</td></tr>";
325
326
        foreach($aFiles as $file){
0 ignored issues
show
Bug introduced by
The variable $aFiles does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
327
            static $rowSwitch = 0;
328
            if($rowSwitch == 0){
329
                echo "<tr class='odd'><td><a href='".$file['url']."'>". $file['name'] ."</a></td><td>". $file['desc'] ."</td></tr>";
330
                $rowSwitch = 1;
331
            } else {
332
                echo "<tr class='even'><td><a href='".$file['url']."'>". $file['name'] ."</a></td><td>". $file['desc'] ."</td></tr>";
333
                $rowSwitch = 0;
334
            }
335
        }
336
        echo "</table>";
337
    } else {
338
        xoops_cp_header();
339
        //echo $oAdminButton->renderButtons('manNotify');
340
        $indexAdmin = new ModuleAdmin();
341
        echo $indexAdmin->addNavigation('notifications.php');
342
343
        foreach($aFiles as $file){
344
            if($_GET['file'] == $file['filename']){
345
                $myFileName = $file['filename'];
346
                $myFileDesc = $file['desc'];
347
                $myName = $file['name'];
348
                break;
349
            }
350
        }
351
        if(!$has_write = is_writable($dir.$myFileName)){
352
            $message = _AM_XHELP_MESSAGE_FILE_READONLY;
353
            $handle = fopen($dir.$myFileName, 'r');
0 ignored issues
show
Bug introduced by
The variable $myFileName does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
354
            $fileSize = filesize($dir.$myFileName);
355
        } elseif(isset($_POST['editTemplate'])){
356
            $handle = fopen($dir.$myFileName, 'w+');
357
        } else {
358
            $handle = fopen($dir.$myFileName, 'r+');
359
            $fileSize = filesize($dir.$myFileName);
360
        }
361
362
        if(isset($_POST['editTemplate'])){
363
            if(isset($_POST['templateText'])){
364
                $text = $_POST['templateText'];    // Get new text for template
365
            } else {
366
                $text = '';
367
            }
368
369
            if(!$returnPage =& $_xhelpSession->get("xhelp_return_page")){
370
                $returnPage = false;
371
            }
372
373
            if(fwrite($handle, $text)){
374
                $message = _AM_XHELP_MESSAGE_FILE_UPDATED;
375
                $fileSize = filesize($dir.$myFileName);
376
                fclose($handle);
377 View Code Duplication
                if($returnPage){
378
                    header("Location: ".XHELP_ADMIN_URL."/$returnPage");
379
                } else {
380
                    header("Location: ".XHELP_ADMIN_URL."/notifications.php");
381
                }
382
            } else {
383
                $message = _AM_XHELP_MESSAGE_FILE_UPDATED_ERROR;
384
                $fileSize = filesize($dir.$myFileName);
385
                fclose($handle);
386
                if($returnPage){
387
                    redirect_header("Location: ".XHELP_ADMIN_URL."/$returnPage", 3, $message);
388
                } else {
389
                    redirect_header("Location: ".XHELP_ADMIN_URL."/notifications.php", 3, $message);
390
                }
391
            }
392
        }
393
        if(!$has_write){
394
            echo "<div id='readOnly' class='errorMsg'>";
395
            echo $message;
0 ignored issues
show
Bug introduced by
The variable $message does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
396
            echo "</div>";
397
        }
398
399
        echo "<form action='".XHELP_ADMIN_URL."/notifications.php?op=modifyEmlTpl&amp;file=".$myFileName."' method='post'>";
400
        echo "<table width='100%' border='0' cellspacing='1' class='outer'>
401
              <tr><th colspan='2'>".$myName."</th></tr>
0 ignored issues
show
Bug introduced by
The variable $myName does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
402
              <tr><td colspan='2' class='head'>". $myFileDesc ."</td></tr>";
0 ignored issues
show
Bug introduced by
The variable $myFileDesc does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
403
404
        echo "<tr class='odd'>
405
                  <td><textarea name='templateText' cols='40' rows='40'>". fread($handle, $fileSize) ."</textarea></td>
0 ignored issues
show
Bug introduced by
The variable $fileSize does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
406
                  <td valign='top'>
407
                      <b>". _AM_XHELP_TEXT_GENERAL_TAGS ."</b>
408
                      <ul>
409
                        <li>". _AM_XHELP_TEXT_GENERAL_TAGS1 ."</li>
410
                        <li>". _AM_XHELP_TEXT_GENERAL_TAGS2 ."</li>
411
                        <li>". _AM_XHELP_TEXT_GENERAL_TAGS3 ."</li>
412
                        <li>". _AM_XHELP_TEXT_GENERAL_TAGS4 ."</li>
413
                        <li>". _AM_XHELP_TEXT_GENERAL_TAGS5 ."</li>
414
                      </ul>
415
                      <br />
416
                      <u>". _AM_XHELP_TEXT_TAGS_NO_MODIFY ."</u>
417
                  </td>
418
              </tr>";
419
420
        if($has_write){
421
            echo "<tr><td class='foot' colspan='2'><input type='submit' name='editTemplate' value='". _AM_XHELP_BUTTON_UPDATE ."' class='formButton' /></td></tr>";
422
        }
423
        echo "</table></form>";
424
    }
425
    include_once "admin_footer.php";
426
}
427