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 02e554c59c837b94e1a7c8bdfcf2256d68201ff5

Checkpoint
Author: Catalin(ux) M. BOIE
Author date (UTC): 2015-04-17 06:58
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2015-04-17 06:58
Parent(s): 96355ec971acd16480c9c22469a2a659c8ade994
Signing key:
Tree: a275d77688b893d194360e64876db019fae2fe70
File Lines added Lines deleted
TODO 7 14
inc/bug.inc.php 5 6
inc/git.inc.php 8 3
inc/plan.inc.php 2 3
inc/repo.inc.php 4 4
inc/rights.inc.php 5 6
inc/user/repo-page.php 4 4
root/robots.txt 2 1
root/themes/default/admin/plans/list/line.html 1 2
root/themes/default/repo/bug/list_note/line.html 1 1
root/themes/default/repo/bug/show.html 1 1
root/themes/default/repo/list/line.html 1 1
root/themes/default/repo/main.html 1 1
root/themes/default/user/repo/rights/list_repo/line.html 1 1
root/themes/default/user/repo/rights/list_repo_path/line.html 1 1
root/themes/default/user/repo/rights/list_repo_refs/line.html 1 1
scripts/remote.php 1 1
tests/bug.php 19 40
tests/git.php 20 0
tests/git_log1.expected 10 10
tests/git_log1.final 10 10
tests/http_bug.php 29 23
tests/rights.php 1 1
tests/util.php 1 1
File TODO changed (mode: 100644) (index 14b15a7..7191bb5)
1 1 == Where I stopped last time == == Where I stopped last time ==
2 2 [ ] Add "Spread the word!" on website. [ ] Add "Spread the word!" on website.
3 3
4 [ ] https access before first launch?
5 [ ] Check 'description_nice' and apply this everywhere. Maybe we should unset
6 'description', so people will not be tempted to use it.
7 Maybe just overwrite 'description'.
8 Planul este sa auditez peste tot daca folosesc variabile luate cu
9 rg_var_str, rg_var_re & rg_var_cookie_re. si le trintesc pe
10 output fara a le trece prin template sau rg_xss_safe.
11 Apoi, ar trebui sa fac si nl2br pe toate textele, just in case.
12 Nu e OK. Trebuie doar pentru anumite cazuri: la o descriere pe pagina
13 proiectului, e nevoie. Dar intr-un form, in textarea, nu e nevoie.
14 Apoi as putea elimina description_nice.
15 Deci, cred ca trebuie sa auditez peste tot folosirea lui description.
16 [ ] Upload kvm image to downloads.rocketgit.com. Sign it? sha256 it?
17 4 [ ] Security: validate sparas! [ ] Security: validate sparas!
18 5 [ ] Menus - change color for selected items, not the background color. [ ] Menus - change color for selected items, not the background color.
19 6 [ ] Daca creez repo, nu-mi creaza dir-ul (de fapt, nu marcheaza in cache ca l-a [ ] Daca creez repo, nu-mi creaza dir-ul (de fapt, nu marcheaza in cache ca l-a
 
21 8 broken pipe. Foarte ciudat. De ce nu ar putea trimite? broken pipe. Foarte ciudat. De ce nu ar putea trimite?
22 9 Probabil socket-ul nu mai e deschis pentru ca cache-ul s-a restartat? Probabil socket-ul nu mai e deschis pentru ca cache-ul s-a restartat?
23 10 [ ] I can do a select before write to be sure socket is open. [ ] I can do a select before write to be sure socket is open.
24 If I get a error signal from select, reopen the socket.
11 If I get an error signal from select, reopen the socket.
25 12 [ ] Check search. [ ] Check search.
13 [ ] Run unit testing.
26 14 [ ] SPF? mail-ul ajunge in spam! [ ] SPF? mail-ul ajunge in spam!
15 [ ] Upload kvm image to downloads.rocketgit.com. Sign it? sha256 it?
27 16 [ ] Release virtual machine. [ ] Release virtual machine.
17 [ ] https access before first launch?
28 18 [ ] [ ]
29 19
30 20 == BEFORE NEXT RELEASE == == BEFORE NEXT RELEASE ==
21 [ ] Add uid to events so we can delete old events for tests or abusing users?
22 [ ] Should we just set no password somehow for ssh access to be able to signal
23 the user that has no key uploaded?
31 24 [ ] When getting another IP, allow ssh on port 443(https)? [ ] When getting another IP, allow ssh on port 443(https)?
32 25 [ ] Investigate --decorate/--word-diff for git log. [ ] Investigate --decorate/--word-diff for git log.
33 26 [ ] client_win.html hint is not used. [ ] client_win.html hint is not used.
File inc/bug.inc.php changed (mode: 100644) (index 4bdbb08..5e8fba6)
... ... function rg_bug_vars_defaults()
274 274 function rg_bug_vars() function rg_bug_vars()
275 275 { {
276 276 $ret = array(); $ret = array();
277 $ret['title'] = rg_var_str("title");
278 $ret['body'] = rg_var_str("body");
277 $ret['title'] = trim(rg_var_str("title"));
278 $ret['body'] = trim(rg_var_str("body"));
279 279 $ret['state'] = rg_var_uint("state"); $ret['state'] = rg_var_uint("state");
280 280 $ret['labels'] = rg_var_str("labels"); $ret['labels'] = rg_var_str("labels");
281 281 $ret['assigned_to'] = rg_var_str("assigned_to"); $ret['assigned_to'] = rg_var_str("assigned_to");
 
... ... function rg_bug_cosmetic($db, &$row)
297 297 } }
298 298
299 299 if (isset($row['body'])) if (isset($row['body']))
300 $row['HTML:body'] = nl2br(rg_xss_safe($row['body']));
300 $row['HTML:body_nlbr'] = nl2br(rg_xss_safe($row['body']));
301 301
302 302 if (isset($row['itime'])) if (isset($row['itime']))
303 303 $row['creation'] = gmdate("Y-m-d H:i", $row['itime']); $row['creation'] = gmdate("Y-m-d H:i", $row['itime']);
 
... ... function rg_bug_edit($db, $login_ui, $ri, $data)
431 431 } }
432 432
433 433 if (rg_sql_begin($db) !== TRUE) { if (rg_sql_begin($db) !== TRUE) {
434 rg_bug_set_error("start traqnsaction failed");
434 rg_bug_set_error("start transaction failed");
435 435 break; break;
436 436 } }
437 437
 
... ... function rg_bug_note_list($db, $repo_id, $bug_id, $offset)
1080 1080 else else
1081 1081 $row['owner'] = "?"; $row['owner'] = "?";
1082 1082
1083 $row['HTML:note'] = nl2br(rg_xss_safe($row['note']));
1084 unset($row['note']);
1083 $row['HTML:note_nlbr'] = nl2br(rg_xss_safe($row['note']));
1085 1084
1086 1085 $ret[] = $row; $ret[] = $row;
1087 1086 } }
File inc/git.inc.php changed (mode: 100644) (index 02ffd73..ac532c0)
... ... function rg_git_rev($rev)
258 258 */ */
259 259 function rg_git_reference($refname) function rg_git_reference($refname)
260 260 { {
261 $pattern = "[a-zA-Z0-9^~\/_]";
262 if (preg_match('/^' . $pattern . '$/uD', $refname) !== 1) {
261 $pattern = "[a-zA-Z0-9^~\/_]*";
262 $r = preg_match('/^' . $pattern . '$/uD', $refname);
263 if ($r === FALSE) {
264 rg_internal_error("preg_match failed!");
265 return "";
266 }
267 if ($r !== 1) {
263 268 $chars = preg_replace('/' . $pattern . '/', '', $refname); $chars = preg_replace('/' . $pattern . '/', '', $refname);
264 rg_log("git_reference: ref [$refname] contains invalid chars ($chars)");
269 rg_log("git_reference: ref [$refname] contains invalid chars ($chars) (r=$r)");
265 270 return ""; return "";
266 271 } }
267 272
File inc/plan.inc.php changed (mode: 100644) (index 60a8c13..6358354)
... ... function rg_plan_list($db)
156 156 $id = $row['id']; $id = $row['id'];
157 157
158 158 // fixes // fixes
159 $row['HTML:description'] = nl2br(rg_xss_safe($row['description']));
160 unset($row['description']);
159 $row['HTML:description_nlbr'] = nl2br(rg_xss_safe($row['description']));
161 160
162 161 $ret[$id] = $row; $ret[$id] = $row;
163 162 } }
 
... ... function rg_plan_edit_high_level($db, &$rg)
328 327 else else
329 328 $pi['id'] = rg_var_uint("pi::id"); $pi['id'] = rg_var_uint("pi::id");
330 329 $pi['name'] = rg_var_str("pi::name"); $pi['name'] = rg_var_str("pi::name");
331 $pi['description'] = rg_var_str("pi::description");
330 $pi['description'] = trim(rg_var_str("pi::description"));
332 331 $pi['disk_mb'] = rg_var_uint("pi::disk_mb"); $pi['disk_mb'] = rg_var_uint("pi::disk_mb");
333 332 $pi['users'] = rg_var_uint("pi::users"); $pi['users'] = rg_var_uint("pi::users");
334 333 $pi['bw'] = rg_var_uint("pi::bw"); $pi['bw'] = rg_var_uint("pi::bw");
File inc/repo.inc.php changed (mode: 100644) (index d83dd62..86256f4)
... ... function rg_repo_path_by_name($uid, $repo_name)
625 625 function rg_repo_cosmetic(&$row) function rg_repo_cosmetic(&$row)
626 626 { {
627 627 $_a = rg_xss_safe($row['description']); $_a = rg_xss_safe($row['description']);
628 $row['HTML:description_nice'] = nl2br($_a);
628 $row['HTML:description_nlbr'] = nl2br($_a);
629 629 } }
630 630
631 631 /* /*
 
... ... function rg_repo_admin_rights($db, $rg, $type)
1238 1238 $a['misc'] = rg_var_str("misc"); $a['misc'] = rg_var_str("misc");
1239 1239 $a['ip'] = rg_var_str("ip"); $a['ip'] = rg_var_str("ip");
1240 1240 $a['prio'] = rg_var_uint("prio"); $a['prio'] = rg_var_uint("prio");
1241 $a['description'] = rg_var_str("description");
1241 $a['description'] = trim(rg_var_str("description"));
1242 1242 //rg_log_ml("CHECK: a(POST)=" . print_r($a, TRUE)); //rg_log_ml("CHECK: a(POST)=" . print_r($a, TRUE));
1243 1243
1244 1244 $errmsg = array(); $errmsg = array();
 
... ... function rg_repo_edit_high_level($db, &$rg)
1496 1496 $rg['ri']['master'] = rg_var_uint("master"); $rg['ri']['master'] = rg_var_uint("master");
1497 1497 $rg['ri']['name'] = rg_var_str("name"); // TODO: filter name! $rg['ri']['name'] = rg_var_str("name"); // TODO: filter name!
1498 1498 $rg['ri']['max_commit_size'] = rg_var_uint("max_commit_size"); $rg['ri']['max_commit_size'] = rg_var_uint("max_commit_size");
1499 $rg['ri']['description'] = rg_var_str("description");
1499 $rg['ri']['description'] = trim(rg_var_str("description"));
1500 1500 $rg['ri']['public'] = rg_var_bool("public"); $rg['ri']['public'] = rg_var_bool("public");
1501 $rg['ri']['license'] = rg_var_str("license");
1501 $rg['ri']['license'] = trim(rg_var_str("license"));
1502 1502 rg_repo_cosmetic($rg['ri']); rg_repo_cosmetic($rg['ri']);
1503 1503 //rg_log_ml("CHECK: after repo edit: rg[ri]=" . print_r($rg['ri'], TRUE)); //rg_log_ml("CHECK: after repo edit: rg[ri]=" . print_r($rg['ri'], TRUE));
1504 1504
File inc/rights.inc.php changed (mode: 100644) (index f45d8b0..4103979)
... ... function rg_rights_a2s($a)
176 176 /* /*
177 177 * Improves a little bit the items of a right * Improves a little bit the items of a right
178 178 * TODO: we have a circular dependency on user.inc. Remove the lookup and break * TODO: we have a circular dependency on user.inc. Remove the lookup and break
179 * the dependency.
179 * the dependency. Register a function globally, from user.inc, that will be
180 * called here.
180 181 */ */
181 182 function rg_rights_cosmetic($db, &$row) function rg_rights_cosmetic($db, &$row)
182 183 { {
 
... ... function rg_rights_cosmetic($db, &$row)
218 219
219 220 if (!isset($row['description'])) if (!isset($row['description']))
220 221 $row['description'] = ""; $row['description'] = "";
222
223 $row['HTML:description_nlbr'] = nl2br(rg_xss_safe($row['description']));
221 224 } }
222 225
223 226 /* /*
 
... ... function rg_rights_test_ip($list, $ip)
626 629 * Returns TRUE if all 'needed_rights' are included in 'rights' * Returns TRUE if all 'needed_rights' are included in 'rights'
627 630 * @list - an array of rights * @list - an array of rights
628 631 * needed_rights: rights letters; you can use "ab|cd" = (a AND B) OR (C AND d) * needed_rights: rights letters; you can use "ab|cd" = (a AND B) OR (C AND d)
629 * @misc - if FALSE, we will ignore the 'misc' from db. Is needed in remote access.
630 632 */ */
631 633 function rg_rights_test($list, $needed_rights, $ip, $misc) function rg_rights_test($list, $needed_rights, $ip, $misc)
632 634 { {
 
... ... function rg_rights_test($list, $needed_rights, $ip, $misc)
672 674 continue; continue;
673 675
674 676 // Test 'misc' match // Test 'misc' match
675 if ($misc !== FALSE) {
676 if (empty($v['misc']))
677 break;
678
677 if (!empty($v['misc'])) {
679 678 $cmp_func = $rg_rights_cmp_func[$v['type']]; $cmp_func = $rg_rights_cmp_func[$v['type']];
680 679 $r = $cmp_func($v['misc'], $misc); $r = $cmp_func($v['misc'], $misc);
681 680 if ($r !== TRUE) { if ($r !== TRUE) {
File inc/user/repo-page.php changed (mode: 100644) (index 641bbdf..74d6709)
... ... if ($rg_git_port != 0)
71 71 $urls[]['HTML:url'] = '<a href="' . $rg['git'] . '">' . $rg['git'] . '</a>'; $urls[]['HTML:url'] = '<a href="' . $rg['git'] . '">' . $rg['git'] . '</a>';
72 72 $rg['HTML:urls'] = rg_template_table("repo/urls", $urls, $rg); $rg['HTML:urls'] = rg_template_table("repo/urls", $urls, $rg);
73 73
74 function rg_add_clone_hints($db, &$rg)
74 function rg_add_clone_hints($db, &$rg, $ref)
75 75 { {
76 76 global $rg_ssh_port; global $rg_ssh_port;
77 77 global $rg_git_port; global $rg_git_port;
 
... ... function rg_add_clone_hints($db, &$rg)
97 97 $x['username'] = $rg['login_ui']['username']; $x['username'] = $rg['login_ui']['username'];
98 98 $x['needed_rights'] = 'H'; /* anon push */ $x['needed_rights'] = 'H'; /* anon push */
99 99 $x['ip'] = $rg['ip']; $x['ip'] = $rg['ip'];
100 $x['misc'] = FALSE;
100 $x['misc'] = $ref;
101 101 if (rg_rights_allow($db, $x) === TRUE) if (rg_rights_allow($db, $x) === TRUE)
102 102 $hints[]['HTML:hint'] = rg_template("hints/repo/anon_push.html", $rg); $hints[]['HTML:hint'] = rg_template("hints/repo/anon_push.html", $rg);
103 103 } }
 
... ... function rg_add_clone_hints($db, &$rg)
109 109 $_subop = empty($paras) ? "history" : array_shift($paras); $_subop = empty($paras) ? "history" : array_shift($paras);
110 110
111 111 if (strcmp($_subop, "history") == 0) { if (strcmp($_subop, "history") == 0) {
112 rg_add_clone_hints($db, $rg);
112 rg_add_clone_hints($db, $rg, '');
113 113
114 114 $hist = rg_repo_history_load($db, $rg['ri']['repo_id'], 0, 20, 0); $hist = rg_repo_history_load($db, $rg['ri']['repo_id'], 0, 20, 0);
115 115 if ($hist === FALSE) if ($hist === FALSE)
 
... ... if (strcmp($_subop, "history") == 0) {
129 129 $type_ref['ref_url']); $type_ref['ref_url']);
130 130 $rg = array_merge($rg, $bt); $rg = array_merge($rg, $bt);
131 131
132 rg_add_clone_hints($db, $rg);
132 rg_add_clone_hints($db, $rg, $ref);
133 133
134 134 $_repo_body .= rg_template("repo/source.html", $rg); $_repo_body .= rg_template("repo/source.html", $rg);
135 135
File root/robots.txt changed (mode: 100644) (index d332754..99eda2f)
1 1 User-agent: * User-agent: *
2 2 Allow: / Allow: /
3 Disallow: /nonexisting
3 Disallow: /nonexisting
4 Disallow: /op/logout
File root/themes/default/admin/plans/list/line.html changed (mode: 100644) (index 2247ad3..4719b12)
1 <!-- @@DUMP-DISABLED@@ -->
2 1 <tr> <tr>
3 2 <td><input type="checkbox" name="delete_list[@@id@@]" /></td> <td><input type="checkbox" name="delete_list[@@id@@]" /></td>
4 3 <td>@@position@@</td> <td>@@position@@</td>
5 4 <td>@@name@@</td> <td>@@name@@</td>
6 <td>@@description@@</td>
5 <td>@@description_nlbr@@</td>
7 6 <td>@@if(@@users@@ == 0){{Unlimited}}{{@@users@@}}</td> <td>@@if(@@users@@ == 0){{Unlimited}}{{@@users@@}}</td>
8 7 <td>@@if(@@speed@@ == 0){{Unlimited}}{{@@speed@@}}</td> <td>@@if(@@speed@@ == 0){{Unlimited}}{{@@speed@@}}</td>
9 8 <td>@@if(@@bw@@ == 0){{Unlimited}}{{@@bw@@}}</td> <td>@@if(@@bw@@ == 0){{Unlimited}}{{@@bw@@}}</td>
File root/themes/default/repo/bug/list_note/line.html changed (mode: 100644) (index ccb8ae8..33985fd)
1 1 <div class="note"> <div class="note">
2 2 <b>@@owner@@</b> - @@creation@@ <b>@@owner@@</b> - @@creation@@
3 3 <div class="note_body"> <div class="note_body">
4 @@note@@
4 @@note_nlbr@@
5 5 </div> </div>
6 6 </div> </div>
File root/themes/default/repo/bug/show.html changed (mode: 100644) (index ac91cd5..ba0fa76)
35 35 </div> </div>
36 36
37 37 <div class="bug_body"> <div class="bug_body">
38 @@bug::body@@
38 @@bug::body_nlbr@@
39 39 </div> </div>
40 40
41 41 @@labels_html@@ @@labels_html@@
File root/themes/default/repo/list/line.html changed (mode: 100644) (index 2dccd42..e399320)
1 1 <tr> <tr>
2 2 <td><a href="@@url_user@@">@@owner@@</a>/<a href="@@url_repo@@">@@name@@</a></td> <td><a href="@@url_user@@">@@owner@@</a>/<a href="@@url_repo@@">@@name@@</a></td>
3 <td><small>@@description_nice@@</small></td>
3 <td><small>@@description_nlbr@@</small></td>
4 4 <td>@@clone_of@@</td> <td>@@clone_of@@</td>
5 5 <td>@@creation@@</td> <td>@@creation@@</td>
6 6 <td>@@if(@@public@@ == 1){{Public}}{{Private}}</td> <td>@@if(@@public@@ == 1){{Public}}{{Private}}</td>
File root/themes/default/repo/main.html changed (mode: 100644) (index 7966a14..5e43435)
7 7 (License: @@if("@@ri::license@@" == ""){{Unspecified}}{{@@ri::license@@}}) (License: @@if("@@ri::license@@" == ""){{Unspecified}}{{@@ri::license@@}})
8 8 </div> </div>
9 9 <div class="repo_desc"> <div class="repo_desc">
10 @@ri::description_nice@@
10 @@ri::description_nlbr@@
11 11 </div> </div>
12 12
13 13 @@urls@@ @@urls@@
File root/themes/default/user/repo/rights/list_repo/line.html changed (mode: 100644) (index 5b68566..0581e59)
6 6 <td>@@username@@</td> <td>@@username@@</td>
7 7 <td>@@ip_nice@@</td> <td>@@ip_nice@@</td>
8 8 <td>@@rights_text@@</td> <td>@@rights_text@@</td>
9 <td>@@description@@</td>
9 <td>@@description_nlbr@@</td>
10 10 <td>@@if(@@can_be_deleted@@ == 1){{<a href="@@url_repo@@/admin/repo_rights?edit_id=@@right_id@@">Edit</a>}}{{N/A}}</td> <td>@@if(@@can_be_deleted@@ == 1){{<a href="@@url_repo@@/admin/repo_rights?edit_id=@@right_id@@">Edit</a>}}{{N/A}}</td>
11 11 </tr> </tr>
File root/themes/default/user/repo/rights/list_repo_path/line.html changed (mode: 100644) (index 2aa9dff..fdb0cc5)
7 7 <td>@@ip_nice@@</td> <td>@@ip_nice@@</td>
8 8 <td>@@misc@@</td> <td>@@misc@@</td>
9 9 <td>@@rights_text@@</td> <td>@@rights_text@@</td>
10 <td>@@description@@</td>
10 <td>@@description_nlbr@@</td>
11 11 <td>@@if(@@can_be_deleted@@ == 1){{<a href="@@url_repo@@/admin/path_rights?edit_id=@@right_id@@">Edit</a>}}{{N/A}}</td> <td>@@if(@@can_be_deleted@@ == 1){{<a href="@@url_repo@@/admin/path_rights?edit_id=@@right_id@@">Edit</a>}}{{N/A}}</td>
12 12 </tr> </tr>
File root/themes/default/user/repo/rights/list_repo_refs/line.html changed (mode: 100644) (index a28f7f5..67e9b10)
7 7 <td>@@ip_nice@@</td> <td>@@ip_nice@@</td>
8 8 <td>@@misc@@</td> <td>@@misc@@</td>
9 9 <td>@@rights_text@@</td> <td>@@rights_text@@</td>
10 <td>@@description@@</td>
10 <td>@@description_nlbr@@</td>
11 11 <td>@@if(@@can_be_deleted@@ == 1){{<a href="@@url_repo@@/admin/refs_rights?edit_id=@@right_id@@">Edit</a>}}{{N/A}}</td> <td>@@if(@@can_be_deleted@@ == 1){{<a href="@@url_repo@@/admin/refs_rights?edit_id=@@right_id@@">Edit</a>}}{{N/A}}</td>
12 12 </tr> </tr>
File scripts/remote.php changed (mode: 100644) (index c462394..0899abf)
... ... $x['uid'] = $conn_ui['uid'];
206 206 $x['username'] = $conn_ui['username']; $x['username'] = $conn_ui['username'];
207 207 $x['needed_rights'] = $needed_rights; $x['needed_rights'] = $needed_rights;
208 208 $x['ip'] = $ip; $x['ip'] = $ip;
209 $x['misc'] = FALSE;
209 $x['misc'] = '';
210 210 $ret = rg_rights_allow($db, $x); $ret = rg_rights_allow($db, $x);
211 211 if ($ret !== TRUE) if ($ret !== TRUE)
212 212 fatal("You have no rights to access this repo!"); fatal("You have no rights to access this repo!");
File tests/bug.php changed (mode: 100644) (index 02800c3..5f388b7)
... ... rg_log_set_file("bug.log");
15 15
16 16 require_once("common.php"); require_once("common.php");
17 17
18 // defaults
19 $uid = 1;
20 $ui = array("uid" => $uid, "username" => "userX", "organization" => 0, "email" => "test@embedromix.ro",
21 "confirmed" => 1);
22 $repo_name = "bug-A";
18 $_testns = 'bug';
23 19
24
25 rg_test_create_repo($db, $ui, $new);
20 rg_test_create_user($db, $u1);
21 rg_test_create_user($db, $u2);
22 rg_test_create_repo($db, $u1, $new);
26 23
27 24 $data = array("bug_id" => 0, $data = array("bug_id" => 0,
28 "title" => "Bug title",
29 "body" => "This is the body\nof the\nbug. <>",
30 "labels" => "label3,label1,label2",
25 "title" => "Bug title<xss>",
26 "body" => "This is the body\nof the\nbug.<xss>",
27 "labels" => "label2,label1<xss>",
31 28 "state" => 1, "state" => 1,
32 29 "assigned_uid" => 6); "assigned_uid" => 6);
33 30 $ri = array("repo_id" => $new['repo_id'], "name" => "repoX"); $ri = array("repo_id" => $new['repo_id'], "name" => "repoX");
34 $r = rg_bug_edit($db, $ui, $ri, $data);
31 $r = rg_bug_edit($db, $u1, $ri, $data);
35 32 if ($r === FALSE) { if ($r === FALSE) {
36 33 rg_log("Cannot insert a bug (" . rg_bug_error() . ")!"); rg_log("Cannot insert a bug (" . rg_bug_error() . ")!");
37 34 exit(1); exit(1);
 
... ... if ($r === FALSE) {
43 40 rg_log("Cannot get labels (" . rg_bug_error() . ")!"); rg_log("Cannot get labels (" . rg_bug_error() . ")!");
44 41 exit(1); exit(1);
45 42 } }
46 if (strcmp($r[0], "label1") != 0) {
43 if (strcmp($r[0], "label1<xss>") != 0) {
47 44 rg_log("Ordering the labels seems to not work."); rg_log("Ordering the labels seems to not work.");
48 45 exit(1); exit(1);
49 46 } }
50 if (strcmp($r[2], "label3") != 0) {
47 if (strcmp($r[1], "label2") != 0) {
51 48 rg_log("Ordering the labels seems to not work."); rg_log("Ordering the labels seems to not work.");
52 49 exit(1); exit(1);
53 50 } }
54 51
55 // add user
56 $_u['uid'] = 0;
57 $_u['realname'] = "user-bug-A real name";
58 $_u['username'] = "user-bug-A";
59 $_u['email'] = "rg@localhost";
60 $_u['pass'] = "pass1";
61 $_u['pass2'] = "pass1";
62 $_u['is_admin'] = 1;
63 $_u['rights'] = "C";
64 $_u['session_time'] = 3600;
65 $_u['confirm_token'] = "";
66 $_u['plan_id'] = 1000;
67 $uid = rg_user_edit($db, $_u);
68 if ($uid === FALSE) {
69 rg_log("Cannot add user (" . rg_user_error() . ")!");
70 exit(1);
71 }
72
73 $data = array("note" => "This is just a note.");
74 $r = rg_bug_note_add($db, $new['repo_id'], $bug_id, $uid, $data);
52 $data = array("note" => "This is just a note.<xss>");
53 $r = rg_bug_note_add($db, $new['repo_id'], $bug_id, $u2['uid'], $data);
75 54 if ($r === FALSE) { if ($r === FALSE) {
76 rg_log("Cannot add a note (" . rg_bug_error() . ")!");
55 rg_log("Cannot add a note by u2 (" . rg_bug_error() . ")!");
77 56 exit(1); exit(1);
78 57 } }
79 58
 
... ... if ($r['exists'] != 0) {
91 70 } }
92 71
93 72 // Search bugs // Search bugs
94 $q = array("reported_by" => "user-bug-A",
95 "assigned_to" => "user-bug-A",
73 $q = array("reported_by" => $u1['username'],
74 "assigned_to" => $u2['username'],
96 75 "state" => "1", "state" => "1",
97 76 "start" => "2000-01-01", "start" => "2000-01-01",
98 77 "end" => "2001-01-01", "end" => "2001-01-01",
99 "title_string" => "IMPOSSIBLE TITLE",
100 "body_string" => "IMPOSSIBLE BODY",
78 "title_string" => "IMPOSSIBLE TITLE<xss>",
79 "body_string" => "IMPOSSIBLE BODY<xss>",
101 80 "bugs_per_page" => "1"); "bugs_per_page" => "1");
102 $r = rg_bug_search($db, $new['repo_id'], $uid, $q);
81 $r = rg_bug_search($db, $new['repo_id'], $u1['uid'], $q);
103 82 if ($r === FALSE) { if ($r === FALSE) {
104 83 rg_log("Cannot search bugs 1 (" . rg_bug_error() . ")!"); rg_log("Cannot search bugs 1 (" . rg_bug_error() . ")!");
105 84 exit(1); exit(1);
 
... ... if (count($r) > 0) {
111 90
112 91 $q = array("title_string" => "g t", $q = array("title_string" => "g t",
113 92 "body_string" => ""); "body_string" => "");
114 $r = rg_bug_search($db, $new['repo_id'], $uid, $q);
93 $r = rg_bug_search($db, $new['repo_id'], $u1['uid'], $q);
115 94 if ($r === FALSE) { if ($r === FALSE) {
116 95 rg_log("Cannot search bugs 2 (" . rg_bug_error() . ")!"); rg_log("Cannot search bugs 2 (" . rg_bug_error() . ")!");
117 96 exit(1); exit(1);
File tests/git.php changed (mode: 100644) (index ee3eb51..05b5f2f)
... ... rg_log_set_file("git.log");
12 12 $rg_no_db = TRUE; $rg_no_db = TRUE;
13 13 require_once("common.php"); require_once("common.php");
14 14
15
16 rg_log("Testing git_reference...");
17 $s = "refs";
18 $e = $s;
19 $r = rg_git_reference($s);
20 if (strcmp($r, $e) != 0) {
21 rg_log("git_reference($s) is not working");
22 exit(1);
23 }
24
25 $s = "refs/heads/x";
26 $e = $s;
27 $r = rg_git_reference($s);
28 if (strcmp($r, $e) != 0) {
29 rg_log("git_reference($s) is not working");
30 exit(1);
31 }
32
33
15 34 rg_log("[*] Checking if git-init works..."); rg_log("[*] Checking if git-init works...");
16 35 $r = rg_git_init("git.tmp"); $r = rg_git_init("git.tmp");
17 36 if ($r !== TRUE) { if ($r !== TRUE) {
 
... ... print_r($refs);
32 51
33 52 system("rm -rf git.tmp"); system("rm -rf git.tmp");
34 53
54
35 55 rg_log("OK"); rg_log("OK");
36 56 ?> ?>
File tests/git_log1.expected changed (mode: 100644) (index 168e603..a23c181)
1 1 <div class="diff"> <div class="diff">
2 2 <br /> <br />
3 <a name="dis1">
3 <a name="dis1"></a>
4 4 <table class="chunk" width="100%"> <table class="chunk" width="100%">
5 5 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>dis1</b> changed (mode: 100644) (index 2c4179b..2bf9115):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>dis1</b> changed (mode: 100644) (index 2c4179b..2bf9115):</td></tr>
6 6 1 &nbsp; #ff0000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa #eeeeee 1 &nbsp; #ff0000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa #eeeeee
 
10 10 </div> </div>
11 11 <div class="diff"> <div class="diff">
12 12 <br /> <br />
13 <a name="dis1">
13 <a name="dis1"></a>
14 14 <table class="chunk" width="100%"> <table class="chunk" width="100%">
15 15 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>dis1</b> added (mode: 100644) (index 0000000..2c4179b):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>dis1</b> added (mode: 100644) (index 0000000..2c4179b):</td></tr>
16 16 &nbsp; 1 #eeeeee #00ff00 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &nbsp; 1 #eeeeee #00ff00 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
19 19 </div> </div>
20 20 <div class="diff"> <div class="diff">
21 21 <br /> <br />
22 <a name="a b c">
22 <a name="a b c"></a>
23 23 <table class="chunk" width="100%"> <table class="chunk" width="100%">
24 24 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a b c</b> added (mode: 100644) (index 0000000..72943a1):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a b c</b> added (mode: 100644) (index 0000000..72943a1):</td></tr>
25 25 &nbsp; 1 #eeeeee #00ff00 aaa &nbsp; 1 #eeeeee #00ff00 aaa
 
27 27 </div> </div>
28 28 <div class="diff"> <div class="diff">
29 29 <br /> <br />
30 <a name="a3">
30 <a name="a3"></a>
31 31 <table class="chunk" width="100%"> <table class="chunk" width="100%">
32 32 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a3</b> deleted (index 193814c..0000000):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a3</b> deleted (index 193814c..0000000):</td></tr>
33 33 1 &nbsp; #ff0000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa #eeeeee 1 &nbsp; #ff0000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa #eeeeee
 
35 35 </div> </div>
36 36 <div class="diff"> <div class="diff">
37 37 <br /> <br />
38 <a name="a3">
38 <a name="a3"></a>
39 39 <table class="chunk" width="100%"> <table class="chunk" width="100%">
40 40 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a3</b> renamed from a2 (similarity 100%):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a3</b> renamed from a2 (similarity 100%):</td></tr>
41 41 </table> </table>
42 42 <br /> <br />
43 <a name="c">
43 <a name="c"></a>
44 44 <table class="chunk" width="100%"> <table class="chunk" width="100%">
45 45 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>c</b> added (mode: 100644) (index 0000000..8ded189):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>c</b> added (mode: 100644) (index 0000000..8ded189):</td></tr>
46 46 &nbsp; 1 #eeeeee #00ff00 aaaaaaaaaaaaaaaaaaaa &nbsp; 1 #eeeeee #00ff00 aaaaaaaaaaaaaaaaaaaa
 
48 48 </div> </div>
49 49 <div class="diff"> <div class="diff">
50 50 <br /> <br />
51 <a name="a2">
51 <a name="a2"></a>
52 52 <table class="chunk" width="100%"> <table class="chunk" width="100%">
53 53 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a2</b> added (mode: 100644) (index 0000000..193814c):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a2</b> added (mode: 100644) (index 0000000..193814c):</td></tr>
54 54 &nbsp; 1 #eeeeee #00ff00 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &nbsp; 1 #eeeeee #00ff00 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
56 56 </div> </div>
57 57 <div class="diff"> <div class="diff">
58 58 <br /> <br />
59 <a name="empty.txt">
59 <a name="empty.txt"></a>
60 60 <table class="chunk" width="100%"> <table class="chunk" width="100%">
61 61 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>empty.txt</b> added (mode: 100644) (index 0000000..e69de29):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>empty.txt</b> added (mode: 100644) (index 0000000..e69de29):</td></tr>
62 62 </table> </table>
63 63 </div> </div>
64 64 <div class="diff"> <div class="diff">
65 65 <br /> <br />
66 <a name="xx&quot;yy">
66 <a name="xx&quot;yy"></a>
67 67 <table class="chunk" width="100%"> <table class="chunk" width="100%">
68 68 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>xx&quot;yy</b> added (mode: 100644) (index 0000000..e69de29):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>xx&quot;yy</b> added (mode: 100644) (index 0000000..e69de29):</td></tr>
69 69 </table> </table>
70 70 </div> </div>
71 71 <div class="diff"> <div class="diff">
72 72 <br /> <br />
73 <a name="a">
73 <a name="a"></a>
74 74 <table class="chunk" width="100%"> <table class="chunk" width="100%">
75 75 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a</b> added (mode: 100644) (index 0000000..193814c):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a</b> added (mode: 100644) (index 0000000..193814c):</td></tr>
76 76 &nbsp; 1 #eeeeee #00ff00 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &nbsp; 1 #eeeeee #00ff00 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
File tests/git_log1.final changed (mode: 100644) (index 168e603..a23c181)
1 1 <div class="diff"> <div class="diff">
2 2 <br /> <br />
3 <a name="dis1">
3 <a name="dis1"></a>
4 4 <table class="chunk" width="100%"> <table class="chunk" width="100%">
5 5 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>dis1</b> changed (mode: 100644) (index 2c4179b..2bf9115):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>dis1</b> changed (mode: 100644) (index 2c4179b..2bf9115):</td></tr>
6 6 1 &nbsp; #ff0000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa #eeeeee 1 &nbsp; #ff0000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa #eeeeee
 
10 10 </div> </div>
11 11 <div class="diff"> <div class="diff">
12 12 <br /> <br />
13 <a name="dis1">
13 <a name="dis1"></a>
14 14 <table class="chunk" width="100%"> <table class="chunk" width="100%">
15 15 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>dis1</b> added (mode: 100644) (index 0000000..2c4179b):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>dis1</b> added (mode: 100644) (index 0000000..2c4179b):</td></tr>
16 16 &nbsp; 1 #eeeeee #00ff00 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &nbsp; 1 #eeeeee #00ff00 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
19 19 </div> </div>
20 20 <div class="diff"> <div class="diff">
21 21 <br /> <br />
22 <a name="a b c">
22 <a name="a b c"></a>
23 23 <table class="chunk" width="100%"> <table class="chunk" width="100%">
24 24 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a b c</b> added (mode: 100644) (index 0000000..72943a1):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a b c</b> added (mode: 100644) (index 0000000..72943a1):</td></tr>
25 25 &nbsp; 1 #eeeeee #00ff00 aaa &nbsp; 1 #eeeeee #00ff00 aaa
 
27 27 </div> </div>
28 28 <div class="diff"> <div class="diff">
29 29 <br /> <br />
30 <a name="a3">
30 <a name="a3"></a>
31 31 <table class="chunk" width="100%"> <table class="chunk" width="100%">
32 32 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a3</b> deleted (index 193814c..0000000):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a3</b> deleted (index 193814c..0000000):</td></tr>
33 33 1 &nbsp; #ff0000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa #eeeeee 1 &nbsp; #ff0000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa #eeeeee
 
35 35 </div> </div>
36 36 <div class="diff"> <div class="diff">
37 37 <br /> <br />
38 <a name="a3">
38 <a name="a3"></a>
39 39 <table class="chunk" width="100%"> <table class="chunk" width="100%">
40 40 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a3</b> renamed from a2 (similarity 100%):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a3</b> renamed from a2 (similarity 100%):</td></tr>
41 41 </table> </table>
42 42 <br /> <br />
43 <a name="c">
43 <a name="c"></a>
44 44 <table class="chunk" width="100%"> <table class="chunk" width="100%">
45 45 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>c</b> added (mode: 100644) (index 0000000..8ded189):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>c</b> added (mode: 100644) (index 0000000..8ded189):</td></tr>
46 46 &nbsp; 1 #eeeeee #00ff00 aaaaaaaaaaaaaaaaaaaa &nbsp; 1 #eeeeee #00ff00 aaaaaaaaaaaaaaaaaaaa
 
48 48 </div> </div>
49 49 <div class="diff"> <div class="diff">
50 50 <br /> <br />
51 <a name="a2">
51 <a name="a2"></a>
52 52 <table class="chunk" width="100%"> <table class="chunk" width="100%">
53 53 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a2</b> added (mode: 100644) (index 0000000..193814c):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a2</b> added (mode: 100644) (index 0000000..193814c):</td></tr>
54 54 &nbsp; 1 #eeeeee #00ff00 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &nbsp; 1 #eeeeee #00ff00 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
56 56 </div> </div>
57 57 <div class="diff"> <div class="diff">
58 58 <br /> <br />
59 <a name="empty.txt">
59 <a name="empty.txt"></a>
60 60 <table class="chunk" width="100%"> <table class="chunk" width="100%">
61 61 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>empty.txt</b> added (mode: 100644) (index 0000000..e69de29):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>empty.txt</b> added (mode: 100644) (index 0000000..e69de29):</td></tr>
62 62 </table> </table>
63 63 </div> </div>
64 64 <div class="diff"> <div class="diff">
65 65 <br /> <br />
66 <a name="xx&quot;yy">
66 <a name="xx&quot;yy"></a>
67 67 <table class="chunk" width="100%"> <table class="chunk" width="100%">
68 68 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>xx&quot;yy</b> added (mode: 100644) (index 0000000..e69de29):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>xx&quot;yy</b> added (mode: 100644) (index 0000000..e69de29):</td></tr>
69 69 </table> </table>
70 70 </div> </div>
71 71 <div class="diff"> <div class="diff">
72 72 <br /> <br />
73 <a name="a">
73 <a name="a"></a>
74 74 <table class="chunk" width="100%"> <table class="chunk" width="100%">
75 75 <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a</b> added (mode: 100644) (index 0000000..193814c):</td></tr> <tr style="border: 1px; background: #dddddd"><td colspan="4">File <b>a</b> added (mode: 100644) (index 0000000..193814c):</td></tr>
76 76 &nbsp; 1 #eeeeee #00ff00 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &nbsp; 1 #eeeeee #00ff00 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
File tests/http_bug.php changed (mode: 100644) (index 35aae2e..9802330)
... ... require_once("common.php");
18 18 $_testns = 'http_bug'; $_testns = 'http_bug';
19 19 $rg_cache_enable = TRUE; $rg_cache_enable = TRUE;
20 20
21 rg_test_create_user($db, $rg_ui);
22 rg_test_create_user($db, $rg_ui2);
23 rg_test_create_repo($db, $rg_ui, $repo);
21 rg_test_create_user($db, $u1);
22 rg_test_create_user($db, $u2);
23 rg_test_create_repo($db, $u1, $repo);
24 24
25 $r = test_login($test_url, $rg_ui, $good_sid);
25 $r = test_login($test_url, $u1, $good_sid);
26 26 if ($r === FALSE) if ($r === FALSE)
27 27 exit(1); exit(1);
28 28
29 29
30 30 rg_log("Loading bug form..."); rg_log("Loading bug form...");
31 $url = "/user/" . $rg_ui['username'] . "/" . $repo['name'] . "/bug/add";
31 $url = "/user/" . $u1['username'] . "/" . $repo['name'] . "/bug/add";
32 32 $headers = array("Cookie: sid=" . $good_sid); $headers = array("Cookie: sid=" . $good_sid);
33 33 $data = array(); $data = array();
34 34 $r = do_req($test_url . $url, $data, $headers); $r = do_req($test_url . $url, $data, $headers);
 
... ... $data = array('doit' => 1, 'edit' => 1, 'token' => $token,
49 49 'title' => 'Title1 space<xss>', 'title' => 'Title1 space<xss>',
50 50 'body' => 'aasasasassa<xss>', 'body' => 'aasasasassa<xss>',
51 51 'state' => 1, 'state' => 1,
52 'assigned_to' => $rg_ui2['username'],
53 'labels' => implode(' ', $labels));
52 'assigned_to' => $u2['username'],
53 'labels' => implode(' ', $labels),
54 '_test' => 'add bug');
54 55 $r = do_req($test_url . $url, $data, $headers); $r = do_req($test_url . $url, $data, $headers);
55 56 if ($r === FALSE) { if ($r === FALSE) {
56 57 rg_log('Cannot post bug request.'); rg_log('Cannot post bug request.');
 
... ... if ($row['bug_id'] != 1) {
64 65 rg_log("Seems the bugs do not start at 1, but " . $row['bug_id']); rg_log("Seems the bugs do not start at 1, but " . $row['bug_id']);
65 66 exit(1); exit(1);
66 67 } }
67 if ($row['assigned_uid'] != $rg_ui2['uid']) {
68 rg_log('assigned_uid is not ' . $rg_ui2['uid']
68 if ($row['assigned_uid'] != $u2['uid']) {
69 rg_log('assigned_uid is not ' . $u2['uid']
69 70 . ', but ' . $row['assigned_uid'] . '!'); . ', but ' . $row['assigned_uid'] . '!');
70 71 exit(1); exit(1);
71 72 } }
 
... ... if (strcmp($p1, $p2) != 0) {
93 94 rg_log("Testing adding a note"); rg_log("Testing adding a note");
94 95
95 96 rg_log("Loading bug/note form..."); rg_log("Loading bug/note form...");
96 $url = "/user/" . $rg_ui['username'] . "/" . $repo['name'] . "/bug/1";
97 $data = array();
97 $url = "/user/" . $u1['username'] . "/" . $repo['name'] . "/bug/1";
98 $data = array('_test' => 'adding a note');
98 99 $r = do_req($test_url . $url, $data, $headers); $r = do_req($test_url . $url, $data, $headers);
99 100 if ($r === FALSE) { if ($r === FALSE) {
100 101 rg_log("Cannot load bug page."); rg_log("Cannot load bug page.");
 
... ... $token = $r['token'];
105 106 rg_log("Posting note add form (token=$token)..."); rg_log("Posting note add form (token=$token)...");
106 107 $note = 'This is a note<xss>'; $note = 'This is a note<xss>';
107 108 $data = array('note_add_doit' => 1, 'token' => $token, $data = array('note_add_doit' => 1, 'token' => $token,
108 'note' => $note);
109 'note' => $note,
110 '_test' => 'adding a note');
109 111 $r = do_req($test_url . $url, $data, $headers); $r = do_req($test_url . $url, $data, $headers);
110 112 if ($r === FALSE) { if ($r === FALSE) {
111 113 rg_log('Cannot post bug request.'); rg_log('Cannot post bug request.');
 
... ... if ($row['note'] != $note) {
120 122 rg_log('Note is not ok [' . $note . '] != [' . $row['note'] . ']!'); rg_log('Note is not ok [' . $note . '] != [' . $row['note'] . ']!');
121 123 exit(1); exit(1);
122 124 } }
123 if ($row['uid'] != $rg_ui['uid']) {
124 rg_log('uid is not ok [' . $row['uid'] . '] != [' . $rg_ui['uid'] . ']!');
125 if ($row['uid'] != $u1['uid']) {
126 rg_log('uid is not ok [' . $row['uid'] . '] != [' . $u1['uid'] . ']!');
125 127 exit(1); exit(1);
126 128 } }
127 129
 
... ... $token = $r['token'];
131 133 rg_log("Posting close bug form..."); rg_log("Posting close bug form...");
132 134 $data = array('token' => $token, $data = array('token' => $token,
133 135 'close_reopen' => 1, 'close_reopen' => 1,
134 'state' => 2);
136 'state' => 2,
137 '_test' => 'closing a bug');
135 138 $r = do_req($test_url . $url, $data, $headers); $r = do_req($test_url . $url, $data, $headers);
136 139 if ($r === FALSE) { if ($r === FALSE) {
137 140 rg_log('Cannot post bug request.'); rg_log('Cannot post bug request.');
 
... ... $token = $r['token'];
153 156 rg_log("Posting re-open bug form..."); rg_log("Posting re-open bug form...");
154 157 $data = array('token' => $token, $data = array('token' => $token,
155 158 'close_reopen' => 1, 'close_reopen' => 1,
156 'state'=> 1);
159 'state'=> 1,
160 '_test' => 're-opn bug');
157 161 $r = do_req($test_url . $url, $data, $headers); $r = do_req($test_url . $url, $data, $headers);
158 162 if ($r === FALSE) { if ($r === FALSE) {
159 163 rg_log('Cannot post bug request.'); rg_log('Cannot post bug request.');
 
... ... for ($i = 0; $i <= 1; $i++) {
176 180 $token = $r['token']; $token = $r['token'];
177 181 rg_log("Posting delete bug form..."); rg_log("Posting delete bug form...");
178 182 $data = array('token' => $token, $data = array('token' => $token,
179 'del_undel' => $i + 1);
183 'del_undel' => $i + 1,
184 '_test' => 'deleting a bug');
180 185 $r = do_req($test_url . $url, $data, $headers); $r = do_req($test_url . $url, $data, $headers);
181 186 if ($r === FALSE) { if ($r === FALSE) {
182 187 rg_log('Cannot post bug request.'); rg_log('Cannot post bug request.');
 
... ... for ($i = 0; $i <= 1; $i++) {
196 201 . ' deleted= [' . $row['deleted'] . ']!'); . ' deleted= [' . $row['deleted'] . ']!');
197 202 exit(1); exit(1);
198 203 } }
199 if ($row['deleted_who'] != $rg_ui['uid']) {
204 if ($row['deleted_who'] != $u1['uid']) {
200 205 rg_log('i=' . $i . ': Seems the deleted_who was not updated;' rg_log('i=' . $i . ': Seems the deleted_who was not updated;'
201 206 . ' deleted_who= [' . $row['deleted_who'] . ']!'); . ' deleted_who= [' . $row['deleted_who'] . ']!');
202 207 exit(1); exit(1);
 
... ... for ($i = 0; $i <= 1; $i++) {
205 210
206 211
207 212 // Test watching a bug - we need to login as a different user // Test watching a bug - we need to login as a different user
208 $r = test_login($test_url, $rg_ui2, $good_sid);
213 $r = test_login($test_url, $u2, $good_sid);
209 214 if ($r === FALSE) if ($r === FALSE)
210 215 exit(1); exit(1);
211 216 $headers = array("Cookie: sid=" . $good_sid); $headers = array("Cookie: sid=" . $good_sid);
 
... ... $headers = array("Cookie: sid=" . $good_sid);
213 218 // We are already in the watch list because the asignee is automatically added // We are already in the watch list because the asignee is automatically added
214 219 for ($i = 0; $i <= 1; $i++) { for ($i = 0; $i <= 1; $i++) {
215 220 rg_log("Loading bug form (i=$i)..."); rg_log("Loading bug form (i=$i)...");
216 $data = array();
221 $data = array('_test' => 'load-form-watch-' . $i);
217 222 $r = do_req($test_url . $url, $data, $headers); $r = do_req($test_url . $url, $data, $headers);
218 223 if ($r === FALSE) { if ($r === FALSE) {
219 224 rg_log('Cannot load bug form.'); rg_log('Cannot load bug form.');
 
... ... for ($i = 0; $i <= 1; $i++) {
222 227 $token = $r['token']; $token = $r['token'];
223 228
224 229 rg_log("Posting (un)watch bug form..."); rg_log("Posting (un)watch bug form...");
225 $data = array('token' => $token, 'watch' => $i, 'unwatch' => 1 - $i);
230 $data = array('token' => $token, 'watch' => $i, 'unwatch' => 1 - $i,
231 '_test' => 'post-watch-' . $i);
226 232 $r = do_req($test_url . $url, $data, $headers); $r = do_req($test_url . $url, $data, $headers);
227 233 if ($r === FALSE) { if ($r === FALSE) {
228 234 rg_log('Cannot post watch bug request.'); rg_log('Cannot post watch bug request.');
 
... ... for ($i = 0; $i <= 1; $i++) {
238 244 rg_sql_free_result($res); rg_sql_free_result($res);
239 245
240 246 if ($i == 0) { // unwatch - only rg_ui[uid] should be present if ($i == 0) { // unwatch - only rg_ui[uid] should be present
241 if (($rows != 1) || ($row[0]['uid'] != $rg_ui['uid'])) {
247 if (($rows != 1) || ($row[0]['uid'] != $u1['uid'])) {
242 248 rg_log_ml('Seems we could not watch the bug; row:' rg_log_ml('Seems we could not watch the bug; row:'
243 249 . print_r($row, TRUE)); . print_r($row, TRUE));
244 250 exit(1); exit(1);
245 251 } }
246 252 } else { } else {
247 $_l = array($rg_ui['uid'], $rg_ui2['uid']);
253 $_l = array($u1['uid'], $u2['uid']);
248 254 for ($j = 0; $j <= 1; $j++) { for ($j = 0; $j <= 1; $j++) {
249 255 if (!in_array($row[$j]['uid'], $_l)) { if (!in_array($row[$j]['uid'], $_l)) {
250 256 rg_log('Seems I cannot unwatch a bug' rg_log('Seems I cannot unwatch a bug'
File tests/rights.php changed (mode: 100644) (index b1f853a..8673c28)
... ... rg_log("rights: testing 'test'...");
61 61 $rights = array(array("rights" => "ABC", "ip" => "")); $rights = array(array("rights" => "ABC", "ip" => ""));
62 62 $needed_rights = "BCD"; $needed_rights = "BCD";
63 63 $ip = "1.2.3.4"; $ip = "1.2.3.4";
64 $misc = FALSE;
64 $misc = '';
65 65 $r = rg_rights_test($rights, $needed_rights, $ip, $misc); $r = rg_rights_test($rights, $needed_rights, $ip, $misc);
66 66 if ($r !== FALSE) { if ($r !== FALSE) {
67 67 rg_log("allow is not working right!"); rg_log("allow is not working right!");
File tests/util.php changed (mode: 100644) (index a230cfd..d7933c8)
... ... if (strcmp($x['HTML:X::A'], "Aval") != 0) {
359 359
360 360 // rg_re_repo_git($organization, $user, $repo) // rg_re_repo_git($organization, $user, $repo)
361 361 $r = rg_re_repo_git(1, 'u1<', 'repo2ș'); $r = rg_re_repo_git(1, 'u1<', 'repo2ș');
362 $e = 'git://r1.embedromix.ro/u1%3C/repo2%C8%99';
362 $e = 'git://localhost/u1%3C/repo2%C8%99';
363 363 if (strcmp($r, $e) != 0) { if (strcmp($r, $e) != 0) {
364 364 rg_log("re_repo_git is wrong [$r] != [$e]!"); rg_log("re_repo_git is wrong [$r] != [$e]!");
365 365 exit(1); exit(1);
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