changing paste read output for API refactoring

This commit is contained in:
El RIDO
2015-10-18 11:08:28 +02:00
parent b92b38cee8
commit f21567133c
7 changed files with 74 additions and 36 deletions

View File

@@ -52,6 +52,10 @@ class model_paste extends model_abstract
$this->_data->meta->formatter = $this->_conf->getKey('defaultformatter');
}
}
$this->_data->comments = array_values($this->getComments());
$this->_data->comment_count = count($this->_data->comments);
$this->_data->comment_offset = 0;
$this->_data->{'@context'} = 'js/paste.jsonld';
return $this->_data;
}

View File

@@ -339,9 +339,7 @@ class zerobin
$paste = $this->_model->getPaste($dataid);
if ($paste->exists())
{
// The paste itself is the first in the list of encrypted messages.
$messages = array_merge(array($paste->get()), $paste->getComments());
$this->_data = json_encode($messages);
$this->_data = json_encode($paste->get());
}
else
{
@@ -359,7 +357,7 @@ class zerobin
}
else
{
$this->_return_message(0, $dataid, array('messages' => $messages));
$this->_return_message(0, $dataid, json_decode($this->_data, true));
}
}
}

View File

@@ -384,7 +384,7 @@ class zerobin_db extends zerobin_abstract
$comments[$i]->meta->nickname = $row['nickname'];
if (array_key_exists('vizhash', $row))
$comments[$i]->meta->vizhash = $row['vizhash'];
$comments[$i]->meta->postdate = $i;
$comments[$i]->meta->postdate = (int) $row['postdate'];
$comments[$i]->meta->commentid = $row['dataid'];
$comments[$i]->meta->parentid = $row['parentid'];
}