Location: PHPKode > projects > VCore > v25b10/includes/functions.php
<?php
/*
/ Functions file. Functions in this file are used throughout ZPanel.
/
/ Created: 3/20/2005
/ Last Edited: 3/20/2005
*/

// Function: Clean
// Creation Date: 3/20/2005
// Alter Date: 3/20/2005
// Usage: Restricts the input to a certain number of words.
function Clean($subject, $restriction) {
	$subject = trim($subject);
	$subject = addslashes($subject);
	
	// Break down spaces and only return the first "words"
	if (strpos($subject,' ')) {
		$subject = explode(' ', $subject);
		$newstring = '';
		for ($i=0; $i <= $restriction-1; $i++) {
			$newstring .= $subject[$i].' ';
		}
		$subject = trim($newstring);
	}

	return $subject;
}

// Function: Get Contents
// Creation Date: 3/20/2005
// Alter Date: 3/20/2005
// Usage: Blocks ?page= exploits and locks them to pages under ZPanel's module directory.
function GetContents($page, $root, $ext = false) {
	$page = trim($page);
	$page = str_replace('http://', '', $page);
	$page = str_replace('../', '', $page);
	
	if ($ext) {
		$ext = trim($ext);
		$ext = str_replace('http://', '', $ext);		
	
		if (file_exists($root.'/modules/'.$page.'/'.$ext.'.php')) {
			return ($root.'/modules/'.$page.'/'.$ext.'.php');
		}else{
			echo 'The ?page= specified is incorrect.';
		}
	}else{
		if (file_exists($root.'/modules/'.$page.'/index.php')) {
			return ($root.'/modules/'.$page.'/index.php');
		}else{
			if ($page == 'main') {
				return ($root.'/main.php');
			}else{
				echo 'The ?page= specified is incorrect.';
			}
		}
	}
}

// Function: Check Module
// Creation Date: 3/20/2005
// Alter Date: 3/20/2005
// Usage: Checks if a module exists, if not returns ''.
function CheckModule($page, $root) {
	$page = trim($page);
	
	if (file_exists($root.'/modules/'.$page)) {
		return $page;
	}else{
		return '';
	}
}

?>
Return current item: VCore