From: Roland Häder Date: Wed, 10 Aug 2011 19:38:10 +0000 (+0000) Subject: Extension ext-admins improved: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c16ab2169b75a7dafb5b0b55523e9fe6f4f5efdb;p=mailer.git Extension ext-admins improved: - The menu point what-admins_contct does now provide a shiny new selection box fully made of templates - Fixed admin contact link (still there are a lot copies around in the script) - TODOs.txt updated --- diff --git a/.gitattributes b/.gitattributes index 6f67363f55..22227754c1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1885,6 +1885,8 @@ templates/de/html/removeip_level.tpl svneol=native#text/plain templates/de/html/runtime_fatal_row.tpl svneol=native#text/plain templates/de/html/runtime_fatal_table.tpl svneol=native#text/plain templates/de/html/select/.htaccess svneol=native#text/plain +templates/de/html/select/select_admins_box.tpl svneol=native#text/plain +templates/de/html/select/select_admins_option.tpl svneol=native#text/plain templates/de/html/select/select_forced_ads_type_box.tpl svneol=native#text/plain templates/de/html/select/select_forced_ads_type_option.tpl svneol=native#text/plain templates/de/html/select/select_network_box.tpl svneol=native#text/plain diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 738b121c41..6bd635e7b7 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -55,16 +55,16 @@ ./inc/functions.php:2236: // @TODO Rename column data_type to e.g. mail_status ./inc/gen_sql_patches.php:95:// @TODO Rewrite this to a filter ./inc/install-functions.php:57: // @TODO DEACTIVATED: changeDataInLocalConfigurationFile('OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestElement('omode'), 0); -./inc/language/de.php:1071: // @TODO Rewrite these two constants -./inc/language/de.php:1087: // @TODO Rewrite these three constants -./inc/language/de.php:757:// @TODO Are these constants longer used? +./inc/language/de.php:1072: // @TODO Rewrite these two constants +./inc/language/de.php:1088: // @TODO Rewrite these three constants +./inc/language/de.php:758:// @TODO Are these constants longer used? ./inc/language-functions.php:255: // @TODO These are all valid languages, again hard-coded ./inc/language-functions.php:44:// @TODO Rewrite all language constants to this function. ./inc/language/newsletter_de.php:13: * @TODO This language file is completely out-dated, please do no * ./inc/language/rallye_de.php:13: * @TODO Naming convention not applied for language strings * ./inc/language/refback_de.php:53: // @TODO Rewrite these constants to one ./inc/language/sponsor_de.php:117:// @TODO Rewrite these four constants to one and use sprintf() -./inc/libs/admins_functions.php:505: // @TODO This can be, somehow, rewritten +./inc/libs/admins_functions.php:508: // @TODO This can be, somehow, rewritten ./inc/libs/bonus_functions.php:194: // @TODO Move this HTML to a template ./inc/libs/doubler_functions.php:44:// @TODO Lame description ./inc/libs/doubler_functions.php:93: // @TODO Can't this be moved into EL? @@ -90,12 +90,12 @@ ./inc/mails/doubler_mails.php:53:// @TODO Can this be rewritten to a filter? ./inc/module-functions.php:267: // @TODO Nothing helped??? ./inc/module-functions.php:308: // @TODO Rewrite this to a filter -./inc/modules/admin/admin-inc.php:1379: // @TODO If we can rewrite the EL sub-system to support more than one parameter, this call_user_func_array() can be avoided +./inc/modules/admin/admin-inc.php:1420: // @TODO If we can rewrite the EL sub-system to support more than one parameter, this call_user_func_array() can be avoided ./inc/modules/admin/admin-inc.php:171: // @TODO This and the next getCurrentAdminId() call might be moved into the templates? ./inc/modules/admin/admin-inc.php:242: // @TODO This can be rewritten into a filter ./inc/modules/admin/admin-inc.php:274: // @TODO Rewrite this to $content = SQL_FETCHARRAY() ./inc/modules/admin/admin-inc.php:340: // @TODO Rewrite this to $content = SQL_FETCHARRAY() -./inc/modules/admin/admin-inc.php:444:// @TODO Try to rewrite this to adminAddMenuSelectionBox() +./inc/modules/admin/admin-inc.php:485:// @TODO Try to rewrite this to adminAddMenuSelectionBox() ./inc/modules/admin/overview-inc.php:162: // @TODO Rewrite this to a filter ./inc/modules/admin/overview-inc.php:275: // @TODO Rewrite this to something with include files and/or filter ./inc/modules/admin/overview-inc.php:309: // @TODO This may also be rewritten to include files @@ -149,7 +149,7 @@ ./inc/modules/guest/what-login.php:125: // @TODO Move this HTML code into a template ./inc/modules/guest/what-mediadata.php:182:// @TODO Rewrite all these if-blocks to filters ./inc/modules/guest/what-mediadata.php:67: // @TODO Find a better formular than this one -./inc/modules/guest/what-rallyes.php:89: // @TODO Reactivate this: $content['admin'] = '' . $login . ''; +./inc/modules/guest/what-rallyes.php:89: // @TODO Reactivate this: $content['admin'] = '' . $login . ''; ./inc/modules/guest/what-sponsor_reg.php:289: // @TODO Maybe a default referal id? ./inc/modules/guest/what-stats.php:108: // @TODO This can be somehow rewritten ./inc/modules/guest/what-stats.php:82:// @TODO This can be rewritten in a dynamic include @@ -161,7 +161,7 @@ ./inc/modules/member/what-order.php:82: // @TODO Rewrite this to SQL_FETCHARRAY() ./inc/modules/member/what-payout.php:194: // @TODO Rewrite this to a filter ./inc/modules/member/what-points.php:55:// @TODO Should we rewrite this to a filter? -./inc/modules/member/what-rallyes.php:89: // @TODO Reactivate this: $content['admin'] = '' . $content['login'] . ''; +./inc/modules/member/what-rallyes.php:89: // @TODO Reactivate this: $content['admin'] = '' . $content['login'] . ''; ./inc/modules/member/what-reflinks.php:52:// @TODO Move this into a filter ./inc/modules/member/what-transfer.php:128: // @TODO Rewrite this to a filter ./inc/modules/member/what-unconfirmed.php:162: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY() @@ -175,15 +175,15 @@ ./inc/mysql-manager.php:44:// @TODO Can we cache this? ./inc/purge/purge-inact.php:55: // @TODO Rewrite these if() blocks to a filter ./inc/revision-functions.php:169:// @TODO This function does also set and get in 'cache_array' -./inc/template-functions.php:1068: // @TODO Deprecate this thing -./inc/template-functions.php:1079: // @TODO Deprecate this thing -./inc/template-functions.php:1169: // @TODO This can be easily moved out after the merge from EL branch to this is complete -./inc/template-functions.php:1202: // @TODO Add a little more infos here -./inc/template-functions.php:1531:// @TODO Lame description for this function -./inc/template-functions.php:1553: // @TODO Move this in a filter +./inc/template-functions.php:1070: // @TODO Deprecate this thing +./inc/template-functions.php:1081: // @TODO Deprecate this thing +./inc/template-functions.php:1171: // @TODO This can be easily moved out after the merge from EL branch to this is complete +./inc/template-functions.php:1204: // @TODO Add a little more infos here +./inc/template-functions.php:1533:// @TODO Lame description for this function +./inc/template-functions.php:1555: // @TODO Move this in a filter ./inc/template-functions.php:184: * @TODO On some pages this is buggy ./inc/template-functions.php:273: // @TODO Remove this sanity-check if all is fine -./inc/template-functions.php:596:// @TODO $simple/$constants are deprecated +./inc/template-functions.php:598:// @TODO $simple/$constants are deprecated ./inc/wrapper-functions.php:512:// @TODO Do some more sanity check here ./inc/xml-functions.php:189: // @TODO Handle characters ./mailid.php:139: // @TODO Rewrite this to a filter @@ -197,7 +197,6 @@ ./network-check.php:54:// @TODO Add processing of request here ./view.php:68: // @TODO No banner found, output some default banner ./templates/de/html/admin/admin_add_country.tpl:23: -./templates/de/html/admin/admin_admins_contct_form.tpl:4: ./templates/de/html/admin/admin_config_other.tpl:79: ./templates/de/html/admin/admin_config_rewrite.tpl:4: ./templates/de/html/admin/admin_edit_admin_menu.tpl:4: @@ -231,7 +230,7 @@ ./inc/loader/load_cache-revision.php:2:// @DEPRECATED ./inc/loader/load_cache-them.php:2:// @DEPRECATED ./inc/loader/load-extensions.php:2:// @DEPRECATED -./inc/modules/admin/admin-inc.php:445:// @DEPRECATED +./inc/modules/admin/admin-inc.php:486:// @DEPRECATED ./inc/modules/admin/what-chk_regs.php:2:// @DEPRECATED ./inc/modules/admin/what-config_admins.php:2:// @DEPRECATED ./inc/modules/admin/what-config_email.php:2:// @DEPRECATED diff --git a/inc/language/admins_de.php b/inc/language/admins_de.php index 0fd5d59c52..7cf9887791 100644 --- a/inc/language/admins_de.php +++ b/inc/language/admins_de.php @@ -59,8 +59,9 @@ addMessages(array( 'ADMIN_ADMINS_CANNOT_DELETE_LAST' => "Das letzte Admin-Account kann nicht gelöscht werden.", 'ADMIN_ADMINS_SELECT_ADMIN' => "Bitte wählen Sie einen Administrator aus dem Menüpunkt Admin-Account ändern aus.", 'ADMIN_ADMINS_ADMIN_ID' => "Admin-Id", + 'ADMIN_CONTACT_ADMINS_TITLE' => "Administrator %s kontaktieren:", 'ADMIN_ADMINS_CONTACT_SUBMIT' => "Admin kontaktieren", - 'ADMIN_ADMINS_ENTER_CONTACT_TEXT' => "Kontaktgrund eingeben", + 'ADMIN_ADMINS_ENTER_CONTACT_TEXT' => "Nachricht an Administrator eingeben:", 'ADMIN_ADMINS_SELECT_CONTACT_TYPE' => "Nachricht übertragen als", 'ADMIN_ADMINS_CONTACT_TYPE_MAIL' => "Mail", 'ADMIN_ADMINS_CONTACT_TYPE_MSG' => "Nachricht", @@ -99,8 +100,9 @@ addMessages(array( 'ADMIN_ADMINS_ADD_MORE_ADMINS' => "Weiteren Admin hinzufügen", 'ADMIN_ACCOUNT_SAVED' => "Admin-Account gespeichert.", 'ADMIN_ADMINS_ERROR_PASS_MISMATCH' => "Die beiden Passwörter stimmen nicht überein.", + 'ADMIN_ADMINS_SELECTION_BOX_TITLE' => "Administrator-Account auswählen:", -// Logical area constants + // Logical area constants 'ADMIN_ADMINS_LA_MODE_GLOBAL' => "Globale Einst.", 'ADMIN_ADMINS_LA_MODE_OLD' => "Altes Menü", 'ADMIN_ADMINS_LA_MODE_NEW' => "Neues Menü", diff --git a/inc/language/de.php b/inc/language/de.php index 9af233f00b..5ba4dcc5d4 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -754,6 +754,7 @@ addMessages(array( 'ADMIN_NO_ADDITIONAL_SQLS' => "Keine weiteren SQL-Anweisungen zum Ausführen.", 'ADMIN_SQLS_EXECUTED_ON_UPDATE' => "Beim Aktualisieren ausgeführte SQL-Anweisungen", 'ADMIN_SQLS_EXECUTED_ON_REGISTER' => "SQL-Anweisungen, die beim Installieren/Updaten ausgeführt werden", + 'ADMIN_SELECT_ADMIN' => "Administrator auswählen:", // @TODO Are these constants longer used? 'ADMIN_UNKNOWN_FIELD_TYPE_1' => "Unbekannter Datentyp ", 'ADMIN_UNKNOWN_FIELD_TYPE_2' => " erkannt.", diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index 27c0a10491..407308222a 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -153,15 +153,18 @@ LIMIT 1", // Load userid list($adminId) = SQL_FETCHROW($result); - // Rewrite email address to contact link - $email = '{%url=modules.php?module=' . $mod . '&what=admins_contct&admin=' . bigintval($adminId) . '%}'; + // Call this function again + $email = generateAdminEmailLink($adminId, $mod); } // END - if // Free memory SQL_FREERESULT($result); - } elseif ((is_int($email)) && ($email > 0)) { + } elseif (isValidUserId($email)) { // Direct id given - $email = '{%url=modules.php?module=' . $mod . '&what=admins_contct&admin=' . bigintval($email) . '%}'; + $email = '{%url=modules.php?module=' . $mod . '&what=admins_contct&id=' . bigintval($email) . '%}'; + } else { + // This is strange and needs fixing + debug_report_bug(__FUNCTION__, __LINE__, 'email[' . gettype($email) . ']=' . $email . ',mod=' . $mod . ' - This should not happen.'); } // Return rewritten (?) email address diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 14d65d059e..a3f48e8480 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -389,7 +389,7 @@ ORDER BY // Free memory SQL_FREERESULT($result_main); $OUT .= ''; - } + } // END - if // Is there a cache instance again? // Return or output content? @@ -400,24 +400,65 @@ ORDER BY } } -// Create an admin selection box -function generateAdminSelectionBox ($adminId = NULL) { - // Return content - return $OUT; +// Create an admin selection box form +function addAdminSelectionBox ($adminId = NULL, $special = '') { + // Default is email as "special column" + $ADD = ',`email` AS `special`'; + + // Is a special column given? + if (!empty($special)) { + // Additional column for SQL query + $ADD = ',`' . $special . '` AS `special`'; + } // END - if + + // Query all entries + $result = SQL_QUERY('SELECT + `id`,`login`' . $ADD . ' +FROM + `{?_MYSQL_PREFIX?}_admins` +ORDER BY + `login` ASC', __FUNCTION__, __LINE__); + + // Init output + $OUT = ''; + + // Load all entries + while ($content = SQL_FETCHARRAY($result)) { + // Add the entry + $OUT .= loadTemplate('select_admins_option', true, $content); + } // END - if + + // Free memory + SQL_FREERESULT($result); + + // Add form to content + $content['form_selection'] = $OUT; + + // Output form + loadTemplate('select_admins_box', false, $content); } // Create a member selection box function addMemberSelectionBox ($userid = NULL, $add_all = false, $return = false, $none = false, $field = 'userid') { // Output selection form with all confirmed user accounts listed - $result = SQL_QUERY('SELECT `userid`,`surname`,`family` FROM `{?_MYSQL_PREFIX?}_user_data` ORDER BY `userid` ASC', __FUNCTION__, __LINE__); + $result = SQL_QUERY('SELECT + `userid`,`surname`,`family` +FROM + `{?_MYSQL_PREFIX?}_user_data` +ORDER BY + `userid` ASC', __FUNCTION__, __LINE__); // Default output $OUT = ''; // USe this only for adding points (e.g. adding refs really makes no sence ;-) ) - if ($add_all === true) $OUT = ' '; - elseif ($none === true) $OUT = ' '; + if ($add_all === true) { + $OUT = ' '; + } elseif ($none === true) { + $OUT = ' '; + } + // Load all entries while ($content = SQL_FETCHARRAY($result)) { $OUT .= '