示例#1
0
 public static function getZipMediaContent($core, $get, $post)
 {
     if (empty($get['id'])) {
         throw new Exception('No media ID');
     }
     $id = (int) $get['id'];
     if (!$core->auth->check('media,media_admin', $core->blog)) {
         throw new Exception('Permission denied');
     }
     try {
         $core->media = new dcMedia($core);
         $file = $core->media->getFile($id);
     } catch (Exception $e) {
     }
     if ($file === null || $file->type != 'application/zip' || !$file->editable) {
         throw new Exception('Not a valid file');
     }
     $rsp = new xmlTag('result');
     $content = $core->media->getZipContent($file);
     foreach ($content as $k => $v) {
         $rsp->file($k);
     }
     return $rsp;
 }