X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fadmin-inc.php;h=cf46a9366eec52d36dc4ac18b2a0037248ff37a4;hp=2f9bd54d5a8c13873776e11da90e8e2969791d1e;hb=98e932344cf1462454f0a875a25fed3d1df4f812;hpb=6d8886333b637f5bace7d9a6e4e04cf28d3fbf2e diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 2f9bd54d5a..cf46a9366e 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -720,7 +720,7 @@ function adminChangeActivationStatus ($IDs, $table, $row, $idRow = 'id') { } // Send mails for del/edit/lock build modes -function sendAdminBuildMails ($mode, $table, $content, $id, $subjectPart = '') { +function sendAdminBuildMails ($mode, $table, $content, $id, $subjectPart = '', $userid = 'userid_raw') { // Default subject is the subject part $subject = $subjectPart; @@ -731,7 +731,7 @@ function sendAdminBuildMails ($mode, $table, $content, $id, $subjectPart = '') { } // END - if // Is the raw userid set? - if (postRequestParameter('userid_raw', $id) > 0) { + if (postRequestParameter($userid, $id) > 0) { // Generate subject $subjectLine = getMessage('MEMBER_'.strtoupper($subject).'_'.strtoupper($table).'_SUBJECT'); @@ -743,7 +743,7 @@ function sendAdminBuildMails ($mode, $table, $content, $id, $subjectPart = '') { } // Send email out - sendEmail(postRequestParameter('userid_raw', $id), $subjectLine, $mail); + sendEmail(postRequestParameter($userid, $id), $subjectLine, $mail); } // END - if // Generate subject @@ -751,14 +751,14 @@ function sendAdminBuildMails ($mode, $table, $content, $id, $subjectPart = '') { // Send admin notification out if (!empty($subjectPart)) { - sendAdminNotification($subjectLine, 'admin_' . $mode . '_' . strtolower($subjectPart) . '_' . $table, $content, postRequestParameter('userid_raw', $id)); + sendAdminNotification($subjectLine, 'admin_' . $mode . '_' . strtolower($subjectPart) . '_' . $table, $content, postRequestParameter($userid, $id)); } else { - sendAdminNotification($subjectLine, 'admin_' . $mode . '_' . $table, $content, postRequestParameter('userid_raw', $id)); + sendAdminNotification($subjectLine, 'admin_' . $mode . '_' . $table, $content, postRequestParameter($userid, $id)); } } // Build a special template list -function adminListBuilder ($listType, $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn) { +function adminListBuilder ($listType, $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $userid = 'userid_raw') { $OUT = ''; $SW = 2; // "Walk" through all entries @@ -782,7 +782,7 @@ function adminListBuilder ($listType, $IDs, $table, $columns, $filterFunctions, // Do we have a userid? if ($key == 'userid') { // Add it again as raw id - $content['userid_raw'] = bigintval($value); + $content[$userid] = bigintval($value); } // END - if // If the key matches the idColumn variable, we need to temporary remember it @@ -824,7 +824,7 @@ function adminListBuilder ($listType, $IDs, $table, $columns, $filterFunctions, } // Change status of "build" list -function adminBuilderStatusHandler ($mode, $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $statusArray) { +function adminBuilderStatusHandler ($mode, $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $statusArray, $userid = 'userid_raw') { // All valid entries? (We hope so here!) if ((is_array($IDs)) && (count($IDs) > 0) && (count($columns) == count($filterFunctions)) && (count($columns) == count($extraValues)) && (count($statusArray) > 0)) { // "Walk" through all entries @@ -861,7 +861,7 @@ function adminBuilderStatusHandler ($mode, $IDs, $table, $columns, $filterFuncti } // END - if } elseif (isset($content[$column])) { // Unfinished! - app_die(__FUNCTION__, __LINE__, ":UNFINISHED: id={$id}/{$column}[".gettype($statusInfo)."] = {$content[$column]}"); + debug_report_bug(__FUNCTION__, __LINE__, ":UNFINISHED: id={$id}/{$column}[".gettype($statusInfo)."] = {$content[$column]}"); } } // END - foreach @@ -871,7 +871,7 @@ function adminBuilderStatusHandler ($mode, $IDs, $table, $columns, $filterFuncti logDebugMessage(__FUNCTION__, __LINE__, 'Found entry: ' . $key); // Skip id, raw userid and 'do_$mode' - if (!in_array($key, array($idColumn, 'userid_raw', ('do_' . $mode)))) { + if (!in_array($key, array($idColumn, $userid, ('do_' . $mode)))) { // Are there brackets () at the end? if (substr($entries[$id], -2, 2) == '()') { // Direct SQL command found @@ -913,22 +913,26 @@ function adminBuilderStatusHandler ($mode, $IDs, $table, $columns, $filterFuncti } // Delete rows by given id numbers -function adminDeleteEntriesConfirm ($IDs, $table, $columns=array(), $filterFunctions=array(), $extraValues=array(), $deleteNow=false, $idColumn='id', $userIdColumn='userid') { +function adminDeleteEntriesConfirm ($IDs, $table, $columns = array(), $filterFunctions = array(), $extraValues = array(), $deleteNow = false, $idColumn = 'id', $userIdColumn = 'userid', $userid = 'userid_raw') { // All valid entries? (We hope so here!) if ((is_array($IDs)) && (count($IDs) > 0) && (count($columns) == count($filterFunctions)) && (count($columns) == count($extraValues))) { // Shall we delete here or list for deletion? if ($deleteNow === true) { // The base SQL command: - $sql = "DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_%s` WHERE %s IN (%s)"; + $sql = "DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s` IN (%s)"; // Delete them all $idList = ''; foreach ($IDs as $id => $sel) { // Is there a userid? - if (isPostRequestParameterSet('userid_raw', $id)) { + if (isPostRequestParameterSet($userid, $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), __FUNCTION__, __LINE__); + $result = SQL_QUERY_ESC("SELECT * FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`=%s LIMIT 1", + array( + $table, + $idColumn, + $id + ), __FUNCTION__, __LINE__); // Fetch the data $content = SQL_FETCHARRAY($result); @@ -945,7 +949,7 @@ function adminDeleteEntriesConfirm ($IDs, $table, $columns=array(), $filterFunct } // END - foreach // Run the query - SQL_QUERY($sql, array($table, $idColumn, substr($idList, 0, -1)), __FUNCTION__, __LINE__); + SQL_QUERY_ESC($sql, array($table, $idColumn, substr($idList, 0, -1)), __FUNCTION__, __LINE__); // Was this fine? if (SQL_AFFECTEDROWS() == count($IDs)) { @@ -963,7 +967,7 @@ function adminDeleteEntriesConfirm ($IDs, $table, $columns=array(), $filterFunct } // Edit rows by given id numbers -function adminEditEntriesConfirm ($IDs, $table, $columns=array(), $filterFunctions=array(), $extraValues=array(), $editNow=false, $idColumn='id', $userIdColumn='userid') { +function adminEditEntriesConfirm ($IDs, $table, $columns = array(), $filterFunctions = array(), $extraValues = array(), $editNow = false, $idColumn = 'id', $userIdColumn = 'userid', $userid = 'userid_raw') { // All valid entries? (We hope so here!) if ((is_array($IDs)) && (count($IDs) > 0) && (count($columns) == count($filterFunctions)) && (count($columns) == count($extraValues))) { // Shall we change here or list for editing? @@ -980,7 +984,7 @@ function adminEditEntriesConfirm ($IDs, $table, $columns=array(), $filterFunctio ); foreach (postRequestArray() as $key => $entries) { // Skip raw userid which is always invalid - if ($key == 'userid_raw') { + if ($key == $userid) { // Continue with next field continue; } // END - if @@ -1201,7 +1205,7 @@ function adminUpdateTaskData ($id, $row, $data) { // Is the id not set, then we need a backtrace here... :( if ($id <= 0) { // Initiate backtrace - debug_report_bug(sprintf("id is invalid: %s. row=%s, data=%s", + debug_report_bug(__FUNCTION__, __LINE__, sprintf("id is invalid: %s. row=%s, data=%s", $id, $row, $data @@ -1268,7 +1272,7 @@ function generateAdminLink ($adminId) { $adminLink = '' . $login . ''; } else { // Extension not found - $adminLink = getMaskedMessage('EXTENSION_PROBLEM_NOT_INSTALLED', 'admins'); + $adminLink = getMaskedMessage('EXTENSION_PROBLEM_EXTENSION_NOT_INSTALLED', 'admins'); } } else { // Maybe deleted?