]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/admin-inc.php
Adding of network advert types partly finished, hard-coded table type fixed to dynamic
[mailer.git] / inc / modules / admin / admin-inc.php
index c962ea20bf9a25003b127e37257c50944bf7bf06..97aab22bfebb4c94ab3b1e4dcd38e076af164eaa 100644 (file)
@@ -377,7 +377,7 @@ ORDER BY
                                        if (($menu == $action) && (empty($what))) {
                                                $OUT .= '<strong>';
                                        } else {
-                                               $OUT .= '[<a href="{?URL?}/modules.php?module=admin&amp;action=' . $menu . '">';
+                                               $OUT .= '[<a href="{%url=modules.php?module=admin&amp;action=' . $menu . '%}">';
                                        }
                                } else {
                                        $OUT .= '<em style="cursor:help" class="admin_note" title="{--MENU_ACTION_404--}">';
@@ -447,7 +447,7 @@ ORDER BY
                                                                if ($what == $what_sub) {
                                                                        $OUT .= '<strong>';
                                                                } else {
-                                                                       $OUT .= '[<a href="{?URL?}/modules.php?module=admin&amp;what=' . $what_sub . '">';
+                                                                       $OUT .= '[<a href="{%url=modules.php?module=admin&amp;what=' . $what_sub . '%}">';
                                                                }
                                                        } else {
                                                                $OUT .= '<em style="cursor:help" class="admin_note" title="{--MENU_WHAT_404--}">';
@@ -561,16 +561,16 @@ function adminMenuSelectionBox_DEPRECATED ($mode, $default = '', $defid = '') {
 }
 
 // Wrapper for $_POST and adminSaveSettings
-function adminSaveSettingsFromPostData ($tableName = '_config', $whereStatement = '`config`=0', $translateComma = array(), $alwaysAdd = false) {
+function adminSaveSettingsFromPostData ($tableName = '_config', $whereStatement = '`config`=0', $translateComma = array(), $alwaysAdd = false, $displayMessage = true) {
        // Get the array
        $postData = postRequestArray();
 
        // Call the lower function
-       adminSaveSettings($postData, $tableName, $whereStatement, $translateComma, $alwaysAdd);
+       adminSaveSettings($postData, $tableName, $whereStatement, $translateComma, $alwaysAdd, $displayMessage);
 }
 
 // Save settings to the database
-function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement = '`config`=0', $translateComma = array(), $alwaysAdd = false) {
+function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement = '`config`=0', $translateComma = array(), $alwaysAdd = false, $displayMessage = true) {
        // Prepare all arrays, variables
        $DATA = array();
        $skip = false;
@@ -656,11 +656,17 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement
        // Simply run generated SQL string
        SQL_QUERY($sql, __FUNCTION__, __LINE__);
 
+       // Remember affected rows
+       $affected = SQL_AFFECTEDROWS();
+
        // Rebuild cache
        rebuildCacheFile('config', 'config');
 
-       // Settings saved
-       loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
+       // Settings saved, so display message?
+       if ($displayMessage === true) loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
+
+       // Return affected rows
+       return $affected;
 }
 
 // Generate a selection box
@@ -707,7 +713,10 @@ function generateUserProfileLink ($userid, $title = '', $what = 'list_user') {
        if (($title == '') && ($userid > 0)) {
                // Set userid as title
                $title = $userid;
-       } // END - if
+       } elseif ($userid == 0) {
+               // User id zero is invalid
+               return '<strong>' . $userid . '</strong>';
+       }
 
        if (($title == '0') && ($what == 'list_refs')) {
                // Return title again
@@ -721,14 +730,14 @@ function generateUserProfileLink ($userid, $title = '', $what = 'list_user') {
        }
 
        // Return link
-       return '[<a href="{?URL?}/modules.php?module=admin&amp;what=' . $what . '&amp;userid=' . $userid . '" title="{--ADMIN_USER_PROFILE_TITLE--}">' . $title . '</a>]';
+       return '[<a href="{%url=modules.php?module=admin&amp;what=' . $what . '&amp;userid=' . $userid . '%}" title="{--ADMIN_USER_PROFILE_TITLE--}">' . $title . '</a>]';
 }
 
 // Check "logical-area-mode"
 function adminGetMenuMode () {
        // Set the global mode as the mode for all admins
        $mode = getConfig('admin_menu');
-       $ADMIN = $mode;
+       $adminMode = $mode;
 
        // Get admin id
        $adminId = getCurrentAdminId();
@@ -736,7 +745,7 @@ function adminGetMenuMode () {
        // Check individual settings of current admin
        if (isset($GLOBALS['cache_array']['admin']['la_mode'][$adminId])) {
                // Load from cache
-               $ADMIN = $GLOBALS['cache_array']['admin']['la_mode'][$adminId];
+               $adminMode = $GLOBALS['cache_array']['admin']['la_mode'][$adminId];
                incrementStatsEntry('cache_hits');
        } elseif (isExtensionInstalledAndNewer('admins', '0.6.7')) {
                // Load from database when version of 'admins' is enough
@@ -744,7 +753,7 @@ function adminGetMenuMode () {
                        array($adminId), __FUNCTION__, __LINE__);
                if (SQL_NUMROWS($result) == 1) {
                        // Load data
-                       list($ADMIN) = SQL_FETCHROW($result);
+                       list($adminMode) = SQL_FETCHROW($result);
                }
 
                // Free memory
@@ -752,7 +761,7 @@ function adminGetMenuMode () {
        }
 
        // Check what the admin wants and set it when it's not the global mode
-       if ($ADMIN != 'global') $mode = $ADMIN;
+       if ($adminMode != 'global') $mode = $adminMode;
 
        // Return admin-menu's mode
        return $mode;
@@ -1314,11 +1323,11 @@ function adminCreateUserLink ($userid) {
        // Is the userid set correctly?
        if ($userid > 0) {
                // Create a link to that profile
-               return '{?URL?}/modules.php?module=admin&amp;what=list_user&amp;userid='.bigintval($userid);
+               return '{%url=modules.php?module=admin&amp;what=list_user&amp;userid='.bigintval($userid) . '%}';
        } // END - if
 
        // Return a link to the user list
-       return '{?URL?}/modules.php?module=admin&amp;what=list_user';
+       return '{%url=modules.php?module=admin&amp;what=list_user%}';
 }
 
 // Generate a "link" for the given admin id (admin_id)