33 lines
		
	
	
		
			919 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			919 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
function checkAlerts() {
 | 
						|
   if ( $_SESSION['sentfile'] != '' ) {
 | 
						|
      echo "<script type='text/javascript'>\n";
 | 
						|
      echo "var message = 'Sent File: ", addslashes($_SESSION['sentfile']);
 | 
						|
      echo "\\n\\nDon\'t forget to add \"books@jaj.com\" to your ";
 | 
						|
      echo "approved senders.';\n";
 | 
						|
      echo "alert(message);\n";
 | 
						|
      echo "</script>\n";
 | 
						|
   }
 | 
						|
   $_SESSION['sentfile'] = "";
 | 
						|
   return;
 | 
						|
}
 | 
						|
 | 
						|
function makePathSafe($path = "") {
 | 
						|
   if ( $path == "" ) return "";
 | 
						|
   while ( strpos($path, "//") ) {
 | 
						|
      $path = ereg_replace("//", "/", $path);
 | 
						|
   }
 | 
						|
   while ( substr($path, 0, 1) == '/' ) {
 | 
						|
      $path = substr($path, 1, strlen($path)-1);
 | 
						|
   }
 | 
						|
   while ( substr($path, strlen($path)-1, 1) == '/' ) {
 | 
						|
      $path = substr($path, 0, strlen($path)-1);
 | 
						|
   }
 | 
						|
   $path = "/" . $path;
 | 
						|
   while ( preg_match("/\/\.*\//", $path) ) {
 | 
						|
      $path = preg_replace("/\/\.{0,}\//", "/", $path);
 | 
						|
   }
 | 
						|
   return $path;
 | 
						|
}
 |