$hash,'content'=>htmlentities(file_get_contents($path)))); } public function handleUpload($tmpfile,$hash=false) { if($hash===false) { $hash = getNewHash('txt',6); } else { if(!endswith($hash,'.txt')) $hash.='.txt'; if(isExistingHash($hash)) return array('status'=>'err','hash'=>$hash,'reason'=>'Custom hash already exists'); } storeFile($tmpfile,$hash,true); return array('status'=>'ok','hash'=>$hash,'url'=>getURL().$hash); } function getTypeOfText($hash) { return file_get_contents(getDataDir().DS.$hash.DS.'type'); } }