From 81bfbcd72e424060ea1223b49ad92fcfa150f361 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 6 Apr 2009 19:34:33 +0000 Subject: [PATCH] config.php partly solved, see #117 --- .gitattributes | 6 + .gitignore | 1 + admin.php | 2 +- agb.php | 2 +- beg.php | 43 +- birthday_confirm.php | 27 +- click.php | 2 +- confirm.php | 2 +- css.php | 10 +- debug.php | 2 +- doubler.php | 4 +- img.php | 6 +- inc/config-functions.php | 50 +- inc/config-global.php | 81 +++ inc/config-local.php.dist | 128 +++++ inc/config.php | 172 +----- inc/databases.php | 14 +- inc/db/lib-mysql3.php | 47 +- inc/db/lib.php | 10 +- inc/doubler_send.php | 2 +- inc/extensions.php | 2 +- inc/extensions/ext-lead.php | 92 +++ inc/extensions/ext-newsletter.php | 4 +- inc/filters.php | 2 +- inc/footer.php | 8 +- inc/functions.php | 523 +++++------------- inc/header.php | 29 +- inc/inc-functions.php | 4 +- inc/install-inc.php | 134 +++-- inc/language.php | 17 +- inc/language/bonus_de.php | 2 - inc/language/de.php | 10 +- inc/language/en.php | 6 +- inc/language/install_de.php | 3 +- inc/libs/admins_functions.php | 8 +- inc/libs/bonus_functions.php | 21 +- inc/libs/cache_functions.php | 4 +- inc/libs/doubler_functions.php | 4 +- inc/libs/holiday_functions.php | 4 +- inc/libs/html_mail_functions.php | 6 +- inc/libs/rallye_functions.php | 26 +- inc/libs/register_functions.php | 4 +- inc/libs/security_functions.php | 14 +- inc/libs/sponsor_functions.php | 2 +- inc/libs/surfbar_functions.php | 28 +- inc/libs/user_functions.php | 6 +- inc/load_config.php | 66 +++ inc/modules/admin.php | 4 +- inc/modules/admin/admin-inc.php | 14 +- inc/modules/admin/overview-inc.php | 4 +- inc/modules/admin/what-admin_add.php | 17 +- inc/modules/admin/what-admins_edit.php | 4 +- inc/modules/admin/what-admins_mails.php | 2 +- inc/modules/admin/what-config_admin.php | 4 +- inc/modules/admin/what-config_admins.php | 4 +- inc/modules/admin/what-config_autopurge.php | 4 +- inc/modules/admin/what-config_beg.php | 119 ++-- inc/modules/admin/what-config_birthday.php | 20 +- inc/modules/admin/what-config_bonus.php | 48 +- inc/modules/admin/what-config_cache.php | 36 +- inc/modules/admin/what-config_doubler.php | 31 +- inc/modules/admin/what-config_extensions.php | 4 +- inc/modules/admin/what-config_holiday.php | 6 +- inc/modules/admin/what-config_mediadata.php | 2 +- inc/modules/admin/what-config_order.php | 16 +- inc/modules/admin/what-config_other.php | 46 +- inc/modules/admin/what-config_points.php | 8 +- .../admin/what-config_rallye_prices.php | 4 +- inc/modules/admin/what-config_refback.php | 4 +- inc/modules/admin/what-config_removeip.php | 32 +- inc/modules/admin/what-config_rewrite.php | 4 +- inc/modules/admin/what-config_surfbar.php | 24 +- inc/modules/admin/what-config_wernis.php | 8 +- inc/modules/admin/what-del_holiday.php | 4 +- inc/modules/admin/what-del_transfer.php | 2 +- inc/modules/admin/what-email_archiv.php | 6 +- inc/modules/admin/what-email_details.php | 6 +- inc/modules/admin/what-extensions.php | 2 +- inc/modules/admin/what-guest_add.php | 17 +- inc/modules/admin/what-list_autopurge.php | 6 +- inc/modules/admin/what-list_beg.php | 4 +- inc/modules/admin/what-list_bonus.php | 20 +- inc/modules/admin/what-list_holiday.php | 6 +- inc/modules/admin/what-list_notifications.php | 4 +- inc/modules/admin/what-list_payouts.php | 2 +- inc/modules/admin/what-list_primera.php | 2 +- inc/modules/admin/what-list_rallyes.php | 6 +- inc/modules/admin/what-list_refs.php | 4 +- inc/modules/admin/what-list_sponsor.php | 10 +- inc/modules/admin/what-list_task.php | 2 +- inc/modules/admin/what-list_transfer.php | 2 +- inc/modules/admin/what-list_unconfirmed.php | 6 +- inc/modules/admin/what-list_user.php | 12 +- inc/modules/admin/what-list_wernis.php | 2 +- inc/modules/admin/what-logs.php | 20 +- inc/modules/admin/what-mem_add.php | 2 +- inc/modules/admin/what-refbanner.php | 2 +- inc/modules/admin/what-send_newsletter.php | 2 +- inc/modules/admin/what-surfbar_stats.php | 2 +- inc/modules/admin/what-theme_check.php | 2 +- inc/modules/admin/what-unlock_emails.php | 2 +- inc/modules/admin/what-unlock_sponsor.php | 4 +- inc/modules/admin/what-updates.php | 2 +- inc/modules/admin/what-usage.php | 4 +- inc/modules/guest/what-confirm.php | 4 +- inc/modules/guest/what-login.php | 2 +- inc/modules/guest/what-rallyes.php | 4 +- inc/modules/guest/what-register.php | 6 +- inc/modules/guest/what-stats.php | 8 +- inc/modules/guest/what-top10.php | 6 +- inc/modules/guest/what-wernis_portal.php | 2 +- inc/modules/login.php | 2 +- inc/modules/member/what-beg2.php | 2 +- inc/modules/member/what-bonus.php | 2 +- inc/modules/member/what-categories.php | 6 +- inc/modules/member/what-holiday.php | 4 +- inc/modules/member/what-html_mail.php | 4 +- inc/modules/member/what-newsletter.php | 2 +- inc/modules/member/what-order.php | 2 +- inc/modules/member/what-payout.php | 2 +- inc/modules/member/what-primera.php | 2 +- inc/modules/member/what-rallyes.php | 4 +- inc/modules/member/what-stats.php | 6 +- inc/modules/member/what-support.php | 2 +- inc/modules/member/what-surfbar_list.php | 4 +- inc/modules/member/what-transfer.php | 10 +- inc/modules/member/what-wernis.php | 2 +- inc/modules/sponsor/settings.php | 4 +- inc/mysql-connect.php | 39 +- inc/mysql-manager.php | 33 +- inc/pool/pool-user.php | 6 +- inc/reset/reset_holiday.php | 6 +- inc/session.php | 11 - inc/stats_bonus.php | 2 +- inc/stylesheet.php | 16 +- inc/wrapper-functions.php | 376 +++++++++++++ index.php | 6 +- install.php | 2 +- js.php | 11 +- lead-confirm.php | 2 +- login.php | 2 +- mailid.php | 15 +- mailid_top.php | 4 +- modules.php | 4 +- ref.php | 2 +- show_bonus.php | 31 +- sponsor_confirm.php | 2 +- sponsor_ref.php | 2 +- surfbar.php | 4 +- templates/de/html/admin/admin_config_beg.tpl | 118 ++-- .../de/html/admin/admin_config_birthday.tpl | 37 +- .../de/html/admin/admin_config_bonus.tpl | 2 +- templates/de/html/beg/beg_link.tpl | 3 +- .../de/html/birthday/birthday_confirm.tpl | 12 +- templates/de/html/birthday/birthday_msg.tpl | 6 +- templates/de/html/copyright.tpl | 7 +- templates/de/html/ext/ext_lead.tpl | 21 + templates/de/html/guest/guest_beg.tpl | 3 +- templates/de/html/index.tpl | 4 +- templates/de/html/member/member_beg.tpl | 3 +- templates/de/html/show_bonus.tpl | 29 +- templates/de/html/show_bonus_msg.tpl | 10 +- view.php | 4 +- 163 files changed, 1770 insertions(+), 1433 deletions(-) create mode 100644 inc/config-global.php create mode 100644 inc/config-local.php.dist create mode 100644 inc/extensions/ext-lead.php create mode 100644 inc/load_config.php create mode 100644 inc/wrapper-functions.php create mode 100644 templates/de/html/ext/ext_lead.tpl diff --git a/.gitattributes b/.gitattributes index f9c448fe18..d789c7dec6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -92,6 +92,8 @@ inc/autopurge/purge-unconfirmed.php -text inc/cache/.htaccess -text inc/check-reset.php -text inc/config-functions.php -text +inc/config-global.php -text +inc/config-local.php.dist -text inc/config.php -text inc/databases.php -text inc/db/.htaccess -text @@ -125,6 +127,7 @@ inc/extensions/ext-events.php -text inc/extensions/ext-holiday.php -text inc/extensions/ext-html_mail.php -text inc/extensions/ext-iso3166.php -text +inc/extensions/ext-lead.php -text inc/extensions/ext-logs.php -text inc/extensions/ext-mailid.php -text inc/extensions/ext-maintenance.php -text @@ -261,6 +264,7 @@ inc/libs/user_functions.php -text inc/libs/wernis_functions.php -text inc/libs/yoomedia_functions.php -text inc/load_cache.php -text +inc/load_config.php -text inc/load_extensions.php -text inc/loader/.htaccess -text inc/loader/load_cache-admin.php -text @@ -627,6 +631,7 @@ inc/stylesheet.php -text inc/weekly/.htaccess -text inc/weekly/weekly_ -text inc/weekly/weekly_surfbar.php -text +inc/wrapper-functions.php -text /index.php -text /install.php -text install/menu-de.sql -text @@ -1241,6 +1246,7 @@ templates/de/html/ext/ext_doubler.tpl -text templates/de/html/ext/ext_events.tpl -text templates/de/html/ext/ext_holiday.tpl -text templates/de/html/ext/ext_html_mail.tpl -text +templates/de/html/ext/ext_lead.tpl -text templates/de/html/ext/ext_logs.tpl -text templates/de/html/ext/ext_mailid.tpl -text templates/de/html/ext/ext_maintenance.tpl -text diff --git a/.gitignore b/.gitignore index e14734f1e0..9df491e110 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ inc/.secret/dummy.php inc/cache/*.cache inc/cache/*.log inc/cache/.revision +inc/cache/config-local.php diff --git a/admin.php b/admin.php index 9ae71294ab..c6a9bf529e 100644 --- a/admin.php +++ b/admin.php @@ -48,7 +48,7 @@ $GLOBALS['module'] = 'admin'; $GLOBALS['output_mode'] = -1; // Load the required file(s) -require('inc/config.php'); +require('inc/config-global.php'); // Is the script installed? if (isInstalled()) { diff --git a/agb.php b/agb.php index 652ad4b257..065941cc7f 100644 --- a/agb.php +++ b/agb.php @@ -48,7 +48,7 @@ $GLOBALS['module'] = 'agb'; $GLOBALS['output_mode'] = -1; // Load the required file(s) -require('inc/config.php'); +require('inc/config-global.php'); // Is the script installed? if (isInstalled()) { diff --git a/beg.php b/beg.php index 6d4e6c5cc6..669afcf88e 100644 --- a/beg.php +++ b/beg.php @@ -51,7 +51,7 @@ $GLOBALS['output_mode'] = -1; $msg = null; // Load the required file(s) -require('inc/config.php'); +require('inc/config-global.php'); // Is the 'beg' extension active? REDIRCT_ON_UNINSTALLED_EXTENSION('beg'); @@ -69,7 +69,7 @@ if (isInstalled()) { $pay = false; // Validate if it is not a number - if ("".(REQUEST_GET('uid') + 0)."" !== "".REQUEST_GET('uid')."") { + if (''.(REQUEST_GET('uid') + 0).'' !== ''.REQUEST_GET('uid').'') { if (EXT_IS_ACTIVE('nickname')) { // Maybe we have found a nickname? $result = SQL_QUERY_ESC("SELECT userid, beg_clicks, ref_payout, status, last_online FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1", @@ -86,7 +86,7 @@ if (isInstalled()) { } // Check if locked in so don't pay points - $status = "failed"; + $status = 'failed'; // Check if account was found if (SQL_NUMROWS($result) == 1) { @@ -106,7 +106,7 @@ if (isInstalled()) { // Set nickname / userid for the template(s define('__BEG_UID' , REQUEST_GET('uid')); define('__BEG_CLICKS', ($clicks + 1)); - define('__BEG_BANNER', LOAD_TEMPLATE("beg_banner", true)); + define('__BEG_BANNER', LOAD_TEMPLATE('beg_banner', true)); define('__BEG_POINTS', translateComma($points)); } else { // Other status @@ -128,7 +128,7 @@ if (isInstalled()) { array($uid, detectRemoteAddr(), session_id()), __FILE__, __LINE__); // Entry not found, points set and not logged in? - if (((SQL_NUMROWS($result) == 0) || (IS_ADMIN())) && ($points > 0) && (!IS_MEMBER()) && (getConfig('beg_pay_mode') == "NONE")) { + if (((SQL_NUMROWS($result) == 0) || (IS_ADMIN())) && ($points > 0) && (!IS_MEMBER()) && (getConfig('beg_pay_mode') == 'NONE')) { // Admin is testing? if (!IS_ADMIN()) { @@ -139,10 +139,7 @@ if (isInstalled()) { array($uid, detectRemoteAddr(), session_id()), __FILE__, __LINE__); // Was is successfull? - if (SQL_AFFECTEDROWS() == 1) { - // Okay! - $pay = true; - } // END - if + $pay (SQL_AFFECTEDROWS() == 1); } else { // Is admin! $pay = true; @@ -153,19 +150,19 @@ if (isInstalled()) { // Add points to user or begging rallye account if (BEG_ADD_POINTS($uid, $points)) { // Set 'done' message - define('__BEG_MSG', LOAD_TEMPLATE("beg_done", true)); + $content['msg'] = LOAD_TEMPLATE('beg_done', true)); } else { // Error! - define('__BEG_MSG', LOAD_TEMPLATE("beg_failed", true)); + $content['msg'] = LOAD_TEMPLATE('beg_failed', true)); } } else { // Error! - define('__BEG_MSG', LOAD_TEMPLATE("beg_failed", true)); + $content['msg'] = LOAD_TEMPLATE('beg_failed', true)); } } elseif (IS_MEMBER()) { // Logged in user found! - define('__BEG_MSG', LOAD_TEMPLATE("beg_login", true)); - } elseif (getConfig('beg_pay_mode') != "NONE") { // Other pay-mode active! + $content['msg'] = LOAD_TEMPLATE('beg_login', true)); + } elseif (getConfig('beg_pay_mode') != 'NONE') { // Other pay-mode active! // Prepare content for template $content = array( 'clicks' => constant('__BEG_CLICKS'), @@ -174,11 +171,11 @@ if (isInstalled()) { ); // Load message template depending on pay-mode - define('__BEG_MSG', LOAD_TEMPLATE("beg_pay_mode_".strtolower(getConfig('beg_pay_mode')), true, $content)); + $content['msg'] = LOAD_TEMPLATE('beg_pay_mode_'.strtolower(getConfig('beg_pay_mode')), true, $content)); $pay = true; } else { // Clicked received while reload lock is active - define('__BEG_MSG', LOAD_TEMPLATE("beg_failed", true)); + $content['msg'] = LOAD_TEMPLATE('beg_failed', true)); } // Free memory @@ -188,28 +185,28 @@ if (isInstalled()) { loadIncludeOnce('inc/header.php'); // Load final template - LOAD_TEMPLATE("beg_link"); + LOAD_TEMPLATE('beg_link', false, $content); // Tracker code enabled? (We don't track users here! - if ((getConfig('beg_pay_mode') != "NONE") && ($pay)) { + if ((getConfig('beg_pay_mode') != 'NONE') && ($pay === true)) { // Prepare content for template // @TODO Opps, what is missing here??? $content = array( ); // Include config-depending template - LOAD_TEMPLATE("beg_pay_code_".strtolower(getConfig('beg_pay_mode')), false, $content); - } elseif ((!$pay) && (!defined('__BEG_MSG'))) { + LOAD_TEMPLATE('beg_pay_code_'.strtolower(getConfig('beg_pay_mode')), false, $content); + } elseif ((!$pay) && (!isset($content['msg']))) { // Cannot pay! :-( - define('__BEG_MSG', LOAD_TEMPLATE("beg_failed", true)); + $content['msg'] = LOAD_TEMPLATE('beg_failed', true)); } // Include footer loadIncludeOnce('inc/footer.php'); - } elseif (($status != 'CONFIRMED') && ($status != "failed")) { + } elseif (($status != 'CONFIRMED') && ($status != 'failed')) { // Maybe locked/unconfirmed account? $msg = generateErrorCodeFromUserStatus($status); - } elseif (($uid == '0') || ($status == "failed")) { + } elseif (($uid == '0') || ($status == 'failed')) { // Inalid or locked account, so let's find out $result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1", array(REQUEST_GET('uid')), __FILE__, __LINE__); diff --git a/birthday_confirm.php b/birthday_confirm.php index 829dc6965a..24c46fcc56 100644 --- a/birthday_confirm.php +++ b/birthday_confirm.php @@ -48,10 +48,10 @@ $GLOBALS['module'] = 'birthday_confirm'; $GLOBALS['output_mode'] = -1; // Load the required file(s) -require('inc/config.php'); +require('inc/config-global.php'); // Is the 'birthday' extension active? -REDIRECT_ON_UNINSTALLED_EXTENSION('birthday'); +redirectOnUninstalledExtension('birthday'); // Is the script installed? if (isInstalled()) { @@ -70,6 +70,9 @@ WHERE b.userid=%s AND b.chk_value='%s' LIMIT 1", array($uid, $chk), __FILE__, __LINE__); //* DEBUG: */ echo "uid=".$uid.",chk=".$chk." (".strlen($chk).'/'.strlen(REQUEST_GET('check')).'/'.SQL_NUMROWS($result).")
\n"; + // Prepare content + $content = array(); + // Is an entry there? if (SQL_NUMROWS($result) == 1) { // Ok, congratulation again! Here's your gift from us... @@ -95,21 +98,19 @@ WHERE b.userid=%s AND b.chk_value='%s' LIMIT 1", SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_birthday` WHERE userid=%s AND chk_value='%s' LIMIT 1", array($uid, $chk), __FILE__, __LINE__); - // Transfer data to constants for the template - define('__GENDER', translateGender($data['gender'])); - define('__SNAME' , $data['surname']); - define('__FNAME' , $data['family']); - define('__GIFT' , translateComma($data['points'])); + // "Translate" some data + $data['gender'] = translateGender($data['gender']); + $data['points'] = translateComma($data['points']); // Load message from template - define('__MSG', LOAD_TEMPLATE('birthday_msg', true)); + $content['msg'] = LOAD_TEMPLATE('birthday_msg', true, $data); } else { // Unconfirmed / locked accounts cannot get points - define('__MSG', sprintf(getMessage('BIRTHDAY_CANNOT_STATUS'), translateUserStatus($data['status']))); + $content['msg'] = sprintf(getMessage('BIRTHDAY_CANNOT_STATUS'), translateUserStatus($data['status'])); } } else { // Cannot load data! - define('__MSG', getMessage('BIRTHDAY_CANNOT_LOAD_DATA')); + $content['msg'] = getMessage('BIRTHDAY_CANNOT_LOAD_DATA'); } // Free memory @@ -122,13 +123,13 @@ WHERE b.userid=%s AND b.chk_value='%s' LIMIT 1", loadInclude('inc/header.php'); // Load birthday header template (for your banners, e.g.?) - define('__BIRTHDAY_HEADER', LOAD_TEMPLATE('birthday_header', true)); + $content['header'] = LOAD_TEMPLATE('birthday_header', true); // Load birthday footer template (for your banners, e.g.?) - define('__BIRTHDAY_FOOTER', LOAD_TEMPLATE('birthday_footer', true)); + $content['footer'] = LOAD_TEMPLATE('birthday_footer', true); // Load final template and output it - LOAD_TEMPLATE('birthday_confirm'); + LOAD_TEMPLATE('birthday_confirm', false, $content); // Include footer loadInclude('inc/footer.php'); diff --git a/click.php b/click.php index 48ddf484d8..cf6f3e529f 100644 --- a/click.php +++ b/click.php @@ -48,7 +48,7 @@ $GLOBALS['module'] = 'click'; $GLOBALS['output_mode'] = -1; // Load the required file(s) -require('inc/config.php'); +require('inc/config-global.php'); if (((REQUEST_ISSET_GET(('user'))) || (REQUEST_ISSET_GET(('reseller')))) && (REQUEST_ISSET_GET(('banner')))) { // Update clicks counter... diff --git a/confirm.php b/confirm.php index 1a540ccabc..96f7578208 100644 --- a/confirm.php +++ b/confirm.php @@ -48,7 +48,7 @@ $GLOBALS['module'] = 'confirm'; $GLOBALS['output_mode'] = -1; // Load the required file(s) -require('inc/config.php'); +require('inc/config-global.php'); // Is the script installed? if ((isInstalled()) && (isAdminRegistered())) { diff --git a/css.php b/css.php index 5206767093..714848650a 100644 --- a/css.php +++ b/css.php @@ -40,7 +40,7 @@ require('inc/libs/security_functions.php'); // Footer is disabled in CSS mode -$GLOBALS['footer_sent'] = "-1"; +$GLOBALS['footer_sent'] = '-1'; // Init variables $GLOBALS['what'] = ''; @@ -50,11 +50,11 @@ $GLOBALS['action'] = ''; $GLOBALS['output_mode'] = '1'; $GLOBALS['module'] = 'css'; -// Set header -header('Content-type: text/css'); - // Load the required file(s) -require('inc/config.php'); +require('inc/config-global.php'); + +// Set header +sendHeader('Content-type: text/css'); // Load header loadInclude('inc/header.php'); diff --git a/debug.php b/debug.php index c7cf9e9023..aa7c764e1f 100644 --- a/debug.php +++ b/debug.php @@ -48,7 +48,7 @@ $GLOBALS['module'] = 'debug'; $GLOBALS['output_mode'] = -1; // Load the required file(s) -require('inc/config.php'); +require('inc/config-global.php'); // Redirect only to registration page when this script is installed if ((isInstalled()) && (getTotalFatalErrors() == 0)) { diff --git a/doubler.php b/doubler.php index 908cc0264d..9a63547831 100644 --- a/doubler.php +++ b/doubler.php @@ -50,10 +50,10 @@ $GLOBALS['refid'] = 0; $GLOBALS['output_mode'] = 0; // Load the required file(s) -require('inc/config.php'); +require('inc/config-global.php'); // Is the 'doubler' extension active? -REDIRECT_ON_UNINSTALLED_EXTENSION('doubler'); +redirectOnUninstalledExtension('doubler'); // Is the script installed? if (isInstalled()) { diff --git a/img.php b/img.php index 2f39fa0e37..f1099706ea 100644 --- a/img.php +++ b/img.php @@ -48,7 +48,7 @@ $GLOBALS['module'] = 'img'; $GLOBALS['output_mode'] = -1; // Load the required file(s) -require('inc/config.php'); +require('inc/config-global.php'); // Script installed? if (isInstalled()) { @@ -59,10 +59,10 @@ if (isInstalled()) { if (REQUEST_ISSET_GET(('code'))) { // Generate image GENERATE_IMAGE(bigintval(REQUEST_GET('code'))); - } elseif (REQUEST_ISSET_GET(('tag'))) { + } elseif (REQUEST_ISSET_GET('tag')) { // Tag set so create the IFN (Include-FileName) $INC = sprintf("inc/img/tag-%s.php", - REQUEST_GET(('tag')) + REQUEST_GET('tag') ); // Include is readable? diff --git a/inc/config-functions.php b/inc/config-functions.php index 186ede8339..506db1b908 100644 --- a/inc/config-functions.php +++ b/inc/config-functions.php @@ -49,16 +49,16 @@ function mergeConfig ($newConfig) { } // Getter for $_CONFIG entries -function getConfig ($entry) { +function getConfig ($configEntry) { global $_CONFIG; // Default value $value = null; // Is the entry there? - if (isConfigEntrySet($entry)) { + if (isConfigEntrySet($configEntry)) { // Then use it - $value = $_CONFIG[$entry]; + $value = $_CONFIG[$configEntry]; } // END - if // Return it @@ -66,20 +66,26 @@ function getConfig ($entry) { } // Setter for $_CONFIG entries -function setConfigEntry ($entry, $value) { +function setConfigEntry ($configEntry, $value) { global $_CONFIG; // Secure the entry name - $entry = SQL_ESCAPE($entry); + if (function_exists('SQL_ESCAPE')) { + // Use our secure function + $configEntry = SQL_ESCAPE($configEntry); + } else { + // Use maybe insecure function + $configEntry = smartAddSlashes($configEntry); + } // And set it - $_CONFIG[$entry] = $value; + $_CONFIG[$configEntry] = $value; } // Checks wether the given config entry is set -function isConfigEntrySet ($entry) { +function isConfigEntrySet ($configEntry) { global $_CONFIG; - return (isset($_CONFIG[$entry])); + return (isset($_CONFIG[$configEntry])); } // Increment or init with given value or 1 as default the given config entry @@ -105,6 +111,7 @@ function isConfigLoaded () { // Init the config array function initConfig () { global $_CONFIG; + debug_report_bug('Reached!'); // Set a minimum dummy configuration $_CONFIG = array( @@ -116,19 +123,17 @@ function initConfig () { // Load configuration and return it as an arry function loadConfiguration ($no = '0') { - global $_CONFIG; - // Check for cache extension, cache-array and if the requested configuration is in cache - if ((is_array($GLOBALS['cache_array'])) && (isset($GLOBALS['cache_array']['config'][$no])) && (is_array($GLOBALS['cache_array']['config'][$no]))) { + if ((isset($GLOBALS['cache_array'])) && (is_array($GLOBALS['cache_array'])) && (isset($GLOBALS['cache_array']['config'][$no])) && (is_array($GLOBALS['cache_array']['config'][$no]))) { // Load config from cache //* DEBUG: */ echo gettype($GLOBALS['cache_array']['config'][$no])."
\n"; foreach ($GLOBALS['cache_array']['config'][$no] as $key => $value) { - $_CONFIG[$key] = $value; + setConfigEntry($key, $value); } // END - foreach // Count cache hits if exists - if ((isset($_CONFIG['cache_hits'])) && (EXT_IS_ACTIVE('cache'))) { - $_CONFIG['cache_hits']++; + if ((isConfigEntrySet('cache_hits')) && (EXT_IS_ACTIVE('cache'))) { + incrementConfigEntry('cache_hits'); } // END - if } elseif ((!EXT_IS_ACTIVE('cache')) || (!isset($GLOBALS['cache_array']['config'][$no]))) { // Load config from DB @@ -138,14 +143,14 @@ function loadConfiguration ($no = '0') { // Is the config there? if (SQL_NUMROWS($result_config) == 1) { // Get config from database - $_CONFIG = SQL_FETCHARRAY($result_config); + mergeConfig(SQL_FETCHARRAY($result_config)); } // END - if // Free result SQL_FREERESULT($result_config); // Remember this config in the array - $GLOBALS['cache_array']['config'][$no] = $_CONFIG; + $GLOBALS['cache_array']['config'][$no] = getConfigArray(); } } @@ -153,8 +158,17 @@ function loadConfiguration ($no = '0') { function getConfigArray () { global $_CONFIG; - // Return it - return $_CONFIG; + // Default is null + $return = null; + + // Is the config set? + if (isConfigLoaded()) { + // Then use it + $return = $_CONFIG; + } // END - if + + // Return result + return $return; } // [EOF] diff --git a/inc/config-global.php b/inc/config-global.php new file mode 100644 index 0000000000..de3c4ac3c3 --- /dev/null +++ b/inc/config-global.php @@ -0,0 +1,81 @@ + diff --git a/inc/config-local.php.dist b/inc/config-local.php.dist new file mode 100644 index 0000000000..08e6779d5f --- /dev/null +++ b/inc/config-local.php.dist @@ -0,0 +1,128 @@ + "localhost", + // CFG: MYSQL-DBASE + 'dbase' => "db", + // CFG: MYSQL-LOGIN + 'login' => "user", + // CFG: MYSQL-PASSWORD + 'password' => "pass", +); + +// SMTP-Subsystem (keep all empty to use legacy mail() command!) +// CFG: SMTP-HOSTNAME +setConfigEntry('SMTP_HOSTNAME', ""); +// CFG: SMTP-USER +setConfigEntry('SMTP_USER' , ""); +// CFG: SMTP-PASSWORD +setConfigEntry('SMTP_PASSWORD', ""); + +// @TODO Rewrite the following three constants, somehow... +// CFG: MAIN-TITLE +define('MAIN_TITLE', "Your mail-exchanger title"); + +// CFG: SLOGAN +define('SLOGAN', "Your cool slogan here"); + +// CFG: WEBMASTER +define('WEBMASTER', "you@some-hoster.tld.invalid"); + +// +?> diff --git a/inc/config.php b/inc/config.php index dfc866fb73..f551ef47b7 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1,173 +1,3 @@ "localhost", - // CFG: MYSQL-DBASE - 'dbase' => "db", - // CFG: MYSQL-LOGIN - 'login' => "user", - // CFG: MYSQL-PASSWORD - 'password' => "pass", -); - -// CFG: MYSQL-PREIFX -define('_MYSQL_PREFIX', "mxchange"); - -// CFG: TABLE-TYPE -define('_TABLE_TYPE', "MyISAM"); - -// CFG: DATABASE-TYPE -define('_DB_TYPE', "mysql3"); - -// Lead-Code data -define('LEAD_CODE_ENABLED', true); -define('LEAD_EXPIRY_TIME' , (30*24*60*60)); // == 30 days - -// SMTP-Subsystem (keep all empty to use legacy mail() command!) -// CFG: SMTP-HOSTNAME -define('SMTP_HOSTNAME', ""); -// CFG: SMTP-USER -define('SMTP_USER' , ""); -// CFG: SMTP-PASSWORD -define('SMTP_PASSWORD', ""); - -// SSL cookies? (enable only if you have SSL, URLs will begin with https://) -define('SSL_COOKIES', false); - -// CFG: BACKLINK (Enable backlink to mxchange.org in footer? rel=external is set!) -define('ENABLE_BACKLINK', true); - -// Connect to the MySQL database... -require(constant('PATH')."inc/mysql-connect.php"); - -// +// @DEPRECATED ?> diff --git a/inc/databases.php b/inc/databases.php index f06b34c034..d8ebad0b6f 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -95,26 +95,26 @@ setConfigEntry('one_day', (60*60*24)); // // Timestamp for yesterday, today ... all at 00:00 am -define('START_YDAY', makeTime(0, 0, 0, time() - getConfig('one_day'))); -define('START_TDAY', makeTime(0, 0, 0, time())); +setConfigEntry('START_YDAY', makeTime(0, 0, 0, time() - getConfig('one_day'))); +setConfigEntry('START_TDAY', makeTime(0, 0, 0, time())); // Take a prime number which is long (if you know a longer one please try it out!) -define('_PRIME', 591623); +setConfigEntry('_PRIME', 591623); // Calculate "entropy" with the prime number (for code generation) -define('_ADD', (constant('_PRIME') * constant('_PRIME') / (pi() * getConfig('code_length') + 1))); +setConfigEntry('_ADD', (getConfig('_PRIME') * getConfig('_PRIME') / (pi() * getConfig('code_length') + 1))); // Random number for e.g. the "cache-buster" used in OpenX script define('CACHE_BUSTER', mt_rand(1000000, 9999999)); // CFG: DEBUG-SQL (if enabled and DEBUG_MODE is enabled all SQL queries will be logged to debug.log) -define('DEBUG_SQL', false); +setConfigEntry('DEBUG_SQL', 'N'); // CFG: ENCRYPT-SEPERATOR -define('ENCRYPT_SEPERATOR', ':'); +setConfigEntry('ENCRYPT_SEPERATOR', ':'); // Extra title is empty by default -$EXTRA_TITLE = ''; +setExtraTitle(''); // ?> diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index b0de8af3fc..823e5d02f9 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -51,10 +51,10 @@ function SQL_QUERY ($sql_string, $F, $L) { $sql_string = str_replace("\t", " ", str_replace("\n", " ", str_replace("\r", " ", $sql_string))); // Replace {!_MYSQL_PREFIX!} with constant, closes #84. Thanks to profi-concept - $sql_string = str_replace("{!_MYSQL_PREFIX!}", constant('_MYSQL_PREFIX'), $sql_string); + $sql_string = str_replace("{!_MYSQL_PREFIX!}", getConfig('_MYSQL_PREFIX'), $sql_string); // Replace {!_TABLE_TYPE!} with constant - $sql_string = str_replace("{!_TABLE_TYPE!}", constant('_TABLE_TYPE'), $sql_string); + $sql_string = str_replace("{!_TABLE_TYPE!}", getConfig('_TABLE_TYPE'), $sql_string); // Starting time $querytimeBefore = array_sum(explode(' ', microtime())); @@ -80,11 +80,11 @@ Query string:
// Debug output //* DEBUG: */ print "Query=
".$sql_string."
, affected=".SQL_AFFECTEDROWS().", numrows=".SQL_NUMROWS($result)."
\n"; - if (($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1") && (isDebugModeEnabled()) && (isBooleanConstantAndTrue('DEBUG_SQL'))) { + if (($GLOBALS['output_mode'] != '1') && ($GLOBALS['output_mode'] != '-1') && (isDebugModeEnabled()) && (getConfig('DEBUG_SQL') == 'Y')) { // // Debugging stuff... // - $fp = fopen(constant('PATH')."inc/cache/mysql.log", 'a') or app_die(__FILE__, __LINE__, "Cannot write mysql.log!"); + $fp = fopen(constant('PATH') . 'inc/cache/mysql.log', 'a') or app_die(__FILE__, __LINE__, "Cannot write mysql.log!"); if (!isset($GLOBALS['sql_first_entry'])) { // Write first entry fwrite($fp, "Module=".$GLOBALS['module']."\n"); @@ -274,7 +274,7 @@ function SQL_QUERY_ESC ($qstring, $data, $F, $L, $run=true, $strip=true, $secure // Debugging // //* DEBUG: */ $fp = fopen(constant('PATH')."inc/cache/escape_debug.log", 'a') or app_die(__FILE__, __LINE__, "Cannot write debug.log!"); - //* DEBUG: */ fwrite($fp, $F."(".$L."): ".str_replace("\r", '', str_replace("\n", " ", $eval))."\n"); + //* DEBUG: */ fwrite($fp, $F.'('.$L."): ".str_replace("\r", '', str_replace("\n", " ", $eval))."\n"); //* DEBUG: */ fclose($fp); // Run the code @@ -351,47 +351,54 @@ function SQL_ALTER_TABLE ($sql, $F, $L) { $result = false; // Determine index/fulltext/unique word - // 12 3 3 2 2 3 3 2 2 3 3 21 - $noIndex = ((ereg("INDEX", $sql) == false) && (ereg("FULLTEXT", $sql) == false) && (ereg("UNIQUE", $sql) == false)); + $noIndex = ( + ( + strpos($sql, 'INDEX') === false + ) && ( + strpos($sql, 'FULLTEXT') === false + ) && ( + strpos($sql, 'UNIQUE') === false + ) + ); // Extract table name $tableArray = explode(" ", $sql); - $tableName = str_replace("`", '', $tableArray[2]); + $tableName = str_replace('`', '', $tableArray[2]); // Shall we add/drop? - if (((ereg("ADD", $sql)) || (ereg("DROP", $sql))) && ($noIndex)) { + if (((strpos($sql, 'ADD') !== false) || (strpos($sql, 'DROP') !== false)) && ($noIndex === true)) { // And column name as well - $columnName = str_replace("`", '', $tableArray[4]); + $columnName = str_replace('`', '', $tableArray[4]); // Get column information $result = SQL_QUERY_ESC("SHOW COLUMNS FROM %s LIKE '%s'", array($tableName, $columnName), __FILE__, __LINE__); // Do we have no entry on ADD or an entry on DROP? - // 123 4 4 3 3 4 432 23 4 4 3 3 4 4321 - if (((SQL_NUMROWS($result) == 0) && (ereg("ADD", $sql))) || ((SQL_NUMROWS($result) == 1) && (ereg("DROP", $sql)))) { + // 123 4 4 3 3 4 4 32 23 4 4 3 3 4 4 321 + if (((SQL_NUMROWS($result) == 0) && (strpos($sql, 'ADD') !== false)) || ((SQL_NUMROWS($result) == 1) && (strpos($sql, 'DROP') !== false))) { // Do the query //* DEBUG: */ print __LINE__.':'.$sql."
\n"; $result = SQL_QUERY($sql, $F, $L, false); } // END - if - } elseif ((constant('_TABLE_TYPE') == "InnoDB") && (ereg("FULLTEXT", $sql))) { + } elseif ((getConfig('_TABLE_TYPE') == 'InnoDB') && (strpos($sql, 'FULLTEXT') !== false)) { // Skip this query silently //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Skipped FULLTEXT: sql=%s,file=%s,line=%s", $sql, $F, $L)); } elseif (!$noIndex) { // And column name as well - $columnName = str_replace("`", '', $tableArray[4]); + $columnName = str_replace('`', '', $tableArray[4]); // Is this "UNIQUE" or so? FULLTEXT has been handled the elseif() block above - if (in_array(strtoupper($columnName), array("INDEX", "UNIQUE", "KEY", "FULLTEXT"))) { + if (in_array(strtoupper($columnName), array('INDEX', 'UNIQUE', 'KEY', 'FULLTEXT'))) { // Init loop - $begin = 1; $columnName = ","; - while (strpos($columnName, ",") !== false) { + $begin = 1; $columnName = ','; + while (strpos($columnName, ',') !== false) { // Use last - $columnName = str_replace("`", '', $tableArray[count($tableArray) - $begin]); + $columnName = str_replace('`', '', $tableArray[count($tableArray) - $begin]); //* DEBUG: */ print __LINE__.':'.$columnName."----------------".$begin."
\n"; // Remove brackes - $columnName = str_replace("(", '', str_replace(")", '', $columnName)); + $columnName = str_replace('(', '', str_replace(')', '', $columnName)); //* DEBUG: */ print __LINE__.':'.$columnName."----------------".$begin."
\n"; // Continue @@ -400,7 +407,7 @@ function SQL_ALTER_TABLE ($sql, $F, $L) { } // END - if // Show indexes - $result = SQL_QUERY_ESC("SHOW INDEX FROM %s", + $result = SQL_QUERY_ESC("SHOW INDEX FROM `%s`", array($tableName), __FILE__, __LINE__); // Walk through all diff --git a/inc/db/lib.php b/inc/db/lib.php index 72a1f6a525..217d7681b0 100644 --- a/inc/db/lib.php +++ b/inc/db/lib.php @@ -40,20 +40,20 @@ if (!defined('__SECURITY')) { $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php'; require($INC); -} +} // END - if -// Select MySQL 3 as default database type -if (!defined('_DB_TYPE')) define('_DB_TYPE', "mysql3"); +// Is it not set? +if (!isConfigEntrySet('_DB_TYPE')) setConfigEntry('_DB_TYPE', 'mysql3'); // Create include file name -$INC = sprintf("inc/db/lib-%s.php", constant('_DB_TYPE')); +$INC = sprintf("inc/db/lib-%s.php", getConfig('_DB_TYPE')); if (isIncludeReadable($INC)) { // Include abstraction layer loadIncludeOnce($INC); } else { // Bye, bye... - die("Cannot load database abstraction layer ".constant('_DB_TYPE')." -> R.I.P."); + die('Cannot load database abstraction layer ' . getConfig('_DB_TYPE') . ' -> R.I.P.'); } // diff --git a/inc/doubler_send.php b/inc/doubler_send.php index 9388fc6b82..6017dfb65e 100644 --- a/inc/doubler_send.php +++ b/inc/doubler_send.php @@ -148,7 +148,7 @@ if (((SQL_NUMROWS($result_total) > 0) && (getConfig('doubler_sent_all') == 'Y')) // Doubled points 'points' => translateComma($content['points']), // Timemark - 'when' => generateDateTime($content['timemark'], "2"), + 'when' => generateDateTime($content['timemark'], '2'), // IP number when the member submitted the doubling form 'ip' => $content['remote_ip'], ); diff --git a/inc/extensions.php b/inc/extensions.php index d6c49ad67c..58f22fd028 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -1237,7 +1237,7 @@ function EXT_GET_REMOVAL_LIST () { } // Redirects if the provided extension is not installed -function REDIRECT_ON_UNINSTALLED_EXTENSION ($ext_name) { +function redirectOnUninstalledExtension ($ext_name) { // So is the extension there? if (!EXT_IS_ACTIVE($ext_name)) { // Redirect to index diff --git a/inc/extensions/ext-lead.php b/inc/extensions/ext-lead.php new file mode 100644 index 0000000000..1e8d7ea6a5 --- /dev/null +++ b/inc/extensions/ext-lead.php @@ -0,0 +1,92 @@ + diff --git a/inc/extensions/ext-newsletter.php b/inc/extensions/ext-newsletter.php index 2baf2f7745..83f9bdd779 100644 --- a/inc/extensions/ext-newsletter.php +++ b/inc/extensions/ext-newsletter.php @@ -158,10 +158,10 @@ default: // Do stuff when extension is loaded // Don't use these chars in links... ;-) // $GLOBALS['url_ends'] = array( - " ", + ' ', "\n", "\r", - ")", + ')', ); // Valid email chars (without @, or do you want to have another @ inside your email addy?) diff --git a/inc/filters.php b/inc/filters.php index 74cda8e85b..098a2157f9 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -521,7 +521,7 @@ function FILTER_CHECK_ADMIN_ACL () { // Filter for initializing randomizer function FILTER_INIT_RANDOMIZER () { // Simply init the randomizer with seed and _ADD value - mt_srand(generateSeed() + constant('_ADD')); + mt_srand(generateSeed() + getConfig('_ADD')); } // Filter for removing updates diff --git a/inc/footer.php b/inc/footer.php index 556022f0bf..d822c4eb7f 100644 --- a/inc/footer.php +++ b/inc/footer.php @@ -45,7 +45,7 @@ if (!defined('__SECURITY')) { // Footer disabled or already sent? // 1234 5 54 45 5 5 543 3 321 -if ((((!isset($GLOBALS['footer_sent'])) || (($GLOBALS['footer_sent'] != "1") && ($GLOBALS['footer_sent'] != "2"))) && ($GLOBALS['output_mode'] != "1"))) { +if ((((!isset($GLOBALS['footer_sent'])) || (($GLOBALS['footer_sent'] != '1') && ($GLOBALS['footer_sent'] != '2'))) && ($GLOBALS['output_mode'] != '1'))) { // Output the generated HTML code or do nothing in direct-mode if (getTotalFatalErrors() > 0) { // Output fatal error messages @@ -53,9 +53,9 @@ if ((((!isset($GLOBALS['footer_sent'])) || (($GLOBALS['footer_sent'] != "1") && } // END - if // Shall we display the copyright notice? - if ((!REQUEST_ISSET_GET(('frame'))) && (basename($_SERVER['PHP_SELF']) != "mailid_top.php") && (isBooleanConstantAndTrue('WRITE_FOOTER')) && ($GLOBALS['header_sent'] == "2")) { + if ((!REQUEST_ISSET_GET(('frame'))) && (basename($_SERVER['PHP_SELF']) != "mailid_top.php") && (getConfig('WRITE_FOOTER') == 'Y') && ($GLOBALS['header_sent'] == '2')) { // Backlink enabled? - if (isBooleanConstantAndTrue('ENABLE_BACKLINK')) { + if ((getConfig('ENABLE_BACKLINK') == 'Y') || (isInstalling())) { // Copyright with backlink, thanks! :-) LOAD_TEMPLATE("copyright_backlink"); } else { @@ -65,7 +65,7 @@ if ((((!isset($GLOBALS['footer_sent'])) || (($GLOBALS['footer_sent'] != "1") && } // END - if // Shall we display the parsing time and number of queries? - if ((GET_EXT_VERSION('sql_patches') >= '0.4.1') && (getConfig('show_timings') == 'Y') && (!REQUEST_ISSET_GET(('frame'))) && ($GLOBALS['header_sent'] == "2")) { + if ((GET_EXT_VERSION('sql_patches') >= '0.4.1') && (getConfig('show_timings') == 'Y') && (!REQUEST_ISSET_GET(('frame'))) && ($GLOBALS['header_sent'] == '2')) { // Then display it here displayParsingTime(); } // END - if diff --git a/inc/functions.php b/inc/functions.php index dc5fe39367..7262baf0b7 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -41,7 +41,7 @@ if (!defined('__SECURITY')) { require($INC); } -// Output HTML code directly or "render" it. You addionally switch the new-line character off +// Output HTML code directly or 'render' it. You addionally switch the new-line character off function OUTPUT_HTML ($HTML, $newLine = true) { // Some global variables global $OUTPUT; @@ -49,11 +49,11 @@ function OUTPUT_HTML ($HTML, $newLine = true) { // Do we have HTML-Code here? if (!empty($HTML)) { // Yes, so we handle it as you have configured - switch (constant('OUTPUT_MODE')) + switch (getConfig('OUTPUT_MODE')) { - case "render": + case 'render': // That's why you don't need any \n at the end of your HTML code... :-) - if (constant('_OB_CACHING') == "on") { + if (constant('_OB_CACHING') == 'on') { // Output into PHP's internal buffer outputRawCode($HTML); @@ -70,7 +70,7 @@ function OUTPUT_HTML ($HTML, $newLine = true) { case 'direct': // If we are switching from render to direct output rendered code - if ((!empty($OUTPUT)) && (constant('_OB_CACHING') != "on")) { outputRawCode($OUTPUT); $OUTPUT = ''; } + if ((!empty($OUTPUT)) && (constant('_OB_CACHING') != 'on')) { outputRawCode($OUTPUT); $OUTPUT = ''; } // The same as above... ^ outputRawCode($HTML); @@ -79,11 +79,11 @@ function OUTPUT_HTML ($HTML, $newLine = true) { default: // Huh, something goes wrong or maybe you have edited config.php ??? - DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Invalid renderer %s detected.", constant('OUTPUT_MODE'))); + DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Invalid renderer %s detected.", getConfig('OUTPUT_MODE'))); app_die(__FUNCTION__, __LINE__, "{--FATAL_ERROR--}: {--LANG_NO_RENDER_DIRECT--}"); break; } - } elseif ((constant('_OB_CACHING') == "on") && (isset($GLOBALS['footer_sent'])) && ($GLOBALS['footer_sent'] == 1)) { + } elseif ((constant('_OB_CACHING') == 'on') && (isset($GLOBALS['footer_sent'])) && ($GLOBALS['footer_sent'] == 1)) { // Headers already sent? if (headers_sent()) { // Log this error @@ -102,20 +102,20 @@ function OUTPUT_HTML ($HTML, $newLine = true) { } // END - if // Send HTTP header - header("HTTP/1.1 200"); + sendHeader('HTTP/1.1 200'); // Used later $now = gmdate('D, d M Y H:i:s') . ' GMT'; // General headers for no caching - header("Expired: " . $now); // RFC2616 - Section 14.21 - header("Last-Modified: " . $now); - header("Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0"); // HTTP/1.1 - header("Pragma: no-cache"); // HTTP/1.0 - header("Connection: Close"); + sendHeader('Expired: ' . $now); // RFC2616 - Section 14.21 + sendHeader('Last-Modified: ' . $now); + sendHeader('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1 + sendHeader('Pragma: no-cache'); // HTTP/1.0 + sendHeader('Connection: Close'); // Extension 'rewrite' installed? - if ((EXT_IS_ACTIVE('rewrite')) && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) { + if ((EXT_IS_ACTIVE('rewrite')) && ($GLOBALS['output_mode'] != '1') && ($GLOBALS['output_mode'] != '-1')) { $OUTPUT = rewriteLinksInCode($OUTPUT); } // END - if @@ -136,9 +136,9 @@ function OUTPUT_HTML ($HTML, $newLine = true) { // Output code here, DO NOT REMOVE! ;-) outputRawCode($OUTPUT); - } elseif ((constant('OUTPUT_MODE') == "render") && (!empty($OUTPUT))) { + } elseif ((getConfig('OUTPUT_MODE') == 'render') && (!empty($OUTPUT))) { // Rewrite links when rewrite extension is active - if ((EXT_IS_ACTIVE('rewrite')) && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) { + if ((EXT_IS_ACTIVE('rewrite')) && ($GLOBALS['output_mode'] != '1') && ($GLOBALS['output_mode'] != '-1')) { $OUTPUT = rewriteLinksInCode($OUTPUT); } // END - if @@ -158,8 +158,8 @@ function outputRawCode ($HTML) { // Output stripped HTML code to avoid broken JavaScript code, etc. echo stripslashes(stripslashes($HTML)); - // Flush the output if only constant('_OB_CACHING') is not "on" - if (constant('_OB_CACHING') != "on") { + // Flush the output if only constant('_OB_CACHING') is not 'on' + if (constant('_OB_CACHING') != 'on') { // Flush it flush(); } // END - if @@ -259,7 +259,7 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) { } // END - if // Generate date/time string - $date_time = generateDateTime(time(), "1"); + $date_time = generateDateTime(time(), '1'); // Base directory $basePath = sprintf("%stemplates/%s/html/", constant('PATH'), getLanguage()); @@ -343,12 +343,12 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) { $ret = "\n".$ret."\n"; } elseif ((IS_ADMIN()) || ((isInstalling()) && (!isInstalled()))) { // Only admins shall see this warning or when installation mode is active - $ret = "
".TEMPLATE_404."
+ $ret = "
{--TEMPLATE_404--}
(".basename($FQFN).")

-".TEMPLATE_CONTENT." +{--TEMPLATE_CONTENT--}
".print_r($content, true)."
-".TEMPLATE_DATA." +{--TEMPLATE_DATA--}
".print_r($DATA, true)."


"; } @@ -411,7 +411,7 @@ function sendEmail($toEmail, $subject, $message, $HTML = 'N', $mailHeader = '') //* DEBUG: */ print __FUNCTION__."(".__LINE__."):TO={$toEmail}
\n"; // Check for PHPMailer or debug-mode - if (!CHECK_PHPMAILER_USAGE()) { + if (!checkPhpMailerUsage()) { // Not in PHPMailer-Mode if (empty($mailHeader)) { // Load email header template @@ -450,32 +450,30 @@ Message : ".$message." \n"); } elseif (($HTML == 'Y') && (EXT_IS_ACTIVE('html_mail'))) { // Send mail as HTML away - SEND_HTML_EMAIL($toEmail, $subject, $message, $mailHeader); + sendHtmlEmail($toEmail, $subject, $message, $mailHeader); } elseif (!empty($toEmail)) { // Send Mail away - SEND_RAW_EMAIL($toEmail, $subject, $message, $mailHeader); + sendRawEmail($toEmail, $subject, $message, $mailHeader); } elseif ($HTML == 'N') { // Problem found! - SEND_RAW_EMAIL(constant('WEBMASTER'), "[PROBLEM:]".$subject, $message, $mailHeader); + sendRawEmail(constant('WEBMASTER'), '[PROBLEM:]' . $subject, $message, $mailHeader); } } // Check if legacy or PHPMailer command // @TODO Rewrite this to an extension 'smtp' // @private -function CHECK_PHPMAILER_USAGE() { - return ((defined('SMTP_HOSTNAME')) && (defined('SMTP_USER')) && (defined('SMTP_PASSWORD')) && (constant('SMTP_HOSTNAME') != '') && (constant('SMTP_USER') != '')); +function checkPhpMailerUsage() { + return ((getConfig('SMTP_HOSTNAME') != '') && (getConfig('SMTP_USER') != '')); } -/* - * Send out a raw email with PHPMailer class or legacy mail() command - */ -function SEND_RAW_EMAIL ($toEmail, $subject, $msg, $from) { +// Send out a raw email with PHPMailer class or legacy mail() command +function sendRawEmail ($toEmail, $subject, $msg, $from) { // Shall we use PHPMailer class or legacy mode? - if (CHECK_PHPMAILER_USAGE()) { + if (checkPhpMailerUsage()) { // Use PHPMailer class with SMTP enabled - loadIncludeOnce("inc/phpmailer/class.phpmailer.php"); - loadIncludeOnce("inc/phpmailer/class.smtp.php"); + loadIncludeOnce('inc/phpmailer/class.phpmailer.php'); + loadIncludeOnce('inc/phpmailer/class.smtp.php'); // get new instance $mail = new PHPMailer(); @@ -483,10 +481,10 @@ function SEND_RAW_EMAIL ($toEmail, $subject, $msg, $from) { $mail->IsSMTP(); $mail->SMTPAuth = true; - $mail->Host = constant('SMTP_HOSTNAME'); + $mail->Host = getConfig('SMTP_HOSTNAME'); $mail->Port = 25; - $mail->Username = constant('SMTP_USER'); - $mail->Password = constant('SMTP_PASSWORD'); + $mail->Username = getConfig('SMTP_USER'); + $mail->Password = getConfig('SMTP_PASSWORD'); if (empty($from)) { $mail->From = constant('WEBMASTER'); } else { @@ -496,7 +494,7 @@ function SEND_RAW_EMAIL ($toEmail, $subject, $msg, $from) { $mail->Subject = $subject; if ((EXT_IS_ACTIVE('html_mail')) && (strip_tags($msg) != $msg)) { $mail->Body = $msg; - $mail->AltBody = "Your mail program required HTML support to read this mail!"; + $mail->AltBody = 'Your mail program required HTML support to read this mail!'; $mail->WordWrap = 70; $mail->IsHTML(true); } else { @@ -504,8 +502,8 @@ function SEND_RAW_EMAIL ($toEmail, $subject, $msg, $from) { } $mail->AddAddress($toEmail, ''); $mail->AddReplyTo(constant('WEBMASTER'), constant('MAIN_TITLE')); - $mail->AddCustomHeader("Errors-To:".constant('WEBMASTER')); - $mail->AddCustomHeader("X-Loop:".constant('WEBMASTER')); + $mail->AddCustomHeader('Errors-To:' . constant('WEBMASTER')); + $mail->AddCustomHeader('X-Loop:' . constant('WEBMASTER')); $mail->Send(); } else { // Use legacy mail() command @@ -580,7 +578,7 @@ function generateDateTime ($time, $mode = '0') { // Translates Y/N to yes/no function translateYesNo ($yn) { // Default - $translated = "??? (".$yn.")"; + $translated = "??? (".$yn.')'; switch ($yn) { case 'Y': $translated = getMessage('YES'); break; case 'N': $translated = getMessage('NO'); break; @@ -728,11 +726,6 @@ function countSelection ($array) { return $ret; } -// Wrapper for $_POST['sel'] -function countPostSelection () { - return countSelection(REQUEST_POST('sel')); -} - // Generate XHTML code for the CAPTCHA function generateCaptchaCode ($code, $type, $DATA, $uid) { return 'Code'; @@ -741,13 +734,13 @@ function generateCaptchaCode ($code, $type, $DATA, $uid) { // "Getter" for language function getLanguage () { // Set default return value to default language from config - $ret = constant('DEFAULT_LANG'); + $ret = getConfig('DEFAULT_LANG'); // Init variable $lang = ''; // Is the variable set - if (REQUEST_ISSET_GET(('mx_lang'))) { + if (REQUEST_ISSET_GET('mx_lang')) { // Accept only first 2 chars $lang = substr(REQUEST_GET('mx_lang'), 0, 2); } elseif (isset($GLOBALS['cache_array']['language'])) { @@ -755,16 +748,16 @@ function getLanguage () { $ret = $GLOBALS['cache_array']['language']; } elseif (!empty($lang)) { // Check if main language file does exist - if (isFileReadable(constant('PATH').'inc/language/'.$lang.'.php')) { + if (isFileReadable(constant('PATH') . 'inc/language/'.$lang.'.php')) { // Okay found, so let's update cookies setLanguage($lang); - } - } elseif (!isSessionVariableSet('mx_lang')) { + } // END - if + } elseif (isSessionVariableSet('mx_lang')) { // Return stored value from cookie $ret = getSession('mx_lang'); // Fixes a warning before the session has the mx_lang constant - if (empty($ret)) $ret = constant('DEFAULT_LANG'); + if (empty($ret)) $ret = getConfig('DEFAULT_LANG'); } // Cache entry @@ -935,7 +928,7 @@ function LOAD_EMAIL_TEMPLATE ($template, $content = array(), $UID = '0') { return COMPILE_CODE($newContent); } -// Generates a timestamp (wrapper for mktime()) +// Generates a timestamp (some wrapper for mktime()) function makeTime ($H, $M, $S, $stamp) { // Extract day, month and year from given timestamp $day = date('d', $stamp); @@ -947,7 +940,7 @@ function makeTime ($H, $M, $S, $stamp) { } // Redirects to an URL and if neccessarry extends it with own base URL -function redirectToUrl ($URL, $addUrlData=true) { +function redirectToUrl ($URL) { // Compile out URI codes $URL = compileUriCode($URL); @@ -958,7 +951,7 @@ function redirectToUrl ($URL, $addUrlData=true) { } // END - if // Three different debug ways... - //* DEBUG: */ debug_report_bug(sprintf("%s[%s:] URL=%s", __FUNCTION__, __LINE__, $URL)); + /* DEBUG: */ debug_report_bug(sprintf("%s[%s:] URL=%s", __FUNCTION__, __LINE__, $URL)); //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, $URL); //* DEBUG: */ die($URL); @@ -979,9 +972,6 @@ function redirectToUrl ($URL, $addUrlData=true) { clearOutputBuffer(); } // END - if - // Add some data to URL if cookies are not accepted - if ((!isBooleanConstantAndTrue('__COOKIES')) && ($addUrlData === true)) $URL = addUrlData($URL); - // Secure the URL against bad things such als HTML insertions and so on... $URL = htmlentities(strip_tags($URL), ENT_QUOTES); @@ -992,7 +982,7 @@ function redirectToUrl ($URL, $addUrlData=true) { } elseif (!headers_sent()) { // Load URL when headers are not sent //* DEBUG: */ debug_report_bug("URL={$URL}"); - header ('Location: '.str_replace('&', '&', $URL)); + sendHeader('Location: '.str_replace('&', '&', $URL)); } else { // Output error message loadInclude('inc/header.php'); @@ -1005,7 +995,7 @@ function redirectToUrl ($URL, $addUrlData=true) { } // Wrapper for redirectToUrl but URL comes from a configuration entry -function LOAD_CONFIGURED_URL ($configEntry) { +function redirectToConfiguredUrl ($configEntry) { // Get the URL $URL = getConfig($configEntry); @@ -1278,40 +1268,40 @@ function generateRandomCodde ($length, $code, $uid, $DATA = '') { if (!defined('_MAX')) define('_MAX', 15235); // Build server string - $server = $_SERVER['PHP_SELF'].constant('ENCRYPT_SEPERATOR').detectUserAgent().constant('ENCRYPT_SEPERATOR').getenv('SERVER_SOFTWARE').constant('ENCRYPT_SEPERATOR').detectRemoteAddr().":'.':".filemtime(constant('PATH')."inc/databases.php"); + $server = $_SERVER['PHP_SELF'].getConfig('ENCRYPT_SEPERATOR').detectUserAgent().getConfig('ENCRYPT_SEPERATOR').getenv('SERVER_SOFTWARE').getConfig('ENCRYPT_SEPERATOR').detectRemoteAddr().":'.':".filemtime(constant('PATH').'inc/databases.php'); // Build key string - $keys = constant('SITE_KEY').constant('ENCRYPT_SEPERATOR').constant('DATE_KEY'); - if (isConfigEntrySet('secret_key')) $keys .= constant('ENCRYPT_SEPERATOR').getConfig('secret_key'); - if (isConfigEntrySet('file_hash')) $keys .= constant('ENCRYPT_SEPERATOR').getConfig('file_hash'); - $keys .= constant('ENCRYPT_SEPERATOR').date("d-m-Y (l-F-T)", getConfig(('patch_ctime'))); - if (isConfigEntrySet('master_salt')) $keys .= constant('ENCRYPT_SEPERATOR').getConfig('master_salt'); + $keys = getConfig('SITE_KEY').getConfig('ENCRYPT_SEPERATOR').getConfig('DATE_KEY'); + if (isConfigEntrySet('secret_key')) $keys .= getConfig('ENCRYPT_SEPERATOR').getConfig('secret_key'); + if (isConfigEntrySet('file_hash')) $keys .= getConfig('ENCRYPT_SEPERATOR').getConfig('file_hash'); + $keys .= getConfig('ENCRYPT_SEPERATOR').date("d-m-Y (l-F-T)", getConfig(('patch_ctime'))); + if (isConfigEntrySet('master_salt')) $keys .= getConfig('ENCRYPT_SEPERATOR').getConfig('master_salt'); // Build string from misc data - $data = $code.constant('ENCRYPT_SEPERATOR').$uid.constant('ENCRYPT_SEPERATOR').$DATA; + $data = $code.getConfig('ENCRYPT_SEPERATOR').$uid.getConfig('ENCRYPT_SEPERATOR').$DATA; // Add more additional data - if (isSessionVariableSet('u_hash')) $data .= constant('ENCRYPT_SEPERATOR').getSession('u_hash'); - if (isUserIdSet()) $data .= constant('ENCRYPT_SEPERATOR').getUserId(); - if (isSessionVariableSet('mxchange_theme')) $data .= constant('ENCRYPT_SEPERATOR').getSession('mxchange_theme'); - if (isSessionVariableSet('mx_lang')) $data .= constant('ENCRYPT_SEPERATOR').getLanguage(); - if (isset($GLOBALS['refid'])) $data .= constant('ENCRYPT_SEPERATOR').$GLOBALS['refid']; + if (isSessionVariableSet('u_hash')) $data .= getConfig('ENCRYPT_SEPERATOR').getSession('u_hash'); + if (isUserIdSet()) $data .= getConfig('ENCRYPT_SEPERATOR').getUserId(); + if (isSessionVariableSet('mxchange_theme')) $data .= getConfig('ENCRYPT_SEPERATOR').getSession('mxchange_theme'); + if (isSessionVariableSet('mx_lang')) $data .= getConfig('ENCRYPT_SEPERATOR').getLanguage(); + if (isset($GLOBALS['refid'])) $data .= getConfig('ENCRYPT_SEPERATOR').$GLOBALS['refid']; // Calculate number for generating the code - $a = $code + constant('_ADD') - 1; + $a = $code + getConfig('_ADD') - 1; if (isConfigEntrySet('master_hash')) { // Generate hash with master salt from modula of number with the prime number and other data - $saltedHash = generateHash(($a % constant('_PRIME')).constant('ENCRYPT_SEPERATOR').$server.constant('ENCRYPT_SEPERATOR').$keys.constant('ENCRYPT_SEPERATOR').$data.constant('ENCRYPT_SEPERATOR').date("d-m-Y (l-F-T)", time()).constant('ENCRYPT_SEPERATOR').$a, getConfig('master_salt')); + $saltedHash = generateHash(($a % getConfig('_PRIME')).getConfig('ENCRYPT_SEPERATOR').$server.getConfig('ENCRYPT_SEPERATOR').$keys.getConfig('ENCRYPT_SEPERATOR').$data.getConfig('ENCRYPT_SEPERATOR').getConfig('DATE_KEY').getConfig('ENCRYPT_SEPERATOR').$a, getConfig('master_salt')); // Create number from hash - $rcode = hexdec(substr($saltedHash, strlen(getConfig('master_salt')), 9)) / abs(constant('_MAX') - $a + sqrt(constant('_ADD'))) / pi(); + $rcode = hexdec(substr($saltedHash, strlen(getConfig('master_salt')), 9)) / abs(constant('_MAX') - $a + sqrt(getConfig('_ADD'))) / pi(); } else { // Generate hash with "hash of site key" from modula of number with the prime number and other data - $saltedHash = generateHash(($a % constant('_PRIME')).constant('ENCRYPT_SEPERATOR').$server.constant('ENCRYPT_SEPERATOR').$keys.constant('ENCRYPT_SEPERATOR').$data.constant('ENCRYPT_SEPERATOR').date("d-m-Y (l-F-T)", time()).constant('ENCRYPT_SEPERATOR').$a, substr(sha1(constant('SITE_KEY')), 0, 8)); + $saltedHash = generateHash(($a % getConfig('_PRIME')).getConfig('ENCRYPT_SEPERATOR').$server.getConfig('ENCRYPT_SEPERATOR').$keys.getConfig('ENCRYPT_SEPERATOR').$data.getConfig('ENCRYPT_SEPERATOR').getConfig('DATE_KEY').getConfig('ENCRYPT_SEPERATOR').$a, substr(sha1(getConfig('SITE_KEY')), 0, 8)); // Create number from hash - $rcode = hexdec(substr($saltedHash, 8, 9)) / abs(constant('_MAX') - $a + sqrt(constant('_ADD'))) / pi(); + $rcode = hexdec(substr($saltedHash, 8, 9)) / abs(constant('_MAX') - $a + sqrt(getConfig('_ADD'))) / pi(); } // At least 10 numbers shall be secure enought! @@ -1361,12 +1351,12 @@ function GENERATE_IMAGE ($img_code, $headerSent=true) { // Switch image type switch (getConfig('img_type')) { - case "jpg": + case 'jpg': // Okay, load image and hide all errors $image = @imagecreatefromjpeg($img); break; - case "png": + case 'png': // Okay, load image and hide all errors $image = @imagecreatefrompng($img); break; @@ -1384,19 +1374,19 @@ function GENERATE_IMAGE ($img_code, $headerSent=true) { imagestring($image, 5, 14, 2, $img_code, $text_color); // Return to browser - header ("Content-Type: image/".getConfig('img_type')); + sendHeader('Content-Type: image/' . getConfig('img_type')); // Output image with matching image factory switch (getConfig('img_type')) { - case "jpg": imagejpeg($image); break; - case "png": imagepng($image); break; + case 'jpg': imagejpeg($image); break; + case 'png': imagepng($image); break; } // Remove image from memory imagedestroy($image); } // Create selection box or array of splitted timestamp -function createTimeSelections ($timestamp, $prefix = '', $display = '', $align="center", $return_array=false) { +function createTimeSelections ($timestamp, $prefix = '', $display = '', $align = 'center', $return_array=false) { // Calculate 2-seconds timestamp $stamp = round($timestamp); //* DEBUG: */ print("*".$stamp.'/'.$timestamp."*
"); @@ -1648,8 +1638,8 @@ function SEND_ADMIN_EMAILS_PRO ($subj, $template, $content, $UID) { $result = false; // "implode" IDs and query string - $aid = implode(",", $adminIds); - if ($aid == "-1") { + $aid = implode(',', $adminIds); + if ($aid == '-1') { if (EXT_IS_ACTIVE('events')) { // Add line to user events EVENTS_ADD_LINE($subj, $msg, $UID); @@ -1719,7 +1709,7 @@ function ADD_EMAIL_NAV ($PAGES, $offset, $show_form, $colspan, $return=false) { $NAV = ''; for ($page = 1; $page <= $PAGES; $page++) { // Is the page currently selected or shall we generate a link to it? - if (($page == REQUEST_GET('page')) || ((!REQUEST_ISSET_GET('page')) && ($page == "1"))) { + if (($page == REQUEST_GET('page')) || ((!REQUEST_ISSET_GET('page')) && ($page == '1'))) { // Is currently selected, so only highlight it $NAV .= "-"; } else { @@ -1733,7 +1723,7 @@ function ADD_EMAIL_NAV ($PAGES, $offset, $show_form, $colspan, $return=false) { $NAV .= "\">"; } $NAV .= $page; - if (($page == REQUEST_GET('page')) || ((!REQUEST_ISSET_GET('page')) && ($page == "1"))) { + if (($page == REQUEST_GET('page')) || ((!REQUEST_ISSET_GET('page')) && ($page == '1'))) { // Is currently selected, so only highlight it $NAV .= "-"; } else { @@ -1901,7 +1891,7 @@ function sendRawRequest ($host, $request) { // Use login data to proxy? (username at least!) if (getConfig('proxy_username') != '') { // Add it as well - $encodedAuth = base64_encode(COMPILE_CODE(getConfig('proxy_username')).constant('ENCRYPT_SEPERATOR').COMPILE_CODE(getConfig('proxy_password'))); + $encodedAuth = base64_encode(COMPILE_CODE(getConfig('proxy_username')).getConfig('ENCRYPT_SEPERATOR').COMPILE_CODE(getConfig('proxy_password'))); $proxyTunnel .= "Proxy-Authorization: Basic ".$encodedAuth."\r\n"; } // END - if @@ -2091,19 +2081,19 @@ function generateHash ($plainText, $salt = '') { // When the salt is empty build a new one, else use the first x configured characters as the salt if (empty($salt)) { // Build server string (inc/databases.php is no longer updated with every commit) - $server = $_SERVER['PHP_SELF'].constant('ENCRYPT_SEPERATOR').detectUserAgent().constant('ENCRYPT_SEPERATOR').getenv('SERVER_SOFTWARE').constant('ENCRYPT_SEPERATOR').detectRemoteAddr(); + $server = $_SERVER['PHP_SELF'].getConfig('ENCRYPT_SEPERATOR').detectUserAgent().getConfig('ENCRYPT_SEPERATOR').getenv('SERVER_SOFTWARE').getConfig('ENCRYPT_SEPERATOR').detectRemoteAddr(); // Build key string - $keys = constant('SITE_KEY').constant('ENCRYPT_SEPERATOR').constant('DATE_KEY').constant('ENCRYPT_SEPERATOR').getConfig('secret_key').constant('ENCRYPT_SEPERATOR').getConfig('file_hash').constant('ENCRYPT_SEPERATOR').date("d-m-Y (l-F-T)", getConfig(('patch_ctime'))).constant('ENCRYPT_SEPERATOR').getConfig('master_salt'); + $keys = getConfig('SITE_KEY').getConfig('ENCRYPT_SEPERATOR').getConfig('DATE_KEY').getConfig('ENCRYPT_SEPERATOR').getConfig('secret_key').getConfig('ENCRYPT_SEPERATOR').getConfig('file_hash').getConfig('ENCRYPT_SEPERATOR').date("d-m-Y (l-F-T)", getConfig(('patch_ctime'))).getConfig('ENCRYPT_SEPERATOR').getConfig('master_salt'); // Additional data - $data = $plainText.constant('ENCRYPT_SEPERATOR').uniqid(mt_rand(), true).constant('ENCRYPT_SEPERATOR').time(); + $data = $plainText.getConfig('ENCRYPT_SEPERATOR').uniqid(mt_rand(), true).getConfig('ENCRYPT_SEPERATOR').time(); // Calculate number for generating the code - $a = time() + constant('_ADD') - 1; + $a = time() + getConfig('_ADD') - 1; // Generate SHA1 sum from modula of number and the prime number - $sha1 = sha1(($a % constant('_PRIME')).$server.constant('ENCRYPT_SEPERATOR').$keys.constant('ENCRYPT_SEPERATOR').$data.constant('ENCRYPT_SEPERATOR').date("d-m-Y (l-F-T)", time()).constant('ENCRYPT_SEPERATOR').$a); + $sha1 = sha1(($a % getConfig('_PRIME')).$server.getConfig('ENCRYPT_SEPERATOR').$keys.getConfig('ENCRYPT_SEPERATOR').$data.getConfig('ENCRYPT_SEPERATOR').getConfig('DATE_KEY').getConfig('ENCRYPT_SEPERATOR').$a); //* DEBUG: */ echo "SHA1=".$sha1." (".strlen($sha1).")
"; $sha1 = scrambleString($sha1); //* DEBUG: */ echo "Scrambled=".$sha1." (".strlen($sha1).")
"; @@ -2203,31 +2193,6 @@ function genScrambleString ($len) { return $scrambleString; } -// Append data like session ID or referal ID to the given URL which would -// normally be stored in cookies -function addUrlData ($URL) { - // Init add - $add = ''; - - // Determine URL binder - $BIND = '?'; - if (strpos($URL, '?') !== false) $BIND = '&'; - - if ((!defined('__COOKIES')) || ((!constant('__COOKIES')))) { - // Cookies are not accepted - if ((REQUEST_ISSET_GET(('refid'))) && (strpos($URL, "refid=") == 0)) { - // Cookie found in URL - $add .= $BIND."refid=".bigintval(REQUEST_GET('refid')); - } elseif ((GET_EXT_VERSION('sql_patches') != '') && (getConfig('def_refid') > 0)) { - // Not found! So let's set default here - $add .= $BIND."refid=".getConfig('def_refid'); - } - } // END - if - - // Add all together and return it - return $URL . $add; -} - // Generate an PGP-like encrypted hash of given hash for e.g. cookies function generatePassString ($passHash) { // Return vanilla password hash @@ -2242,9 +2207,9 @@ function generatePassString ($passHash) { $part2 = hexdec(substr(getConfig('secret_key'), $start, 4)); $mod = dechex($idx); if ($part1 > $part2) { - $mod = dechex(sqrt(($part1 - $part2) * constant('_PRIME') / pi())); + $mod = dechex(sqrt(($part1 - $part2) * getConfig('_PRIME') / pi())); } elseif ($part2 > $part1) { - $mod = dechex(sqrt(($part2 - $part1) * constant('_PRIME') / pi())); + $mod = dechex(sqrt(($part2 - $part1) * getConfig('_PRIME') / pi())); } $mod = substr(round($mod), 0, 4); $mod = str_repeat('0', 4-strlen($mod)).$mod; @@ -2253,7 +2218,7 @@ function generatePassString ($passHash) { $newHash .= $mod; } // END - for - //* DEBUG: */ print($passHash."
".$newHash." (".strlen($newHash).")"); + //* DEBUG: */ print($passHash."
".$newHash." (".strlen($newHash).')'); $ret = generateHash($newHash, getConfig('master_salt')); //* DEBUG: */ print($ret."
\n"); } else { @@ -2476,60 +2441,6 @@ function getThemeId ($name) { return $id; } -// Read a given file -function readFromFile ($FQFN, $sqlPrepare = false) { - // Load the file - if (function_exists('file_get_contents')) { - // Use new function - $content = file_get_contents($FQFN); - } else { - // Fall-back to implode-file chain - $content = implode('', file($FQFN)); - } - - // Prepare SQL queries? - if ($sqlPrepare === true) { - // Remove some unwanted chars - $content = str_replace("\r", '', $content); - $content = str_replace("\n\n", "\n", $content); - } // END - if - - // Return the content - return $content; -} - -// Writes content to a file -function writeToFile ($FQFN, $content) { - // Is the file writeable? - if ((isFileReadable($FQFN)) && (!is_writeable($FQFN)) && (!chmod($FQFN, 0644))) { - // Not writeable! - DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("File %s not writeable.", basename($FQFN))); - - // Failed! :( - return false; - } // END - if - - // By default all is failed... - $return = false; - - // Is the function there? - if (function_exists('file_put_contents')) { - // Write it directly - $return = file_put_contents($FQFN, $content); - } else { - // Write it with fopen - $fp = fopen($FQFN, 'w') or app_die(__FUNCTION__, __LINE__, "Cannot write file ".basename($FQFN).'!'); - fwrite($fp, $content); - fclose($fp); - - // Set CHMOD rights - $return = chmod($FQFN, 0644); - } - - // Return status - return $return; -} - // Generates an error code from given account status function generateErrorCodeFromUserStatus ($status) { // Default error code if unknown account status @@ -2551,15 +2462,6 @@ function generateErrorCodeFromUserStatus ($status) { return $errorCode; } -// Clears the output buffer. This function does *NOT* backup sent content. -function clearOutputBuffer () { - // Trigger an error on failure - if (!ob_end_clean()) { - // Failed! - debug_report_bug(__FUNCTION__.': Failed to clean output buffer.'); - } // END - if -} - // Function to search for the last modifified file function searchDirsRecursive ($dir, &$last_changed) { // Get dir as array @@ -2737,35 +2639,6 @@ function getArrayFromActualVersion () { return $akt_vers; } - -// Loads an include file and logs any missing files for debug purposes -function loadInclude ($INC) { - // Add the path. This is why we need a trailing slash in config.php - $FQFN = constant('PATH') . $INC; - - // Is the include file there? - if (!isIncludeReadable($INC)) { - // Not there so log it - debug_report_bug(sprintf("Include file %s not found.", $INC)); - return false; - } // END - if - - // Try to load it - require($FQFN); -} - -// Loads an include file once -function loadIncludeOnce ($INC) { - // Is it not loaded? - if (!isset($GLOBALS['load_once'][$INC])) { - // Then try to load it - loadInclude($INC); - - // And mark it as loaded - $GLOBALS['load_once'][$INC] = "loaded"; - } // END - if -} - // Back-ported from the new ship-simu engine. :-) function debug_get_printable_backtrace () { // Init variable @@ -2777,7 +2650,7 @@ function debug_get_printable_backtrace () { if (!isset($trace['file'])) $trace['file'] = __FUNCTION__; if (!isset($trace['line'])) $trace['line'] = __LINE__; if (!isset($trace['args'])) $trace['args'] = array(); - $backtrace .= "
  • ".basename($trace['file']).":".$trace['line'].", ".$trace['function']."(".count($trace['args']).")
  • \n"; + $backtrace .= "
  • ".basename($trace['file']).":".$trace['line'].", ".$trace['function'].'('.count($trace['args']).")
  • \n"; } // END - foreach // Close it @@ -2805,7 +2678,7 @@ function debug_report_bug ($message = '') { // Add output $debug .= "Please report this bug at bugs.mxchange.org:
    ";
     	$debug .= debug_get_printable_backtrace();
    -	$debug .= "
    Request-URI: ".$_SERVER['REQUEST_URI']."
    \n"; + $debug .= "\nRequest-URI: ".$_SERVER['REQUEST_URI']."
    \n"; $debug .= "Thank you for finding bugs."; // And abort here @@ -2841,8 +2714,8 @@ function convertCodeToMessage ($code) { break; case getCode('EXTENSION_PROBLEM'): - if (REQUEST_ISSET_GET(('ext'))) { - $msg = sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), REQUEST_GET(('ext'))); + if (REQUEST_ISSET_GET('ext')) { + $msg = sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), REQUEST_GET('ext')); } else { $msg = getMessage('EXTENSION_PROBLEM_UNSET_EXT'); } @@ -2896,29 +2769,6 @@ function generateAdminLink ($aid) { return $admin; } -// Checks wether an include file (non-FQFN better) is readable -function isIncludeReadable ($INC) { - // Construct FQFN - $FQFN = constant('PATH') . $INC; - - // Is it readable? - return isFileReadable($FQFN); -} - -// Encode strings -// @TODO Implement $compress -function encodeString ($str, $compress=true) { - $str = urlencode(base64_encode(compileUriCode($str))); - return $str; -} - -// Decode strings encoded with encodeString() -// @TODO Implement $decompress -function decodeString ($str, $decompress=true) { - $str = compileUriCode(base64_decode(urldecode(compileUriCode($str)))); - return $str; -} - // Compile characters which are allowed in URLs function compileUriCode ($code, $simple=true) { // Compile constants @@ -3008,21 +2858,6 @@ function isUrlValidSimple ($url) { return $reg; } -// Smartly adds slashes -function smartAddSlashes ($unquoted) { - $unquoted = str_replace("\\", '', $unquoted); - return addslashes($unquoted); -} - -// Decode entities in a nicer way -function decodeEntities ($str) { - // Decode the entities to UTF-8 now - $decodedString = html_entity_decode($str, ENT_NOQUOTES, "UTF-8"); - - // Return decoded string - return $decodedString; -} - // Wtites data to a config.php-style file // @TODO Rewrite this function to use readFromFile() and writeToFile() function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $DATA, $seek=0) { @@ -3106,26 +2941,6 @@ function sendAdminNotification ($subject, $templateName, $content=array(), $uid } } -// Merges an array together but only if both are arrays -function merge_array ($array1, $array2) { - // Are both an array? - if ((is_array($array1)) && (is_array($array2))) { - // Merge all together - return array_merge($array1, $array2); - } elseif (is_array($array1)) { - // Return left array - DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("array2 is not an array. array != %s", gettype($array2))); - return $array1; - } elseif (is_array($array2)) { - // Return right array - DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("array1 is not an array. array != %s", gettype($array1))); - return $array2; - } - - // Both are not arrays - debug_report_bug(__FUNCTION__.": No arrays provided!"); -} - // Debug message logger function DEBUG_LOG ($funcFile, $line, $message, $force=true) { // Is debug mode enabled? @@ -3152,7 +2967,7 @@ function runResetIncludes () { SET_INC_POOL(getArrayFromDirectory('inc/reset/', 'reset_')); // Update database - if (!defined('DEBUG_RESET')) updateConfiguration('last_update', time()); + if (getConfig('DEBUG_RESET') != 'Y') updateConfiguration('last_update', time()); // Is the config entry set? if (GET_EXT_VERSION('sql_patches') >= '0.4.2') { @@ -3165,7 +2980,7 @@ function runResetIncludes () { MERGE_INC_POOL(getArrayFromDirectory('inc/weekly/', 'weekly_')); // Update config - if (!defined('DEBUG_WEEKLY')) updateConfiguration('last_week', $currWeek); + if (getConfig('DEBUG_WEEKLY') != 'Y') updateConfiguration('last_week', $currWeek); } // END - if // Create current month mark @@ -3177,7 +2992,7 @@ function runResetIncludes () { MERGE_INC_POOL(getArrayFromDirectory('inc/monthly/', 'monthly_')); // Update config - if (!defined('DEBUG_MONTHLY')) updateConfiguration('last_month', $currMonth); + if (getConfig('DEBUG_MONTHLY') != 'Y') updateConfiguration('last_month', $currMonth); } // END - if } // END - if @@ -3218,12 +3033,6 @@ function handleExtraValues ($filterFunction, $value, $extraValue) { return $ret; } -// Check if given FQFN is a readable file -function isFileReadable ($FQFN) { - // Check all... - return ((file_exists($FQFN)) && (is_file($FQFN)) && (is_readable($FQFN))); -} - // Converts timestamp selections into a timestamp function convertSelectionsToTimestamp (&$POST, &$DATA, &$id, &$skip) { // Init test variable @@ -3294,7 +3103,7 @@ function HANDLE_LOGIN_FAILTURES ($accessLevel) { //* DEBUG: */ print __FUNCTION__."(".__LINE__."):accessLevel={$accessLevel}
    \n"; $content = array( 'login_failures' => getSession('mxchange_'.$accessLevel.'_failures'), - 'last_failure' => generateDateTime(getSession('mxchange_'.$accessLevel.'_last_fail'), "2") + 'last_failure' => generateDateTime(getSession('mxchange_'.$accessLevel.'_last_fail'), '2') ); // Load template @@ -3372,8 +3181,8 @@ function determineRealRemoteAddress () { } // This strips out the real address from proxy output - if (strstr($address, ",")){ - $addressArray = explode(",", $address); + if (strstr($address, ',')){ + $addressArray = explode(',', $address); $address = $addressArray[0]; } // END - if @@ -3381,66 +3190,6 @@ function determineRealRemoteAddress () { return $address; } -// "Getter" for remote IP number -function detectRemoteAddr () { - // Get remote ip from environment - $remoteAddr = determineRealRemoteAddress(); - - // Is removeip installed? - if (EXT_IS_ACTIVE('removeip')) { - // Then anonymize it - $remoteAddr = GET_ANONYMOUS_REMOTE_ADDR($remoteAddr); - } // END - if - - // Return it - return $remoteAddr; -} - -// "Getter" for remote hostname -function detectRemoteHostname () { - // Get remote ip from environment - $remoteHost = getenv('REMOTE_HOST'); - - // Is removeip installed? - if (EXT_IS_ACTIVE('removeip')) { - // Then anonymize it - $remoteHost = GET_ANONYMOUS_REMOTE_HOST($remoteHost); - } // END - if - - // Return it - return $remoteHost; -} - -// "Getter" for user agent -function detectUserAgent () { - // Get remote ip from environment - $userAgent = getenv('HTTP_USER_AGENT'); - - // Is removeip installed? - if (EXT_IS_ACTIVE('removeip')) { - // Then anonymize it - $userAgent = GET_ANONYMOUS_USER_AGENT($userAgent); - } // END - if - - // Return it - return $userAgent; -} - -// "Getter" for referer -function detectReferer () { - // Get remote ip from environment - $referer = getenv('HTTP_REFERER'); - - // Is removeip installed? - if (EXT_IS_ACTIVE('removeip')) { - // Then anonymize it - $referer = GET_ANONYMOUS_REFERER($referer); - } // END - if - - // Return it - return $referer; -} - // Adds a bonus mail to the queue // This is a high-level function! function addNewBonusMail ($data, $mode = '', $output=true) { @@ -3499,7 +3248,7 @@ function DETERMINE_REFID () { $GLOBALS['refid'] = getConfig(('def_refid')); } elseif ((GET_EXT_VERSION('user') >= '0.3.4') && (getConfig('select_user_zero_refid')) == 'Y') { // Select a random user which has confirmed enougth mails - $GLOBALS['refid'] = SELECT_RANDOM_REFID(); + $GLOBALS['refid'] = determineRandomReferalId(); } else { // No default ID when sql_patches is not installed or none set $GLOBALS['refid'] = 0; @@ -3515,23 +3264,6 @@ function DETERMINE_REFID () { return $GLOBALS['refid']; } -// Check wether we are installing -function isInstalling () { - $installing = ((isset($GLOBALS['mxchange_installing'])) || (REQUEST_ISSET_GET('installing'))); - //* DEBUG: */ var_dump($installing); - return $installing; -} - -// Check wether this script is installed -function isInstalled () { - return isBooleanConstantAndTrue('mxchange_installed'); -} - -// Check wether an admin is registered -function isAdminRegistered () { - return isBooleanConstantAndTrue('admin_registered'); -} - // Enables the reset mode. Only call this function if you really want the // reset to be run! function enableResetMode () { @@ -3542,23 +3274,6 @@ function enableResetMode () { runFilterChain('reset_enabled'); } -// Checks wether the reset mode is active -function isResetModeEnabled () { - // Now simply check it - return ((isset($GLOBALS['reset_enabled'])) && ($GLOBALS['reset_enabled'] === true)); -} - -// Checks wether the debug mode is enabled -function isDebugModeEnabled () { - // Simply check it - return isBooleanConstantAndTrue('DEBUG_MODE'); -} - -// Checks wether the cache instance is valid -function isCacheInstanceValid () { - return ((isset($GLOBALS['cache_instance'])) && (is_object($GLOBALS['cache_instance']))); -} - // Our shutdown-function function shutdown () { // Call the filter chain 'shutdown' @@ -3601,33 +3316,43 @@ function isUserIdSet () { return (isset($GLOBALS['userid'])); } -// Checks wether the given FQFN is a directory and not .,.. or .svn -function isDirectory ($FQFN) { - // Generate baseName - $baseName = basename($FQFN); - - // Check it - $isDirectory = ((is_dir($FQFN)) && ($baseName != '.') && ($baseName != '..') && ($baseName != ".svn")); - - // Return the result - return $isDirectory; -} - // Handle message codes from URL function handleCodeMessage () { - if (REQUEST_ISSET_GET(('msg'))) { + if (REQUEST_ISSET_GET('msg')) { // Default extension is "unknown" - $ext = "unknown"; + $ext = 'unknown'; // Is extension given? - if (REQUEST_ISSET_GET(('ext'))) $ext = REQUEST_GET(('ext')); + if (REQUEST_ISSET_GET('ext')) $ext = REQUEST_GET('ext'); // Convert the 'msg' parameter from URL to a human-readable message $msg = convertCodeToMessage(REQUEST_GET('msg')); // Load message template - LOAD_TEMPLATE("message", false, $msg); + LOAD_TEMPLATE('message', false, $msg); + } // END - if +} + +// Setter for extra title +function setExtraTitle ($extraTitle) { + $GLOBALS['extra_title'] = $extraTitle; +} + +// Getter for extra title +function getExtraTitle () { + // Is the extra title set? + if (!isExtraTitleSet()) { + // No, then abort here + debug_report_bug('extra_title is not set!'); } // END - if + + // Return it + return $GLOBALS['extra_title']; +} + +// Checks if the extra title is set +function isExtraTitleSet () { + return ((isset($GLOBALS['extra_title'])) && (!empty($GLOBALS['extra_title']))); } ////////////////////////////////////////////////// diff --git a/inc/header.php b/inc/header.php index 5c904093df..9afbe993d2 100644 --- a/inc/header.php +++ b/inc/header.php @@ -45,9 +45,9 @@ if (!defined('__SECURITY')) { } // Is the header already sent? -if (($GLOBALS['header_sent'] != "1") && ($GLOBALS['header_sent'] != "2")) { +if (($GLOBALS['header_sent'] != '1') && ($GLOBALS['header_sent'] != '2')) { // If not in CSS mode generate the header - if (($GLOBALS['output_mode'] != "1")) { + if (($GLOBALS['output_mode'] != '1')) { // Generate header $TITLE = ''; @@ -59,9 +59,9 @@ if (($GLOBALS['header_sent'] != "1") && ($GLOBALS['header_sent'] != "2")) { if ((getConfig('enable_title_deco') == 'Y') && (getConfig('title_left') != '')) $TITLE .= trim(getConfig('title_left'))." "; // Do we have some extra title? - if (!empty($EXTRA_TITLE)) { + if (isExtraTitleSet()) { // Then prepent it - $TITLE .= $EXTRA_TITLE." by "; + $TITLE .= getExtraTitle() . ' by '; } // END - if // Add main title @@ -81,9 +81,12 @@ if (($GLOBALS['header_sent'] != "1") && ($GLOBALS['header_sent'] != "2")) { // Remember title in constant for the template define('__PAGE_TITLE', $TITLE); + } elseif ((isInstalled()) && (!isAdminRegistered())) { + // Installed but no admin registered + define('__PAGE_TITLE', sprintf(getMessage('SETUP_OF_MXCHANGE'), constant('MAIN_TITLE'))); } elseif ((!isInstalled()) || (!isAdminRegistered())) { // Installation mode - define('__PAGE_TITLE', sprintf(getMessage('INSTALLATION_OF_MXCHANGE'), constant('MAIN_TITLE'))); + define('__PAGE_TITLE', getMessage('INSTALLATION_OF_MXCHANGE')); } else { // Configuration not found! define('__PAGE_TITLE', getMessage('NO_CONFIG_FOUND_TITLE')); @@ -97,12 +100,12 @@ if (($GLOBALS['header_sent'] != "1") && ($GLOBALS['header_sent'] != "2")) { unset($TITLE); // Output page header code - LOAD_TEMPLATE("page_header"); + LOAD_TEMPLATE('page_header'); // Include meta data in 'guest' module if ($GLOBALS['module'] == 'index') { // Load meta data template - LOAD_TEMPLATE("metadata"); + LOAD_TEMPLATE('metadata'); // Add meta description to header if ((isInstalled()) && (isAdminRegistered()) && (SQL_IS_LINK_UP())) { @@ -112,23 +115,23 @@ if (($GLOBALS['header_sent'] != "1") && ($GLOBALS['header_sent'] != "2")) { } // END - if // Include more header data here - LOAD_TEMPLATE("header"); + LOAD_TEMPLATE('header'); // Include stylesheet - loadIncludeOnce("inc/stylesheet.php"); + loadIncludeOnce('inc/stylesheet.php'); } // END - if // Closing HEAD tag - if ($GLOBALS['output_mode'] != "1") OUTPUT_HTML(""); + if ($GLOBALS['output_mode'] != '1') OUTPUT_HTML(''); $GLOBALS['header_sent'] = 1; } // END - if // Load body or not -if (($GLOBALS['module'] != "frametester") || (($GLOBALS['module'] == "frametester") && (REQUEST_ISSET_GET(('frame')))) || (($GLOBALS['header_sent'] == "1") && (REQUEST_ISSET_GET(('frame')))) && ($GLOBALS['output_mode'] != "1")) { +if (($GLOBALS['module'] != 'frametester') || (($GLOBALS['module'] == 'frametester') && (REQUEST_ISSET_GET(('frame')))) || (($GLOBALS['header_sent'] == '1') && (REQUEST_ISSET_GET(('frame')))) && ($GLOBALS['output_mode'] != '1')) { // Is the header sent and the script is not the mail confirmation script and not a CSS? - if (($GLOBALS['header_sent'] == "1") && (basename($_SERVER['PHP_SELF']) != "mailid.php") && ($GLOBALS['output_mode'] != "1")) { + if (($GLOBALS['header_sent'] == '1') && (basename($_SERVER['PHP_SELF']) != 'mailid.php') && ($GLOBALS['output_mode'] != '1')) { // Add BODY tag - LOAD_TEMPLATE("page_body"); + LOAD_TEMPLATE('page_body'); $GLOBALS['header_sent'] = 2; } // END - if } // END - if diff --git a/inc/inc-functions.php b/inc/inc-functions.php index 7dc1946e0c..a2a63b5929 100644 --- a/inc/inc-functions.php +++ b/inc/inc-functions.php @@ -63,7 +63,7 @@ function getArrayFromDirectory ($baseDir, $prefix, $includeDirs = false, $addBas $INCs = array(); // Open directory - $dirPointer = opendir(constant('PATH') . $baseDir) or app_die(__FUNCTION__, __LINE__, "Cannot read ".basename($baseDir)." path!"); + $dirPointer = opendir(constant('PATH') . $baseDir) or app_die(__FUNCTION__, __LINE__, 'Cannot read '.basename($baseDir).' path!'); // Read all entries while ($baseFile = readdir($dirPointer)) { @@ -88,7 +88,7 @@ function getArrayFromDirectory ($baseDir, $prefix, $includeDirs = false, $addBas // Is this a valid reset file? //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "baseDir={$baseDir},prefix={$prefix},baseFile={$baseFile}"); - if (((isFileReadable($FQFN)) && (substr($baseFile, 0, strlen($prefix)) == $prefix) && (substr($baseFile, -4, 4) == ".php")) || (($includeDirs) && (isDirectory($FQFN)))) { + if (((isFileReadable($FQFN)) && (substr($baseFile, 0, strlen($prefix)) == $prefix) && (substr($baseFile, -4, 4) == '.php')) || (($includeDirs) && (isDirectory($FQFN)))) { // Remove both for extension name $extName = substr($baseFile, strlen($prefix), -4); diff --git a/inc/install-inc.php b/inc/install-inc.php index 6073f4e66d..3b93829627 100644 --- a/inc/install-inc.php +++ b/inc/install-inc.php @@ -44,7 +44,7 @@ if (!defined('__SECURITY')) { $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php'; require($INC); -} +} // END - if // Init variables $mysql = array(); @@ -79,30 +79,29 @@ if ((REQUEST_ISSET_GET('page') && (REQUEST_GET('page') == 5))) { } // END - if // Is MXChange installed or no admin registered so far? -if ((!isInstalled()) || (!isAdminRegistered())) -{ +if ((!isInstalled()) || (!isAdminRegistered())) { // Set URL for FORM actions define('__BURL_ACTION', constant('URL')); // Output page for entered value switch (REQUEST_GET('page')) { - case "welcome": // Welcome to the installation! - LOAD_TEMPLATE("install_welcome"); + case 'welcome': // Welcome to the installation! + LOAD_TEMPLATE('install_welcome'); break; - case "1": // Server path, base URL + case '1': // Server path, base URL // @Profi-Concept: Hab meine Meinung doch geaendert! :-) // Load template - LOAD_TEMPLATE("install_page1"); + LOAD_TEMPLATE('install_page1'); break; - case "2": // MySQL data (alone!) - if (empty($mysql['dbase'])) $mysql['dbase'] = "your_database"; - if (empty($mysql['login'])) $mysql['login'] = "your_login"; - if (empty($mysql['host'])) $mysql['host'] = "localhost"; - if (empty($mysql['prefix'])) $mysql['prefix'] = "mxchange"; - if (empty($mysql['type'])) $mysql['type'] = "MyISAM"; + case '2': // MySQL data (alone!) + if (empty($mysql['dbase'])) $mysql['dbase'] = 'your_database'; + if (empty($mysql['login'])) $mysql['login'] = 'your_login'; + if (empty($mysql['host'])) $mysql['host'] = 'localhost'; + if (empty($mysql['prefix'])) $mysql['prefix'] = 'mxchange'; + if (empty($mysql['type'])) $mysql['type'] = 'MyISAM'; if (getTotalFatalErrors() > 0) { OUTPUT_HTML(""); foreach (getFatalArray() as $key => $err) { @@ -122,10 +121,10 @@ if ((!isInstalled()) || (!isAdminRegistered())) define('__EMAIL_VALUE' , REQUEST_POST('email')); // Load template - LOAD_TEMPLATE("install_page2"); + LOAD_TEMPLATE('install_page2'); break; - case "3": + case '3': // Set more values define('__SPATH_VALUE' , REQUEST_POST('spath')); define('__BURL_VALUE' , REQUEST_POST('burl')); @@ -134,14 +133,18 @@ if ((!isInstalled()) || (!isAdminRegistered())) define('__EMAIL_VALUE' , REQUEST_POST('email')); // Use default SMTP data - $smtpHost = constant('SMTP_HOSTNAME'); - $smtpUser = constant('SMTP_USER'); - $smtpPass1 = constant('SMTP_PASSWORD'); - $smtpPass2 = constant('SMTP_PASSWORD'); + $smtpHost = getConfig('SMTP_HOSTNAME'); + $smtpUser = getConfig('SMTP_USER'); + $smtpPass1 = getConfig('SMTP_PASSWORD'); + $smtpPass2 = getConfig('SMTP_PASSWORD'); // Overwrite it with the data from sent (failed) form if (REQUEST_ISSET_POST(('smtp_host'))) $smtpHost = REQUEST_POST('smtp_host'); if (REQUEST_ISSET_POST(('smtp_user'))) $smtpUser = REQUEST_POST('smtp_user'); + if (REQUEST_ISSET_POST(('smtp_pass'))) { + $smtpPass1 = REQUEST_POST('smtp_pass'); + $smtpPass2 = REQUEST_POST('smtp_pass'); + } // END - if // MySQL settings define('__MYSQL_HOST' , $mysql['host']); @@ -159,10 +162,10 @@ if ((!isInstalled()) || (!isAdminRegistered())) define('__SMTP_PASS2', $smtpPass2); // Load template - LOAD_TEMPLATE("install_page3"); + LOAD_TEMPLATE('install_page3'); break; - case "5": // Misc settings + case '5': // Misc settings // General settings define('__SPATH_VALUE' , REQUEST_POST('spath')); define('__BURL_VALUE' , REQUEST_POST('burl')); @@ -199,12 +202,8 @@ if ((!isInstalled()) || (!isAdminRegistered())) {--LANG_OUTPUT_MODE--}:   @@ -213,12 +212,8 @@ if ((!isInstalled()) || (!isAdminRegistered())) {--WARN_NO_PASSWORD--}:   @@ -227,12 +222,8 @@ if ((!isInstalled()) || (!isAdminRegistered())) {--LANG_WRITE_FOOTER--}:   @@ -241,12 +232,8 @@ if ((!isInstalled()) || (!isAdminRegistered())) {--INSTALL_ENABLE_BACKLINK--}:   @@ -272,7 +259,7 @@ if ((!isInstalled()) || (!isAdminRegistered())) "); break; - case "finalize": // Write captured data to files + case 'finalize': // Write captured data to files if ((REQUEST_ISSET_POST(('finalize'))) && (!isInstalled())) { // You have submitted data then we have to reset the SQLs INIT_SQLS(); @@ -283,7 +270,7 @@ if ((!isInstalled()) || (!isAdminRegistered())) // Seems to work, also right database? if (SQL_SELECT_DB($mysql['dbase'], __FILE__, __LINE__) === true) { // Automatically run install.sql - if ((isFileReadable(REQUEST_POST('spath').'install/tables.sql')) && (isFileReadable(REQUEST_POST('spath').'install/menu-'.getLanguage().'.sql'))) { + if ((isFileReadable(REQUEST_POST('spath') . 'install/tables.sql')) && (isFileReadable(REQUEST_POST('spath') . 'install/menu-'.getLanguage().'.sql'))) { // Both exists so import them foreach (array('tables', 'menu-'.getLanguage()) as $dump) { // Should be save here because file_exists() is there but we check it again. :) @@ -301,8 +288,8 @@ if ((!isInstalled()) || (!isAdminRegistered())) } // END - while } // END - foreach - // And split it up against ;\n ... - SET_SQLS(merge_array(GET_SQLS(), explode(";\n", $fileContent))); + // Split it up against ";\n" and merge it into existing SQLs + MERGE_SQLS(explode(";\n", $fileContent)); } else { // Not readable! debug_report_bug(sprintf("SQL dump %s is not readable!", $dump)); @@ -319,26 +306,37 @@ if ((!isInstalled()) || (!isAdminRegistered())) // Now run all queries through and try to keep out empty or comment queries runFilterChain('run_sqls'); + // Copy the config template and verify it + copyFileVerified(REQUEST_POST('spath') . 'inc/config-local.php.dist', REQUEST_POST('spath') . 'inc/cache/config-local.php', 0644); + // Ok, all done. So we can write the config data to the php files - if (REQUEST_POST('spath') != constant('PATH')) changeDataInFile(REQUEST_POST('spath')."inc/config.php", "SERVER-PATH", "define('PATH', \"", "\");", REQUEST_POST('spath'), 0); - if (REQUEST_POST('burl') != constant('URL')) changeDataInFile(REQUEST_POST('spath')."inc/config.php", "HOST-URL", "define('URL', \"", "\");", REQUEST_POST('burl'), 0); - changeDataInFile(REQUEST_POST('spath')."inc/config.php", "MAIN_TITLE", "define('MAIN_TITLE', \"", "\");", REQUEST_POST('title'), 0); - changeDataInFile(REQUEST_POST('spath')."inc/config.php", "SLOGAN", "define('SLOGAN', \"", "\");", REQUEST_POST('slogan'), 0); - changeDataInFile(REQUEST_POST('spath')."inc/config.php", "WEBMASTER", "define('WEBMASTER', \"", "\");", REQUEST_POST('email'), 0); - changeDataInFile(REQUEST_POST('spath')."inc/config.php", "NULLPASS-WARNING", "define('warn_no_pass', ", ");", REQUEST_POST('warn_no_pass'), 0); - changeDataInFile(REQUEST_POST('spath')."inc/config.php", "WRITE-FOOTER", "define('WRITE_FOOTER', ", ");", REQUEST_POST('wfooter'), 0); - changeDataInFile(REQUEST_POST('spath')."inc/config.php", "BACKLINK", "define('ENABLE_BACKLINK', ", ");", REQUEST_POST('blink'), 0); - // DEACTIVATED: changeDataInFile(REQUEST_POST('spath')."inc/config.php", "OUTPUT-MODE", "define('OUTPUT_MODE', \"", "\");", REQUEST_POST('omode'), 0); - changeDataInFile(REQUEST_POST('spath')."inc/config.php", "MYSQL-HOST", " 'host' => \"", "\",", $mysql['host'], 0); - changeDataInFile(REQUEST_POST('spath')."inc/config.php", "MYSQL-DBASE", " 'dbase' => \"", "\",", $mysql['dbase'], 0); - changeDataInFile(REQUEST_POST('spath')."inc/config.php", "MYSQL-LOGIN", " 'login' => \"", "\",", $mysql['login'], 0); - changeDataInFile(REQUEST_POST('spath')."inc/config.php", "MYSQL-PASSWORD", " 'password' => \"", "\",", $mysql['pass1'], 0); - changeDataInFile(REQUEST_POST('spath')."inc/config.php", "MYSQL-PREFIX", "define('_MYSQL_PREFIX', \"", "\");", $mysql['prefix'], 0); - changeDataInFile(REQUEST_POST('spath')."inc/config.php", "TABLE-TYPE", "define('_TABLE_TYPE', \"", "\");", $mysql['type'], 0); - changeDataInFile(REQUEST_POST('spath')."inc/config.php", "SMTP-HOSTNAME", "define('SMTP_HOSTNAME', \"", "\");", REQUEST_POST('smtp_host'), 0); - changeDataInFile(REQUEST_POST('spath')."inc/config.php", "SMTP-USER", "define('SMTP_USER', \"", "\");", REQUEST_POST('smtp_user'), 0); - changeDataInFile(REQUEST_POST('spath')."inc/config.php", "SMTP-PASSWORD", "define('SMTP_PASSWORD', \"", "\");", REQUEST_POST('smtp_pass1'), 0); - changeDataInFile(REQUEST_POST('spath')."inc/config.php", "INSTALLED", "define('mxchange_installed', ", ");", "true", 0); + if (REQUEST_POST('spath') != constant('PATH')) changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "SERVER-PATH", "define('PATH', \"", "\");", REQUEST_POST('spath'), 0); + if (REQUEST_POST('burl') != constant('URL')) changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "HOST-URL", "define('URL', \"", "\");", REQUEST_POST('burl'), 0); + changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "MAIN-TITLE", "define('MAIN_TITLE', \"", "\");", REQUEST_POST('title'), 0); + changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "SLOGAN", "define('SLOGAN', \"", "\");", REQUEST_POST('slogan'), 0); + changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "WEBMASTER", "define('WEBMASTER', \"", "\");", REQUEST_POST('email'), 0); + changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "NULLPASS-WARNING", "setConfigEntry('WARN_NO_PASS', \"", "\");", REQUEST_POST('warn_no_pass'), 0); + changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "WRITE-FOOTER", "setConfigEntry('WRITE_FOOTER', \"", "\");", REQUEST_POST('wfooter'), 0); + changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "BACKLINK", "setConfigEntry('ENABLE_BACKLINK', \"", "\");", REQUEST_POST('blink'), 0); + // DEACTIVATED: changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "OUTPUT-MODE", "define('OUTPUT_MODE', \"", "\");", REQUEST_POST('omode'), 0); + changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "MYSQL-HOST", " 'host' => \"", "\",", $mysql['host'], 0); + changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "MYSQL-DBASE", " 'dbase' => \"", "\",", $mysql['dbase'], 0); + changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "MYSQL-LOGIN", " 'login' => \"", "\",", $mysql['login'], 0); + changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "MYSQL-PASSWORD", " 'password' => \"", "\",", $mysql['pass1'], 0); + changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "MYSQL-PREFIX", "setConfigEntry('_MYSQL_PREFIX', \"", "\");", $mysql['prefix'], 0); + changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "TABLE-TYPE", "setConfigEntry('_TABLE_TYPE', \"", "\");", $mysql['type'], 0); + changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "SMTP-HOSTNAME", "setConfigEntry('SMTP_HOSTNAME', \"", "\");", REQUEST_POST('smtp_host'), 0); + changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "SMTP-USER", "setConfigEntry('SMTP_USER', \"", "\");", REQUEST_POST('smtp_user'), 0); + changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "SMTP-PASSWORD", "setConfigEntry('SMTP_PASSWORD', \"", "\");", REQUEST_POST('smtp_pass1'), 0); + + // Generate a long site key + $siteKey = generatePassword(50); + + // And write it + changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "SITE-KEY", "setConfigEntry('SITE_KEY', \"", "\");", $siteKey, 0); + + // Script is now installed + changeDataInFile(REQUEST_POST('spath') . 'inc/cache/config-local.php', "INSTALLED", "setConfigEntry('MXCHANGE_INSTALLED', \"", "\");", 'Y', 0); } else { // Installation area not found! addFatalMessage(__FILE__, __LINE__, getMessage('INSTALL_MISSING_DUMPS')); diff --git a/inc/language.php b/inc/language.php index 60ca78fb9c..9b2b5a6caa 100644 --- a/inc/language.php +++ b/inc/language.php @@ -46,20 +46,19 @@ if (!defined('__SECURITY')) { $mx_lang = getSession('mx_lang'); // Set default language if it is not (yet) set -if (is_null($mx_lang)) $mx_lang = constant('DEFAULT_LANG'); +if (is_null($mx_lang)) $mx_lang = getConfig('DEFAULT_LANG'); // Generate filename $INC = sprintf("inc/language/%s.php", SQL_ESCAPE($mx_lang)); -// Generate FQFN -$FQFN = constant('PATH') . $INC; - // Look for file -if (!isFileReadable($FQFN)) { +if (!isIncludeReadable($INC)) { // Switch to default (DO NOT CHANGE!!!) - $mx_lang = constant('DEFAULT_LANG'); - setSession('mx_lang', $mx_lang); - $INC = sprintf("inc/language/%s.php", $mx_lang); + setSession('mx_lang', 'de'); + $INC = 'inc/language/de.php'; + + // And set it temporarily + setConfigEntry('DEFAULT_LANG', 'de'); } // END - if // Load language file @@ -68,7 +67,7 @@ loadIncludeOnce($INC); // Check for installation mode if ((isInstalling()) || (!isInstalled()) || (!isAdminRegistered())) { // Load matching language file - loadInclude('inc/language/install_' . $mx_lang . '.php'); + loadInclude('inc/language/install_' . getSession('mx_lang') . '.php'); } // Remove no more needed variables diff --git a/inc/language/bonus_de.php b/inc/language/bonus_de.php index 5cbb93947c..5da63d96f0 100644 --- a/inc/language/bonus_de.php +++ b/inc/language/bonus_de.php @@ -65,8 +65,6 @@ define('BONUS_LOGIN_TURBO_NOTE', "Der Login-, Referal-, Klickrate-, Mailbuchungs define('BONUS_POINTS_TITLE', "Sonderbonus-{!POINTS!}"); define('BONUS_RANK_YOU_ARE_NOT_FOUND', "Sie haben bis jetzt noch keine Aktiv-Vergütung erhalten!"); define('BONUS_RANK', "Platz"); -define('BONUS_SHOW_FOOTER_NOTE_1', "Wir wünschen allen Gewinnern viel Glück bei der monatlichen Aktiv-Rallye!"); -define('BONUS_SHOW_FOOTER_NOTE_2', "Es können nur die ersten {!__BONUS_TOTAL_RANKS!} die Aktiv-Rallye gewinnen. Der Rechtsweg ist ausgeschlossen."); define('BONUS_SHOW_HEADER_LINE_1', "Hier sehen Sie eine Übersicht, wer alles"); define('BONUS_SHOW_HEADER_LINE_2', "für die Mail"); define('BONUS_SHOW_HEADER_LINE_3', "erhalten hat"); diff --git a/inc/language/de.php b/inc/language/de.php index ea12b6d019..886903ebac 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -43,7 +43,7 @@ if (!defined('__SECURITY')) { } // Installation/setup -define('CONFIG_IS_WRITE_PROTECTED', "Die Konfigurationsdatei inc/config.php ist schreibgeschützt. Bitte setzen Sie CHMOD 666 auf die Datei!"); +define('CONFIG_IS_WRITE_PROTECTED', "Die Konfigurationsdatei inc/cache/config-local.php ist schreibgeschützt. Bitte setzen Sie CHMOD 666 auf die Datei!"); define('DUMMY_IS_WRITE_PROTECTED', "In dem Verzeichnis inc/ kann keine Datei erzeugt werden. Bitte setzen Sie CHMOD 777 auf das Verzeichnis!"); define('SECRET_IS_WRITE_PROTECTED', "In dem Verzeichnis inc/.secret/ kann keine Datei erzeugt werden. Bitte setzen Sie CHMOD 777 auf das Verzeichnis oder probieren Sie auch 770 aus!"); @@ -69,9 +69,9 @@ define('META_KEYWORDS', "mailtausch, mailversand, kostenlos, kostenloser, mailex define('LANG_WARNING', "Warnung"); define('DIE_CONFIG_CHANGED_YOU', "Sie haben Ihre Config-Datei editiert! Auf Wiedersehen..."); define('DIE_RUN_INSTALL_MYSQL', "Bitte rufen Sie http://your-domain.com/install.php auf, um Ihre MySQL-Daten einzurichten!"); -define('WARN_NULL_PASSWORD', "Sie haben kein Passwort eingegeben! Bitte lesen Sie in der inc/config.php nach, wie Sie diese Warnung abschalten können."); -define('FATAL_CONFIG_WRITABLE', "Ihre Datei inc/config.php ist beschreibbar! Dies ist ein mögliches Sicherheitsrisiko!"); -define('FATAL_CANNOT_WRITE_CONFIG', "Kann Konfigurationsdaten nicht speichern, da ich keinen Schreibzugriff auf inc/config.php habe!"); +define('WARN_NULL_PASSWORD', "Sie haben kein Passwort eingegeben! Bitte lesen Sie in der inc/cache/config-local.php nach, wie Sie diese Warnung abschalten können."); +define('FATAL_CONFIG_WRITABLE', "Ihre Datei inc/cache/config-local.php ist beschreibbar! Dies ist ein mögliches Sicherheitsrisiko!"); +define('FATAL_CANNOT_WRITE_CONFIG', "Kann Konfigurationsdaten nicht speichern, da ich keinen Schreibzugriff auf inc/cache/config-local.php habe!"); define('FATAL_CANNOT_CREATE_TMP', "Kann eine temporäre Datei nicht erzeugen! Bitte setzen Sie CHMOD 777 auf Verzeichnis inc!"); define('FATAL_ERROR', "Fataler Fehler"); define('LANG_NO_RENDER_DIRECT', "Sie haben weder 'render' noch 'direct' als Ausgabe-Modus eingestellt!"); @@ -168,7 +168,7 @@ define('CREATE_ACTION_FIRST', "Bitte erstellen Sie zuerst die action-xxxxx.php D define('IS_FIRST_MENU', "Ist das erste Hauptmenü"); define('NO_DB_LINK', "Keine Verbindung zur Datenbank."); define('NO_DB_LINK_SHUTDOWN', "Keine Verbindung zur Datenbank beim Schliessen der Verbindung."); -define('MYSQL_DATA_MISSING', "Die Konfiguration Ihrer Datenbankverbindung ist unnvollständig. Bitte in inc/config.php mindestens den Hostnamen, Datenbanknamen und Login zur Datenbank eingeben."); +define('MYSQL_DATA_MISSING', "Die Konfiguration Ihrer Datenbankverbindung ist unnvollständig. Bitte in inc/cache/config-local.php mindestens den Hostnamen, Datenbanknamen und Login zur Datenbank eingeben."); define('REGISTER_PERSONAL_DATA', "Persönliche Daten"); define('REGISTER_CATEGORIES', "Interessengebiete"); define('REGISTER_MISC', "Passwort, maximale Mails pro Tag etc."); diff --git a/inc/language/en.php b/inc/language/en.php index 978e0c5653..d0d476cc9f 100644 --- a/inc/language/en.php +++ b/inc/language/en.php @@ -53,9 +53,9 @@ define('META_KEYWORDS', "Enter at least (1) 20 search keywords seperated by comm define('LANG_WARNING', "Warning"); define('DIE_CONFIG_CHANGED_YOU', "You have edited your config.php file! I'm out here..."); define('DIE_RUN_INSTALL_MYSQL', "Please run http://your-domain.com/install.php to setup your MySQL data."); -define('WARN_NULL_PASSWORD', "You have a null-password! If you want to switch off this warning please have a look in inc/config.php."); -define('FATAL_CONFIG_WRITABLE', "Your file inc/config.php is writeable! This is a possible security risk."); -define('FATAL_CANNOT_WRITE_CONFIG', "Cannot write config data because I have no write permissions to inc/config.php."); +define('WARN_NULL_PASSWORD', "You have a null-password! If you want to switch off this warning please have a look in inc/cache/config-local.php."); +define('FATAL_CONFIG_WRITABLE', "Your file inc/cache/config-local.php is writeable! This is a possible security risk."); +define('FATAL_CANNOT_WRITE_CONFIG', "Cannot write config data because I have no write permissions to inc/cache/config-local.php."); define('FATAL_ERROR', "Fatal error"); define('LANG_NO_RENDER_DIRECT', "You did not setup the output mode weather to 'render' nor to 'direct'."); define('INSTALLATION', "Script installation"); diff --git a/inc/language/install_de.php b/inc/language/install_de.php index c3b6b5057b..9b222bb158 100644 --- a/inc/language/install_de.php +++ b/inc/language/install_de.php @@ -43,7 +43,8 @@ if (!defined('__SECURITY')) { } // Language definitions -define('INSTALLATION_OF_MXCHANGE', "Installation von MXChange-{!MT_WORD!}-Script - %s"); +define('INSTALLATION_OF_MXCHANGE', "Installation von MXChange-{!MT_WORD!}-Script"); +define('SETUP_OF_MXCHANGE', "Installation von MXChange-{!MT_WORD!}-Script - %s"); define('INSTALL_MISSING_DUMPS', "Die SQL-Dumps wurden nicht gefunden! Diese sollten auch mit hochgeladen werden und lesbar sein (CHMOD 644)."); define('INSTALL_ENABLE_BACKLINK', "Backlink (=Rückverlinkung zu mxchange.org setzen?) rel="external" ist gesetzt. Bitte nicht den Backlink einbauen, und nofollow verwenden! Das schadet allen."); define('WRONG_PAGE', "Sie oder dieses Script haben eine falsche Seite ausgewählt!"); diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index 86f375c200..1279145d40 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -160,7 +160,7 @@ function adminsChangeAdminAccount ($POST) { // When both passwords match update admin account if ($POST['pass1'][$id] == $POST['pass2'][$id]) { // Save only when both passwords are the same (also when they are empty) - $add = ''; $cache_update = "1"; + $add = ''; $cache_update = '1'; // Generate hash $hash = generateHash($POST['pass1'][$id]); @@ -269,12 +269,12 @@ function adminsEditAdminAccount ($POST) { // Shall we allow changing default ACL? if ($currMode == "allow") { // Allow chaning it - $content['mode'] = generateOptionList("/ARRAY/", array("allow", "deny"), array(constant('ADMINS_ALLOW_MODE'), constant('ADMINS_DENY_MODE')), $content['mode']); + $content['mode'] = generateOptionList('/ARRAY/', array("allow", "deny"), array(constant('ADMINS_ALLOW_MODE'), constant('ADMINS_DENY_MODE')), $content['mode']); } else { // Don't allow it $content['mode'] = " "; } - $content['la_mode'] = generateOptionList("/ARRAY/", array("global", "OLD", "NEW"), array(ADMINS_GLOBAL_LA_SETTING, ADMINS_OLD_LA_SETTING, ADMINS_NEW_LA_SETTING), $content['la_mode']); + $content['la_mode'] = generateOptionList('/ARRAY/', array("global", "OLD", "NEW"), array(ADMINS_GLOBAL_LA_SETTING, ADMINS_OLD_LA_SETTING, ADMINS_NEW_LA_SETTING), $content['la_mode']); // Load row template and switch color $OUT .= LOAD_TEMPLATE("admin_edit_admins_row", true, $content); @@ -349,7 +349,7 @@ function adminsRemoveAdminAccount ($POST) { // Purge cache cachePurgeAdminMenu($id); - $cache_update = "1"; + $cache_update = '1'; } } diff --git a/inc/libs/bonus_functions.php b/inc/libs/bonus_functions.php index 109e740f1d..d5a360e57c 100644 --- a/inc/libs/bonus_functions.php +++ b/inc/libs/bonus_functions.php @@ -133,7 +133,7 @@ function BONUS_MAKE_RANK_ROWS ($data, $type, $uid) { // Transfer data to template define('__YR_LEVEL' , $rank); define('__YR_POINTS', $points); - define('__YR_TMARK' , generateDateTime($mark, "1")); + define('__YR_TMARK' , generateDateTime($mark, '1')); // Load template define('__YOUR_RANKING_LINE', LOAD_TEMPLATE("show_bonus_yr", true)); @@ -194,12 +194,12 @@ function BONUS_POINTS_HANDLER ($mode) { if (getConfig('bonus_active') != 'Y') return; // Switch to jackpot-mode when no UID is supplied but userid-mode is selected - if ((getConfig('bonus_mode') == "UID") && (getConfig('bonus_uid') == '0')) { + if ((getConfig('bonus_mode') == 'UID') && (getConfig('bonus_uid') == '0')) { // Update database & config updateConfiguration('bonus_mode', 'JACKPOT'); } // END - if - if ($mode == "login_bonus") { + if ($mode == 'login_bonus') { // Login bonus detected $points = getConfig('login_bonus'); } else { @@ -213,20 +213,20 @@ function BONUS_POINTS_HANDLER ($mode) { case 'JACKPOT': // ... jackpot if ((SUB_JACKPOT($points) == -1) && (getConfig('bonus_uid') > 0)) { // Check points amount first... - $total = GET_TOTAL_DATA(getConfig('bonus_uid'), "user_points", "points") - GET_TOTAL_DATA(getConfig('bonus_uid'), "user_data", "used_points"); + $total = GET_TOTAL_DATA(getConfig('bonus_uid'), 'user_points', 'points') - GET_TOTAL_DATA(getConfig('bonus_uid'), 'user_data', 'used_points'); if ($total >= $points) { // Subtract points from userid's account - SUB_POINTS("bonus_payout_jackpot", getConfig('bonus_uid'), $points); + SUB_POINTS('bonus_payout_jackpot', getConfig('bonus_uid'), $points); } // END - if } // END - if break; - case "UID": // ... userid's account + case 'UID': // ... userid's account // Check his amount first - $total = GET_TOTAL_DATA(getConfig('bonus_uid'), "user_points", "points") - GET_TOTAL_DATA(getConfig('bonus_uid'), "user_data", "used_points"); + $total = GET_TOTAL_DATA(getConfig('bonus_uid'), 'user_points', 'points') - GET_TOTAL_DATA(getConfig('bonus_uid'), 'user_data', 'used_points'); if ($total >= $points) { // Subtract points from userid's account - SUB_POINTS("bonus_payout_uid", getConfig('bonus_uid'), $points); + SUB_POINTS('bonus_payout_uid', getConfig('bonus_uid'), $points); } else { // Try to subtract from jackpot $dummy = SUB_JACKPOT($points); @@ -241,8 +241,9 @@ function BONUS_PURGE_EXPIRED_TURBO_BONUS() { $result = SQL_QUERY("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_bonus_turbo` WHERE timemark < (UNIX_TIMESTAMP() - ".getConfig('bonus_timeout').")", __FUNCTION__, __LINE__); if (SQL_AFFECTEDROWS() > 0) { // Send out email to admin - sendAdminNotification(AUTOPURGE_ADMIN_TURBO_SUBJECT, "admin_autopurge_turbo", SQL_AFFECTEDROWS(), ''); - } + sendAdminNotification(AUTOPURGE_ADMIN_TURBO_SUBJECT, 'admin_autopurge_turbo', SQL_AFFECTEDROWS(), ''); + } // END - if } + // ?> diff --git a/inc/libs/cache_functions.php b/inc/libs/cache_functions.php index b5804821a5..1e38e1faf6 100644 --- a/inc/libs/cache_functions.php +++ b/inc/libs/cache_functions.php @@ -119,7 +119,7 @@ class CacheSystem { // This will destory an existing cache file! if ($this->ret == $this->statusDone) { // Create file - if ($this->isCacheReadable()) chmod($this->fqfn, 0666); + if ($this->isCacheReadable()) changeMode($this->fqfn, 0666); $this->pointer = fopen($this->fqfn, 'w') or app_die(__METHOD__, __LINE__, "Cannot write to cache ".$this->fqfn." !"); // Add open PHP tag @@ -172,7 +172,7 @@ class CacheSystem { fclose($this->pointer); // Set rights - if ($this->isCacheReadable()) chmod($this->fqfn, 0666); + if ($this->isCacheReadable()) changeMode($this->fqfn, 0666); // Remove pointer $this->pointer = false; diff --git a/inc/libs/doubler_functions.php b/inc/libs/doubler_functions.php index 16179e2569..e7b890c039 100644 --- a/inc/libs/doubler_functions.php +++ b/inc/libs/doubler_functions.php @@ -50,11 +50,11 @@ function DOUBLER_GENERATE_TABLE ($uid = '0', $done='N', $ref='N', $sort="ASC") { if ($uid > 0) { // Load entries only from a single user $add = " AND `userid`='".bigintval($uid)."'"; - $mode = 'member'; $COLS = "4"; $DT_MODE = "2"; + $mode = 'member'; $COLS = "4"; $DT_MODE = '2'; $NOT_FOUND = getMessage('DOUBLER_MEMBER_NO_ENTRIES_FOUND'); } else { // Guest mode! - $mode = 'guest'; $COLS = "3"; $DT_MODE = "3"; + $mode = 'guest'; $COLS = '3'; $DT_MODE = '3'; $NOT_FOUND = getMessage('DOUBLER_GUEST_NO_ENTRIES_FOUND'); } diff --git a/inc/libs/holiday_functions.php b/inc/libs/holiday_functions.php index 58dba68cb6..885c6551a7 100644 --- a/inc/libs/holiday_functions.php +++ b/inc/libs/holiday_functions.php @@ -69,8 +69,8 @@ LIMIT 1", array(bigintval($content['userid'])), __FUNCTION__, __LINE__, false)); // Prepare array $content = array( - 'holiday_end' => generateDateTime($content['holiday_end'] , "3"), - 'holiday_start' => generateDateTime($content['holiday_start'], "3"), + 'holiday_end' => generateDateTime($content['holiday_end'] , '3'), + 'holiday_start' => generateDateTime($content['holiday_start'], '3'), 'holiday_comments' => $content['comments'] ); diff --git a/inc/libs/html_mail_functions.php b/inc/libs/html_mail_functions.php index e2bcafab29..491afda732 100644 --- a/inc/libs/html_mail_functions.php +++ b/inc/libs/html_mail_functions.php @@ -151,11 +151,11 @@ function HTML_INSERT_URLS ($text) { return COMPILE_CODE(str_replace("\n", "
    \n", $text)); } -// -function SEND_HTML_EMAIL($to, $subject, $message, $FROM) { +// Sends a HTML mail to the user +function sendHtmlEmail($to, $subject, $message, $FROM) { if (EXT_IS_ACTIVE('html_mail')) { // Send mail away as HTML - $FROM = "Content-Type: text/html\n".$FROM; + $FROM = "Content-Type: text/html\n" . $FROM; sendEmail($to, $subject, $message, 'N', $FROM); } } diff --git a/inc/libs/rallye_functions.php b/inc/libs/rallye_functions.php index 9183a06d0d..46e8c45847 100644 --- a/inc/libs/rallye_functions.php +++ b/inc/libs/rallye_functions.php @@ -61,9 +61,9 @@ function RALLYE_AUTOSTART_RALLYES ($result) { // Transfer all neccessary data to the global $DATA array $DATA['uid_cnt'] = SQL_NUMROWS($result_user); - $DATA['start'] = generateDateTime($start, "2"); - $DATA['end'] = generateDateTime($end , "2"); - $DATA['now_t'] = generateDateTime(time(), "2"); + $DATA['start'] = generateDateTime($start, '2'); + $DATA['end'] = generateDateTime($end , '2'); + $DATA['now_t'] = generateDateTime(time(), '2'); $DATA['title'] = $title; $DATA['id'] = $id; // ID for the rallye details link @@ -293,9 +293,9 @@ VALUES ('%s','%s','0')", if ($notify == 'Y') { // Transfer all neccessary data to the global $DATA array - $DATA['start'] = generateDateTime($start, "2"); - $DATA['end'] = generateDateTime($end , "2"); - $DATA['now_t'] = generateDateTime(time(), "2"); + $DATA['start'] = generateDateTime($start, '2'); + $DATA['end'] = generateDateTime($end , '2'); + $DATA['now_t'] = generateDateTime(time(), '2'); $DATA['title'] = $title; $DATA['id'] = $id; // ID for the rallye details link $DATA['ref'] = 0; @@ -330,9 +330,9 @@ function RALLYE_EXPIRE_RALLYES ($result) { $DATA = array(); $cnt = 0; $users = array(); $DATA['title'] = $title; - $DATA['start'] = generateDateTime($start, "1"); - $DATA['end'] = generateDateTime($end , "1"); - $DATA['now_t'] = generateDateTime(time(), "1"); + $DATA['start'] = generateDateTime($start, '1'); + $DATA['end'] = generateDateTime($end , '1'); + $DATA['now_t'] = generateDateTime(time(), '1'); // Just count... $total = 0; @@ -442,7 +442,7 @@ VALUES ('NEW','RALLYE_EXPIRED','{--RALLYE_ADMIN_EXPIRED--}: %s','{--RALLYE_ADMIN // function RALLYE_LOAD_USER_DATA ($uids_array) { // Implode user ids - $uid_string = implode(",", $uids_array['uid']); + $uid_string = implode(',', $uids_array['uid']); // Init result string $ret = ''; @@ -642,9 +642,9 @@ WHERE end_time <= (UNIX_TIMESTAMP() - %s) AND expired='Y'", while ($content = SQL_FETCHARRAY($result_rallye)) { // Prepare data for mail template $DATA['title'] = $content['title']; - $DATA['start'] = generateDateTime($content['start_time'], "1"); - $DATA['end'] = generateDateTime($content['end_time'] , "1"); - $DATA['now_t'] = generateDateTime(time(), "1"); + $DATA['start'] = generateDateTime($content['start_time'], '1'); + $DATA['end'] = generateDateTime($content['end_time'] , '1'); + $DATA['now_t'] = generateDateTime(time(), '1'); // Send mail to admin sendAdminNotification(sprintf(getMessage('RALLYE_ADMIN_PURGED_SUBJ'), $content['title']), "admin_rallye_purged", '', 0); diff --git a/inc/libs/register_functions.php b/inc/libs/register_functions.php index 8ed526a227..ceab0b90fe 100644 --- a/inc/libs/register_functions.php +++ b/inc/libs/register_functions.php @@ -146,9 +146,9 @@ function registerGenerateCategoryTable ($mode, $return=false) { ); if ((REQUEST_POST('cat', $content['id']) == 'Y') || ((getConfig('register_default') == 'Y') && (!REQUEST_ISSET_POST('cat', $content['id'])))) { - $content['def_y'] = ' chkecked="checked"'; + $content['def_y'] = ' checked="checked"'; } else { - $content['def_n'] = ' chkecked="checked"'; + $content['def_n'] = ' checked="checked"'; } // Load template and switch color diff --git a/inc/libs/security_functions.php b/inc/libs/security_functions.php index 9d1cf45625..6e1084ce94 100644 --- a/inc/libs/security_functions.php +++ b/inc/libs/security_functions.php @@ -90,7 +90,7 @@ if (!isset($_POST)) { // Generate arrays which holds the relevante chars to replace $GLOBALS['security_chars'] = array( // The chars we are looking for... - 'from' => array("{", "}", '/', '.', "'", "$", "(", ")", '{--', '--}', "%", ';', "[", "]", ':', "--"), + 'from' => array("{", "}", '/', '.', "'", "$", '(', ')', '{--', '--}', "%", ';', "[", "]", ':', "--"), // ... and we will replace to. 'to' => array( "{OPEN_ANCHOR2}", @@ -163,15 +163,15 @@ if (!defined('_OB_CACHING')) { if (phpversion() >= '4.0.4pl1' && (strstr(getenv('HTTP_USER_AGENT'),'compatible') || (strstr(getenv('HTTP_USER_AGENT'), "Mozilla")))) { if ((extension_loaded('zlib')) && (function_exists('ob_start'))) { // Start caching - define('_OB_CACHING', "on"); + define('_OB_CACHING', 'on'); ob_start(); } else { // Extension not loaded or required function is missing - define('_OB_CACHING', "404"); + define('_OB_CACHING', '404'); } } else { // Old PHP version - define('_OB_CACHING', "old"); + define('_OB_CACHING', 'old'); } } @@ -183,9 +183,9 @@ $SELF_DIR = dirname($_SERVER['PHP_SELF']); $SELF_FILE = basename($_SERVER['PHP_SELF']); // Check for a .php inside the $SELF_DIR... -while (ereg(".php", $SELF_DIR)) { +while (ereg('.php', $SELF_DIR)) { // Correct the dirname - $SELF_DIR = substr($SELF_DIR, 0, (strpos($SELF_DIR, ".php") + 4)); + $SELF_DIR = substr($SELF_DIR, 0, (strpos($SELF_DIR, '.php') + 4)); // Rewrite filename... $SELF_FILE = basename($SELF_DIR); // ... and dirname @@ -200,7 +200,7 @@ unset($SELF_DIR); unset($SELF_FILE); // Security system loaded... -define('__SECURITY', "1"); +define('__SECURITY', '1'); // ?> diff --git a/inc/libs/sponsor_functions.php b/inc/libs/sponsor_functions.php index 1d19320d93..3db8ad7841 100644 --- a/inc/libs/sponsor_functions.php +++ b/inc/libs/sponsor_functions.php @@ -142,7 +142,7 @@ function SPONSOR_HANDLE_SPONSOR (&$POST, $NO_UPDATE=false, $messageArray=array() // Generate message $message = SPONSOR_GET_MESSAGE(ADMIN_SPONSOR_UPDATED, "updated", $messageArray); $ret = "updated"; - } elseif ((!$ALREADY) || (($POST['force'] == "1") && (IS_ADMIN()))) { + } elseif ((!$ALREADY) || (($POST['force'] == '1') && (IS_ADMIN()))) { // Add new sponsor, first add more data $DATA['keys'][] = "sponsor_created"; $DATA['values'][] = time(); $DATA['keys'][] = 'status'; diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index 7c9f58af84..82ae305ab1 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -374,13 +374,13 @@ function SURFBAR_MEMBER_DISPLAY_ACTION_FORM ($action, $urlData) { if ($action == 'edit') { // Default is not limited $urlData['limited_yes'] = ''; - $urlData['limited_no'] = ' chkecked="checked"'; + $urlData['limited_no'] = ' checked="checked"'; $urlData['limited'] = 'false'; // Is this URL limited? if ($urlData['views_max'] > 0) { // Then rewrite form data - $urlData['limited_yes'] = ' chkecked="checked"'; + $urlData['limited_yes'] = ' checked="checked"'; $urlData['limited_no'] = ''; $urlData['limited'] = 'true'; } // END - if @@ -664,8 +664,8 @@ function SURFBAR_NOTIFY_ADMIN ($messageType, $content) { // Translate some data if present if (isset($content['status'])) $content['status'] = surfbarTranslateUserStatus($content['status']); - if (isset($content['registered'])) $content['registered'] = generateDateTime($content['registered'], "2"); - if (isset($content['last_locked'])) $content['last_locked'] = generateDateTime($content['last_locked'], "2"); + if (isset($content['registered'])) $content['registered'] = generateDateTime($content['registered'], '2'); + if (isset($content['last_locked'])) $content['last_locked'] = generateDateTime($content['last_locked'], '2'); if (isset($content['views_total'])) $content['views_total'] = translateComma($content['views_total']); if (isset($content['views_allowed'])) $content['views_allowed'] = translateComma($content['views_allowed']); if (isset($content['views_max'])) $content['views_max'] = translateComma($content['views_max']); @@ -697,8 +697,8 @@ function SURFBAR_NOTIFY_USER ($messageType, $content) { // Translate some data if present if (isset($content['status'])) $content['status'] = surfbarTranslateUserStatus($content['status']); - if (isset($content['registered'])) $content['registered'] = generateDateTime($content['registered'], "2"); - if (isset($content['last_locked'])) $content['last_locked'] = generateDateTime($content['last_locked'], "2"); + if (isset($content['registered'])) $content['registered'] = generateDateTime($content['registered'], '2'); + if (isset($content['last_locked'])) $content['last_locked'] = generateDateTime($content['last_locked'], '2'); if (isset($content['views_total'])) $content['views_total'] = translateComma($content['views_total']); if (isset($content['views_allowed'])) $content['views_allowed'] = translateComma($content['views_allowed']); if (isset($content['views_max'])) $content['views_max'] = translateComma($content['views_max']); @@ -870,7 +870,7 @@ function SURFBAR_GET_TOTAL_URLS ($status = 'ACTIVE', $excludeUserId = 0) { // Get amount from database $result = SQL_QUERY_ESC("SELECT COUNT(id) AS cnt FROM `{!_MYSQL_PREFIX!}_surfbar_urls` -WHERE userid NOT IN (".implode(",", $UIDs['uid']).") AND `status`='%s'", +WHERE userid NOT IN (".implode(',', $UIDs['uid']).") AND `status`='%s'", array($status), __FUNCTION__, __LINE__ ); @@ -1162,7 +1162,7 @@ ORDER BY u.userid ASC", __FUNCTION__, __LINE__); SQL_FREERESULT($result); // Debug message - //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "UIDs::count=".count($UIDs)." (with own userid=".getUserId().")", false); + //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "UIDs::count=".count($UIDs)." (with own userid=".getUserId().')', false); // Return result return $UIDs; @@ -1410,7 +1410,7 @@ LEFT JOIN `{!_MYSQL_PREFIX!}_surfbar_salts` AS sbs ON sbu.id=sbs.url_id LEFT JOIN `{!_MYSQL_PREFIX!}_surfbar_locks` AS l ON sbu.id=l.url_id -WHERE sbu.userid NOT IN (".implode(",", $UIDs).") AND (sbu.views_allowed=0 OR (sbu.views_allowed > 0 AND sbu.views_max > 0)) AND sbu.`status`='ACTIVE'".$add." +WHERE sbu.userid NOT IN (".implode(',', $UIDs).") AND (sbu.views_allowed=0 OR (sbu.views_allowed > 0 AND sbu.views_max > 0)) AND sbu.`status`='ACTIVE'".$add." GROUP BY sbu.id", __FUNCTION__, __LINE__); // Log last query @@ -1484,10 +1484,10 @@ function SURFBAR_RELOAD_TO_STOP_PAGE ($page="stop") { // Internal or external? if ((getConfig('surfbar_pause_mode') == 'INTERNAL') || (getConfig('surfbar_pause_url') == '')) { // Reload to internal page - redirectToUrl("surfbar.php?frame=".$page); + redirectToUrl('surfbar.php?frame=' . $page); } else { // Reload to external page - LOAD_CONFIGURED_URL('surfbar_pause_url'); + redirectToConfiguredUrl('surfbar_pause_url'); } } @@ -1510,11 +1510,11 @@ function SURFBAR_DETERMINE_NEXT_ID ($urlId = 0) { $add = " AND sbu.id NOT IN ("; foreach ($USE as $url_id => $lid) { // Add URL id - $add .= $url_id.","; + $add .= $url_id.','; } // END - foreach // Add closing bracket - $add = substr($add, 0, -1) . ")"; + $add = substr($add, 0, -1) . ')'; } // END - if // Determine depleted user account @@ -1537,7 +1537,7 @@ LEFT JOIN `{!_MYSQL_PREFIX!}_surfbar_salts` AS sbs ON sbu.id=sbs.url_id LEFT JOIN `{!_MYSQL_PREFIX!}_surfbar_locks` AS l ON sbu.id=l.url_id -WHERE sbu.userid NOT IN (".implode(",", $UIDs['uid']).") AND sbu.`status`='ACTIVE' AND (sbu.views_allowed=0 OR (sbu.views_allowed > 0 AND sbu.views_max > 0))".$add." +WHERE sbu.userid NOT IN (".implode(',', $UIDs['uid']).") AND sbu.`status`='ACTIVE' AND (sbu.views_allowed=0 OR (sbu.views_allowed > 0 AND sbu.views_max > 0))".$add." GROUP BY sbu.id ORDER BY l.last_surfed ASC, sbu.id ASC LIMIT %s,1", diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index 1b72e2065e..8ef78b4c6f 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -153,7 +153,7 @@ function ADD_PAGENAV ($PAGES, $offset, $show_form, $colspan,$return=false) { $OUT = ''; for ($page = 1; $page <= $PAGES; $page++) { - if (($page == REQUEST_GET('page')) || ((!REQUEST_ISSET_GET('page')) && ($page == "1"))) { + if (($page == REQUEST_GET('page')) || ((!REQUEST_ISSET_GET('page')) && ($page == '1'))) { $OUT .= "-"; } else { if (!REQUEST_ISSET_GET(('letter'))) REQUEST_SET_GET('letter', getMessage('_ALL2')); @@ -172,7 +172,7 @@ function ADD_PAGENAV ($PAGES, $offset, $show_form, $colspan,$return=false) { $OUT .= $page; - if (($page == REQUEST_GET('page')) || ((!REQUEST_ISSET_GET('page')) && ($page == "1"))) { + if (($page == REQUEST_GET('page')) || ((!REQUEST_ISSET_GET('page')) && ($page == '1'))) { $OUT .= "-"; } else { $OUT .= ""; @@ -222,7 +222,7 @@ WHERE `email`='%s'".$locked." LIMIT 1", } // Selects a random user id as the new referal id if they have at least X confirmed mails in this run -function SELECT_RANDOM_REFID () { +function determineRandomReferalId () { // Default is zero refid $refid = 0; diff --git a/inc/load_config.php b/inc/load_config.php new file mode 100644 index 0000000000..26d35e68c8 --- /dev/null +++ b/inc/load_config.php @@ -0,0 +1,66 @@ + diff --git a/inc/modules/admin.php b/inc/modules/admin.php index 3a3472bcc1..a7c5c9146c 100644 --- a/inc/modules/admin.php +++ b/inc/modules/admin.php @@ -70,7 +70,7 @@ if (!isAdminRegistered()) { switch ($ret) { case 'done': - $done = changeDataInFile(constant('PATH')."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0); + $done = changeDataInFile(constant('PATH') . 'inc/cache/config-local.php', "ADMIN-SETUP", "setConfigEntry('ADMIN_REGISTERED', \"", "\");", 'Y', 0); if ($done === true) { // Registering is done redirectToUrl('modules.php?module=admin&register=done'); @@ -98,7 +98,7 @@ if (!isAdminRegistered()) { // Admin still not registered? if (!isAdminRegistered()) { // Write to config that registration is done - changeDataInFile(constant('PATH')."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0); + changeDataInFile(constant('PATH') . 'inc/cache/config-local.php', "ADMIN-SETUP", "setConfigEntry('ADMIN_REGISTERED', \"", "\");", 'Y', 0); // Load URL for login redirectToUrl('modules.php?module=admin'); diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 889820cea9..af3e0ab424 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -69,7 +69,7 @@ function REGISTER_ADMIN ($user, $md5, $email) { // Only be executed on login procedure! function CHECK_ADMIN_LOGIN ($admin_login, $password) { // By default no admin is found - $ret = "404"; + $ret = '404'; // Get admin id $aid = GET_ADMIN_ID($admin_login); @@ -131,7 +131,7 @@ function CHECK_ADMIN_LOGIN ($admin_login, $password) { $salt = __SALT; // Check if password is same - //* DEBUG: */ echo "*".$ret.",".$data['password'].",".$password.",".$salt."*
    \n"; + //* DEBUG: */ echo "*".$ret.','.$data['password'].','.$password.','.$salt."*
    \n"; if (($ret == 'pass') && ($data['password'] == generateHash($password, $salt)) && ((!empty($salt))) || ($data['password'] == $password)) { // Re-hash the plain passord with new random salt $data['password'] = generateHash($password); @@ -218,13 +218,13 @@ function LOGIN_ADMIN ($adminLogin, $passHash) { // Only be executed on cookie checking function CHECK_ADMIN_COOKIES ($admin_login, $password) { // By default no admin cookies are found - $ret = "404"; $pass = ''; + $ret = '404'; $pass = ''; // Get hash $pass = GET_ADMIN_HASH(GET_ADMIN_ID($admin_login)); - if ($pass != "-1") $ret = 'pass'; + if ($pass != '-1') $ret = 'pass'; - //* DEBUG: */ print __FUNCTION__."(".__LINE__."):".generatePassString($pass)."(".strlen($pass).")/".$password."(".strlen($password).")
    \n"; + //* DEBUG: */ print __FUNCTION__."(".__LINE__."):".generatePassString($pass).'('.strlen($pass).")/".$password.'('.strlen($password).")
    \n"; // Check if password matches if (($ret == 'pass') && ((generatePassString($pass) == $password) || ($pass == $password) || ((strlen($pass) == 32) && (md5($password) == $pass)))) { @@ -661,7 +661,7 @@ function ADMIN_MAKE_MENU_SELECTION ($menu, $type, $name, $default = '') { // Walk through all files foreach ($menuArray as $file) { // Is this a PHP script? - if ((!isDirectory($file)) && (strpos($file, "".$type.'-') > -1) && (strpos($file, ".php") > 0)) { + if ((!isDirectory($file)) && (strpos($file, "".$type.'-') > -1) && (strpos($file, '.php') > 0)) { // Then test if the file is readable $test = sprintf("%sinc/modules/%s/%s", constant('PATH'), $menu, $file); @@ -993,7 +993,7 @@ function ADMIN_DELETE_ENTRIES_CONFIRM ($IDs, $table, $columns=array(), $filterFu } // END - if // Add id number - $idList .= $id.","; + $idList .= $id . ','; } // END - foreach // Run the query diff --git a/inc/modules/admin/overview-inc.php b/inc/modules/admin/overview-inc.php index 504e740523..14944df068 100644 --- a/inc/modules/admin/overview-inc.php +++ b/inc/modules/admin/overview-inc.php @@ -55,7 +55,7 @@ function OUTPUT_STANDARD_OVERVIEW(&$result_tasks) { $extensionList = getArrayFromDirectory("inc/extensions/", "ext-", false, false); foreach ($extensionList as $file) { // Is this file an extension? - if ((substr($file, 0, 4) == "ext-") && (substr($file, -4) == ".php")) { + if ((substr($file, 0, 4) == "ext-") && (substr($file, -4) == '.php')) { //* DEBUG: */ echo $file."
    \n"; // Possible newly installed extension found so we extract extension's name $ext_name = strtolower(substr($file, 4, -4)); // Keep always extension names on lower case!!! @@ -421,7 +421,7 @@ LIMIT 1", 'admin' => $content['assigned_admin'], 'uid' => $content['userid'], 'type' => $content['task_type_msg'], - 'created' => generateDateTime($content['task_created'], "2") + 'created' => generateDateTime($content['task_created'], '2') )); // Do we have extension task? diff --git a/inc/modules/admin/what-admin_add.php b/inc/modules/admin/what-admin_add.php index bc85b8a791..7c14e58139 100644 --- a/inc/modules/admin/what-admin_add.php +++ b/inc/modules/admin/what-admin_add.php @@ -136,18 +136,13 @@ if (!IS_FORM_SENT()) } $OUT = " "; - foreach ($below as $key => $m) - { - if (is_array($m)) - { - foreach ($m as $key2 => $m2) - { + foreach ($below as $key => $m) { + if (is_array($m)) { + foreach ($m as $key2 => $m2) { $OUT .= " \n"; diff --git a/inc/modules/admin/what-list_autopurge.php b/inc/modules/admin/what-list_autopurge.php index dd93f3ba03..be29dfad9f 100644 --- a/inc/modules/admin/what-list_autopurge.php +++ b/inc/modules/admin/what-list_autopurge.php @@ -83,9 +83,9 @@ if (SQL_NUMROWS($result) > 0) { 'sname' => $content['surname'], 'fname' => $content['family'], 'email' => "".$content['email']."", - 'joined' => generateDateTime($content['joined'], "2"), - 'last' => generateDateTime($content['last_online'], "2"), - 'notified' => generateDateTime($content['ap_notified'], "2"), + 'joined' => generateDateTime($content['joined'], '2'), + 'last' => generateDateTime($content['last_online'], '2'), + 'notified' => generateDateTime($content['ap_notified'], '2'), ); // Load row template diff --git a/inc/modules/admin/what-list_beg.php b/inc/modules/admin/what-list_beg.php index 3bb5aba71f..ed8b864cd4 100644 --- a/inc/modules/admin/what-list_beg.php +++ b/inc/modules/admin/what-list_beg.php @@ -91,7 +91,7 @@ ORDER BY beg_points DESC, last_online DESC, userid", 'sname' => $content['surname'], 'fname' => $content['family'], 'turbo' => translateComma($content['beg_points']), - 'last' => generateDateTime($content['last_online'], "2"), + 'last' => generateDateTime($content['last_online'], '2'), 'sw' => $SW, 'win1' => $WIN1, 'win2' => $WIN2, @@ -116,7 +116,7 @@ ORDER BY beg_points DESC, last_online DESC, userid", // Prepare constant for timemark if (EXT_IS_ACTIVE('autopurge')) { - define('__AUTOPURGE_TIMEOUT', generateDateTime(time() - getConfig('ap_inactive_since'), "2")); + define('__AUTOPURGE_TIMEOUT', generateDateTime(time() - getConfig('ap_inactive_since'), '2')); } else { define('__AUTOPURGE_TIMEOUT', sprintf(getMessage('EXTENSION_PROBLEM_NOT_INSTALLED'), 'autopurge')); } diff --git a/inc/modules/admin/what-list_bonus.php b/inc/modules/admin/what-list_bonus.php index 1a225c96f3..ef776061a6 100644 --- a/inc/modules/admin/what-list_bonus.php +++ b/inc/modules/admin/what-list_bonus.php @@ -57,16 +57,16 @@ if (getConfig('bonus_active') == 'Y') { if (GET_EXT_VERSION('bonus') >= '0.6.9') { // Add more bonus points here - $USE = "(0"; - if (getConfig('bonus_click_yn') == 'Y') $USE .= " + turbo_bonus"; - if (getConfig('bonus_login_yn') == 'Y') $USE .= " + login_bonus"; - if (getConfig('bonus_order_yn') == 'Y') $USE .= " + bonus_order"; - if (getConfig('bonus_stats_yn') == 'Y') $USE .= " + bonus_stats"; - if (getConfig('bonus_ref_yn') == 'Y') $USE .= " + bonus_ref"; - $USE .= ")"; + $USE = '(0'; + if (getConfig('bonus_click_yn') == 'Y') $USE .= " + `turbo_bonus`"; + if (getConfig('bonus_login_yn') == 'Y') $USE .= " + `login_bonus`"; + if (getConfig('bonus_order_yn') == 'Y') $USE .= " + `bonus_order`"; + if (getConfig('bonus_stats_yn') == 'Y') $USE .= " + `bonus_stats`"; + if (getConfig('bonus_ref_yn') == 'Y') $USE .= " + `bonus_ref`"; + $USE .= ')'; } else { // Old version ??? - $USE = "turbo_bonus"; + $USE = 'turbo_bonus'; } // Autopurge installed? @@ -104,7 +104,7 @@ ORDER BY points DESC, last_online DESC, userid", $content['email'] = generateMemberEmailLink($content['email'], "user_data"); $content['gender'] = translateGender($content['gender']); $content['points'] = translateComma($content['points']); - $content['last'] = generateDateTime($content['last'], "2"); + $content['last'] = generateDateTime($content['last'], '2'); $content['sw'] = $SW; $content['win1'] = $WIN1; $content['win2'] = $WIN2; @@ -128,7 +128,7 @@ ORDER BY points DESC, last_online DESC, userid", // Prepare constant for timemark if (EXT_IS_ACTIVE('autopurge')) { - define('__AUTOPURGE_TIMEOUT', generateDateTime(time() - getConfig('ap_inactive_since'), "2")); + define('__AUTOPURGE_TIMEOUT', generateDateTime(time() - getConfig('ap_inactive_since'), '2')); } else { define('__AUTOPURGE_TIMEOUT', sprintf(getMessage('EXTENSION_PROBLEM_NOT_INSTALLED'), 'autopurge')); } diff --git a/inc/modules/admin/what-list_holiday.php b/inc/modules/admin/what-list_holiday.php index 9a0a4a1f09..0dc684b149 100644 --- a/inc/modules/admin/what-list_holiday.php +++ b/inc/modules/admin/what-list_holiday.php @@ -64,11 +64,11 @@ if (SQL_NUMROWS($result) > 0) { 'sw' => $SW, 'id' => $content['id'], 'uid' => generateUserProfileLink($content['userid']), - 'start' => generateDateTime($content['holiday_start'], "3"), - 'end' => generateDateTime($content['holiday_end'], "3"), + 'start' => generateDateTime($content['holiday_start'], '3'), + 'end' => generateDateTime($content['holiday_end'], '3'), 'comments' => wordwrap($content['comments'], 15), 'status' => translateUserStatus($content['status']), - 'last' => generateDateTime($content['last_online'], "3"), + 'last' => generateDateTime($content['last_online'], '3'), ); // Load row template and switch color diff --git a/inc/modules/admin/what-list_notifications.php b/inc/modules/admin/what-list_notifications.php index bc34e3156c..ee0ec97d5e 100644 --- a/inc/modules/admin/what-list_notifications.php +++ b/inc/modules/admin/what-list_notifications.php @@ -50,7 +50,7 @@ $WHO = _ALL; $SQL2 = ''; // Set offset an current page to default values -if (!REQUEST_ISSET_GET('page')) REQUEST_SET_GET('page' , "1"); +if (!REQUEST_ISSET_GET('page')) REQUEST_SET_GET('page' , '1'); if (!REQUEST_ISSET_GET('offset')) REQUEST_SET_GET('offset', getConfig('mails_page')); if ((EXT_IS_ACTIVE('bonus')) && ($WHO == getMessage('_ALL'))) { @@ -109,7 +109,7 @@ if ((EXT_IS_ACTIVE('bonus')) && (SQL_NUMROWS($result_max) > 0) && (!empty($SQL2) // Add navigation (without change box but with colspan=3) $content['nav'] = ''; - if ($PAGES > 1) $content['nav'] = ADD_EMAIL_NAV($PAGES, getConfig('mails_page'), false, "3", true); + if ($PAGES > 1) $content['nav'] = ADD_EMAIL_NAV($PAGES, getConfig('mails_page'), false, '3', true); // Prepare content $content['rows'] = $OUT; diff --git a/inc/modules/admin/what-list_payouts.php b/inc/modules/admin/what-list_payouts.php index 1215c5fa6d..5a63f110c4 100644 --- a/inc/modules/admin/what-list_payouts.php +++ b/inc/modules/admin/what-list_payouts.php @@ -258,7 +258,7 @@ ORDER BY p.payout_timestamp DESC", __FILE__, __LINE__); 'ptype' => translateComma($content['payout_total'])." ".COMPILE_CODE($content['type']), 'account' => $content['target_account'], 'bank' => $content['target_bank'], - 'tstamp' => generateDateTime($content['payout_timestamp'], "2"), + 'tstamp' => generateDateTime($content['payout_timestamp'], '2'), 'status' => $content['status'], ); diff --git a/inc/modules/admin/what-list_primera.php b/inc/modules/admin/what-list_primera.php index cbb86b063c..f2bddbfa2f 100644 --- a/inc/modules/admin/what-list_primera.php +++ b/inc/modules/admin/what-list_primera.php @@ -58,7 +58,7 @@ if (SQL_NUMROWS($result) > 0) { $content['sw'] = $SW; $content['link'] = generateUserProfileLink($content['userid']); $content['primera_amount'] = translateComma($content['primera_amount']); - $content['primera_timestamp'] = generateDateTime($content['primera_timestamp'], "2"); + $content['primera_timestamp'] = generateDateTime($content['primera_timestamp'], '2'); $content['raw_type'] = strtolower($content['primera_type']); $content['primera_type'] = PRIMERA_TRANSFER_STATUS($content['primera_type']); diff --git a/inc/modules/admin/what-list_rallyes.php b/inc/modules/admin/what-list_rallyes.php index 8f9e81d5fd..5d8c97163f 100644 --- a/inc/modules/admin/what-list_rallyes.php +++ b/inc/modules/admin/what-list_rallyes.php @@ -57,7 +57,7 @@ if (REQUEST_ISSET_GET(('rallye'))) { // Activate / deactivate switch (REQUEST_GET('activate')) { - case "1": // Activate + case '1': // Activate ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET is_active='Y' WHERE `id`=%s AND is_active='N' LIMIT 1"); break; @@ -69,7 +69,7 @@ if (REQUEST_ISSET_GET(('rallye'))) { // Automatic notification switch (REQUEST_GET('notify')) { - case "1": // Activate + case '1': // Activate ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET send_notify='Y' WHERE `id`=%s AND send_notify='N' LIMIT 1"); break; @@ -81,7 +81,7 @@ if (REQUEST_ISSET_GET(('rallye'))) { // Automatic adding of new members switch (REQUEST_GET('auto')) { - case "1": // Activate + case '1': // Activate ADD_SQL("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET auto_add_new_user='Y' WHERE `id`=%s AND auto_add_new_user='N' LIMIT 1"); break; diff --git a/inc/modules/admin/what-list_refs.php b/inc/modules/admin/what-list_refs.php index 77912df496..4bfaa48adc 100644 --- a/inc/modules/admin/what-list_refs.php +++ b/inc/modules/admin/what-list_refs.php @@ -150,7 +150,7 @@ ORDER BY level ASC", __FILE__, __LINE__); 'family' => $data['family'], 'email' => "[".$data['email']."]", 'status' => translateUserStatus($data['status']), - 'registered' => generateDateTime($data['joined'], "3"), + 'registered' => generateDateTime($data['joined'], '3'), ); // Check if referal count is larger 0 and update link @@ -202,7 +202,7 @@ ORDER BY level ASC", __FILE__, __LINE__); 'family' => $levels['family'], 'email' => "[".$levels['email']."]", 'status' => translateUserStatus($levels['status']), - 'registered' => generateDateTime($levels['joined'], "3"), + 'registered' => generateDateTime($levels['joined'], '3'), ); // Check if referal count is larger 0 and update link diff --git a/inc/modules/admin/what-list_sponsor.php b/inc/modules/admin/what-list_sponsor.php index af15d3b2db..efb727b5e6 100644 --- a/inc/modules/admin/what-list_sponsor.php +++ b/inc/modules/admin/what-list_sponsor.php @@ -94,9 +94,9 @@ WHERE `id`='%s' LIMIT 1", define('__SPONSOR_EMAIL_VALUE', $DATA['email']); define('__SPONSOR_URL' , DEREFERER($DATA['url'])); // Timestamps - define('__SPONSOR_CREATED' , generateDateTime($DATA['sponsor_created'], "2")); - define('__SPONSOR_LAST_ONLINE', generateDateTime($DATA['last_online'], "2")); - define('__SPONSOR_LAST_CHANGE', generateDateTime($DATA['last_change'], "2")); + define('__SPONSOR_CREATED' , generateDateTime($DATA['sponsor_created'], '2')); + define('__SPONSOR_LAST_ONLINE', generateDateTime($DATA['last_online'], '2')); + define('__SPONSOR_LAST_CHANGE', generateDateTime($DATA['last_change'], '2')); // Sponsor points define('__SPONSOR_AMOUNT' , translateComma($DATA['points_amount'])); define('__SPONSOR_USED' , translateComma($DATA['points_used'])); @@ -161,8 +161,8 @@ FROM `{!_MYSQL_PREFIX!}_sponsor_data` ORDER BY `id`", __FILE__, __LINE__); 'fname' => $content['family'], 'email' => "mailto:".$content['email'], 'status' => sponsorTranslateUserStatus($content['status']), - 'created' => generateDateTime($content['sponsor_created'], "2"), - 'last' => generateDateTime($content['last_online'], "2"), + 'created' => generateDateTime($content['sponsor_created'], '2'), + 'last' => generateDateTime($content['last_online'], '2'), 'points' => translateComma($content['points_amount'] - $content['points_used']), 'ip' => $content['remote_addr'], ); diff --git a/inc/modules/admin/what-list_task.php b/inc/modules/admin/what-list_task.php index 3808ecf675..c4a7f8d217 100644 --- a/inc/modules/admin/what-list_task.php +++ b/inc/modules/admin/what-list_task.php @@ -167,7 +167,7 @@ ORDER BY userid DESC, task_type DESC, subject, task_created DESC", __FILE__, __L 'admin' => $content['assigned_admin'], 'uid' => $content['userid'], 'type' => $content['task_type_msg'], - 'created' => generateDateTime($content['task_created'], "2") + 'created' => generateDateTime($content['task_created'], '2') )); // Do we have an extension task? diff --git a/inc/modules/admin/what-list_transfer.php b/inc/modules/admin/what-list_transfer.php index 24cff28bed..17d79344fa 100644 --- a/inc/modules/admin/what-list_transfer.php +++ b/inc/modules/admin/what-list_transfer.php @@ -57,7 +57,7 @@ if (SQL_NUMROWS($result) > 0) $content = array( 'sw' => $SW, 'idx' => $content['trans_id'], - 'stamp' => generateDateTime($content['time_trans'], "3"), + 'stamp' => generateDateTime($content['time_trans'], '3'), 'from_link' => generateUserProfileLink($content['userid']), 'to_link' => generateUserProfileLink($content['to_uid']), 'reason' => wordwrap($content['reason'], 15), diff --git a/inc/modules/admin/what-list_unconfirmed.php b/inc/modules/admin/what-list_unconfirmed.php index da4767d126..2d9cb3b763 100644 --- a/inc/modules/admin/what-list_unconfirmed.php +++ b/inc/modules/admin/what-list_unconfirmed.php @@ -60,7 +60,7 @@ ON p.id=s.pool_id WHERE p.id='".REQUEST_GET('mid')."' LIMIT 1"; // Column, type and ID for member's mail - $col = "stats_id"; $type = "NORMAL"; $ID = "-1"; + $col = "stats_id"; $type = "NORMAL"; $ID = '-1'; // Load admin_list_unconfirmed template $listed = true; $DATA = REQUEST_GET('mid'); $LINK = 'mailid'; @@ -92,7 +92,7 @@ if ($listed === true) { SQL_FREERESULT($result); // Transfer data to constants for the template - if (($stats_id > 0) && ($ID == "-1")) $ID = $stats_id; + if (($stats_id > 0) && ($ID == '-1')) $ID = $stats_id; if ($col == 'bonus_id') $sender = 0; // Load unconfirmed mail links. Hmmm, this select query is pretty cool @@ -147,7 +147,7 @@ WHERE l.%s='%s' ORDER BY l.userid LIMIT %s", 'text' => COMPILE_CODE($text), 'url' => FRAMETESTER($url), 'unconfirmed' => $unconfirmed, - 'stamp' => generateDateTime($stamp, "2"), + 'stamp' => generateDateTime($stamp, '2'), 'rows' => $OUT ); diff --git a/inc/modules/admin/what-list_user.php b/inc/modules/admin/what-list_user.php index a13bbaf732..c21ac0a8fc 100644 --- a/inc/modules/admin/what-list_user.php +++ b/inc/modules/admin/what-list_user.php @@ -92,7 +92,7 @@ if (EXT_IS_ACTIVE('country')) { // Init unset data (bad that we change $_GET here!) if (!REQUEST_ISSET_GET(('letter'))) { REQUEST_SET_GET('letter', getMessage('_ALL2')); } if (!REQUEST_ISSET_GET(('sortby'))) { REQUEST_SET_GET('sortby', 'userid'); } -if (!REQUEST_ISSET_GET('page')) { REQUEST_SET_GET('page' , "1"); } +if (!REQUEST_ISSET_GET('page')) { REQUEST_SET_GET('page' , '1'); } // Set base URL $base = "[ 0) { // Then use it - define('_BIRTHDAY', generateDateTime($stamp, "3")); + define('_BIRTHDAY', generateDateTime($stamp, '3')); } else { // Zero or below so set zero! - define('_BIRTHDAY', generateDateTime(0, "3")); + define('_BIRTHDAY', generateDateTime(0, '3')); } // Prepare data for template @@ -151,7 +151,7 @@ LIMIT 1", $DATA['last_profile_sent'] = generateDateTime($DATA['last_profile_sent'], '0'); $DATA['total'] = translateComma(GET_TOTAL_DATA($uid, "user_points", "points")); $DATA['locked'] = translateComma(GET_TOTAL_DATA($uid, "user_points", "locked_points")); - $DATA['lock_timestamp'] = generateDateTime($DATA['lock_timestamp'], "2"); + $DATA['lock_timestamp'] = generateDateTime($DATA['lock_timestamp'], '2'); // Is the lock reason not set? if (!isset($DATA['lock_reason'])) $DATA['lock_reason'] = '---'; @@ -250,7 +250,7 @@ LIMIT 1", // Activate the extension please! $PAGES = round(SQL_NUMROWS($result_master) / getConfig('user_limit') + 0.5); - if (!REQUEST_ISSET_GET('page')) REQUEST_SET_GET('page' , "1"); + if (!REQUEST_ISSET_GET('page')) REQUEST_SET_GET('page' , '1'); if (!REQUEST_ISSET_GET('offset')) REQUEST_SET_GET('offset', getConfig('user_limit')); // Add limitation to SQL string and run him again @@ -327,7 +327,7 @@ LIMIT 1", $content['points'] = translateComma($pointsTotal); $content['rate'] = translateComma($clickRate); $content['locked'] = translateComma(GET_TOTAL_DATA($content['userid'], "user_points", "locked_points")); - $content['lock_timestamp'] = generateDateTime($content['lock_timestamp'], "2"); + $content['lock_timestamp'] = generateDateTime($content['lock_timestamp'], '2'); $content['status'] = translateUserStatus($content['status']); // Is the lock reason not set? diff --git a/inc/modules/admin/what-list_wernis.php b/inc/modules/admin/what-list_wernis.php index 24501b427b..cce8fb1049 100644 --- a/inc/modules/admin/what-list_wernis.php +++ b/inc/modules/admin/what-list_wernis.php @@ -58,7 +58,7 @@ if (SQL_NUMROWS($result) > 0) { $content['sw'] = $SW; $content['link'] = generateUserProfileLink($content['userid']); $content['wernis_amount'] = translateComma($content['wernis_amount']); - $content['wernis_timestamp'] = generateDateTime($content['wernis_timestamp'], "2"); + $content['wernis_timestamp'] = generateDateTime($content['wernis_timestamp'], '2'); $content['raw_type'] = strtolower($content['wernis_type']); $content['wernis_type'] = WERNIS_TRANSFER_STATUS($content['wernis_type']); diff --git a/inc/modules/admin/what-logs.php b/inc/modules/admin/what-logs.php index 8d1c582348..df3a5872f0 100644 --- a/inc/modules/admin/what-logs.php +++ b/inc/modules/admin/what-logs.php @@ -45,7 +45,7 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { // Add description as navigation point ADD_DESCR('admin', __FILE__); -if (REQUEST_ISSET_GET(('access'))) { +if (REQUEST_ISSET_GET('access')) { // Secure input and construct FQFN $access = SQL_ESCAPE(strip_tags(REQUEST_GET('access'))); $target = sprintf("%slogs/%s", constant('PATH'), $access); @@ -62,15 +62,15 @@ if (REQUEST_ISSET_GET(('access'))) { clearOutputBuffer(); // Set header - if (substr($access, -3, 3) == "log") { + if (substr($access, -3, 3) == 'log') { // Output header - header("Content-Type: text/plain"); - } elseif (substr($access, -3, 3) == ".gz") { + sendHeader('Content-Type: text/plain'); + } elseif (substr($access, -3, 3) == '.gz') { // @TODO Fix content-type here - header("Content-Type: text/plain"); - } elseif (substr($access, -3, 3) == ".bz2") { + sendHeader('Content-Type: text/plain'); + } elseif (substr($access, -3, 3) == '.bz2') { // @TODO Fix content-type here - header("Content-Type: text/plain"); + sendHeader('Content-Type: text/plain'); } else { // Restore old content OUTPUT_HTML($OUTPUT); @@ -90,13 +90,15 @@ if (REQUEST_ISSET_GET(('access'))) { } else { // List access logfiles $dir = constant('PATH') . getConfig('logs_base') . '/'; + + // Is the directory there? if (isDirectory($dir)) { // logs directory does exist OUTPUT_HTML("
      "); - $handle = opendir($dir) or app_die(__FILE__, __LINE__, "Cannot open directory ".getConfig('logs_base').'!'); + $handle = opendir($dir) or app_die(__FILE__, __LINE__, 'Cannot open directory '.getConfig('logs_base') . '!'); while ($file = readdir($handle)) { // We currenly only like files with "access" as prefix, should be more flexible! - if (substr($file, 0, 6) == "access") { + if (substr($file, 0, 6) == 'access') { // Okay, let us print it out OUTPUT_HTML("
    1. ".$file."
    2. "); } diff --git a/inc/modules/admin/what-mem_add.php b/inc/modules/admin/what-mem_add.php index 9a8f9cfee0..d96a8491d9 100644 --- a/inc/modules/admin/what-mem_add.php +++ b/inc/modules/admin/what-mem_add.php @@ -145,7 +145,7 @@ if (!IS_FORM_SENT()) { $OUT .= " \n"; diff --git a/inc/modules/admin/what-refbanner.php b/inc/modules/admin/what-refbanner.php index bab476d6c1..857b516d6e 100644 --- a/inc/modules/admin/what-refbanner.php +++ b/inc/modules/admin/what-refbanner.php @@ -102,7 +102,7 @@ VALUES ('%s','%s','%s')", LOAD_TEMPLATE('admin_settings_saved', false, $content); } elseif (($SEL > 0) && (REQUEST_ISSET_POST('edit'))) { // Edit banner - $SW = ''; $OUT = ''; + $SW = 2; $OUT = ''; foreach (REQUEST_POST('sel') as $id => $sel) { // Load data $result = SQL_QUERY_ESC("SELECT url, alternate, visible FROM `{!_MYSQL_PREFIX!}_refbanner` WHERE `id`=%s LIMIT 1", diff --git a/inc/modules/admin/what-send_newsletter.php b/inc/modules/admin/what-send_newsletter.php index c93be07865..c96e883df0 100644 --- a/inc/modules/admin/what-send_newsletter.php +++ b/inc/modules/admin/what-send_newsletter.php @@ -84,7 +84,7 @@ ORDER BY userid ASC", __FILE__, __LINE__); } else { // Copy data into constants for the template and load it // @TODO Rewrite this constant - define('_DATESTAMP', generateDateTime(time(), "3")); + define('_DATESTAMP', generateDateTime(time(), '3')); if (EXT_IS_ACTIVE('html_mail')) { // Load template with HTML mode LOAD_TEMPLATE("admin_newsletter"); diff --git a/inc/modules/admin/what-surfbar_stats.php b/inc/modules/admin/what-surfbar_stats.php index 6637b61c9b..05416d05f5 100644 --- a/inc/modules/admin/what-surfbar_stats.php +++ b/inc/modules/admin/what-surfbar_stats.php @@ -65,7 +65,7 @@ ORDER BY `userid` ASC", // "Translate" some data $content['userid'] = generateUserProfileLink($content['userid']); $content['total_visits'] = translateComma($content['total_visits']); - $content['last_online'] = generateDateTime($content['last_online'], "2"); + $content['last_online'] = generateDateTime($content['last_online'], '2'); $content['sw'] = $SW; // Load row template diff --git a/inc/modules/admin/what-theme_check.php b/inc/modules/admin/what-theme_check.php index 7706757737..993ecc443b 100644 --- a/inc/modules/admin/what-theme_check.php +++ b/inc/modules/admin/what-theme_check.php @@ -127,7 +127,7 @@ if (($response[count($response) - 1] == "[EOF]") && ($response[0] != "[EOF]")) { $OUT .= " ".($idx + 1).". ".$name." - ".generateDateTime($THEMES['fctime'][$idx], "2")." + ".generateDateTime($THEMES['fctime'][$idx], '2')." ".translateComma(round($THEMES['fsize'][$idx] / 1.024) / 1000)." ".KBYTES." ".$THEMES['ver'][$idx]." (".$THEMES['cver'][$idx].") diff --git a/inc/modules/admin/what-unlock_emails.php b/inc/modules/admin/what-unlock_emails.php index 20687f46a6..7411003f73 100644 --- a/inc/modules/admin/what-unlock_emails.php +++ b/inc/modules/admin/what-unlock_emails.php @@ -212,7 +212,7 @@ LIMIT 1", 'cat_link' => $content['category'], 'pay_title' => str_replace("\"", """, getPaymentTitlePrice($content['payment'], true)), 'pay_link' => $content['payment'], - 'ordered' => generateDateTime($content['timestamp'], "2"), + 'ordered' => generateDateTime($content['timestamp'], '2'), 'tsend' => $content['target_send'], ); diff --git a/inc/modules/admin/what-unlock_sponsor.php b/inc/modules/admin/what-unlock_sponsor.php index e6e6866993..65418b104b 100644 --- a/inc/modules/admin/what-unlock_sponsor.php +++ b/inc/modules/admin/what-unlock_sponsor.php @@ -93,7 +93,7 @@ ORDER BY sp.pay_name", $data = array( 'aid' => $content['email'], 'order' => ($content['pay_count'] * $content['pay_rate'])." ".$content['pay_currency'], - 'stamp' => generateDateTime($content['pay_ordered'], "2"), + 'stamp' => generateDateTime($content['pay_ordered'], '2'), 'pname' => $content['pay_name'], ); @@ -194,7 +194,7 @@ if (SQL_NUMROWS($result) > 0) { 'family' => $content['family'], 'email' => "mailto:".$content['email'], 'remote' => $content['remote_addr'], - 'created' => generateDateTime($content['sponsor_created'], "2"), + 'created' => generateDateTime($content['sponsor_created'], '2'), ); // Load row template and switch colors diff --git a/inc/modules/admin/what-updates.php b/inc/modules/admin/what-updates.php index 411634ab67..de2c0a2dcd 100644 --- a/inc/modules/admin/what-updates.php +++ b/inc/modules/admin/what-updates.php @@ -132,7 +132,7 @@ if (empty($ONLINE['version'])) { } elseif (($ONLINE['version'] != constant('FULL_VERSION')) || ($ONLINE['revision'] != constant('CURR_SVN_REVISION'))) { // New full-version available (all previous released patches are included in this version!) define('__ONLINE_VERSION', $ONLINE['version']); - define('__ONLINE_CHANGE' , generateDateTime($ONLINE['changed'], "2")); + define('__ONLINE_CHANGE' , generateDateTime($ONLINE['changed'], '2')); define('__ONLINE_REVISION', $ONLINE['revision']); // Load template diff --git a/inc/modules/admin/what-usage.php b/inc/modules/admin/what-usage.php index 7041ee31bf..bd1a7e0378 100644 --- a/inc/modules/admin/what-usage.php +++ b/inc/modules/admin/what-usage.php @@ -46,7 +46,7 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR('admin', __FILE__); // Base directory (should be moved to database) -$usage = getConfig('usage_base').'/'; +$usage = getConfig('usage_base') . '/'; if (REQUEST_ISSET_GET(('image'))) { if (REQUEST_GET('type') == 'usage') { @@ -66,7 +66,7 @@ if (REQUEST_ISSET_GET(('image'))) { if (isFileReadable($FQFN)) { $image = imagecreatefrompng($FQFN); - header("Content-type: image/png"); + sendHeader("Content-type: image/png"); imagepng($image); imagedestroy($image); } diff --git a/inc/modules/guest/what-confirm.php b/inc/modules/guest/what-confirm.php index aa8d40d7d7..91595cf84a 100644 --- a/inc/modules/guest/what-confirm.php +++ b/inc/modules/guest/what-confirm.php @@ -108,7 +108,7 @@ if (REQUEST_ISSET_GET(('hash'))) { } // END - if // Account confirmed! - if (defined('LEAD_CODE_ENABLED') && defined('LEAD_EXPIRY_TIME')) { + if (EXT_IS_ACTIVE('lead')) { // Set special lead cookie setSession('lead_uid', bigintval($uid)); @@ -119,7 +119,7 @@ if (REQUEST_ISSET_GET(('hash'))) { define('__UID', bigintval($uid)); LOAD_TEMPLATE("guest_confirm_table"); } - } elseif (defined('LEAD_CODE_ENABLED') && defined('LEAD_EXPIRY_TIME')) { + } elseif (EXT_IS_ACTIVE('lead')) { // Set special lead cookie setSession('lead_uid', bigintval($uid)); diff --git a/inc/modules/guest/what-login.php b/inc/modules/guest/what-login.php index 61303934d4..c0f493ff82 100644 --- a/inc/modules/guest/what-login.php +++ b/inc/modules/guest/what-login.php @@ -88,7 +88,7 @@ if (!REQUEST_ISSET_GET(('login'))) REQUEST_SET_GET('login' , ''); if (IS_MEMBER()) { // Login immidiately... $URL = 'modules.php?module=login'; -} elseif ((IS_FORM_SENT()) && (''.$uid.'' != ''.REQUEST_POST('id').'')) { +} elseif ((IS_FORM_SENT()) && (''.$uid.'' != ''.REQUEST_POST('id') . '')) { // Invalid input (no nickname extension installed but nickname entered) $errorCode = getCode('EXTENSION_PROBLEM'); } elseif (IS_FORM_SENT()) { diff --git a/inc/modules/guest/what-rallyes.php b/inc/modules/guest/what-rallyes.php index be0254f732..dd494cf90f 100644 --- a/inc/modules/guest/what-rallyes.php +++ b/inc/modules/guest/what-rallyes.php @@ -91,8 +91,8 @@ if (SQL_NUMROWS($result) == 1) { } // Set start and end time - define('__RALLYE_START', generateDateTime($start, "1")); - define('__RALLYE_END' , generateDateTime($end , "1")); + define('__RALLYE_START', generateDateTime($start, '1')); + define('__RALLYE_END' , generateDateTime($end , '1')); // Determine min_users define('__RALLYE_MAX_USERS', RALLYE_DETERMINE_MIN_USERS($min_users)); diff --git a/inc/modules/guest/what-register.php b/inc/modules/guest/what-register.php index 2c4368b4a9..ea30251620 100644 --- a/inc/modules/guest/what-register.php +++ b/inc/modules/guest/what-register.php @@ -69,7 +69,7 @@ if (!REQUEST_ISSET_POST(('street_nr'))) REQUEST_SET_POST('street_nr' , ''); if (!REQUEST_ISSET_POST('zip')) REQUEST_SET_POST('zip' , ''); if (!REQUEST_ISSET_POST(('city'))) REQUEST_SET_POST('city' , ''); if (!REQUEST_ISSET_POST(('cntry'))) REQUEST_SET_POST('cntry' , ''); -if (!REQUEST_ISSET_POST(('country_code'))) REQUEST_SET_POST('country_code', "1"); +if (!REQUEST_ISSET_POST(('country_code'))) REQUEST_SET_POST('country_code', '1'); // Default refid is zero REQUEST_SET_POST('refid', 0); @@ -190,7 +190,7 @@ if ((IS_FORM_SENT()) && ((!$FAILED) || (IS_ADMIN()))) { $lockedUsers = GET_TOTAL_DATA('LOCKED', 'user_data', 'userid', 'status', true); // Generate hash which will be inserted into confirmation mail - $hash = generateHash(sha1($confirmedUsers.constant('ENCRYPT_SEPERATOR').$unconfirmedUsers.constant('ENCRYPT_SEPERATOR').$lockedUsers.constant('ENCRYPT_SEPERATOR').REQUEST_POST('month').'-'.REQUEST_POST('day').'-'.REQUEST_POST('year').constant('ENCRYPT_SEPERATOR').getenv('SERVER_NAME').constant('ENCRYPT_SEPERATOR').detectRemoteAddr().constant('ENCRYPT_SEPERATOR').detectUserAgent().'/'.constant('SITE_KEY').'/'.constant('DATE_KEY').'/'.constant('RAND_NUMBER'))); + $hash = generateHash(sha1($confirmedUsers.getConfig('ENCRYPT_SEPERATOR').$unconfirmedUsers.getConfig('ENCRYPT_SEPERATOR').$lockedUsers.getConfig('ENCRYPT_SEPERATOR').REQUEST_POST('month') . '-'.REQUEST_POST('day') . '-'.REQUEST_POST('year').getConfig('ENCRYPT_SEPERATOR').getenv('SERVER_NAME').getConfig('ENCRYPT_SEPERATOR').detectRemoteAddr().getConfig('ENCRYPT_SEPERATOR').detectUserAgent().'/'.getConfig('SITE_KEY') . '/'.getConfig('DATE_KEY') . '/'.constant('RAND_NUMBER'))); // Add design when extension sql_patches is v0.2.7 or greater // @TODO Rewrite these all to a single filter @@ -198,7 +198,7 @@ if ((IS_FORM_SENT()) && ((!$FAILED) || (IS_ADMIN()))) { if (GET_EXT_VERSION('sql_patches') >= '0.2.7') { // Okay, add design here $ADD1 = ", `curr_theme`"; - $ADD2 = ", '".getCurrentTheme()."'"; + $ADD2 = ', ''.getCurrentTheme().'''; } // END - if // Check if I shall disable sending mail to newly registered members out about active/begging rallye diff --git a/inc/modules/guest/what-stats.php b/inc/modules/guest/what-stats.php index 2f4212d110..2c217a3916 100644 --- a/inc/modules/guest/what-stats.php +++ b/inc/modules/guest/what-stats.php @@ -72,12 +72,12 @@ switch (getConfig('guest_stats')) { case 'MEMBERS': // Statistics about your members // Members yesterday / today online - $ymem = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE last_online >= ".constant('START_YDAY')." AND `last_online` < ".constant('START_TDAY')." AND `status`='CONFIRMED'", __FILE__, __LINE__)); - $tmem = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE last_online >= ".constant('START_TDAY')." AND `status`='CONFIRMED'", __FILE__, __LINE__)); + $ymem = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE last_online >= ".getConfig('START_YDAY')." AND `last_online` < ".getConfig('START_TDAY')." AND `status`='CONFIRMED'", __FILE__, __LINE__)); + $tmem = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE last_online >= ".getConfig('START_TDAY')." AND `status`='CONFIRMED'", __FILE__, __LINE__)); // Yesterday / today registered - $yreg = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE joined >= ".constant('START_YDAY')." AND joined < ".constant('START_TDAY'), __FILE__, __LINE__)); - $treg = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE joined >= ".constant('START_TDAY'), __FILE__, __LINE__)); + $yreg = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE joined >= ".getConfig('START_YDAY')." AND joined < ".getConfig('START_TDAY'), __FILE__, __LINE__)); + $treg = SQL_NUMROWS(SQL_QUERY("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE joined >= ".getConfig('START_TDAY'), __FILE__, __LINE__)); // Only males / females $male = GET_TOTAL_DATA('M', 'user_data', 'userid', 'gender', true, " AND `status`='CONFIRMED'"); diff --git a/inc/modules/guest/what-top10.php b/inc/modules/guest/what-top10.php index 60a4bd24d0..3acd968059 100644 --- a/inc/modules/guest/what-top10.php +++ b/inc/modules/guest/what-top10.php @@ -79,7 +79,7 @@ while ($content = SQL_FETCHARRAY($result)) { 'nick' => $content['nickname'], 'logins' => $content['total_logins'], 'points' => translateComma(GET_TOTAL_DATA($content['userid'], "user_points", "points")), - 'last' => generateDateTime($content['last_online'], "3"), + 'last' => generateDateTime($content['last_online'], '3'), ); // Load row template @@ -149,7 +149,7 @@ while ($content = SQL_FETCHARRAY($result)) { 'uid' => $content['userid'], 'nick' => $content['nickname'], 'points' => translateComma($content['points']), - 'last' => generateDateTime($content['last_online'], "3") + 'last' => generateDateTime($content['last_online'], '3') ); // Load row template @@ -220,7 +220,7 @@ while ($content = SQL_FETCHARRAY($result)) { 'refs' => $content['refs'], 'nick' => $content['nickname'], 'points' => translateComma(GET_TOTAL_DATA($content['userid'], "user_points", "points")), - 'last' => generateDateTime($content['last_online'], "3") + 'last' => generateDateTime($content['last_online'], '3') ); // Load row template diff --git a/inc/modules/guest/what-wernis_portal.php b/inc/modules/guest/what-wernis_portal.php index bf3491770c..96444b1780 100644 --- a/inc/modules/guest/what-wernis_portal.php +++ b/inc/modules/guest/what-wernis_portal.php @@ -55,7 +55,7 @@ OUTPUT_HTML("
      "); $rdf = new fase4_rdf(); $rdf->use_dynamic_display(false); $rdf->set_CacheDir(constant('PATH')."inc/cache/"); -$rdf->set_salt(md5(constant('SITE_KEY'))); +$rdf->set_salt(md5(getConfig('SITE_KEY'))); $rdf->set_max_item(10); $rdf->set_Options( array( diff --git a/inc/modules/login.php b/inc/modules/login.php index eb333e70ce..1c796983da 100644 --- a/inc/modules/login.php +++ b/inc/modules/login.php @@ -42,7 +42,7 @@ if (!defined('__SECURITY')) { require($INC); } elseif (!IS_MEMBER()) { $URL = 'modules.php?module=index'; - if ($check == 'mem_only') $URL .= '&msg='.getCode('MODULE_MEM_ONLY').'&mod='.$GLOBALS['module']; + if ($check == 'mem_only') $URL .= '&msg='.getCode('MODULE_MEM_ONLY') . '&mod='.$GLOBALS['module']; redirectToUrl($URL); } diff --git a/inc/modules/member/what-beg2.php b/inc/modules/member/what-beg2.php index cee62bc19a..217b63ed43 100644 --- a/inc/modules/member/what-beg2.php +++ b/inc/modules/member/what-beg2.php @@ -76,7 +76,7 @@ if (SQL_NUMROWS($result) > 0) { 'cnt' => $cnt, 'uid' => bigintval($content['userid']), 'points' => translateComma($content['beg']), - 'last' => generateDateTime($content['last_online'], "2"), + 'last' => generateDateTime($content['last_online'], '2'), ); // Load row template diff --git a/inc/modules/member/what-bonus.php b/inc/modules/member/what-bonus.php index d44f961776..059b028234 100644 --- a/inc/modules/member/what-bonus.php +++ b/inc/modules/member/what-bonus.php @@ -92,7 +92,7 @@ if (SQL_NUMROWS($result) > 0) { $content['cnt'] = $cnt; $content['uid'] = bigintval($content['uid']); $content['points'] = translateComma($content['points']); - $content['last'] = generateDateTime($content['last'], "2"); + $content['last'] = generateDateTime($content['last'], '2'); // Load row template $OUT .= LOAD_TEMPLATE("member_bonus_row", true, $content); diff --git a/inc/modules/member/what-categories.php b/inc/modules/member/what-categories.php index 93da79f9ab..9f2f814446 100644 --- a/inc/modules/member/what-categories.php +++ b/inc/modules/member/what-categories.php @@ -113,21 +113,21 @@ if ($cats > 0) { $OUT = ''; $SW = 2; while ($content = SQL_FETCHARRAY($result)) { // Default he has not joined - $content['jn'] = ' chkecked="checked"'; + $content['jn'] = ' checked="checked"'; $content['jy'] = ''; // When we found an entry don't read it, just change the jx elements if (REQUEST_ISSET_POST(('cat'))) { // Form sent? if (REQUEST_POST('cat', $content['id']) =='Y') { - $content['jy'] = ' chkecked="checked"'; + $content['jy'] = ' checked="checked"'; $content['jn'] = ''; } } else { // Check if he has an entry if (GET_TOTAL_DATA($UID, "user_cats", "id", 'userid', true, sprintf(" AND cat_id=%s", bigintval($content['id']))) == 1) { $content['jn'] = ''; - $content['jy'] = ' chkecked="checked"'; + $content['jy'] = ' checked="checked"'; } } diff --git a/inc/modules/member/what-holiday.php b/inc/modules/member/what-holiday.php index 7a1fa8642a..30863ddd6e 100644 --- a/inc/modules/member/what-holiday.php +++ b/inc/modules/member/what-holiday.php @@ -151,8 +151,8 @@ WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__); SQL_FREERESULT($result); // Prepare it for the template - define('__HOLIDAY_START', generateDateTime($start, "3")); - define('__HOLIDAY_END' , generateDateTime($end , "3")); + define('__HOLIDAY_START', generateDateTime($start, '3')); + define('__HOLIDAY_END' , generateDateTime($end , '3')); // Deactivate it now SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` diff --git a/inc/modules/member/what-html_mail.php b/inc/modules/member/what-html_mail.php index 90a6f7aadd..7baa959b92 100644 --- a/inc/modules/member/what-html_mail.php +++ b/inc/modules/member/what-html_mail.php @@ -64,10 +64,10 @@ if (IS_FORM_SENT()) { SQL_FREERESULT($result); if ($mode == 'Y') { - define('HTML_Y', ' chkecked="checked"'); + define('HTML_Y', ' checked="checked"'); define('HTML_N', ''); } else { - define('HTML_N', ' chkecked="checked"'); + define('HTML_N', ' checked="checked"'); define('HTML_Y', ''); } LOAD_TEMPLATE("member_html_mail_settings"); diff --git a/inc/modules/member/what-newsletter.php b/inc/modules/member/what-newsletter.php index 5cac3962b5..3294b49517 100644 --- a/inc/modules/member/what-newsletter.php +++ b/inc/modules/member/what-newsletter.php @@ -98,7 +98,7 @@ VALUES ('0','NEW','NL_UNSUBSCRIBE','{--ADMIN_NL_SUBJECT--}','".$admin_msg."', UN case 'N': // Does not receive the newsletter define('__STATUS_VALUE', getMessage('NL_MEMBER_OFF')); - define('__UNTIL_VALUE' , generateDateTime($until, "2")); + define('__UNTIL_VALUE' , generateDateTime($until, '2')); define('NL_SUBMIT' , getMessage('NL_MEMBER_SUBMIT_ON')); break; } diff --git a/inc/modules/member/what-order.php b/inc/modules/member/what-order.php index 0f1f3f6169..78916d846e 100644 --- a/inc/modules/member/what-order.php +++ b/inc/modules/member/what-order.php @@ -488,7 +488,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__); // Load timestamp from last order list($LORDER) = SQL_FETCHROW($result); - $LORDER = generateDateTime($LORDER, "1"); + $LORDER = generateDateTime($LORDER, '1'); // Free memory SQL_FREERESULT($result); diff --git a/inc/modules/member/what-payout.php b/inc/modules/member/what-payout.php index 4eb6016eda..3717af5a04 100644 --- a/inc/modules/member/what-payout.php +++ b/inc/modules/member/what-payout.php @@ -135,7 +135,7 @@ ORDER BY p.payout_timestamp DESC", 'acc' => $content['target_account'], 'points' => translateComma($content['payout_total'])." ".COMPILE_CODE($content['type']), 'bank' => $content['target_bank'], - 'stamp' => generateDateTime($content['payout_timestamp'], "2"), + 'stamp' => generateDateTime($content['payout_timestamp'], '2'), 'status' => $content['status'] ); diff --git a/inc/modules/member/what-primera.php b/inc/modules/member/what-primera.php index eb8b813615..078af8325e 100644 --- a/inc/modules/member/what-primera.php +++ b/inc/modules/member/what-primera.php @@ -94,7 +94,7 @@ if (!REQUEST_ISSET_GET(('mode'))) { while ($data = SQL_FETCHARRAY($result)) { // Prepare data for output $rowContent = array( - 'stamp' => generateDateTime($data['primera_timestamp'], "2"), + 'stamp' => generateDateTime($data['primera_timestamp'], '2'), 'points' => translateComma($data['primera_amount']), 'acc' => SQL_ESCAPE($data['primera_account']), 'status' => PRIMERA_TRANSFER_STATUS($data['primera_type']), diff --git a/inc/modules/member/what-rallyes.php b/inc/modules/member/what-rallyes.php index dbc3bce2b4..39f7f0ea03 100644 --- a/inc/modules/member/what-rallyes.php +++ b/inc/modules/member/what-rallyes.php @@ -97,8 +97,8 @@ if (SQL_NUMROWS($result) == 1) { define('__RALLYE_MAX_PRICES', RALLYE_DETERMINE_MIN_PRICES($min_prices)); // Set start and end time - define('__RALLYE_START', generateDateTime($start, "1")); - define('__RALLYE_END' , generateDateTime($end , "1")); + define('__RALLYE_START', generateDateTime($start, '1')); + define('__RALLYE_END' , generateDateTime($end , '1')); if ($expired === true) { define('__RALLYE_PRICES', RALLYE_LIST_WINNERS($id)); diff --git a/inc/modules/member/what-stats.php b/inc/modules/member/what-stats.php index 38d199573b..c8ff9de929 100644 --- a/inc/modules/member/what-stats.php +++ b/inc/modules/member/what-stats.php @@ -73,7 +73,7 @@ if (SQL_NUMROWS($result) > 0) { 'pay' => getPaymentTitlePrice($data['payment_id']), 'subj' => COMPILE_CODE($data['subject']), 'url' => DEREFERER($data['url']), - 'stamp' => generateDateTime($data['timestamp'], "2"), + 'stamp' => generateDateTime($data['timestamp'], '2'), 'recs' => $data['target_send'], 'type' => translatePoolType($data['data_type']), 'zip' => $data['zip'] @@ -115,9 +115,9 @@ if (SQL_NUMROWS($result) > 0) { 'pay' => getPaymentTitlePrice($data[2]), 'subj' => COMPILE_CODE($data[3]), 'url' => DEREFERER($data[4]), - 'stamp' => generateDateTime($data[5], "2"), + 'stamp' => generateDateTime($data[5], '2'), 'recs' => $data[6], - 'sent' => generateDateTime($data[7], "2"), + 'sent' => generateDateTime($data[7], '2'), 'clix' => $data[8], 'perc' => COMPILE_CODE($data[8] / $data[6] * 100)."%", ); diff --git a/inc/modules/member/what-support.php b/inc/modules/member/what-support.php index 747ea4078d..ab4a5b950f 100644 --- a/inc/modules/member/what-support.php +++ b/inc/modules/member/what-support.php @@ -88,7 +88,7 @@ if ((!IS_FORM_SENT()) || (!REQUEST_ISSET_POST(('qsummary')))) { // Drop a message in the admin's area SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (userid, assigned_admin, status, task_type, subject, text, task_created) VALUES ('%s','0','NEW','SUPPORT_MEMBER','%s','%s', UNIX_TIMESTAMP())", - array(getUserId(), $subj_a, REQUEST_POST('qsummary').':'.array('text' => REQUEST_POST('qdetails'))), __FILE__, __LINE__); + array(getUserId(), $subj_a, REQUEST_POST('qsummary') . ':'.array('text' => REQUEST_POST('qdetails'))), __FILE__, __LINE__); // Form sent LOAD_TEMPLATE("member_support_contcted"); diff --git a/inc/modules/member/what-surfbar_list.php b/inc/modules/member/what-surfbar_list.php index b2494b9b00..6de11b2e39 100644 --- a/inc/modules/member/what-surfbar_list.php +++ b/inc/modules/member/what-surfbar_list.php @@ -77,8 +77,8 @@ if ((IS_FORM_SENT()) && (REQUEST_ISSET_POST(('action'))) && (REQUEST_ISSET_POST( // Include link to stats $content['views_total'] = "[".translateComma($content['views_total'])."]"; } // END - if - $content['registered'] = generateDateTime($content['registered'], "2"); - $content['last_locked'] = generateDateTime($content['last_locked'], "2"); + $content['registered'] = generateDateTime($content['registered'], '2'); + $content['last_locked'] = generateDateTime($content['last_locked'], '2'); $content['actions'] = SURFBAR_MEMBER_ACTIONS($content['id'], $content['status']); $content['status'] = surfbarTranslateUserStatus($content['status']); if (empty($content['lock_reason'])) { diff --git a/inc/modules/member/what-transfer.php b/inc/modules/member/what-transfer.php index 923ef52a4e..aa017d8a3a 100644 --- a/inc/modules/member/what-transfer.php +++ b/inc/modules/member/what-transfer.php @@ -335,7 +335,7 @@ case "list_out": // List only outgoing transactions $content = array( 'sw' => $SW, 'tid' => $id, - 'stamp' => generateDateTime($stamp, "3"), + 'stamp' => generateDateTime($stamp, '3'), 'uid' => $uid, 'reason' => $reason, 'points' => translateComma($points) @@ -425,7 +425,7 @@ array(getUserId(), getConfig('transfer_max')), __FILE__, __LINE__); // Prepare content for template $content['sw'] = $SW; - $content['time'] = generateDateTime($content['time_trans'], "3"); + $content['time'] = generateDateTime($content['time_trans'], '3'); $content['points'] = translateComma($content['points']); // Load row template @@ -517,14 +517,14 @@ case "": // Overview page switch ($opt_in) { case 'Y': - define('__TRANSFER_ALLOW_Y', ' chkecked="checked"'); + define('__TRANSFER_ALLOW_Y', ' checked="checked"'); define('__TRANSFER_ALLOW_N', ''); define('__TRANSFER_NEW_LINK', "{--TRANSFER_NOW_LINK--}"); break; case 'N': define('__TRANSFER_ALLOW_Y', ''); - define('__TRANSFER_ALLOW_N', ' chkecked="checked"'); + define('__TRANSFER_ALLOW_N', ' checked="checked"'); define('__TRANSFER_NEW_LINK', getMessage('TRANSFER_PLEASE_ALLOW_OPT_IN')); break; } @@ -542,7 +542,7 @@ LIMIT 1", array(getConfig('transfer_timeout'), getUserId()), __FILE__, __LINE__) // Load newest transaction list($newest) = SQL_FETCHROW($result); SQL_FREERESULT($result); - define('__TRANSFER_SETTINGS_CONTENT', sprintf(getMessage('TRANSFER_LATEST_IS'), generateDateTime($newest, "3"))); + define('__TRANSFER_SETTINGS_CONTENT', sprintf(getMessage('TRANSFER_LATEST_IS'), generateDateTime($newest, '3'))); } // Load template diff --git a/inc/modules/member/what-wernis.php b/inc/modules/member/what-wernis.php index c7fa6d1532..9e5768ee17 100644 --- a/inc/modules/member/what-wernis.php +++ b/inc/modules/member/what-wernis.php @@ -94,7 +94,7 @@ if ((!REQUEST_ISSET_GET(('mode'))) || (REQUEST_GET('mode') == "choose")) { while ($data = SQL_FETCHARRAY($result)) { // Prepare data for output $rowContent = array( - 'stamp' => generateDateTime($data['wernis_timestamp'], "2"), + 'stamp' => generateDateTime($data['wernis_timestamp'], '2'), 'points' => translateComma($data['wernis_amount']), 'acc' => bigintval($data['wernis_account']), 'status' => WERNIS_TRANSFER_STATUS($data['wernis_type']), diff --git a/inc/modules/sponsor/settings.php b/inc/modules/sponsor/settings.php index bf986e0d7b..96ce1e5b2e 100644 --- a/inc/modules/sponsor/settings.php +++ b/inc/modules/sponsor/settings.php @@ -95,13 +95,13 @@ if (SQL_NUMROWS($result) == 1) { // Make yes/no selection switch ($content['receive_warnings']) { case 'Y': - define('__YES', ' chkecked="checked"'); + define('__YES', ' checked="checked"'); define('__NO', ''); break; case 'N': define('__YES', ''); - define('__NO', ' chkecked="checked"'); + define('__NO', ' checked="checked"'); break; } diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index 6e257ae804..8693a51c6b 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -45,6 +45,9 @@ if (!defined('__SECURITY')) { // Non-database functions require('inc/functions.php'); +// Wrapper functions +require('inc/wrapper-functions.php'); + // Load more function libraries or includes foreach (array('request-functions', 'session-functions', 'config-functions', 'code-functions', 'inc-functions', 'filters', 'mysql-manager', 'extensions', 'db/lib', 'handler', 'hooks') as $lib) { // Load special functions @@ -54,28 +57,28 @@ foreach (array('request-functions', 'session-functions', 'config-functions', 'co // Set error handler set_error_handler('__errorHandler'); +// Load configuration file(s) here +loadIncludeOnce('inc/load_config.php'); + +// Set important header_sent +$GLOBALS['header_sent'] = 0; + // Check if the user setups his MySQL stuff... -if ((empty($MySQL['login'])) && (!isInstalling()) && (!REQUEST_ISSET_GET('installing')) && (isInstalled())) { +if ((empty($GLOBALS['mysql']['login'])) && (!isInstalling()) && (!REQUEST_ISSET_GET('installing')) && (isInstalled())) { // No login entered and outside installation mode - OUTPUT_HTML("{--LANG_WARNING--}: "); + OUTPUT_HTML('{--LANG_WARNING--}: '); if (isInstalled()) { // You have changed my configuration file! - app_die(__FILE__, __LINE__, "{--DIE_CONFIG_CHANGED_YOU--}"); + app_die(__FILE__, __LINE__, '{--DIE_CONFIG_CHANGED_YOU--}'); } else { // Please run the installation script (maybe again) - app_die(__FILE__, __LINE__, "{--DIE_RUN_INSTALL_MYSQL--}"); + app_die(__FILE__, __LINE__, '{--DIE_RUN_INSTALL_MYSQL--}'); } -} elseif ((!isInstalling()) && (empty($MySQL['password'])) && (isBooleanConstantAndTrue('warn_no_pass'))) { +} elseif ((!isInstalling()) && (empty($GLOBALS['mysql']['password'])) && (getConfig('WARN_NO_PASS') == 'Y')) { // No database password entered!!! - OUTPUT_HTML("
      {--LANG_WARNING--}:
      {--WARN_NULL_PASSWORD--}"); + OUTPUT_HTML('
      {--LANG_WARNING--}:
      {--WARN_NULL_PASSWORD--}'); } -// Set dummy config array -initConfig(); - -// Set important header_sent -$GLOBALS['header_sent'] = 0; - // Init fatal messages initFatalMessages(); @@ -88,19 +91,19 @@ if ((!isInstalling()) && (isInstalled())) { // CSS array EXT_INIT_CSS_FILES(); - if ((!empty($MySQL['host'])) && (!empty($MySQL['login'])) && (!empty($MySQL['password'])) && (!empty($MySQL['dbase']))) { + if ((!empty($GLOBALS['mysql']['host'])) && (!empty($GLOBALS['mysql']['login'])) && (!empty($GLOBALS['mysql']['password'])) && (!empty($GLOBALS['mysql']['dbase']))) { // Connect to DB - SQL_CONNECT($MySQL['host'], $MySQL['login'], $MySQL['password'], __FILE__, __LINE__); + SQL_CONNECT($GLOBALS['mysql']['host'], $GLOBALS['mysql']['login'], $GLOBALS['mysql']['password'], __FILE__, __LINE__); // Is the link valid? if (SQL_IS_LINK_UP()) { // Is it a valid resource? - if (SQL_SELECT_DB($MySQL['dbase'], __FILE__, __LINE__) === true) { + if (SQL_SELECT_DB($GLOBALS['mysql']['dbase'], __FILE__, __LINE__) === true) { // This is required for extension 'optimize' to work - define('__DB_NAME', $MySQL['dbase']); + define('__DB_NAME', $GLOBALS['mysql']['dbase']); // Remove MySQL array from namespace - unset($MySQL); + unset($GLOBALS['mysql']); // Load configuration stuff loadConfiguration(); @@ -115,7 +118,7 @@ if ((!isInstalling()) && (isInstalled())) { loadIncludeOnce('inc/versions.php'); // Loading patching system is required here... - loadIncludeOnce('inc/patch-system.php'); // Initialize patch system + loadIncludeOnce('inc/patch-system.php'); // Run daily reset loadIncludeOnce('inc/check-reset.php'); diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index be375eea69..a8532d6997 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -92,7 +92,7 @@ function getModuleDescription ($mode, $wht, $column = 'what') { } // END - if // Default is not found - $ret = "??? (".$wht.")"; + $ret = "??? (".$wht.')'; // Look for title $result = SQL_QUERY_ESC("SELECT title FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE %s='%s' LIMIT 1", @@ -237,7 +237,7 @@ function checkModulePermissions ($mod) { $ret = checkModulePermissions($mod_chk); } else { // Module not found we don't add it to the database - $ret = "404"; + $ret = '404'; } } elseif (!$found) { // Problem with module detected @@ -328,7 +328,7 @@ function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) { $prefix .= " -> "; // We need to remove .php and the end - if (substr($search, -4, 4) == ".php") { + if (substr($search, -4, 4) == '.php') { // Remove the .php $search = substr($search, 0, -4); } // END - i @@ -441,7 +441,7 @@ function ADD_MENU ($mode, $act, $wht) { } // Navigation link - $OUT .= ""; + $OUT .= ""; } else { $OUT .= ""; } @@ -664,7 +664,7 @@ function addMaxReceiveList ($mode, $default = '', $return = false) { $OUT .= " - {!__BIRTHDAY_HEADER!} + + $content[header] + - {!__MSG!} + + $content[msg] + - {!__BIRTHDAY_FOOTER!} + + $content[footer] + diff --git a/templates/de/html/birthday/birthday_msg.tpl b/templates/de/html/birthday/birthday_msg.tpl index d06a4ae596..17a05701cc 100644 --- a/templates/de/html/birthday/birthday_msg.tpl +++ b/templates/de/html/birthday/birthday_msg.tpl @@ -1,8 +1,8 @@ -
      Herzlichen Glückwunsch zum Geburtstag!

      +
      Herzlichen Glückwunsch zum Geburtstag!


      -Hallo {!__GENDER!} {!__SNAME!} {!__FNAME!}!
      +Hallo $content[gender] $content[surname] $content[family]!

      Wir das Team von {!MAIN_TITLE!} wüschen Ihnen alles Gute und Gesundheit zum Geburtstag. Als kleines Geschenk von uns haben wir -Ihnen soeben {!__GIFT!} {!POINTS!} Ihrem Account +Ihnen soeben $content[points] {!POINTS!} Ihrem Account gutgeschrieben! diff --git a/templates/de/html/copyright.tpl b/templates/de/html/copyright.tpl index d1a91d7c0f..eb0cef1c5d 100644 --- a/templates/de/html/copyright.tpl +++ b/templates/de/html/copyright.tpl @@ -1,11 +1,12 @@