4 * JSON api for gitlive desktop application
6 require_once 'MTrackWeb.php';
7 class MTrackWeb_Gitlive extends MTrackWeb
11 header('WWW-Authenticate: Basic realm="Gitlive"');
12 header('HTTP/1.0 401 Unauthorized');
18 if (!isset($_SERVER['PHP_AUTH_USER'])) {
21 $u = DB_DataObject::factory('core_person');
23 $u->whereAdd('LENGTH(passwd) > 1');
24 //$u->company_id = $this->company->id;
26 $u->email = $_SERVER['PHP_AUTH_USER'];
27 if ($u->count() > 1 || !$u->find(true)) {
33 // return $this->errmsg('disabled');
36 if ($u->checkPassword($_SERVER['PHP_AUTH_PW'])) {
39 // we do not log automated???
50 $pi .= (strlen($pi) ? $this->bootLoader->ext : '');
51 $r = DB_DataObject::factory('mtrack_repos');
52 if (!$r->get('shortname', $pi)) {
53 $this->jerr("invalid repo");
55 // make sure it's a valid project..
56 if (!$this->projectPerm($r->project_id, 'MTrack.Issue', 'S')) {
57 $this->jerr("no perms");
59 //DB_DAtaObject::DebugLevel(1);
60 $t = DB_DataObject::Factory('mtrack_ticket');
62 $t->whereAdd("join_status_id.name IN ( 'open', 'new')");
63 $t->project_id = $r->project_id;
64 // only need id / name / status?
65 //$ar = $t->fetchAll('id', ');
68 mtrack_ticket.id as id ,
69 mtrack_ticket.summary as summary,
70 mtrack_ticket.description as description
76 $ret[] = $t->toArray('%s', 0);
81 $this->jok("WORKED!");