<?php
chdir('../..');
require_once('api/buyers.php');

$result = null;
$buyers = new Buyers();

$id = intval($buyers->request->post('id'));
$object = $buyers->request->post('object');
$values = $buyers->request->post('values');

switch ($object)
{
    case 'page':
    	if($buyers->managers->access('pages'))
            $result = $buyers->pages->update_page($id, $values);
    break;
    case 'blog':
    	if($buyers->managers->access('blog'))
            $result = $buyers->blog->update_post($id, $values);
    break;
    case 'comment':
    	if($buyers->managers->access('comments'))
            $result = $buyers->comments->update_comment($id, $values);
    break;
    case 'feedback':
        if($buyers->managers->access('feedbacks'))
            $result = $buyers->feedbacks->update_feedback($id, $values);
    break;
}
$buyers->request->set_header("json");
print json_encode($result);
