File | Lines added | Lines deleted |
---|---|---|
README | 5 | 1 |
TODO | 14 | 9 |
hooks/post-receive | 2 | 1 |
inc/bug.inc.php | 2 | 2 |
inc/dispatch/dispatch.php | 2 | 4 |
inc/git.inc.php | 8 | 3 |
inc/repo.inc.php | 12 | 11 |
inc/repo/repo.php | 1 | 2 |
inc/repo/search.form.php | 0 | 8 |
inc/user/create.php | 3 | 3 |
inc/user/home-page.php | 1 | 26 |
inc/user/repo-page.php | 56 | 50 |
inc/user/repo/admin/admin.php | 5 | 5 |
inc/user/repo/admin/delete/delete.php | 1 | 1 |
inc/user/repo/admin/edit/edit.php | 8 | 8 |
inc/user/repo/admin/rights/README | 0 | 0 |
inc/user/repo/admin/rights/rights.php | 6 | 1 |
inc/user/repo/bug/add/add.php | 2 | 2 |
inc/user/repo/bug/main.php | 8 | 8 |
inc/user/repo/bug/show/show.php | 3 | 2 |
inc/util.inc.php | 59 | 21 |
rocketgit.spec.in | 4 | 2 |
root/themes/default/hints/repo/edit_rights.html | 2 | 0 |
root/themes/default/main.css | 1 | 0 |
root/themes/default/user/logout.html | 3 | 0 |
root/themes/default/user/repo/delete/sure.html | 3 | 1 |
scripts/remote.php | 2 | 0 |
File README changed (mode: 100644) (index 69d280c..f5ad10f) | |||
12 | 12 | . Very little dependencies, all packaged in main-stream distributions | . Very little dependencies, all packaged in main-stream distributions |
13 | 13 | . SELinux friendly | . SELinux friendly |
14 | 14 | . Very small | . Very small |
15 | . | ||
16 | 15 | ||
17 | 16 | ||
18 | 17 | == Install == | == Install == |
18 | . Notes: | ||
19 | - It is recommended to NOT install rocketgit on a multiuser machine. | ||
20 | There are some things that should be fixed first. We are working on it. | ||
21 | |||
19 | 22 | . Edit /etc/rocketgit/config.php | . Edit /etc/rocketgit/config.php |
20 | 23 | . Edit /etc/httpd/conf.d/rocketgit.conf | . Edit /etc/httpd/conf.d/rocketgit.conf |
21 | 24 | ||
82 | 85 | . Special thanks to a lot of people that came with suggestions. | . Special thanks to a lot of people that came with suggestions. |
83 | 86 | . Special thanks to gitosys, Gitorious and other projects from where I learned | . Special thanks to gitosys, Gitorious and other projects from where I learned |
84 | 87 | things. | things. |
88 | . See AUTHORS file for all people contributed to this project. |
File TODO changed (mode: 100644) (index f7838c4..22f8b92) | |||
1 | 1 | == BEFORE FIRST RELEASE! == | == BEFORE FIRST RELEASE! == |
2 | [ ] Delete rights by select. | ||
3 | [ ] menu shoul be on almost black bg with white text. | ||
4 | [ ] Description does not respect new lines. | ||
2 | [ ] Fix this shit. isset($_REQUEST['rights']) ? rg_rights_a2s(rg_var_str("rights")) : $rg | ||
3 | [ ] when you add a bug, state any shoul not be present. | ||
4 | [ ] bug tracker is private? | ||
5 | [ ] When I visit bug page, I auto add a save search. Bad! (doit == 1) | ||
6 | [ ] Is not clear that the owner has full rights (repo->admin->edit). | ||
5 | 7 | [ ] Checking for "rg_ui['uid'] == 0" may not be enough. | [ ] Checking for "rg_ui['uid'] == 0" may not be enough. |
6 | 8 | Maybe rg_ui[['uid'] = repo['uid']? | Maybe rg_ui[['uid'] = repo['uid']? |
7 | [ ] "log" is not working. | ||
8 | [ ] When you search, private repos should not be present. | ||
9 | 9 | [ ] List on the first page the latest commits. | [ ] List on the first page the latest commits. |
10 | 10 | Do not forget to exclude private repos. | Do not forget to exclude private repos. |
11 | 11 | [ ] bug_update does not update labels! | [ ] bug_update does not update labels! |
13 | 13 | [ ] Should we expire the reset password token? Why? | [ ] Should we expire the reset password token? Why? |
14 | 14 | Somebody can request another one! | Somebody can request another one! |
15 | 15 | [ ] All internal error should show a special page? | [ ] All internal error should show a special page? |
16 | [ ] Deleting a SSH key should be done with token: | ||
16 | [ ] Deleting SSH key should be done with token: | ||
17 | 17 | First, invalidate it, second delete it. Maybe show an undelete page? | First, invalidate it, second delete it. Maybe show an undelete page? |
18 | 18 | Or, allow delete and move it to deleted list and allow undelete and | Or, allow delete and move it to deleted list and allow undelete and |
19 | 19 | then delete? Hm. | then delete? Hm. |
23 | 23 | [ ] Third option: anybody can create an account but must be validated by admin. | [ ] Third option: anybody can create an account but must be validated by admin. |
24 | 24 | [ ] After creating the account, keep the user logged in and allow login | [ ] After creating the account, keep the user logged in and allow login |
25 | 25 | even if is not confirmed (option in config). | even if is not confirmed (option in config). |
26 | [ ] Fix the headers (+dkim) to avoid spam. | ||
26 | [ ] Fix the mail headers (+dkim) to avoid spam. | ||
27 | 27 | [ ] logrotate is not working. | [ ] logrotate is not working. |
28 | 28 | [ ] Build a function to store data in a processing queue: | [ ] Build a function to store data in a processing queue: |
29 | 29 | dirs like YYYY/MM/DD/HH/MM/job | dirs like YYYY/MM/DD/HH/MM/job |
30 | 30 | [ ] Use some named pipes to signal q.php/cron.php to do some stuff. | [ ] Use some named pipes to signal q.php/cron.php to do some stuff. |
31 | [ ] | ||
32 | 31 | [ ] Check if we can give rights for a non-owning repo! | [ ] Check if we can give rights for a non-owning repo! |
33 | 32 | We should check if the user that gives rights is the owner! | We should check if the user that gives rights is the owner! |
33 | [ ] | ||
34 | 34 | ||
35 | 35 | ||
36 | 36 | == Medium == | == Medium == |
37 | [ ] Allow search from the first page. | ||
38 | [ ] Send notifications when a user is given rights to a repo. | ||
39 | [ ] Detect hexa strings and link them to commits. | ||
40 | [ ] Any user on a machine can look at repositories. | ||
41 | Any user can connect to database. Fix also the README after fixing this. | ||
37 | 42 | [ ] Provide OpenVPN tunnels. | [ ] Provide OpenVPN tunnels. |
38 | 43 | [ ] Errors should signal what field is not ok. | [ ] Errors should signal what field is not ok. |
39 | 44 | [ ] Replace all *.form.php with templates. | [ ] Replace all *.form.php with templates. |
72 | 77 | [ ] We are escaping when we insert in database _and_ when we output on screen! | [ ] We are escaping when we insert in database _and_ when we output on screen! |
73 | 78 | What should we do? | What should we do? |
74 | 79 | [ ] Add permission to add bug tracker to a project. | [ ] Add permission to add bug tracker to a project. |
75 | [ ] When repo is empty, weshould not show the Log/Tree menu. | ||
80 | [ ] When repo is empty, we should not show the Log/Tree menu. | ||
76 | 81 | [ ] @@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. |
77 | 82 | [ ] Fix diff output. Cannot deal with renames/removes/etc. | [ ] Fix diff output. Cannot deal with renames/removes/etc. |
78 | 83 | [ ] Check admin creatin of an account. | [ ] Check admin creatin of an account. |
File hooks/post-receive changed (mode: 100755) (index 27ab082..72701e2) | |||
... | ... | fclose($f); | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | // Mark repository dirty for disk statistics and other stuff | // Mark repository dirty for disk statistics and other stuff |
63 | @file_put_contents($repo_path . "/dirty", ""); | ||
63 | // TODO: deal with the case when is not possible to write that file. | ||
64 | @file_put_contents($repo_path . "/rocketgit/dirty", ""); | ||
64 | 65 | ||
65 | 66 | $a = array( | $a = array( |
66 | 67 | "op" => "push", | "op" => "push", |
File inc/bug.inc.php changed (mode: 100644) (index 60cb3b6..cdfc81a) | |||
... | ... | function rg_bug_list_query($db, $url, $sql) | |
412 | 412 | function rg_bug_search_load_all($db, $repo_id, $uid, $url) | function rg_bug_search_load_all($db, $repo_id, $uid, $url) |
413 | 413 | { | { |
414 | 414 | rg_prof_start("bug_search_load_all"); | rg_prof_start("bug_search_load_all"); |
415 | rg_log("bug_search_load_all: repo_id=$repo_id uid=$uid"); | ||
415 | rg_log("bug_search_load_all: repo_id=$repo_id uid=$uid url=$url"); | ||
416 | 416 | ||
417 | 417 | $ret = FALSE; | $ret = FALSE; |
418 | 418 | do { | do { |
... | ... | function rg_bug_search($db, $url, $repo_id, $uid, $q) | |
663 | 663 | $limit = $q['bugs_per_page']; | $limit = $q['bugs_per_page']; |
664 | 664 | ||
665 | 665 | // Only if we have a name and the user is logged in | // Only if we have a name and the user is logged in |
666 | if (!empty($q['name']) && ($uid > 0)) { | ||
666 | if (!empty($q['name']) && ($uid > 0) && ($q['standard'] == 0)) { | ||
667 | 667 | $r = rg_bug_search_save($db, $repo_id, $uid, $q); | $r = rg_bug_search_save($db, $repo_id, $uid, $q); |
668 | 668 | if ($r === FALSE) | if ($r === FALSE) |
669 | 669 | break; | break; |
File inc/dispatch/dispatch.php changed (mode: 100644) (index 9aa6f7e..fb56ea9) | |||
... | ... | case 'login': | |
13 | 13 | ||
14 | 14 | case 'logout': | case 'logout': |
15 | 15 | if (rg_sess_destroy($db, $sid, $rg_ui)) { | if (rg_sess_destroy($db, $sid, $rg_ui)) { |
16 | include($INC . "/bye/bye.php"); | ||
17 | $body .= $_bye; | ||
16 | $body .= rg_template("user/logout.html", $more); | ||
18 | 17 | } else { | } else { |
19 | $body .= "Cannot log you out. Please clean all cookies" | ||
20 | . " and restart browser!"; | ||
18 | $body .= rg_template("user/logout_err.html", $more); | ||
21 | 19 | } | } |
22 | 20 | break; | break; |
23 | 21 |
File inc/git.inc.php changed (mode: 100644) (index e224b27..c67035a) | |||
... | ... | function rg_git_log($max, $from, $to, $also_patch) | |
513 | 513 | ||
514 | 514 | rg_log("git_log: from=$from to=$to max=$max"); | rg_log("git_log: from=$from to=$to max=$max"); |
515 | 515 | ||
516 | //Test if we have an emptydir | ||
516 | // Test if we have an empty dir | ||
517 | 517 | $_dir = getenv("GIT_DIR"); | $_dir = getenv("GIT_DIR"); |
518 | if (empty($_dir)) { | ||
519 | rg_log("\tGIT_DIR is not defined!"); | ||
520 | return FALSE; | ||
521 | } | ||
522 | |||
518 | 523 | if (!file_exists($_dir . "/refs/heads/master")) { | if (!file_exists($_dir . "/refs/heads/master")) { |
519 | 524 | rg_log("\tRepo is empty."); | rg_log("\tRepo is empty."); |
520 | 525 | return ""; | return ""; |
... | ... | function rg_git_log($max, $from, $to, $also_patch) | |
532 | 537 | $from_to = " " . $from . ".." . $to; | $from_to = " " . $from . ".." . $to; |
533 | 538 | } | } |
534 | 539 | ||
535 | $cmd = "git log" | ||
540 | $cmd = "git --no-pager log" | ||
536 | 541 | . " --no-merges" | . " --no-merges" |
537 | 542 | . " -z" | . " -z" |
538 | 543 | . $max_count | . $max_count |
... | ... | function rg_git_branches_and_tags($repo_dir, $base_url, $current_ref) | |
1029 | 1034 | */ | */ |
1030 | 1035 | function rg_git_parse_ref(&$paras) | function rg_git_parse_ref(&$paras) |
1031 | 1036 | { | { |
1032 | rg_log("git_parse_ref: " . rg_array2string($paras)); | ||
1037 | rg_log("git_parse_ref: " . rg_array2string($paras) . "."); | ||
1033 | 1038 | ||
1034 | 1039 | $ret = array("ref_type" => "", | $ret = array("ref_type" => "", |
1035 | 1040 | "ref_url" => "", | "ref_url" => "", |
File inc/repo.inc.php changed (mode: 100644) (index 2ae3888..70f57e7) | |||
... | ... | function rg_repo_list($db, $url, $rg_ui) | |
449 | 449 | } | } |
450 | 450 | ||
451 | 451 | /* | /* |
452 | * | ||
452 | * Search in all repositories | ||
453 | * We need to not find private repositories. | ||
453 | 454 | */ | */ |
454 | function rg_repo_search($db, $q, $masters) | ||
455 | function rg_repo_search($db, $rg_ui, $q) | ||
455 | 456 | { | { |
456 | rg_log("repo_search: q=$q, masters=$masters..."); | ||
457 | |||
458 | $add = ""; | ||
459 | if ($masters == 1) | ||
460 | $add = " AND master = 0"; | ||
457 | rg_prof_start("repo_search"); | ||
458 | rg_log("repo_search: q=$q..."); | ||
461 | 459 | ||
462 | 460 | $e_q = rg_sql_escape($db, $q); | $e_q = rg_sql_escape($db, $q); |
463 | 461 | ||
464 | 462 | $sql = "SELECT * FROM repos" | $sql = "SELECT * FROM repos" |
465 | 463 | . " WHERE deleted = 0" | . " WHERE deleted = 0" |
466 | . " AND name ILIKE '%$e_q%'" | ||
467 | . $add | ||
468 | . " ORDER BY name" | ||
464 | . " AND (name ILIKE '%$e_q%' OR description ILIKE '%$e_q%')" | ||
465 | . " AND (uid = " . $rg_ui['uid'] . " OR default_rights LIKE '%F%')" | ||
466 | . " ORDER BY master, name" | ||
469 | 467 | . " LIMIT 10"; | . " LIMIT 10"; |
470 | 468 | ||
471 | return rg_repo_list_query($db, "", $sql); | ||
469 | $r = rg_repo_list_query($db, "", $sql); | ||
470 | |||
471 | rg_prof_end("repo_search"); | ||
472 | return $r; | ||
472 | 473 | } | } |
473 | 474 | ||
474 | 475 | /* | /* |
File inc/repo/repo.php changed (mode: 100644) (index a9d24f6..7f0c843) | |||
... | ... | case 'list': | |
63 | 63 | ||
64 | 64 | case 'search': | case 'search': |
65 | 65 | $q = rg_var_str("q"); | $q = rg_var_str("q"); |
66 | $masters = rg_var_uint("masters"); | ||
67 | 66 | ||
68 | 67 | while ($doit == 1) { | while ($doit == 1) { |
69 | $_t = rg_repo_search($db, $q, $masters); | ||
68 | $_t = rg_repo_search($db, $rg_ui, $q); | ||
70 | 69 | if ($_t === FALSE) { | if ($_t === FALSE) { |
71 | 70 | $errmsg[] = rg_repo_error(); | $errmsg[] = rg_repo_error(); |
72 | 71 | break; | break; |
File inc/repo/search.form.php changed (mode: 100644) (index 03c5581..c00ba79) | |||
... | ... | $_form .= ' | |
14 | 14 | <br /> | <br /> |
15 | 15 | <br /> | <br /> |
16 | 16 | ||
17 | <label for="masters" class="form_item_title">Only masters?</label><br /> | ||
18 | <select name="masters"> | ||
19 | <option value="1">Yes</option> | ||
20 | <option value="0">No</option> | ||
21 | </select> | ||
22 | <br /> | ||
23 | <br /> | ||
24 | |||
25 | 17 | <input type="submit" name="button" value="Search" /> | <input type="submit" name="button" value="Search" /> |
26 | 18 | ||
27 | 19 | </form> | </form> |
File inc/user/create.php changed (mode: 100644) (index 9fb133f..02a730e) | |||
1 | 1 | <?php | <?php |
2 | 2 | rg_log("/inc/user/create"); | rg_log("/inc/user/create"); |
3 | 3 | ||
4 | $user_create_more = $more; | ||
4 | 5 | $_create = ""; | $_create = ""; |
5 | 6 | ||
6 | 7 | if ($rg_account_allow_creation != 1) { | if ($rg_account_allow_creation != 1) { |
... | ... | if ($doit == 1) { | |
48 | 49 | $_u['disk_quota_mb'] = 100; | $_u['disk_quota_mb'] = 100; |
49 | 50 | $_u['rights'] = "C"; | $_u['rights'] = "C"; |
50 | 51 | $_u['session_time'] = $session_time; | $_u['session_time'] = $session_time; |
51 | $_u['confirm_token'] = rg_id(40); | ||
52 | $_u['confirm_token'] = rg_id(20); | ||
52 | 53 | if (!rg_user_edit($db, $_u)) { | if (!rg_user_edit($db, $_u)) { |
53 | 54 | $errmsg[] = "Cannot add user (" . rg_user_error() . ")."; | $errmsg[] = "Cannot add user (" . rg_user_error() . ")."; |
54 | 55 | break; | break; |
... | ... | if ($doit == 1) { | |
61 | 62 | } | } |
62 | 63 | ||
63 | 64 | $show_form = 0; | $show_form = 0; |
64 | $_create .= "Check your e-mail and follow the link inside."; | ||
65 | $_create .= rg_template("user/email_conf.html", $user_create_more); | ||
65 | 66 | } while (0); | } while (0); |
66 | 67 | } else { | } else { |
67 | 68 | $xuser = ""; | $xuser = ""; |
... | ... | if ($show_form == 1) { | |
81 | 82 | } | } |
82 | 83 | ||
83 | 84 | ?> | ?> |
84 |
File inc/user/home-page.php changed (mode: 100644) (index 605ccde..7b15357) | |||
... | ... | $_home = ""; | |
5 | 5 | ||
6 | 6 | $ui = rg_user_info($db, 0, $rr['user'], ""); | $ui = rg_user_info($db, 0, $rr['user'], ""); |
7 | 7 | if ($ui === FALSE) { | if ($ui === FALSE) { |
8 | $_home .= "Invalid user!"; | ||
8 | $_home .= rg_warning("Invalid user!"); | ||
9 | 9 | return; | return; |
10 | 10 | } | } |
11 | 11 | ||
12 | $is_owner = ($ui['uid'] == $rg_ui['uid']) ? 1 : 0; | ||
13 | |||
14 | 12 | // list of repositories | // list of repositories |
15 | 13 | $_home .= rg_repo_list($db, "", $ui); | $_home .= rg_repo_list($db, "", $ui); |
16 | |||
17 | // allow operations if the page is owned by the user visiting it | ||
18 | if ($is_owner == 1) { | ||
19 | $errmsg = array(); | ||
20 | |||
21 | switch ($subop) { | ||
22 | case 'edit_info': | ||
23 | include($INC . "/user/info/info.php"); | ||
24 | $_home .= $_info; | ||
25 | break; | ||
26 | |||
27 | case 'change_pass': | ||
28 | include($INC . "/user/pass/pass.php"); | ||
29 | $_home .= $_pass; | ||
30 | break; | ||
31 | |||
32 | case 'keys': | ||
33 | include($INC . "/user/keys/keys.php"); | ||
34 | $_home .= $_keys; | ||
35 | break; | ||
36 | } | ||
37 | } | ||
38 | |||
39 | 14 | ?> | ?> |
File inc/user/repo-page.php changed (mode: 100644) (index 0e16ec4..14c6068) | |||
2 | 2 | rg_log("/inc/user/repo-page"); | rg_log("/inc/user/repo-page"); |
3 | 3 | ||
4 | 4 | $_repo_page = ""; | $_repo_page = ""; |
5 | $user_more = $more; | ||
5 | $repo_more = $more; | ||
6 | 6 | ||
7 | 7 | if (rg_user_ok($rr['user']) !== TRUE) { | if (rg_user_ok($rr['user']) !== TRUE) { |
8 | $_repo_page .= "Invalid user!"; | ||
8 | $_repo_page .= rg_warning("Invalid user!"); | ||
9 | 9 | return; | return; |
10 | 10 | } | } |
11 | 11 | ||
12 | 12 | if (rg_repo_ok($rr['repo']) !== TRUE) { | if (rg_repo_ok($rr['repo']) !== TRUE) { |
13 | $_repo_page .= "Invalid repo!"; | ||
13 | $_repo_page .= rg_warning("Invalid repo!"); | ||
14 | 14 | return; | return; |
15 | 15 | } | } |
16 | 16 | ||
... | ... | while (1) { | |
35 | 35 | rg_repo_invalidate_cache($rr); | rg_repo_invalidate_cache($rr); |
36 | 36 | } | } |
37 | 37 | ||
38 | $ui = rg_user_info($db, 0, $rr['user'], ""); | ||
39 | if ($ui === FALSE) { | ||
40 | $_repo_page .= "Invalid user!"; | ||
38 | // We must not allow access to a private repo (check for fetch) | ||
39 | if (rg_repo_allow($db, $ri, $rg_ui, "F") !== TRUE) { | ||
40 | $_repo_page .= rg_warning("Not existent repo!"); | ||
41 | return; | ||
42 | } | ||
43 | |||
44 | $page_ui = rg_user_info($db, 0, $rr['user'], ""); | ||
45 | if ($page_ui === FALSE) { | ||
46 | $_repo_page .= rg_warning("Invalid user!"); | ||
41 | 47 | return; | return; |
42 | 48 | } | } |
43 | 49 | // TODO: should we test against $ri?! | // TODO: should we test against $ri?! |
44 | 50 | $can_admin = (rg_repo_allow($db, $ri, $rg_ui, "A") === TRUE) ? 1 : 0; | $can_admin = (rg_repo_allow($db, $ri, $rg_ui, "A") === TRUE) ? 1 : 0; |
45 | 51 | ||
46 | $user_more = array( | ||
52 | $repo_more = array( | ||
47 | 53 | "owner" => $rr['user'], | "owner" => $rr['user'], |
48 | "url_user" => rg_re_userpage($ui), | ||
49 | "url_repo" => rg_re_repopage($ui, $rr['repo']), | ||
54 | "url_user" => rg_re_userpage($page_ui), | ||
55 | "url_repo" => rg_re_repopage($page_ui, $rr['repo']), | ||
50 | 56 | "ssh" => rg_re_repo_ssh($rr), | "ssh" => rg_re_repo_ssh($rr), |
51 | 57 | "git" => rg_re_repo_git($rr), | "git" => rg_re_repo_git($rr), |
52 | 58 | "can_admin" => $can_admin | "can_admin" => $can_admin |
53 | 59 | ); | ); |
54 | $user_more = array_merge($user_more, $ri); | ||
55 | $user_more['default_rights'] = implode(", ", rg_rights_text("repo", $ri['default_rights'])); | ||
56 | $user_more['max_commit_size'] = $ri['max_commit_size'] == 0 ? "unlimited" : rg_1024($ri['max_commit_size']); | ||
57 | $user_more['max_users'] = $ri['max_users'] == 0 ? "unlimited" : rg_1000($ri['max_users']); | ||
58 | $user_more['hints'] = ""; | ||
60 | $repo_more = array_merge($repo_more, $ri); | ||
61 | $repo_more['default_rights'] = implode(", ", rg_rights_text("repo", $ri['default_rights'])); | ||
62 | $repo_more['max_commit_size'] = $ri['max_commit_size'] == 0 ? "unlimited" : rg_1024($ri['max_commit_size']); | ||
63 | $repo_more['max_users'] = $ri['max_users'] == 0 ? "unlimited" : rg_1000($ri['max_users']); | ||
64 | $repo_more['hints'] = ""; | ||
59 | 65 | ||
60 | 66 | $repo_dir = rg_repo_name2base($rr) . $rr['repo'] . ".git"; | $repo_dir = rg_repo_name2base($rr) . $rr['repo'] . ".git"; |
61 | 67 | rg_log("repo_dir=$repo_dir"); | rg_log("repo_dir=$repo_dir"); |
... | ... | putenv("GIT_DIR=$repo_dir"); | |
65 | 71 | if (empty($subop)) | if (empty($subop)) |
66 | 72 | $subop = "source"; | $subop = "source"; |
67 | 73 | ||
68 | $user_more['repo_body'] = ""; | ||
69 | $user_more['repo_right'] = ""; | ||
70 | $user_more['branches_and_tags'] = ""; | ||
74 | $repo_more['repo_body'] = ""; | ||
75 | $repo_more['repo_right'] = ""; | ||
76 | $repo_more['branches_and_tags'] = ""; | ||
71 | 77 | $_repo_body = ""; | $_repo_body = ""; |
72 | 78 | $_repo_right = ""; | $_repo_right = ""; |
73 | 79 | ||
74 | 80 | // build urls list | // build urls list |
75 | 81 | $urls = array(); | $urls = array(); |
76 | 82 | if ($rg_ssh_port != 0) | if ($rg_ssh_port != 0) |
77 | $urls[]['HTML:url'] = '<a href="' . $user_more['ssh'] . '">' . $user_more['ssh'] . '</a>'; | ||
83 | $urls[]['HTML:url'] = '<a href="' . $repo_more['ssh'] . '">' . $repo_more['ssh'] . '</a>'; | ||
78 | 84 | if ($rg_git_port != 0) | if ($rg_git_port != 0) |
79 | $urls[]['HTML:url'] = '<a href="' . $user_more['git'] . '">' . $user_more['git'] . '</a>'; | ||
80 | $user_more['HTML:urls'] = rg_template_table("repo/urls", $urls, $user_more); | ||
85 | $urls[]['HTML:url'] = '<a href="' . $repo_more['git'] . '">' . $repo_more['git'] . '</a>'; | ||
86 | $repo_more['HTML:urls'] = rg_template_table("repo/urls", $urls, $repo_more); | ||
81 | 87 | ||
82 | 88 | if (strcmp($subop, "admin") == 0) { | if (strcmp($subop, "admin") == 0) { |
83 | 89 | if ($can_admin != 1) | if ($can_admin != 1) |
84 | 90 | rg_security_violation("User is not admin!"); | rg_security_violation("User is not admin!"); |
85 | 91 | ||
86 | include($INC . "/user/repo/admin.php"); | ||
92 | include($INC . "/user/repo/admin/admin.php"); | ||
87 | 93 | $_repo_body .= $_admin; | $_repo_body .= $_admin; |
88 | 94 | } else if (strcmp($subop, "source") == 0) { | } else if (strcmp($subop, "source") == 0) { |
89 | 95 | $subop = array_shift($paras); | $subop = array_shift($paras); |
90 | 96 | ||
91 | 97 | $type_ref = rg_git_parse_ref($paras); | $type_ref = rg_git_parse_ref($paras); |
92 | 98 | $ref = $type_ref['ref_path']; | $ref = $type_ref['ref_path']; |
93 | $user_more = array_merge($user_more, $type_ref); | ||
99 | $repo_more = array_merge($repo_more, $type_ref); | ||
94 | 100 | ||
95 | $bt = rg_git_branches_and_tags($repo_dir, $user_more['url_repo'], | ||
101 | $bt = rg_git_branches_and_tags($repo_dir, $repo_more['url_repo'], | ||
96 | 102 | $type_ref['ref_url']); | $type_ref['ref_url']); |
97 | rg_log("DEBUG: user_more: " . rg_array2string($user_more)); | ||
98 | $user_more = array_merge($user_more, $bt); | ||
103 | //rg_log("DEBUG: repo_more: " . rg_array2string($repo_more)); | ||
104 | $repo_more = array_merge($repo_more, $bt); | ||
99 | 105 | ||
100 | 106 | $hints = array(); | $hints = array(); |
101 | 107 | if ($rg_ssh_port != 0) | if ($rg_ssh_port != 0) |
102 | $hints[]['HTML:hint'] = rg_template("hints/repo/clone_ssh.html", $user_more); | ||
108 | $hints[]['HTML:hint'] = rg_template("hints/repo/clone_ssh.html", $repo_more); | ||
103 | 109 | if ($rg_git_port != 0) | if ($rg_git_port != 0) |
104 | $hints[]['HTML:hint'] = rg_template("hints/repo/clone_git.html", $user_more); | ||
110 | $hints[]['HTML:hint'] = rg_template("hints/repo/clone_git.html", $repo_more); | ||
105 | 111 | if (rg_rights_allow($ri['default_rights'], "H")) // anonymous push? | if (rg_rights_allow($ri['default_rights'], "H")) // anonymous push? |
106 | $hints[]['HTML:hint'] = rg_template("hints/repo/anon_push.html", $user_more); | ||
107 | rg_log("DEBUG: hints1: " . rg_array2string($hints)); | ||
108 | $user_more['HTML:hints'] = rg_template_table("hints/list", $hints, $user_more); | ||
109 | rg_log("DEBUG: hints: " . $user_more['HTML:hints']); | ||
112 | $hints[]['HTML:hint'] = rg_template("hints/repo/anon_push.html", $repo_more); | ||
113 | //rg_log("DEBUG: hints1: " . rg_array2string($hints)); | ||
114 | $repo_more['HTML:hints'] = rg_template_table("hints/list", $hints, $repo_more); | ||
115 | //rg_log("DEBUG: hints: " . $repo_more['HTML:hints']); | ||
110 | 116 | ||
111 | $_repo_body .= rg_template("repo/source.html", $user_more); | ||
117 | $_repo_body .= rg_template("repo/source.html", $repo_more); | ||
112 | 118 | ||
113 | 119 | rg_log("DEBUG: subop=[$subop]"); | rg_log("DEBUG: subop=[$subop]"); |
114 | 120 | if (strcmp($subop, "tree") == 0) { | if (strcmp($subop, "tree") == 0) { |
... | ... | if (strcmp($subop, "admin") == 0) { | |
117 | 123 | if (strcmp($type, "blob") == 0) { | if (strcmp($type, "blob") == 0) { |
118 | 124 | // find hash of blob | // find hash of blob |
119 | 125 | $_path = implode("/", $paras); | $_path = implode("/", $paras); |
120 | $user_more['path'] = "/" . $_path; | ||
126 | $repo_more['path'] = "/" . $_path; | ||
121 | 127 | $_tree = rg_git_ls_tree($ref, $_path); | $_tree = rg_git_ls_tree($ref, $_path); |
122 | 128 | if ($_tree === FALSE) { | if ($_tree === FALSE) { |
123 | 129 | $_repo_body .= "Invalid path!"; | $_repo_body .= "Invalid path!"; |
... | ... | if (strcmp($subop, "admin") == 0) { | |
131 | 137 | ); | ); |
132 | 138 | $blob = array_merge($blob, $_content); | $blob = array_merge($blob, $_content); |
133 | 139 | $_repo_body .= rg_template("repo/blob.html", | $_repo_body .= rg_template("repo/blob.html", |
134 | array_merge($blob, $user_more)); | ||
140 | array_merge($blob, $repo_more)); | ||
135 | 141 | } | } |
136 | 142 | } else if (strcmp($type, "tree") == 0) { | } else if (strcmp($type, "tree") == 0) { |
137 | 143 | // find treeish of dir | // find treeish of dir |
138 | 144 | $_path = implode("/", $paras); | $_path = implode("/", $paras); |
139 | $user_more['path'] = "/" . $_path; | ||
145 | $repo_more['path'] = "/" . $_path; | ||
140 | 146 | $_tree = rg_git_ls_tree($ref, $_path); | $_tree = rg_git_ls_tree($ref, $_path); |
141 | 147 | if ($_tree === FALSE) { | if ($_tree === FALSE) { |
142 | 148 | $_repo_body .= "Invalid path!"; | $_repo_body .= "Invalid path!"; |
143 | 149 | } else { | } else { |
144 | 150 | $_hash = $_tree[0]['ref']; | $_hash = $_tree[0]['ref']; |
145 | 151 | $_tree = rg_git_ls_tree($_hash, ""); | $_tree = rg_git_ls_tree($_hash, ""); |
146 | $_repo_body .= rg_template_table("repo/tree", $_tree, $user_more); | ||
152 | $_repo_body .= rg_template_table("repo/tree", $_tree, $repo_more); | ||
147 | 153 | } | } |
148 | 154 | } else { // default is to show root tree | } else { // default is to show root tree |
149 | $user_more['path'] = ""; | ||
155 | $repo_more['path'] = ""; | ||
150 | 156 | $_tree = rg_git_ls_tree($ref, ""); | $_tree = rg_git_ls_tree($ref, ""); |
151 | $_repo_body .= rg_template_table("repo/tree", $_tree, $user_more); | ||
157 | $_repo_body .= rg_template_table("repo/tree", $_tree, $repo_more); | ||
152 | 158 | } | } |
153 | 159 | } else { // log is default | } else { // log is default |
154 | 160 | // show the log | // show the log |
... | ... | if (strcmp($subop, "admin") == 0) { | |
158 | 164 | $_repo_body .= "Error generating log!"; | $_repo_body .= "Error generating log!"; |
159 | 165 | // TODO: rg_internal_error? | // TODO: rg_internal_error? |
160 | 166 | } else if (empty($log)) { | } else if (empty($log)) { |
161 | $_repo_body .= rg_template("repo/not_init.html", $user_more); | ||
167 | $_repo_body .= rg_template("repo/not_init.html", $repo_more); | ||
162 | 168 | } else { | } else { |
163 | 169 | //rg_log("DEBUG: log: " . print_r($log, TRUE)); | //rg_log("DEBUG: log: " . print_r($log, TRUE)); |
164 | 170 | $_repo_body .= rg_git_log_template($log, | $_repo_body .= rg_git_log_template($log, |
165 | "repo/log", $user_more); | ||
171 | "repo/log", $repo_more); | ||
166 | 172 | } | } |
167 | 173 | ||
168 | 174 | $type = array_shift($paras); | $type = array_shift($paras); |
... | ... | if (strcmp($subop, "admin") == 0) { | |
191 | 197 | $_repo_body .= rg_git_diff($log[0]['patches'], "repo/diff.html"); | $_repo_body .= rg_git_diff($log[0]['patches'], "repo/diff.html"); |
192 | 198 | } | } |
193 | 199 | } | } |
194 | $_repo_right = rg_template("repo/source_r.html", $user_more); | ||
200 | $_repo_right = rg_template("repo/source_r.html", $repo_more); | ||
195 | 201 | } else if (strcmp($subop, "bug") == 0) { | } else if (strcmp($subop, "bug") == 0) { |
196 | 202 | include($INC . "/user/repo/bug/main.php"); | include($INC . "/user/repo/bug/main.php"); |
197 | $_repo_body .= rg_template("repo/bug/main.html", $user_more); | ||
203 | $_repo_body .= $bug_body; | ||
198 | 204 | } else if (strcmp($subop, "stats") == 0) { | } else if (strcmp($subop, "stats") == 0) { |
199 | $_repo_body .= rg_template("repo/stats.html", $user_more); | ||
205 | $_repo_body .= rg_template("repo/stats.html", $repo_more); | ||
200 | 206 | } else if (strcmp($subop, "mr") == 0) { | } else if (strcmp($subop, "mr") == 0) { |
201 | 207 | if (empty($paras[0])) { | if (empty($paras[0])) { |
202 | $_repo_body .= rg_template("repo/mrs.html", $user_more); | ||
208 | $_repo_body .= rg_template("repo/mrs.html", $repo_more); | ||
203 | 209 | ||
204 | 210 | $r = rg_mr_load($db, $ri['repo_id'], 20); | $r = rg_mr_load($db, $ri['repo_id'], 20); |
205 | 211 | if ($r === FALSE) { | if ($r === FALSE) { |
206 | 212 | $_repo_body .= "Error getting merge request list (" | $_repo_body .= "Error getting merge request list (" |
207 | 213 | . rg_mr_error() . ")."; | . rg_mr_error() . ")."; |
208 | 214 | } else { | } else { |
209 | $_repo_body .= rg_template_table("repo/mr/list", $r, $user_more); | ||
215 | $_repo_body .= rg_template_table("repo/mr/list", $r, $repo_more); | ||
210 | 216 | } | } |
211 | 217 | } else { | } else { |
212 | 218 | $mr = preg_replace('/[^0-9a-zA-Z_]/', '', $paras[0]); | $mr = preg_replace('/[^0-9a-zA-Z_]/', '', $paras[0]); |
... | ... | if (strcmp($subop, "admin") == 0) { | |
223 | 229 | break; | break; |
224 | 230 | } | } |
225 | 231 | ||
226 | $mri['HTML:diff'] = rg_git_log_template($_log, "repo/log", $user_more); | ||
227 | $_repo_body .= rg_template("repo/mr/page.html", $mri, $user_more); | ||
232 | $mri['HTML:diff'] = rg_git_log_template($_log, "repo/log", $repo_more); | ||
233 | $_repo_body .= rg_template("repo/mr/page.html", $mri, $repo_more); | ||
228 | 234 | } while (0); | } while (0); |
229 | 235 | } | } |
230 | 236 | } | } |
231 | 237 | ||
232 | $user_more['HTML:repo_body'] = $_repo_body; | ||
233 | $user_more['HTML:repo_right'] = $_repo_right; | ||
234 | $_repo_page = rg_template("repo/main.html", $user_more); | ||
238 | $repo_more['HTML:repo_body'] = $_repo_body; | ||
239 | $repo_more['HTML:repo_right'] = $_repo_right; | ||
240 | $_repo_page = rg_template("repo/main.html", $repo_more); | ||
235 | 241 | ?> | ?> |
File inc/user/repo/admin/admin.php renamed from inc/user/repo/admin.php (similarity 73%) (mode: 100644) (index 68431ee..966187a) | |||
1 | 1 | <?php | <?php |
2 | rg_log("/inc/user/repo/admin"); | ||
2 | rg_log("/inc/user/repo/admin/admin"); | ||
3 | 3 | ||
4 | 4 | $_admin_body = ""; | $_admin_body = ""; |
5 | $repo_admin_more = $more; | ||
5 | $repo_admin_more = $repo_more; | ||
6 | 6 | ||
7 | 7 | // TODO: we must set the url globally, in index.php! | // TODO: we must set the url globally, in index.php! |
8 | 8 | $_url_admin = rg_re_repopage($rg_ui, $rr['repo']) . "/admin"; | $_url_admin = rg_re_repopage($rg_ui, $rr['repo']) . "/admin"; |
... | ... | $repo_admin_more['url_admin'] = $_url_admin; | |
13 | 13 | $_op = empty($paras) ? "" : $paras[0]; | $_op = empty($paras) ? "" : $paras[0]; |
14 | 14 | switch ($_op) { | switch ($_op) { |
15 | 15 | case 'edit': | case 'edit': |
16 | include($INC . "/user/repo/edit/edit.php"); | ||
16 | include($INC . "/user/repo/admin/edit/edit.php"); | ||
17 | 17 | $_admin_body .= $_edit; | $_admin_body .= $_edit; |
18 | 18 | break; | break; |
19 | 19 | ||
20 | 20 | case 'rights': | case 'rights': |
21 | include($INC . "/user/repo/rights/rights.php"); | ||
21 | include($INC . "/user/repo/admin/rights/rights.php"); | ||
22 | 22 | $_admin_body .= $_rights; | $_admin_body .= $_rights; |
23 | 23 | break; | break; |
24 | 24 | ||
25 | 25 | case 'delete': | case 'delete': |
26 | include($INC . "/user/repo/delete/delete.php"); | ||
26 | include($INC . "/user/repo/admin/delete/delete.php"); | ||
27 | 27 | $_admin_body .= $_delete; | $_admin_body .= $_delete; |
28 | 28 | break; | break; |
29 | 29 |
File inc/user/repo/admin/delete/delete.php renamed from inc/user/repo/delete/delete.php (similarity 95%) (mode: 100644) (index 2dba86d..c410e1d) | |||
1 | 1 | <?php | <?php |
2 | rg_log("/inc/user/repo/delete/delete"); | ||
2 | rg_log("/inc/user/repo/admin/delete/delete"); | ||
3 | 3 | ||
4 | 4 | $are_you_sure = rg_var_uint("are_you_sure"); | $are_you_sure = rg_var_uint("are_you_sure"); |
5 | 5 |
File inc/user/repo/admin/edit/edit.php renamed from inc/user/repo/edit/edit.php (similarity 82%) (mode: 100644) (index a8db7bd..078bd33) | |||
1 | 1 | <?php | <?php |
2 | rg_log("/inc/user/repo/edit/edit"); | ||
2 | rg_log("/inc/user/repo/admin/edit/edit"); | ||
3 | 3 | ||
4 | 4 | $_edit = ""; | $_edit = ""; |
5 | 5 | $repo_edit_more = $repo_admin_more; | $repo_edit_more = $repo_admin_more; |
... | ... | $errmsg = array(); | |
8 | 8 | ||
9 | 9 | $_show_form = 1; | $_show_form = 1; |
10 | 10 | if ($doit == 1) { | if ($doit == 1) { |
11 | if (!rg_token_valid($db, $sid, $token)) { | ||
12 | $_edit .= "Invalid token. Try again."; | ||
13 | return; | ||
14 | } | ||
15 | |||
16 | 11 | $repo_id = rg_var_uint("repo_id"); | $repo_id = rg_var_uint("repo_id"); |
17 | 12 | $master_repo_id = 0; | $master_repo_id = 0; |
18 | 13 | $name = rg_var_str("name"); | $name = rg_var_str("name"); |
19 | 14 | $max_commit_size = rg_var_uint("max_commit_size"); | $max_commit_size = rg_var_uint("max_commit_size"); |
20 | 15 | $max_users = rg_var_uint("max_users"); | $max_users = rg_var_uint("max_users"); |
21 | 16 | $description = rg_var_str("description"); | $description = rg_var_str("description"); |
22 | $rights = @rg_rights_a2s($_REQUEST['rights']); | ||
17 | $rights = isset($_REQUEST['rights']) ? rg_rights_a2s($_REQUEST['rights']) : ""; | ||
23 | 18 | ||
24 | 19 | do { | do { |
20 | if (!rg_token_valid($db, $sid, $token)) { | ||
21 | $errmsg[] = "Invalid token. Try again."; | ||
22 | break; | ||
23 | } | ||
24 | |||
25 | 25 | // lookup user | // lookup user |
26 | 26 | $_ui = rg_user_info($db, 0, $rr['user'], ""); | $_ui = rg_user_info($db, 0, $rr['user'], ""); |
27 | 27 | if ($_ui['ok'] != 1) { | if ($_ui['ok'] != 1) { |
... | ... | if ($doit == 1) { | |
43 | 43 | break; | break; |
44 | 44 | } | } |
45 | 45 | ||
46 | $_edit .= "The repository was updated with success!"; | ||
46 | $_edit .= rg_ok("The repository was updated with success!"); | ||
47 | 47 | $_show_form = 0; | $_show_form = 0; |
48 | 48 | } while (0); | } while (0); |
49 | 49 | } else { | } else { |
File inc/user/repo/admin/rights/README renamed from inc/user/repo/rights/README (similarity 100%) |
File inc/user/repo/admin/rights/rights.php renamed from inc/user/repo/rights/rights.php (similarity 92%) (mode: 100644) (index cef3b69..dc884e9) | |||
1 | 1 | <?php | <?php |
2 | rg_log("/inc/user/repo/rights/rights"); | ||
2 | rg_log("/inc/user/repo/admin/rights/rights"); | ||
3 | 3 | ||
4 | 4 | $repo_rights_more = $repo_admin_more; | $repo_rights_more = $repo_admin_more; |
5 | 5 | $_rights = ""; | $_rights = ""; |
... | ... | else | |
104 | 104 | $_rights .= "<br />\n"; | $_rights .= "<br />\n"; |
105 | 105 | ||
106 | 106 | $_rights .= rg_template("user/repo/rights/form.html", $repo_rights_more); | $_rights .= rg_template("user/repo/rights/form.html", $repo_rights_more); |
107 | |||
108 | // hints | ||
109 | $hints = array(); | ||
110 | $hints[]['HTML:hint'] = rg_template("hints/repo/edit_rights.html", $repo_rights_more); | ||
111 | $_rights .= rg_template_table("hints/list", $hints, $repo_rights_more); | ||
107 | 112 | ?> | ?> |
File inc/user/repo/bug/add/add.php changed (mode: 100644) (index 5322483..846945a) | |||
... | ... | if ($doit == 0) { | |
41 | 41 | break; | break; |
42 | 42 | } | } |
43 | 43 | ||
44 | $bug_id = rg_bug_add($db, $ri['repo_id'], $ui['uid'], $_x); | ||
44 | $bug_id = rg_bug_add($db, $ri['repo_id'], $rg_ui['uid'], $_x); | ||
45 | 45 | if ($bug_id === FALSE) { | if ($bug_id === FALSE) { |
46 | 46 | $bug_errmsg[] = "Cannot add bug (" . rg_bug_error() . ")."; | $bug_errmsg[] = "Cannot add bug (" . rg_bug_error() . ")."; |
47 | 47 | break; | break; |
48 | 48 | } | } |
49 | 49 | ||
50 | 50 | // redirect to bug home | // redirect to bug home |
51 | $url = rg_re_bugpage($rg_ui, $ri, $bug_id); | ||
51 | $url = rg_re_bugpage($page_ui, $ri, $bug_id); | ||
52 | 52 | rg_redirect($url); | rg_redirect($url); |
53 | 53 | } while (0); | } while (0); |
54 | 54 | } | } |
File inc/user/repo/bug/main.php changed (mode: 100644) (index 43696d4..17d539b) | |||
1 | 1 | <?php | <?php |
2 | 2 | rg_log("/inc/user/repo/bug/main"); | rg_log("/inc/user/repo/bug/main"); |
3 | 3 | ||
4 | $repo_bug_more = $repo_admin_more; | ||
4 | $repo_bug_more = $repo_more; | ||
5 | 5 | $_bug_body = ""; | $_bug_body = ""; |
6 | 6 | ||
7 | 7 | $repo_bug_more['can_save'] = $rg_ui['uid'] > 0 ? 1 : 0; | $repo_bug_more['can_save'] = $rg_ui['uid'] > 0 ? 1 : 0; |
... | ... | case 'add': | |
21 | 21 | case 'list': /* list */ | case 'list': /* list */ |
22 | 22 | $_search = empty($paras) ? "All" : array_shift($paras); | $_search = empty($paras) ? "All" : array_shift($paras); |
23 | 23 | ||
24 | $_url = rg_re_repopage($ui, $ri['name']) . "/bug"; | ||
25 | |||
26 | 24 | // Somebody pressed "Remove" button? | // Somebody pressed "Remove" button? |
27 | 25 | if (rg_var_uint("remove") == 1) { | if (rg_var_uint("remove") == 1) { |
28 | 26 | $token = rg_var_str("token"); | $token = rg_var_str("token"); |
29 | 27 | if (!rg_token_valid($db, $sid, $token)) { | if (!rg_token_valid($db, $sid, $token)) { |
30 | $_bug_body .= "Error: invalid token. Try again."; // TODO | ||
28 | $_bug_body .= rg_warning("Error: invalid token. Try again."); // TODO | ||
31 | 29 | exit(1); // security_violation! | exit(1); // security_violation! |
32 | 30 | } | } |
33 | 31 | ||
34 | 32 | $r = rg_bug_search_remove($db, $ri['repo_id'], $rg_ui['uid'], | $r = rg_bug_search_remove($db, $ri['repo_id'], $rg_ui['uid'], |
35 | 33 | $_search); | $_search); |
36 | 34 | if ($r === FALSE) | if ($r === FALSE) |
37 | $_bug_body .= "Error: cannot delete search!"; // TODO | ||
35 | $_bug_body .= rg_warning("Error: cannot delete search!"); // TODO | ||
38 | 36 | } | } |
39 | 37 | ||
38 | $_url = rg_re_repopage($page_ui, $ri['name']) . "/bug"; | ||
40 | 39 | $r = rg_bug_search_load_all($db, $ri['repo_id'], $rg_ui['uid'], $_url); | $r = rg_bug_search_load_all($db, $ri['repo_id'], $rg_ui['uid'], $_url); |
41 | 40 | if ($r === FALSE) { | if ($r === FALSE) { |
42 | $_bug_body .= "Error: cannot load all searches!"; // TODO | ||
41 | $_bug_body .= rg_warning("Error: cannot load all searches!"); // TODO | ||
43 | 42 | } else { | } else { |
44 | 43 | $_bug_body .= rg_template_table("repo/bug/search/list", | $_bug_body .= rg_template_table("repo/bug/search/list", |
45 | 44 | $r, $repo_bug_more); | $r, $repo_bug_more); |
... | ... | case 'list': /* list */ | |
47 | 46 | ||
48 | 47 | $filter = rg_bug_search_load($db, $ri['repo_id'], $rg_ui['uid'], $_search); | $filter = rg_bug_search_load($db, $ri['repo_id'], $rg_ui['uid'], $_search); |
49 | 48 | if ($filter === FALSE) { | if ($filter === FALSE) { |
50 | $_bug_body .= "Error: cannot load search!"; // TODO | ||
49 | $_bug_body .= rg_warning("Error: cannot load search!"); // TODO | ||
51 | 50 | $filter = array(); | $filter = array(); |
52 | 51 | } | } |
53 | 52 | ||
... | ... | case 'list': /* list */ | |
57 | 56 | $r = rg_bug_search($db, $repo_bug_more['url_repo'], $ri['repo_id'], | $r = rg_bug_search($db, $repo_bug_more['url_repo'], $ri['repo_id'], |
58 | 57 | $rg_ui['uid'], $filter); | $rg_ui['uid'], $filter); |
59 | 58 | if ($r === FALSE) | if ($r === FALSE) |
60 | $_bug_body .= "Error: Cannot search bugs!"; // TODO: do something OK here! | ||
59 | $_bug_body .= rg_warning("Error: Cannot search bugs!"); // TODO: do something OK here! | ||
61 | 60 | else | else |
62 | 61 | $_bug_body .= $r; | $_bug_body .= $r; |
63 | 62 | ||
... | ... | default: // go directly to a bug | |
83 | 82 | } | } |
84 | 83 | ||
85 | 84 | $repo_bug_more['HTML:bug_body'] = $_bug_body; | $repo_bug_more['HTML:bug_body'] = $_bug_body; |
85 | $bug_body = rg_template("repo/bug/main.html", $repo_bug_more); | ||
86 | 86 | ?> | ?> |
File inc/user/repo/bug/show/show.php changed (mode: 100644) (index 7d06a6e..0d6bf78) | |||
... | ... | $doit = rg_var_uint("doit"); | |
21 | 21 | $note_errmsg = array(); | $note_errmsg = array(); |
22 | 22 | if ($doit == 0) { | if ($doit == 0) { |
23 | 23 | // default values | // default values |
24 | $repo_bug_show_more['note'] = ""; | ||
24 | $note = ""; | ||
25 | 25 | } else { | } else { |
26 | 26 | do { | do { |
27 | 27 | $token = rg_var_str("token"); | $token = rg_var_str("token"); |
... | ... | if ($doit == 0) { | |
47 | 47 | } | } |
48 | 48 | ||
49 | 49 | // prepare form for other note | // prepare form for other note |
50 | $repo_bug_show_more['note'] = ""; | ||
50 | $note = ""; | ||
51 | 51 | } while (0); | } while (0); |
52 | 52 | } | } |
53 | 53 | ||
... | ... | $repo_bug_show_more['HTML:note_errmsg'] = rg_template_errmsg($note_errmsg); | |
70 | 70 | ||
71 | 71 | $repo_bug_show_more['rg_action'] = rg_re_post($cop); | $repo_bug_show_more['rg_action'] = rg_re_post($cop); |
72 | 72 | $repo_bug_show_more['rg_form_token'] = rg_token_get($db, $sid); | $repo_bug_show_more['rg_form_token'] = rg_token_get($db, $sid); |
73 | $repo_bug_show_more['note'] = $note; | ||
73 | 74 | $repo_bug_show_more['HTML:note_add'] = rg_template("repo/bug/note_add.html", $repo_bug_show_more); | $repo_bug_show_more['HTML:note_add'] = rg_template("repo/bug/note_add.html", $repo_bug_show_more); |
74 | 75 | ||
75 | 76 | $_bug_show .= rg_template("repo/bug/show.html", $repo_bug_show_more); | $_bug_show .= rg_template("repo/bug/show.html", $repo_bug_show_more); |
File inc/util.inc.php changed (mode: 100644) (index 8e5a3d0..2ad030f) | |||
... | ... | function rg_ok($msg) | |
671 | 671 | function rg_exec($cmd) | function rg_exec($cmd) |
672 | 672 | { | { |
673 | 673 | rg_prof_start("exec($cmd)"); | rg_prof_start("exec($cmd)"); |
674 | |||
675 | 674 | rg_log("Executing [$cmd]..."); | rg_log("Executing [$cmd]..."); |
676 | 675 | ||
677 | 676 | $ret = array(); | $ret = array(); |
678 | 677 | $ret['ok'] = 0; | $ret['ok'] = 0; |
679 | 678 | $ret['errmsg'] = ""; | $ret['errmsg'] = ""; |
679 | do { | ||
680 | $desc = array( | ||
681 | 0 => array("pipe", "r"), | ||
682 | 1 => array("pipe", "w"), | ||
683 | 2 => array("pipe", "w") | ||
684 | ); | ||
685 | $a = proc_open($cmd, $desc, $pipes); | ||
686 | if ($a === FALSE) { | ||
687 | $ret['errmsg'] = "cannot call proc_open"; | ||
688 | break; | ||
689 | } | ||
680 | 690 | ||
681 | $desc = array( | ||
682 | 0 => array("pipe", "r"), | ||
683 | 1 => array("pipe", "w"), | ||
684 | 2 => array("pipe", "w") | ||
685 | ); | ||
686 | $a = proc_open($cmd, $desc, $pipes); | ||
687 | if ($a === FALSE) { | ||
688 | $ret['errmsg'] = "cannot call proc_open"; | ||
689 | rg_prof_end("exec($cmd)"); | ||
690 | return $ret; | ||
691 | } | ||
691 | $stderr = ""; | ||
692 | $ret['data'] = ""; | ||
693 | $rx = array($pipes[1], $pipes[2]); | ||
694 | while (!empty($rx)) { | ||
695 | $revents = $rx; | ||
696 | $wevents = NULL; | ||
697 | $ex = NULL; | ||
698 | $r = stream_select($revents, $wevents, $ex, 10, 0); | ||
699 | if ($r === FALSE) { | ||
700 | $ret['errmsg'] = "cannot select"; | ||
701 | break; | ||
702 | } | ||
703 | //rg_log("DEBUG: stream_select returned $r" | ||
704 | // . ", revents: " . rg_array2string($revents)); | ||
705 | |||
706 | foreach ($revents as $fd) { | ||
707 | //rg_log("Event on fd $fd!"); | ||
708 | if (feof($fd)) { | ||
709 | //rg_log("eof on fd $fd!"); | ||
710 | foreach ($rx as $_key => $_fd) | ||
711 | if ($_fd == $fd) | ||
712 | unset($rx[$_key]); | ||
713 | continue; | ||
714 | } | ||
692 | 715 | ||
693 | $errmsg = trim(stream_get_contents($pipes[2])); | ||
694 | $ret['data'] = stream_get_contents($pipes[1]); | ||
716 | $_d = fread($fd, 32 * 4096); | ||
717 | if ($_d === FALSE) { | ||
718 | $ret['errmsg'] = "cannot read"; | ||
719 | break; | ||
720 | } | ||
695 | 721 | ||
696 | for ($i = 0; $i < 3; $i++) | ||
697 | fclose($pipes[$i]); | ||
722 | //rg_log("DEBUG: got data from fd $fd [$_d]"); | ||
698 | 723 | ||
699 | $ret['code'] = proc_close($a); | ||
700 | if ($ret['code'] == 0) | ||
701 | $ret['ok'] = 1; | ||
702 | else | ||
703 | $ret['errmsg'] = "code " . $ret['code'] . ": " . $errmsg; | ||
724 | if ($fd === $pipes[2]) | ||
725 | $stderr .= $_d; | ||
726 | else if ($fd === $pipes[1]) | ||
727 | $ret['data'] .= $_d; | ||
728 | } | ||
729 | } | ||
730 | $stderr = trim($stderr); | ||
731 | $ret['data'] = trim($ret['data']); | ||
732 | |||
733 | for ($i = 0; $i < 3; $i++) | ||
734 | fclose($pipes[$i]); | ||
735 | |||
736 | $err = proc_close($a); | ||
737 | if (empty($errmsg) && ($err == 0)) | ||
738 | $ret['ok'] = 1; | ||
739 | else | ||
740 | $ret['errmsg'] = "code " . $err . ": " . $stderr; | ||
741 | } while (0); | ||
704 | 742 | ||
705 | 743 | rg_prof_end("exec($cmd)"); | rg_prof_end("exec($cmd)"); |
706 | 744 | return $ret; | return $ret; |
File rocketgit.spec.in changed (mode: 100644) (index 10fccff..a47d6af) | |||
... | ... | Light and fast Git hosting solution, similar with Gitorious/GitHub/etc. | |
19 | 19 | getent group rocketgit >/dev/null || groupadd -r rocketgit | getent group rocketgit >/dev/null || groupadd -r rocketgit |
20 | 20 | getent passwd rocketgit >/dev/null || useradd -r -g rocketgit -s /bin/bash -m -d /home/rocketgit -c "RocketGit user" rocketgit | getent passwd rocketgit >/dev/null || useradd -r -g rocketgit -s /bin/bash -m -d /home/rocketgit -c "RocketGit user" rocketgit |
21 | 21 | semanage fcontext -a -t httpd_log_t "/var/log/rocketgit-web(/.*)?" || : | semanage fcontext -a -t httpd_log_t "/var/log/rocketgit-web(/.*)?" || : |
22 | semanage fcontext -a -t public_content_rw_t "/var/lib/rocketgit(/.*)?" || : | ||
22 | 23 | ||
23 | 24 | %post | %post |
24 | 25 | if [ $1 -ne 0 ]; then | if [ $1 -ne 0 ]; then |
... | ... | fi | |
29 | 30 | %postun | %postun |
30 | 31 | if [ $1 = 0 ]; then | if [ $1 = 0 ]; then |
31 | 32 | userdel rocketgit | userdel rocketgit |
33 | semanage fcontext -d "/var/lib/rocketgit(/.*)?" || : | ||
32 | 34 | semanage fcontext -d "/var/log/rocketgit-web(/.*)?" || : | semanage fcontext -d "/var/log/rocketgit-web(/.*)?" || : |
33 | 35 | fi | fi |
34 | 36 | ||
... | ... | rm -rf ${RPM_BUILD_ROOT} | |
59 | 61 | %config(noreplace) /etc/httpd/conf.d/rocketgit.conf | %config(noreplace) /etc/httpd/conf.d/rocketgit.conf |
60 | 62 | %attr(0700,rocketgit,rocketgit) %dir /var/log/@PRJ@ | %attr(0700,rocketgit,rocketgit) %dir /var/log/@PRJ@ |
61 | 63 | %attr(0700,apache,apache) %dir /var/log/@PRJ@-web | %attr(0700,apache,apache) %dir /var/log/@PRJ@-web |
62 | %attr(0700,rocketgit,rocketgit) %dir /var/lib/@PRJ@ | ||
64 | %attr(0755,rocketgit,rocketgit) %dir /var/lib/@PRJ@ | ||
63 | 65 | %attr(0700,rocketgit,rocketgit) %dir /var/lib/@PRJ@/locks | %attr(0700,rocketgit,rocketgit) %dir /var/lib/@PRJ@/locks |
64 | %attr(0700,rocketgit,rocketgit) %dir /var/lib/@PRJ@/repos | ||
66 | %attr(0755,rocketgit,rocketgit) %dir /var/lib/@PRJ@/repos | ||
65 | 67 | %attr(0700,rocketgit,rocketgit) %dir /var/lib/@PRJ@/q_merge_requests | %attr(0700,rocketgit,rocketgit) %dir /var/lib/@PRJ@/q_merge_requests |
66 | 68 | %config(noreplace) /etc/logrotate.d/rocketgit | %config(noreplace) /etc/logrotate.d/rocketgit |
67 | 69 |
File root/themes/default/hints/repo/edit_rights.html added (mode: 100644) (index 0000000..4dc1ed2) | |||
1 | You do not have to grant yourself rights.<br /> | ||
2 | You are the owner, so you have maximum rights. |
File root/themes/default/main.css changed (mode: 100644) (index 8396c17..2c8ef73) | |||
... | ... | form input[type="text"], form input[type="password"], form textarea, form select | |
38 | 38 | font-size: 10pt; | font-size: 10pt; |
39 | 39 | padding: 2px; | padding: 2px; |
40 | 40 | } | } |
41 | form select option { padding: 3px; } | ||
41 | 42 | form input[type="submit"] { | form input[type="submit"] { |
42 | 43 | color: #FF0000; | color: #FF0000; |
43 | 44 | display: inline-block; | display: inline-block; |
File root/themes/default/user/logout.html changed (mode: 100644) (index e69de29..1e71fc6) | |||
1 | <div class="ok"> | ||
2 | You are now logged out. | ||
3 | </div> |
File root/themes/default/user/repo/delete/sure.html changed (mode: 100644) (index 3520c39..a39fe9b) | |||
1 | <div class="warning"> | ||
1 | <div class="formarea"> | ||
2 | |||
3 | <div class="formarea_title">Delete repository</div><br /> | ||
2 | 4 | ||
3 | 5 | <form method="post" action="@@url@@"> | <form method="post" action="@@url@@"> |
4 | 6 | <input type="hidden" name="doit" value="1" /> | <input type="hidden" name="doit" value="1" /> |
File scripts/remote.php changed (mode: 100644) (index 963c7db..33d71ff) | |||
... | ... | if ($ri['exists'] != 1) | |
171 | 171 | if ($ri['deleted'] == 1) | if ($ri['deleted'] == 1) |
172 | 172 | fatal("Repo was deleted!"); | fatal("Repo was deleted!"); |
173 | 173 | ||
174 | // We must not use here the rg_repo_allow function because we need | ||
175 | // $rights variable below. | ||
174 | 176 | $ret = rg_repo_rights_get($db, $ri, $uid, 0); | $ret = rg_repo_rights_get($db, $ri, $uid, 0); |
175 | 177 | if ($ret['ok'] !== 1) | if ($ret['ok'] !== 1) |
176 | 178 | fatal("Internal error (rights_get)"); | fatal("Internal error (rights_get)"); |