storage_path = $path; } public function setContent($content, $language, $nick, $description) { global $config; $content = PastifyText($content, $language, $description); do { $filename = sha1(date('r') . rand(1000, getrandmax())); } while (file_exists(realpath($storage_path . '/' , $filename))); if ($config['short_results_path']) { $urlbase = $config['short_results_path']; } else { $urlbase = $config['site_domain'] . $config['site_path'] . '/' . $config['results_dir']; } $content = $this->prepareContent($filename, $urlbase, $content); $filename = $filename . ".html"; // write content $outfile = realpath($storage_path . '/' , $filename); $fp = fopen($outfile, "w"); fwrite($fp, $content); fclose($fp); return $pasteUrl; } public function delContent($pid) { $filename = realpath($this->storage_path . $pid); if (!empty($filename) && file_exists($filename)) { if (!@unlink($filename)) { header('HTTP/1.0 503 Service Unavailable'); die('Failed to remove ' . $filename); } } } } ?>