<commit_before><?php
if(strrpos($_SERVER['REQUEST_URI'],'controller.php') !== false) {
	header('Location: ./');
	exit;
}
require_once('./constants.php');

require_once(CASH_PLATFORM_PATH);
$pages_path = ADMIN_BASE_PATH . '/components/pages/';
$admin_primary_cash_request = new CASHRequest();
$request_parameters = null;

// admin-specific autoloader
function cash_admin_autoloadCore($classname) {
	$file = ADMIN_BASE_PATH . '/classes/'.$classname.'.php';
	if (file_exists($file)) {
		require_once($file);
	}
}
spl_autoload_register('cash_admin_autoloadCore');

// grab path from .htaccess redirect
if ($_REQUEST['p'] && ($_REQUEST['p'] != realpath(ADMIN_BASE_PATH))) {
	$parsed_request = str_replace('/','_',trim($_REQUEST['p'],'/'));
	if (file_exists($pages_path . 'definitions/' . $parsed_request . '.php') && file_exists($pages_path . 'markup/' . $parsed_request . '.php')) {
		define('BASE_PAGENAME', $parsed_request);
		$include_filename = BASE_PAGENAME.'.php';
	} else {
		// cascade through a "failure" to see if it is a true bad request, or a page requested
		// with parameters requested — always show the last good true filename and push the
		// remaining request portions into te request_parameters array
		if (strpos($parsed_request,'_') !== false) {
			$fails_at_level = 0;
			$successful_request = '';
			$exploded_request = explode('_',$parsed_request);
			for($i = 0, $a = sizeof($exploded_request); $i < $a; ++$i) {
				if ($i > 0) {
					$test_request = $successful_request . '_' . $exploded_request[$i];
				} else {
					$test_request = $successful_request . $exploded_request[$i];
				}
				if (file_exists($pages_path . 'definitions/' . $test_request . '.php') && file_exists($pages_path . 'markup/' . $test_request . '.php')) {
					$successful_request = $test_request;
				} else {
					$fails_at_level = $i;
					break;
				}
			}
			if ($fails_at_level == 0) {
				define('BASE_PAGENAME', '');
				$include_filename = 'error.php';
			} else {
				// define page as successful request
				define('BASE_PAGENAME', $successful_request);
				$include_filename = BASE_PAGENAME.'.php';
				// turn the rest of the request into the parameters array
				$request_parameters = array_slice($exploded_request, 0 - (sizeof($exploded_request) - ($fails_at_level)));
			}
		} else {
			define('BASE_PAGENAME', '');
			$include_filename = 'error.php';
		}
	}
} else {
	define('BASE_PAGENAME','mainpage');
	$include_filename = 'mainpage.php';
}

$run_login_scripts = false;

// if a login needs doing, do it
$login_message = "Log In";
if (isset($_POST['login'])) {
	$login_details = AdminHelper::doLogin($_POST['address'],$_POST['password'],true,$_POST['browseridassertion']);
	if ($login_details !== false) {
		$admin_primary_cash_request->sessionSet('cash_actual_user',$login_details);
		$admin_primary_cash_request->sessionSet('cash_effective_user',$login_details);
		if ($_POST['browseridassertion']) {
			$address = CASHSystem::getBrowserIdStatus($_POST['browseridassertion']);
		} else {
			$address = $_POST['address'];
		}
		$admin_primary_cash_request->sessionSet('cash_effective_user_email',$address);
		
		$run_login_scripts = true;
		
		if ($include_filename == 'logout.php') {
			header('Location: ' . ADMIN_WWW_BASE_PATH);
			exit;
		}
	} else {
		$admin_primary_cash_request->sessionClearAll();
		$login_message = "Try Again";
	}<commit_msg>tweak for false browserid assertion detection<commit_after><?php
if(strrpos($_SERVER['REQUEST_URI'],'controller.php') !== false) {
	header('Location: ./');
	exit;
}
require_once('./constants.php');

require_once(CASH_PLATFORM_PATH);
$pages_path = ADMIN_BASE_PATH . '/components/pages/';
$admin_primary_cash_request = new CASHRequest();
$request_parameters = null;

// admin-specific autoloader
function cash_admin_autoloadCore($classname) {
	$file = ADMIN_BASE_PATH . '/classes/'.$classname.'.php';
	if (file_exists($file)) {
		require_once($file);
	}
}
spl_autoload_register('cash_admin_autoloadCore');

// grab path from .htaccess redirect
if ($_REQUEST['p'] && ($_REQUEST['p'] != realpath(ADMIN_BASE_PATH))) {
	$parsed_request = str_replace('/','_',trim($_REQUEST['p'],'/'));
	if (file_exists($pages_path . 'definitions/' . $parsed_request . '.php') && file_exists($pages_path . 'markup/' . $parsed_request . '.php')) {
		define('BASE_PAGENAME', $parsed_request);
		$include_filename = BASE_PAGENAME.'.php';
	} else {
		// cascade through a "failure" to see if it is a true bad request, or a page requested
		// with parameters requested — always show the last good true filename and push the
		// remaining request portions into te request_parameters array
		if (strpos($parsed_request,'_') !== false) {
			$fails_at_level = 0;
			$successful_request = '';
			$exploded_request = explode('_',$parsed_request);
			for($i = 0, $a = sizeof($exploded_request); $i < $a; ++$i) {
				if ($i > 0) {
					$test_request = $successful_request . '_' . $exploded_request[$i];
				} else {
					$test_request = $successful_request . $exploded_request[$i];
				}
				if (file_exists($pages_path . 'definitions/' . $test_request . '.php') && file_exists($pages_path . 'markup/' . $test_request . '.php')) {
					$successful_request = $test_request;
				} else {
					$fails_at_level = $i;
					break;
				}
			}
			if ($fails_at_level == 0) {
				define('BASE_PAGENAME', '');
				$include_filename = 'error.php';
			} else {
				// define page as successful request
				define('BASE_PAGENAME', $successful_request);
				$include_filename = BASE_PAGENAME.'.php';
				// turn the rest of the request into the parameters array
				$request_parameters = array_slice($exploded_request, 0 - (sizeof($exploded_request) - ($fails_at_level)));
			}
		} else {
			define('BASE_PAGENAME', '');
			$include_filename = 'error.php';
		}
	}
} else {
	define('BASE_PAGENAME','mainpage');
	$include_filename = 'mainpage.php';
}

$run_login_scripts = false;

// if a login needs doing, do it
$login_message = "Log In";
if (isset($_POST['login'])) {
	if ($_POST['browseridassertion'] == '-1') {
		$browseridassertion = false;
	} else {
		$browseridassertion = $_POST['browseridassertion'];
	}
	$login_details = AdminHelper::doLogin($_POST['address'],$_POST['password'],true,$browseridassertion);
	if ($login_details !== false) {
		$admin_primary_cash_request->sessionSet('cash_actual_user',$login_details);
		$admin_primary_cash_request->sessionSet('cash_effective_user',$login_details);
		if ($browseridassertion) {
			$address = CASHSystem::getBrowserIdStatus($browseridassertion);
		} else {
			$address = $_POST['address'];
		}
		$admin_primary_cash_request->sessionSet('cash_effective_user_email',$address);
		
		$run_login_scripts = true;
		
		if ($include_filename == 'logout.php') {
			header('Location: ' . ADMIN_WWW_BASE_PATH);
			exit;
		}
	} else {
		$admin_primary_cash_request->sessionClearAll();
		$login_message = "Try Again";
	}
{'fraction_non_alphanumeric': 0.16637605347282766, 'fraction_numerical': 0.0015983725661145017, 'mean_word_length': 4.759832635983264, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7468524', 'n_tokens_mistral': 2584, 'n_tokens_neox': 2313, 'n_words': 433}