function txScannerStart() { global $DB, $json, $C; VerifyAdministrator(TRUE); CheckAccessList(TRUE); shell_exec("{$C['php_cli']} scanner.php " . escapeshellarg($_REQUEST['config_id']) . " >/dev/null 2>&1 &"); echo $json->encode(array('status' => JSON_SUCCESS, 'message' => 'Your request to start the gallery scanner has been processed')); }
function tlxDatabaseRawQuery() { global $json, $DB; VerifyAdministrator(TRUE); CheckAccessList(TRUE); if (preg_match('~^SELECT COUNT~i', $_REQUEST['query'])) { $affected = $DB->Count($_REQUEST['query']); } else { if (preg_match('~^SELECT~i', $_REQUEST['query'])) { $result = $DB->Query($_REQUEST['query']); $affected = $DB->NumRows($result); $DB->Free($result); } else { $affected = $DB->Update($_REQUEST['query']); } } echo $json->encode(array('status' => JSON_SUCCESS, 'message' => "SQL query has been executed; a total of {$affected} rows were affected by this query")); }
/** * Perform a raw SQL query */ function lxRawQuery() { global $json, $DB; VerifyAdministrator(TRUE); CheckAccessList(TRUE); $affected = $DB->Update($_REQUEST['query']); echo $json->encode(array('status' => JSON_SUCCESS, 'message' => "SQL query has been executed; a total of {$affected} rows were affected by this query")); }
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(); }