]> git.mxchange.org Git - mailer.git/blobdiff - 0.2.1/inc/mysql-connect.php
Code rewritings, load base config improved and many minor fixes...
[mailer.git] / 0.2.1 / inc / mysql-connect.php
index c9a90d9e041de71b5bb1c59f61da91a63b620e80..a17cea30cf6aa7472a1ef9c0914500d5b2242b5d 100644 (file)
@@ -34,7 +34,7 @@
 // Some security stuff...\r
 if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))\r
 {\r
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";\r
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";\r
        require($INC);\r
 }\r
 \r
@@ -92,56 +92,24 @@ if ((!mxchange_installing) && (mxchange_installed))
        {\r
                // Connect to DB\r
                $link = SQL_CONNECT($MySQL['host'], $MySQL['login'], $MySQL['password'], __FILE__, __LINE__);\r
-               if ($link)\r
+               if ($link !== false)\r
                {\r
                        $db = SQL_SELECT_DB($MySQL['dbase'], $link, __FILE__, __LINE__);\r
-                       if ($db)\r
+                       if ($db !== false)\r
                        {\r
-                               // Load configuration stuff    0            1                2          3              4                    5              6            7          8            9          10             11          12          13            14             15              16           17             18            19              20          21             22              23                 24                 25            26           27          28           29             30                 31              32           33            34\r
+                               // Load configuration stuff\r
                                $result = SQL_QUERY("SELECT pass_len, points_register, points_ref, least_cats, check_double_email, check_double_pass, admin_notify, url_tlock, test_text, max_tlength, test_subj, autosend_active, max_send, url_blacklist, auto_purge, auto_purge_active, last_update, unconfirmed, profile_lock, online_timeout, mad_timestamp, mad_count, profile_update, send_prof_update, resend_profile_update, code_length, patch_level, patch_ctime, guest_stats, ref_payout, activate_xchange, order_multi_page, display_refid, ip_timeout, allow_direct_pay, config FROM "._MYSQL_PREFIX."_config WHERE config='0' LIMIT 1", __FILE__, __LINE__);\r
 \r
-                               if (SQL_NUMROWS($result) == 1)\r
-                               {\r
+                               if (SQL_NUMROWS($result) == 1) {\r
                                        // Load data when previous SQL query did not fail\r
-                                       if ($result) $DUMMY = SQL_FETCHROW($result);\r
-\r
-                                       // We copy the fetched data to the CONFIG array (or can you remember which number is for which config value??? ;-) )\r
-                                       $CONFIG = array(\r
-                                               'pass_len'        =>  $DUMMY[0], // Minimum password length\r
-                                               'points_register' =>  $DUMMY[1], // How many points the new member gets on registration\r
-                                               'points_ref'      =>  $DUMMY[2], // How many points a members gets on direct referral\r
-                                               'least_cats'      =>  $DUMMY[3], // Minimum number of categories to be selected\r
-                                               'dbl_email'       =>  $DUMMY[4], // Shall we check if the email address is already in out database?\r
-                                               'dbl_pass'        =>  $DUMMY[5], // Shall we - silencly - check if another user is using the same password?\r
-                                               'admin_notify'    =>  $DUMMY[6], // Shall I notify the admin if a member has changed his profile?\r
-                                               'url_tlock'       =>  $DUMMY[7], // Time in seconds to lock same ordered URL\r
-                                               'test_text'       =>  $DUMMY[8], // Shall I test the text against URLs?\r
-                                               'max_tlength'     =>  $DUMMY[9], // How long shall the ordered text be?\r
-                                               'test_subj'       => $DUMMY[10], // Shall I test the subject against URLs?\r
-                                               'autosend_active' => $DUMMY[11], // Active / Deactive auto-send feature? (currently disabled feature)\r
-                                               'max_send'        => $DUMMY[12], // How many shall I send in one time from the pool?\r
-                                               'url_blacklist'   => $DUMMY[13], // Shall I enable or disable the URL black-list feature?\r
-                                               'auto_purge'      => $DUMMY[14], // How many days shall mails stay in stats table? (disabled!)\r
-                                               'ap_active'       => $DUMMY[15], // Shall auto-purge be enabled or disbaled? (disabled!)\r
-                                               'last_update'     => $DUMMY[16], // Last update when reset on database was\r
-                                               'unconfirmed'     => $DUMMY[17], // How many unconfirmed mails shall I allow to order new mails?\r
-                                               'profile_lock'    => $DUMMY[18], // Time in seconds to keep a member's profile write-protected after he changes something\r
-                                               'online_timeout'  => $DUMMY[19], // Session expiration in online list\r
-                                               'profile_update'  => $DUMMY[22], // How many seconds between profile update notification?\r
-                                               'send_update'     => $DUMMY[23], // Shall I send profile update notifications to your members?\r
-                                               'prof_reupdate'   => $DUMMY[24], // Seconds between re-notifications for profile update?\r
-                                               'code_length'     => $DUMMY[25], // Length of the code the member has to re-type\r
-                                               'patch_level'     => $DUMMY[26], // Installed patch level in database\r
-                                               'patch_ctime'     => $DUMMY[27], // Latest patch file\r
-                                               'gstats_mode'     => $DUMMY[28], // Guest statistics mode: About your members, module clicks or inactive\r
-                                               'ref_payout'      => $DUMMY[29], // After how many confirmed mails shall the referral bonus be paid? (0 = disable feature)\r
-                                               'activate_system' => $DUMMY[30], // Automatic activation of your exchange after x days (0 = disable feature)\r
-                                               'order_multi'     => $DUMMY[31], // Shall I activate multiple pages in order form? This will enable sending by ZIP code\r
-                                               'display_refid'   => $DUMMY[32], // Shall I display the refid in registration form or not?\r
-                                               'ip_timeout'      => $DUMMY[33], // Timeout for same IP number in registration form\r
-                                               'direct_pay'      => $DUMMY[34], // Shall I pay "clicked" points directly or not? Not is default.\r
-                                       );\r
-                                       unset($DUMMY);\r
+                                       if (!$result) {
+                                               // Something went wrong
+                                               ADD_FATAL(FATAL_CANNOT_LOAD_CONFIG);
+                                               return;
+                                       }\r
+
+                                       // Load the configuration
+                                       $CONFIG = array_merge($CONFIG, SQL_FETCHARRAY($result));
 \r
                                        // Initialize include-file-pool\r
                                        $INC_POOL = array();\r
@@ -234,7 +202,7 @@ if ((!mxchange_installing) && (mxchange_installed))
                                        $dummy = CHECK_MODULE($GLOBALS['module']);\r
                                        if ($dummy == "done") COUNT_MODULE($GLOBALS['module']);\r
                                        unset($dummy);\r
-                                       if ($CONFIG['activate_system'] > 0) ACTIVATE_EXCHANGE();\r
+                                       if ($CONFIG['activate_xchange'] > 0) activateExchange();\r
                                }\r
                                 else\r
                                {\r