* @license http://www.gnu.org/copyleft/gpl.html GNU GPL * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz * */ define('INTERNAL', 1); require(dirname(dirname(dirname(__FILE__))) . '/init.php'); safe_require('artefact', 'blog'); $limit = param_integer('limit', null); $offset = param_integer('offset', 0); $id = param_integer('blogpost', 0); if ($id) { $blogpost = new ArtefactTypeBlogPost($id); if (!$filelist = $blogpost->get_attached_files()) { $filelist = array(); } } else { $filelist = array(); } $result = array( 'count' => count($filelist), 'limit' => $limit, 'offset' => $offset, 'data' => $filelist, 'error' => false, 'message' => get_string('attachedfilelistloaded'), ); json_headers(); print json_encode($result);