function ServerTest() { global $errors; $server = GetServerCapabilities(); if ($server['safe_mode']) { $errors[] = 'PHP safe_mode appears to be enabled; this must be disabled for ToplistX to function properly'; } if (!$server['shell_exec']) { $errors[] = "The PHP shell_exec() function " . ($server['safe_mode'] ? "cannot be used because of the safe_mode setting" : "is disabled") . ". This function is required for ToplistX to work properly"; } if (!$server['php_cli']) { $errors[] = 'The CLI version of PHP could not be found on your server. This is required for ToplistX to function properly'; } else { if ($server['php_cli_safe_mode']) { $errors[] = 'The CLI version of PHP is running with safe_mode enabled. This must be disabled for ToplistX to function properly'; } } }
<?php if ($_GET['a'] == 'phpinfo') { phpinfo(); exit; } if (!defined('E_STRICT')) { define('E_STRICT', 2048); } error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT); $server = GetServerCapabilities(); ?> <html> <head> <title>Server Test Script</title> <style> body, td { font-family: Tahoma; font-size: 9pt; } .h2 { font-size: 18pt; font-weight: bold; margin-bottom: 10px; } .passed { font-weight: bold; color: green;
function lxSaveGeneralSettings() { global $C; VerifyAdministrator(); CheckAccessList(); $server = GetServerCapabilities(); $GLOBALS['_server_'] = $server; $v = new Validator(); $required = array('base_url' => 'Base URL', 'cookie_domain' => 'Cookie Domain', 'from_email' => 'E-mail Address', 'from_email_name' => 'E-mail Name', 'page_new' => 'New Links Page', 'page_popular' => 'Popular Links Page', 'page_top' => 'Top Links Page', 'page_details' => 'Link Details Page', 'extension' => 'File Extension', 'date_format' => 'Date Format', 'time_format' => 'Time Format', 'dec_point' => 'Decimal Point', 'thousands_sep' => 'Thousands Separator', 'min_desc_length' => 'Minimum Description Length', 'max_desc_length' => 'Maximum Description Length', 'min_title_length' => 'Maximum Title Length', 'max_title_length' => 'Maximum Title Length', 'max_keywords' => 'Maximum Keywords', 'link_weight' => 'Default Link Weight', 'min_comment_length' => 'Maximum Comment Length', 'max_comment_length' => 'Maximum Comment Length', 'max_rating' => 'Maximum Rating', 'font_dir' => 'Font Directory', 'min_code_length' => 'Minimum Code Length', 'max_code_length' => 'Maximum Code Length', 'cache_index' => 'Index Page Cache', 'cache_category' => 'Category Page Cache', 'cache_new' => 'New Link Page Cache', 'cache_popular' => 'Popular Links Page Cache', 'cache_top' => 'Top Links Page Cache', 'cache_search' => 'Search Page Cache', 'cache_details' => 'Details Page Cache'); foreach ($required as $field => $name) { $v->Register($_REQUEST[$field], V_EMPTY, "The {$name} field is required"); } if ($v->Validate()) { if (!preg_match('~%d~', $_REQUEST['page_details'])) { if (strpos($_REQUEST['page_details'], '.') === FALSE) { $_REQUEST['page_details'] .= "%d"; } else { $_REQUEST['page_details'] = preg_replace('~\\.([^.]*)$~', '%d.$1', $_REQUEST['page_details']); } } $_REQUEST['extension'] = preg_replace('~^\\.~', '', $_REQUEST['extension']); $_REQUEST['base_url'] = preg_replace('~/$~', '', $_REQUEST['base_url']); $_REQUEST['domain'] = preg_replace('~^www\\.~', '', $_SERVER['HTTP_HOST']); $_REQUEST = array_merge($server, $_REQUEST); WriteConfig($_REQUEST); $GLOBALS['message'] = 'Your settings have been successfully updated'; } else { $C = array_merge($C, $_REQUEST); $GLOBALS['errstr'] = join('<br />', $v->GetErrors()); } lxShGeneralSettings(); }
function txGeneralSettingsSave() { global $C; VerifyAdministrator(); CheckAccessList(); $server = GetServerCapabilities(); $GLOBALS['_server_'] = $server; $v = new Validator(); $required = array('document_root' => 'Document Root', 'install_url' => 'TGPX URL', 'cookie_domain' => 'Cookie Domain', 'from_email' => 'E-mail Address', 'from_email_name' => 'E-mail Name', 'date_format' => 'Date Format', 'time_format' => 'Time Format', 'dec_point' => 'Decimal Point', 'thousands_sep' => 'Thousands Separator', 'max_submissions' => 'Global Submissions Per Day', 'submissions_per_person' => 'Submissions Per Person', 'max_links' => 'Maximum Links Allowed', 'min_desc_length' => 'Minimum Description Length', 'max_desc_length' => 'Maximum Description Length', 'min_thumb_size' => 'Minimum Gallery Thumb Size', 'max_thumb_size' => 'Maximum Gallery Thumb Size', 'max_keywords' => 'Maximum Keywords', 'gallery_weight' => 'Default Gallery Weight', 'font_dir' => 'Font Directory', 'min_code_length' => 'Minimum Code Length', 'max_code_length' => 'Maximum Code Length', 'permanent_hold' => 'Permanent Holding Period', 'submitted_hold' => 'Submitted Holding Period', 'page_permissions' => 'Page Permissions'); if ($_REQUEST['allow_multiple_cats']) { $required['max_categories'] = 'Maximum Categories'; } foreach ($required as $field => $name) { $v->Register($_REQUEST[$field], V_EMPTY, "The {$name} field is required"); } $v->Register($_REQUEST['min_thumb_size'], V_REGEX, "The 'Minimum Gallery Thumb Size' value must be in WxH format", '~\\d+x\\d+~'); $v->Register($_REQUEST['max_thumb_size'], V_REGEX, "The 'Maximum Gallery Thumb Size' value must be in WxH format", '~\\d+x\\d+~'); if (!$v->Validate()) { $C = array_merge($C, $_REQUEST); return $v->ValidationError('txShGeneralSettings'); } if (!isset($_REQUEST['compression'])) { $_REQUEST['compression'] = 80; } list($_REQUEST['min_thumb_width'], $_REQUEST['min_thumb_height']) = explode('x', trim($_REQUEST['min_thumb_size'])); list($_REQUEST['max_thumb_width'], $_REQUEST['max_thumb_height']) = explode('x', trim($_REQUEST['max_thumb_size'])); $_REQUEST['document_root'] = preg_replace('~/$~', '', $_REQUEST['document_root']); $_REQUEST['install_url'] = preg_replace('~/$~', '', $_REQUEST['install_url']); $_REQUEST['preview_url'] = preg_replace('~/$~', '', $_REQUEST['preview_url']); $_REQUEST['domain'] = preg_replace('~^www\\.~', '', $_SERVER['HTTP_HOST']); $_REQUEST['preview_dir'] = DirectoryFromRoot($_REQUEST['document_root'], $_REQUEST['preview_url']); $_REQUEST = array_merge($server, $_REQUEST); WriteConfig($_REQUEST); CleanupThumbSizes(); $GLOBALS['message'] = 'Your settings have been successfully updated'; txShGeneralSettings(); }
function tlxGeneralSettingsSave() { global $C; VerifyAdministrator(); CheckAccessList(); $server = GetServerCapabilities(); $GLOBALS['_server_'] = $server; $v = new Validator(); $required = array('document_root' => 'Document Root', 'install_url' => 'ToplistX URL', 'cookie_domain' => 'Cookie Domain', 'from_email' => 'E-mail Address', 'from_email_name' => 'E-mail Name', 'date_format' => 'Date Format', 'time_format' => 'Time Format', 'dec_point' => 'Decimal Point', 'thousands_sep' => 'Thousands Separator', 'secret_key' => 'Secret Key', 'forward_url' => 'Default Forward URL', 'alternate_out_url' => 'Alternate Out URL', 'redirect_code' => 'Redirect Status Code', 'max_rating' => 'Maximum Site Rating', 'min_comment_length' => 'Minimum Comment Length', 'max_comment_length' => 'Maximum Comment Length', 'comment_interval' => 'Comment Interval', 'min_desc_length' => 'Minimum Description Length', 'max_desc_length' => 'Maximum Description Length', 'max_keywords' => 'Maximum Keywords', 'return_percent' => 'Default Return Percent', 'banner_max_width' => 'Maximum Banner Width', 'banner_max_height' => 'Maximum Banner Height', 'banner_max_bytes' => 'Maximum Banner Filesize', 'font_dir' => 'Font Directory', 'min_code_length' => 'Minimum Code Length', 'max_code_length' => 'Maximum Code Length'); if (!$_REQUEST['using_cron']) { $required['rebuild_interval'] = 'Rebuild Interval'; $v->Register($_REQUEST['rebuild_interval'], V_GREATER_EQ, 'The Rebuild Interval must be 60 or larger', 60); } foreach ($required as $field => $name) { $v->Register($_REQUEST[$field], V_EMPTY, "The {$name} field is required"); } $_REQUEST['return_percent'] /= 100; $_REQUEST['document_root'] = preg_replace('~/$~', '', $_REQUEST['document_root']); $_REQUEST['install_url'] = preg_replace('~/$~', '', $_REQUEST['install_url']); $_REQUEST['domain'] = preg_replace('~^www\\.~', '', $_SERVER['HTTP_HOST']); $_REQUEST['banner_dir'] = DirectoryFromRoot($_REQUEST['document_root'], $_REQUEST['banner_url']); if (!$v->Validate()) { $C = array_merge($C, $_REQUEST); return $v->ValidationError('tlxShGeneralSettings'); } $_REQUEST = array_merge($server, $_REQUEST); WriteConfig($_REQUEST); $GLOBALS['message'] = 'Your settings have been successfully updated'; tlxShGeneralSettings(); }