* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category API
- * @package GNUSocial
+ * @package GNUsocial
* @author Hannes Mannerheim <h@nnesmannerhe.im>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://www.gnu.org/software/social/
{
const MAXCOUNT = 100;
- var $original = null;
+ var $original = null; // Notice object for which to retrieve favs
var $cnt = self::MAXCOUNT;
/**
*
* @return boolean success flag
*/
- function prepare($args)
+ protected function prepare(array $args=array())
{
parent::prepare($args);
+ if ($this->format !== 'json') {
+ $this->clientError('This method currently only serves JSON.', 415);
+ }
+
$id = $this->trimmed('id');
- $this->original = Notice::staticGet('id', $id);
+ $this->original = Notice::getKV('id', $id);
- if (empty($this->original)) {
+ if (!($this->original instanceof Notice)) {
// TRANS: Client error displayed trying to display redents of a non-exiting notice.
- $this->clientError(_('No such notice.'),
- 400, $this->format);
- return false;
+ $this->clientError(_('No such notice.'), 400);
}
$cnt = $this->trimmed('count');
*
* @return void
*/
- function handle($args)
+ protected function handle()
{
- parent::handle($args);
+ parent::handle();
$fave = new Fave();
$fave->selectAdd();
$ids_with_profile_data = array();
$i=0;
foreach($ids as $id) {
- $profile = Profile::staticGet('id', $id);
+ $profile = Profile::getKV('id', $id);
$ids_with_profile_data[$i]['user_id'] = $id;
$ids_with_profile_data[$i]['nickname'] = $profile->nickname;
$ids_with_profile_data[$i]['fullname'] = $profile->fullname;