diff --git a/scp/apikeys.php b/scp/apikeys.php
index f9293f6053125b6f72f82056ee4466a1086b58c1..e393a31c5f2bea0647a238240ba5e9021ad3c9ab 100644
--- a/scp/apikeys.php
+++ b/scp/apikeys.php
@@ -46,7 +46,7 @@ if($_POST){
                 $count=count($_POST['ids']);
                 if($_POST['enable']){
                     $sql='UPDATE '.API_KEY_TABLE.' SET isactive=1 WHERE id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).')';
+                        implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())){
                         if($num==$count)
                             $msg='Selected API keys enabled';
@@ -57,7 +57,7 @@ if($_POST){
                     }
                 }elseif($_POST['disable']){
                     $sql='UPDATE '.API_KEY_TABLE.' SET isactive=0  WHERE id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).')';
+                        implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())) {
                         if($num==$count)
                             $msg='Selected API keys disabled';
diff --git a/scp/banlist.php b/scp/banlist.php
index faa709fd3e3aeb1cc81878ad99c885e2b84d56d3..081fde9b4ed0cd18713cab78e795c2e0eaf1df1b 100644
--- a/scp/banlist.php
+++ b/scp/banlist.php
@@ -71,7 +71,7 @@ if($_POST && !$errors && $filter){
                     $sql='UPDATE '.EMAIL_FILTER_RULE_TABLE.' SET isactive=1 WHERE filter_id='.
                             db_input($filter->getId()).
                          ' AND id IN ('.
-                            implode(',', array_map('db_input', $_POST['ids'])).')';
+                            implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())){
                         if($num==$count)
                             $msg='Selected emails ban status set to enabled';
@@ -84,7 +84,7 @@ if($_POST && !$errors && $filter){
                     $sql='UPDATE '.EMAIL_FILTER_RULE_TABLE.' SET isactive=0 WHERE filter_id='.
                             db_input($filter->getId()).
                          ' AND id IN ('.
-                            implode(',', array_map('db_input', $_POST['ids'])).')';
+                            implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())) {
                         if($num==$count)
                             $msg='Selected emails ban status set to disabled';
diff --git a/scp/canned.php b/scp/canned.php
index fa208a273bb9e3fc21833b9fa747a3d1ab40be73..2a2252233627510e35f0f12da6f9c916751c8143 100644
--- a/scp/canned.php
+++ b/scp/canned.php
@@ -72,7 +72,7 @@ if($_POST && $thisstaff->canManageCannedResponses()) {
                 $count=count($_POST['ids']);
                 if($_POST['enable']) {
                     $sql='UPDATE '.CANNED_TABLE.' SET isenabled=1 WHERE canned_id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).')';
+                        implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())) {
                         if($num==$count)
                             $msg='Selected canned replies enabled';
@@ -83,7 +83,7 @@ if($_POST && $thisstaff->canManageCannedResponses()) {
                     }
                 } elseif($_POST['disable']) {
                     $sql='UPDATE '.CANNED_TABLE.' SET isenabled=0 WHERE canned_id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).')';
+                        implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())) {
                         if($num==$count)
                             $msg='Selected canned replies disabled';
diff --git a/scp/categories.php b/scp/categories.php
index ed98da8979e6b2070195c00e7047aceb18cd86a0..6b645fc847737e335feb0c474d868b819f8c7c2d 100644
--- a/scp/categories.php
+++ b/scp/categories.php
@@ -53,7 +53,7 @@ if($_POST){
                 $count=count($_POST['ids']);
                 if($_POST['public']) {
                     $sql='UPDATE '.FAQ_CATEGORY_TABLE.' SET ispublic=1 WHERE category_id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).')';
+                        implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())) {
                         if($num==$count)
                             $msg='Selected categories made PUBLIC';
@@ -64,7 +64,7 @@ if($_POST){
                     }
                 } elseif($_POST['private']) {
                     $sql='UPDATE '.FAQ_CATEGORY_TABLE.' SET ispublic=0 WHERE category_id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).')';
+                        implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())) {
                         if($num==$count)
                             $msg='Selected categories made PRIVATE';
diff --git a/scp/departments.php b/scp/departments.php
index ae03b6385d9cd7120e22a5d415dfbef32c130aa9..ef1acb12d62adcaa3c6285a210e7aa9d3f57fc29 100644
--- a/scp/departments.php
+++ b/scp/departments.php
@@ -46,7 +46,7 @@ if($_POST){
                 $count=count($_POST['ids']);
                 if($_POST['public']){
                     $sql='UPDATE '.DEPT_TABLE.' SET ispublic=1 WHERE dept_id IN ('
-                        .implode(',', array_map('db_input', $_POST['ids'])).')';
+                        .implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())){
                         if($num==$count)
                             $msg='Selected departments made public';
@@ -58,7 +58,7 @@ if($_POST){
                 }elseif($_POST['private']){
                     $sql='UPDATE '.DEPT_TABLE.' SET ispublic=0  '.
                          'WHERE dept_id IN ('
-                            .implode(',', array_map('db_input', $_POST['ids']))
+                            .implode(',', db_input($_POST['ids']))
                         .') AND dept_id!='.db_input($cfg->getDefaultDeptId());
                     if(db_query($sql) && ($num=db_affected_rows())) {
                         if($num==$count)
@@ -72,7 +72,7 @@ if($_POST){
                 }elseif($_POST['delete']){
                     //Deny all deletes if one of the selections has members in it.
                     $sql='SELECT count(staff_id) FROM '.STAFF_TABLE.' WHERE dept_id IN ('
-                        .implode(',', array_map('db_input', $_POST['ids'])).')';
+                        .implode(',', db_input($_POST['ids'])).')';
                     list($members)=db_fetch_row(db_query($sql));
                     if($members)
                         $errors['err']='Dept. with users can not be deleted. Move staff first.';
diff --git a/scp/emails.php b/scp/emails.php
index fa8a150d7d7285806f10fce23f4855c8d5c4e1bf..b0d32bb59bf9d415275aaada58c96cf3df892629 100644
--- a/scp/emails.php
+++ b/scp/emails.php
@@ -47,9 +47,9 @@ if($_POST){
 
                 $sql='SELECT count(dept_id) FROM '.DEPT_TABLE.' dept '.
                      'WHERE email_id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).
+                        implode(',', db_input($_POST['ids'])).
                      ') OR autoresp_email_id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).')';
+                        implode(',', db_input($_POST['ids'])).')';
                 list($depts)=db_fetch_row(db_query($sql));
                 if($depts>0){
                     $errors['err']='One or more of the selected emails is being used by a department. Remove association first!';
diff --git a/scp/filters.php b/scp/filters.php
index ce61a7ea93b6a65db8654828d07302c830e63e19..4ce0f30765f5192617f22345c00571f26d206af2 100644
--- a/scp/filters.php
+++ b/scp/filters.php
@@ -50,7 +50,7 @@ if($_POST){
                 $count=count($_POST['ids']);
                 if($_POST['enable']){
                     $sql='UPDATE '.EMAIL_FILTER_TABLE.' SET isactive=1 WHERE id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).')';
+                        implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())){
                         if($num==$count)
                             $msg='Selected filters enabled';
@@ -61,7 +61,7 @@ if($_POST){
                     }
                 }elseif($_POST['disable']){
                     $sql='UPDATE '.EMAIL_FILTER_TABLE.' SET isactive=0  WHERE id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).')';
+                        implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())) {
                         if($num==$count)
                             $msg='Selected filters disabled';
diff --git a/scp/groups.php b/scp/groups.php
index aa2ee2d11332ab850207e4941447d2ef477fcc03..22b1bae0acb36959fff05ec3f75323a691053920 100644
--- a/scp/groups.php
+++ b/scp/groups.php
@@ -44,7 +44,7 @@ if($_POST){
                 $count=count($_POST['ids']);
                 if($_POST['enable']){
                     $sql='UPDATE '.GROUP_TABLE.' SET group_enabled=1, updated=NOW() WHERE group_id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).')';
+                        implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())){
                         if($num==$count)
                             $msg='Selected groups activated';
@@ -55,7 +55,7 @@ if($_POST){
                     }
                 }elseif($_POST['disable']){
                     $sql='UPDATE '.GROUP_TABLE.' SET group_enabled=0, updated=NOW() WHERE group_id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).')';
+                        implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())) {
                         if($num==$count)
                             $msg='Selected groups disabled';
diff --git a/scp/helptopics.php b/scp/helptopics.php
index 45a288f41f0ffe9f5bde9078270ad17a8fc9eb5a..5bd1ded7048f26307f2cd18d09d6b3a946f13f65 100644
--- a/scp/helptopics.php
+++ b/scp/helptopics.php
@@ -46,7 +46,7 @@ if($_POST){
                 $count=count($_POST['ids']);
                 if($_POST['enable']){
                     $sql='UPDATE '.TOPIC_TABLE.' SET isactive=1 WHERE topic_id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).')';
+                        implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())){
                         if($num==$count)
                             $msg='Selected help topics enabled';
@@ -57,7 +57,7 @@ if($_POST){
                     }
                 }elseif($_POST['disable']){
                     $sql='UPDATE '.TOPIC_TABLE.' SET isactive=0  WHERE topic_id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).')';
+                        implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())) {
                         if($num==$count)
                             $msg='Selected help topics disabled';
diff --git a/scp/logs.php b/scp/logs.php
index b34126f5defe58184f76f9f4e8f4c9e810b2f49e..e29ef3702a50cd8949cc355b99b5a12dcb0ceadd 100644
--- a/scp/logs.php
+++ b/scp/logs.php
@@ -24,7 +24,7 @@ if($_POST){
                 $count=count($_POST['ids']);
                 if($_POST['delete']){
                     $sql='DELETE FROM '.SYSLOG_TABLE.' WHERE log_id IN ('
-                        .implode(',', array_map('db_input', $_POST['ids'])).')';
+                        .implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())){
                         if($num==$count)
                             $msg='Selected logs deleted successfully';
diff --git a/scp/slas.php b/scp/slas.php
index 8c7c1b4affd5e7263002cdeef5d8ad0e83e011eb..8f3b0f75ca331381beb6a348f46c2a703853b229 100644
--- a/scp/slas.php
+++ b/scp/slas.php
@@ -46,7 +46,7 @@ if($_POST){
                 $count=count($_POST['ids']);
                 if($_POST['enable']){
                     $sql='UPDATE '.SLA_TABLE.' SET isactive=1 WHERE id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).')';
+                        implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())){
                         if($num==$count)
                             $msg='Selected SLA plans enabled';
@@ -57,7 +57,7 @@ if($_POST){
                     }
                 }elseif($_POST['disable']){
                     $sql='UPDATE '.SLA_TABLE.' SET isactive=0  WHERE id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).')';
+                        implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())) {
                         if($num==$count)
                             $msg='Selected SLA plans disabled';
diff --git a/scp/staff.php b/scp/staff.php
index eacafb3175c209f8a5dead599329491cc531eab8..88c8949f9908542067bf0ebc03e64781c5ce0b08 100644
--- a/scp/staff.php
+++ b/scp/staff.php
@@ -46,7 +46,7 @@ if($_POST){
                 $count=count($_POST['ids']);
                 if($_POST['enable']){
                     $sql='UPDATE '.STAFF_TABLE.' SET isactive=1 WHERE staff_id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).')';
+                        implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())){
                         if($num==$count)
                             $msg='Selected staff activated';
diff --git a/scp/teams.php b/scp/teams.php
index 2fcbb1b1ec1cce26538fddb55e69b960d7747476..50d7ca1cae022dd328189b9d8ffdaaad1727c533 100644
--- a/scp/teams.php
+++ b/scp/teams.php
@@ -44,7 +44,7 @@ if($_POST){
                 $count=count($_POST['ids']);
                 if($_POST['enable']){
                     $sql='UPDATE '.TEAM_TABLE.' SET isenabled=1 WHERE team_id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).')';
+                        implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())){
                         if($num==$count)
                             $msg='Selected teams activated';
@@ -55,7 +55,7 @@ if($_POST){
                     }
                 }elseif($_POST['disable']){
                     $sql='UPDATE '.TEAM_TABLE.' SET isenabled=0 WHERE team_id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).')';
+                        implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())) {
                         if($num==$count)
                             $msg='Selected teams disabled';
diff --git a/scp/templates.php b/scp/templates.php
index b87713662627dc2044a336609786d469973ed4f4..4ba95d70a8a707422bf011781b6df9ab292a5f9f 100644
--- a/scp/templates.php
+++ b/scp/templates.php
@@ -55,7 +55,7 @@ if($_POST){
                 $count=count($_POST['ids']);
                 if($_POST['enable']){
                     $sql='UPDATE '.EMAIL_TEMPLATE_TABLE.' SET isactive=1 WHERE tpl_id IN ('.
-                        implode(',', array_map('db_input', $_POST['ids'])).')';
+                        implode(',', db_input($_POST['ids'])).')';
                     if(db_query($sql) && ($num=db_affected_rows())){
                         if($num==$count)
                             $msg='Selected templates enabled';