Add a new tag to hide a paste on the main page

This commit is contained in:
Némunaire 2012-02-29 14:41:00 +01:00
commit a6a87b6f8a
5 changed files with 23 additions and 8 deletions

View file

@ -12,6 +12,7 @@ class Paste
var $date;
var $content;
var $ip;
var $private = false;
var $ref = NULL;
var $hash;
var $crypt = NULL;
@ -82,6 +83,9 @@ class Paste
else
$this->hash = NULL;
if ($doc->getElementsByTagName("private")->length > 0)
$this->private = true;
if ($doc->getElementsByTagName("crypt")->length > 0)
$this->crypt = base64_decode($doc->getElementsByTagName("crypt")->item(0)->textContent);
else
@ -186,6 +190,10 @@ class Paste
$xml_paste->appendChild(
$xml->createElement("hash", $this->hash));
if ($this->is_private ())
$xml_paste->appendChild(
$xml->createElement("private"));
$xml->appendChild($xml_paste);
if ($xml->save(Paste::get_path($this->filename)))
@ -316,6 +324,11 @@ class Paste
}
}
function is_private()
{
return $this->private;
}
function export_to_file($fileto)
{
file_put_contents($fileto, $this->content);