diff --git a/include/staff/settings-attachments.inc.php b/include/staff/settings-attachments.inc.php
deleted file mode 100644
index b381fa40d334f9f2c9077f91698c6ec90aa31491..0000000000000000000000000000000000000000
--- a/include/staff/settings-attachments.inc.php
+++ /dev/null
@@ -1,108 +0,0 @@
-<?php
-if(!($maxfileuploads=ini_get('max_file_uploads')))
-    $maxfileuploads=DEFAULT_MAX_FILE_UPLOADS;
-
-?>
-<form action="settings.php?t=attachments" method="post" id="save">
-<?php csrf_token(); ?>
-<input type="hidden" name="t" value="attachments" >
-<table class="form_table settings_table" width="940" border="0" cellspacing="0" cellpadding="2">
-    <thead>
-        <tr>
-            <th colspan="2">
-                <h4>Attachments Settings</h4>
-                <em> Before enabling attachments make sure you understand PHP file upload settings and security issues related to file upload.</em>
-            </th>
-        </tr>
-    </thead>
-    <tbody>
-        <tr>
-            <td width="180">Allow Attachments:</td>
-            <td>
-              <input type="checkbox" name="allow_attachments" <?php echo $config['allow_attachments']?'checked="checked"':''; ?>><b>Allow Attachments</b>
-                &nbsp; <em>(Global Setting)</em>
-                &nbsp;<font class="error">&nbsp;<?php echo $errors['allow_attachments']; ?></font>
-            </td>
-        </tr>
-        <tr>
-            <td width="180">Emailed Attachments:</td>
-            <td>
-                <input type="checkbox" name="allow_email_attachments" <?php echo $config['allow_email_attachments']?'checked="checked"':''; ?>> Accept emailed files
-                    &nbsp;<font class="error">&nbsp;<?php echo $errors['allow_email_attachments']; ?></font>
-            </td>
-        </tr>
-        <tr>
-            <td width="180">Online Attachments:</td>
-            <td>
-                <input type="checkbox" name="allow_online_attachments" <?php echo $config['allow_online_attachments']?'checked="checked"':''; ?> >
-                    Allow web upload &nbsp;&nbsp;&nbsp;&nbsp;
-                <input type="checkbox" name="allow_online_attachments_onlogin" <?php echo $config['allow_online_attachments_onlogin'] ?'checked="checked"':''; ?> >
-                    Limit to authenticated users only. <em>(User must be logged in to upload files)</em>
-                    <font class="error">&nbsp;<?php echo $errors['allow_online_attachments']; ?></font>
-            </td>
-        </tr>
-        <tr>
-            <td>Max. User File Uploads:</td>
-            <td>
-                <select name="max_user_file_uploads">
-                    <?php
-                    for($i = 1; $i <=$maxfileuploads; $i++) {
-                        ?>
-                        <option <?php echo $config['max_user_file_uploads']==$i?'selected="selected"':''; ?> value="<?php echo $i; ?>">
-                            <?php echo $i; ?>&nbsp;<?php echo ($i>1)?'files':'file'; ?></option>
-                        <?php
-                    } ?>
-                </select>
-                <em>(Number of files the user is allowed to upload simultaneously)</em>
-                &nbsp;<font class="error">&nbsp;<?php echo $errors['max_user_file_uploads']; ?></font>
-            </td>
-        </tr>
-        <tr>
-            <td>Max. Staff File Uploads:</td>
-            <td>
-                <select name="max_staff_file_uploads">
-                    <?php
-                    for($i = 1; $i <=$maxfileuploads; $i++) {
-                        ?>
-                        <option <?php echo $config['max_staff_file_uploads']==$i?'selected="selected"':''; ?> value="<?php echo $i; ?>">
-                            <?php echo $i; ?>&nbsp;<?php echo ($i>1)?'files':'file'; ?></option>
-                        <?php
-                    } ?>
-                </select>
-                <em>(Number of files the staff is allowed to upload simultaneously)</em>
-                &nbsp;<font class="error">&nbsp;<?php echo $errors['max_staff_file_uploads']; ?></font>
-            </td>
-        </tr>
-        <tr>
-            <td width="180">Maximum File Size:</td>
-            <td>
-                <input type="text" name="max_file_size" value="<?php echo $config['max_file_size']; ?>"> in bytes.
-                    <em>(Max <?php echo Format::file_size(ini_get('upload_max_filesize')); ?>)</em>
-                    <font class="error">&nbsp;<?php echo $errors['max_file_size']; ?></font>
-            </td>
-        </tr>
-        <tr>
-            <td width="180">Ticket Response Files:</td>
-            <td>
-                <input type="checkbox" name="email_attachments" <?php echo $config['email_attachments']?'checked="checked"':''; ?> >Email attachments to the user
-            </td>
-        </tr>
-        <tr>
-            <th colspan="2">
-                <em><strong>Accepted File Types</strong>: Limit the type of files users are allowed to upload.
-                <font class="error">&nbsp;<?php echo $errors['allowed_filetypes']; ?></font></em>
-            </th>
-        </tr>
-        <tr>
-            <td colspan="2">
-                <em>Enter allowed file extensions separated by a comma. e.g .doc, .pdf. To accept all files enter wildcard <b><i>.*</i></b>&nbsp;i.e dotStar (NOT Recommended).</em><br>
-                <textarea name="allowed_filetypes" cols="21" rows="4" style="width: 65%;" wrap="hard" ><?php echo $config['allowed_filetypes']; ?></textarea>
-            </td>
-        </tr>
-    </tbody>
-</table>
-<p style="padding-left:210px;">
-    <input class="button" type="submit" name="submit" value="Save Changes">
-    <input class="button" type="reset" name="reset" value="Reset Changes">
-</p>
-</form>
diff --git a/include/staff/settings-autoresponders.inc.php b/include/staff/settings-autoresp.inc.php
similarity index 94%
rename from include/staff/settings-autoresponders.inc.php
rename to include/staff/settings-autoresp.inc.php
index 106e7f3f4d7063a6bcb4835cdbd07006b6f16b5c..0d3a2ab9c20f06824d72bf9cd82dd45fc338cd08 100644
--- a/include/staff/settings-autoresponders.inc.php
+++ b/include/staff/settings-autoresp.inc.php
@@ -1,6 +1,6 @@
-<form action="settings.php?t=autoresponders" method="post" id="save">
+<form action="settings.php?t=autoresp" method="post" id="save">
 <?php csrf_token(); ?>
-<input type="hidden" name="t" value="autoresponders" >
+<input type="hidden" name="t" value="autoresp" >
 <table class="form_table settings_table" width="940" border="0" cellspacing="0" cellpadding="2">
     <thead>
         <tr>
diff --git a/include/staff/settings-dates.inc.php b/include/staff/settings-dates.inc.php
deleted file mode 100644
index f8085cfc3193342bf1bd6c66df87b48d9dcf5edd..0000000000000000000000000000000000000000
--- a/include/staff/settings-dates.inc.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-$gmtime=Misc::gmtime();
-?>
-<form action="settings.php?t=dates" method="post" id="save">
-<?php csrf_token(); ?>
-<input type="hidden" name="t" value="dates" >
-<table class="form_table settings_table" width="940" border="0" cellspacing="0" cellpadding="2">
-    <thead>
-        <tr>
-            <th colspan="2">
-                <h4>Date and Time Options</h4>
-                <em>Please refer to <a href="http://php.net/date" target="_blank">PHP Manual</a> for supported parameters.</em>
-            </th>
-        </tr>
-    </thead>
-    <tbody>
-        <tr><td width="220" class="required">Time Format:</td>
-            <td>
-                <input type="text" name="time_format" value="<?php echo $config['time_format']; ?>">
-                    &nbsp;<font class="error">*&nbsp;<?php echo $errors['time_format']; ?></font>
-                    <em><?php echo Format::date($config['time_format'],$gmtime,$config['timezone_offset'],$config['enable_daylight_saving']); ?></em></td>
-        </tr>
-        <tr><td width="220" class="required">Date Format:</td>
-            <td><input type="text" name="date_format" value="<?php echo $config['date_format']; ?>">
-                        &nbsp;<font class="error">*&nbsp;<?php echo $errors['date_format']; ?></font>
-                        <em><?php echo Format::date($config['date_format'],$gmtime,$config['timezone_offset'],$config['enable_daylight_saving']); ?></em>
-            </td>
-        </tr>
-        <tr><td width="220" class="required">Date &amp; Time Format:</td>
-            <td><input type="text" name="datetime_format" value="<?php echo $config['datetime_format']; ?>">
-                        &nbsp;<font class="error">*&nbsp;<?php echo $errors['datetime_format']; ?></font>
-                        <em><?php echo Format::date($config['datetime_format'],$gmtime,$config['timezone_offset'],$config['enable_daylight_saving']); ?></em>
-            </td>
-        </tr>
-        <tr><td width="220" class="required">Day, Date &amp; Time Format:</td>
-            <td><input type="text" name="daydatetime_format" value="<?php echo $config['daydatetime_format']; ?>">
-                        &nbsp;<font class="error">*&nbsp;<?php echo $errors['daydatetime_format']; ?></font>
-                        <em><?php echo Format::date($config['daydatetime_format'],$gmtime,$config['timezone_offset'],$config['enable_daylight_saving']); ?></em>
-            </td>
-        </tr>
-        <tr><td width="220" class="required">Default Time Zone:</td>
-            <td>
-                <select name="default_timezone_id">
-                    <option value="">&mdash; Select Default Time Zone &mdash;</option>
-                    <?php
-                    $sql='SELECT id, offset,timezone FROM '.TIMEZONE_TABLE.' ORDER BY id';
-                    if(($res=db_query($sql)) && db_num_rows($res)){
-                        while(list($id,$offset, $tz)=db_fetch_row($res)){
-                            $sel=($config['default_timezone_id']==$id)?'selected="selected"':'';
-                            echo sprintf('<option value="%d" %s>GMT %s - %s</option>',$id,$sel,$offset,$tz);
-                        }
-                    }
-                    ?>
-                </select>
-                &nbsp;<font class="error">*&nbsp;<?php echo $errors['default_timezone_id']; ?></font>
-            </td>
-        </tr>
-        <tr>
-            <td width="220">Daylight Saving:</td>
-            <td>
-                <input type="checkbox" name="enable_daylight_saving" <?php echo $config['enable_daylight_saving'] ? 'checked="checked"': ''; ?>>Observe daylight savings
-            </td>
-        </tr>
-    </tbody>
-</table>
-<p style="padding-left:250px;">
-    <input class="button" type="submit" name="submit" value="Save Changes">
-    <input class="button" type="reset" name="reset" value="Reset Changes">
-</p>
-</form>
diff --git a/include/staff/settings-emails.inc.php b/include/staff/settings-emails.inc.php
index e4ccaf3a4e69329c15d474bfd3f136f9a8fe17f9..fecd3ab3fca43d5d7c8c1985c0668c991ecdd3f7 100644
--- a/include/staff/settings-emails.inc.php
+++ b/include/staff/settings-emails.inc.php
@@ -1,110 +1,118 @@
-<form action="settings.php?t=emails" method="post" id="save">
+<?php
+if(!defined('OSTADMININC') || !$thisstaff || !$thisstaff->isAdmin() || !$config) die('Access Denied');
+?>
+<h2>Email Settings and Options</h2>
+<form action="settings.php?t=emails" method="post" id="save">
 <?php csrf_token(); ?>
-<input type="hidden" name="t" value="emails" >
-<table class="form_table settings_table" width="940" border="0" cellspacing="0" cellpadding="2">
-    <thead>
-        <tr>
-            <th colspan="2">
-                <h4>Email Settings</h4>
-                <em>Note that some of the global settings can be overwritten at department/email level.</em>
-            </th>
-        </tr>
-    </thead>
-    <tbody>
-        <tr>
-            <td width="180" class="required">Default System Email:</td>
-            <td>
-                <select name="default_email_id">
-                    <option value=0 disabled>Select One</option>
+<input type="hidden" name="t" value="emails" >
+<table class="form_table settings_table" width="940" border="0" cellspacing="0" cellpadding="2">
+    <thead>
+        <tr>
+            <th colspan="2">
+                <h4>Email Settings</h4>
+                <em>Note that some of the global settings can be overwritten at department/email level.</em>
+            </th>
+        </tr>
+    </thead>
+    <tbody>
+        <tr>
+            <td width="180" class="required">Default System Email:</td>
+            <td>
+                <select name="default_email_id">
+                    <option value=0 disabled>Select One</option>
                     <?php
-                    $sql='SELECT email_id,email,name FROM '.EMAIL_TABLE;
-                    if(($res=db_query($sql)) && db_num_rows($res)){
-                        while (list($id,$email,$name) = db_fetch_row($res)){
-                            $email=$name?"$name &lt;$email&gt;":$email;
-                            ?>
-                            <option value="<?php echo $id; ?>"<?php echo ($config['default_email_id']==$id)?'selected="selected"':''; ?>><?php echo $email; ?></option>
+                    $sql='SELECT email_id,email,name FROM '.EMAIL_TABLE;
+                    if(($res=db_query($sql)) && db_num_rows($res)){
+                        while (list($id,$email,$name) = db_fetch_row($res)){
+                            $email=$name?"$name &lt;$email&gt;":$email;
+                            ?>
+                            <option value="<?php echo $id; ?>"<?php echo ($config['default_email_id']==$id)?'selected="selected"':''; ?>><?php echo $email; ?></option>
                         <?php
-                        }
-                    } ?>
-                 </select>
-                 &nbsp;<font class="error">*&nbsp;<?php echo $errors['default_email_id']; ?></font>
-            </td>
-        </tr>
-        <tr>
-            <td width="180" class="required">Default Alert Email:</td>
-            <td>
-                <select name="alert_email_id">
-                    <option value="0" selected="selected">Use Default System Email (above)</option>
+                        }
+                    } ?>
+                 </select>
+                 &nbsp;<font class="error">*&nbsp;<?php echo $errors['default_email_id']; ?></font>
+            </td>
+        </tr>
+        <tr>
+            <td width="180" class="required">Default Alert Email:</td>
+            <td>
+                <select name="alert_email_id">
+                    <option value="0" selected="selected">Use Default System Email (above)</option>
                     <?php
-                    $sql='SELECT email_id,email,name FROM '.EMAIL_TABLE.' WHERE email_id != '.db_input($config['default_email_id']);
-                    if(($res=db_query($sql)) && db_num_rows($res)){
-                        while (list($id,$email,$name) = db_fetch_row($res)){
-                            $email=$name?"$name &lt;$email&gt;":$email;
-                            ?>
-                            <option value="<?php echo $id; ?>"<?php echo ($config['alert_email_id']==$id)?'selected="selected"':''; ?>><?php echo $email; ?></option>
+                    $sql='SELECT email_id,email,name FROM '.EMAIL_TABLE.' WHERE email_id != '.db_input($config['default_email_id']);
+                    if(($res=db_query($sql)) && db_num_rows($res)){
+                        while (list($id,$email,$name) = db_fetch_row($res)){
+                            $email=$name?"$name &lt;$email&gt;":$email;
+                            ?>
+                            <option value="<?php echo $id; ?>"<?php echo ($config['alert_email_id']==$id)?'selected="selected"':''; ?>><?php echo $email; ?></option>
                         <?php
-                        }
-                    } ?>
-                 </select>
-                 &nbsp;<font class="error">*&nbsp;<?php echo $errors['alert_email_id']; ?></font>
-            </td>
-        </tr>
-        <tr>
-            <td width="180" class="required">Admin Email Address:</td>
-            <td>
-                <input type="text" size=40 name="admin_email" value="<?php echo $config['admin_email']; ?>">
-                    &nbsp;<font class="error">*&nbsp;<?php echo $errors['admin_email']; ?></font></td>
-        </tr>
-        <tr><th colspan=2><em><strong>Incoming Emails</strong>: For mail fetcher (POP/IMAP) to work you must set a cron job or enable auto-cron</em></th>
-        <tr>
-            <td width="180">Email Polling:</td>
-            <td><input type="checkbox" name="enable_mail_polling" value=1 <?php echo $config['enable_mail_polling']? 'checked="checked"': ''; ?>  > Enable POP/IMAP
-                 &nbsp;&nbsp;<em>(Global setting which can be disabled at email level)</em>
-            </td>
-        </tr>
-        <tr>
-            <td width="180">Email Piping:</td>
-            <td><input type="checkbox" name="enable_email_piping" value=1 <?php echo $config['enable_email_piping']? 'checked="checked"': ''; ?>> Enable email piping
-                 &nbsp;&nbsp;<em>(You pipe we accept policy)</em>
-            </td>
-        </tr>
-        <tr>
-            <td width="180">Strip Quoted Reply:</td>
-            <td>
-                <input type="checkbox" name="strip_quoted_reply" <?php echo $config['strip_quoted_reply'] ? 'checked="checked"':''; ?>>
-                <em>(depends on the reply separator tag set below)</em>
-                &nbsp;<font class="error">&nbsp;<?php echo $errors['strip_quoted_reply']; ?></font>
-            </td>
-        </tr>
-        <tr>
-            <td width="180">Reply Separator Tag:</td>
-            <td><input type="text" name="reply_separator" value="<?php echo $config['reply_separator']; ?>">
-                &nbsp;<font class="error">&nbsp;<?php echo $errors['reply_separator']; ?></font>
-            </td>
-        </tr>
-        <tr><th colspan=2><em><strong>Outgoing Emails</strong>: Default email only applies to outgoing emails without SMTP setting.</em></th></tr>
-        <tr><td width="180">Default Outgoing Email:</td>
-            <td>
-                <select name="default_smtp_id">
-                    <option value=0 selected="selected">None: Use PHP mail function</option>
+                        }
+                    } ?>
+                 </select>
+                 &nbsp;<font class="error">*&nbsp;<?php echo $errors['alert_email_id']; ?></font>
+            </td>
+        </tr>
+        <tr>
+            <td width="180" class="required">Admin's Email Address:</td>
+            <td>
+                <input type="text" size=40 name="admin_email" value="<?php echo $config['admin_email']; ?>">
+                    &nbsp;<font class="error">*&nbsp;<?php echo $errors['admin_email']; ?></font>
+                &nbsp;&nbsp;<em>(System administrator's email)</em> 
+            </td>
+        </tr>
+        <tr><th colspan=2><em><strong>Incoming Emails</strong>: For mail fetcher (polling) to work you must set an external cron job or enable auto-cron</em></th>
+        <tr>
+            <td width="180">Email Polling:</td>
+            <td><input type="checkbox" name="enable_mail_polling" value=1 <?php echo $config['enable_mail_polling']? 'checked="checked"': ''; ?>  > Enable POP/IMAP polling
+                 &nbsp;&nbsp;
+                 <input type="checkbox" name="enable_auto_cron" <?php echo $config['enable_auto_cron']?'checked="checked"':''; ?>>
+                 Enable Auto-Cron <em>(Poll emails based on staff activity - NOT recommended)</em>
+            </td>
+        </tr>
+        <tr>
+            <td width="180">Email Piping:</td>
+            <td><input type="checkbox" name="enable_email_piping" value=1 <?php echo $config['enable_email_piping']? 'checked="checked"': ''; ?>> Enable email piping
+                 &nbsp;&nbsp;<em>(You pipe we accept policy)</em>
+            </td>
+        </tr>
+        <tr>
+            <td width="180">Strip Quoted Reply:</td>
+            <td>
+                <input type="checkbox" name="strip_quoted_reply" <?php echo $config['strip_quoted_reply'] ? 'checked="checked"':''; ?>>
+                <em>(depends on the reply separator tag set below)</em>
+                &nbsp;<font class="error">&nbsp;<?php echo $errors['strip_quoted_reply']; ?></font>
+            </td>
+        </tr>
+        <tr>
+            <td width="180">Reply Separator Tag:</td>
+            <td><input type="text" name="reply_separator" value="<?php echo $config['reply_separator']; ?>">
+                &nbsp;<font class="error">&nbsp;<?php echo $errors['reply_separator']; ?></font>
+            </td>
+        </tr>
+        <tr><th colspan=2><em><strong>Outgoing Emails</strong>: Default email only applies to outgoing emails without SMTP setting.</em></th></tr>
+        <tr><td width="180">Default Outgoing Email:</td>
+            <td>
+                <select name="default_smtp_id">
+                    <option value=0 selected="selected">None: Use PHP mail function</option>
                     <?php
-                    $sql='SELECT email_id,email,name,smtp_host FROM '.EMAIL_TABLE.' WHERE smtp_active=1';
-
-                    if(($res=db_query($sql)) && db_num_rows($res)) {
-                        while (list($id,$email,$name,$host) = db_fetch_row($res)){
-                            $email=$name?"$name &lt;$email&gt;":$email;
-                            ?>
-                            <option value="<?php echo $id; ?>"<?php echo ($config['default_smtp_id']==$id)?'selected="selected"':''; ?>><?php echo $email; ?></option>
+                    $sql='SELECT email_id,email,name,smtp_host FROM '.EMAIL_TABLE.' WHERE smtp_active=1';
+
+                    if(($res=db_query($sql)) && db_num_rows($res)) {
+                        while (list($id,$email,$name,$host) = db_fetch_row($res)){
+                            $email=$name?"$name &lt;$email&gt;":$email;
+                            ?>
+                            <option value="<?php echo $id; ?>"<?php echo ($config['default_smtp_id']==$id)?'selected="selected"':''; ?>><?php echo $email; ?></option>
                         <?php
-                        }
-                    } ?>
-                 </select>&nbsp;&nbsp;<font class="error">&nbsp;<?php echo $errors['default_smtp_id']; ?></font>
-           </td>
-       </tr>
-    </tbody>
-</table>
-<p style="padding-left:250px;">
-    <input class="button" type="submit" name="submit" value="Save Changes">
-    <input class="button" type="reset" name="reset" value="Reset Changes">
-</p>
-</form>
+                        }
+                    } ?>
+                 </select>&nbsp;&nbsp;<font class="error">&nbsp;<?php echo $errors['default_smtp_id']; ?></font>
+           </td>
+       </tr>
+    </tbody>
+</table>
+<p style="padding-left:250px;">
+    <input class="button" type="submit" name="submit" value="Save Changes">
+    <input class="button" type="reset" name="reset" value="Reset Changes">
+</p>
+</form>
diff --git a/include/staff/settings-kb.inc.php b/include/staff/settings-kb.inc.php
index 6fe8433f5ee580c5a201a42518652106af63d313..0ab2ec09449a07f8f7efa78f8602683534b7666a 100644
--- a/include/staff/settings-kb.inc.php
+++ b/include/staff/settings-kb.inc.php
@@ -1,3 +1,7 @@
+<?php
+if(!defined('OSTADMININC') || !$thisstaff || !$thisstaff->isAdmin() || !$config) die('Access Denied');
+?>
+<h2>Knowledge Base Settings and Options</h2>
 <form action="settings.php?t=kb" method="post" id="save">
 <?php csrf_token(); ?>
 <input type="hidden" name="t" value="kb" >
@@ -5,25 +9,25 @@
     <thead>
         <tr>
             <th colspan="2">
-                <h4>Knowledgebase Settings</h4>
-                <em>Disabling knowledgebase disables user's knowledgebase interface.</em>
+                <h4>Knowledge Base Settings</h4>
+                <em>Disabling knowledge base disables clients'interface.</em>
             </th>
         </tr>
     </thead>
     <tbody>
         <tr>
-            <td width="180">Knowledgebase Status:</td>
+            <td width="180">Knowledge base status:</td>
             <td>
               <input type="checkbox" name="enable_kb" value="1" <?php echo $config['enable_kb']?'checked="checked"':''; ?>>
-              Enable Knowledgebase&nbsp;<em>(Client Interface)</em>
+              Enable Knowledge base&nbsp;<em>(Client interface)</em>
               &nbsp;<font class="error">&nbsp;<?php echo $errors['enable_kb']; ?></font>
             </td>
         </tr>
         <tr>
-            <td width="180">Premade Responses:</td>
+            <td width="180">Canned Responses:</td>
             <td>
                 <input type="checkbox" name="enable_premade" value="1" <?php echo $config['enable_premade']?'checked="checked"':''; ?> >
-                Enable premade/canned responses&nbsp;<em>(Available on ticket reply)</em>
+                Enable canned responses&nbsp;<em>(Available on ticket reply)</em>
                 &nbsp;<font class="error">&nbsp;<?php echo $errors['enable_premade']; ?></font>
             </td>
         </tr>
diff --git a/include/staff/settings-general.inc.php b/include/staff/settings-system.inc.php
similarity index 70%
rename from include/staff/settings-general.inc.php
rename to include/staff/settings-system.inc.php
index 20bbd94866960d2e06ae4d3451825d5752c853ac..1bc9b3ee4daf79688164593ca59daab8a1bb0ebc 100644
--- a/include/staff/settings-general.inc.php
+++ b/include/staff/settings-system.inc.php
@@ -1,12 +1,18 @@
-<form action="settings.php?t=general" method="post" id="save">
+<?php
+if(!defined('OSTADMININC') || !$thisstaff || !$thisstaff->isAdmin() || !$config) die('Access Denied');
+
+$gmtime = Misc::gmtime();
+?>
+<h2>System Settings and Preferences - <span>osTicket (v<?php echo $cfg->getVersion(); ?>)</span></h2>
+<form action="settings.php?t=system" method="post" id="save">
 <?php csrf_token(); ?>
-<input type="hidden" name="t" value="general" >
+<input type="hidden" name="t" value="system" >
 <table class="form_table settings_table" width="940" border="0" cellspacing="0" cellpadding="2">
     <thead>
         <tr>
             <th colspan="2">
-                <h4>General Settings</h4>
-                <em>Offline mode will disable client interface and only allow admins to login to Staff Control Panel</em>
+                <h4>System Settings & Preferences</h4>
+                <em><b>General Settings</b>: Offline mode will disable client interface and only allow admins to login to Staff Control Panel</em>
             </th>
         </tr>
     </thead>
@@ -120,6 +126,12 @@
                 &nbsp;<font class="error">&nbsp;<?php echo $errors['passwd_reset_period']; ?></font>
             </td>
         </tr>
+        <tr><td>Bind Staff Session to IP:</td>
+            <td>
+              <input type="checkbox" name="staff_ip_binding" <?php echo $config['staff_ip_binding']?'checked="checked"':''; ?>>
+              <em>(binds staff session to originating IP address upon login)</em>
+            </td>
+        </tr>
         <tr><td>Staff Excessive Logins:</td>
             <td>
                 <select name="staff_max_logins">
@@ -144,12 +156,6 @@
                 Maximum idle time in minutes before a staff member must log in again (enter 0 to disable).
             </td>
         </tr>
-       <tr><td>Bind Staff Session to IP:</td>
-            <td>
-              <input type="checkbox" name="staff_ip_binding" <?php echo $config['staff_ip_binding']?'checked="checked"':''; ?>>
-              <em>(binds staff session to originating IP address upon login)</em>
-            </td>
-        </tr>
         <tr><td>Client Excessive Logins:</td>
             <td>
                 <select name="client_max_logins">
@@ -176,16 +182,56 @@
                 &nbsp;Maximum idle time in minutes before a client must log in again (enter 0 to disable).
             </td>
         </tr>
-        <tr><td>Clickable URLs:</td>
+        <tr>
+            <th colspan="2">
+                <em><b>Date and Time Options</b>: Please refer to <a href="http://php.net/date" target="_blank">PHP Manual</a> for supported parameters.</em>
+            </th>
+        </tr>
+        <tr><td width="220" class="required">Time Format:</td>
+            <td>
+                <input type="text" name="time_format" value="<?php echo $config['time_format']; ?>">
+                    &nbsp;<font class="error">*&nbsp;<?php echo $errors['time_format']; ?></font>
+                    <em><?php echo Format::date($config['time_format'],$gmtime,$config['timezone_offset'],$config['enable_daylight_saving']); ?></em></td>
+        </tr>
+        <tr><td width="220" class="required">Date Format:</td>
+            <td><input type="text" name="date_format" value="<?php echo $config['date_format']; ?>">
+                        &nbsp;<font class="error">*&nbsp;<?php echo $errors['date_format']; ?></font>
+                        <em><?php echo Format::date($config['date_format'],$gmtime,$config['timezone_offset'],$config['enable_daylight_saving']); ?></em>
+            </td>
+        </tr>
+        <tr><td width="220" class="required">Date &amp; Time Format:</td>
+            <td><input type="text" name="datetime_format" value="<?php echo $config['datetime_format']; ?>">
+                        &nbsp;<font class="error">*&nbsp;<?php echo $errors['datetime_format']; ?></font>
+                        <em><?php echo Format::date($config['datetime_format'],$gmtime,$config['timezone_offset'],$config['enable_daylight_saving']); ?></em>
+            </td>
+        </tr>
+        <tr><td width="220" class="required">Day, Date &amp; Time Format:</td>
+            <td><input type="text" name="daydatetime_format" value="<?php echo $config['daydatetime_format']; ?>">
+                        &nbsp;<font class="error">*&nbsp;<?php echo $errors['daydatetime_format']; ?></font>
+                        <em><?php echo Format::date($config['daydatetime_format'],$gmtime,$config['timezone_offset'],$config['enable_daylight_saving']); ?></em>
+            </td>
+        </tr>
+        <tr><td width="220" class="required">Default Time Zone:</td>
             <td>
-              <input type="checkbox" name="clickable_urls" <?php echo $config['clickable_urls']?'checked="checked"':''; ?>>
-               <em>(converts URLs in messages to clickable links)</em>
+                <select name="default_timezone_id">
+                    <option value="">&mdash; Select Default Time Zone &mdash;</option>
+                    <?php
+                    $sql='SELECT id, offset,timezone FROM '.TIMEZONE_TABLE.' ORDER BY id';
+                    if(($res=db_query($sql)) && db_num_rows($res)){
+                        while(list($id,$offset, $tz)=db_fetch_row($res)){
+                            $sel=($config['default_timezone_id']==$id)?'selected="selected"':'';
+                            echo sprintf('<option value="%d" %s>GMT %s - %s</option>',$id,$sel,$offset,$tz);
+                        }
+                    }
+                    ?>
+                </select>
+                &nbsp;<font class="error">*&nbsp;<?php echo $errors['default_timezone_id']; ?></font>
             </td>
         </tr>
-        <tr><td>Enable Auto Cron:</td>
+        <tr>
+            <td width="220">Daylight Saving:</td>
             <td>
-              <input type="checkbox" name="enable_auto_cron" <?php echo $config['enable_auto_cron']?'checked="checked"':''; ?>>
-                <em>(executes cron jobs based on staff activity - not recommended)</em>
+                <input type="checkbox" name="enable_daylight_saving" <?php echo $config['enable_daylight_saving'] ? 'checked="checked"': ''; ?>>Observe daylight savings
             </td>
         </tr>
     </tbody>
@@ -195,4 +241,3 @@
     <input class="button" type="reset" name="reset" value="Reset Changes">
 </p>
 </form>
-
diff --git a/include/staff/settings-tickets.inc.php b/include/staff/settings-tickets.inc.php
index 280abca08ea44d698e0a41b56b1d8d0a62cd1693..992e9900425c19d708f7cb35d75a59f7b18c36bf 100644
--- a/include/staff/settings-tickets.inc.php
+++ b/include/staff/settings-tickets.inc.php
@@ -1,3 +1,9 @@
+<?php
+if(!defined('OSTADMININC') || !$thisstaff || !$thisstaff->isAdmin() || !$config) die('Access Denied');
+if(!($maxfileuploads=ini_get('max_file_uploads')))
+    $maxfileuploads=DEFAULT_MAX_FILE_UPLOADS;
+?>
+<h2>Ticket Settings and Options</h2>
 <form action="settings.php?t=tickets" method="post" id="save">
 <?php csrf_token(); ?>
 <input type="hidden" name="t" value="tickets" >
@@ -5,7 +11,7 @@
     <thead>
         <tr>
             <th colspan="2">
-                <h4>Ticket Settings and Options</h4>
+                <h4>Ticket Settings</h4>
                 <em>Global ticket settings and options.</em>
             </th>
         </tr>
@@ -55,53 +61,59 @@
              </td>
         </tr>
         <tr>
-            <td width="180">Web Tickets Priority</td>
+            <td>Maximum <b>Open</b> Tickets:</td>
             <td>
-                <input type="checkbox" name="allow_priority_change" value="1" <?php echo $config['allow_priority_change'] ?'checked="checked"':''; ?>>
-                <em>(Allow user to overwrite/set priority)</em>
+                <input type="text" name="max_open_tickets" size=4 value="<?php echo $config['max_open_tickets']; ?>">
+                per email/user. <em>(Helps with spam and email flood control - enter 0 for unlimited)</em>
             </td>
         </tr>
         <tr>
-            <td width="180">Emailed Tickets Priority</td>
+            <td>Ticket Auto-lock Time:</td>
             <td>
-                <input type="checkbox" name="use_email_priority" value="1" <?php echo $config['use_email_priority'] ?'checked="checked"':''; ?> >
-                <em>(Use email priority when available)</em>
+                <input type="text" name="autolock_minutes" size=4 value="<?php echo $config['autolock_minutes']; ?>">
+                <font class="error"><?php echo $errors['autolock_minutes']; ?></font>
+                <em>(Minutes to lock a ticket on activity - enter 0 to disable locking)</em>
+            </td>
+        </tr>
+        <tr>
+                    <td width="180">Web Tickets Priority:</td>
+                    <td>
+                        <input type="checkbox" name="allow_priority_change" value="1" <?php echo $config['allow_priority_change'] ?'checked="checked"':''; ?>>
+                        <em>(Allow user to overwrite/set priority)</em>
+                    </td>
+                </tr>
+                <tr>
+                    <td width="180">Emailed Tickets Priority:</td>
+                    <td>
+                        <input type="checkbox" name="use_email_priority" value="1" <?php echo $config['use_email_priority'] ?'checked="checked"':''; ?> >
+                        <em>(Use email priority when available)</em>
             </td>
         </tr>
         <tr>
-            <td width="180">Show Related Tickets</td>
+            <td width="180">Show Related Tickets:</td>
             <td>
                 <input type="checkbox" name="show_related_tickets" value="1" <?php echo $config['show_related_tickets'] ?'checked="checked"':''; ?> >
                 <em>(Show all related tickets on user login - otherwise access is restricted to one ticket view per login)</em>
             </td>
         </tr>        
         <tr>
-            <td width="180">Show Notes Inline</td>
+            <td width="180">Show Notes Inline:</td>
             <td>
                 <input type="checkbox" name="show_notes_inline" value="1" <?php echo $config['show_notes_inline'] ?'checked="checked"':''; ?> >
                 <em>(Show internal notes  inline)</em>
               </td>
-        </tr>  
-        <tr>
-            <td>Human Verification:</td>
-            <td>
-                <input type="checkbox" name="enable_captcha" <?php echo $config['enable_captcha']?'checked="checked"':''; ?>>
-                Enable CAPTCHA on new web tickets.<em>(requires GDLib)</em> &nbsp;<font class="error">&nbsp;<?php echo $errors['enable_captcha']; ?></font><br/>
-            </td>
         </tr>
-        <tr>
-            <td>Maximum <b>Open</b> Tickets:</td>
+        <tr><td>Clickable URLs:</td>
             <td>
-                <input type="text" name="max_open_tickets" size=4 value="<?php echo $config['max_open_tickets']; ?>">
-                per email/user. <em>(Helps with spam and email flood control - enter 0 for unlimited)</em>
+              <input type="checkbox" name="clickable_urls" <?php echo $config['clickable_urls']?'checked="checked"':''; ?>>
+               <em>(converts URLs in ticket thread to clickable links)</em>
             </td>
         </tr>
         <tr>
-            <td>Ticket Auto-lock Time:</td>
+            <td>Human Verification:</td>
             <td>
-                <input type="text" name="autolock_minutes" size=4 value="<?php echo $config['autolock_minutes']; ?>">
-                <font class="error"><?php echo $errors['autolock_minutes']; ?></font>
-                <em>(Minutes to lock a ticket on activity - enter 0 to disable locking)</em>
+                <input type="checkbox" name="enable_captcha" <?php echo $config['enable_captcha']?'checked="checked"':''; ?>>
+                Enable CAPTCHA on new web tickets.<em>(requires GDLib)</em> &nbsp;<font class="error">&nbsp;<?php echo $errors['enable_captcha']; ?></font><br/>
             </td>
         </tr>
         <tr>
@@ -139,6 +151,94 @@
                 Hide staff's name on responses.
             </td>
         </tr>
+        <tr>
+            <th colspan="2">
+                <em><b>Attachments</b>:  Size setting mainly apply to web tickets.</em>
+            </th>
+        </tr>
+        <tr>
+            <td width="180">Allow Attachments:</td>
+            <td>
+              <input type="checkbox" name="allow_attachments" <?php echo $config['allow_attachments']?'checked="checked"':''; ?>><b>Allow Attachments</b>
+                &nbsp; <em>(Global Setting)</em>
+                &nbsp;<font class="error">&nbsp;<?php echo $errors['allow_attachments']; ?></font>
+            </td>
+        </tr>
+        <tr>
+            <td width="180">Emailed Attachments:</td>
+            <td>
+                <input type="checkbox" name="allow_email_attachments" <?php echo $config['allow_email_attachments']?'checked="checked"':''; ?>> Accept emailed files
+                    &nbsp;<font class="error">&nbsp;<?php echo $errors['allow_email_attachments']; ?></font>
+            </td>
+        </tr>
+        <tr>
+            <td width="180">Online Attachments:</td>
+            <td>
+                <input type="checkbox" name="allow_online_attachments" <?php echo $config['allow_online_attachments']?'checked="checked"':''; ?> >
+                    Allow web upload &nbsp;&nbsp;&nbsp;&nbsp;
+                <input type="checkbox" name="allow_online_attachments_onlogin" <?php echo $config['allow_online_attachments_onlogin'] ?'checked="checked"':''; ?> >
+                    Limit to authenticated users only. <em>(User must be logged in to upload files)</em>
+                    <font class="error">&nbsp;<?php echo $errors['allow_online_attachments']; ?></font>
+            </td>
+        </tr>
+        <tr>
+            <td>Max. User File Uploads:</td>
+            <td>
+                <select name="max_user_file_uploads">
+                    <?php
+                    for($i = 1; $i <=$maxfileuploads; $i++) {
+                        ?>
+                        <option <?php echo $config['max_user_file_uploads']==$i?'selected="selected"':''; ?> value="<?php echo $i; ?>">
+                            <?php echo $i; ?>&nbsp;<?php echo ($i>1)?'files':'file'; ?></option>
+                        <?php
+                    } ?>
+                </select>
+                <em>(Number of files the user is allowed to upload simultaneously)</em>
+                &nbsp;<font class="error">&nbsp;<?php echo $errors['max_user_file_uploads']; ?></font>
+            </td>
+        </tr>
+        <tr>
+            <td>Max. Staff File Uploads:</td>
+            <td>
+                <select name="max_staff_file_uploads">
+                    <?php
+                    for($i = 1; $i <=$maxfileuploads; $i++) {
+                        ?>
+                        <option <?php echo $config['max_staff_file_uploads']==$i?'selected="selected"':''; ?> value="<?php echo $i; ?>">
+                            <?php echo $i; ?>&nbsp;<?php echo ($i>1)?'files':'file'; ?></option>
+                        <?php
+                    } ?>
+                </select>
+                <em>(Number of files the staff is allowed to upload simultaneously)</em>
+                &nbsp;<font class="error">&nbsp;<?php echo $errors['max_staff_file_uploads']; ?></font>
+            </td>
+        </tr>
+        <tr>
+            <td width="180">Maximum File Size:</td>
+            <td>
+                <input type="text" name="max_file_size" value="<?php echo $config['max_file_size']; ?>"> in bytes.
+                    <em>(System Max. <?php echo Format::file_size(ini_get('upload_max_filesize')); ?>)</em>
+                    <font class="error">&nbsp;<?php echo $errors['max_file_size']; ?></font>
+            </td>
+        </tr>
+        <tr>
+            <td width="180">Ticket Response Files:</td>
+            <td>
+                <input type="checkbox" name="email_attachments" <?php echo $config['email_attachments']?'checked="checked"':''; ?> >Email attachments to the user
+            </td>
+        </tr>
+        <tr>
+            <th colspan="2">
+                <em><strong>Accepted File Types</strong>: Limit the type of files users are allowed to submit.
+                <font class="error">&nbsp;<?php echo $errors['allowed_filetypes']; ?></font></em>
+            </th>
+        </tr>
+        <tr>
+            <td colspan="2">
+                <em>Enter allowed file extensions separated by a comma. e.g .doc, .pdf. To accept all files enter wildcard <b><i>.*</i></b>&nbsp;i.e dotStar (NOT Recommended).</em><br>
+                <textarea name="allowed_filetypes" cols="21" rows="4" style="width: 65%;" wrap="hard" ><?php echo $config['allowed_filetypes']; ?></textarea>
+            </td>
+        </tr>
     </tbody>
 </table>
 <p style="padding-left:250px;">