<commit_before><?

defined('C5_EXECUTE') or die("Access Denied.");
$u = new User();

$cf = Loader::helper('file');
$fp = FilePermissions::getGlobal();
if (!$fp->canAddFiles()) {
	die(t("Unable to add files."));
}

if (isset($_REQUEST['fID'])) {
	// we are replacing a file
	$fr = File::getByID($_REQUEST['fID']);
} else {
	$fr = false;
}

$searchInstance = $_POST['searchInstance'];

$valt = Loader::helper('validation/token');
Loader::library("file/importer");
Loader::library('3rdparty/Zend/Http/Client');
Loader::library('3rdparty/Zend/Uri/Http');
$file = Loader::helper('file');
Loader::helper('mime');

$error = array();

// load all the incoming fields into an array
$incoming_urls = array();

if (!function_exists('iconv_get_encoding')) {
	$errors[] = t('Remote URL import requires the iconv extension enabled on your server.');
}

if (count($errors) == 0) { 
	for ($i = 1; $i < 6; $i++) {
		$this_url = trim($_REQUEST['url_upload_' .$i]); 
	
		// did we get anything?
		if (!strlen($this_url))
			continue; 
		
		// validate URL
		if (Zend_Uri_Http::check($this_url)) {
			// URL appears to be good... add it
			$incoming_urls[] = $this_url;
		} else {
			$errors[] = '"' . $this_url . '"' . t(' is not a valid URL.');
		}
	}

	if (!$valt->validate('import_remote')) {
		$errors[] = $valt->getErrorMessage();
	}
				
	
	if (count($incoming_urls) < 1) {
		$errors[] = t('You must specify at least one valid URL.');
	}

}


$import_responses = array();

// if we haven't gotten any errors yet then try to process the form
if (count($errors) < 1) {<commit_msg>Removed quotation marks from around url when outputting a Zend_Uri_Http::check error. This error string is eventually fed into the window.parent.ccmAlert.notice() function down at the bottom of the file, and that function wraps the entire error in quotation marks -- so the quotation marks inside the error message were causing a javascript error due to premature string termination. An alternate solution would be to escape the error string, but there could be unintended consequences to that approach, so simply removing the offending quotation marks from the error string instead seems like a more localized and hence "safer" solution.<commit_after><?

defined('C5_EXECUTE') or die("Access Denied.");
$u = new User();

$cf = Loader::helper('file');
$fp = FilePermissions::getGlobal();
if (!$fp->canAddFiles()) {
	die(t("Unable to add files."));
}

if (isset($_REQUEST['fID'])) {
	// we are replacing a file
	$fr = File::getByID($_REQUEST['fID']);
} else {
	$fr = false;
}

$searchInstance = $_POST['searchInstance'];

$valt = Loader::helper('validation/token');
Loader::library("file/importer");
Loader::library('3rdparty/Zend/Http/Client');
Loader::library('3rdparty/Zend/Uri/Http');
$file = Loader::helper('file');
Loader::helper('mime');

$error = array();

// load all the incoming fields into an array
$incoming_urls = array();

if (!function_exists('iconv_get_encoding')) {
	$errors[] = t('Remote URL import requires the iconv extension enabled on your server.');
}

if (count($errors) == 0) { 
	for ($i = 1; $i < 6; $i++) {
		$this_url = trim($_REQUEST['url_upload_' .$i]); 
	
		// did we get anything?
		if (!strlen($this_url))
			continue; 
		
		// validate URL
		if (Zend_Uri_Http::check($this_url)) {
			// URL appears to be good... add it
			$incoming_urls[] = $this_url;
		} else {
			$errors[] = $this_url . t(' is not a valid URL.');
		}
	}

	if (!$valt->validate('import_remote')) {
		$errors[] = $valt->getErrorMessage();
	}
				
	
	if (count($incoming_urls) < 1) {
		$errors[] = t('You must specify at least one valid URL.');
	}

}


$import_responses = array();

// if we haven't gotten any errors yet then try to process the form
if (count($errors) < 1) {
{'fraction_non_alphanumeric': 0.1733903286134117, 'fraction_numerical': 0.004274646005877639, 'mean_word_length': 4.371592539454807, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '4814817', 'n_tokens_mistral': 1296, 'n_tokens_neox': 1227, 'n_words': 377}