From 00797d46cc0b7e2c4e8c084eb4c6ac26cd0336e1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 9 Jun 2009 19:41:20 +0000 Subject: [PATCH] Typo in function name fixed, double->single quotes, some HTML fixes --- inc/functions.php | 2 +- inc/libs/html_mail_functions.php | 6 +-- inc/libs/newsletter_functions.php | 6 +-- inc/libs/surfbar_functions.php | 2 +- inc/mails/birthday_mails.php | 2 +- inc/modules/admin/what-usage.php | 6 +-- inc/modules/member/what-order.php | 14 +++--- inc/modules/member/what-transfer.php | 66 ++++++++++++++-------------- inc/mysql-connect.php | 2 +- inc/mysql-manager.php | 6 +-- mailid_top.php | 2 +- 11 files changed, 57 insertions(+), 57 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 66614abbb7..d16ffb7cfa 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1216,7 +1216,7 @@ function ADD_SELECTION ($type, $default, $prefix = '', $id = '0') { // Deprecated : $length // Optional : $DATA // -function generateRandomCodde ($length, $code, $uid, $DATA = '') { +function generateRandomCode ($length, $code, $uid, $DATA = '') { // Fix missing _MAX constant // @TODO Rewrite this unnice code if (!defined('_MAX')) define('_MAX', 15235); diff --git a/inc/libs/html_mail_functions.php b/inc/libs/html_mail_functions.php index 7071a163a4..3c4e377e93 100644 --- a/inc/libs/html_mail_functions.php +++ b/inc/libs/html_mail_functions.php @@ -55,14 +55,14 @@ function HTML_ADD_VALID_TAGS() { // function HTML_CHECK_TAGS ($html) { $test = stripslashes($html); - while (ereg("<", $test) && ereg(">", $test)) { - $check = strtolower(substr($test, strpos($test, "<") + 1, strpos($test, ">") - strpos($test, "<") - 1)); + while (ereg('<', $test) && ereg('>', $test)) { + $check = strtolower(substr($test, strpos($test, '<') + 1, strpos($test, '>') - strpos($test, '<') - 1)); $check = str_replace('/', '', $check); if (!in_array($check, $GLOBALS['html_tags'])) { // Invalid tag found! return ""; } - $test = substr($test, strpos($test, ">") + 1); + $test = substr($test, strpos($test, '>') + 1); } // Return tested code return $html; diff --git a/inc/libs/newsletter_functions.php b/inc/libs/newsletter_functions.php index 16a28db280..f6b0dfd4b8 100644 --- a/inc/libs/newsletter_functions.php +++ b/inc/libs/newsletter_functions.php @@ -56,14 +56,14 @@ function NL_ADD_VALID_TAGS () { // function NL_CHECK_TAGS ($html) { $test = stripslashes($html); - while (ereg("<", $test) && ereg(">", $test)) { - $check = strtolower(substr($test, strpos($test, "<") + 1, strpos($test, ">") - strpos($test, "<") - 1)); + while (ereg('<', $test) && ereg('>', $test)) { + $check = strtolower(substr($test, strpos($test, '<') + 1, strpos($test, '>') - strpos($test, '<') - 1)); $check = str_replace('/', '', $check); if (!in_array($check, $GLOBALS['html_tags'])) { // Invalid tag found! return ""; } - $test = substr($test, strpos($test, ">") + 1); + $test = substr($test, strpos($test, '>') + 1); } // Return tested code return $html; diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index 3eecd87c8e..392978204e 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -969,7 +969,7 @@ function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt = '') { } // ... and now the validation code - $valCode = generateRandomCodde($length, sha1(SURFBAR_GET_SALT().':'.$urlId), getUserId()); + $valCode = generateRandomCode($length, sha1(SURFBAR_GET_SALT().':'.$urlId), getUserId()); //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "valCode={$valCode}", false); } // END - while diff --git a/inc/mails/birthday_mails.php b/inc/mails/birthday_mails.php index 609c65af8d..4cc3ef182b 100644 --- a/inc/mails/birthday_mails.php +++ b/inc/mails/birthday_mails.php @@ -84,7 +84,7 @@ if (SQL_NUMROWS($result_birthday) > 0) { // @TODO 4 is hard-coded here, should we move it out in config? for ($idx = 0; $idx < 4; $idx++) { - $content['check'] .= generateRandomCodde("8", mt_rand(0, $month.$day), $content['userid'], ($age * ($idx + 1))); + $content['check'] .= generateRandomCode("8", mt_rand(0, $month.$day), $content['userid'], ($age * ($idx + 1))); } // Insert row into database diff --git a/inc/modules/admin/what-usage.php b/inc/modules/admin/what-usage.php index c776c2c248..70d433eb40 100644 --- a/inc/modules/admin/what-usage.php +++ b/inc/modules/admin/what-usage.php @@ -66,7 +66,7 @@ if (REQUEST_ISSET_GET(('image'))) { if (isFileReadable($FQFN)) { $image = imagecreatefrompng($FQFN); - sendHeader("Content-type: image/png"); + sendHeader('Content-type: image/png'); imagepng($image); imagedestroy($image); } @@ -104,10 +104,10 @@ if ((!empty($FQFN)) && (isFileReadable($FQFN))) { $test = strtolower($content); // Do we need to strip out above and including plus trailing tag? - if ((strpos($test, " 0) && (strpos($test, "") > 0)) { + if ((strpos($test, ' 0) && (strpos($test, '') > 0)) { // Okay, then do so. $content = substr(substr($content, 0, $body_end), $body_start); - $content = substr($content, strpos($content, ">") + 1); + $content = substr($content, strpos($content, '>') + 1); } // END - if // Output code diff --git a/inc/modules/member/what-order.php b/inc/modules/member/what-order.php index f0dc82a361..b080325257 100644 --- a/inc/modules/member/what-order.php +++ b/inc/modules/member/what-order.php @@ -101,7 +101,7 @@ FROM `{!_MYSQL_PREFIX!}_pool` WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1", array(getUserId(), REQUEST_POST('url'), getConfig('url_tlock')), __FILE__, __LINE__); - $type = "TEMP"; $id = 0; + $type = 'TEMP'; $id = 0; if (SQL_NUMROWS($result) == 1) { // Load id and mail type list($id, $type) = SQL_FETCHROW($result); @@ -110,7 +110,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1", // Free result SQL_FREERESULT($result); - if ($type == "TEMP") { + if ($type == 'TEMP') { // No entry found, so we need to check out the stats table as well... :) // We have to add that suff here, now we continue WITHOUT checking and check the text and subject against some filters $URL = ''; @@ -145,7 +145,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1", if (getConfig('url_blacklist') == 'Y') { // Ok, I do that for you know... $result = SQL_QUERY_ESC("SELECT UNIX_TIMESTAMP(`timestamp`) AS tstamp FROM `{!_MYSQL_PREFIX!}_url_blacklist` WHERE `url`='%s' LIMIT 1", - array(REQUEST_POST('url')), __FILE__, __LINE__); + array(REQUEST_POST('url')), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { // Jupp, we got one listed @@ -182,12 +182,12 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1", if (!REQUEST_ISSET_POST(('text'))) $URL = 'modules.php?module=login&what=order&msg=' . getCode('INVALID_TAGS')."&id=".$id; } else { // Remove any HTML code - REQUEST_SET_POST('text', str_replace("<", "{OPEN_HTML}", str_replace(">", "{CLOSE_HTML}", REQUEST_POST('text')))); + REQUEST_SET_POST('text', str_replace('<', '{OPEN_HTML}', str_replace('>', '{CLOSE_HTML}', REQUEST_POST('text')))); } } } elseif (!IS_ADMIN()) { // He has already sent a mail within a specific time - $URL = 'modules.php?module=login&what=order&msg=' . getCode('URL_TLOCK')."&id=".$id; + $URL = 'modules.php?module=login&what=order&msg=' . getCode('URL_TLOCK') . '&id=' . $id; } // Still no error? @@ -268,7 +268,7 @@ WHERE userid=%s AND holiday_start < UNIX_TIMESTAMP() AND holiday_end > UNIX_TIME if (($USED > 0) && ($USED <= $total) && ($MAX_SEND > 0)) { // Gettings points is okay, so we can add $USED later from $TIME = time(); - if (($id == '0') || ($type != "TEMP")) { + if (($id == '0') || ($type != 'TEMP')) { // New order $id = 0; if (EXT_IS_ACTIVE('html_mail')) { @@ -553,7 +553,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__); $message = getMessage('MEMBER_ENTER_INVALID_URL'); break; - case "": // When no error code is included in the URL we do not need to output an error message as well... + case '': // When no error code is included in the URL we do not need to output an error message as well... break; default: diff --git a/inc/modules/member/what-transfer.php b/inc/modules/member/what-transfer.php index 5ce05ad567..ff3034a77e 100644 --- a/inc/modules/member/what-transfer.php +++ b/inc/modules/member/what-transfer.php @@ -77,7 +77,7 @@ switch ($mode) // Add new transfer if (getConfig('transfer_code') > 0) { // Check for code - $code = generateRandomCodde(getConfig('transfer_code'), REQUEST_POST('code_chk'), getUserId(), constant('__TRANSFER_MAX_VALUE')); + $code = generateRandomCode(getConfig('transfer_code'), REQUEST_POST('code_chk'), getUserId(), constant('__TRANSFER_MAX_VALUE')); $valid_code = ($code == REQUEST_POST('code')); } else { // Zero length (= disabled) is always valid! @@ -171,7 +171,7 @@ switch ($mode) define('__TRANSFER_EXPIRES', createFancyTime(getConfig('transfer_age'))); // Generate tranafer id - define('__TRANS_ID', bigintval(generateRandomCodde("10", mt_rand(0, 99999), getUserId(), REQUEST_POST('reason')))); + define('__TRANS_ID', bigintval(generateRandomCode("10", mt_rand(0, 99999), getUserId(), REQUEST_POST('reason')))); // Add entries to both tables SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_transfers_in` (userid, from_uid, points, reason, time_trans, trans_id) VALUES ('%s','%s','%s','%s', UNIX_TIMESTAMP(),'%s')", @@ -188,16 +188,16 @@ switch ($mode) SUB_POINTS('transfer', getUserId(), REQUEST_POST('points')); // First send email to recipient - $msg = LOAD_EMAIL_TEMPLATE("member_transfer_recipient", '', constant('__RECIPIENT_UID')); - sendEmail(constant('__RECIPIENT_EMAIL'), getMessage('TRANSFER_MEMBER_RECIPIENT_SUBJ').": ".$SENDER, $msg); + $msg = LOAD_EMAIL_TEMPLATE('member_transfer_recipient', '', constant('__RECIPIENT_UID')); + sendEmail(constant('__RECIPIENT_EMAIL'), getMessage('TRANSFER_MEMBER_RECIPIENT_SUBJ') . ': ' . $SENDER, $msg); // Second send email to sender - $msg = LOAD_EMAIL_TEMPLATE("member_transfer_sender", '', constant('__SENDER_UID')); - sendEmail(constant('__SENDER_EMAIL'), getMessage('TRANSFER_MEMBER_SENDER_SUBJ').": ".$RECIPIENT, $msg); + $msg = LOAD_EMAIL_TEMPLATE('member_transfer_sender', '', constant('__SENDER_UID')); + sendEmail(constant('__SENDER_EMAIL'), getMessage('TRANSFER_MEMBER_SENDER_SUBJ') . ': ' . $RECIPIENT, $msg); // At last send admin mail(s) $ADMIN_SUBJ = sprintf("%s (%s->%s)", getMessage('TRANSFER_ADMIN_SUBJECT'), $SENDER, $RECIPIENT); - sendAdminNotification($ADMIN_SUBJ, "admin_transfer_points"); + sendAdminNotification($ADMIN_SUBJ, 'admin_transfer_points'); // Transfer is completed LOAD_TEMPLATE('admin_settings_saved', false, getMessage('TRANSFER_COMPLETED')."
{--TRANSFER_CONTINUE_OVERVIEW--}"); @@ -233,11 +233,11 @@ switch ($mode) if (EXT_IS_ACTIVE('nickname')) { // Load userid and nickname $result = SQL_QUERY_ESC("SELECT userid, nickname FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' AND opt_in='Y' AND userid != '%s' ORDER BY `userid` ASC", - array(getUserId()), __FILE__, __LINE__); + array(getUserId()), __FILE__, __LINE__); } else { // Load only userid $result = SQL_QUERY_ESC("SELECT userid, userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `status`='CONFIRMED' AND opt_in='Y' AND userid != '%s' ORDER BY `userid` ASC", - array(getUserId()), __FILE__, __LINE__); + array(getUserId()), __FILE__, __LINE__); } if (SQL_NUMROWS($result) > 0) { @@ -266,7 +266,7 @@ switch ($mode) } else { // No one else is opt-in $OUT = getMessage('TRANSFER_NO_ONE_ELSE_OPT_IN'); - define('__TRANSFER_TO_DISABLED', " disabled"); + define('__TRANSFER_TO_DISABLED', ' disabled="disabled"'); } // Transfer output to constant for the template @@ -275,11 +275,11 @@ switch ($mode) // Generate Code if (getConfig('transfer_code') > 0) { $rand = mt_rand(0, 99999); - $code = generateRandomCodde(getConfig('transfer_code'), $rand, getUserId(), constant('__TRANSFER_MAX_VALUE')); + $code = generateRandomCode(getConfig('transfer_code'), $rand, getUserId(), constant('__TRANSFER_MAX_VALUE')); $img = GENERATE_IMAGE($code, false); define('__TRANSFER_IMAGE_INPUT', " ".$img); } else { - $code = "00000"; + $code = '00000'; define('__TRANSFER_IMAGE_INPUT', getMessage('TRANSFER_NO_CODE')); } @@ -295,16 +295,16 @@ switch ($mode) } // Output form - LOAD_TEMPLATE("member_transfer_new"); + LOAD_TEMPLATE('member_transfer_new'); } break; - case "list_in": // List only incoming transactions - case "list_out": // List only outgoing transactions + case 'list_in': // List only incoming transactions + case 'list_out': // List only outgoing transactions // As you can see I put list_in and list_out together. I now do a switch() again on it for the right SQL command switch ($mode) { - case "list_in": + case 'list_in': $sql = "SELECT trans_id, from_uid, points, reason, time_trans FROM `{!_MYSQL_PREFIX!}_user_transfers_in` WHERE userid=%s ORDER BY time_trans DESC LIMIT ".getConfig('transfer_max'); // @TODO Rewrite these constants $NOTHING = getMessage('TRANSFER_NO_INCOMING_TRANSFERS'); @@ -312,7 +312,7 @@ switch ($mode) define('__TRANSFER_TITLE', getMessage('TRANSFER_LIST_INCOMING')); break; - case "list_out": + case 'list_out': $sql = "SELECT trans_id, to_uid, points, reason, time_trans FROM `{!_MYSQL_PREFIX!}_user_transfers_out` WHERE userid=%s ORDER BY time_trans DESC LIMIT ".getConfig('transfer_max'); // @TODO Rewrite these constants $NOTHING = getMessage('TRANSFER_NO_OUTGOING_TRANSFERS'); @@ -329,7 +329,7 @@ switch ($mode) // @TODO This should be somehow rewritten to $content = SQL_FETCHARRAY(), see switch() block above for SQL queries while (list($tid, $uid, $points, $reason, $stamp) = SQL_FETCHROW($result)) { // Rewrite points - if ($type == "OUT") $points = $points.'-'; + if ($type == 'OUT') $points = $points.'-'; // Prepare content for template $content = array( @@ -342,12 +342,12 @@ switch ($mode) ); // Load row template - $OUT .= LOAD_TEMPLATE("member_transfer_row2", true, $content); + $OUT .= LOAD_TEMPLATE('member_transfer_row2', true, $content); // Add points and switch color $total += $points; $SW = 3 - $SW; - } + } // END - while // Free memory SQL_FREERESULT($result); @@ -368,10 +368,10 @@ switch ($mode) define('__TRANSFER_TOTAL_VALUE', $total); // Load final template - LOAD_TEMPLATE("member_transfer_list"); + LOAD_TEMPLATE('member_transfer_list'); break; - case "list_all": // List all transactions + case 'list_all': // List all transactions // We fill a temporary table with data from both tables. This is much easier // to code and unstand by you as sub-SELECT queries. I know this is not the // fastest way but it shall be fine for now. @@ -391,7 +391,7 @@ KEY(party_uid) $result = SQL_QUERY_ESC("SELECT trans_id, from_uid, points, reason, time_trans FROM `{!_MYSQL_PREFIX!}_user_transfers_in` WHERE userid=%s ORDER BY `id` LIMIT %s", array(getUserId(), getConfig('transfer_max')), __FILE__, __LINE__); while ($DATA = SQL_FETCHROW($result)) { - $DATA[] = "IN"; + $DATA[] = 'IN'; $DATA = implode("','", $DATA); $res_temp = SQL_QUERY("INSERT INTO `{!_MYSQL_PREFIX!}_transfers_tmp` (trans_id, party_uid, points, reason, time_trans, trans_type) VALUES ('".$DATA."')", __FILE__, __LINE__); } @@ -403,7 +403,7 @@ KEY(party_uid) $result = SQL_QUERY_ESC("SELECT trans_id, to_uid, points, reason, time_trans FROM `{!_MYSQL_PREFIX!}_user_transfers_out` WHERE userid=%s ORDER BY `id` LIMIT %s", array(getUserId(), getConfig('transfer_max')), __FILE__, __LINE__); while ($DATA = SQL_FETCHROW($result)) { - $DATA[] = "OUT"; + $DATA[] = 'OUT'; $DATA = implode("','", $DATA); $res_temp = SQL_QUERY("INSERT INTO `{!_MYSQL_PREFIX!}_transfers_tmp` (trans_id, party_uid, points, reason, time_trans, trans_type) VALUES ('".$DATA."')", __FILE__, __LINE__); } @@ -421,7 +421,7 @@ KEY(party_uid) $OUT = ''; $SW = 2; while ($content = SQL_FETCHARRAY($result)) { // Rewrite points - if ($content['trans_type'] == "OUT") $content['points'] = '-'.$content['points'].""; + if ($content['trans_type'] == 'OUT') $content['points'] = '-'.$content['points'].""; // Prepare content for template $content['sw'] = $SW; @@ -434,7 +434,7 @@ KEY(party_uid) // Add points and switch color $total += $content['points']; $SW = 3 - $SW; - } + } // END - while // Free memory SQL_FREERESULT($result); @@ -461,7 +461,7 @@ KEY(party_uid) define('__TRANSFER_SUM', getMessage('TRANSFER_TOTAL_BALANCE')); // Load final template - LOAD_TEMPLATE("member_transfer_list"); + LOAD_TEMPLATE('member_transfer_list'); // At the end we don't need a temporary table in memory $result = SQL_QUERY("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_transfers_tmp`", __FILE__, __LINE__); @@ -470,7 +470,7 @@ KEY(party_uid) SQL_FREERESULT($result); break; - case "": // Overview page + case '': // Overview page // Check incoming transfers $result = SQL_QUERY_ESC("SELECT COUNT(id) FROM `{!_MYSQL_PREFIX!}_user_transfers_in` WHERE userid=%s", array(getUserId()), __FILE__, __LINE__); list($dmy) = SQL_FETCHROW($result); @@ -512,10 +512,9 @@ KEY(party_uid) // "Settings saved..." LOAD_TEMPLATE('admin_settings_saved', false, "
{--SETTINGS_SAVED--}
"); - } + } // END - if - switch ($opt_in) - { + switch ($opt_in) { case 'Y': define('__TRANSFER_ALLOW_Y', ' checked="checked"'); define('__TRANSFER_ALLOW_N', ''); @@ -527,14 +526,15 @@ KEY(party_uid) define('__TRANSFER_ALLOW_N', ' checked="checked"'); define('__TRANSFER_NEW_LINK', getMessage('TRANSFER_PLEASE_ALLOW_OPT_IN')); break; - } + } // END - switch // Check for latest out-transfers $result = SQL_QUERY_ESC("SELECT time_trans FROM `{!_MYSQL_PREFIX!}_user_transfers_out` WHERE time_trans > (UNIX_TIMESTAMP() - %s) AND `userid`=%s ORDER BY time_trans DESC -LIMIT 1", array(getConfig('transfer_timeout'), getUserId()), __FILE__, __LINE__); +LIMIT 1", + array(getConfig('transfer_timeout'), getUserId()), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 0) { // Load template define('__TRANSFER_SETTINGS_CONTENT', LOAD_TEMPLATE("member_transfer_settings", true)); diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index 0e0bd8068e..836da4cd53 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -158,7 +158,7 @@ if ((!isInstalling()) && (isInstalled())) { // Is the extension sql_patches installed and at least 0.3.6? if (GET_EXT_VERSION('sql_patches') >= '0.3.6') { // Generate random number - define('RAND_NUMBER', generateRandomCodde(10, mt_rand(10000,32766), getUserId(), '')); + define('RAND_NUMBER', generateRandomCode(10, mt_rand(10000,32766), getUserId(), '')); } else { // Generate weak (!!!) code define('RAND_NUMBER', mt_rand(1000000, 9999999)); diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 302e9d2091..7504db5bad 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -627,7 +627,7 @@ function IS_ADMIN ($admin = '') { // Check if password is valid //* DEBUG: */ print __FUNCTION__."*".$valPass.'/'.$passCookie."*
\n"; $ret = (($valPass == $passCookie) || ((strlen($valPass) == 32) && ($valPass == md5($passCookie))) || (($valPass == "*FAILED*") && (!EXT_IS_ACTIVE('cache')))); - } + } // END - if // Return result of comparision //* DEBUG: */ if (!$ret) echo __LINE__."OK!
"; @@ -670,10 +670,10 @@ function addMaxReceiveList ($mode, $default = '', $return = false) { define('__MAX_RECEIVE_OPTIONS', $OUT); // Load template - $OUT = LOAD_TEMPLATE($mode."_receive_table", true); + $OUT = LOAD_TEMPLATE($mode . '_receive_table', true); } else { // Maybe the admin has to setup some maximum values? - debug_report_bug("Nothing is being done here?"); + debug_report_bug('Nothing is being done here?'); } // Free result diff --git a/mailid_top.php b/mailid_top.php index 5273f72e9c..ed811fd03e 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -164,7 +164,7 @@ if (isInstalled()) { if (($time > 0) && ($payment > 0)) { if (!empty($code)) { // Generate code - $img_code = generateRandomCodde(getConfig('code_length'), $code, $url_uid, $urlId); + $img_code = generateRandomCode(getConfig('code_length'), $code, $url_uid, $urlId); } // END - if switch ($mode) { -- 2.39.5