From dbd1bc95c8f89024118791dc3fb3633a90afa9cf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 6 Feb 2008 20:32:39 +0000 Subject: [PATCH] Naming convention applied --- inc/extensions.php | 4 +- inc/functions.php | 16 +++---- inc/install-inc.php | 29 ++++++------ inc/language.php | 10 ++--- inc/modules/admin/admin-inc.php | 20 ++++----- inc/modules/admin/what-list_links.php | 4 +- inc/modules/admin/what-list_task.php | 4 +- inc/modules/member/what-order.php | 18 ++++---- inc/modules/member/what-unconfirmed.php | 6 +-- inc/modules/order.php | 6 +-- inc/mysql-manager.php | 60 ++++++++++++------------- mailid.php | 9 ++-- mailid_top.php | 14 +++--- 13 files changed, 103 insertions(+), 97 deletions(-) diff --git a/inc/extensions.php b/inc/extensions.php index dc22eaeb7a..e8675c7ef3 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -271,8 +271,8 @@ function EXT_IS_ACTIVE ($ext_name, $ignore_admin=false, $ignore_cache=false) if ((!mxchange_installed) || (mxchange_installing) || (empty($ext_name))) return false; // Extension's file name will also be checked - $FILE = PATH."inc/extensions/ext-".$ext_name.".php"; - if ((!file_exists($FILE)) && (!is_readable($FILE))) return false; + $file = PATH."inc/extensions/ext-".$ext_name.".php"; + if ((!file_exists($file)) && (!is_readable($file))) return false; //* DEBUG: */ echo "*".$ext_name."*
"; // Failed is the default diff --git a/inc/functions.php b/inc/functions.php index 3162da2b78..6a64288272 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -662,9 +662,9 @@ function SELECTION_COUNT($array) return $ret; } // -function IMG_CODE ($code, $TYPE, $DATA, $uid) +function IMG_CODE ($code, $type, $DATA, $uid) { - return "\"Code\""; + return "\"Code\""; } // function TRANSLATE_STATUS($status) @@ -1132,10 +1132,10 @@ function array_pk_sort(&$array, $a_sort, $primary_key = 0, $order = -1, $nums = $array = $dummy; } // -function ADD_SELECTION($TYPE, $DEFAULT, $PREFIX="", $id="0") +function ADD_SELECTION($type, $DEFAULT, $PREFIX="", $id="0") { global $MONTH_DESCR; $OUT = ""; - if ($TYPE == "yn") + if ($type == "yn") { // This is a yes/no selection only! if ($id > 0) $PREFIX .= "[".$id."]"; @@ -1145,11 +1145,11 @@ function ADD_SELECTION($TYPE, $DEFAULT, $PREFIX="", $id="0") { // Begin with regular selection box here if (!empty($PREFIX)) $PREFIX .= "_"; - $TYPE2 = $TYPE; - if ($id > 0) $TYPE2 .= "[".$id."]"; - $OUT .= " \n"; } - switch ($TYPE) + switch ($type) { case "day": // Day for ($idx = 1; $idx < 32; $idx++) diff --git a/inc/install-inc.php b/inc/install-inc.php index 0b0cfb1207..f4146a707e 100644 --- a/inc/install-inc.php +++ b/inc/install-inc.php @@ -43,23 +43,23 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) } // -function install_WriteData ($FILE, $COMMENT, $PREFIX, $SUFFIX, $DATA, $SNEAK=0) +function install_WriteData ($file, $COMMENT, $PREFIX, $SUFFIX, $DATA, $SNEAK=0) { $DONE = false; $SNEAK++; - if (file_exists($FILE)) + if (file_exists($file)) { - $SEARCH = "CFG: ".$COMMENT; - $TMP = $FILE.".tmp"; - $fp = fopen($FILE, 'r') or OUTPUT_HTML ("READ: ".$FILE."
"); - if ($fp) + $search = "CFG: ".$COMMENT; + $tmp = $file.".tmp"; + $fp = @fopen($file, 'r') or OUTPUT_HTML ("READ: ".$file."
"); + if (is_resource($fp)) { - $fp_tmp = fopen($TMP, 'w') or OUTPUT_HTML ("WRITE: ".$TMP."
"); - if ($fp_tmp) + $fp_tmp = @fopen($tmp, 'w') or OUTPUT_HTML ("WRITE: ".$tmp."
"); + if (is_resource($fp_tmp)) { while (! feof($fp)) { $line = fgets ($fp, 10240); - if (strpos($line, $SEARCH) > -1) $next = 0; + if (strpos($line, $search) > -1) $next = 0; if ($next > -1) { if ($next == $SNEAK) @@ -78,12 +78,15 @@ function install_WriteData ($FILE, $COMMENT, $PREFIX, $SUFFIX, $DATA, $SNEAK=0) // Finished writing tmp file $DONE = true; } + + // Close source directory fclose($fp); - if ($DONE) + + if (($DONE) && (is_writeable($file))) { // Copy back tmp file and delete tmp :-) - @copy($TMP, $FILE); - @unlink($TMP); + @copy($tmp, $file); + @unlink($tmp); } else { @@ -93,7 +96,7 @@ function install_WriteData ($FILE, $COMMENT, $PREFIX, $SUFFIX, $DATA, $SNEAK=0) } else { - OUTPUT_HTML ("404: ".$FILE."
"); + OUTPUT_HTML ("404: ".$file."
"); } } diff --git a/inc/language.php b/inc/language.php index beced61269..4790793a23 100644 --- a/inc/language.php +++ b/inc/language.php @@ -41,18 +41,18 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) if (empty($mx_lang)) $mx_lang = DEFAULT_LANG; // Look for file -$FILE = sprintf(PATH."inc/language/%s.php", $mx_lang); -if (!file_exists($FILE)) +$file = sprintf(PATH."inc/language/%s.php", $mx_lang); +if (!file_exists($file)) { // Switch to default (DO NOT CHANGE!!!) @setcookie("mx_lang", "de", (time() + $CONFIG['online_timeout']), COOKIE_PATH); $mx_lang = "de"; - $FILE = sprintf(PATH."inc/language/%s.php", $mx_lang); + $file = sprintf(PATH."inc/language/%s.php", $mx_lang); } // Load language file -require($FILE); -unset($FILE); +require($file); +unset($file); // Check for installation mode if (!mxchange_installed) diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 258c265a2a..be8b8c1eb6 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -162,23 +162,23 @@ function CHECK_ADMIN_COOKIES ($admin_login, $password) return $ret; } // -function admin_WriteData ($FILE, $COMMENT, $PREFIX, $SUFFIX, $DATA, $SEEK=0) +function admin_WriteData ($file, $COMMENT, $PREFIX, $SUFFIX, $DATA, $SEEK=0) { $DONE = false; $SEEK++; $found = false; - if (file_exists($FILE)) + if (file_exists($file)) { - $SEARCH = "CFG: ".$COMMENT; - $TMP = $FILE.".tmp"; - $fp = fopen($FILE, 'r') or OUTPUT_HTML ("READ: ".$FILE."
"); + $search = "CFG: ".$COMMENT; + $tmp = $file.".tmp"; + $fp = fopen($file, 'r') or OUTPUT_HTML ("READ: ".$file."
"); if ($fp) { - $fp_tmp = fopen($TMP, 'w') or OUTPUT_HTML ("WRITE: ".$TMP."
"); + $fp_tmp = fopen($tmp, 'w') or OUTPUT_HTML ("WRITE: ".$tmp."
"); if ($fp_tmp) { while (! feof($fp)) { $line = fgets ($fp, 1024); - if (strpos($line, $SEARCH) > -1) { $next = 0; $found = true; } + if (strpos($line, $search) > -1) { $next = 0; $found = true; } if ($next > -1) { if ($next == $SEEK) @@ -201,8 +201,8 @@ function admin_WriteData ($FILE, $COMMENT, $PREFIX, $SUFFIX, $DATA, $SEEK=0) if (($DONE) && ($found)) { // Copy back tmp file and delete tmp :-) - @copy($TMP, $FILE); - @unlink($TMP); + @copy($tmp, $file); + @unlink($tmp); define ('_FATAL', false); } elseif (!$found) @@ -219,7 +219,7 @@ function admin_WriteData ($FILE, $COMMENT, $PREFIX, $SUFFIX, $DATA, $SEEK=0) } else { - OUTPUT_HTML ("404: ".$FILE."
"); + OUTPUT_HTML ("404: ".$file."
"); } } // diff --git a/inc/modules/admin/what-list_links.php b/inc/modules/admin/what-list_links.php index 1cb8786dab..5d7a1b02b5 100644 --- a/inc/modules/admin/what-list_links.php +++ b/inc/modules/admin/what-list_links.php @@ -94,14 +94,14 @@ if (!empty($_GET['u_id'])) { case "NORMAL": $result_data = SQL_QUERY_ESC("SELECT subject, timestamp_ordered, cat_id FROM "._MYSQL_PREFIX."_user_stats WHERE id=%d LIMIT 1", array(bigintval($id)), __FILE__, __LINE__); - $TYPE = "mailid"; $DATA = $id; $PROBLEM = NORMAL_MAIL_PROBLEM; + $type = "mailid"; $DATA = $id; $PROBLEM = NORMAL_MAIL_PROBLEM; $LINK = "".$id.""; break; case "BONUS": $result_data = SQL_QUERY_ESC("SELECT subject, timestamp, cat_id FROM "._MYSQL_PREFIX."_bonus WHERE id=%d LIMIT 1", array(bigintval($id2)), __FILE__, __LINE__); - $TYPE = "bonusid"; $DATA = $id2; $PROBLEM = BONUS_MAIL_PROBLEM; + $type = "bonusid"; $DATA = $id2; $PROBLEM = BONUS_MAIL_PROBLEM; $LINK = "".$id2.""; break; } diff --git a/inc/modules/admin/what-list_task.php b/inc/modules/admin/what-list_task.php index 20c2b1b3b9..3a4fccd5cb 100644 --- a/inc/modules/admin/what-list_task.php +++ b/inc/modules/admin/what-list_task.php @@ -129,10 +129,10 @@ ORDER BY userid DESC, task_type DESC, subject, task_created DESC", __FILE__, __L } // There are uncompleted jobs! - $eval = "\$TYPE = ADMIN_OVERVIEW_TASK_".strtoupper($_GET['type'])."_TYPE;"; + $eval = "\$type = ADMIN_OVERVIEW_TASK_".strtoupper($_GET['type'])."_TYPE;"; eval($eval); LOAD_TEMPLATE("admin_overview_header_task", false, array( - 'message' => $TYPE, + 'message' => $type, 'type' => $_GET['type'] )); $SW = 2; diff --git a/inc/modules/member/what-order.php b/inc/modules/member/what-order.php index 205ef6a589..fd306af3fb 100644 --- a/inc/modules/member/what-order.php +++ b/inc/modules/member/what-order.php @@ -544,7 +544,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__); // Now we need to load the mail types... $result = SQL_QUERY("SELECT id, price, payment, mail_title FROM "._MYSQL_PREFIX."_payments ORDER BY payment", __FILE__, __LINE__); - $TYPES = array(); + $typeS = array(); if (SQL_NUMROWS($result) > 0) { // Check for message ID in URL @@ -636,7 +636,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__); } // Load all email types... - while ($TYPES[] = SQL_FETCHROW($result)) + while ($typeS[] = SQL_FETCHROW($result)) { // Nothing to do here... ;-) } @@ -699,22 +699,22 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__); $CAT .= ">".$CATS['name'][$key]." (".$CATS['uids'][$key]." ".USER_IN_CAT.")\n"; } // Mail type - $TYPE = ""; - foreach ($TYPES as $key=>$value) + $type = ""; + foreach ($typeS as $key=>$value) { - $P = TRANSLATE_COMMA($TYPES[$key][1]); + $P = TRANSLATE_COMMA($typeS[$key][1]); if (is_array($value)) { // Output option line - $TYPE .= "