From 3299d3eba008bfd2450d0f19d072126f98c78e1e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 27 Aug 2008 21:59:32 +0000 Subject: [PATCH] * Dummy extension "yoomedia" added for Yoo! Media's API (Interface 2.0 supported) * Generic proxy support with BASE64 encoded auth data added * Configuration array now build with one line in extensions * Session management now always loads before theme manager * Setting of theme now works again * Misc minor fixes --- .gitattributes | 4 + inc/extensions/ext-active.php | 2 +- inc/extensions/ext-autopurge.php | 17 +-- inc/extensions/ext-beg.php | 18 +-- inc/extensions/ext-birthday.php | 4 +- inc/extensions/ext-bonus.php | 26 +--- inc/extensions/ext-cache.php | 15 +-- inc/extensions/ext-doubler.php | 20 +-- inc/extensions/ext-holiday.php | 5 +- inc/extensions/ext-maintenance.php | 2 +- inc/extensions/ext-mediadata.php | 3 +- inc/extensions/ext-newsletter.php | 3 +- inc/extensions/ext-order.php | 6 +- inc/extensions/ext-register.php | 3 +- inc/extensions/ext-rewrite.php | 2 +- inc/extensions/ext-sponsor.php | 2 +- inc/extensions/ext-sql_patches.php | 58 +++------ inc/extensions/ext-top10.php | 2 +- inc/extensions/ext-transfer.php | 13 +- inc/extensions/ext-user.php | 3 +- inc/extensions/ext-yoomedia.php | 98 ++++++++++++++ inc/functions.php | 121 ++++++++++++++---- inc/header.php | 8 +- inc/language/de.php | 6 + inc/modules/admin/admin-inc.php | 18 +++ inc/modules/admin/what-config_proxy.php | 66 ++++++++++ inc/modules/admin/what-config_title.php | 4 +- inc/modules/admin/what-theme_edit.php | 36 +++--- inc/modules/chk_login.php | 2 +- inc/modules/guest/what-confirm.php | 4 +- inc/modules/member/what-themes.php | 2 +- inc/mysql-connect.php | 15 +-- inc/theme-manager.php | 13 +- index.php | 2 +- .../de/html/admin/admin_config_proxy.tpl | 51 ++++++++ templates/de/html/ext/ext_yoomedia.tpl | 1 + 36 files changed, 415 insertions(+), 240 deletions(-) create mode 100644 inc/extensions/ext-yoomedia.php create mode 100644 inc/modules/admin/what-config_proxy.php create mode 100644 templates/de/html/admin/admin_config_proxy.tpl create mode 100644 templates/de/html/ext/ext_yoomedia.tpl diff --git a/.gitattributes b/.gitattributes index 5d3e807deb..918344fdb2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -127,6 +127,7 @@ inc/extensions/ext-top10.php -text inc/extensions/ext-transfer.php -text inc/extensions/ext-user.php -text inc/extensions/ext-wernis.php -text +inc/extensions/ext-yoomedia.php -text inc/fatal_errors.php -text inc/footer.php -text inc/functions.php -text @@ -275,6 +276,7 @@ inc/modules/admin/what-config_order.php -text inc/modules/admin/what-config_other.php -text inc/modules/admin/what-config_payouts.php -text inc/modules/admin/what-config_points.php -text +inc/modules/admin/what-config_proxy.php -text inc/modules/admin/what-config_rallye_prices.php -text inc/modules/admin/what-config_refid.php -text inc/modules/admin/what-config_reg.php -text @@ -763,6 +765,7 @@ templates/de/html/admin/admin_config_payouts_edit_row.tpl -text templates/de/html/admin/admin_config_payouts_row.tpl -text templates/de/html/admin/admin_config_point_settings.tpl -text templates/de/html/admin/admin_config_points.tpl -text +templates/de/html/admin/admin_config_proxy.tpl -text templates/de/html/admin/admin_config_rallye_del.tpl -text templates/de/html/admin/admin_config_rallye_del_row.tpl -text templates/de/html/admin/admin_config_rallye_edit.tpl -text @@ -1074,6 +1077,7 @@ templates/de/html/ext/ext_top10.tpl -text templates/de/html/ext/ext_transfer.tpl -text templates/de/html/ext/ext_user.tpl -text templates/de/html/ext/ext_wernis.tpl -text +templates/de/html/ext/ext_yoomedia.tpl -text templates/de/html/fatal_footer.tpl -text templates/de/html/fatal_header.tpl -text templates/de/html/guest/.htaccess -text diff --git a/inc/extensions/ext-active.php b/inc/extensions/ext-active.php index 0a385f601d..65da897408 100644 --- a/inc/extensions/ext-active.php +++ b/inc/extensions/ext-active.php @@ -123,7 +123,7 @@ case "update": // Update an extension default: // Do stuff when extension is loaded $dummy = LOAD_CONFIG(); - $_CONFIG['active_limit'] = $dummy['active_limit']; // Only display X most active users for today + $_CONFIG = array_merge($_CONFIG, $dummy); unset($dummy); break; } diff --git a/inc/extensions/ext-autopurge.php b/inc/extensions/ext-autopurge.php index 2412b2acab..136d94b2f9 100644 --- a/inc/extensions/ext-autopurge.php +++ b/inc/extensions/ext-autopurge.php @@ -258,22 +258,7 @@ case "update": // Update an extension default: // Do stuff when extension is loaded $dummy = LOAD_CONFIG(); - // Transfer all to the $_CONFIG array... - $_CONFIG['ap_inactive'] = $dummy['autopurge_inactive']; // Autopurge inactive accounts (yes/no) - $_CONFIG['ap_unconfirmed'] = $dummy['autopurge_unconfirmed']; // Autopurge unconfirmed accounts (yes/no) - $_CONFIG['ap_tasks'] = $dummy['autopurge_tasks']; // Autopurge out-dated tasks (yes/no) - $_CONFIG['ap_in_mail'] = $dummy['ap_in_notify']; // Send email to admin when purging inactive accounts (yes/no) - $_CONFIG['ap_un_mail'] = $dummy['ap_un_notify']; // Send email to admin when purging unconfirmed accounts (yes/no) - $_CONFIG['ap_tasks_mail'] = $dummy['ap_tasks_notify']; // Send email to admin when purging out-dated tasks (yes/no) - $_CONFIG['ap_in_since'] = $dummy['ap_inactive_since']; // Timeout for confirmed accounts when they become inactive (seconds) - $_CONFIG['ap_in_time'] = $dummy['ap_inactive_time']; // Timeout for inactive accounts when they are automatically deleted (seconds) - $_CONFIG['ap_un_time'] = $dummy['ap_unconfirmed_time']; // Timeout for unconfirmed accounts when they are automatically deleted (seconds) - $_CONFIG['ap_tasks_time'] = $dummy['ap_tasks_time']; // Timeout for out-dated tasks - $_CONFIG['ap_del_mails'] = $dummy['ap_del_mails']; // Autopurge mails from deleted users? - $_CONFIG['ap_dm_notify'] = $dummy['ap_dm_notify']; // Send email to admin when purging mails from deleted users (yes/no) - $_CONFIG['ap_dm_timeout'] = $dummy['ap_dm_timeout']; // Timeout for mails from deleted users - - // Save some RAM... + $_CONFIG = array_merge($_CONFIG, $dummy); unset($dummy); // Do we have a daily-reset-run? diff --git a/inc/extensions/ext-beg.php b/inc/extensions/ext-beg.php index 9f78549591..eefd94b2c0 100644 --- a/inc/extensions/ext-beg.php +++ b/inc/extensions/ext-beg.php @@ -260,23 +260,7 @@ case "update": // Update an extension default: // Do stuff when extension is loaded $dummy = LOAD_CONFIG(); - $_CONFIG['beg_timeout'] = $dummy['beg_timeout']; // Global timeout - $_CONFIG['beg_uid_timeout'] = $dummy['beg_uid_timeout']; // Timeout for one userid - $_CONFIG['beg_ip_timeout'] = $dummy['beg_ip_timeout']; // Timeout for one IP number - $_CONFIG['beg_points'] = $dummy['beg_points']; // Minimum beggable points - $_CONFIG['beg_points_max'] = $dummy['beg_points_max']; // Maximum beggable points - $_CONFIG['beg_uid'] = $dummy['beg_uid']; // Account to subtract begged points from - $_CONFIG['beg_mode'] = $dummy['beg_mode']; // Payment mode: direct or over referral system? - $_CONFIG['beg_month'] = $dummy['beg_month']; // Current month - $_CONFIG['beg_ranks'] = $dummy['beg_ranks']; // Maximum member who will win - $_CONFIG['beg_active'] = $dummy['beg_active']; // Only active members can win? - $_CONFIG['beg_rallye'] = $dummy['beg_rallye']; // Is the begging rallye activated? - $_CONFIG['beg_ral_en_notify'] = $dummy['beg_ral_en_notify']; // Notify members on enabled rallye? - $_CONFIG['beg_ral_di_notify'] = $dummy['beg_ral_di_notify']; // Notify members on disabled rallye? - $_CONFIG['beg_notify_bonus'] = $dummy['beg_notify_bonus']; // When points are > 0 and bonus extension is installed, a bonus mail with this amount of points will be send instead of an enable-notification! - $_CONFIG['beg_new_mem_notify'] = $dummy['beg_new_mem_notify']; // Notify members on disabled rallye? - $_CONFIG['beg_notify_wait'] = $dummy['beg_notify_wait']; // Time to wait in seconds for bonus mails - $_CONFIG['beg_include_own'] = $dummy['beg_include_own']; // Include webmaster's own userid in rallye? + $_CONFIG = array_merge($_CONFIG, $dummy); unset($dummy); // Remove old entries diff --git a/inc/extensions/ext-birthday.php b/inc/extensions/ext-birthday.php index 418d0b33cf..52654f0c97 100644 --- a/inc/extensions/ext-birthday.php +++ b/inc/extensions/ext-birthday.php @@ -186,9 +186,7 @@ default: // Do stuff when extension is loaded $dummy = LOAD_CONFIG(); // Copy config to main array - $_CONFIG['birthday_points'] = $dummy['birthday_points']; - $_CONFIG['birthday_mode'] = $dummy['birthday_mode']; - $_CONFIG['birthday_active'] = $dummy['birthday_active']; + $_CONFIG = array_merge($_CONFIG, $dummy); // Save some RAM... unset($dummy); diff --git a/inc/extensions/ext-bonus.php b/inc/extensions/ext-bonus.php index 06e52585f0..a2a0271038 100644 --- a/inc/extensions/ext-bonus.php +++ b/inc/extensions/ext-bonus.php @@ -541,31 +541,7 @@ WHERE last_online < ".$mark." ORDER BY userid"; default: // Do stuff when extension is loaded $dummy = LOAD_CONFIG(); - $_CONFIG['login_bonus'] = $dummy['login_bonus']; // Bonus points for successfull logins - $_CONFIG['turbo_bonus'] = $dummy['turbo_bonus']; // Bonus points for the fastest clicker, No. 1 - $_CONFIG['bonus_rates'] = $dummy['turbo_rates']; // Points for clicker no. 2 to x - $_CONFIG['bonus_ranks'] = $dummy['bonus_ranks']; // Total ranks who can win - $_CONFIG['login_timeout'] = $dummy['login_timeout']; // Time in seconds between two logins - $_CONFIG['bonus_month'] = $dummy['last_bonus_month']; // Last month where click-bonus are "paid" - $_CONFIG['bonus_mode'] = $dummy['bonus_mode']; // Mode for adding points for login/click bonus - $_CONFIG['bonus_uid'] = $dummy['bonus_uid']; // Member account to take points from - $_CONFIG['bonus_lines'] = $dummy['bonus_lines']; // Number of lines to display in show_bonus.php - $_CONFIG['bonus_timeout'] = $dummy['bonus_timeout']; // Auto-Purge timeout for bonus lines in mxchange_bonus_turbo - $_CONFIG['bonus_order'] = $dummy['bonus_order']; // Bonus points for ordering mails - $_CONFIG['bonus_ref'] = $dummy['bonus_ref']; // Bonus points for "making" a referral - $_CONFIG['bonus_stats'] = $dummy['bonus_stats']; // Bonus points for 100% clickrate in mail stats - $_CONFIG['bonus_active'] = $dummy['bonus_active']; // De/activate bonus active rallye - $_CONFIG['bonus_order_yn'] = $dummy['bonus_order_yn']; // Include order bonus in analysis? - $_CONFIG['bonus_ref_yn'] = $dummy['bonus_ref_yn']; // Include referral bonus in analysis? - $_CONFIG['bonus_stats_yn'] = $dummy['bonus_stats_yn']; // Include statistics bonus in analysis? - $_CONFIG['bonus_login_yn'] = $dummy['bonus_login_yn']; // Include login bonus in analysis? - $_CONFIG['bonus_click_yn'] = $dummy['bonus_click_yn']; // Include "mailid" bonus in analysis? - $_CONFIG['bonus_en_notify'] = $dummy['bonus_en_notify']; // Notify members about enabled active rallye? - $_CONFIG['bonus_di_notify'] = $dummy['bonus_di_notify']; // Notify members about disabled active rallye? - $_CONFIG['bonus_new_mem_notify'] = $dummy['bonus_new_mem_notify']; // Notify members about disabled active rallye? - $_CONFIG['bonus_notify_points'] = $dummy['bonus_notify_points']; // Bonus points for the enable-notification mail? 0 = disable! - $_CONFIG['bonus_notify_wait'] = $dummy['bonus_notify_wait']; // Time to wait in seconds for bonus mails - $_CONFIG['bonus_include_own'] = $dummy['bonus_include_own']; // Include webmaster's own userid in active rallye? + $_CONFIG = array_merge($_CONFIG, $dummy); unset($dummy); if (defined('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1)) diff --git a/inc/extensions/ext-cache.php b/inc/extensions/ext-cache.php index ad0f624a9b..e76ac2bbf7 100644 --- a/inc/extensions/ext-cache.php +++ b/inc/extensions/ext-cache.php @@ -185,20 +185,7 @@ case "update": // Update an extension default: // Do stuff when extension is loaded $dummy = LOAD_CONFIG(); - - // Load config and destroy dummy array - $_CONFIG['cache_update'] = $dummy['cache_update']; // Last time the cache files are been re-created - $_CONFIG['cache_path'] = $dummy['cache_path']; // Relative path for the cache files to 'inc/' - $_CONFIG['cache_tested'] = $dummy['cache_tested']; // Says if cache path is tested or not - $_CONFIG['db_hits'] = $dummy['db_hits']; // Counted hits on the database (all!) - $_CONFIG['cache_hits'] = $dummy['cache_hits']; // Counted hits on the cache arrays in memory - $_CONFIG['cache_admins'] = $dummy['cache_admins']; // Is the table '_admins' cacheable? - $_CONFIG['cache_acls'] = $dummy['cache_acls']; // Is the table '_admins_acls' cacheable? - $_CONFIG['cache_exts'] = $dummy['cache_exts']; // Is the table '_extensions' cacheable? - $_CONFIG['cache_config'] = $dummy['cache_config']; // Is the table '_config' cacheable? - $_CONFIG['cache_modreg'] = $dummy['cache_modreg']; // Is the table '_mod_reg' cacheable? - $_CONFIG['cache_refdepth'] = $dummy['cache_refdepth']; // Is the table '_refdepths' cacheable? - $_CONFIG['cache_refsys'] = $dummy['cache_refsys']; // Is the table '_refsystem' cacheable? + $_CONFIG = array_merge($_CONFIG, $dummy); unset($dummy); // Create instance on class diff --git a/inc/extensions/ext-doubler.php b/inc/extensions/ext-doubler.php index 1ba8512590..9026ca8f1a 100644 --- a/inc/extensions/ext-doubler.php +++ b/inc/extensions/ext-doubler.php @@ -237,25 +237,7 @@ case "update": // Update an extension default: // Do stuff when extension is loaded $dummy = LOAD_CONFIG(); - $_CONFIG['doubler_charge'] = $dummy['doubler_charge']; - $_CONFIG['doubler_jackpot'] = $dummy['doubler_jackpot']; - $_CONFIG['doubler_own'] = $dummy['doubler_own']; - $_CONFIG['doubler_uid'] = $dummy['doubler_uid']; - $_CONFIG['doubler_points'] = $dummy['doubler_points']; - $_CONFIG['doubler_used'] = $dummy['doubler_used']; - $_CONFIG['doubler_send_mode'] = $dummy['doubler_send_mode']; - $_CONFIG['doubler_timeout'] = $dummy['doubler_timeout']; - $_CONFIG['doubler_display_new'] = $dummy['doubler_display_new']; - $_CONFIG['doubler_display_pay'] = $dummy['doubler_display_pay']; - $_CONFIG['doubler_display_old'] = $dummy['doubler_display_old']; - $_CONFIG['doubler_ref'] = $dummy['doubler_ref']; - $_CONFIG['doubler_min'] = $dummy['doubler_min']; - $_CONFIG['doubler_max'] = $dummy['doubler_max']; - $_CONFIG['doubler_left'] = $dummy['doubler_left']; - $_CONFIG['doubler_counter'] = $dummy['doubler_counter']; - $_CONFIG['doubler_max_sent'] = $dummy['doubler_max_sent']; - $_CONFIG['doubler_group_sent'] = $dummy['doubler_group_sent']; - $_CONFIG['doubler_sent_all'] = $dummy['doubler_sent_all']; + $_CONFIG = array_merge($_CONFIG, $dummy); unset($dummy); if ((defined('__DAILY_RESET')) && ($_CONFIG['doubler_send_mode'] == "RESET")) diff --git a/inc/extensions/ext-holiday.php b/inc/extensions/ext-holiday.php index b26919897f..8e121a3e08 100644 --- a/inc/extensions/ext-holiday.php +++ b/inc/extensions/ext-holiday.php @@ -225,10 +225,7 @@ case "update": // Update an extension default: // Do stuff when extension is loaded $dummy = LOAD_CONFIG(); - // Copy data to config array - $_CONFIG['holiday_max'] = $dummy['holiday_max']; // Maximum days for holiday - $_CONFIG['holiday_lock'] = $dummy['holiday_lock']; // Lock deactivation in member area for X seconds - $_CONFIG['holiday_mode'] = $dummy['holiday_mode']; // Mode for activating holiday + $_CONFIG = array_merge($_CONFIG, $dummy); unset($dummy); // Do we have a daily-reset-run? diff --git a/inc/extensions/ext-maintenance.php b/inc/extensions/ext-maintenance.php index 32e7bba2e3..9fd371f7d3 100644 --- a/inc/extensions/ext-maintenance.php +++ b/inc/extensions/ext-maintenance.php @@ -111,7 +111,7 @@ case "update": // Update an extension default: // Do stuff when extension is loaded $dummy = LOAD_CONFIG(); - $_CONFIG['maintenance'] = $dummy['maintenance']; + $_CONFIG = array_merge($_CONFIG, $dummy); unset($dummy); break; } diff --git a/inc/extensions/ext-mediadata.php b/inc/extensions/ext-mediadata.php index b002b6cdca..fa8249d507 100644 --- a/inc/extensions/ext-mediadata.php +++ b/inc/extensions/ext-mediadata.php @@ -130,8 +130,7 @@ Bitte stellen Sie diesen derzeit manuell unter ".print_r($dummy, true).""); + $_CONFIG = array_merge($_CONFIG, $dummy); // Read key from secret file if ((empty($_CONFIG['file_hash'])) || (empty($_CONFIG['master_salt'])) || (empty($_CONFIG['pass_scramble']))) { @@ -600,10 +580,10 @@ default: // Do stuff when extension is loaded } else { // Set some lame ;-) default settings $_CONFIG['def_refid'] = 0; - $_CONFIG['title_decoration'] = 'N'; - $_CONFIG['title_mod_show'] = 'Y'; - $_CONFIG['title_middle'] = "-"; - //$_CONFIG['verbose_sql'] = 'N'; + $_CONFIG['enable_title_deco'] = 'N'; + $_CONFIG['title_mod_show'] = 'Y'; + $_CONFIG['title_middle'] = "-"; + //$_CONFIG['verbose_sql'] = 'N'; define('MT_WORD' , DEFAULT_MT_WORD ); define('MT_WORD2', DEFAULT_MT_WORD2); define('POINTS' , DEFAULT_POINTS); diff --git a/inc/extensions/ext-top10.php b/inc/extensions/ext-top10.php index 19ac12ced0..35c1590cbd 100644 --- a/inc/extensions/ext-top10.php +++ b/inc/extensions/ext-top10.php @@ -143,7 +143,7 @@ case "update": // Update an extension default: // Do stuff when extension is loaded $dummy = LOAD_CONFIG(); - $_CONFIG['top10_max'] = $dummy['top10_max']; + $_CONFIG = array_merge($_CONFIG, $dummy); unset($dummy); break; } diff --git a/inc/extensions/ext-transfer.php b/inc/extensions/ext-transfer.php index 612671f595..c99b7aa528 100644 --- a/inc/extensions/ext-transfer.php +++ b/inc/extensions/ext-transfer.php @@ -284,18 +284,7 @@ case "update": // Update an extension default: // Do stuff when extension is loaded $dummy = LOAD_CONFIG(); - // Maximum of listed transfers for out- and in-transfers - $_CONFIG['transfer_max'] = $dummy['transfer_max']; - // Age in seconds - $_CONFIG['transfer_age'] = $dummy['transfer_age']; - // Lock timeout for member settings - $_CONFIG['transfer_timeout'] = $dummy['transfer_timeout']; - // Balance after points transfer - $_CONFIG['transfer_balance'] = $dummy['transfer_balance']; - // Length of touring code - $_CONFIG['transfer_code'] = $dummy['transfer_code']; - // Length of touring code - $_CONFIG['ap_transfer'] = $dummy['ap_transfer']; + $_CONFIG = array_merge($_CONFIG, $dummy); unset($dummy); if ((defined('__DAILY_RESET')) && ($_CONFIG['ap_transfer'] == 'Y')) diff --git a/inc/extensions/ext-user.php b/inc/extensions/ext-user.php index b0eb28ec9c..f96acbf5a7 100644 --- a/inc/extensions/ext-user.php +++ b/inc/extensions/ext-user.php @@ -215,8 +215,7 @@ case "update": // Update an extension default: // Do stuff when extension is loaded $dummy = LOAD_CONFIG(); - $_CONFIG['user_limit'] = $dummy['user_limit']; - $_CONFIG['user_alpha'] = $dummy['user_alpha']; + $_CONFIG = array_merge($_CONFIG, $dummy); unset($dummy); break; } diff --git a/inc/extensions/ext-yoomedia.php b/inc/extensions/ext-yoomedia.php new file mode 100644 index 0000000000..b34984bea3 --- /dev/null +++ b/inc/extensions/ext-yoomedia.php @@ -0,0 +1,98 @@ + diff --git a/inc/functions.php b/inc/functions.php index f2806f6b64..7462021a9d 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -138,8 +138,16 @@ function OUTPUT_HTML($HTML, $NEW_LINE = true) { // Compile and run finished rendered HTML code while (strpos($OUTPUT, '{!') > 0) { - $eval = "\$OUTPUT = \"" . COMPILE_CODE(addslashes($OUTPUT)) . "\";"; - eval($eval); + // Prepare the content and eval() it... + $newContent = ""; + $eval = "\$newContent = \"" . COMPILE_CODE(addslashes($OUTPUT)) . "\";"; + @eval($eval); + + if (empty($newContent)) { + // Something went wrong! + die("Evaluation error:
".htmlentities($eval)."
"); + } + $OUTPUT = $newContent; } // Output code here, DO NOT REMOVE! ;-) @@ -1650,6 +1658,16 @@ function ADD_EMAIL_NAV($PAGES, $offset, $show_form, $colspan, $return=false) { // function MXCHANGE_OPEN ($script) { + global $_CONFIG; + // Default is not to use proxy + $useProxy = true; + + // Are proxy settins set? + if ((!empty($_CONFIG['proxy_host'])) && ($_CONFIG['proxy_port'] > 0)) { + // Then use it + $useProxy = true; + } + //* DEBUG */ print("SCRIPT=".$script."
\n"); // Compile the script name $script = COMPILE_CODE($script); @@ -1663,7 +1681,7 @@ function MXCHANGE_OPEN ($script) { $extract = explode("/", $url); $url = $extract[0]; // Done extracting the URL :) - } + } // END - if // Extract host name $host = str_replace("http://", "", $url); @@ -1684,17 +1702,62 @@ function MXCHANGE_OPEN ($script) { // Open connection //* DEBUG */ die("SCRIPT=".$script."
\n"); - $fp = @fsockopen($host, 80, $errno, $errdesc, 30); - if (!$fp) { - // Failed! - return array("", "", ""); + if ($useProxy) { + $fp = @fsockopen(COMPILE_CODE($_CONFIG['proxy_host']), $_CONFIG['proxy_port'], $errno, $errdesc, 30); + } else { + $fp = @fsockopen($host, 80, $errno, $errdesc, 30); } - // Generate request header - $request = "GET /".trim($script)." HTTP/1.0\r\n"; + // Is there a link? + if (!is_resource($fp)) { + // Failed! + return array("", "", ""); + } // END - if + + // Do we use proxy? + if ($useProxy) { + // Generate CONNECT request header + $request = "CONNECT ".$host.":80 HTTP/1.1\r\n"; + $request .= "Host: ".$host."\r\n"; + + // Use login data to proxy? (username at least!) + if (!empty($_CONFIG['proxy_username'])) { + // Add it as well + $encodedAuth = base64_encode(COMPILE_CODE($_CONFIG['proxy_username']).":".COMPILE_CODE($_CONFIG['proxy_password'])); + $request .= "Proxy-Authorization: Basic ".$encodedAuth."\r\n"; + } // END - if + + // Add last new-line + $request .= "\r\n"; + //* DEBUG: */ print("Request:
".$request."
"); + + // Write request + fputs($fp, $request); + + // Got response? + if (feof($fp)) { + // No response received + return array("", "", ""); + } // END - if + + // Read the first line + $resp = trim(fgets($fp, 10240)); + $respArray = explode(" ", $resp); + if ((strtolower($respArray[0]) !== "http/1.0") || ($respArray[1] != "200")) { + // Invalid response! + return array("", "", ""); + } // END - if + } // END - if + + // Generate GET request header + $request = "GET /".trim($script)." HTTP/1.1\r\n"; $request .= "Host: ".$host."\r\n"; $request .= "Referer: ".URL."/admin.php\r\n"; - $request .= "User-Agent: ".TITLE."/".FULL_VERSION."\r\n\r\n"; + $request .= "User-Agent: ".TITLE."/".FULL_VERSION."\r\n"; + $request .= "Content-Type: text/plain\r\n"; + $request .= "Cache-Control: no-cache\r\n"; + $request .= "Connection: Close\r\n\r\n"; + //* DEBUG: */ print("Request:
".$request."
"); // Initialize array $response = array(); @@ -1705,16 +1768,25 @@ function MXCHANGE_OPEN ($script) { // Read response while(!feof($fp)) { $response[] = trim(fgets($fp, 1024)); - } + } // END - while // Close socket fclose($fp); + //* DEBUG: */ print("Response:
".print_r($response, true)."
"); + + // Proxy agent found? + if ((substr(strtolower($response[0]), 0, 11) == "proxy-agent") && ($useProxy)) { + // Proxy header detected, so remove two lines + array_shift($response); + array_shift($response); + } // END - if + // Was the request successfull? - if ((!ereg("200 OK", $response[0])) && (empty($response[0]))) { + if ((!ereg("200 OK", $response[0])) || (empty($response[0]))) { // Not found / access forbidden $response = array("", "", ""); - } + } // END - if // Return response return $response; @@ -2082,6 +2154,7 @@ function DISPLAY_PARSING_TIME_FOOTER() { // Unset/set session variables function set_session ($var, $value) { global $CSS; + // Abort in CSS mode here if ($CSS == 1) return true; @@ -2099,6 +2172,9 @@ function set_session ($var, $value) { //* DEBUG: */ echo "SET:".$var."=".$value."
\n"; $_SESSION[$var] = $value; return session_register($var); + } elseif (!empty($value)) { + // Update session + $_SESSION[$var] = $value; } // Return always true if the session variable is already set. @@ -2121,8 +2197,6 @@ function isSessionVariableSet($var) { // Returns wether the value of the session variable or NULL if not set function get_session($var) { - if (!isset($_SESSION)) session_start(); - // Default is not found! ;-) $value = null; @@ -2137,21 +2211,20 @@ function get_session($var) { } // -////////////////////////////////////////////// -// // -// AUTOMATICALLY RE-GNERATED FUNCTIONS ONLY // -// // -////////////////////////////////////////////// +////////////////////////////////////////////////// +// // +// AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS // +// // +////////////////////////////////////////////////// // -if (!function_exists('html_entity_decode')) -{ +if (!function_exists('html_entity_decode')) { // Taken from documentation on www.php.net - function html_entity_decode($string) - { + function html_entity_decode($string) { $trans_tbl = get_html_translation_table(HTML_ENTITIES); $trans_tbl = array_flip($trans_tbl); return strtr($string, $trans_tbl); } } + // ?> diff --git a/inc/header.php b/inc/header.php index ce675dc08c..704ffd2cff 100644 --- a/inc/header.php +++ b/inc/header.php @@ -51,20 +51,20 @@ if (($header != "1") && ($header != "2")) { // Add title decorations? (left) if (!defined('__PAGE_TITLE')) { if ((count($_CONFIG) > 1) && (is_resource($link)) && (isset($db))) { - if (($_CONFIG['title_decoration'] == 'Y') && (trim(!empty($_CONFIG['title_left'])))) $TITLE .= trim($_CONFIG['title_left'])." "; + if (($_CONFIG['enable_title_deco'] == 'Y') && (trim(!empty($_CONFIG['title_left'])))) $TITLE .= trim($_CONFIG['title_left'])." "; $TITLE .= MAIN_TITLE; // Add title of module? (middle decoration will also be added!) - if (($_CONFIG['title_mod_show'] == 'Y') || ((empty($GLOBALS['what'])) && (empty($GLOBALS['action']))) || ($GLOBALS['module'] == "admin")) $TITLE .= " ".trim($_CONFIG['title_middle'])." ".ADD_MODULE_TITLE($GLOBALS['module']); + if (($_CONFIG['enable_mod_title'] == 'Y') || ((empty($GLOBALS['what'])) && (empty($GLOBALS['action']))) || ($GLOBALS['module'] == "admin")) $TITLE .= " ".trim($_CONFIG['title_middle'])." ".ADD_MODULE_TITLE($GLOBALS['module']); // Add title from what file $MODE = ""; if ($GLOBALS['module'] == "login") $MODE = "member"; elseif ($GLOBALS['module'] == "index") $MODE = "guest"; - if ((!empty($MODE)) && (isset($_CONFIG['title_what_show'])) && ($_CONFIG['title_what_show'] == 'Y')) $TITLE .= " ".trim($_CONFIG['title_middle'])." ".GET_MOD_DESCR($MODE, $GLOBALS['what']); + if ((!empty($MODE)) && (isset($_CONFIG['enable_what_title'])) && ($_CONFIG['enable_what_title'] == 'Y')) $TITLE .= " ".trim($_CONFIG['title_middle'])." ".GET_MOD_DESCR($MODE, $GLOBALS['what']); // Add title decorations? (right) - if (($_CONFIG['title_decoration'] == 'Y') && (!empty($_CONFIG['title_right']))) $TITLE .= " ".trim($_CONFIG['title_right']); + if (($_CONFIG['enable_title_deco'] == 'Y') && (!empty($_CONFIG['title_right']))) $TITLE .= " ".trim($_CONFIG['title_right']); // Remember title in constant for the template define('__PAGE_TITLE', html_entity_decode($TITLE)); diff --git a/inc/language/de.php b/inc/language/de.php index 860316e7bf..ad0650adb7 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -1111,6 +1111,12 @@ define('ADMIN_NO_POINTS_REPAYED', "Die Mailbuchung hatte keine {!POINTS!} zum zu define('ADMIN_POINTS_SHREDDED', "Es wurden %s {!POINTS!} geschrettert."); define('EXTENSION_WARNING_EXT_INACTIVE', "Die Erweiterung %s ist nicht aktiv. Dies kann zu Störungen führen.
\nBitte aktivieren Sie diese unter Verschiedenes->Erweiterungen."); define('EXTENSION_WARNING_USER_LIMIT', "Die Erweiterung user ist nicht aktiv. Die Anzahl User pro Seite wurde auf 100 gesetzt. Bitte aktivieren Sie diese unter Verschiedenes->Erweiterungen."); +define('ADMIN_PROXY_SETTINGS_INVALID', "Ihre Proxy-Einstellungen scheinen ungültig zu sein!"); +define('ADMIN_EDIT_PROXY_SETTINGS', "Proxy-Einstellungen ändern"); +define('ADMIN_CONFIG_PROXY_HOST', "Hostname oder IP-Nummer:"); +define('ADMIN_CONFIG_PROXY_PORT', "Port-Nummer (z.B. 8085):"); +define('ADMIN_CONFIG_PROXY_USERNAME', "Benuztername (falls vorhanden):"); +define('ADMIN_CONFIG_PROXY_PASSWORD', "Passwort (falls vorhanden):"); // ?> diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 684517c86d..2fc9b17210 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -837,5 +837,23 @@ function ADMIN_DELETE_ENTRIES_CONFIRM ($IDs, $table, $row, $columns = array(), $ } } } +// Checks proxy settins by fetching check-updates2.php from www.mxchange.org +function ADMIN_TEST_PROXY_SETTINGS ($settingsArray) { + global $_CONFIG; + // By default they are invalid + $valid = false; + + // Set temporary the new settings + $_CONFIG = array_merge($_CONFIG, $settingsArray); + + // Now get the test URL + $content = MXCHANGE_OPEN("check-updates2.php"); + + // Is the first line with "200 OK"? + $valid = ereg("200 OK", $content[0]); + + // Return result + return $valid; +} // ?> diff --git a/inc/modules/admin/what-config_proxy.php b/inc/modules/admin/what-config_proxy.php new file mode 100644 index 0000000000..75cd3f38e8 --- /dev/null +++ b/inc/modules/admin/what-config_proxy.php @@ -0,0 +1,66 @@ + $_CONFIG['proxy_host'], + 'proxy_port' => $_CONFIG['proxy_port'], + 'proxy_username' => $_CONFIG['proxy_username'], + 'proxy_password' => $_CONFIG['proxy_password'], + ); + + // Load template + LOAD_TEMPLATE("admin_config_proxy", false, $content); +} + +// +?> diff --git a/inc/modules/admin/what-config_title.php b/inc/modules/admin/what-config_title.php index 322be77bf3..85cf02ca94 100644 --- a/inc/modules/admin/what-config_title.php +++ b/inc/modules/admin/what-config_title.php @@ -51,8 +51,8 @@ if (isset($_POST['ok'])) define('__CFG_TITLE_LEFT' , $_CONFIG['title_left']); define('__CFG_TITLE_MIDDLE' , $_CONFIG['title_middle']); define('__CFG_TITLE_RIGHT' , $_CONFIG['title_right']); - define('__CFG_TITLE_DECOS' , ADD_SELECTION("yn", $_CONFIG['title_decoration'], "enable_title_deco")); - define('__CFG_TITLE_MOD_SHOW' , ADD_SELECTION("yn", $_CONFIG['title_mod_show'] , "enable_mod_title" )); + define('__CFG_TITLE_DECOS' , ADD_SELECTION("yn", $_CONFIG['enable_title_deco'], "enable_title_deco")); + define('__CFG_TITLE_MOD_SHOW' , ADD_SELECTION("yn", $_CONFIG['enable_mod_title'] , "enable_mod_title" )); define('__CFG_TITLE_WHAT_SHOW', ADD_SELECTION("yn", $_CONFIG['title_what_show'] , "enable_what_title")); // Load template diff --git a/inc/modules/admin/what-theme_edit.php b/inc/modules/admin/what-theme_edit.php index 15418d191c..f3557895ac 100644 --- a/inc/modules/admin/what-theme_edit.php +++ b/inc/modules/admin/what-theme_edit.php @@ -32,11 +32,11 @@ ************************************************************************/ // Some security stuff... -if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin())) -{ +if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin())) { $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; require($INC); } + // Add description as navigation point ADD_DESCR("admin", basename(__FILE__)); @@ -45,28 +45,20 @@ global $CurrTheme; // Check for selected themes $SEL = 0; if (!empty($_POST['sel'])) $SEL = SELECTION_COUNT($_POST['sel']); -if ($SEL > 0) -{ +if ($SEL > 0) { $OUT = ""; - foreach ($_POST['sel'] as $id=>$sel) - { + foreach ($_POST['sel'] as $id=>$sel) { $SQL = ""; // Shall I de-/activate or delete themes? - if (isset($_POST['status'])) - { + if (isset($_POST['status'])) { // Change status - if ($_POST['active'][$id] == 'Y') - { + if ($_POST['active'][$id] == 'Y') { $SQL = "UPDATE "._MYSQL_PREFIX."_themes SET theme_active='N' WHERE id='".$id."' LIMIT 1"; - } - else - { + } else { $SQL = "UPDATE "._MYSQL_PREFIX."_themes SET theme_active='Y' WHERE id='".$id."' LIMIT 1"; } $OUT = ADMIN_THEMES_UPDATED; - } - elseif (isset($_POST['del'])) - { + } elseif (isset($_POST['del'])) { // Delete themes $SQL = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_themes WHERE id='".$id."' LIMIT 1"; $OUT = ADMIN_THEMES_DELETED; @@ -79,9 +71,13 @@ if ($SEL > 0) // Output generated? if (empty($OUT)) ADMIN_THEME_NO_OUTPUT; } elseif (!empty($_GET['default_theme'])) { - // Save theme + // Escape string from input $POST['default_theme'] = SQL_ESCAPE($_GET['default_theme']); - set_session("mxchange_theme", $POST['default_theme'], (time() + 60*60*24*365), COOKIE_PATH); + + // Set session + set_session("mxchange_theme", $POST['default_theme']); + + // Save theme ADMIN_SAVE_SETTINGS($POST); } @@ -123,9 +119,7 @@ if (SQL_NUMROWS($result) > 0) // Free memory SQL_FREERESULT($result); -} - else -{ +} else { // No themes found??? $OUT .= " diff --git a/inc/modules/chk_login.php b/inc/modules/chk_login.php index 745fc31efd..6ab20c0266 100644 --- a/inc/modules/chk_login.php +++ b/inc/modules/chk_login.php @@ -50,7 +50,7 @@ if (!empty($GLOBALS['userid']) && (isSessionVariableSet('u_hash')) && (isSession SQL_FREERESULT($result); // Change to new theme - set_session("mxchange_theme", $NewTheme, (time() + 60*60*24*365), COOKIE_PATH); + set_session("mxchange_theme", $NewTheme); $bonus = false; if ((GET_EXT_VERSION("sql_patches") >= "0.2.8") && (GET_EXT_VERSION("bonus") >= "0.2.1") && ($_CONFIG['bonus_login_yn'] == 'N') && ($_CONFIG['bonus_login_yn'] == 'Y')) { diff --git a/inc/modules/guest/what-confirm.php b/inc/modules/guest/what-confirm.php index 40a1c513d5..4749ab6313 100644 --- a/inc/modules/guest/what-confirm.php +++ b/inc/modules/guest/what-confirm.php @@ -115,7 +115,7 @@ if (!empty($_GET['hash'])) // Account confirmed! if (defined('LEAD_CODE_ENABLED') && defined('LEAD_EXPIRY_TIME')) { // Set special lead cookie - set_session("lead_uid", bigintval($uid), (time() + LEAD_EXPIRY_TIME), COOKIE_PATH); + set_session("lead_uid", bigintval($uid)); // Lead-Code mode enabled LOAD_URL("lead-confirm.php"); @@ -126,7 +126,7 @@ if (!empty($_GET['hash'])) } } elseif (defined('LEAD_CODE_ENABLED') && defined('LEAD_EXPIRY_TIME')) { // Set special lead cookie - set_session("lead_uid", bigintval($uid), (time() + LEAD_EXPIRY_TIME), COOKIE_PATH); + set_session("lead_uid", bigintval($uid)); // Lead-Code mode enabled LOAD_URL("lead-confirm.php"); diff --git a/inc/modules/member/what-themes.php b/inc/modules/member/what-themes.php index 8778538010..eb2c73ec18 100644 --- a/inc/modules/member/what-themes.php +++ b/inc/modules/member/what-themes.php @@ -55,7 +55,7 @@ if (!empty($_POST['member_theme'])) $NewTheme = $_POST['member_theme']; // Change to new theme - set_session("mxchange_theme", $NewTheme, (time() + 60*60*24*365), COOKIE_PATH); + set_session("mxchange_theme", $NewTheme); // Theme saved! LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_THEME_SAVED); diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index cdde847e5d..49b40d3582 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -48,9 +48,6 @@ require_once(PATH."inc/functions.php"); // Non-database functions require_once(PATH."inc/extensions.php"); require_once(PATH."inc/language.php"); -// Load "databases" aka static arrays -require_once(PATH."inc/databases.php"); // Several hard-coded databases (arrays, constants) - // Check if the user setups his MySQL stuff... if ((empty($MySQL['login'])) && (!isBooleanConstantAndTrue('mxchange_installing')) && (!isset($_GET['installing'])) && (isBooleanConstantAndTrue('mxchange_installed'))) { // No login entered and outside installation mode @@ -67,11 +64,6 @@ if ((empty($MySQL['login'])) && (!isBooleanConstantAndTrue('mxchange_installing' echo "".LANG_WARNING.": ".WARN_NULL_PASSWORD; } -// Init configuration arrays -$_CONFIG = array( - 'code_length' => 0 -); - // Check if this file is writeable or read-only and warn the user if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndTrue('mxchange_installed'))) { // Check for write-permission for config.php and inc directory @@ -130,15 +122,15 @@ LIMIT 1", __FILE__, __LINE__); // Load all extensions require_once(PATH."inc/load_extensions.php"); + // Load "databases" aka static arrays + require_once(PATH."inc/databases.php"); + // Loading patching system is required here... require_once(PATH."inc/patch-system.php"); // Initialize patch system // Functions which are related to themes require_once(PATH."inc/theme-manager.php"); - // Initialize session management - require_once(PATH."inc/session.php"); - // Load admin include file if he is admin if (IS_ADMIN()) { // Administrative functions @@ -242,7 +234,6 @@ LIMIT 1", __FILE__, __LINE__); require_once(PATH."inc/databases.php"); require_once(PATH."inc/theme-manager.php"); require_once(PATH."inc/load_extensions.php"); - require_once(PATH."inc/session.php"); // Check if we are in installation routine $installPhp = basename($_SERVER['PHP_SELF']); diff --git a/inc/theme-manager.php b/inc/theme-manager.php index f463d23233..3eeee63dde 100644 --- a/inc/theme-manager.php +++ b/inc/theme-manager.php @@ -38,6 +38,9 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) require($INC); } +// Always make sure the session management is initialized first +require_once(PATH."inc/session.php"); + // function GET_CURR_THEME() { global $INC_POOL, $_CONFIG, $CSS; @@ -50,7 +53,7 @@ function GET_CURR_THEME() { if (!isSessionVariableSet('mxchange_theme')) { // Set default theme - set_session("mxchange_theme", $ret, (time() + 60*60*24*365), COOKIE_PATH); + set_session("mxchange_theme", $ret); } elseif ((isSessionVariableSet('mxchange_theme')) && (GET_EXT_VERSION("sql_patches") >= "0.1.4")) { // Get theme from cookie $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' LIMIT 1", array(get_session('mxchange_theme')), __FILE__, __LINE__); @@ -68,17 +71,17 @@ function GET_CURR_THEME() { // Installation mode active if ((!empty($_GET['theme'])) && (file_exists($theme)) && (is_readable($theme))) { // Set cookie from URL data - set_session("mxchange_theme", $_GET['theme'], (time() + 60*60*24*365), COOKIE_PATH); + set_session("mxchange_theme", $_GET['theme']); } elseif (file_exists(PATH."theme/".$_POST['theme']."/theme.php")) { // Set cookie from posted data - set_session("mxchange_theme", $_POST['theme'], (time() + 60*60*24*365), COOKIE_PATH); + set_session("mxchange_theme", $_POST['theme']); } // Set return value $ret = get_session('mxchange_theme'); } else { // Invalid design, reset cookie - set_session("mxchange_theme", $ret, (time() + 60*60*24*365), COOKIE_PATH); + set_session("mxchange_theme", $ret); } // Add (maybe) found theme.php file to inclusion list @@ -149,7 +152,7 @@ if ((!empty($_POST['new_theme'])) && ($_POST['new_theme'] != $CurrTheme)) $NewTheme = $_POST['new_theme']; // Change to new theme - set_session("mxchange_theme", $NewTheme, (time() + 60*60*24*365), COOKIE_PATH); + set_session("mxchange_theme", $NewTheme); // Remove current from array and set new $theme = PATH."theme/".$CurrTheme."/theme.php"; diff --git a/index.php b/index.php index 7f9ea32350..1af40fcdb5 100644 --- a/index.php +++ b/index.php @@ -59,7 +59,7 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install // Is the index page configured for redirect pr not? if ($_CONFIG['index_cookie'] > 0) { // Set cookie and remeber it for specified time - set_session("visited", "true", (time() + $_CONFIG['index_cookie']), COOKIE_PATH); + set_session("visited", "true"); } elseif (isSessionVariableSet('visited')) { // Remove cookie when admin set 0 in setup set_session("visited", ""); diff --git a/templates/de/html/admin/admin_config_proxy.tpl b/templates/de/html/admin/admin_config_proxy.tpl new file mode 100644 index 0000000000..a64c02abc5 --- /dev/null +++ b/templates/de/html/admin/admin_config_proxy.tpl @@ -0,0 +1,51 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {--ADMIN_EDIT_PROXY_SETTINGS--}
 
+ {--ADMIN_CONFIG_PROXY_HOST--} + + +
 
+ {--ADMIN_CONFIG_PROXY_PORT--} + + +
 
+ {--ADMIN_CONFIG_PROXY_USERNAME--} + + +
 
+ {--ADMIN_CONFIG_PROXY_PASSWORD--} + + +
 
+
diff --git a/templates/de/html/ext/ext_yoomedia.tpl b/templates/de/html/ext/ext_yoomedia.tpl new file mode 100644 index 0000000000..c455498949 --- /dev/null +++ b/templates/de/html/ext/ext_yoomedia.tpl @@ -0,0 +1 @@ +Erweiterung zur Anbindung an die API (Interface 2.0!) von
Yoo!Media. -- 2.39.5