public function fileInfo($get) { $uri = $get['f']; $repo = Repository::findOneByPk($get['id']); $path = $this->getPath($repo); $f = $path . $get['f']; if (!is_file($f)) { return array(); } $content = file_get_contents($f); $type = array_last(explode('.', $f)); $name = basename($f); return array('uri' => $uri, 'type' => $type, 'name' => $name, 'is_image' => self::isImage($type), 'content' => !self::isImage($type) ? $content : base64_encode($content), 'comments' => self::getComments($uri)); }
public function load($get) { $id = $get['id']; $repo = Repository::findOneByPk($id); if ($repo) { $tmp_dir = Config::get('code/tmp_dir'); $dir_name = md5($repo->address); if (!is_dir($tmp_dir . '/' . $dir_name)) { mkdir($tmp_dir . '/' . $dir_name); } $s = new SvnHelper($repo->address, $repo->user, $repo->password); $s->checkOut($tmp_dir . '/' . $dir_name); return $this->getCommonResult(true); } }