Location: PHPKode > scripts > F-ystem Support Module > f-ystem-support-module/Fystem.class.php
<?php
	class fystem{
	var $handle;
	var $data;
    function fystem($target,$mode){
include_once('Fystem.settings.php');
$this->handle['path'] = $root.$target;
$this->handle['root'] = $root;
$this->handle['data'] = NULL; // return file contents $this->grabber('read');
$this->data['source'] = $root;
$this->data['mode'] = $mode;
$this->data['content'] = NULL; // write to file $this->prep($this->data['content'],'')
    return $this->data;
    }
    function prep($string,$copy_source){
$this->data['content'] = $string;
$this->data['ch'] = 1;
$this->data['source'] .= $copy_source;
 IF(!file_exists($this->handle['path'])){
  IF(!copy($this->data['source'],$this->handle['path'])){
echo 'The Cows Just Came Home...That\'s Bad.';
    return 303;
  }
 }
$pe = is_writable($this->handle['path']);
 IF($pe === FALSE){
echo 'I\'m sorry file permissions have to be updated manually...';
return 102;
 }ELSE
    return $this->data['content'];
    }
    function grabber($swit){
 IF(!$stream = fopen($this->handle['path'], $this->data['mode'])){
echo 'Did you even put your shoes on right? WRONG!';
    return 222;
 }
  SWITCH($swit){
	case 'read':
 IF(($this->data['mode'] < 2) && ($this->data['mode'] !== 'r')){
$this->data['mode'] .= '+';
 }
$size = filesize($this->handle['path']);
$this->handle['data'] = fread($stream, $size);
   IF(!$this->handle['data']){
echo 'Don\'t Look Now, it\'s a Flying Pig!';
    return 202;
   }
fclose($stream);
    return $this->handle['data'];
	break;
	case 'wryt':
 IF(!isset($this->data['ch'])){
echo 'No Money, No Funny...Prep up a String!';
    return 001;
 }
 IF(($this->data['mode'] < 2) && ($this->data['mode'] === 'r')){
$this->data['mode'] = 'r+';
 }
 IF(fwrite($stream, $this->data['content']) === FALSE){
echo 'Bananas Eating Monkies...What an Error!';
    return 101;
 }
fclose($stream);
    return 13;
	break;
	default:
echo 'What Happened? Are You on Dr*gs?';
    return 666;
	break;
 }
    }
	}
?>
Return current item: F-ystem Support Module