X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Flibs%2Fregister_functions.php;h=8ed526a227bdc66e81344fd1b042fa6d70ae22c1;hp=575f193a548304c1a68b9e10089c61a0083aa855;hb=7b0f17cd637e388049d2167811e4332cec1e979b;hpb=aea4f2a51ffa6f483056c6ce167c8c6fd8ca6129 diff --git a/inc/libs/register_functions.php b/inc/libs/register_functions.php index 575f193a54..8ed526a227 100644 --- a/inc/libs/register_functions.php +++ b/inc/libs/register_functions.php @@ -43,7 +43,7 @@ if (!defined('__SECURITY')) { } // -function REGISTER_FILL_MUST_CONSTANTS () { +function registerMustFillout () { $result = SQL_QUERY("SELECT field_name, field_required FROM `{!_MYSQL_PREFIX!}_must_register` ORDER BY `id`", __FUNCTION__, __LINE__); @@ -59,6 +59,7 @@ function REGISTER_FILL_MUST_CONSTANTS () { SQL_FREERESULT($result); // Also fill other constants + // @TODO Rewrite these constants, too define('MUST_GENDER', "
 (*)
"); define('MUST_ADDY' , "
 (*)
"); define('MUST_BIRTH' , "
 (*)
"); @@ -82,7 +83,7 @@ function REGISTER_CHECK_REQUIRED_FIELDS (&$array) { if ((empty($value)) && ($chk == 'Y') && (!$country)) { // Required field not set - $array[$key] = "!"; + $array[$key] = '!'; $ret = true; } } @@ -95,13 +96,13 @@ function REGISTER_CHECK_REQUIRED_FIELDS (&$array) { // function REGISTER_OUTPUT_REQUIRE_CHECK (&$array) { - $result = SQL_QUERY("SELECT field_name, field_required FROM `{!_MYSQL_PREFIX!}_must_register` ORDER BY `id`", __FUNCTION__, __LINE__); + $result = SQL_QUERY("SELECT `field_name`, `field_required` FROM `{!_MYSQL_PREFIX!}_must_register` ORDER BY `id`", __FUNCTION__, __LINE__); while ($content = SQL_FETCHARRAY($result)) { - if (($array[$content['field_name']] == "!") && ($content['field_required'] == 'Y')) { + if (($array[$content['field_name']] == '!') && ($content['field_required'] == 'Y')) { // Empty entry found $array[$content['field_name']] = ''; $OUT = constant('REGISTER_'.strtoupper($content['field_name']).'_REQUIRED'); - OUTPUT_HTML("
".$OUT."
"); + registerOutputFailedMessage('', $OUT); } // END - if } // END - while @@ -109,8 +110,8 @@ function REGISTER_OUTPUT_REQUIRE_CHECK (&$array) { SQL_FREERESULT($result); } -// -function REGISTER_ADD_CATEGORY_TABLE ($mode, $return=false) { +// Generates a 'category table' for the registration form +function registerGenerateCategoryTable ($mode, $return=false) { $OUT = ''; // Guests are mostly not interested in how many members has @@ -121,7 +122,7 @@ function REGISTER_ADD_CATEGORY_TABLE ($mode, $return=false) { if (IS_ADMIN()) $AND = ''; // Look for categories - $result = SQL_QUERY("SELECT id, cat, visible FROM `{!_MYSQL_PREFIX!}_cats` ".$AND." ORDER BY `sort`", + $result = SQL_QUERY("SELECT `id`, `cat`, `visible` FROM `{!_MYSQL_PREFIX!}_cats` ".$AND." ORDER BY `sort` ASC", __FUNCTION__, __LINE__); if (SQL_NUMROWS($result) > 0) { @@ -139,8 +140,8 @@ function REGISTER_ADD_CATEGORY_TABLE ($mode, $return=false) { $content = array( 'sw' => $SW, 'cat' => $content['cat'], - 'def_y' => "", - 'def_n' => "", + 'def_y' => '', + 'def_n' => '', 'id' => $content['id'], ); @@ -171,5 +172,15 @@ function REGISTER_ADD_CATEGORY_TABLE ($mode, $return=false) { OUTPUT_HTML($OUT); } } + +// Outputs a 'failed message' +function registerOutputFailedMessage ($messageId, $extra='') { + if (empty($messageId)) { + OUTPUT_HTML('
' . $extra . '
'); + } else { + OUTPUT_HTML('
{--' . $messageId . '--}' . $extra . '
'); + } +} + // ?>