xaizek / rocketgit (License: AGPLv3+) (since 2018-12-09)
Light and fast Git hosting solution suitable to serve both as a hub or as a personal code storage with its tickets, pull requests, API and much more.
Commit 9d56cfb9031f9e09680e61e41614fce4f846e767

Bulk
Author: Catalin(ux) M. BOIE
Author date (UTC): 2012-07-04 22:03
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2012-07-04 22:03
Parent(s): b6a908e44053809a8c00c14e71aaea3fee524fd9
Signing key:
Tree: 5dc2ebda194bf878314cefc2ae418d3dedf86f46
File Lines added Lines deleted
TODO 28 5
inc/admin/users/user.form.php 1 2
inc/bug.inc.php 257 55
inc/feedback/suggestion.form.php 1 2
inc/git.inc.php 8 6
inc/keys.inc.php 4 3
inc/log.inc.php 11 3
inc/login/login.form.php 1 2
inc/repo.inc.php 46 14
inc/repo/repo.form.php 1 2
inc/repo/search.form.php 1 2
inc/rights.inc.php 1 1
inc/sql.inc.php 11 1
inc/ssh.inc.php 58 0
inc/struct.inc.php 40 19
inc/user/forgot.form.php 1 2
inc/user/forgot_send.form.php 1 2
inc/user/keys/add.form.php 1 2
inc/user/pass/pass.form.php 1 2
inc/user/repo-page.php 7 5
inc/user/repo/bug/add/add.php 50 0
inc/user/repo/bug/main.php 32 0
inc/user/repo/bug/show.php 66 0
inc/user/repo/rights/rights.form.php 1 2
inc/util.inc.php 37 2
root/index.php 4 3
root/themes/default/errmsg/footer.html 3 0
root/themes/default/errmsg/header.html 3 0
root/themes/default/errmsg/line.html 1 0
root/themes/default/errmsg/nodata.html 0 0
root/themes/default/main.css 5 0
root/themes/default/repo/blob.html 1 1
root/themes/default/repo/bug/bug_add.html 29 0
root/themes/default/repo/bug/list/footer.html 0 0
root/themes/default/repo/bug/list/header.html 11 0
root/themes/default/repo/bug/list/line.html 11 0
root/themes/default/repo/bug/list/nodata.html 1 1
root/themes/default/repo/bug/list_note/footer.html 0 0
root/themes/default/repo/bug/list_note/header.html 7 0
root/themes/default/repo/bug/list_note/line.html 6 0
root/themes/default/repo/bug/list_note/nodata.html 1 1
root/themes/default/repo/bug/main.html 8 0
root/themes/default/repo/bug/note_add.html 17 0
root/themes/default/repo/bug/show.html 15 0
root/themes/default/repo/issues.html 0 1
root/themes/default/repo/main.html 2 6
root/themes/default/repo/source.html 4 0
samples/config.php 1 1
scripts/remote.php 19 16
tests/git2.php 1 1
tests/sql.php 2 0
File TODO changed (mode: 100644) (index c735d80..f1ed3fb)
1 1 == BEFORE FIRST RELEASE! == == BEFORE FIRST RELEASE! ==
2 [ ] array2string but transform \n into \\n (same for \r). Only rg_log may use \n.
3 [ ] Fix PostgreSQL auth because httpd is in private tmp so we need TCP!
4 [ ] Cannot lock the schema upgrade because both web and cron try to own the lock!
5 Let only cron/q/remote to do it, in web just wait (or give error)
6 (or auto retry).
2 7 [ ] Make available the merge requests. [ ] Make available the merge requests.
3 8 [ ] Add possibility to reject merge requests, to apply, to delete etc. [ ] Add possibility to reject merge requests, to apply, to delete etc.
4 9 [ ] JUNK1/JUNK2: http://rg.embedromix.ro:8000/user/catab/rocketgit/commit/afd1df2..f919c9b [ ] JUNK1/JUNK2: http://rg.embedromix.ro:8000/user/catab/rocketgit/commit/afd1df2..f919c9b
 
8 13 [ ] "log" does not list last entries! More exactly, seems the owner does not update repo! [ ] "log" does not list last entries! More exactly, seems the owner does not update repo!
9 14 [ ] @@branch@@ is not defined for merge requests. Should it? Probably yes, to filter them. [ ] @@branch@@ is not defined for merge requests. Should it? Probably yes, to filter them.
10 15 [ ] Create a repo and click on it; seems we get error (gabi)! [ ] Create a repo and click on it; seems we get error (gabi)!
11 [ ] Enforce Signoff-by lines per project (a new permission)
12 = reject commits without signoff!
13 Maybe, do it generic, allow a text field to enumerate what should be in a commit!
14 Also, present a list with checkboxex: at least Signoff-by, Reported-by, Acked-by!
15 [ ]
16 16 [ ] Check if we have a way to disable merge requests per project. [ ] Check if we have a way to disable merge requests per project.
17 17 [ ] Add real name to user info. [ ] Add real name to user info.
18 18 [ ] Add permission to add bug tracker to a project. [ ] Add permission to add bug tracker to a project.
19 [ ] Remove all @@DUMP@@s from templates.
20 [ ] Seems we are double html escape the body of a bug.
21 [ ] We are escaping when we insert in database _and_ when we output on screen!
22 What should we do?
23 [ ] Bug number is not race free allocated!
24 [ ]
25
19 26
20 27 == Medium == == Medium ==
28 [ ] If we do ssh without any command, be nice and show how to clone,
29 show projects, rights etc. CHeck ssh.inc.php.
30 [ ] Enforce Signoff-by lines per project (a new permission)
31 = reject commits without signoff!
32 Maybe, do it generic, allow a text field to enumerate what should be in a commit!
33 Also, present a list with checkboxex: at least Signoff-by, Reported-by, Acked-by!
21 34 [ ] Linus on why GitHub sucks: https://github.com/torvalds/linux/pull/17#issuecomment-5654674 [ ] Linus on why GitHub sucks: https://github.com/torvalds/linux/pull/17#issuecomment-5654674
22 35 [ ] Warn if commit messages are too long (no wrap). [ ] Warn if commit messages are too long (no wrap).
23 36 [ ] Allow possibility to send an e-mail to mainteiner from web with a pull request [ ] Allow possibility to send an e-mail to mainteiner from web with a pull request
24 37 [ ] Check https://github.com/torvalds/linux/pull/17#issuecomment-5654674 [ ] Check https://github.com/torvalds/linux/pull/17#issuecomment-5654674
25 38 [ ] Merge requests e-mail: explanation of why to pull, diffstat! Maybe also the patch if is small. [ ] Merge requests e-mail: explanation of why to pull, diffstat! Maybe also the patch if is small.
26 39 [ ] Check git-request-pull [ ] Check git-request-pull
40 [ ] Show the size of a repository. Also when you ssh from terminal.
41 See git-count-objects and http://stackoverflow.com/questions/8185276/find-size-of-git-repo.
42 [ ] Logo for project.
43 [ ] Default branch per project[/user].
44 [ ] Main language of the project.
45 [ ] Web site for a project.
46 [ ]
27 47
28 48 == Normal priority == == Normal priority ==
49 [ ] Add hint about "ssh rocketgit@server" to quickly find status etc.
50 [ ] rg_redirect does not record profiling information!
51 [ ] git bundle
29 52 [ ] How to sign merge requests?! [ ] How to sign merge requests?!
30 53 [ ] Signal, with red, if a key was uploaded in the last X days. [ ] Signal, with red, if a key was uploaded in the last X days.
31 54 [ ] Store in a cookie the last uid used, and if > 0, lookup e-mail and prefill [ ] Store in a cookie the last uid used, and if > 0, lookup e-mail and prefill
File inc/admin/users/user.form.php changed (mode: 100644) (index 47f82d4..d420d67)
... ... if ($admin_mode == 1) {
8 8 $sel_is_admin[$is_admin] = " selected=\"selected\""; $sel_is_admin[$is_admin] = " selected=\"selected\"";
9 9 } }
10 10
11 if (count($errmsg) > 0)
12 $_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n";
11 $_form .= rg_template_errmsg($errmsg);
13 12
14 13 $_form .= ' $_form .= '
15 14 <form method="post" action="' . rg_re_post($cop) . '"> <form method="post" action="' . rg_re_post($cop) . '">
File inc/bug.inc.php changed (mode: 100644) (index 1fb7fe9..1eb5d7b)
... ... function rg_bug_error()
20 20 return $rg_bug_error; return $rg_bug_error;
21 21 } }
22 22
23 /*
24 * This is valled from rg_repo_add
25 */
26 function rg_bug_add_max($db, $repo_id)
27 {
28 rg_prof_start("bug_add_max");
29
30 $sql = "INSERT INTO bugs_max (repo_id, last_bug_id)"
31 . " VALUES ($repo_id, 0)";
32 $res = rg_sql_query($db, $sql);
33 if ($res === FALSE) {
34 rg_bug_set_error("cannot init bug max (" . rg_sql_error() . ")");
35 return FALSE;
36 }
37 rg_sql_free_result($res);
38
39 rg_prof_end("bug_add_max");
40
41 return TRUE;
42 }
43
23 44 /* /*
24 45 * We want the bug number to be consecutive per project. * We want the bug number to be consecutive per project.
25 * TODO: Big race here, two people can insert the get the same id!
46 * This is why we use a separate table (bugs_max) to track last id.
47 * This function must be inside a transaction.
26 48 */ */
27 49 function rg_bug_next_id($db, $repo_id) function rg_bug_next_id($db, $repo_id)
28 50 { {
29 51 rg_prof_start("bug_next_id"); rg_prof_start("bug_next_id");
30 52
31 $sql = "SELECT MAX(bug_id) + 1 AS max FROM bugs"
32 . " WHERE repo_id = $repo_id";
53 $sql = "UPDATE bugs_max SET last_bug_id = last_bug_id + 1"
54 . " WHERE repo_id = $repo_id"
55 . " RETURNING last_bug_id AS next_bug_id";
33 56 $res = rg_sql_query($db, $sql); $res = rg_sql_query($db, $sql);
34 57 if ($res === FALSE) { if ($res === FALSE) {
35 rg_bug_set_error("cannot get max (" . rg_sql_error() . ")");
36 return $ret;
58 rg_bug_set_error("cannot get/update max (" . rg_sql_error() . ")");
59 return FALSE;
37 60 } }
38 61 $row = rg_sql_fetch_array($res); $row = rg_sql_fetch_array($res);
39 rg_log("DEBUG: max=" . $row['max']);
62 $next_bug_id = $row['next_bug_id'];
63 rg_log("\tDEBUG: next_bug_id=" . $next_bug_id);
40 64 rg_sql_free_result($res); rg_sql_free_result($res);
41 65
42 66 rg_prof_end("bug_next_id"); rg_prof_end("bug_next_id");
43 67
44 return empty($row['max']) ? 1 : $row['max'];
68 return $next_bug_id;
69 }
70
71 /*
72 * Helper function to populate some fields for a bug
73 */
74 function rg_bug_cosmetic($db, &$row)
75 {
76 $_ui = rg_user_info($db, $row['uid'], "", "");
77 if ($_ui['exists'] != 1)
78 $row['owner'] = "?";
79 else
80 $row['owner'] = $_ui['username'];
81
82 $row['HTML:body'] = nl2br($row['body']);
83 unset($row['body']);
84 $row['creation'] = gmdate("Y-m-d H:i", $row['itime']);
85
86 if ($row['utime'] > 0)
87 $row['updated'] = gmdate("Y-m-d H:i", $row['utime']);
88 else
89 $row['updated'] = "-";
90
91 $row['assigned_to'] = "-";
92 if ($row['assigned_uid'] > 0) {
93 $_ui = rg_user_info($db, $row['assigned_uid'], "", "");
94 if ($_ui['exists'] == 1)
95 $row['assigned_to'] = $_ui['username'];
96 }
45 97 } }
46 98
47 99 /* /*
 
... ... function rg_bug_info($db, $repo_id, $bug_id)
84 136 $row['exists'] = 1; $row['exists'] = 1;
85 137 $row['ok'] = 1; $row['ok'] = 1;
86 138
139 rg_bug_cosmetic($db, $row);
140
87 141 $rg_bug_info_cache[$key] = $row; $rg_bug_info_cache[$key] = $row;
88 142
89 143 rg_prof_end("bug_info"); rg_prof_end("bug_info");
 
... ... function rg_bug_add($db, $repo_id, $uid, $data)
111 165 $itime = time(); $itime = time();
112 166 $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ""; $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : "";
113 167
114 $bug_id = rg_bug_next_id($db, $repo_id);
115 if ($bug_id == 0)
116 return FALSE;
168 $ret = FALSE;
169 $rollback = 0;
170 do {
171 if (rg_sql_begin($db) !== TRUE)
172 break;
173
174 $rollback = 1;
175
176 $bug_id = rg_bug_next_id($db, $repo_id);
177 if ($bug_id === FALSE)
178 break;
179
180 $err = rg_bug_label_insert($db, $repo_id, $bug_id, $data['labels']);
181 if ($err !== TRUE)
182 break;
183
184 $sql = "INSERT INTO bugs force_fail_to_test_consecutive_bug_id (bug_id, itime, utime, repo_id, uid, ip"
185 . ", title, body, assigned_uid, deleted)"
186 . " VALUES ($bug_id, $itime, 0, $repo_id, $uid, '$ip'"
187 . ", '" . $e_data['title'] . "'"
188 . ", '" . $e_data['body'] . "'"
189 . ", " . $e_data['assigned_uid']
190 . ", 0)";
191 $res = rg_sql_query($db, $sql);
192 if ($res === FALSE) {
193 rg_bug_set_error("Cannot insert bug (" . rg_sql_error() . ")");
194 break;
195 }
196 rg_sql_free_result($res);
117 197
118 $sql = "INSERT INTO bugs (bug_id, itime, utime, repo_id, uid, ip"
119 . ", title, body, labels, state, assigned_uid, deleted)"
120 . " VALUES ($bug_id, $itime, 0, $repo_id, $uid, '$ip'"
121 . ", '" . $e_data['title'] . "'"
122 . ", '" . $e_data['body'] . "'"
123 . ", '" . $e_data['labels'] . "'"
124 . ", " . $e_data['state']
125 . ", " . $e_data['assigned_uid']
126 . ", 0)";
127 $res = rg_sql_query($db, $sql);
128 if ($res === FALSE) {
129 rg_bug_set_error("Cannot insert bug (" . rg_sql_error() . ")");
130 return FALSE;
131 }
132 rg_sql_free_result($res);
198 if (rg_sql_commit($db) === FALSE) {
199 rg_bug_set_error("Cannot commit (" . rg_sql_error() . ")");
200 break;
201 }
202
203 $ret = $bug_id;
204 $rollback = 0;
205 } while (0);
206
207 if ($rollback == 1)
208 rg_sql_rollback($db);
133 209
134 210 rg_prof_end("bug_add"); rg_prof_end("bug_add");
135 211
136 return $bug_id;
212 return $ret;
137 213 } }
138 214
139 215 /* /*
 
... ... function rg_bug_update($db, $repo_id, $bug_id, $data)
184 260 $e_data = $data; $e_data = $data;
185 261 $e_data['title'] = rg_sql_escape($db, $data['title']); $e_data['title'] = rg_sql_escape($db, $data['title']);
186 262 $e_data['body'] = rg_sql_escape($db, $data['body']); $e_data['body'] = rg_sql_escape($db, $data['body']);
187 $e_data['labels'] = rg_sql_escape($db, $data['labels']);
188 263
189 264 $utime = time(); $utime = time();
190 265
 
... ... function rg_bug_list_query($db, $url, $sql)
225 300
226 301 $d = array(); $d = array();
227 302 while (($row = rg_sql_fetch_array($res))) { while (($row = rg_sql_fetch_array($res))) {
228 $_line = array();
229
230 foreach ($row as $k => $v)
231 $_line[$k] = $v;
232
233 $_ui = rg_user_info($db, $row['uid'], "", "");
234 if ($_ui['exists'] != 1)
235 $_line['owner'] = "?";
236 else
237 $_line['owner'] = $_ui['username'];
238
239 $_line['body'] = nl2br(htmlspecialchars($row['body']));
240 $_line['creation'] = gmdate("Y-m-d", $row['itime']);
241 $_line['updated'] = gmdate("Y-m-d", $row['utime']);
242
243 if ($row['assigned_uid'] == 0) {
244 $_line['assigned_to'] = "-";
245 } else {
246 $_ui = rg_user_info($db, $row['assigned_uid'], "", "");
247 if ($_ui['exists'] != 1) {
248 $_line['assigned_to'] = "?";
249 } else {
250 $_line['assigned_to'] = $_ui['username'];
251 }
252 }
253
254 $d[] = $_line;
303 rg_bug_cosmetic($db, $row);
304 $row['url_bug'] = $url . "/bug/" . $row['bug_id'];
305 $d[] = $row;
255 306 } }
256 307 rg_sql_free_result($res); rg_sql_free_result($res);
257 308
258 309 rg_prof_end("bug_list_query"); rg_prof_end("bug_list_query");
259 310
260 return rg_template_table("bug/list", $d, array());
311 return rg_template_table("repo/bug/list", $d, array());
261 312 } }
262 313
263 314 /* /*
 
... ... function rg_bug_list($db, $url, $repo_id)
269 320
270 321 $sql = "SELECT * FROM bugs" $sql = "SELECT * FROM bugs"
271 322 . " WHERE repo_id = $repo_id" . " WHERE repo_id = $repo_id"
323 . " AND deleted = 0"
272 324 . " ORDER BY itime"; . " ORDER BY itime";
273 325
274 326 return rg_bug_list_query($db, $url, $sql); return rg_bug_list_query($db, $url, $sql);
 
... ... function rg_bug_search($db, $q)
286 338 $sql = "SELECT * FROM bugs" $sql = "SELECT * FROM bugs"
287 339 . " WHERE deleted = 0" . " WHERE deleted = 0"
288 340 . " AND (title ILIKE '%$e_q%' OR body ILIKE '%$e_q%')" . " AND (title ILIKE '%$e_q%' OR body ILIKE '%$e_q%')"
341 . " AND deleted = 0"
289 342 . " ORDER BY itime" . " ORDER BY itime"
290 343 . " LIMIT 10"; . " LIMIT 10";
291 344
 
... ... function rg_bug_note_add($db, $repo_id, $bug_id, $uid, $data)
326 379 return TRUE; return TRUE;
327 380 } }
328 381
382 /*
383 * List notes for a bug
384 */
385 function rg_bug_note_list($db, $repo_id, $bug_id, $offset)
386 {
387 rg_prof_start("bug_note_list");
388
389 rg_log("bug_note_list: repo_id=$repo_id bug_id=$bug_id");
390
391 // TODO: test if user is allowed to see a note
392
393 $sql = "SELECT * FROM bug_notes"
394 . " WHERE repo_id = $repo_id"
395 . " AND bug_id = $bug_id"
396 . " ORDER BY itime"
397 . " LIMIT 20 OFFSET $offset";
398 $res = rg_sql_query($db, $sql);
399 if ($res === FALSE) {
400 rg_bug_set_error("Cannot select bug notes (" . rg_sql_error() . ")");
401 return FALSE;
402 }
403
404 $data = array();
405 while (($row = rg_sql_fetch_array($res))) {
406 $row['creation'] = gmdate("Y-m-d H:i", $row['itime']);
407
408 $_ui = rg_user_info($db, $row['uid'], "", "");
409 if ($_ui['exists'] == 1)
410 $row['owner'] = $_ui['username'];
411 else
412 $row['owner'] = "?";
413
414 $row['HTML:note'] = nl2br($row['note']);
415 unset($row['note']);
416
417 $data[] = $row;
418 }
419 rg_sql_free_result($res);
420
421 rg_prof_end("bug_note_list");
422
423 return $data;
424 }
425
426 /* LABELS */
427
428 /*
429 * Build an array from a string of labels
430 */
431 function rg_bug_label_string2array($s)
432 {
433 $ret = array();
434
435 $s = preg_replace('/\w/', ',', $s);
436 $list = explode(",", $s);
437 if (empty($list))
438 return array();
439
440 foreach ($list as $label)
441 $ret[] = trim($label);
442
443 return $ret;
444 }
445
446 /*
447 * Builds a string of labels, from an array
448 */
449 function rg_bug_label_array2string($a)
450 {
451 return implode(",", $a);
452 }
453
454 /*
455 * Returns labels that are in the first set but not in the second
456 */
457 function rg_bug_label_diff($a, $b)
458 {
459 $ret = array();
460
461 if (empty($a))
462 return array();
463
464 foreach ($a as $label)
465 if (!isset($b[$label]))
466 $ret[] = $label;
467
468 return $ret;
469 }
470
471 /*
472 * Get all labels for a project
473 */
474 function rg_bug_label_get($db, $repo_id, $bug_id)
475 {
476 $ret = array();
477
478 $sql = "SELECT DISTINCT label FROM bug_labels"
479 . " WHERE repo_id = $repo_id"
480 . " AND bug_id = $bug_id";
481 $res = rg_sql_query($db, $sql);
482 if ($res === FALSE) {
483 rg_bug_set_error("Cannot select labels (" . rg_sql_error() . ")");
484 return FALSE;
485 }
486 while (($row = rg_sql_fetch_array($res)))
487 $ret[] = $row['label'];
488 rg_sql_free_result($res);
489
490 return $ret;
491 }
492
493 /*
494 * Inserts labels
495 */
496 function rg_bug_label_insert($db, $repo_id, $bug_id, $labels)
497 {
498 rg_prof_start("bug_label_insert");
499
500 $labels = rg_bug_label_string2array($labels);
501 if (empty($labels))
502 return TRUE;
503
504 $existing = rg_bug_label_get($db, $repo_id, $bug_id);
505 if ($existing === FALSE)
506 return FALSE;
507
508 $diff = rg_bug_label_diff($labels, $existing);
509 if (empty($diff))
510 return TRUE;
511
512 $ret = TRUE;
513 foreach ($diff as $label) {
514 $e_label = rg_sql_escape($db, $label);
515 $sql = "INSERT INTO bug_labels (repo_id, bug_id, label)"
516 . " VALUES ($repo_id, $bug_id, '$e_label')";
517 $res = rg_sql_query($db, $sql);
518 if ($res === FALSE) {
519 rg_bug_set_error("Cannot insert label (" . rg_sql_error() . ")");
520 $ret = FALSE;
521 break;
522 }
523 rg_sql_free_result($res);
524 }
525
526 rg_prof_end("bug_label_insert");
527
528 return $ret;
529 }
530
329 531 ?> ?>
File inc/feedback/suggestion.form.php changed (mode: 100644) (index cb8c765..8ae813e)
... ... $_form = '<div class="formarea">' . "\n";
3 3
4 4 $_form .= '<div class="formarea_title">Send a suggestion</div><br />' . "\n"; $_form .= '<div class="formarea_title">Send a suggestion</div><br />' . "\n";
5 5
6 if (count($errmsg) > 0)
7 $_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n";
6 $_form .= rg_template_errmsg($errmsg);
8 7
9 8 $_form .= ' $_form .= '
10 9 <form method="post" action="' . rg_re_post($cop) . '"> <form method="post" action="' . rg_re_post($cop) . '">
File inc/git.inc.php changed (mode: 100644) (index 02bcad4..bc4d1b2)
... ... function rg_git_whitespace_ok($old, $new)
267 267 . " " . escapeshellarg($old) . " " . escapeshellarg($old)
268 268 . " " . escapeshellarg($new); . " " . escapeshellarg($new);
269 269 $a = rg_exec($cmd); $a = rg_exec($cmd);
270 rg_log("\ta:" . print_r($a, TRUE));
270 rg_log("\ta:" . rg_array2string($a));
271 271 if ($a['ok'] != 1) { if ($a['ok'] != 1) {
272 272 rg_git_set_error("error on diff (" . $a['errmsg'] . ")"); rg_git_set_error("error on diff (" . $a['errmsg'] . ")");
273 273 $ret = $a['data']; $ret = $a['data'];
 
... ... function rg_git_ls_tree($tree, $path)
387 387
388 388 rg_prof_end("git_ls_tree"); rg_prof_end("git_ls_tree");
389 389
390 // We are forced to use print_r instead of array2string because
391 // it may be a multilevel array.
390 392 rg_log("DEBUG: ls-tree: " . print_r($ret, TRUE)); rg_log("DEBUG: ls-tree: " . print_r($ret, TRUE));
391 393
392 394 return $ret; return $ret;
 
... ... function rg_git_stats($log)
683 685 * Nice diff per file * Nice diff per file
684 686 * Outputs the result of replacing variables in a template with real variables * Outputs the result of replacing variables in a template with real variables
685 687 * @a - output of rg_git_diff2array[index] * @a - output of rg_git_diff2array[index]
686 * TODO: Switch to r66_template_table?
688 * TODO: Switch to rg_template_table?
687 689 */ */
688 690 function rg_git_diff($a, $template_file) function rg_git_diff($a, $template_file)
689 691 { {
690 rg_log("git_diff: a: " . print_r($a, TRUE));
692 rg_log("git_diff: a: " . rg_array2string($a));
691 693
692 694 $ret = "<div class=\"diff\">\n"; $ret = "<div class=\"diff\">\n";
693 695
 
... ... function rg_git_diff($a, $template_file)
696 698 // for each file changed // for each file changed
697 699 foreach ($a as $fileindex => $finfo) { foreach ($a as $fileindex => $finfo) {
698 700 if (!isset($finfo['file'])) if (!isset($finfo['file']))
699 rg_log("BAD finfo:" . print_r($finfo, TRUE));
701 rg_log("BAD finfo:" . rg_array2string($finfo));
700 702
701 703 $ret .= "<br />\n"; $ret .= "<br />\n";
702 704
 
... ... function rg_git_branches_and_tags($repo_dir, $base_url, $current_ref)
1005 1007 $ret['HTML:branches_and_tags'] .= implode("\n", $_l); $ret['HTML:branches_and_tags'] .= implode("\n", $_l);
1006 1008 $ret['HTML:branches_and_tags'] .= "</div>\n"; $ret['HTML:branches_and_tags'] .= "</div>\n";
1007 1009
1008 rg_log("rg_git_branches_and_tags: ret:" . print_r($ret, TRUE));
1010 rg_log("rg_git_branches_and_tags: ret:" . rg_array2string($ret));
1009 1011
1010 1012 return $ret; return $ret;
1011 1013 } }
 
... ... function rg_git_diff_tree($tree1, $tree2)
1084 1086
1085 1087 rg_prof_end("git_diff_tree"); rg_prof_end("git_diff_tree");
1086 1088
1087 rg_log("DEBUG: diff-tree: " . print_r($ret, TRUE));
1089 rg_log("DEBUG: diff-tree: " . rg_array2string($ret));
1088 1090
1089 1091 return $ret; return $ret;
1090 1092 } }
File inc/keys.inc.php changed (mode: 100644) (index d383682..99ca553)
... ... function rg_keys_add($db, $rg_ui, $key)
144 144 } }
145 145
146 146 $sql = "INSERT INTO keys (itime, uid, key)" $sql = "INSERT INTO keys (itime, uid, key)"
147 . " VALUES ($itime, " . $rg_ui['uid'] . ", '$e_key')";
147 . " VALUES ($itime, " . $rg_ui['uid'] . ", '$e_key')"
148 . " RETURNING key_id";
148 149 $res = rg_sql_query($db, $sql); $res = rg_sql_query($db, $sql);
149 150 if ($res === FALSE) { if ($res === FALSE) {
150 151 rg_keys_set_error("Cannot insert key (" . rg_sql_error() . ")"); rg_keys_set_error("Cannot insert key (" . rg_sql_error() . ")");
151 152 return FALSE; return FALSE;
152 153 } }
154 $row = rg_sql_fetch_array($res);
155 $id = $row['key_id'];
153 156 rg_sql_free_result($res); rg_sql_free_result($res);
154 157
155 $id = rg_sql_last_id($db);
156
157 158 rg_prof_end("keys_add"); rg_prof_end("keys_add");
158 159
159 160 return $id; return $id;
File inc/log.inc.php changed (mode: 100644) (index 0247f02..8601be1)
... ... function rg_log($str)
33 33 } }
34 34
35 35 $t = gettimeofday(); $t = gettimeofday();
36 $buf = gmdate("Y-m-d H:i:s", $t['sec']) . "." . sprintf("%03u", $t['usec'] / 1000);
37 $buf .= " " . $rg_log_sid . " " . $str . "\n";
36
37 $a = explode("\n", $str);
38 $buf0 = gmdate("Y-m-d H:i:s", $t['sec']) . "." . sprintf("%03u", $t['usec'] / 1000);
39 $buf0 .= " " . $rg_log_sid . " ";
40 $buf = "";
41 foreach ($a as $line) {
42 // TODO: replace string chars with [HH]; use /e
43 $line = preg_replace('/[\\x00-\\x08\\x0a-\\x1f\\x7f-\\xff]/', "X", $line);
44 $buf .= $buf0 . $line . "\n";
45 }
38 46
39 47 if ($rg_log_fd !== NULL) if ($rg_log_fd !== NULL)
40 48 fwrite($rg_log_fd, $buf); fwrite($rg_log_fd, $buf);
41 49 } }
42 50
43 function r66_fatal($msg)
51 function rg_fatal($msg)
44 52 { {
45 53 rg_log("FATAL: $msg"); rg_log("FATAL: $msg");
46 54
File inc/login/login.form.php changed (mode: 100644) (index e9fa7cf..885d1f9)
1 1 <?php <?php
2 2 $_form = '<div class="formarea">' . "\n"; $_form = '<div class="formarea">' . "\n";
3 3
4 if (count($errmsg) > 0)
5 $_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n";
4 $_form .= rg_template_errmsg($errmsg);
6 5
7 6 $_form .= ' $_form .= '
8 7 <form method="post" action="' . rg_re_post($cop) . '"> <form method="post" action="' . rg_re_post($cop) . '">
File inc/repo.inc.php changed (mode: 100644) (index 80bcd9e..f3f2fa0)
... ... require_once($INC . "/user.inc.php");
6 6 require_once($INC . "/git.inc.php"); require_once($INC . "/git.inc.php");
7 7 require_once($INC . "/rights.inc.php"); require_once($INC . "/rights.inc.php");
8 8 require_once($INC . "/prof.inc.php"); require_once($INC . "/prof.inc.php");
9 require_once($INC . "/bug.inc.php");
9 10
10 11 $rg_repo_error = ""; $rg_repo_error = "";
11 12
 
... ... function rg_repo_create($db, $master, $rg_ui, $name, $max_commit_size,
241 242
242 243 $itime = time(); $itime = time();
243 244
244 $sql = "INSERT INTO repos (uid, master, name, itime"
245 . ", max_commit_size, description, git_dir_done, default_rights"
246 . ", max_users)"
247 . " VALUES (" . $rg_ui['uid'] . ", $master, '$e_name', $itime"
248 . ", $max_commit_size, '$e_description', 0, '$rights', $max_users)";
249 $res = rg_sql_query($db, $sql);
250 if ($res === FALSE) {
251 rg_repo_set_error("Cannot insert (" . rg_sql_error() . ")");
252 return FALSE;
253 }
254 rg_sql_free_result($res);
245 $ret = FALSE;
246 $rollback = 0;
247 do {
248 if (rg_sql_begin($db) === FALSE) {
249 rg_repo_set_error("cannot begin transaction to add a repo"
250 . " (" . rg_sql_error() . ")");
251 break;
252 }
253
254 $rollback = 1;
255
256 $sql = "INSERT INTO repos (uid, master, name, itime"
257 . ", max_commit_size, description, git_dir_done, default_rights"
258 . ", max_users)"
259 . " VALUES (" . $rg_ui['uid'] . ", $master, '$e_name', $itime"
260 . ", $max_commit_size, '$e_description', 0, '$rights', $max_users)"
261 . " RETURNING repo_id";
262 $res = rg_sql_query($db, $sql);
263 if ($res === FALSE) {
264 rg_repo_set_error("Cannot insert (" . rg_sql_error() . ")");
265 break;
266 }
267 $row = rg_sql_fetch_array($res);
268 $repo_id = $row['repo_id'];
269 rg_sql_free_result($res);
270
271 if (rg_bug_add_max($db, $repo_id)) {
272 rg_repo_set_error(rg_bug_error());
273 break;
274 }
275
276 if (rg_sql_commit($db) === FALSE) {
277 rg_repo_set_error("Cannot commit (" . rg_sql_error() . ")");
278 break;
279 }
280
281 $rollback = 0;
282 $ret = TRUE;
283 } while (0);
284
285 if ($rollback == 1)
286 rg_sql_rollback($db);
255 287
256 288 // git repo creation will be delayed for serialization reasons // git repo creation will be delayed for serialization reasons
257 // and for permission reasons (we are apache here)
289 // and for permission reasons (we are 'apache' user here)
258 290
259 291 rg_prof_end("repo_create"); rg_prof_end("repo_create");
260 292
261 return TRUE;
293 return $ret;
262 294 } }
263 295
264 296 /* /*
 
... ... function rg_repo_list_query($db, $url, $sql)
377 409 $_line['owner'] = $_ui['username']; $_line['owner'] = $_ui['username'];
378 410 $_line['url_repo'] = rg_re_repopage($_ui, $row['name']); $_line['url_repo'] = rg_re_repopage($_ui, $row['name']);
379 411 $_line['url_user'] = rg_re_userpage($_ui); $_line['url_user'] = rg_re_userpage($_ui);
380 $_line['HTML:description'] = nl2br(htmlspecialchars($row['description']));
412 $_line['HTML:description'] = nl2br($row['description']);
381 413
382 414 $master_repo = "-"; $master_repo = "-";
383 415 if ($row['master'] > 0) { if ($row['master'] > 0) {
File inc/repo/repo.form.php changed (mode: 100644) (index 4511afa..25a5efc)
1 1 <?php <?php
2 2 $_form = '<div class="formarea">' . "\n"; $_form = '<div class="formarea">' . "\n";
3 3
4 if (count($errmsg) > 0)
5 $_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n";
4 $_form .= rg_template_errmsg($errmsg);
6 5
7 6 $_form .= ' $_form .= '
8 7 <form method="post" action="' . rg_re_post($cop) . '"> <form method="post" action="' . rg_re_post($cop) . '">
File inc/repo/search.form.php changed (mode: 100644) (index f91f189..fd97b2a)
1 1 <?php <?php
2 2 $_form = '<div class="formarea">' . "\n"; $_form = '<div class="formarea">' . "\n";
3 3
4 if (count($errmsg) > 0)
5 $_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n";
4 $_form .= rg_template_errmsg($errmsg);
6 5
7 6 $_form .= ' $_form .= '
8 7 <form method="post" action="' . rg_re_post($cop) . '"> <form method="post" action="' . rg_re_post($cop) . '">
File inc/rights.inc.php changed (mode: 100644) (index e0ff1c4..23ba88a)
... ... function rg_rights_set($db, $type, $obj_id, $uid, $rights)
194 194 $r = rg_rights_get($db, $type, $obj_id, $uid); $r = rg_rights_get($db, $type, $obj_id, $uid);
195 195 if ($r['ok'] != 1) if ($r['ok'] != 1)
196 196 return $r; return $r;
197 rg_log("r: " . print_r($r, TRUE));
197 rg_log("r: " . rg_array2string($r));
198 198
199 199 if ($r['exists'] == 1) { if ($r['exists'] == 1) {
200 200 $sql = "UPDATE rights" $sql = "UPDATE rights"
File inc/sql.inc.php changed (mode: 100644) (index 886a074..e3a7ac5)
... ... function rg_sql_close($db)
115 115 function rg_sql_free_result($res) function rg_sql_free_result($res)
116 116 { {
117 117 if (!is_resource($res)) if (!is_resource($res))
118 r66_fatal("res is not resource!");
118 rg_fatal("res is not resource!");
119 119 pg_free_result($res); pg_free_result($res);
120 120 } }
121 121
 
... ... function rg_sql_commit($db)
169 169 return TRUE; return TRUE;
170 170 } }
171 171
172 function rg_sql_rollback($db)
173 {
174 $res = rg_sql_query($db, "ROLLBACK");
175 if ($res === FALSE)
176 return FALSE;
177
178 rg_sql_free_result($res);
179 return TRUE;
180 }
181
172 182 ?> ?>
File inc/ssh.inc.php added (mode: 100644) (index 0000000..d8f19c5)
1 <?php
2 //
3 // Description: This file deals with commands accepted by ssh
4 //
5 require_once($INC . "/sql.inc.php");
6 require_once($INC . "/state.inc.php");
7 require_once($INC . "/prof.inc.php");
8 require_once($INC . "/repo.inc.php");
9
10 function rg_ssh_status($db, $uid)
11 {
12 rg_log("ssh_status");
13
14 echo "Here will be the status.\n";
15
16 exit(0);
17 }
18
19 function rg_ssh_repos($db, $uid)
20 {
21 rg_log("ssh_repos");
22
23 echo "\n";
24 echo "Repositories (name, creation, disk used/quota):\n";
25 $sql = "SELECT * FROM repos"
26 . " WHERE uid = $uid"
27 . " AND deleted = 0"
28 . " ORDER BY name";
29 $pad = " ";
30 $res = rg_sql_query($db, $sql);
31 while (($row = rg_sql_fetch_array($res))) {
32 echo "\t" . substr(substr($row['name'], 0, 32) . $pad, 0, 32)
33 . "\t" . gmdate("Y-m-d", $row['itime'])
34 . "\t" . rg_1024($row['disk_used_mb']) . "/" . rg_1024($row['disk_quota_mb'])
35 . "\n";
36 }
37 rg_sql_free_result($res);
38
39 echo "\n";
40 exit(0);
41 }
42
43 function rg_ssh_dispatch($db, $uid, $cmd)
44 {
45 $cmd = explode(" ", $cmd, 2);
46
47 switch ($cmd[0]) {
48 case 'status': rg_ssh_status($db, $uid); break;
49 case 'repos': rg_ssh_repos($db, $uid); break;
50 case '':
51 echo "\nWelcome to RocketGit!\n\n";
52 echo "Available commmands: status, repos.\n";
53 echo "\n";
54 exit(0);
55 }
56 }
57
58 ?>
File inc/struct.inc.php changed (mode: 100644) (index 886ac19..7d64820)
... ... $rg_sql_struct[5]['tables'] = array(
121 121
122 122 $rg_sql_struct[6] = array(); $rg_sql_struct[6] = array();
123 123 $rg_sql_struct[6]['tables'] = array( $rg_sql_struct[6]['tables'] = array(
124 "bugs_max" => "CREATE TABLE bugs_max ("
125 . "repo_id INT NOT NULL PRIMARY KEY"
126 . ", last_bug_id INT NOT NULL"
127 . ")",
124 128 "bugs" => "CREATE TABLE bugs (" "bugs" => "CREATE TABLE bugs ("
125 129 . "repo_id INT NOT NULL" . "repo_id INT NOT NULL"
126 130 . ", bug_id INT NOT NULL" . ", bug_id INT NOT NULL"
 
... ... $rg_sql_struct[6]['tables'] = array(
130 134 . ", ip TEXT NOT NULL" . ", ip TEXT NOT NULL"
131 135 . ", title TEXT NOT NULL" . ", title TEXT NOT NULL"
132 136 . ", body TEXT NOT NULL" . ", body TEXT NOT NULL"
133 . ", labels TEXT NOT NULL"
134 . ", state INT NOT NULL"
135 137 . ", assigned_uid INT NOT NULL" . ", assigned_uid INT NOT NULL"
136 138 . ", deleted INT NOT NULL" . ", deleted INT NOT NULL"
137 139 . ")", . ")",
 
... ... $rg_sql_struct[6]['tables'] = array(
142 144 . ", itime INT NOT NULL" . ", itime INT NOT NULL"
143 145 . ", uid INT NOT NULL" . ", uid INT NOT NULL"
144 146 . ", ip TEXT NOT NULL" . ", ip TEXT NOT NULL"
147 . ")",
148 "bug_labels" => "CREATE TABLE bug_labels ("
149 . "repo_id INT NOT NULL"
150 . ", bug_id INT NOT NULL"
151 . ", label TEXT NOT NULL"
145 152 . ")" . ")"
146 153 ); );
147 154 $rg_sql_struct[6]['other'] = array( $rg_sql_struct[6]['other'] = array(
 
... ... $rg_sql_struct[6]['other'] = array(
149 156 . " ON bugs (repo_id, bug_id)", . " ON bugs (repo_id, bug_id)",
150 157 "bugs_index_itime" => "CREATE INDEX bugs_i_itime" "bugs_index_itime" => "CREATE INDEX bugs_i_itime"
151 158 . " ON bugs (itime)", . " ON bugs (itime)",
152 "bug_notes_index_repo_id_bug_id" => "CREATE UNIQUE INDEX bug_notes_i_repo_id_bug_id"
153 . " ON bug_notes (repo_id, bug_id)"
159 "bug_notes_index_repo_id_bug_id" => "CREATE INDEX bug_notes_i_repo_id_bug_id"
160 . " ON bug_notes (repo_id, bug_id)",
161 "bug_labels_index_repo_id_bug_id" => "CREATE INDEX bug_labels_i_repo_id_bug_id"
162 . " ON bug_labels (repo_id, bug_id)"
154 163 ); );
155 164
156 165 // This must be the last line // This must be the last line
 
... ... function rg_sql_struct_update_if_needed($db, $flags)
235 244 if (rg_lock("schema_upgrade.lock") === FALSE) if (rg_lock("schema_upgrade.lock") === FALSE)
236 245 return FALSE; return FALSE;
237 246
238 if (rg_sql_begin($db) !== TRUE)
239 return FALSE;
247 $ret = FALSE;
248 $rollback = 0;
249 do {
250 if (rg_sql_begin($db) !== TRUE)
251 break;
240 252
241 $r = rg_sql_struct_run($db, $flags, $old);
242 if ($r !== TRUE) {
243 rg_log("Cannot update schema (" . rg_sql_error() . ")");
244 return FALSE;
245 }
253 $rollback = 1;
246 254
247 $r = rg_state_set($db, "schema_version", $rg_sql_schema_ver);
248 if ($r !== TRUE) {
249 rg_log("Cannot update schema ver (" . rg_state_error() . ")");
250 return FALSE;
251 }
255 $r = rg_sql_struct_run($db, $flags, $old);
256 if ($r !== TRUE) {
257 rg_log("Cannot update schema (" . rg_sql_error() . ")");
258 break;
259 }
252 260
253 if (rg_sql_commit($db) !== TRUE)
254 return FALSE;
261 $r = rg_state_set($db, "schema_version", $rg_sql_schema_ver);
262 if ($r !== TRUE) {
263 rg_log("Cannot update schema ver (" . rg_state_error() . ")");
264 break;
265 }
266
267 if (rg_sql_commit($db) !== TRUE)
268 break;
269
270 $rollback = 0;
271 $ret = TRUE;
272 } while (0);
273
274 if ($rollback == 1)
275 rg_sql_rollback($db);
255 276
256 277 rg_unlock("schema_upgrade.lock"); rg_unlock("schema_upgrade.lock");
257 278
258 return TRUE;
279 return $ret;
259 280 } }
260 281 ?> ?>
File inc/user/forgot.form.php changed (mode: 100644) (index 76aa4f7..2066cd4)
1 1 <?php <?php
2 2 $_forgot_form = '<div class="formarea">' . "\n"; $_forgot_form = '<div class="formarea">' . "\n";
3 3
4 if (count($errmsg) > 0)
5 $_forgot_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n";
4 $_forgot_form .= rg_template_errmsg($errmsg);
6 5
7 6 $_forgot_form .= ' $_forgot_form .= '
8 7 <form method="post" action="' . rg_re_post($cop) . '"> <form method="post" action="' . rg_re_post($cop) . '">
File inc/user/forgot_send.form.php changed (mode: 100644) (index 1a25042..22f8399)
1 1 <?php <?php
2 2 $_form = '<div class="formarea">' . "\n"; $_form = '<div class="formarea">' . "\n";
3 3
4 if (count($errmsg) > 0)
5 $_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n";
4 $_form .= rg_template_errmsg($errmsg);
6 5
7 6 $_form .= ' $_form .= '
8 7 <form method="post" action="' . rg_re_post($cop . "/forgot_send") . '"> <form method="post" action="' . rg_re_post($cop . "/forgot_send") . '">
File inc/user/keys/add.form.php changed (mode: 100644) (index 9fbb6ea..93d03a1)
... ... $_form = '<div class="formarea">' . "\n";
4 4
5 5 $_form .= "<div class=\"formarea_title\">Add a new ssh key</div><br />\n"; $_form .= "<div class=\"formarea_title\">Add a new ssh key</div><br />\n";
6 6
7 if (count($errmsg) > 0)
8 $_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n";
7 $_form .= rg_template_errmsg($errmsg);
9 8
10 9 $_form .= ' $_form .= '
11 10 <form method="post" action="' . rg_re_post($cop) . '"> <form method="post" action="' . rg_re_post($cop) . '">
File inc/user/pass/pass.form.php changed (mode: 100644) (index 0e4b71b..000930e)
... ... $_chpass_form = '<div class="formarea">' . "\n";
3 3
4 4 $_chpass_form .= '<div class="formarea_title">Change password</div><br />' . "\n"; $_chpass_form .= '<div class="formarea_title">Change password</div><br />' . "\n";
5 5
6 if (count($errmsg) > 0)
7 $_chpass_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n";
6 $_chpass_form .= rg_template_errmsg($errmsg);
8 7
9 8 $_chpass_form .= ' $_chpass_form .= '
10 9 <form method="post" action="' . rg_re_post($cop) . '"> <form method="post" action="' . rg_re_post($cop) . '">
File inc/user/repo-page.php changed (mode: 100644) (index 3899721..c5d647d)
... ... if (empty($subop))
50 50
51 51 $_more['repo_body'] = ""; $_more['repo_body'] = "";
52 52 $_more['repo_right'] = ""; $_more['repo_right'] = "";
53 $_more['branches_and_tags'] = "";
53 54 $_repo_body = ""; $_repo_body = "";
54 55 $_repo_right = ""; $_repo_right = "";
55 56
 
... ... if (strcmp($subop, "admin") == 0) {
68 69
69 70 $bt = rg_git_branches_and_tags($repo_dir, $_more['url_repo'], $bt = rg_git_branches_and_tags($repo_dir, $_more['url_repo'],
70 71 $type_ref['ref_url']); $type_ref['ref_url']);
71 rg_log("DEBUG: _more: " . print_r($_more, TRUE));
72 rg_log("DEBUG: _more: " . rg_array2string($_more));
72 73 $_more = array_merge($_more, $bt); $_more = array_merge($_more, $bt);
73 74
74 75 $_repo_body .= rg_template("repo/source.html", $_more); $_repo_body .= rg_template("repo/source.html", $_more);
 
... ... if (strcmp($subop, "admin") == 0) {
89 90 $_hash = $_tree[0]['ref']; $_hash = $_tree[0]['ref'];
90 91 $c = rg_git_content($_hash); $c = rg_git_content($_hash);
91 92 $_content = array( $_content = array(
92 "obj" => $obj,
93 "hash" => $_hash,
93 94 "HTML:content" => rg_template_list($c) "HTML:content" => rg_template_list($c)
94 95 ); );
95 96 $blob = array_merge($blob, $_content); $blob = array_merge($blob, $_content);
 
... ... if (strcmp($subop, "admin") == 0) {
142 143 } }
143 144
144 145 $log = rg_git_log(1, $first, $second, TRUE); $log = rg_git_log(1, $first, $second, TRUE);
145 rg_log("log: " . print_r($log, TRUE));
146 rg_log("log: " . rg_array2string($log));
146 147
147 148 // stats // stats
148 149 $_repo_body .= rg_git_files_stats($log[0]['files'], "repo/fstat"); $_repo_body .= rg_git_files_stats($log[0]['files'], "repo/fstat");
 
... ... if (strcmp($subop, "admin") == 0) {
153 154 } }
154 155 } }
155 156 $_repo_right = rg_template("repo/source_r.html", $_more); $_repo_right = rg_template("repo/source_r.html", $_more);
156 } else if (strcmp($subop, "issues") == 0) {
157 $_repo_body .= rg_template("repo/issues.html", $_more);
157 } else if (strcmp($subop, "bug") == 0) {
158 include($INC . "/user/repo/bug/main.php");
159 $_repo_body .= rg_template("repo/bug/main.html", $_more);
158 160 } else if (strcmp($subop, "stats") == 0) { } else if (strcmp($subop, "stats") == 0) {
159 161 $_repo_body .= rg_template("repo/stats.html", $_more); $_repo_body .= rg_template("repo/stats.html", $_more);
160 162 } else if (strcmp($subop, "mrs") == 0) { } else if (strcmp($subop, "mrs") == 0) {
File inc/user/repo/bug/add/add.php added (mode: 100644) (index 0000000..23dd3a0)
1 <?php
2 rg_log("/inc/repo/bug/add/add");
3
4 $bug_more = $_more;
5 $_bug_add = "";
6 $bug_errmsg = array();
7
8 $_x = array();
9 if ($doit == 0) {
10 // defaults
11 $_x['title'] = "";
12 $_x['body'] = "";
13 $_x['labels'] = "";
14 $_x['assigned_to'] = 0;
15 } else {
16 $_x['title'] = rg_var_str("title");
17 $_x['body'] = rg_var_str("body");
18 $_x['labels'] = rg_var_str("labels");
19 $_x['assigned_uid'] = 0;
20
21 while (1) {
22 if (!rg_token_valid($db, $sid, rg_var_str("token"))) {
23 $bug_errmsg[] = "Invalid token. Try again.";
24 break;
25 }
26
27 if (empty($_x['title'])) {
28 $bug_errmsg[] = "Title too short.";
29 break;
30 }
31
32 $bug_id = rg_bug_add($db, $ri['repo_id'], $ui['uid'], $_x);
33 if ($bug_id === FALSE) {
34 $bug_errmsg[] = "Cannot add bug (" . rg_bug_error() . ").";
35 break;
36 }
37
38 // redirect to bug home
39 $url = rg_re_bugpage($rg_ui, $ri, $bug_id);
40 rg_redirect($url);
41 }
42 }
43
44 $bug_more = array_merge($bug_more, $_x);
45 $bug_more['HTML:bug_errmsg'] = rg_template_errmsg($bug_errmsg);
46 $bug_more['bug_action'] = "Add bug";
47 $bug_more['rg_action'] = rg_re_post($cop);
48 $bug_more['rg_form_token'] = rg_token_get($db, $sid);
49 $_bug_add .= rg_template("repo/bug/bug_add.html", $bug_more);
50 ?>
File inc/user/repo/bug/main.php added (mode: 100644) (index 0000000..4ef8ebf)
1 <?php
2 rg_log("/inc/user/repo/bug/main");
3
4 $_bug_body = "";
5
6 $_op = isset($paras[0]) ? $paras[0] : "";
7 switch ($_op) {
8 case 'add':
9 include($INC . "/user/repo/bug/add/add.php");
10 $_bug_body .= $_bug_add;
11 break;
12
13 case '': /* list */
14 $r = rg_bug_list($db, $_more['url_repo'], $ri['repo_id']);
15 if ($r === FALSE)
16 $_bug_body .= "Error!"; // TODO: do something OK here!
17 else
18 $_bug_body .= $r;
19 break;
20
21 default: // go directly to a bug
22 $bug_id = intval($_op);
23 if ($bug_id == 0) {
24 rg_log("BAD, invalid op=$_op!");
25 } else {
26 include($INC . "/user/repo/bug/show.php");
27 $_bug_body .= $_bug_show;
28 }
29 }
30
31 $_more['HTML:bug_body'] = $_bug_body;
32 ?>
File inc/user/repo/bug/show.php added (mode: 100644) (index 0000000..dc97f45)
1 <?php
2 rg_log("/inc/user/repo/bug/show");
3
4 $_bug_show = "";
5
6 $ibug = rg_bug_info($db, $ri['repo_id'], $bug_id);
7 if ($ibug['exists'] != 1)
8 die("TODO: Invalid bug (" . rg_bug_error() . ")!"); // TODO: do not use die!
9
10 $_tmp = array_merge($_more, $ibug);
11
12 // insert?
13 $doit = rg_var_uint("doit");
14 $note_errmsg = array();
15 if ($doit == 0) {
16 // default values
17 $_tmp['note'] = "";
18 } else {
19 while (1) {
20 $token = rg_var_str("token");
21 $note = rg_var_str("note");
22
23 if (!rg_token_valid($db, $sid, $token)) {
24 $note_errmsg[] = "Invalid token. Try again.";
25 break;
26 }
27
28 if (empty($note)) {
29 $note_errmsg[] = "Cannot be empty";
30 break;
31 }
32
33 // add note
34 $_d = array();
35 $_d['note'] = $note;
36 $ret = rg_bug_note_add($db, $ri['repo_id'], $bug_id, $rg_ui['uid'], $_d);
37 if ($ret === FALSE) {
38 $note_errmsg[] = "Cannot add note (" . rg_bug_error() . ")";
39 break;
40 }
41
42 // prepare form for other note
43 $_tmp['note'] = "";
44 break;
45 }
46 }
47
48 // load notes
49 $notes = rg_bug_note_list($db, $ri['repo_id'], $bug_id, 0);
50 if ($notes === FALSE)
51 $_tmp['HTML:notes'] = "Cannot load notes!";
52 else
53 $_tmp['HTML:notes'] = rg_template_table("repo/bug/list_note", $notes, array());
54
55 // add note form
56 if (empty($note_errmsg))
57 $_tmp['HTML:note_errmsg'] = "";
58 else
59 $_tmp['HTML:note_errmsg'] = rg_template_errmsg($note_errmsg);
60
61 $_tmp['rg_action'] = rg_re_post($cop);
62 $_tmp['rg_form_token'] = rg_token_get($db, $sid);
63 $_tmp['HTML:note_add'] = rg_template("repo/bug/note_add.html", $_tmp);
64
65 $_bug_show .= rg_template("repo/bug/show.html", $_tmp);
66 ?>
File inc/user/repo/rights/rights.form.php changed (mode: 100644) (index c08c3b0..3895d0a)
1 1 <?php <?php
2 2 $_form = '<div class="formarea">' . "\n"; $_form = '<div class="formarea">' . "\n";
3 3
4 if (count($errmsg) > 0)
5 $_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n";
4 $_form .= rg_template_errmsg($errmsg);
6 5
7 6 $_form .= ' $_form .= '
8 7 <form method="post" action="' . rg_re_post($cop) . '"> <form method="post" action="' . rg_re_post($cop) . '">
File inc/util.inc.php changed (mode: 100644) (index e0c87ea..3a1e284)
... ... function rg_re_repopage($ui, $repo)
166 166 return $_SERVER['PHP_SELF'] . "?vv=$s"; return $_SERVER['PHP_SELF'] . "?vv=$s";
167 167 } }
168 168
169 function rg_re_bugpage($ui, $ri, $bug_id)
170 {
171 if (!isset($ui['organization'])) {
172 rg_internal_error("rg_re_repopage called with wrong ui!");
173 exit(1);
174 }
175
176 $s = rg_re_userpage($ui) . "/" . $ri['name'] . "/bug/" . $bug_id;
177
178 if (isset($_REQUEST['rwe']))
179 return $s;
180
181 return $_SERVER['PHP_SELF'] . "?vv=$s";
182 }
183
169 184 function rg_re_repo_ssh($rr) function rg_re_repo_ssh($rr)
170 185 { {
171 186 global $rg_ssh_port; global $rg_ssh_port;
 
... ... function rg_prepare_conditionals(&$data, &$what, &$values)
343 358 function rg_prepare_replace(&$data, &$what, &$values) function rg_prepare_replace(&$data, &$what, &$values)
344 359 { {
345 360 if (!empty($data)) { if (!empty($data)) {
361 if (!is_array($data))
362 rg_internal_error("invalid type passed");
346 363 foreach ($data as $k => $v) { foreach ($data as $k => $v) {
347 364 if (strncmp($k, "HTML:", 5) == 0) { if (strncmp($k, "HTML:", 5) == 0) {
348 365 $k = substr($k, 5); $k = substr($k, 5);
 
... ... function rg_prepare_replace(&$data, &$what, &$values)
355 372 } }
356 373
357 374 $what['DUMP'] = "/@@DUMP@@/U"; $what['DUMP'] = "/@@DUMP@@/U";
358 $values['DUMP'] = print_r($data, TRUE);
375 $values['DUMP'] = htmlspecialchars(print_r($data, TRUE));
359 376
360 377 // we replace @@unknown@@ with empty // we replace @@unknown@@ with empty
361 378 //$what['FINAL'] = "/@@.*@@/U"; //$what['FINAL'] = "/@@.*@@/U";
 
... ... function rg_template_list($c)
459 476 return $ret; return $ret;
460 477 } }
461 478
479 /*
480 * Show errors using a template
481 */
482 function rg_template_errmsg($a)
483 {
484 $b = array();
485 foreach ($a as $junk => $err)
486 $b[] = array("error" => $err);
487 return rg_template_table("errmsg", $b, array());
488 }
489
462 490 /* /*
463 491 * Execute $cmd and returns the output as a string, binary safe * Execute $cmd and returns the output as a string, binary safe
464 492 */ */
 
... ... function rg_array2string($a)
515 543 if (empty($a)) if (empty($a))
516 544 return ""; return "";
517 545
546 $what = array("/\n/", "/\r/");
547 $values = array("\\n", "\\r");
548
518 549 $ret = ""; $ret = "";
519 550 $add = ""; $add = "";
520 551 foreach ($a as $k => $v) { foreach ($a as $k => $v) {
521 $ret .= $add . "$k=$v";
552 if (is_array($v))
553 $s = "[" . rg_array2string($v) . "]";
554 else
555 $s = preg_replace($what, $values, $v);
556 $ret .= $add . "$k=$s";
522 557 $add = " "; $add = " ";
523 558 } }
524 559
File root/index.php changed (mode: 100644) (index fa1a2e2..1e9fcc4)
... ... include_once($INC . "/keys.inc.php");
13 13 include_once($INC . "/token.inc.php"); include_once($INC . "/token.inc.php");
14 14 include_once($INC . "/prof.inc.php"); include_once($INC . "/prof.inc.php");
15 15 include_once($INC . "/mr.inc.php"); include_once($INC . "/mr.inc.php");
16 include_once($INC . "/bug.inc.php");
16 17
17 18 rg_prof_start("MAIN"); rg_prof_start("MAIN");
18 19
 
... ... $sid = rg_var_re("sid", "/[^A-Za-z0-9]/");
75 76 $token = rg_var_re("token", "/[^A-Za-z0-9]/"); $token = rg_var_re("token", "/[^A-Za-z0-9]/");
76 77
77 78 rg_log("IP: " . @$_SERVER['REMOTE_ADDR']); rg_log("IP: " . @$_SERVER['REMOTE_ADDR']);
78 rg_log("_REQUEST: " . trim(print_r($_REQUEST, TRUE)));
79 rg_log("_COOKIE: " . trim(print_r($_COOKIE, TRUE)));
79 rg_log("_REQUEST: " . rg_array2string($_REQUEST));
80 rg_log("_COOKIE: " . rg_array2string($_COOKIE));
80 81 rg_log("Start! cop=[$cop] op=$op subop=$subop subsubop=$subsubop" rg_log("Start! cop=[$cop] op=$op subop=$subop subsubop=$subsubop"
81 82 . " doit=$doit sid=$sid rr: " . rg_array2string($rr)); . " doit=$doit sid=$sid rr: " . rg_array2string($rr));
82 83 rg_log("paras: " . implode("|", $paras)); rg_log("paras: " . implode("|", $paras));
 
... ... if ($r !== TRUE) {
96 97 } }
97 98
98 99 rg_user_login_by_sid($db, $sid, $rg_ui); rg_user_login_by_sid($db, $sid, $rg_ui);
99 rg_log("After login_by_sid, rg_ui=" . print_r($rg_ui, TRUE));
100 rg_log("After login_by_sid, rg_ui=" . rg_array2string($rg_ui));
100 101
101 102
102 103 $body = ""; $body = "";
File root/themes/default/errmsg/footer.html added (mode: 100644) (index 0000000..8902b2e)
1 </ul>
2 </div>
3 <br />
File root/themes/default/errmsg/header.html added (mode: 100644) (index 0000000..34b4d49)
1 <div class="error">
2 <b>Errors:</b><br />
3 <ul>
File root/themes/default/errmsg/line.html added (mode: 100644) (index 0000000..52e526a)
1 <li>@@error@@</li>
File root/themes/default/errmsg/nodata.html copied from file root/themes/default/repo/mrs.html (similarity 100%)
File root/themes/default/main.css changed (mode: 100644) (index d5d7a67..92ea39b)
... ... label {
184 184 color: #666666; color: #666666;
185 185 white-space: nowrap; white-space: nowrap;
186 186 } }
187
188 .error {}
189 .error b { color: #ff0000; font-weight: bold; font-size: 11pt; }
190 .error ul { padding-left: 15pt; }
191 .error ul li {}
File root/themes/default/repo/blob.html changed (mode: 100644) (index 7a244b8..4d91e05)
1 1 <br /> <br />
2 <span class="blob_title">@@path@@/@@file@@ (@@size@@ bytes)</span><br />
2 <span class="blob_title">@@path@@/@@file@@ (@@hash@@) (@@size@@ bytes)</span><br />
3 3
4 4 <div class="source"> <div class="source">
5 5 <pre> <pre>
File root/themes/default/repo/bug/bug_add.html added (mode: 100644) (index 0000000..7da46ff)
1 <pre>@@DUMP@@</pre>
2
3 <div class="formarea">
4
5 @@bug_errmsg@@
6
7 <form method="post" action="@@rg_action@@">
8 <input type="hidden" name="doit" value="1" />
9 <input type="hidden" name="token" value="@@rg_form_token@@" />
10
11 <label for="title" class="form_item_title">Title</label><br />
12 <input type="text" name="title" value="@@title@@" size="80" />
13 <br />
14 <br />
15
16 <label for="body" class="form_item_title">Description</label><br />
17 <textarea name="body" rows="8" cols="80">@@body@@</textarea>
18 <br />
19 <br />
20
21 <label for="labels" class="form_item_title">Labels (comma or Enter separated)</label><br />
22 <textarea name="labels" rows="3" cols="80">@@labels@@</textarea>
23 <br />
24 <br />
25
26 <input type="submit" name="button" value="@@bug_action@@" />
27
28 </form>
29 </div>
File root/themes/default/repo/bug/list/footer.html copied from file root/themes/default/repo/fstat/footer.html (similarity 100%)
File root/themes/default/repo/bug/list/header.html added (mode: 100644) (index 0000000..1884f8f)
1 <table>
2 <tr>
3 <th>ID</th>
4 <th>Creation date (UTC)</th>
5 <th>Title</th>
6 <th>State</th>
7 <th>Reported by</th>
8 <th>Asigned to</th>
9 <th>Last update</th>
10 </tr>
11
File root/themes/default/repo/bug/list/line.html added (mode: 100644) (index 0000000..7fc339a)
1 <!-- @@DUMP@@ -->
2 <tr>
3 <td><a href="@@url_bug@@">@@bug_id@@</a></td>
4 <td>@@creation@@</td>
5 <td><a href="@@url_bug@@">@@title@@</a></td>
6 <td>@@state@@</td>
7 <td>@@owner@@</td>
8 <td>@@assigned_to@@</td>
9 <td>@@updated@@</td>
10 </tr>
11
File root/themes/default/repo/bug/list/nodata.html copied from file root/themes/default/repo/tree/nodata.html (similarity 65%) (mode: 100644) (index d5ef081..fce0f1f)
1 1 <div class="warning"> <div class="warning">
2 Empty tree.
2 No bugs found.
3 3 </div> </div>
File root/themes/default/repo/bug/list_note/footer.html copied from file root/themes/default/repo/fstat/footer.html (similarity 100%)
File root/themes/default/repo/bug/list_note/header.html added (mode: 100644) (index 0000000..536924a)
1 <table>
2 <tr>
3 <th>Creation (UTC)</th>
4 <th>Owner</th>
5 <th>Note</th>
6 </tr>
7
File root/themes/default/repo/bug/list_note/line.html added (mode: 100644) (index 0000000..9d1825e)
1 <tr>
2 <td>@@creation@@</td>
3 <td>@@owner@@</td>
4 <td>@@note@@</td>
5 </tr>
6
File root/themes/default/repo/bug/list_note/nodata.html copied from file root/themes/default/repo/tree/nodata.html (similarity 64%) (mode: 100644) (index d5ef081..7d61d82)
1 1 <div class="warning"> <div class="warning">
2 Empty tree.
2 No notes found.
3 3 </div> </div>
File root/themes/default/repo/bug/main.html added (mode: 100644) (index 0000000..ddfbe28)
1 <div class="menu">
2 <ul>
3 <li><a href="@@url_repo@@/bug">List</a></li>
4 <li><a href="@@url_repo@@/bug/add">Add</a></li>
5 </ul>
6 </div>
7
8 @@bug_body@@
File root/themes/default/repo/bug/note_add.html added (mode: 100644) (index 0000000..2c5cfb4)
1 <div class="formarea">
2
3 @@note_errmsg@@
4
5 <form method="post" action="@@rg_action@@">
6 <input type="hidden" name="doit" value="1" />
7 <input type="hidden" name="token" value="@@rg_form_token@@" />
8
9 <label for="note" class="form_item_title">Note</label><br />
10 <textarea name="note" rows="4" cols="80">@@note@@</textarea>
11 <br />
12 <br />
13
14 <input type="submit" name="button" value="Add note" />
15
16 </form>
17 </div>
File root/themes/default/repo/bug/show.html added (mode: 100644) (index 0000000..413f3d7)
1 <!-- @@DUMP@@ -->
2
3 Bug ID: @@bug_id@@<br />
4 Insertion date (UTC): @@creation@@<br />
5 Last update (UTC): @@updated@@<br />
6 Reporter: @@owner@@<br />
7 Assigned to: @@assigned_to@@<br />
8 Title: @@title@@<br />
9 Body:<br />
10 @@body@@
11 <br />
12
13 @@notes@@
14
15 @@note_add@@
File root/themes/default/repo/issues.html deleted (index 9cd7f6d..0000000)
1 Not yet implemented. Sorry.
File root/themes/default/repo/main.html changed (mode: 100644) (index 296ceb6..6138840)
1 1 <div class="repo_header"> <div class="repo_header">
2 <div class="repo_header">
2 <div>
3 3 <div class="repo_title"> <div class="repo_title">
4 4 <a href="@@url_user@@">@@owner@@</a>/<a href="@@url_repo@@">@@name@@</a> <a href="@@url_user@@">@@owner@@</a>/<a href="@@url_repo@@">@@name@@</a>
5 5 </div> </div>
 
14 14 <li><a href="@@git@@">@@git@@</a></li> <li><a href="@@git@@">@@git@@</a></li>
15 15 </ul> </ul>
16 16 </div> </div>
17
18 <div>
19 @@branches_and_tags@@
20 </div>
21 17 </div> </div>
22 18
23 19 <div class="menu repo_menu" style="clear: both;"> <div class="menu repo_menu" style="clear: both;">
24 20 <ul> <ul>
25 21 <li><a href="@@url_repo@@/source">Source</a></li> <li><a href="@@url_repo@@/source">Source</a></li>
26 22 <li><a href="@@url_repo@@/mrs">Merge requests</a></li> <li><a href="@@url_repo@@/mrs">Merge requests</a></li>
27 <li><a href="@@url_repo@@/issues">Issues</a></li>
23 <li><a href="@@url_repo@@/bug">Bugs</a></li>
28 24 @@if(@@can_admin@@){{<li><a href="@@url_repo@@/admin">Admin</a></li>}}{{}} @@if(@@can_admin@@){{<li><a href="@@url_repo@@/admin">Admin</a></li>}}{{}}
29 25 </ul> </ul>
30 26 </div> </div>
File root/themes/default/repo/source.html changed (mode: 100644) (index 96159f0..a07b2a8)
1 <div>
2 @@branches_and_tags@@
3 </div>
4
1 5 <div class="menu"> <div class="menu">
2 6 <ul> <ul>
3 7 <li><a href="@@url_repo@@/source/log@@ref_url@@">Log</a></li> <li><a href="@@url_repo@@/source/log@@ref_url@@">Log</a></li>
File samples/config.php changed (mode: 100644) (index 790e5ad..ededa97)
5 5 $rg_base = "/home/rocketgit"; $rg_base = "/home/rocketgit";
6 6
7 7 // Database // Database
8 $rg_sql = "user=rocketgit dbname=rocketgit";
8 $rg_sql = "host=localhost user=rocketgit dbname=rocketgit";
9 9 $rg_sql_debug = 1; $rg_sql_debug = 1;
10 10
11 11 // Session // Session
File scripts/remote.php changed (mode: 100644) (index ae8c667..9c96336)
... ... require_once($INC . "/sql.inc.php");
12 12 require_once($INC . "/struct.inc.php"); require_once($INC . "/struct.inc.php");
13 13 require_once($INC . "/repo.inc.php"); require_once($INC . "/repo.inc.php");
14 14 require_once($INC . "/prof.inc.php"); require_once($INC . "/prof.inc.php");
15 require_once($INC . "/ssh.inc.php");
15 16
16 17 rg_prof_start("remote.php"); rg_prof_start("remote.php");
17 18
 
... ... function fatal($str)
37 38 } }
38 39
39 40 rg_log("Start..."); rg_log("Start...");
40 rg_log("_SERVER: " . print_r($_SERVER, TRUE));
41 rg_log("_SERVER: " . rg_array2string($_SERVER));
41 42
42 43 umask(0022); umask(0022);
43 44
45 $db = rg_sql_open($rg_sql);
46 if ($db === FALSE)
47 fatal("Internal error (db)!");
48
49 $r = rg_sql_struct_update_if_needed($db, 0);
50 if ($r !== TRUE)
51 fatal("We are in a short maintenance. Try again later.");
52
44 53 if (isset($_SERVER['SSH_CONNECTION'])) { if (isset($_SERVER['SSH_CONNECTION'])) {
45 54 rg_log("SSH connection: " . $_SERVER['SSH_CONNECTION']); rg_log("SSH connection: " . $_SERVER['SSH_CONNECTION']);
46 55 $access_type = 1; $access_type = 1;
 
... ... if (isset($_SERVER['SSH_CONNECTION'])) {
54 63 fatal("uid not provided!"); fatal("uid not provided!");
55 64 rg_log("\tuid is $uid."); rg_log("\tuid is $uid.");
56 65
57 $cmd_repo = trim(@$_SERVER['SSH_ORIGINAL_COMMAND']);
58 if (empty($cmd_repo))
59 fatal("No SSH_ORIGINAL_COMMAND provided!");
66 if (!isset($_SERVER['SSH_ORIGINAL_COMMAND']))
67 $cmd_repo = "";
68 else
69 $cmd_repo = trim($_SERVER['SSH_ORIGINAL_COMMAND']);
70 rg_ssh_dispatch($db, $uid, $cmd_repo);
60 71
61 72 $ssh_client = getenv("SSH_CLIENT"); $ssh_client = getenv("SSH_CLIENT");
62 73 $_t = explode(" ", $ssh_client); $_t = explode(" ", $ssh_client);
 
... ... $_t = preg_replace('/\.git$/' , '', $_t);
113 124 $_t = explode("/", $_t); $_t = explode("/", $_t);
114 125 if (strcmp($_t[0], "user") == 0) { if (strcmp($_t[0], "user") == 0) {
115 126 $prefix = "/user"; $prefix = "/user";
116 $user = $_t[1];
117 $repo = $_t[2];
127 $user = isset($_t[1]) ? $_t[1] : "";
128 $repo = isset($_t[2]) ? $_t[2] : "";
118 129 } else { } else {
119 130 $prefix = ""; $prefix = "";
120 $user = $_t[0];
121 $repo = $_t[1];
131 $user = isset($_t[0]) ? $_t[0] : "";
132 $repo = isset($_t[1]) ? $_t[1] : "";
122 133 } }
123 134
124 135 rg_log("host=[$host] cmd=[$cmd] prefix=[$prefix] user=[$user] repo=[$repo]."); rg_log("host=[$host] cmd=[$cmd] prefix=[$prefix] user=[$user] repo=[$repo].");
 
... ... if (rg_user_ok($user) !== TRUE)
130 141 if (rg_repo_ok($repo) !== TRUE) if (rg_repo_ok($repo) !== TRUE)
131 142 fatal("Repo [$repo] is invalid (" . rg_repo_error() . ")"); fatal("Repo [$repo] is invalid (" . rg_repo_error() . ")");
132 143
133 $db = rg_sql_open($rg_sql);
134 if ($db === FALSE)
135 fatal("Internal error (db)!");
136
137 $r = rg_sql_struct_update_if_needed($db, 0);
138 if ($r !== TRUE)
139 fatal("We are in a short maintenance. Try again later.");
140
141 144 // Loading info about the repository // Loading info about the repository
142 145 $rr = array("prefix" => $prefix, "user" => $user, "repo" => $repo); $rr = array("prefix" => $prefix, "user" => $user, "repo" => $repo);
143 146 $ri = rg_repo_info($db, $rr); $ri = rg_repo_info($db, $rr);
File tests/git2.php changed (mode: 100644) (index 34b373d..eaf6ce8)
... ... ini_set("track_errors", "On");
5 5 $INC = "../inc"; $INC = "../inc";
6 6 require_once($INC . "/git.inc.php"); require_once($INC . "/git.inc.php");
7 7
8 rg_log_set_file("git.log");
8 rg_log_set_file("git2.log");
9 9
10 10 $rg_scripts = "/usr/share/rocketgit"; $rg_scripts = "/usr/share/rocketgit";
11 11
File tests/sql.php changed (mode: 100644) (index 13ddb9e..25ee6b4)
... ... $INC = "../inc";
6 6 require_once($INC . "/log.inc.php"); require_once($INC . "/log.inc.php");
7 7 require_once($INC . "/sql.inc.php"); require_once($INC . "/sql.inc.php");
8 8
9 rg_log_set_file("sql.log");
10
9 11 echo "db: open connection...\n"; echo "db: open connection...\n";
10 12 $db = rg_sql_open("dbname=trg"); $db = rg_sql_open("dbname=trg");
11 13 if ($db === FALSE) { if ($db === FALSE) {
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/rocketgit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master