]> git.mxchange.org Git - mailer.git/blobdiff - inc/template-functions.php
SQLs fixed
[mailer.git] / inc / template-functions.php
index d15de9e25f09ac5b4ebc580789a2afd8525cef9f..08fa2e50c288b79126e14226ac601289b3c16cb7 100644 (file)
@@ -543,8 +543,8 @@ function getMenuCssClasses ($data) {
 }
 
 // Generate XHTML code for the CAPTCHA
-function generateCaptchaCode ($code, $type, $DATA, $userid) {
-       return '<img border="0" alt="Code ' . $code . '" src="{%url=mailid_top.php?userid=' . $userid . '&amp;' . $type . '=' . $DATA . '&amp;mode=img&amp;code=' . $code . '%}" />';
+function generateCaptchaCode ($code, $type, $type, $userid) {
+       return '<img border="0" alt="Code ' . $code . '" src="{%url=mailid_top.php?userid=' . $userid . '&amp;' . $type . '=' . $type . '&amp;mode=img&amp;code=' . $code . '%}" />';
 }
 
 // Compiles the given HTML/mail code
@@ -818,6 +818,7 @@ function generateImageOrCode ($img_code, $headerSent = true) {
        // Remove image from memory
        imagedestroy($image);
 }
+
 // Create selection box or array of splitted timestamp
 function createTimeSelections ($timestamp, $prefix = '', $display = '', $align = 'center', $return_array=false) {
        // Do not continue if ONE_DAY is absend
@@ -1026,7 +1027,9 @@ function createTimeSelections ($timestamp, $prefix = '', $display = '', $align =
 // Generate a list of administrative links to a given userid
 function generateMemberAdminActionLinks ($userid) {
        // Make sure userid is a number
-       if ($userid != bigintval($userid)) debug_report_bug(__FUNCTION__, __LINE__, 'userid is not a number!');
+       if ($userid != bigintval($userid)) {
+               debug_report_bug(__FUNCTION__, __LINE__, 'userid is not a number!');
+       } // END - if
 
        // Define all main targets
        $targetArray = array('del_user', 'edit_user', 'lock_user', 'add_points', 'sub_points');
@@ -1231,7 +1234,9 @@ function handleCodeMessage () {
                $ext = 'unknown';
 
                // Is extension given?
-               if (isGetRequestParameterSet('ext')) $ext = getRequestParameter('ext');
+               if (isGetRequestParameterSet('ext')) {
+                       $ext = getRequestParameter('ext');
+               } // END - if
 
                // Convert the 'code' parameter from URL to a human-readable message
                $message = getMessageFromErrorCode(getRequestParameter('code'));
@@ -1341,7 +1346,7 @@ function linenumberCode ($code)    {
                if ($count_lines == 1) {
                        $r .= 1;
                } else {
-                       $r .= ($line == ($count_lines - 1)) ? '' :  ($line+1);
+                       $r .= ($line == ($count_lines - 1)) ? '' : ($line+1);
                }
                $r .= '</span>|';
 
@@ -1588,11 +1593,11 @@ function sendModeMails ($mod, $modes) {
        }
 
        // Load template
-       loadTemplate('admin_settings_saved', false, $content['message']);
+       displayMessage($content['message']);
 }
 
 // Generates a 'selection box' from given array
-function generateSelectionBoxFromArray ($options, $name, $optionValue, $optionContent = '', $extraName = '') {
+function generateSelectionBoxFromArray (array $options, $name, $optionValue, $optionContent = '', $extraName = '') {
        // Start the output
        $OUT = '<select name="' . $name . '" size="1" class="form_select">
 <option value="X" disabled="disabled">{--PLEASE_SELECT--}</option>';
@@ -1705,6 +1710,27 @@ function translatePoolType ($type) {
        return sprintf("{--POOL_TYPE_%s--}", strtoupper($type));
 }
 
+// Displays given message in admin_settings_saved template
+function displayMessage ($message, $return = false) {
+       // Load the template
+       return loadTemplate('admin_settings_saved', $return, $message);
+}
+
+// Generates a selection box for (maybe) given gender
+function generateGenderSelectionBox ($selectedGender = '') {
+       // Start the HTML code
+       $out  = '<select name="gender" size="1" class="form_select">';
+
+       // Add the options
+       $out .= generateOptionList('/ARRAY/', array('M', 'F', 'C'), array('{--GENDER_M--}', '{--GENDER_F--}', '{--GENDER_C--}'), $selectedGender);
+
+       // Finish HTML code
+       $out .= '</select>';
+
+       // Return the code
+       return $out;
+}
+
 //-----------------------------------------------------------------------------
 //                      Template helper functions for EL
 //-----------------------------------------------------------------------------