Deleting of surfbar URLs added, a lot templates rewritten
[mailer.git] / inc / modules / admin / admin-inc.php
index 0c32844379b89018a2b34a4dc563cbaeacb4a81e..86bcda7b13f3ed3f10c8752ee2e07be2ea9cbdfb 100644 (file)
@@ -508,10 +508,10 @@ function ADD_MEMBER_SELECTION_BOX ($def="0", $add_all=false, $return=false, $non
        // Free memory
        SQL_FREERESULT($result);
 
-       // Remeber options in constant
-       define('_MEMBER_SELECTION', $OUT);
-
        if (!$return) {
+               // Remeber options in constant
+               define('_MEMBER_SELECTION', $OUT);
+
                // Display selection box
                define('__LANG_VALUE', GET_LANGUAGE());
 
@@ -786,10 +786,16 @@ function ADMIN_BUILD_LIST ($listType, $IDs, $table, $columns, $filterFunctions,
                                $content = SQL_FETCHARRAY($result);
 
                                // Filter all data
-                               foreach ($content as $key=>$value) {
+                               foreach ($content as $key => $value) {
                                        // Search index
                                        $idx = array_search($key, $columns, true);
 
+                                       // Do we have a userid?
+                                       if ($key == "userid") {
+                                               // Add it again as raw id
+                                               $content['uid'] = bigintval($value);
+                                       } // END - if
+
                                        // Handle the call in external function
                                        $content[$key] = HANDLE_EXTRA_VALUES($filterFunctions[$idx], $value, $extraValues[$idx]);
                                } // END - foreach
@@ -797,15 +803,17 @@ function ADMIN_BUILD_LIST ($listType, $IDs, $table, $columns, $filterFunctions,
                                // Add color switching
                                $content['sw'] = $SW;
 
-                               // Then list it again...
+                               // Then list it
                                $OUT .= LOAD_TEMPLATE("admin_".$listType."_".$table."_row", true, $content);
+
+                               // Switch color
                                $SW = 3 - $SW;
-                       }
+                       } // END - if
 
                        // Free the result
                        SQL_FREERESULT($result);
-               }
-       }
+               } // END - if
+       } // END - foreach
 
        // Load master template
        LOAD_TEMPLATE("admin_".$listType."_".$table."", false, $OUT);
@@ -820,6 +828,40 @@ function ADMIN_DELETE_ENTRIES_CONFIRM ($IDs, $table, $columns=array(), $filterFu
                        $SQL = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_%s WHERE %s IN (%s)";
                        $idList = "";
                        foreach ($IDs as $id => $sel) {
+                               // Is there a userid?
+                               if (isset($_POST['uid'][$id])) {
+                                       // Load all data from that id
+                                       $result = SQL_QUERY_ESC("SELECT * FROM "._MYSQL_PREFIX."_%s WHERE %s=%s LIMIT 1",
+                                               array($table, $idColumn, $id), __FILE__, __LINE__);
+
+                                       // Fetch the data
+                                       $content = SQL_FETCHARRAY($result);
+
+                                       // Free the result
+                                       SQL_FREERESULT($result);
+
+                                       // Do we have a *real* userid?
+                                       if ($_POST['uid'][$id] > 0) {
+                                               // Generate subject
+                                               $eval = "\$subject = MEMBER_DEL_".strtoupper($table)."_SUBJECT;";
+                                               eval($eval);
+
+                                               // Load email template
+                                               $mail = LOAD_EMAIL_TEMPLATE("member_del_".$table, $content);
+
+                                               // Send email out
+                                               SEND_EMAIL($_POST['uid'][$id], $subject, $mail);
+                                       } // END - if
+
+                                       // Generate subject
+                                       $eval = "\$subject = ADMIN_DEL_".strtoupper($table)."_SUBJECT;";
+                                       eval($eval);
+
+                                       // Send admin notification out
+                                       SEND_ADMIN_NOTIFICATION($subject, "admin_del_".$table, $content, $_POST['uid'][$id]);
+                               } // END - if
+
+                               // Add id number
                                $idList .= $id.",";
                        } // END - if