X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffunctions.php;h=8c8d7e15bdba31c04a8f5f8a73e2b16f948daea6;hp=025f936e7db9d5948d3b07c773464e628173c5b4;hb=eeee0af1c4bb14b8438e2bfcb62dc14eb8f8fa5e;hpb=5d9f65a4efafdeda1f03cf03fc95421bc600b9dc diff --git a/inc/functions.php b/inc/functions.php index 025f936e7d..8c8d7e15bd 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -263,47 +263,47 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) { $date_time = MAKE_DATETIME(time(), "1"); // Base directory - $BASE = sprintf("%stemplates/%s/html/", constant('PATH'), GET_LANGUAGE()); - $MODE = ''; + $basePath = sprintf("%stemplates/%s/html/", constant('PATH'), GET_LANGUAGE()); + $mode = ''; // Check for admin/guest/member templates if (strpos($template, "admin_") > -1) { // Admin template found - $MODE = "admin/"; + $mode = "admin/"; } elseif (strpos($template, "guest_") > -1) { // Guest template found - $MODE = "guest/"; + $mode = "guest/"; } elseif (strpos($template, "member_") > -1) { // Member template found - $MODE = "member/"; + $mode = "member/"; } elseif (strpos($template, "install_") > -1) { // Installation template found - $MODE = "install/"; + $mode = "install/"; } elseif (strpos($template, "ext_") > -1) { // Extension template found - $MODE = "ext/"; + $mode = "ext/"; } elseif (strpos($template, "la_") > -1) { // "Logical-area" template found - $MODE = "la/"; + $mode = "la/"; } else { // Test for extension $test = substr($template, 0, strpos($template, "_")); if (EXT_IS_ACTIVE($test)) { // Set extra path to extension's name - $MODE = $test."/"; + $mode = $test."/"; } } //////////////////////// // Generate file name // //////////////////////// - $FQFN = $BASE.$MODE.$template.".tpl"; + $FQFN = $basePath.$mode.$template.".tpl"; - if ((!empty($GLOBALS['what'])) && ((strpos($template, "_header") > 0) || (strpos($template, "_footer") > 0)) && (($MODE == "guest/") || ($MODE == "member/") || ($MODE == "admin/"))) { + if ((!empty($GLOBALS['what'])) && ((strpos($template, "_header") > 0) || (strpos($template, "_footer") > 0)) && (($mode == "guest/") || ($mode == "member/") || ($mode == "admin/"))) { // Select what depended header/footer template file for admin/guest/member area $file2 = sprintf("%s%s%s_%s.tpl", - $BASE, - $MODE, + $basePath, + $mode, $template, SQL_ESCAPE($GLOBALS['what']) ); @@ -318,7 +318,7 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) { // Does the special template exists? if (!FILE_READABLE($FQFN)) { // Reset to default template - $FQFN = $BASE.$template.".tpl"; + $FQFN = $basePath.$template.".tpl"; } // END - if // Now does the final template exists? @@ -621,7 +621,7 @@ function DEREFERER ($URL) { // Don't de-refer our own links! if (substr($URL, 0, strlen(URL)) != URL) { // De-refer this link - $URL = "modules.php?module=loader&url=".encodeString(compileUriCode($URL)); + $URL = 'modules.php?module=loader&url=' . encodeString(compileUriCode($URL)); } // END - if // Return link @@ -631,13 +631,13 @@ function DEREFERER ($URL) { // Translate Uni*-like gender to human-readable function TRANSLATE_GENDER ($gender) { // Default - $ret = "!{$gender}!"; + $ret = '!' . $gender . '!'; // Male/female or company? switch ($gender) { - case "M": $ret = getMessage('GENDER_M'); break; - case "F": $ret = getMessage('GENDER_F'); break; - case "C": $ret = getMessage('GENDER_C'); break; + case 'M': $ret = getMessage('GENDER_M'); break; + case 'F': $ret = getMessage('GENDER_F'); break; + case 'C': $ret = getMessage('GENDER_C'); break; default: // Log unknown gender DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Unknown gender %s detected.", $gender)); @@ -667,21 +667,23 @@ function SELECTION_COUNT ($array) { } return $ret; } + // function IMG_CODE ($code, $type, $DATA, $uid) { - return "\"Code\""; + return 'Code'; } + // function TRANSLATE_STATUS ($status) { switch ($status) { - case "UNCONFIRMED": - case "CONFIRMED": - case "LOCKED": + case 'UNCONFIRMED': + case 'CONFIRMED': + case 'LOCKED': $ret = getMessage(sprintf("ACCOUNT_%s", $status)); break; - case "": + case '': case null: $ret = getMessage('ACCOUNT_DELETED'); break; @@ -712,7 +714,7 @@ function GET_LANGUAGE() { $ret = $GLOBALS['cache_array']['language']; } elseif (!empty($lang)) { // Check if main language file does exist - if (FILE_READABLE(constant('PATH')."inc/language/".$lang.".php")) { + if (FILE_READABLE(constant('PATH').'inc/language/'.$lang.'.php')) { // Okay found, so let's update cookies SET_LANGUAGE($lang); } @@ -739,14 +741,14 @@ function SET_LANGUAGE ($lang) { set_session('mx_lang', $lang); } // -function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") { +function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID='0') { global $DATA, $_CONFIG; // Make sure all template names are lowercase! $template = strtolower($template); // Default 'nickname' if extension is not installed - $nick = "---"; + $nick = '---'; // Prepare IP number and User Agent $REMOTE_ADDR = GET_REMOTE_ADDR(); @@ -817,34 +819,34 @@ function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") { $DATA['email'] = $email; // Base directory - $BASE = sprintf("%stemplates/%s/emails/", constant('PATH'), GET_LANGUAGE()); + $basePath = sprintf("%stemplates/%s/emails/", constant('PATH'), GET_LANGUAGE()); // Check for admin/guest/member templates if (strpos($template, "admin_") > -1) { // Admin template found - $FQFN = $BASE."admin/".$template.".tpl"; + $FQFN = $basePath."admin/".$template.".tpl"; } elseif (strpos($template, "guest_") > -1) { // Guest template found - $FQFN = $BASE."guest/".$template.".tpl"; + $FQFN = $basePath."guest/".$template.".tpl"; } elseif (strpos($template, "member_") > -1) { // Member template found - $FQFN = $BASE."member/".$template.".tpl"; + $FQFN = $basePath."member/".$template.".tpl"; } else { // Test for extension $test = substr($template, 0, strpos($template, "_")); if (EXT_IS_ACTIVE($test)) { // Set extra path to extension's name - $FQFN = $BASE.$test."/".$template.".tpl"; + $FQFN = $basePath.$test."/".$template.".tpl"; } else { // No special filename - $FQFN = $BASE.$template.".tpl"; + $FQFN = $basePath.$template.".tpl"; } } // Does the special template exists? if (!FILE_READABLE($FQFN)) { // Reset to default template - $FQFN = $BASE.$template.".tpl"; + $FQFN = $basePath.$template.".tpl"; } // END - if // Now does the final template exists? @@ -1101,7 +1103,7 @@ function array_pk_sort (&$array, $a_sort, $primary_key = 0, $order = -1, $nums = function ADD_SELECTION ($type, $DEFAULT, $prefix="", $id="0") { $OUT = ''; - if ($type == "yn") { + if ($type == 'yn') { // This is a yes/no selection only! if ($id > 0) $prefix .= "[".$id."]"; $OUT .= " \n"; for ($idx = 0; $idx <= 10; $idx++) { $OUT .= "