require_once "{$GLOBALS['BASE_DIR']}/includes/validator.class.php"; require_once "{$GLOBALS['BASE_DIR']}/includes/mysql.class.php"; require_once "{$GLOBALS['BASE_DIR']}/includes/http.class.php"; require_once "{$GLOBALS['BASE_DIR']}/includes/template.class.php"; require_once "{$GLOBALS['BASE_DIR']}/includes/compiler.class.php"; require_once 'includes/functions.php'; SetupRequest(); $DB = new DB($C['db_hostname'], $C['db_username'], $C['db_password'], $C['db_name']); $DB->Connect(); if (($error = ValidLogin()) === TRUE) { if (isset($_REQUEST['ref_url'])) { header("Location: http://{$_SERVER['HTTP_HOST']}{$_REQUEST['ref_url']}"); exit; } if (!isset($_REQUEST['r'])) { ScheduledCleanup(); include_once 'includes/main.php'; } else { $function = $_REQUEST['r']; if (ValidFunction($function)) { call_user_func($function); } else { trigger_error("Function '{$function}' is not a valid TGPX function", E_USER_ERROR); } } } else { if (isset($_REQUEST['ref_url'])) { $_SERVER['QUERY_STRING'] = TRUE; $_SERVER['REQUEST_URI'] = $_REQUEST['ref_url']; } include_once 'includes/login.php';
echo "ERROR: You must specify at least a SQL data backup filename when using the --restore function\n" . "Example:\n" . "{$_SERVER['_']} {$path}/{$GLOBALS['argv'][0]} --restore --sql-file=sql-backup.txt --thumbs-file=thumbs-backup.txt\n"; break; } DoDatabaseRestore($args, TRUE); break; case '--export': DoGalleryExport(null, TRUE); break; case '--optimize': OptimizeDatabase(); break; case '--daily-partner': DailyPartnerMaintenance(); break; case '--cleanup': ScheduledCleanup(FALSE); break; case '--reset-clicks-submitted': $DB->Update('UPDATE `tx_galleries` SET `clicks`=0 WHERE `type`=?', array('submitted')); break; case '--reset-clicks-permanent': $DB->Update('UPDATE `tx_galleries` SET `clicks`=0 WHERE `type`=?', array('permanent')); break; } $DB->Disconnect(); function DailyPartnerMaintenance() { global $DB, $C; $args = ParseCommandLine(); // Remove inactive partner accounts if (isset($args['remove-inactive']) && is_numeric($args['remove-inactive'])) {