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 f51442036f0124377ba87d2fd4cb3471f8e6083a

Bulk updates
Author: Catalin(ux) M. BOIE
Author date (UTC): 2012-09-06 03:17
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2012-09-06 03:17
Parent(s): 2f4b63e9e1810c8afa882ce2bc80b5c897541656
Signing key:
Tree: 41c9f37a91b689ee811164545391643d42c69bbc
File Lines added Lines deleted
Compare.txt 1 1
README 6 2
TODO 37 16
admin/init.php 4 0
hooks/post-receive 1 1
hooks/pre-commit 1 1
hooks/pre-receive 2 2
hooks/update 1 1
inc/admin/users/add.php 5 5
inc/admin/users/edit.php 5 5
inc/admin/users/user.form.php 2 2
inc/bug.inc.php 3 3
inc/dispatch/dispatch.php 1 1
inc/feedback/suggestion.php 4 4
inc/git.inc.php 20 10
inc/init.inc.php 14 0
inc/keys.inc.php 58 60
inc/log.inc.php 28 9
inc/login/login.form.php 2 0
inc/login/login.php 1 1
inc/mr.inc.php 1 1
inc/repo.inc.php 2 2
inc/repo/repo.form.php 2 1
inc/repo/search.form.php 3 1
inc/rights.inc.php 4 4
inc/token.inc.php 1 1
inc/user.inc.php 7 5
inc/user/confirm.php 1 1
inc/user/create.php 4 4
inc/user/forgot.form.php 2 0
inc/user/forgot.php 1 1
inc/user/forgot_send.form.php 2 0
inc/user/forgot_send.php 1 1
inc/user/keys/add.form.php 0 25
inc/user/keys/keys.php 14 3
inc/user/pass/pass.php 3 3
inc/user/personal.php 3 0
inc/user/repo-page.php 45 14
inc/user/repo/admin.php 1 1
inc/user/repo/bug/show.php 1 4
inc/user/repo/edit/edit.php 2 2
inc/user/repo/rights/rights.form.php 2 0
inc/user/repo/rights/rights.php 3 3
inc/util.inc.php 77 25
root/index.php 2 1
root/themes/default/hints/list/between.html 1 0
root/themes/default/hints/list/footer.html 2 0
root/themes/default/hints/list/header.html 2 0
root/themes/default/hints/list/line.html 1 0
root/themes/default/hints/list/nodata.html 0 0
root/themes/default/hints/repo/anon_push.html 8 0
root/themes/default/hints/repo/client_win.html 4 0
root/themes/default/hints/repo/clone_git.html 5 0
root/themes/default/hints/repo/clone_ssh.html 5 0
root/themes/default/hints/repo/merge.html 16 0
root/themes/default/hints/ssh/key.html 21 0
root/themes/default/index.html 6 6
root/themes/default/main.css 27 4
root/themes/default/main.html 1 2
root/themes/default/repo/admin.html 1 1
root/themes/default/repo/bug/bug_add.html 3 1
root/themes/default/repo/bug/list/line.html 1 1
root/themes/default/repo/bug/main.html 1 1
root/themes/default/repo/bug/note_add.html 2 0
root/themes/default/repo/bug/show.html 14 13
root/themes/default/repo/main.html 10 12
root/themes/default/repo/not_init.html 3 0
root/themes/default/repo/source.html 2 4
root/themes/default/repo/urls/footer.html 0 1
root/themes/default/repo/urls/header.html 2 0
root/themes/default/repo/urls/line.html 1 0
root/themes/default/repo/urls/nodata.html 0 0
root/themes/default/user/keys/add.html 19 0
root/themes/default/user/keys/list/footer.html 1 0
root/themes/default/user/keys/list/header.html 9 0
root/themes/default/user/keys/list/line.html 8 0
root/themes/default/user/keys/list/nodata.html 1 1
root/themes/default/user/keys/main.html 5 0
root/themes/try2/main.css 79 30
root/themes/try3/main.css 80 34
samples/config.php 7 5
scripts/cron.php 1 0
scripts/q.php 5 4
scripts/remote.php 1 0
tests/Makefile 5 1
tests/bug.php 1 0
tests/git.php 1 0
tests/git2.php 1 0
tests/keys.php 1 0
tests/log.php 20 0
tests/prof.php 1 0
tests/repo.php 1 0
tests/rights.php 1 0
tests/sql.php 1 0
tests/state.php 1 0
tests/user.php 1 0
tests/util.php 1 0
File Compare.txt changed (mode: 100644) (index 09b46cb..4216a64)
1 Gitlab RocketGit GitHub Gitorious
1 Gitlab RocketGit GitHub Gitorious unfuddle.com
2 2
3 3
4 4 [Features] [Features]
File README changed (mode: 100644) (index 3bc6337..90bf862)
23 23 # systemctl enable httpd.service # systemctl enable httpd.service
24 24 # systemctl start httpd.service # systemctl start httpd.service
25 25
26 . Activate sshd (for ssh:// access)
27 # systemctl enable sshd.service
28 # systemctl start sshd.service
29
26 30 . Activate xinetd (for git:// access) . Activate xinetd (for git:// access)
27 31 # systemctl enable xinetd.service # systemctl enable xinetd.service
28 32 # systemctl start xinetd.service # systemctl start xinetd.service
29 33
30 34 . Configure PostgreSQL server . Configure PostgreSQL server
31 35 # systemctl enable postgresql.service # systemctl enable postgresql.service
32 # service postgresql initdb (TAKE CARE! YOU MAY DESTROY ALL YOUR DATA!)
36 # postgresql-setup initdb (TAKE CARE! YOU MAY DESTROY ALL YOUR DATA!)
33 37 # systemctl start postgresql.service # systemctl start postgresql.service
34 38
35 39 . Create a PostgreSQL user and database . Create a PostgreSQL user and database
 
49 53 - If the web server and the db are not on the same host, you need to - If the web server and the db are not on the same host, you need to
50 54 replace 127.0.0.1/::1 with your "safe network". You may want to use replace 127.0.0.1/::1 with your "safe network". You may want to use
51 55 md5 for authentication. Also, you may want to change 'listen_addresses' md5 for authentication. Also, you may want to change 'listen_addresses'
52 to '*'.
56 to '*'. You may also want to activate SSL. Check PostgreSQL manual.
53 57
54 58 . Run instalation script . Run instalation script
55 59 # php /usr/share/rocketgit/admin/init.php # php /usr/share/rocketgit/admin/init.php
File TODO changed (mode: 100644) (index 53e593e..fad2d2b)
1 1 == BEFORE FIRST RELEASE! == == BEFORE FIRST RELEASE! ==
2 [ ] Add some hints.
3 [ ] Hints for ssh are not indented!
4 [ ] Allow user to specify if is on windows/linux/etc. to be able to give
5 tailored hints.
6 [ ]
7
8
9 == Medium ==
10 [ ] http://rg.embedromix.ro:8000/user/catab/a13/admin/rights?edit_uid=19
11 should give an error!
12 [ ] Pay attention to: https://github.com/sitaramc/gitolite/wiki:
13 Please DO NOT send me pull requests via github. Instead, send me an
14 email saying what URL and what branch to pull. (The pull system forces
15 a --no-ff even if the merge is at the top of my branch and doesn't
16 need one. It also gives me no chance to fix up minor typos, add any
17 more text to the commit message, etc. I can do that afterward, but
18 this forces a "push -f" or a trivial "typofix" commit).
19 [ ] We should have a 'domain' variable for virtual hosting and use them in
20 paths for locks/queues/repos etc.
21 [ ] Merge requests should use a shorter path? What if a merge request is for
22 other branch?
2 23 [ ] See diff for merge requests. [ ] See diff for merge requests.
24 [ ] On master, list clones.
25 [ ] Configuration: switch for SSL only.
26 [ ] Internal mailing list? Or internal mail?
27 [ ] We should have a cron/q/remote for every config file!
28 Or, at least, to be host aware.
29 [ ] It may be needed to use preg_quote!
30 [ ] Install text files in /usr/share/doc
3 31 [ ] JUNK1/JUNK2: http://rg.embedromix.ro:8000/user/catab/rocketgit/commit/afd1df2..f919c9b [ ] JUNK1/JUNK2: http://rg.embedromix.ro:8000/user/catab/rocketgit/commit/afd1df2..f919c9b
4 [ ] Confirmation e-mail comes from rg1.
5 32 [ ] rg_log: why the fd is NULL?! [ ] rg_log: why the fd is NULL?!
6 [ ] Install text files in /usr/share/doc
7 [ ] "log" does not list last entries! More exactly, seems the owner does not update repo!
8 [ ] @@branch@@ is not defined for merge requests. Should it? Probably yes, to filter them.
9 [ ] Create a repo and click on it; seems we get error (gabi)!
10 [ ] Add permission to add bug tracker to a project.
11 [ ] Remove all @@ DUMP @@s from templates.
12 33 [ ] 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!
13 34 What should we do? What should we do?
14 [ ]
15
16
17 == Medium ==
35 [ ] Add permission to add bug tracker to a project.
36 [ ] When repo is empty, weshould not show the Log/Tree menu.
37 [ ] @@branch@@ is not defined for merge requests. Should it? Probably yes, to filter them.
38 [ ] Fix diff output. Cannot deal with renames/removes/etc.
18 39 [ ] Check admin creatin of an account. [ ] Check admin creatin of an account.
19 40 [ ] Add possibility to reject merge requests, to apply, to delete etc. [ ] Add possibility to reject merge requests, to apply, to delete etc.
20 41 [ ] Do we need to escape some chars in console (ssh rocketgit@host repo X)? [ ] Do we need to escape some chars in console (ssh rocketgit@host repo X)?
 
34 55 [ ] Check webSSO for authentification. [ ] Check webSSO for authentification.
35 56 [ ] Check http://gitlist.org/ [ ] Check http://gitlist.org/
36 57 [ ] use do {} while(0) to respect profiling! [ ] use do {} while(0) to respect profiling!
37 [ ] If we do ssh without any command, be nice and show how to clone,
38 show projects, rights etc. Check ssh.inc.php.
39 58 [ ] Enforce Signoff-by lines per project (a new permission) [ ] Enforce Signoff-by lines per project (a new permission)
40 59 = reject commits without signoff! = reject commits without signoff!
41 60 Maybe, do it generic, allow a text field to enumerate what should be in a commit! Maybe, do it generic, allow a text field to enumerate what should be in a commit!
42 61 Also, present a list with checkboxex: at least Signoff-by, Reported-by, Acked-by! Also, present a list with checkboxex: at least Signoff-by, Reported-by, Acked-by!
43 62 [ ] Linus on why GitHub sucks: https://github.com/torvalds/linux/pull/17#issuecomment-5654674 [ ] Linus on why GitHub sucks: https://github.com/torvalds/linux/pull/17#issuecomment-5654674
44 63 [ ] Warn if commit messages are too long (no wrap). [ ] Warn if commit messages are too long (no wrap).
45 [ ] Allow possibility to send an e-mail to mainteiner from web with a pull request
64 [ ] Allow the possibility to send an e-mail to mainteiner from web with a pull request
46 65 [ ] Check https://github.com/torvalds/linux/pull/17#issuecomment-5654674 [ ] Check https://github.com/torvalds/linux/pull/17#issuecomment-5654674
47 [ ] Merge requests e-mail: explanation of why to pull, diffstat! Maybe also the patch if is small.
66 [ ] Merge requests e-mail: explanation of why to pull, diffstat! Maybe also the
67 patch if is small.
48 68 [ ] Check git-request-pull [ ] Check git-request-pull
49 69 [ ] Show the size of a repository. Also when you ssh from terminal. [ ] Show the size of a repository. Also when you ssh from terminal.
50 70 See git-count-objects and http://stackoverflow.com/questions/8185276/find-size-of-git-repo. See git-count-objects and http://stackoverflow.com/questions/8185276/find-size-of-git-repo.
51 [ ] Logo for project.
71 [ ] Logo for project. Blender?
52 72 [ ] Default branch per project[/user]. [ ] Default branch per project[/user].
53 73 [ ] Main language of the project. [ ] Main language of the project.
54 74 [ ] Web site for a project. [ ] Web site for a project.
55 75 [ ] [ ]
56 76
57 77 == Normal priority == == Normal priority ==
78 [ ] Show last time use of a ssh key, or how many times was used, or both.
58 79 [ ] Add hint about "ssh rocketgit@server" to quickly find status etc. [ ] Add hint about "ssh rocketgit@server" to quickly find status etc.
59 80 [ ] rg_redirect does not record profiling information! [ ] rg_redirect does not record profiling information!
60 81 [ ] git bundle [ ] git bundle
File admin/init.php changed (mode: 100644) (index 5e293ee..a43093f)
... ... $first_install = rg_state_get($db, "first_install");
82 82 if ($first_install == 0) if ($first_install == 0)
83 83 rg_state_set($db, "first_install", time()); rg_state_set($db, "first_install", time());
84 84
85 $install_id = rg_state_get($db, "install_id");
86 if (empty($install_id))
87 rg_state_set($db, "install_id", sha1sum(microtime(TRUE)));
88
85 89 echo "Done!\n"; echo "Done!\n";
86 90 ?> ?>
File hooks/post-receive changed (mode: 100755) (index b691c6e..27ab082)
... ... $namespace = getenv("GIT_NAMESPACE");
33 33 $repo_path = getenv("ROCKETGIT_REPO_PATH"); $repo_path = getenv("ROCKETGIT_REPO_PATH");
34 34
35 35 rg_log("Start namespace=$namespace repo_path=$repo_path"); rg_log("Start namespace=$namespace repo_path=$repo_path");
36 rg_log("_SERVER: " . print_r($_SERVER, TRUE));
36 rg_log("_SERVER: " . rg_array2string($_SERVER));
37 37
38 38 umask(0022); umask(0022);
39 39
File hooks/pre-commit changed (mode: 100755) (index eb815e1..278aee3)
... ... require_once($INC . "/git.inc.php");
19 19 rg_log_set_file($rg_log_dir . "/hook_pre-commit.log"); rg_log_set_file($rg_log_dir . "/hook_pre-commit.log");
20 20
21 21 rg_log("Start..."); rg_log("Start...");
22 rg_log("_SERVER: " . print_r($_SERVER, TRUE));
22 rg_log("_SERVER: " . rg_array2string($_SERVER));
23 23
24 24 umask(0022); umask(0022);
25 25
File hooks/pre-receive changed (mode: 100755) (index 58bf249..a952a41)
... ... require_once($INC . "/repo.inc.php");
24 24 rg_log_set_file($rg_log_dir . "/hook_pre-receive.log"); rg_log_set_file($rg_log_dir . "/hook_pre-receive.log");
25 25
26 26 rg_log("Start"); rg_log("Start");
27 rg_log("_SERVER: " . print_r($_SERVER, TRUE));
27 rg_log("_SERVER: " . rg_array2string($_SERVER));
28 28
29 29 umask(0022); umask(0022);
30 30
 
... ... rg_log("Took " . $diff . "ms.");
61 61 . "\nuid: " . $uid . "\nuid: " . $uid
62 62 . "\npara: $refname $old_rev $new_rev" . "\npara: $refname $old_rev $new_rev"
63 63 . "\nTook: " . $diff . "ms" . "\nTook: " . $diff . "ms"
64 . "\n_SERVER: " . print_r($_SERVER, TRUE));
64 . "\n_SERVER: " . rg_array2string($_SERVER));
65 65
66 66 ?> ?>
File hooks/update changed (mode: 100755) (index 4d7ab71..41893c9)
... ... if (strncmp($a['refname'], "refs/tags/", 10) == 0) {
72 72 . "\nuid: " . $uid . "\nuid: " . $uid
73 73 . "\npara: $refname $old_rev $new_rev" . "\npara: $refname $old_rev $new_rev"
74 74 . "\nProfiling:\n" . rg_prof_text() . "\nProfiling:\n" . rg_prof_text()
75 . "\n_SERVER: " . print_r($_SERVER, TRUE));
75 . "\n_SERVER: " . rg_array2string($_SERVER));
76 76
77 77 rg_prof_end("hook-update"); rg_prof_end("hook-update");
78 78 rg_prof_log("rg_log"); rg_prof_log("rg_log");
File inc/admin/users/add.php changed (mode: 100644) (index f3a981a..848a9d6)
... ... if ($doit == 1) {
22 22
23 23 while (1) { while (1) {
24 24 if (rg_user_ok($xuser) !== TRUE) { if (rg_user_ok($xuser) !== TRUE) {
25 $errmsg[] = "Invalid user name (" . rg_user_error() . ")!";
25 $errmsg[] = "invalid user name (" . rg_user_error() . ")";
26 26 break; break;
27 27 } }
28 28
29 29 if (rg_user_pass_ok($xpass) !== TRUE) { if (rg_user_pass_ok($xpass) !== TRUE) {
30 $errmsg[] = "Invalid password (" . rg_user_error() . ")!";
30 $errmsg[] = "invalid password (" . rg_user_error() . ")";
31 31 break; break;
32 32 } }
33 33
34 34 $_ui = rg_user_info($db, 0, $xuser, ""); $_ui = rg_user_info($db, 0, $xuser, "");
35 35 if ($_ui['ok'] != 1) { if ($_ui['ok'] != 1) {
36 $errmsg[] = "Internal error.";
36 $errmsg[] = "internal error";
37 37 break; break;
38 38 } }
39 39
40 40 if ($_ui['exists'] == 1) { if ($_ui['exists'] == 1) {
41 $errmsg[] = "User already exists.";
41 $errmsg[] = "user already exists";
42 42 break; break;
43 43 } }
44 44
 
... ... if ($doit == 1) {
54 54 $_u['session_time'] = $session_time; $_u['session_time'] = $session_time;
55 55 $_u['confirm_token'] = ""; $_u['confirm_token'] = "";
56 56 if (!rg_user_edit($db, $_u)) { if (!rg_user_edit($db, $_u)) {
57 $errmsg[] = "Cannot add user (" . rg_user_error() . ").";
57 $errmsg[] = "cannot add user (" . rg_user_error() . ")";
58 58 break; break;
59 59 } }
60 60
File inc/admin/users/edit.php changed (mode: 100644) (index 44aa430..bf9d8bd)
... ... if ($doit == 1) {
26 26 while (1) { while (1) {
27 27 $_ui = rg_user_info($db, 0, $xuser, ""); $_ui = rg_user_info($db, 0, $xuser, "");
28 28 if ($_ui['ok'] == 0) { if ($_ui['ok'] == 0) {
29 $errmsg[] = "Internal error!";
29 $errmsg[] = "internal error";
30 30 break; break;
31 31 } }
32 32
33 33 if ($_ui['exists'] == 0) { if ($_ui['exists'] == 0) {
34 $errmsg[] = "User does not exists!";
34 $errmsg[] = "user does not exists";
35 35 break; break;
36 36 } }
37 37
 
... ... if ($doit == 1) {
47 47 $_u['session_time'] = $session_time; $_u['session_time'] = $session_time;
48 48 $_u['confirm_token'] = ""; $_u['confirm_token'] = "";
49 49 if (!rg_user_edit($db, $_u)) { if (!rg_user_edit($db, $_u)) {
50 $errmsg[] = "Cannot change info (" . rg_user_error() . ").";
50 $errmsg[] = "cannot change info (" . rg_user_error() . ")";
51 51 break; break;
52 52 } }
53 53
 
... ... if ($doit == 1) {
60 60
61 61 $_ui = rg_user_info($db, $uid, "", ""); $_ui = rg_user_info($db, $uid, "", "");
62 62 if ($_ui['ok'] == 0) { if ($_ui['ok'] == 0) {
63 $_user_edit .= "Internal error!";
63 $_user_edit .= "internal error!";
64 64 $show_form = 0; $show_form = 0;
65 65 } else if ($_ui['exists'] == 0) { } else if ($_ui['exists'] == 0) {
66 $_user_edit .= "User does not exist!<br />";
66 $_user_edit .= "user does not exist<br />";
67 67 $show_form = 0; $show_form = 0;
68 68 } else { } else {
69 69 $xuser = $_ui['username']; $xuser = $_ui['username'];
File inc/admin/users/user.form.php changed (mode: 100644) (index cc5aeb8..08cda64)
... ... $_form = '<div class="formarea">' . "\n";
4 4 if ($create_mode == 1) if ($create_mode == 1)
5 5 $_title = "Create a new account"; $_title = "Create a new account";
6 6 else else
7 $_title = "Change user details";
7 $_title = "Change details";
8 8 $_form .= "<div class=\"formarea_title\">$_title</div><br />\n"; $_form .= "<div class=\"formarea_title\">$_title</div><br />\n";
9 9
10 10 if ($admin_mode == 1) { if ($admin_mode == 1) {
 
... ... $_form .= '
86 86 <br /> <br />
87 87 <br /> <br />
88 88
89 <input type="submit" value="Go!" />
89 <input type="submit" value="Do" />
90 90 </form> </form>
91 91 </div> </div>
92 92 '; ';
File inc/bug.inc.php changed (mode: 100644) (index 411a5cd..8d31d49)
... ... function rg_bug_label_insert($db, $repo_id, $bug_id, $labels)
536 536 rg_prof_start("bug_label_insert"); rg_prof_start("bug_label_insert");
537 537
538 538 $labels = rg_bug_label_string2array($labels); $labels = rg_bug_label_string2array($labels);
539 rg_log("DEBUG: labels: " . print_r($labels, TRUE));
539 rg_log("DEBUG: labels: " . rg_array2string($labels));
540 540 if (empty($labels)) if (empty($labels))
541 541 return TRUE; return TRUE;
542 542
543 543 $existing = rg_bug_label_get($db, $repo_id, $bug_id); $existing = rg_bug_label_get($db, $repo_id, $bug_id);
544 rg_log("DEBUG: existing: " . print_r($existing, TRUE));
544 rg_log("DEBUG: existing: " . rg_array2string($existing));
545 545 if ($existing === FALSE) if ($existing === FALSE)
546 546 return FALSE; return FALSE;
547 547
548 548 $diff = rg_bug_label_diff($labels, $existing); $diff = rg_bug_label_diff($labels, $existing);
549 rg_log("DEBUG: diff: " . print_r($diff, TRUE));
549 rg_log("DEBUG: diff: " . rg_array2string($diff));
550 550 if (empty($diff)) if (empty($diff))
551 551 return TRUE; return TRUE;
552 552
File inc/dispatch/dispatch.php changed (mode: 100644) (index 31be41e..9aa6f7e)
... ... rg_log("/inc/dispatch/dispatch");
3 3
4 4 switch ($op) { switch ($op) {
5 5 case 'main': case 'main':
6 $body .= rg_template("body.html", $more);
6 $body .= rg_template("main.html", $more);
7 7 break; break;
8 8
9 9 case 'login': case 'login':
File inc/feedback/suggestion.php changed (mode: 100644) (index 8630f32..d9345b1)
... ... if ($doit == 1) {
12 12
13 13 while (1) { while (1) {
14 14 if (!rg_token_valid($db, $sid, $token)) { if (!rg_token_valid($db, $sid, $token)) {
15 $errmsg[] = "Invalid token. Try again.";
15 $errmsg[] = "invalid token; try again";
16 16 break; break;
17 17 } }
18 18
19 19 if (empty($email)) { if (empty($email)) {
20 $errmsg[] = "Invalid e-mail.";
20 $errmsg[] = "invalid e-mail";
21 21 break; break;
22 22 } }
23 23
24 24 if (empty($suggestion)) { if (empty($suggestion)) {
25 $errmsg[] = "Invalid suggestion.";
25 $errmsg[] = "empty suggestion";
26 26 break; break;
27 27 } }
28 28
29 29 $r = rg_user_suggestion($db, $rg_ui['uid'], $email, $suggestion); $r = rg_user_suggestion($db, $rg_ui['uid'], $email, $suggestion);
30 30 if ($r === FALSE) { if ($r === FALSE) {
31 $errmsg[] = "Could not add suggestion (" . rg_user_error() . ")!";
31 $errmsg[] = "could not add suggestion (" . rg_user_error() . ")!";
32 32 break; break;
33 33 } }
34 34
File inc/git.inc.php changed (mode: 100644) (index 39035b7..47613f0)
... ... function rg_git_install_hooks($dst)
53 53 rg_log("git_install_hooks: dst=$dst"); rg_log("git_install_hooks: dst=$dst");
54 54
55 55 if (file_exists($dst . "/hooks")) { if (file_exists($dst . "/hooks")) {
56 //rg_log("hooks folder exists...");
57 $_dir = @readlink($dst . "/hooks");
58 if ($_dir !== FALSE) {
59 //rg_log("\treadlink returned=[$_dir]");
60 if (strcmp($_dir, $rg_scripts . "/hooks") == 0)
61 return TRUE;
56 if (is_link($dst . "/hooks")) {
57 $_dir = @readlink($dst . "/hooks");
58 if ($_dir !== FALSE) {
59 if (strcmp($_dir, $rg_scripts . "/hooks") == 0)
60 return TRUE;
61 rg_log("\tWARN: readlink returned=[$_dir]");
62 }
62 63 } }
63 64
64 65 rg_log("\tNot a link to scripts one, make it..."); rg_log("\tNot a link to scripts one, make it...");
 
... ... function rg_git_ls_tree($tree, $path)
389 390
390 391 // We are forced to use print_r instead of array2string because // We are forced to use print_r instead of array2string because
391 392 // it may be a multilevel array. // it may be a multilevel array.
392 rg_log("DEBUG: ls-tree: " . print_r($ret, TRUE));
393 rg_log_ml("DEBUG: ls-tree: " . print_r($ret, TRUE));
393 394
394 395 return $ret; return $ret;
395 396 } }
 
... ... function rg_git_log($max, $from, $to, $also_patch)
512 513
513 514 rg_log("git_log: from=$from to=$to max=$max"); rg_log("git_log: from=$from to=$to max=$max");
514 515
516 //Test if we have an emptydir
517 $_dir = getenv("GIT_DIR");
518 if (!file_exists($_dir . "/refs/heads/master")) {
519 rg_log("\tRepo is empty.");
520 return "";
521 }
522
515 523 $max_count = ($max == 0) ? "" : " --max-count=$max"; $max_count = ($max == 0) ? "" : " --max-count=$max";
516 524 $patches = $also_patch ? " --patch" : ""; $patches = $also_patch ? " --patch" : "";
517 525
 
... ... function rg_git_branches_and_tags($repo_dir, $base_url, $current_ref)
1004 1012 } }
1005 1013 } }
1006 1014
1007 $ret['HTML:branches_and_tags'] = "<div class=\"branches_and_tags\">\n";
1008 $ret['HTML:branches_and_tags'] .= implode("\n", $_l);
1009 $ret['HTML:branches_and_tags'] .= "</div>\n";
1015 if (!empty($_l)) {
1016 $ret['HTML:branches_and_tags'] = "<div class=\"branches_and_tags\">\n";
1017 $ret['HTML:branches_and_tags'] .= implode("\n", $_l);
1018 $ret['HTML:branches_and_tags'] .= "</div>\n";
1019 }
1010 1020
1011 1021 rg_log("rg_git_branches_and_tags: ret:" . rg_array2string($ret)); rg_log("rg_git_branches_and_tags: ret:" . rg_array2string($ret));
1012 1022
File inc/init.inc.php added (mode: 100644) (index 0000000..3c8d5bd)
1 <?php
2 // This is the first file that is included by all scripts.
3
4 $more = array();
5
6 // For escapeshellarg to work with UTF-8, we are forced to set a locale
7 setlocale(LC_CTYPE, "en_US.UTF-8");
8
9 if (empty($rg_ssh_host))
10 $rg_ssh_host = php_uname("n");
11 $more['rg_ssh_host'] = $rg_ssh_host;
12 $more['rg_ssh_port'] = $rg_ssh_port;
13
14 ?>
File inc/keys.inc.php changed (mode: 100644) (index 99ca553..d7746af)
... ... function rg_keys_error()
19 19 } }
20 20
21 21 /* /*
22 * Validate key
22 * Extracts info about a ssh key
23 23 */ */
24 function rg_keys_valid($s)
24 function rg_keys_info($key)
25 25 { {
26 $v = explode(" ", $s);
27 if (!isset($v[1])) {
28 rg_keys_set_error("Malformed input (missing fields)");
29 return FALSE;
30 }
26 $t = explode(" ", $key, 3);
31 27
32 $decoded = base64_decode(trim($v[1]));
33 if ($decoded === FALSE) {
34 rg_keys_set_error("Malformed input (base64 failed)");
35 return FALSE;
36 }
28 $ret = array();
29 $ret['ok'] = 0;
37 30
38 return $decoded;
39 }
31 if (!isset($t[1])) {
32 rg_keys_set_error("malformed ssh key (missing fields)");
33 return $ret;
34 }
40 35
41 /*
42 * Generates the fingerprint of a key
43 */
44 function rg_keys_fingerprint($key)
45 {
46 $decoded = rg_keys_valid($key);
47 if ($decoded === FALSE)
48 return rg_keys_error();
36 $ret['type'] = $t[0];
37 $ret['key'] = isset($t[1]) ? $t[1] : "";
38 $ret['comment'] = isset($t[2]) ? $t[2] : "";
49 39
50 $digest = md5($decoded);
40 $d = base64_decode($ret['key']);
41 if ($d === FALSE) {
42 rg_keys_set_error("malformed input (base64 failed)");
43 return $ret;
44 }
45 $digest = md5($d);
51 46
52 47 $a = array(); $a = array();
53 48 for ($i = 0; $i < 16; $i++) for ($i = 0; $i < 16; $i++)
54 49 $a[] = substr($digest, $i * 2, 2); $a[] = substr($digest, $i * 2, 2);
55 50
56 return implode(":", $a);
51 $ret['fingerprint'] = implode(":", $a);
52
53 $ret['ok'] = 1;
54 return $ret;
57 55 } }
58 56
59 57 /* /*
 
... ... function rg_keys_remove($db, $rg_ui, $key_id)
63 61 { {
64 62 rg_prof_start("keys_remove"); rg_prof_start("keys_remove");
65 63
66 // mark dirty
67 if (rg_state_set($db, "authorized_keys", 1) === FALSE) {
68 rg_keys_set_error("Cannot make state dirty (" . rg_state_error() . ")!");
69 return FALSE;
70 }
71
72 64 // TODO: move this to caller? // TODO: move this to caller?
73 65 $e_key_id = sprintf("%u", $key_id); $e_key_id = sprintf("%u", $key_id);
74 66
 
... ... function rg_keys_remove($db, $rg_ui, $key_id)
77 69 . " AND key_id = $e_key_id"; . " AND key_id = $e_key_id";
78 70 $res = rg_sql_query($db, $sql); $res = rg_sql_query($db, $sql);
79 71 if ($res === FALSE) { if ($res === FALSE) {
80 rg_keys_set_error("Cannot delete key $key_id (" . rg_sql_error() . ")");
72 rg_keys_set_error("cannot delete key $key_id (" . rg_sql_error() . ")");
81 73 return FALSE; return FALSE;
82 74 } }
83 75 rg_sql_free_result($res); rg_sql_free_result($res);
84 76
77 // mark dirty
78 if (rg_state_set($db, "authorized_keys", 1) === FALSE) {
79 rg_keys_set_error("cannot make state dirty (" . rg_state_error() . ")!");
80 return FALSE;
81 }
82
85 83 rg_prof_end("keys_remove"); rg_prof_end("keys_remove");
86 84
87 85 return TRUE; return TRUE;
 
... ... function rg_keys_add($db, $rg_ui, $key)
121 119 $itime = time(); $itime = time();
122 120 $e_key = rg_sql_escape($db, $key); $e_key = rg_sql_escape($db, $key);
123 121
124 if (rg_keys_valid($key) === FALSE)
122 $ki = rg_keys_info($key);
123 if ($ki['ok'] != 1)
125 124 return FALSE; return FALSE;
126 125
127 126 // check if we are over the maximum // check if we are over the maximum
 
... ... function rg_keys_add($db, $rg_ui, $key)
137 136 return FALSE; return FALSE;
138 137 } }
139 138
140 // set dirty
141 if (rg_state_set($db, "authorized_keys", 1) === FALSE) {
142 rg_keys_set_error("cannot make state dirty: " . rg_state_error());
143 return FALSE;
144 }
145
146 139 $sql = "INSERT INTO keys (itime, uid, key)" $sql = "INSERT INTO keys (itime, uid, key)"
147 140 . " VALUES ($itime, " . $rg_ui['uid'] . ", '$e_key')" . " VALUES ($itime, " . $rg_ui['uid'] . ", '$e_key')"
148 141 . " RETURNING key_id"; . " RETURNING key_id";
149 142 $res = rg_sql_query($db, $sql); $res = rg_sql_query($db, $sql);
150 143 if ($res === FALSE) { if ($res === FALSE) {
151 rg_keys_set_error("Cannot insert key (" . rg_sql_error() . ")");
144 rg_keys_set_error("cannot insert key (" . rg_sql_error() . ")");
152 145 return FALSE; return FALSE;
153 146 } }
154 147 $row = rg_sql_fetch_array($res); $row = rg_sql_fetch_array($res);
155 148 $id = $row['key_id']; $id = $row['key_id'];
156 149 rg_sql_free_result($res); rg_sql_free_result($res);
157 150
151 // set dirty
152 if (rg_state_set($db, "authorized_keys", 1) === FALSE) {
153 rg_keys_set_error("cannot make state dirty: " . rg_state_error());
154 return FALSE;
155 }
156
158 157 rg_prof_end("keys_add"); rg_prof_end("keys_add");
159 158
160 159 return $id; return $id;
 
... ... function rg_keys_regen($db)
199 198 return FALSE; return FALSE;
200 199 } }
201 200
201 // mark file as clean
202 rg_state_set($db, "authorized_keys", 0);
203
202 204 $sql = "SELECT uid, key FROM keys"; $sql = "SELECT uid, key FROM keys";
203 205 $res = rg_sql_query($db, $sql); $res = rg_sql_query($db, $sql);
204 206 if ($res === FALSE) { if ($res === FALSE) {
 
... ... function rg_keys_regen($db)
229 231 return FALSE; return FALSE;
230 232 } }
231 233
232 // mark file as clean
233 rg_state_set($db, "authorized_keys", 0);
234
235 234 rg_prof_end("keys_regen"); rg_prof_end("keys_regen");
236 235
237 236 return TRUE; return TRUE;
 
... ... function rg_keys_list($db, $rg_ui, $url)
253 252 return FALSE; return FALSE;
254 253 } }
255 254
256 $ret = "<div class=\"rg_keys_list\">\n";
257 $ret .= "<table width=\"100%\">\n";
258 $ret .= "<tr>\n";
259 $ret .= " <th>Date (UTC)</th>\n";
260 $ret .= " <th>Fingerprint</th>\n";
261 $ret .= " <th>Operations</th>\n";
262 $ret .= "</tr>\n";
255 $data = array();
263 256 while (($row = rg_sql_fetch_array($res))) { while (($row = rg_sql_fetch_array($res))) {
264 $ret .= "<tr>\n";
265 $ret .= " <td>" . gmdate("Y-m-d H:i", $row['itime']) . "</td>\n";
266 $ret .= " <td>" . rg_keys_fingerprint($row['key']) . "</td>\n";
267
268 $oper = "";
269 $oper = "[<a href=\"$url&amp;key_id=" . $row['key_id']
270 . "&amp;delete=1\">Delete!</a>]";
271 $ret .= " <td>" . $oper . "</td>\n";
272 $ret .= "</tr>\n";
257 $ki = rg_keys_info($row['key']);
258 if ($ki['ok'] != 1) {
259 rg_internal_error("Invalid key in db!");
260 continue;
261 }
262
263 $t = $ki;
264 $t['itime'] = gmdate("Y-m-d H:i", $row['itime']);
265
266 $t['HTML:operations'] = "[<a href=\"$url"
267 . "&amp;key_id=" . $row['key_id']
268 . "&amp;delete=1\">Delete</a>]";
269
270 $data[] = $t;
273 271 } }
274 $ret .= "</table>\n";
275 $ret .= "</div>\n";
276 272 rg_sql_free_result($res); rg_sql_free_result($res);
277 273
274 $ret = rg_template_table("user/keys/list", $data, array());
275
278 276 rg_prof_end("keys_list"); rg_prof_end("keys_list");
279 277
280 278 return $ret; return $ret;
File inc/log.inc.php changed (mode: 100644) (index 8601be1..0c6640f)
... ... function rg_log_set_file($file)
18 18 $rg_log_file = $file; $rg_log_file = $file;
19 19 } }
20 20
21 /*
22 * Transforms strange chars to hexa
23 */
24 function rg_log_callback($matches)
25 {
26 $n = pack("a*", $matches[0]);
27 $tmp = unpack("H*", $n);
28 return "[" . $tmp[1] . "]";
29 }
30
21 31 function rg_log($str) function rg_log($str)
22 32 { {
23 33 global $rg_log_file; global $rg_log_file;
 
... ... function rg_log($str)
34 44
35 45 $t = gettimeofday(); $t = gettimeofday();
36 46
37 $a = explode("\n", $str);
38 47 $buf0 = gmdate("Y-m-d H:i:s", $t['sec']) . "." . sprintf("%03u", $t['usec'] / 1000); $buf0 = gmdate("Y-m-d H:i:s", $t['sec']) . "." . sprintf("%03u", $t['usec'] / 1000);
39 48 $buf0 .= " " . $rg_log_sid . " "; $buf0 .= " " . $rg_log_sid . " ";
40 49 $buf = ""; $buf = "";
41 foreach ($a as $line) {
42 // TODO: replace string chars with [HH]; use /e
43 $line = preg_replace('/[\\x00-\\x08\\x0a-\\x1f\\x7f-\\xff]/', "X", $line);
44 $buf .= $buf0 . $line . "\n";
45 }
50 $str = preg_replace_callback('/[^\pL\pN\pP\pS \t]/uU', "rg_log_callback", $str);
51 $buf .= $buf0 . $str . "\n";
46 52
47 53 if ($rg_log_fd !== NULL) if ($rg_log_fd !== NULL)
48 54 fwrite($rg_log_fd, $buf); fwrite($rg_log_fd, $buf);
49 55 } }
50 56
57 /*
58 * Log a multiline string
59 */
60 function rg_log_ml($str)
61 {
62 $lines = explode("\n", $str);
63 if (empty($lines))
64 return;
65
66 foreach ($lines as $line)
67 rg_log($line);
68 }
69
51 70 function rg_fatal($msg) function rg_fatal($msg)
52 71 { {
53 72 rg_log("FATAL: $msg"); rg_log("FATAL: $msg");
54 73
55 74 $bt = debug_backtrace(); $bt = debug_backtrace();
56 rg_log("Backtrace: " . print_r($bt, TRUE));
75 rg_log_ml("Backtrace: " . print_r($bt, TRUE));
57 76 exit(1); exit(1);
58 77 } }
59 78
 
... ... function rg_internal_error($msg)
62 81 rg_log("Internal error: $msg"); rg_log("Internal error: $msg");
63 82
64 83 $bt = debug_backtrace(); $bt = debug_backtrace();
65 rg_log("Backtrace: " . print_r($bt, TRUE));
84 rg_log_ml("Backtrace: " . print_r($bt, TRUE));
66 85 } }
67 86
68 87 // TODO: send mail or store all data in database // TODO: send mail or store all data in database
 
... ... function rg_security_violation($msg)
71 90 rg_log("Security violation: $msg"); rg_log("Security violation: $msg");
72 91
73 92 $bt = debug_backtrace(); $bt = debug_backtrace();
74 rg_log("Backtrace: " . print_r($bt, TRUE));
93 rg_log_ml("Backtrace: " . print_r($bt, TRUE));
75 94
76 95 exit(1); exit(1);
77 96 } }
File inc/login/login.form.php changed (mode: 100644) (index 885d1f9..017d446)
1 1 <?php <?php
2 2 $_form = '<div class="formarea">' . "\n"; $_form = '<div class="formarea">' . "\n";
3 3
4 $_form .= '<div class="formarea_title">Login</div><br />' . "\n";
5
4 6 $_form .= rg_template_errmsg($errmsg); $_form .= rg_template_errmsg($errmsg);
5 7
6 8 $_form .= ' $_form .= '
File inc/login/login.php changed (mode: 100644) (index 485218f..60f3266)
... ... rg_log("/inc/login/login");
4 4 $user = rg_var_str("user"); $user = rg_var_str("user");
5 5 $pass = rg_var_str("pass"); $pass = rg_var_str("pass");
6 6
7 $_login = "<br />\n";
7 $_login = "";
8 8
9 9 $errmsg = array(); $errmsg = array();
10 10
File inc/mr.inc.php changed (mode: 100644) (index 918c8d6..cee6682)
... ... function rg_mr_queue_process($db)
126 126 $ret = TRUE; $ret = TRUE;
127 127 $dir = @opendir($rg_mr_queue); $dir = @opendir($rg_mr_queue);
128 128 if ($dir === FALSE) { if ($dir === FALSE) {
129 rg_mr_set_error("Cannot open dir $rg_mr_queue ($php_errormsg)!");
129 rg_mr_set_error("cannot open dir $rg_mr_queue ($php_errormsg)!");
130 130 return FALSE; return FALSE;
131 131 } }
132 132
File inc/repo.inc.php changed (mode: 100644) (index 75c889f..957cca7)
... ... function rg_repo_rights_get($db, $ri, $uid, $flags)
539 539
540 540 $r = rg_rights_get($db, "repo", $repo_id, $uid); $r = rg_rights_get($db, "repo", $repo_id, $uid);
541 541 if ($r['ok'] !== 1) { if ($r['ok'] !== 1) {
542 rg_repo_set_error("Cannot get rights (" . rg_rights_error() . ")!");
542 rg_repo_set_error("cannot get rights (" . rg_rights_error() . ")!");
543 543 return FALSE; return FALSE;
544 544 } }
545 545
 
... ... function rg_repo_rights_set($db, $ri, $uid, $rights)
568 568
569 569 $r = rg_rights_set($db, "repo", $ri['repo_id'], $uid, $rights); $r = rg_rights_set($db, "repo", $ri['repo_id'], $uid, $rights);
570 570 if ($r !== TRUE) { if ($r !== TRUE) {
571 rg_repo_set_error("Cannot alter rights (" . rg_rights_error() . ")!");
571 rg_repo_set_error("cannot alter rights (" . rg_rights_error() . ")!");
572 572 return FALSE; return FALSE;
573 573 } }
574 574
File inc/repo/repo.form.php changed (mode: 100644) (index 25a5efc..4b67312)
1 1 <?php <?php
2 2 $_form = '<div class="formarea">' . "\n"; $_form = '<div class="formarea">' . "\n";
3 3
4 $_form .= '<div class="formarea_title">' . $_action . ' repository</div><br />' . "\n";
5
4 6 $_form .= rg_template_errmsg($errmsg); $_form .= rg_template_errmsg($errmsg);
5 7
6 8 $_form .= ' $_form .= '
 
... ... $_form .= '
46 48 (un-check all for private repositories)<br /> (un-check all for private repositories)<br />
47 49 ' . rg_rights_checkboxes("repo", $rights) . ' ' . rg_rights_checkboxes("repo", $rights) . '
48 50 <br /> <br />
49 <br />
50 51
51 52 <input type="submit" name="button" value="' . $_action . '" /> <input type="submit" name="button" value="' . $_action . '" />
52 53
File inc/repo/search.form.php changed (mode: 100644) (index fd97b2a..03c5581)
1 1 <?php <?php
2 2 $_form = '<div class="formarea">' . "\n"; $_form = '<div class="formarea">' . "\n";
3 3
4 $_form .= '<div class="formarea_title">Search for repositories</div><br />' . "\n";
5
4 6 $_form .= rg_template_errmsg($errmsg); $_form .= rg_template_errmsg($errmsg);
5 7
6 8 $_form .= ' $_form .= '
 
... ... $_form .= '
20 22 <br /> <br />
21 23 <br /> <br />
22 24
23 <input type="submit" name="button" value="Search!" />
25 <input type="submit" name="button" value="Search" />
24 26
25 27 </form> </form>
26 28 </div> </div>
File inc/rights.inc.php changed (mode: 100644) (index 23ba88a..3afd2e7)
... ... function rg_rights_checkboxes($type, $passed_rights)
82 82 global $rg_rights; global $rg_rights;
83 83
84 84 if (!isset($rg_rights[$type])) { if (!isset($rg_rights[$type])) {
85 rg_log("[$type] is not registered! " . print_r(debug_backtrace(), TRUE));
85 rg_internal_error("[$type] is not registered!");
86 86 return ""; return "";
87 87 } }
88 88
 
... ... function rg_rights_get($db, $type, $obj_id, $uid)
157 157 . " LIMIT 1"; . " LIMIT 1";
158 158 $res = rg_sql_query($db, $sql); $res = rg_sql_query($db, $sql);
159 159 if ($res === FALSE) { if ($res === FALSE) {
160 rg_rights_set_error("Cannot get info (" . rg_sql_error() . ")!");
160 rg_rights_set_error("cannot get info (" . rg_sql_error() . ")!");
161 161 return $ret; return $ret;
162 162 } }
163 163
 
... ... function rg_rights_set($db, $type, $obj_id, $uid, $rights)
212 212
213 213 $res = rg_sql_query($db, $sql); $res = rg_sql_query($db, $sql);
214 214 if ($res === FALSE) { if ($res === FALSE) {
215 rg_rights_set_error("Cannot alter rights (" . rg_sql_error() . ")!");
215 rg_rights_set_error("cannot alter rights (" . rg_sql_error() . ")!");
216 216 return FALSE; return FALSE;
217 217 } }
218 218 rg_sql_free_result($res); rg_sql_free_result($res);
 
... ... function rg_rights_list($db, $type, $obj_id, $url)
234 234 $sql = "SELECT * FROM rights WHERE type = '$type' AND obj_id = $obj_id"; $sql = "SELECT * FROM rights WHERE type = '$type' AND obj_id = $obj_id";
235 235 $res = rg_sql_query($db, $sql); $res = rg_sql_query($db, $sql);
236 236 if ($res === FALSE) { if ($res === FALSE) {
237 rg_rights_set_error("Cannot get info (" . rg_sql_error() . ")!");
237 rg_rights_set_error("cannot get info (" . rg_sql_error() . ")!");
238 238 return FALSE; return FALSE;
239 239 } }
240 240
File inc/token.inc.php changed (mode: 100644) (index 6ba8511..f4193c4)
... ... function rg_token_insert($db, $sid, $token)
89 89 . " VALUES ('$sid', '$token', $now + 24 * 3600)"; . " VALUES ('$sid', '$token', $now + 24 * 3600)";
90 90 $res = rg_sql_query($db, $sql); $res = rg_sql_query($db, $sql);
91 91 if ($res === FALSE) { if ($res === FALSE) {
92 rg_token_set_error("Cannot insert token (" . rg_sql_error() . ")!");
92 rg_token_set_error("cannot insert token (" . rg_sql_error() . ")!");
93 93 return $ret; return $ret;
94 94 } }
95 95
File inc/user.inc.php changed (mode: 100644) (index dfe4d5f..f50d4e4)
... ... function rg_user_list($db, $url)
518 518 $sql = "SELECT * FROM users ORDER BY username"; $sql = "SELECT * FROM users ORDER BY username";
519 519 $res = rg_sql_query($db, $sql); $res = rg_sql_query($db, $sql);
520 520 if ($res === FALSE) { if ($res === FALSE) {
521 rg_user_set_error("Cannot get info (" . rg_sql_error() . ")!");
521 rg_user_set_error("cannot get info (" . rg_sql_error() . ")!");
522 522 return FALSE; return FALSE;
523 523 } }
524 524
 
... ... function rg_user_forgot_pass_mail($db, $email)
709 709 . "If you want to reset the password, follow:\n" . "If you want to reset the password, follow:\n"
710 710 . $proto . "://" . $proto . "://"
711 711 . @$_SERVER['HTTP_HOST'] . @$_SERVER['HTTP_HOST']
712 . rg_re_url("/op/forgot_link") . "&forgot_token=" . $r['token'],
712 . rg_re_url("/op/forgot_link") . "&forgot_token=" . $r['token']
713 . "\n\nRocketGit team",
713 714 $headers, $headers,
714 715 "-f $rg_admin_email")) { "-f $rg_admin_email")) {
715 rg_user_set_error("Cannot send mail ($php_errormsg)!");
716 rg_user_set_error("cannot send mail ($php_errormsg)!");
716 717 return $ret; return $ret;
717 718 } }
718 719
 
... ... function rg_user_confirm_send($email, $token)
782 783 . "Please confirm your account creation following:\n" . "Please confirm your account creation following:\n"
783 784 . $proto . $proto
784 785 . @$_SERVER['HTTP_HOST'] . @$_SERVER['HTTP_HOST']
785 . rg_re_url("/op/confirm") . "&token=$token",
786 . rg_re_url("/op/confirm") . "&token=" . $token
787 . "\n\nRocketGit team",
786 788 $headers, $headers,
787 789 "-f $rg_admin_email")) { "-f $rg_admin_email")) {
788 rg_user_set_error("Cannot send mail ($php_errormsg)!");
790 rg_user_set_error("cannot send mail ($php_errormsg)!");
789 791 return FALSE; return FALSE;
790 792 } }
791 793
File inc/user/confirm.php changed (mode: 100644) (index a5baee1..447a648)
... ... rg_log("/inc/user/confirm");
3 3
4 4 $token = rg_var_re("token", "/[^A-Za-z0-9]/"); $token = rg_var_re("token", "/[^A-Za-z0-9]/");
5 5
6 $_confirm = "<br />\n";
6 $_confirm = "";
7 7
8 8 $uid = rg_user_confirm($db, $token); $uid = rg_user_confirm($db, $token);
9 9 if ($uid !== FALSE) { if ($uid !== FALSE) {
File inc/user/create.php changed (mode: 100644) (index 845a06d..c2f26bf)
1 1 <?php <?php
2 2 rg_log("/inc/user/create"); rg_log("/inc/user/create");
3 3
4 $_create = "<br />\n";
4 $_create = "";
5 5
6 6 if ($rg_account_allow_creation != 1) { if ($rg_account_allow_creation != 1) {
7 7 $_create .= "This site does not allow account creation. Ask the Admin."; $_create .= "This site does not allow account creation. Ask the Admin.";
 
... ... if ($doit == 1) {
22 22
23 23 while (1) { while (1) {
24 24 if (strcmp($xpass, $xpass2) != 0) { if (strcmp($xpass, $xpass2) != 0) {
25 $errmsg[] = "Password are not the same!";
25 $errmsg[] = "password are not the same";
26 26 break; break;
27 27 } }
28 28
29 29 $_ui = rg_user_info($db, 0, $xuser, ""); $_ui = rg_user_info($db, 0, $xuser, "");
30 30 if ($_ui['ok'] == 0) { if ($_ui['ok'] == 0) {
31 $errmsg[] = "Internal error (" . rg_user_error() . ")!";
31 $errmsg[] = "internal error (" . rg_user_error() . ")";
32 32 break; break;
33 33 } }
34 34
35 35 if ($_ui['exists'] == 1) { if ($_ui['exists'] == 1) {
36 $errmsg[] = "User already exists.";
36 $errmsg[] = "user already exists";
37 37 break; break;
38 38 } }
39 39
File inc/user/forgot.form.php changed (mode: 100644) (index 2066cd4..6850766)
1 1 <?php <?php
2 2 $_forgot_form = '<div class="formarea">' . "\n"; $_forgot_form = '<div class="formarea">' . "\n";
3 3
4 $_forgot_form .= '<div class="formarea_title">Change password</div><br />' . "\n";
5
4 6 $_forgot_form .= rg_template_errmsg($errmsg); $_forgot_form .= rg_template_errmsg($errmsg);
5 7
6 8 $_forgot_form .= ' $_forgot_form .= '
File inc/user/forgot.php changed (mode: 100644) (index b125826..114122c)
... ... $forgot_token = rg_var_re("forgot_token", "/[^A-Za-z0-9]/");
5 5 $pass1 = rg_var_str("pass1"); $pass1 = rg_var_str("pass1");
6 6 $pass2 = rg_var_str("pass2"); $pass2 = rg_var_str("pass2");
7 7
8 $_forgot = "<br />\n";
8 $_forgot = "";
9 9
10 10 $errmsg = array(); $errmsg = array();
11 11
File inc/user/forgot_send.form.php changed (mode: 100644) (index 22f8399..68d6bdb)
1 1 <?php <?php
2 2 $_form = '<div class="formarea">' . "\n"; $_form = '<div class="formarea">' . "\n";
3 3
4 $_form .= '<div class="formarea_title">Forgot password</div><br />' . "\n";
5
4 6 $_form .= rg_template_errmsg($errmsg); $_form .= rg_template_errmsg($errmsg);
5 7
6 8 $_form .= ' $_form .= '
File inc/user/forgot_send.php changed (mode: 100644) (index e2c7968..8993da1)
... ... rg_log("/inc/user/forgot_send");
3 3
4 4 $email = rg_var_str("email"); $email = rg_var_str("email");
5 5
6 $_forgot = "<br />\n";
6 $_forgot = "";
7 7
8 8 $errmsg = array(); $errmsg = array();
9 9 $show_form = 1; $show_form = 1;
File inc/user/keys/add.form.php deleted (index 93d03a1..0000000)
1 <?php
2 // TODO: Do not pass op anymore in a hidden input field!
3 $_form = '<div class="formarea">' . "\n";
4
5 $_form .= "<div class=\"formarea_title\">Add a new ssh key</div><br />\n";
6
7 $_form .= rg_template_errmsg($errmsg);
8
9 $_form .= '
10 <form method="post" action="' . rg_re_post($cop) . '">
11 <input type="hidden" name="add" value="1" />
12 <input type="hidden" name="token" value="' . rg_token_get($db, $sid) . '" />
13
14 <label for="key" class="form_item_title">Key string (starts with ssh-...)</label><br />
15 <textarea name="key" value="' . $key . '" rows="4" cols="50"></textarea>
16 <br />
17 <br />
18
19 <input type="submit" name="button" value="Add!" />
20
21 </form>
22 </div>
23 ';
24
25 ?>
File inc/user/keys/keys.php changed (mode: 100644) (index 54e6863..9b0edf2)
2 2 rg_log("/inc/user/keys/keys"); rg_log("/inc/user/keys/keys");
3 3
4 4 $errmsg = array(); $errmsg = array();
5 $_my_more = $more;
5 6
6 7 $_keys = ""; $_keys = "";
7 8
 
... ... if (rg_var_uint("add") == 1) {
23 24 if (rg_keys_remove($db, $rg_ui, $key_id) !== TRUE) if (rg_keys_remove($db, $rg_ui, $key_id) !== TRUE)
24 25 $errmsg[] = rg_keys_error(); $errmsg[] = rg_keys_error();
25 26 } }
27 $_my_more['HTML:errmsg'] = rg_template_errmsg($errmsg);
26 28
29 $_my_more['HTML:add_form'] = rg_template("user/keys/add.html", $_my_more);
27 30
28 $_keys .= rg_keys_list($db, $rg_ui, $_url);
31 $_my_more['HTML:keys'] = rg_keys_list($db, $rg_ui, $_url);
29 32
30 include($INC . "/user/keys/add.form.php");
31 $_keys .= $_form;
33 $hints = array();
34 if ($rg_ssh_port != 0)
35 $hints[]['HTML:hint'] = rg_template("hints/ssh/key.html", $_my_more);
36 $_my_more['HTML:hints'] = rg_template_table("hints/list", $hints, $_my_more);
37
38 $_my_more['rg_action'] = rg_re_post($cop);
39 $_my_more['rg_form_token'] = rg_token_get($db, $sid);
40 $_my_more['key'] = $key;
41
42 $_keys = rg_template("user/keys/main.html", $_my_more);
32 43 ?> ?>
File inc/user/pass/pass.php changed (mode: 100644) (index 08c4bee..5f18947)
... ... if ($doit == 1) {
13 13
14 14 while (1) { while (1) {
15 15 if (!rg_token_valid($db, $sid, $token)) { if (!rg_token_valid($db, $sid, $token)) {
16 $errmsg[] = "Invalid token. Try again.";
16 $errmsg[] = "invalid token; try again";
17 17 break; break;
18 18 } }
19 19
20 20 if (strcmp($pass1, $pass2) != 0) { if (strcmp($pass1, $pass2) != 0) {
21 $errmsg[] = "Passwords does not match!";
21 $errmsg[] = "passwords does not match";
22 22 break; break;
23 23 } }
24 24
25 25 if (!rg_user_pass_valid($db, $rg_ui['uid'], $old_pass)) { if (!rg_user_pass_valid($db, $rg_ui['uid'], $old_pass)) {
26 $errmsg[] = "Old password is invalid!";
26 $errmsg[] = "old password is invalid";
27 27 break; break;
28 28 } }
29 29
File inc/user/personal.php changed (mode: 100644) (index bf2d3cf..7fcad9b)
... ... $second_menu = array(
26 26
27 27 $errmsg = array(); $errmsg = array();
28 28
29 if (empty($subop))
30 $subop = "edit_info";
31
29 32 switch ($subop) { switch ($subop) {
30 33 case 'edit_info': case 'edit_info':
31 34 include($INC . "/user/info/info.php"); include($INC . "/user/info/info.php");
File inc/user/repo-page.php changed (mode: 100644) (index 67824df..be8d7a9)
... ... if (rg_repo_ok($rr['repo']) !== TRUE) {
13 13 return; return;
14 14 } }
15 15
16 $ri = rg_repo_info($db, $rr);
17 if ($ri === FALSE) {
18 $_repo_page .= "Internal error!";
19 return;
20 }
21 if (($ri['ok'] != 1) || ($ri['exists'] != 1) || ($ri['deleted'] == 1)) {
22 $_repo_page .= "Invalid repository!";
23 return;
16 // Git dir is done asynchronous, loop till is OK
17 while (1) {
18 $ri = rg_repo_info($db, $rr);
19 if ($ri === FALSE) {
20 $_repo_page .= "Internal error!";
21 return;
22 }
23
24 if (($ri['ok'] != 1) || ($ri['exists'] != 1) || ($ri['deleted'] == 1)) {
25 $_repo_page .= "Invalid repository!";
26 return;
27 }
28
29 if ($ri['git_dir_done'] == 1)
30 break;
31
32 rg_log("git dir is not ready yet. Sleep 1 second and loop.");
33 sleep(1);
24 34 } }
25 35
26 36 $ui = rg_user_info($db, 0, $rr['user'], ""); $ui = rg_user_info($db, 0, $rr['user'], "");
 
... ... $_more = array(
39 49 "git" => rg_re_repo_git($rr), "git" => rg_re_repo_git($rr),
40 50 "can_admin" => $can_admin "can_admin" => $can_admin
41 51 ); );
52 $_more = array_merge($_more, $ri);
53 $_more['default_rights'] = implode(", ", rg_rights_text("repo", $ri['default_rights']));
54 $_more['max_commit_size'] = $ri['max_commit_size'] == 0 ? "unlimited" : rg_1024($ri['max_commit_size']);
55 $_more['max_users'] = $ri['max_users'] == 0 ? "unlimited" : rg_1000($ri['max_users']);
56 $_more['hints'] = "";
42 57
43 58 $repo_dir = rg_repo_name2base($rr) . $rr['repo'] . ".git"; $repo_dir = rg_repo_name2base($rr) . $rr['repo'] . ".git";
44 59 rg_log("repo_dir=$repo_dir"); rg_log("repo_dir=$repo_dir");
 
... ... $_more['branches_and_tags'] = "";
54 69 $_repo_body = ""; $_repo_body = "";
55 70 $_repo_right = ""; $_repo_right = "";
56 71
72 // build urls list
73 $urls = array();
74 if ($rg_ssh_port != 0)
75 $urls[]['HTML:url'] = '<a href="' . $_more['ssh'] . '">' . $_more['ssh'] . '</a>';
76 if ($rg_git_port != 0)
77 $urls[]['HTML:url'] = '<a href="' . $_more['git'] . '">' . $_more['git'] . '</a>';
78 $_more['HTML:urls'] = rg_template_table("repo/urls", $urls, $_more);
79
57 80 if (strcmp($subop, "admin") == 0) { if (strcmp($subop, "admin") == 0) {
58 81 if ($can_admin != 1) if ($can_admin != 1)
59 82 rg_security_violation("User is not admin!"); rg_security_violation("User is not admin!");
 
... ... if (strcmp($subop, "admin") == 0) {
72 95 rg_log("DEBUG: _more: " . rg_array2string($_more)); rg_log("DEBUG: _more: " . rg_array2string($_more));
73 96 $_more = array_merge($_more, $bt); $_more = array_merge($_more, $bt);
74 97
98 $hints = array();
99 if ($rg_ssh_port != 0)
100 $hints[]['HTML:hint'] = rg_template("hints/repo/clone_ssh.html", $_more);
101 if ($rg_git_port != 0)
102 $hints[]['HTML:hint'] = rg_template("hints/repo/clone_git.html", $_more);
103 if (rg_rights_allow($ri['default_rights'], "H")) // anonymous push?
104 $hints[]['HTML:hint'] = rg_template("hints/repo/anon_push.html", $_more);
105 rg_log("DEBUG: hints1: " . rg_array2string($hints));
106 $_more['HTML:hints'] = rg_template_table("hints/list", $hints, $_more);
107 rg_log("DEBUG: hints: " . $_more['HTML:hints']);
108
75 109 $_repo_body .= rg_template("repo/source.html", $_more); $_repo_body .= rg_template("repo/source.html", $_more);
76 110
77 111 rg_log("DEBUG: subop=[$subop]"); rg_log("DEBUG: subop=[$subop]");
 
... ... if (strcmp($subop, "admin") == 0) {
121 155 rg_log("Error generating log (" . rg_git_error() . ")!"); rg_log("Error generating log (" . rg_git_error() . ")!");
122 156 $_repo_body .= "Error generating log!"; $_repo_body .= "Error generating log!";
123 157 // TODO: rg_internal_error? // TODO: rg_internal_error?
158 } else if (empty($log)) {
159 $_repo_body .= rg_template("repo/not_init.html", $_more);
124 160 } else { } else {
125 161 //rg_log("DEBUG: log: " . print_r($log, TRUE)); //rg_log("DEBUG: log: " . print_r($log, TRUE));
126 162 $_repo_body .= rg_git_log_template($log, $_repo_body .= rg_git_log_template($log,
 
... ... if (strcmp($subop, "admin") == 0) {
191 227 } }
192 228 } }
193 229
194 $ri2 = $ri;
195 $ri2['default_rights'] = implode(", ", rg_rights_text("repo", $ri['default_rights']));
196 $ri2['max_commit_size'] = $ri['max_commit_size'] == 0 ? "unlimited" : rg_1024($ri['max_commit_size']);
197 $ri2['max_users'] = $ri['max_users'] == 0 ? "unlimited" : rg_1000($ri['max_users']);
198
199 230 $_more['HTML:repo_body'] = $_repo_body; $_more['HTML:repo_body'] = $_repo_body;
200 231 $_more['HTML:repo_right'] = $_repo_right; $_more['HTML:repo_right'] = $_repo_right;
201 $_repo_page = rg_template("repo/main.html", array_merge($ri2, $_more));
232 $_repo_page = rg_template("repo/main.html", $_more);
202 233 ?> ?>
File inc/user/repo/admin.php changed (mode: 100644) (index 15ea6ca..451cdde)
... ... $_admin_body = "";
5 5
6 6 $_url_admin = rg_re_repopage($rg_ui, $rr['repo']) . "/admin"; $_url_admin = rg_re_repopage($rg_ui, $rr['repo']) . "/admin";
7 7
8 $_admin_more = $ri;
8 $_admin_more = array_merge($more, $ri);
9 9 $_admin_more['url_admin'] = $_url_admin; $_admin_more['url_admin'] = $_url_admin;
10 10
11 11 $_op = @$paras[0]; $_op = @$paras[0];
File inc/user/repo/bug/show.php changed (mode: 100644) (index b3e9ace..32efe9c)
... ... else
60 60 $_tmp['HTML:notes'] = rg_template_table("repo/bug/list_note", $notes, array()); $_tmp['HTML:notes'] = rg_template_table("repo/bug/list_note", $notes, array());
61 61
62 62 // add note form // add note form
63 if (empty($note_errmsg))
64 $_tmp['HTML:note_errmsg'] = "";
65 else
66 $_tmp['HTML:note_errmsg'] = rg_template_errmsg($note_errmsg);
63 $_tmp['HTML:note_errmsg'] = rg_template_errmsg($note_errmsg);
67 64
68 65 $_tmp['rg_action'] = rg_re_post($cop); $_tmp['rg_action'] = rg_re_post($cop);
69 66 $_tmp['rg_form_token'] = rg_token_get($db, $sid); $_tmp['rg_form_token'] = rg_token_get($db, $sid);
File inc/user/repo/edit/edit.php changed (mode: 100644) (index 28225c0..c3bfe96)
... ... if ($doit == 1) {
24 24 // lookup user // lookup user
25 25 $_ui = rg_user_info($db, 0, $rr['user'], ""); $_ui = rg_user_info($db, 0, $rr['user'], "");
26 26 if ($_ui['ok'] != 1) { if ($_ui['ok'] != 1) {
27 $errmsg[] = "Internal error!";
27 $errmsg[] = "internal error";
28 28 break; break;
29 29 } else if ($_ui['exists'] != 1) { } else if ($_ui['exists'] != 1) {
30 $errmsg[] = "User <b>$user</b> does not exists!";
30 $errmsg[] = "user <b>$user</b> does not exists";
31 31 break; break;
32 32 } }
33 33
File inc/user/repo/rights/rights.form.php changed (mode: 100644) (index 3895d0a..7c38e5c)
1 1 <?php <?php
2 2 $_form = '<div class="formarea">' . "\n"; $_form = '<div class="formarea">' . "\n";
3 3
4 $_form .= '<div class="formarea_title">Grant rights</div><br />' . "\n";
5
4 6 $_form .= rg_template_errmsg($errmsg); $_form .= rg_template_errmsg($errmsg);
5 7
6 8 $_form .= ' $_form .= '
File inc/user/repo/rights/rights.php changed (mode: 100644) (index 75452b6..eb13654)
... ... while ($edit_uid > 0) {
36 36 // Find user name // Find user name
37 37 $target_ui = rg_user_info($db, $edit_uid, "", ""); $target_ui = rg_user_info($db, $edit_uid, "", "");
38 38 if ($target_ui['exists'] != 1) { if ($target_ui['exists'] != 1) {
39 $errmsg[] = "User does not exists anymore";
39 $errmsg[] = "user does not exists anymore";
40 40 break; break;
41 41 } }
42 42
 
... ... while ($edit_uid > 0) {
47 47
48 48 while ($doit == 1) { while ($doit == 1) {
49 49 if (!rg_token_valid($db, $sid, $token)) { if (!rg_token_valid($db, $sid, $token)) {
50 $errmsg[] = "Invalid token. Try again.";
50 $errmsg[] = "invalid token; try again";
51 51 return; return;
52 52 } }
53 53
54 54 // lookup user // lookup user
55 55 $_ui = rg_user_info($db, 0, $target_user, ""); $_ui = rg_user_info($db, 0, $target_user, "");
56 56 if ($_ui['exists'] != 1) { if ($_ui['exists'] != 1) {
57 $errmsg[] = "User <b>$target_user</b> does not exists!";
57 $errmsg[] = "user <b>$target_user</b> does not exists";
58 58 rg_log("User $target_user does not exists (" . rg_repo_error() . ")!"); rg_log("User $target_user does not exists (" . rg_repo_error() . ")!");
59 59 break; break;
60 60 } }
File inc/util.inc.php changed (mode: 100644) (index 1cdf802..a58816b)
... ... function rg_re_bugpage($ui, $ri, $bug_id)
183 183
184 184 function rg_re_repo_ssh($rr) function rg_re_repo_ssh($rr)
185 185 { {
186 global $rg_ssh_host;
186 187 global $rg_ssh_port; global $rg_ssh_port;
187 188
188 189 if ($rg_ssh_port == 22) if ($rg_ssh_port == 22)
189 190 $port = ""; $port = "";
190 191 else else
191 192 $port = ":" . $rg_ssh_port; $port = ":" . $rg_ssh_port;
192 return "ssh://rocketgit@" . $_SERVER['SERVER_NAME'] . $port
193 return "ssh://rocketgit@" . $rg_ssh_host . $port
193 194 . $rr['prefix'] . "/" . $rr['user'] . "/" . $rr['repo']; . $rr['prefix'] . "/" . $rr['user'] . "/" . $rr['repo'];
194 195 } }
195 196
 
... ... function rg_menu($a, $rg_ui, $op, $subop)
342 343 return $ret; return $ret;
343 344 } }
344 345
346 /*
347 * Provides a link to a image, taking in consideration the theme
348 * Used by rg_prepare_image.
349 */
350 function rg_image_callback($matches)
351 {
352 global $rg_scripts;
353 global $rg_theme;
354
355 $n = $matches[1];
356 $url = "/themes/" . $rg_theme . "/" . $n;
357 $xfile = $rg_scripts . "/root" . $url;
358 if (!is_file($xfile))
359 $url = "/themes/default/" . $n;
360
361 return $url;
362 }
363
364 /*
365 * Prepare an image taking in consideration the them. It will use rg_img as
366 * callback.
367 */
368 function rg_prepare_image($line)
369 {
370 return preg_replace_callback('/@@IMG:(.*)@@/U', "rg_image_callback", $line);
371 }
372
345 373 /* /*
346 374 * Replace conditionals * Replace conditionals
347 375 * @@if(X)_@@A@@_@@B@@ - if X is 0 will return @@B@@, else @@A@@ * @@if(X)_@@A@@_@@B@@ - if X is 0 will return @@B@@, else @@A@@
 
... ... function rg_prepare_replace(&$data, &$what, &$values)
378 406 //$what['FINAL'] = "/@@.*@@/U"; //$what['FINAL'] = "/@@.*@@/U";
379 407 //$values['FINAL'] = ""; //$values['FINAL'] = "";
380 408
381 //rg_log("DEBUG: what: " . print_r($what, TRUE));
382 //rg_log("DEBUG: values: " . print_r($values, TRUE));
409 //rg_log_ml("DEBUG: what: " . print_r($what, TRUE));
410 //rg_log_ml("DEBUG: values: " . print_r($values, TRUE));
411 }
412
413 /*
414 * Loads a file if exists, else return ""
415 */
416 function rg_file_get_contents($f)
417 {
418 if (!file_exists($f))
419 return "";
420
421 return @file_get_contents($f);
383 422 } }
384 423
385 424 /* /*
 
... ... function rg_template_table($dir, $data, $more)
390 429 global $rg_theme; global $rg_theme;
391 430 global $rg_scripts; global $rg_scripts;
392 431
393 $dir = $rg_scripts . "/root/themes/" . $rg_theme . "/" . $dir;
394 if (!is_dir($dir))
395 $dir = $rg_scripts . "/themes/default/" . $dir;
432 $xdir = $rg_scripts . "/root/themes/" . $rg_theme . "/" . $dir;
433 if (!is_dir($xdir))
434 $xdir = $rg_scripts . "/root/themes/default/" . $dir;
396 435
397 436 $m_what = array(); $m_values = array(); $m_what = array(); $m_values = array();
398 437 rg_prepare_replace($more, $m_what, $m_values); rg_prepare_replace($more, $m_what, $m_values);
399 438 rg_prepare_conditionals($more, $m_what, $m_values); rg_prepare_conditionals($more, $m_what, $m_values);
400 439
401 440 if (!is_array($data) || (count($data) == 0)) { if (!is_array($data) || (count($data) == 0)) {
402 $no_data = @file_get_contents($dir . "/nodata.html");
403 if ($no_data === FALSE)
404 $no_data = "";
441 $no_data = rg_file_get_contents($xdir . "/nodata.html");
405 442 return preg_replace($m_what, $m_values, $no_data); return preg_replace($m_what, $m_values, $no_data);
406 443 } }
407 444
408 $head = @file_get_contents($dir . "/header.html");
409 if ($head === FALSE)
410 $head = "";
411
412 $line = @file_get_contents($dir . "/line.html");
413 if ($line === FALSE)
414 $line = "";
415
416 $foot = @file_get_contents($dir . "/footer.html");
417 if ($foot === FALSE)
418 $foot = "";
445 $head = rg_file_get_contents($xdir . "/header.html");
446 $line = rg_file_get_contents($xdir . "/line.html");
447 $foot = rg_file_get_contents($xdir . "/footer.html");
448 $between = rg_file_get_contents($xdir . "/between.html");
419 449
420 450 $head = preg_replace($m_what, $m_values, $head); $head = preg_replace($m_what, $m_values, $head);
421 451 $foot = preg_replace($m_what, $m_values, $foot); $foot = preg_replace($m_what, $m_values, $foot);
452 $between = preg_replace($m_what, $m_values, $between);
422 453
423 454 $body = ""; $body = "";
455 $first = 1;
424 456 foreach ($data as $index => $info) { foreach ($data as $index => $info) {
425 457 $what = $m_what; $values = $m_values; $what = $m_what; $values = $m_values;
426 458
427 459 rg_prepare_replace($info, $what, $values); rg_prepare_replace($info, $what, $values);
428 460 rg_prepare_conditionals($info, $what, $values); rg_prepare_conditionals($info, $what, $values);
429 461
462 $line = rg_prepare_image($line);
463
464 if ($first == 1) {
465 $first = 0;
466 } else {
467 $body .= $between;
468 }
469
430 470 $body .= preg_replace($what, $values, $line); $body .= preg_replace($what, $values, $line);
431 471 } }
432 472
 
... ... function rg_template($file, $data)
438 478 global $rg_scripts; global $rg_scripts;
439 479 global $rg_theme; global $rg_theme;
440 480
441 $file = $rg_scripts . "/root/themes/" . $rg_theme . "/" . $file;
442 if (!is_file($file))
443 $file = $rg_scripts . "/themes/default/" . $file;
481 $xfile = $rg_scripts . "/root/themes/" . $rg_theme . "/" . $file;
482 if (!is_file($xfile))
483 $xfile = $rg_scripts . "/root/themes/default/" . $file;
444 484
445 $body = @file_get_contents($file);
446 if ($body === FALSE)
485 $body = rg_file_get_contents($xfile);
486 if (empty($body))
447 487 return ""; return "";
448 488
449 489 $what = array(); $what = array();
 
... ... function rg_template($file, $data)
452 492 rg_prepare_replace($data, $what, $values); rg_prepare_replace($data, $what, $values);
453 493 rg_prepare_conditionals($data, $what, $values); rg_prepare_conditionals($data, $what, $values);
454 494
495 $body = rg_prepare_image($body);
496
455 497 return preg_replace($what, $values, $body); return preg_replace($what, $values, $body);
456 498 } }
457 499
 
... ... function rg_template_list($c)
481 523 */ */
482 524 function rg_template_errmsg($a) function rg_template_errmsg($a)
483 525 { {
526 if (empty($a))
527 return "";
528
484 529 $b = array(); $b = array();
485 530 foreach ($a as $junk => $err) foreach ($a as $junk => $err)
486 531 $b[] = array("error" => $err); $b[] = array("error" => $err);
 
... ... function rg_exec($cmd)
494 539 { {
495 540 rg_prof_start("exec($cmd)"); rg_prof_start("exec($cmd)");
496 541
542 rg_log("Executing [$cmd]...");
543
497 544 $ret = array(); $ret = array();
498 545 $ret['ok'] = 0; $ret['ok'] = 0;
499 546 $ret['errmsg'] = ""; $ret['errmsg'] = "";
 
... ... function rg_dir_load($dir)
571 618 global $php_errormsg; global $php_errormsg;
572 619
573 620 $ret = array(); $ret = array();
621 if (!file_exists($dir)) {
622 rg_log("$dir does not exists!");
623 return $ret;
624 }
625
574 626 $d = @scandir($dir); $d = @scandir($dir);
575 627 if ($d === FALSE) { if ($d === FALSE) {
576 628 rg_log("Cannot scan dir $dir ($php_errormsg)."); rg_log("Cannot scan dir $dir ($php_errormsg).");
File root/index.php changed (mode: 100644) (index 1f486b3..3b1b94a)
... ... ini_set("track_errors", "On");
4 4
5 5 $INC = dirname(__FILE__) . "/../inc"; $INC = dirname(__FILE__) . "/../inc";
6 6 require_once("/etc/rocketgit/config.php"); require_once("/etc/rocketgit/config.php");
7 require_once($INC . "/init.inc.php");
7 8 require_once($INC . "/log.inc.php"); require_once($INC . "/log.inc.php");
8 9 include_once($INC . "/sql.inc.php"); include_once($INC . "/sql.inc.php");
9 10 include_once($INC . "/struct.inc.php"); include_once($INC . "/struct.inc.php");
 
... ... $op = ""; $subop = ""; $subsubop = ""; $cop = "";
25 26 $rr = array("user" => "", "repo" => "", "prefix" => ""); $rr = array("user" => "", "repo" => "", "prefix" => "");
26 27 $paras = array(); $paras = array();
27 28 $rg_ui = array(); $rg_ui = array();
28 $more = array();
29 29
30 30 // We have variable 'vv' passed from webserver - build 'op' and rest of paras // We have variable 'vv' passed from webserver - build 'op' and rest of paras
31 31 $vv = rg_var_str("vv"); $vv = rg_var_str("vv");
 
... ... rg_log("_COOKIE: " . rg_array2string($_COOKIE));
82 82 rg_log("Start! cop=[$cop] op=$op subop=$subop subsubop=$subsubop" rg_log("Start! cop=[$cop] op=$op subop=$subop subsubop=$subsubop"
83 83 . " doit=$doit sid=$sid rr: " . rg_array2string($rr)); . " doit=$doit sid=$sid rr: " . rg_array2string($rr));
84 84 rg_log("paras: " . implode("|", $paras)); rg_log("paras: " . implode("|", $paras));
85 rg_log("DEBUG: locale: " . setlocale(LC_ALL, 0));
85 86
86 87
87 88 // database connection // database connection
File root/themes/default/hints/list/between.html added (mode: 100644) (index 0000000..3fc714a)
1 <br />
File root/themes/default/hints/list/footer.html added (mode: 100644) (index 0000000..54352b2)
1 </ul>
2 </div> <!-- hints -->
File root/themes/default/hints/list/header.html added (mode: 100644) (index 0000000..56a9fb3)
1 <div class="hints">
2 <ul>
File root/themes/default/hints/list/line.html added (mode: 100644) (index 0000000..c759173)
1 <li>@@hint@@</li>
File root/themes/default/hints/list/nodata.html copied from file root/themes/default/errmsg/nodata.html (similarity 100%)
File root/themes/default/hints/repo/anon_push.html added (mode: 100644) (index 0000000..728084b)
1 You are allowed to anonymously push to this repository.<br />
2 This means that your pushed commits will automatically be transformed into a
3 merge request:<br />
4 <code>
5 ... clone the repository ...<br />
6 ... make some changes and some commits ...<br />
7 git push
8 </code>
File root/themes/default/hints/repo/client_win.html added (mode: 100644) (index 0000000..5c7b9d3)
1 Recommended client software:<br />
2 <ul>
3 <li><a href="http://msysgit.github.com/">msysgit</a></li>
4 </ul>
File root/themes/default/hints/repo/clone_git.html added (mode: 100644) (index 0000000..64b7498)
1 Clone this repository using git:<br />
2 <code>
3 git clone @@git@@ local_dir<br />
4 cd local_dir
5 </code>
File root/themes/default/hints/repo/clone_ssh.html added (mode: 100644) (index 0000000..5b80b64)
1 Clone this repository using ssh (do not forget to upload a key):<br />
2 <code>
3 git clone @@ssh@@ local_dir<br />
4 cd local_dir
5 </code>
File root/themes/default/hints/repo/merge.html added (mode: 100644) (index 0000000..61535f8)
1 How to merge?<br />
2
3 <code>
4 git fetch @@url@@ refs/mr/rg_xxxxxxxx
5 git merge ???
6 </code>
7 <br />
8
9 How to "see" all merge requests as branches:<br />
10 Add, in config file, under the remote you want, a line like this:<br />
11 <code>
12 fetch = +refs/namespaces/*:refs/remotes/your_remote_name_for_example_origin/mr/*
13 </code>
14 After you run a git fetch, you will have all the merge requests localy.<br />
15 You can do ???
16
File root/themes/default/hints/ssh/key.html added (mode: 100644) (index 0000000..0942c5b)
1 How to create a SSH key for RocketGit:<br />
2 <code>
3 ssh-keygen -C "Key for RocketGit" -f ~/.ssh/rocketgit1<br />
4 cat ~/.ssh/rocketgit1.pub<br />
5 </code>
6 Now, copy in clipboard starting with "ssh-...", including the comment.<br />
7 <br />
8
9 To force the use of this key when you connect to the server,<br />
10 add the following lines to ~/.ssh/config (use tab to indent):<br />
11 <code>
12 Host @@rg_ssh_host@@<br />
13 &nbsp;&nbsp; Port @@rg_ssh_port@@<br />
14 &nbsp;&nbsp; IdentityFile ~/.ssh/rocketgit1<br />
15 </code>
16 <br />
17
18 To see the fingerprint of your key (for comparation):<br />
19 <code>
20 ssh-keygen -f ~/.ssh/rocketgit1 -l</br />
21 </code>
File root/themes/default/index.html changed (mode: 100644) (index 4e673b5..a8d2c8d)
22 22 <div id="menus"> <div id="menus">
23 23 @@rg_menu@@ @@rg_menu@@
24 24 </div> </div>
25 </div>
25 </div> <!-- header -->
26 26
27 27 <div id="main"> <div id="main">
28 28 @@rg_body@@ @@rg_body@@
29 </div>
29 </div> <!-- main -->
30 30
31 31 <div id="footer"> <div id="footer">
32 32 <div style="float: left; padding: 5px;"> <div style="float: left; padding: 5px;">
33 <img src="@@rg_theme_url@@/logo/rg4.png" /><br />
33 <img src="@@IMG:logo/rg4.png@@" /><br />
34 34 <b>RocketGit</b> <b>RocketGit</b>
35 35 </div> </div>
36 36
37 <div style="float: left; padding: 5px;">
38 <small>Copyright: <a href="http://kernel.embedromix.ro" target="_new">Catalin(ux) M. BOIE</a></small>
37 <div style="float: left; padding: 5px; padding-left: 20px;">
38 <small>Copyright: <a href="http://kernel.embedromix.ro/" target="_new">Catalin(ux) M. BOIE</a></small>
39 39 </div> </div>
40 </div>
40 </div> <!-- footer -->
41 41
42 42 </div> <!-- container --> </div> <!-- container -->
43 43
File root/themes/default/main.css changed (mode: 100644) (index 68706a8..d767b96)
... ... body {
7 7 font-family: arial, helvetica, sans-serif; font-family: arial, helvetica, sans-serif;
8 8 font-size: 10pt; font-size: 10pt;
9 9 line-height: 105%; line-height: 105%;
10 background-color: #EEEEEE;
10 11 } }
11 12
12 13 table { table {
 
... ... th, td {
28 29
29 30 #container { background-color: #eeeeee; overflow: hidden; } #container { background-color: #eeeeee; overflow: hidden; }
30 31
31 .white_border { border: 1px solid #eeeeee; }
32
33 32 #menus { float: left; } #menus { float: left; }
34 33
35 34 .menu { padding: 6px 0px; } .menu { padding: 6px 0px; }
 
... ... th, td {
71 70 border-top: 1px solid #cccccc; border-top: 1px solid #cccccc;
72 71 padding: 5px; padding: 5px;
73 72 overflow: hidden; overflow: hidden;
73 min-height: 400px;
74 margin-left: 10px;
75 line-height: 120%;
74 76 } }
75 77
76 78 #footer { #footer {
 
... ... th, td {
81 83 } }
82 84
83 85 .formarea { .formarea {
84 margin: 5px auto;
86 margin-top: 5px;
85 87 background-color: #dddddd; background-color: #dddddd;
86 88 padding: 5px; padding: 5px;
87 width: 800px;
88 89 border-radius: 4px 4px 4px 4px; border-radius: 4px 4px 4px 4px;
89 90 border: 1px solid #cccccc; border: 1px solid #cccccc;
90 91 line-height: 120%; line-height: 120%;
 
... ... label {
178 179 border-radius: 4px 4px 4px 4px; border-radius: 4px 4px 4px 4px;
179 180 font-size: 8pt; font-size: 8pt;
180 181 padding: 3px 3px; padding: 3px 3px;
182 background-color: #EEBB60;
181 183 } }
182 184 .urls ul li a { .urls ul li a {
183 185 text-decoration: none; text-decoration: none;
 
... ... label {
203 205 background-color: #a0d0ff; background-color: #a0d0ff;
204 206 } }
205 207
208 .hints {
209 margin-top: 5px;
210 background-color: #A0FFA0;
211 padding: 5px;
212 border-radius: 4px 4px 4px 4px;
213 border: 1px solid #cccccc;
214 line-height: 120%;
215 }
216
217 .bug {
218 margin-top: 5px;
219 }
220 .bug_body {
221 margin-left: 5px;
222 background-color: #A0FFA0;
223 padding: 5px;
224 border-radius: 4px 4px 4px 4px;
225 border: 1px solid #cccccc;
226 line-height: 120%;
227 }
228
File root/themes/default/main.html renamed from root/themes/default/body.html (similarity 67%) (mode: 100644) (index 71fe795..d645f9c)
1 <br />
2 1 <h1>Welcome to RocketGit!</h1> <h1>Welcome to RocketGit!</h1>
3 2 <br /> <br />
4 3
5 Our target is to be the best FLOSS software for managin Git projects.
4 Our target is to be the best FLOSS software for managing Git projects.
6 5 With your help, we will do it. Thanks!<br /> With your help, we will do it. Thanks!<br />
7 6 <br /> <br />
8 7 You can create an account <a href="/op/create_account">here<a/>.<br /> You can create an account <a href="/op/create_account">here<a/>.<br />
File root/themes/default/repo/admin.html changed (mode: 100644) (index 9da37e4..eecfcd6)
1 <div class="menu">
1 <div class="menu submenu">
2 2 <ul> <ul>
3 3 <li><a href="@@url_admin@@/edit">Edit</a></li> <li><a href="@@url_admin@@/edit">Edit</a></li>
4 4 <li><a href="@@url_admin@@/rights">Rights</a></li> <li><a href="@@url_admin@@/rights">Rights</a></li>
File root/themes/default/repo/bug/bug_add.html changed (mode: 100644) (index d74158f..c8f6f6a)
1 1 <div class="formarea"> <div class="formarea">
2 2
3 <div class="formarea_title">Add a bug</div><br />
4
3 5 @@bug_errmsg@@ @@bug_errmsg@@
4 6
5 7 <form method="post" action="@@rg_action@@"> <form method="post" action="@@rg_action@@">
 
12 14 <br /> <br />
13 15
14 16 <label for="body" class="form_item_title">Description</label><br /> <label for="body" class="form_item_title">Description</label><br />
15 <textarea name="body" rows="8" cols="80">@@body@@</textarea>
17 <textarea name="body" rows="5" cols="80">@@body@@</textarea>
16 18 <br /> <br />
17 19 <br /> <br />
18 20
File root/themes/default/repo/bug/list/line.html changed (mode: 100644) (index 7fc339a..78d2600)
1 <!-- @@DUMP@@ -->
1 <!-- @@DUMP-DISABLED@@ -->
2 2 <tr> <tr>
3 3 <td><a href="@@url_bug@@">@@bug_id@@</a></td> <td><a href="@@url_bug@@">@@bug_id@@</a></td>
4 4 <td>@@creation@@</td> <td>@@creation@@</td>
File root/themes/default/repo/bug/main.html changed (mode: 100644) (index ddfbe28..a98cf6b)
1 <div class="menu">
1 <div class="menu submenu">
2 2 <ul> <ul>
3 3 <li><a href="@@url_repo@@/bug">List</a></li> <li><a href="@@url_repo@@/bug">List</a></li>
4 4 <li><a href="@@url_repo@@/bug/add">Add</a></li> <li><a href="@@url_repo@@/bug/add">Add</a></li>
File root/themes/default/repo/bug/note_add.html changed (mode: 100644) (index 2c5cfb4..f8b31e1)
1 1 <div class="formarea"> <div class="formarea">
2 2
3 <div class="formarea_title">Add note</div><br />
4
3 5 @@note_errmsg@@ @@note_errmsg@@
4 6
5 7 <form method="post" action="@@rg_action@@"> <form method="post" action="@@rg_action@@">
File root/themes/default/repo/bug/show.html changed (mode: 100644) (index 83acfb4..1691b9e)
1 <!-- @@DUMP@@ -->
1 <!-- @@DUMP-DISABLED@@ -->
2 2
3 Bug ID: @@bug_id@@<br />
4 Insertion date (UTC): @@creation@@<br />
5 Last update (UTC): @@updated@@<br />
6 Reporter: @@owner@@<br />
7 Assigned to: @@assigned_to@@<br />
8 Title: @@title@@<br />
9 Body:<br />
10 @@body@@
11 <br />
3 <div class="bug">
4 <b>#@@bug_id@@ - @@title@@</b><br />
5 Insertion date (UTC): @@creation@@<br />
6 Last update (UTC): @@updated@@<br />
7 Reporter: <b>@@owner@@</b><br />
8 Assigned to: <b>@@assigned_to@@</b><br />
9 <div class="bug_body">
10 @@body@@
11 </div>
12 12
13 @@labels@@
14 @@notes@@
13 @@labels@@
14 @@notes@@
15 15
16 @@note_add@@
16 @@note_add@@
17 </div>
File root/themes/default/repo/main.html changed (mode: 100644) (index fb7c2eb..6ef0bb6)
1 <div class="repo_container">
1 2 <div class="repo_header"> <div class="repo_header">
2 3 <div> <div>
3 4 <div class="repo_title"> <div class="repo_title">
4 <a href="@@url_user@@">@@owner@@</a>/<a href="@@url_repo@@">@@name@@</a>
5 <a href="@@url_user@@">@@owner@@</a> / <a href="@@url_repo@@">@@name@@</a>
5 6 </div> </div>
6 7 <div class="repo_desc"> <div class="repo_desc">
7 8 @@description@@ @@description@@
8 9 </div> </div>
9 10
10 <div class="urls">
11 <ul>
12 <li><a href="@@ssh@@">@@ssh@@</a></li>
13 <li><a href="@@git@@">@@git@@</a></li>
14 <li><a href="@@git@@">@@git@@</a></li>
15 </ul>
16 </div>
11 @@urls@@
17 12 </div> </div>
18 13
19 <div class="menu repo_menu" style="clear: both;">
14 <div class="menu submenu" style="clear: both;">
20 15 <ul> <ul>
21 16 <li><a href="@@url_repo@@/source">Source</a></li> <li><a href="@@url_repo@@/source">Source</a></li>
22 17 <li><a href="@@url_repo@@/mr">Merge requests</a></li> <li><a href="@@url_repo@@/mr">Merge requests</a></li>
 
24 19 @@if(@@can_admin@@){{<li><a href="@@url_repo@@/admin">Admin</a></li>}}{{}} @@if(@@can_admin@@){{<li><a href="@@url_repo@@/admin">Admin</a></li>}}{{}}
25 20 </ul> </ul>
26 21 </div> </div>
27 </div>
22 </div> <!-- repo_header -->
28 23
29 24 <div class="repo_right"> <div class="repo_right">
30 25 @@repo_right@@ @@repo_right@@
31 </div>
26 </div> <!-- repo_right -->
32 27
33 28 <div class="repo_body"> <div class="repo_body">
34 29 @@repo_body@@ @@repo_body@@
35 </div>
30 </div> <!-- repo_body -->
31
32 @@hints@@
36 33
34 </div> <!-- repo_container -->
File root/themes/default/repo/not_init.html added (mode: 100644) (index 0000000..2e2332a)
1 <!-- This is shown when the repo contains no commit -->
2
3 This repo contains no commits.
File root/themes/default/repo/source.html changed (mode: 100644) (index a07b2a8..e3d9cd4)
1 <div>
2 @@branches_and_tags@@
3 </div>
1 @@branches_and_tags@@
4 2
5 <div class="menu">
3 <div class="menu submenu">
6 4 <ul> <ul>
7 5 <li><a href="@@url_repo@@/source/log@@ref_url@@">Log</a></li> <li><a href="@@url_repo@@/source/log@@ref_url@@">Log</a></li>
8 6 <li><a href="@@url_repo@@/source/tree@@ref_url@@">Tree</a></li> <li><a href="@@url_repo@@/source/tree@@ref_url@@">Tree</a></li>
File root/themes/default/repo/urls/footer.html copied from file root/themes/default/errmsg/footer.html (similarity 65%) (mode: 100644) (index 8902b2e..a9b0151)
1 1 </ul> </ul>
2 2 </div> </div>
3 <br />
File root/themes/default/repo/urls/header.html added (mode: 100644) (index 0000000..2e2e2cf)
1 <div class="urls">
2 <ul>
File root/themes/default/repo/urls/line.html added (mode: 100644) (index 0000000..39971f7)
1 <li>@@url@@</li>
File root/themes/default/repo/urls/nodata.html copied from file root/themes/default/errmsg/nodata.html (similarity 100%)
File root/themes/default/user/keys/add.html added (mode: 100644) (index 0000000..bccab7a)
1 <div class="formarea">
2
3 <div class="formarea_title">Add a new ssh key</div><br />
4
5 @@errmsg@@
6
7 <form method="post" action="@@rg_action@@">
8 <input type="hidden" name="add" value="1" />
9 <input type="hidden" name="token" value="@@rg_form_token@@" />
10
11 <label for="key" class="form_item_title">Key string (starts with ssh-...)</label><br />
12 <textarea name="key" value="@@key@@" rows="4" cols="50"></textarea>
13 <br />
14 <br />
15
16 <input type="submit" name="button" value="Add" />
17
18 </form>
19 </div>
File root/themes/default/user/keys/list/footer.html copied from file root/themes/default/repo/fstat/footer.html (similarity 56%) (mode: 100644) (index 000ca4b..7aae9f5)
1 1 </table> </table>
2 </div>
File root/themes/default/user/keys/list/header.html added (mode: 100644) (index 0000000..62fba12)
1 <div class="rg_keys_list">
2 <table>
3 <tr>
4 <th>Date (UTC)</th>
5 <th>Fingerprint</th>
6 <th>Comment</th>
7 <th>Operations</th>
8 </tr>
9
File root/themes/default/user/keys/list/line.html added (mode: 100644) (index 0000000..712e515)
1 <!-- @@DUMP-DISABLED@@ -->
2 <tr>
3 <td>@@itime@@</td>
4 <td>@@fingerprint@@</td>
5 <td>@@comment@@</td>
6 <td>@@operations@@</td>
7 </tr>
8
File root/themes/default/user/keys/list/nodata.html copied from file root/themes/default/repo/fstat/nodata.html (similarity 56%) (mode: 100644) (index f70717a..7334adb)
1 1 <div class="warning"> <div class="warning">
2 No file changed.
2 No key uploaded yet.
3 3 </div> </div>
File root/themes/default/user/keys/main.html added (mode: 100644) (index 0000000..d7191de)
1 @@add_form@@
2
3 @@keys@@
4
5 @@hints@@
File root/themes/try2/main.css copied from file root/themes/default/main.css (similarity 65%) (mode: 100644) (index 68706a8..563608f)
4 4 } }
5 5
6 6 body { body {
7 font-family: arial, helvetica, sans-serif;
7 font-family: helvetica, sans-serif;
8 8 font-size: 10pt; font-size: 10pt;
9 9 line-height: 105%; line-height: 105%;
10 background-color: #FFFF99;
10 11 } }
11 12
12 13 table { table {
13 14 border-collapse: collapse; border-collapse: collapse;
14 border: 1px solid #000;
15 border: 1px solid #000000;
15 16 background-color: #eeeeee; background-color: #eeeeee;
16 color: #000;
17 color: #000000;
17 18 border-spacing: 1px; border-spacing: 1px;
18 19 padding: 1px; padding: 1px;
19 20 } }
 
... ... th, td {
26 27 word-wrap: break-word; word-wrap: break-word;
27 28 } }
28 29
29 #container { background-color: #eeeeee; overflow: hidden; }
30 code {
31 font-size: 8pt;
32 font-weight: bold;
33 }
34
35 form input, form textarea {
36 border: 1px solid #CCCCCC;
37 font-size: 11pt;
38 padding: 5px;
39 }
40 form input[type="submit"] { font-weight: bold; }
30 41
31 .white_border { border: 1px solid #eeeeee; }
42 #container { }
32 43
33 44 #menus { float: left; } #menus { float: left; }
34 45
35 .menu { padding: 6px 0px; }
46 .menu { padding: 4px 0px; }
36 47 .menu ul { list-style-type: none; } .menu ul { list-style-type: none; }
37 48 .menu ul li { display: inline; } .menu ul li { display: inline; }
38 49 .menu ul li a { .menu ul li a {
39 50 text-decoration: none; text-decoration: none;
40 51 color: #666666; color: #666666;
41 font-size: 10pt;
52 font-size: 11pt;
42 53 padding: 3px 13px; padding: 3px 13px;
43 border: 1px solid #cccccc;
44 border-radius: 4px 4px 4px 4px;
54 font-weight: bold;
45 55 } }
46 .menu ul li a:hover { border: 1px solid #999999; }
47 .menu ul li a.selected { color: #bbbbbb; }
48 .menu ul li a.selected:hover { border: 1px solid #cccccc; }
56 .menu ul li a:hover { color: #AAAAAA; }
57 .menu ul li a.selected { color: #BBBBBB; }
58 .menu ul li a.selected:hover { color: #CCCCCC; }
49 59
50 60 .junk {} .junk {}
51 61
 
... ... th, td {
64 74 #header { #header {
65 75 padding: 5px; padding: 5px;
66 76 overflow: hidden; overflow: hidden;
77 border-bottom: 1px solid #CCCCCC;
67 78 } }
68 79
69 80 #main { #main {
70 81 clear: both; clear: both;
71 border-top: 1px solid #cccccc;
72 padding: 5px;
73 82 overflow: hidden; overflow: hidden;
83 padding-top: 10px;
84 padding-left: 25px;
85 padding-bottom: 10px;
86 padding-right: 25px;
87 min-height: 400px;
88 line-height: 120%;
89 float: left;
90 background-color: #EEEEEE;
91 width: 100%;
74 92 } }
75 93
76 94 #footer { #footer {
77 95 clear: both; clear: both;
78 border-top: 1px solid #cccccc;
96 border-top: 1px solid #CCCCCC;
79 97 padding: 5px 5px; padding: 5px 5px;
80 98 overflow: hidden; overflow: hidden;
81 99 } }
82 100
83 101 .formarea { .formarea {
84 margin: 5px auto;
85 background-color: #dddddd;
102 border: 1px solid #CCCCCC;
86 103 padding: 5px; padding: 5px;
87 width: 800px;
88 104 border-radius: 4px 4px 4px 4px; border-radius: 4px 4px 4px 4px;
89 border: 1px solid #cccccc;
90 line-height: 120%;
105 display: inline-block;
91 106 } }
92 107
93 108 .formarea_title { .formarea_title {
94 109 font-weight: bold; font-weight: bold;
95 font-size: 12pt;
110 font-size: 13pt;
111 border: 0px;
112 border-bottom: 2px solid #CCCCCC;
96 113 } }
97 114
98 115 #profiling { #profiling {
 
... ... th, td {
111 128
112 129 .form_item_title { .form_item_title {
113 130 font-weight: bold; font-weight: bold;
114 margin-bottom: 5px;
115 131 } }
116 132
117 133 label { label {
 
... ... label {
120 136 } }
121 137
122 138 .rg_keys_list { .rg_keys_list {
123 margin: 20px auto;
124 background-color: #dddddd;
125 padding: 5px;
126 width: 650px;
127 border-radius: 4px 4px 4px 4px;
128 border: 1px solid #cccccc;
139 margin-top: 20px;
129 140 } }
130 141
131 142 .blob_title { .blob_title {
 
... ... label {
139 150 border: 1px solid #cccccc; border: 1px solid #cccccc;
140 151 padding: 3px; padding: 3px;
141 152 margin-top: 5px; margin-top: 5px;
153 display: inline-block;
142 154 } }
143 155
144 156 .diff {} .diff {}
 
... ... label {
147 159
148 160 .numbers { text-align: right; } .numbers { text-align: right; }
149 161
150 .repo_menu {}
151 .repo_menu ul li {}
162 .submenu {
163 border: 1px solid #CCCCCC;
164 border-bottom: 1px solid #CCCCCC;
165 background-color: #FFFF99;
166 margin-bottom: 3px;
167 display: inline-block;
168 }
169 .submenu ul li {}
170
171 .repo_container { }
152 172
153 173 .repo_header { } .repo_header { }
154 174
 
... ... label {
178 198 border-radius: 4px 4px 4px 4px; border-radius: 4px 4px 4px 4px;
179 199 font-size: 8pt; font-size: 8pt;
180 200 padding: 3px 3px; padding: 3px 3px;
201 background-color: #E5E5FF;
181 202 } }
182 203 .urls ul li a { .urls ul li a {
183 204 text-decoration: none; text-decoration: none;
 
... ... label {
203 224 background-color: #a0d0ff; background-color: #a0d0ff;
204 225 } }
205 226
227 .hints {
228 margin-top: 5px;
229 background-color: #A0FFA0;
230 padding: 5px;
231 border-radius: 4px 4px 4px 4px;
232 border: 1px solid #cccccc;
233 line-height: 120%;
234 font-size: 9pt;
235 display: inline-block;
236 }
237 .hints ul { list-style-type: none; }
238 .hints ul li { }
239 .hints ul li a { }
240
241
242 .bug {
243 margin-top: 5px;
244 }
245 .bug_body {
246 margin-left: 5px;
247 background-color: #A0FFA0;
248 padding: 5px;
249 border-radius: 4px 4px 4px 4px;
250 border: 1px solid #cccccc;
251 line-height: 120%;
252 display: inline-block;
253 }
254
File root/themes/try3/main.css copied from file root/themes/default/main.css (similarity 64%) (mode: 100644) (index 68706a8..dfd903b)
4 4 } }
5 5
6 6 body { body {
7 font-family: arial, helvetica, sans-serif;
7 font-family: helvetica, sans-serif;
8 8 font-size: 10pt; font-size: 10pt;
9 9 line-height: 105%; line-height: 105%;
10 background-color: #FFFF99;
10 11 } }
11 12
12 13 table { table {
13 14 border-collapse: collapse; border-collapse: collapse;
14 border: 1px solid #000;
15 border: 1px solid #000000;
15 16 background-color: #eeeeee; background-color: #eeeeee;
16 color: #000;
17 color: #000000;
17 18 border-spacing: 1px; border-spacing: 1px;
18 19 padding: 1px; padding: 1px;
19 20 } }
 
... ... th, td {
26 27 word-wrap: break-word; word-wrap: break-word;
27 28 } }
28 29
29 #container { background-color: #eeeeee; overflow: hidden; }
30 code {
31 font-size: 8pt;
32 font-weight: bold;
33 }
34
35 form input, form textarea {
36 border: 1px solid #CCCCCC;
37 font-size: 11pt;
38 padding: 5px;
39 }
40 form input[type="submit"] { font-weight: bold; }
30 41
31 .white_border { border: 1px solid #eeeeee; }
42 #container { }
32 43
33 #menus { float: left; }
44 #menus { }
34 45
35 .menu { padding: 6px 0px; }
46 .menu { padding: 4px 0px; }
36 47 .menu ul { list-style-type: none; } .menu ul { list-style-type: none; }
37 48 .menu ul li { display: inline; } .menu ul li { display: inline; }
38 49 .menu ul li a { .menu ul li a {
39 50 text-decoration: none; text-decoration: none;
40 51 color: #666666; color: #666666;
41 font-size: 10pt;
52 font-size: 11pt;
42 53 padding: 3px 13px; padding: 3px 13px;
43 border: 1px solid #cccccc;
44 border-radius: 4px 4px 4px 4px;
54 font-weight: bold;
45 55 } }
46 .menu ul li a:hover { border: 1px solid #999999; }
47 .menu ul li a.selected { color: #bbbbbb; }
48 .menu ul li a.selected:hover { border: 1px solid #cccccc; }
56 .menu ul li a:hover { color: #AAAAAA; }
57 .menu ul li a.selected { color: #BBBBBB; }
58 .menu ul li a.selected:hover { color: #CCCCCC; }
49 59
50 60 .junk {} .junk {}
51 61
 
... ... th, td {
64 74 #header { #header {
65 75 padding: 5px; padding: 5px;
66 76 overflow: hidden; overflow: hidden;
77 border-bottom: 1px solid #CCCCCC;
67 78 } }
68 79
69 80 #main { #main {
70 clear: both;
71 border-top: 1px solid #cccccc;
72 padding: 5px;
73 overflow: hidden;
81 padding-top: 10px;
82 padding-left: 25px;
83 padding-bottom: 10px;
84 padding-right: 25px;
85 min-height: 400px;
86 line-height: 120%;
87 background-color: #EEEEEE;
88 width: 100%;
74 89 } }
75 90
76 91 #footer { #footer {
77 92 clear: both; clear: both;
78 border-top: 1px solid #cccccc;
93 border-top: 1px solid #CCCCCC;
79 94 padding: 5px 5px; padding: 5px 5px;
80 95 overflow: hidden; overflow: hidden;
81 96 } }
82 97
83 98 .formarea { .formarea {
84 margin: 5px auto;
85 background-color: #dddddd;
99 border: 1px solid #CCCCCC;
86 100 padding: 5px; padding: 5px;
87 width: 800px;
88 101 border-radius: 4px 4px 4px 4px; border-radius: 4px 4px 4px 4px;
89 border: 1px solid #cccccc;
90 line-height: 120%;
102 display: table;
91 103 } }
92 104
93 105 .formarea_title { .formarea_title {
94 106 font-weight: bold; font-weight: bold;
95 font-size: 12pt;
107 font-size: 13pt;
108 border: 0px;
109 border-bottom: 2px solid #CCCCCC;
96 110 } }
97 111
98 112 #profiling { #profiling {
 
... ... th, td {
111 125
112 126 .form_item_title { .form_item_title {
113 127 font-weight: bold; font-weight: bold;
114 margin-bottom: 5px;
115 128 } }
116 129
117 130 label { label {
 
... ... label {
120 133 } }
121 134
122 135 .rg_keys_list { .rg_keys_list {
123 margin: 20px auto;
124 background-color: #dddddd;
125 padding: 5px;
126 width: 650px;
127 border-radius: 4px 4px 4px 4px;
128 border: 1px solid #cccccc;
136 margin-top: 20px;
129 137 } }
130 138
131 139 .blob_title { .blob_title {
 
... ... label {
139 147 border: 1px solid #cccccc; border: 1px solid #cccccc;
140 148 padding: 3px; padding: 3px;
141 149 margin-top: 5px; margin-top: 5px;
150 display: table;
142 151 } }
143 152
144 153 .diff {} .diff {}
 
... ... label {
147 156
148 157 .numbers { text-align: right; } .numbers { text-align: right; }
149 158
150 .repo_menu {}
151 .repo_menu ul li {}
159 .submenu {
160 border: 1px solid #CCCCCC;
161 border-bottom: 1px solid #CCCCCC;
162 background-color: #FFFF99;
163 margin-bottom: 3px;
164 display: table;
165 }
166 .submenu ul li {}
167
168 .repo_container { }
152 169
153 170 .repo_header { } .repo_header { }
154 171
 
... ... label {
168 185 margin: 3px 0px; margin: 3px 0px;
169 186 } }
170 187
171 .repo_body { display: block; }
188 .repo_body { display: table; }
172 189
173 190 .urls { padding: 3px 0px; margin: 5px 0px; } .urls { padding: 3px 0px; margin: 5px 0px; }
174 191 .urls ul { list-style-type: none; } .urls ul { list-style-type: none; }
 
... ... label {
178 195 border-radius: 4px 4px 4px 4px; border-radius: 4px 4px 4px 4px;
179 196 font-size: 8pt; font-size: 8pt;
180 197 padding: 3px 3px; padding: 3px 3px;
198 background-color: #E5E5FF;
181 199 } }
182 200 .urls ul li a { .urls ul li a {
183 201 text-decoration: none; text-decoration: none;
 
... ... label {
203 221 background-color: #a0d0ff; background-color: #a0d0ff;
204 222 } }
205 223
224 .hints {
225 margin-top: 5px;
226 background-color: #A0FFA0;
227 padding: 5px;
228 border-radius: 4px 4px 4px 4px;
229 border: 1px solid #cccccc;
230 line-height: 120%;
231 font-size: 9pt;
232 display: table;
233 }
234 .hints ul { list-style-type: none; }
235 .hints ul li { }
236 .hints ul li a { }
237
238
239 .bug {
240 margin-top: 5px;
241 }
242 .bug_body {
243 margin-left: 5px;
244 background-color: #A0FFA0;
245 padding: 5px;
246 border-radius: 4px 4px 4px 4px;
247 border: 1px solid #cccccc;
248 line-height: 120%;
249 display: table;
250 }
251
File samples/config.php changed (mode: 100644) (index ededa97..733af1a)
... ... $rg_keys_file = $rg_base . "/.ssh/authorized_keys";
18 18 $rg_scripts = "/usr/share/rocketgit"; $rg_scripts = "/usr/share/rocketgit";
19 19
20 20 // Allowed repo names (regular expression) // Allowed repo names (regular expression)
21 $rg_repo_allow = '/^[A-Za-z0-9_.-]*$/';
21 $rg_repo_allow = '/^[\pL\pN\pP]*$/uU';
22 22
23 23 // Allowed repo name length // Allowed repo name length
24 24 $rg_repo_min_len = 2; $rg_repo_min_len = 2;
25 25 $rg_repo_max_len = 64; $rg_repo_max_len = 64;
26 26
27 // Allowed user names (regular expression)
28 $rg_user_allow = '/^[A-Za-z0-9_.-]*$/';
27 // Allowed user names (negated regular expression)
28 $rg_user_allow = '/^[\pL\pN\pP]*$/uU';
29 29
30 30 // Allowed user name length // Allowed user name length
31 31 $rg_user_min_len = 3; $rg_user_min_len = 3;
 
... ... $rg_theme = "default";
64 64 // Default language // Default language
65 65 $rg_lang = "en"; $rg_lang = "en";
66 66
67 // SSH port
67 // SSH host - leave empty to autodetect
68 $rg_ssh_host = "x.company.tld";
69 // SSH port - put 0 to disable
68 70 $rg_ssh_port = 22; $rg_ssh_port = 22;
69 71
70 // Git port
72 // Git port - put 0 to disable
71 73 $rg_git_port = 9418; $rg_git_port = 9418;
72 74
73 75 ?> ?>
File scripts/cron.php changed (mode: 100644) (index eb2f1c6..5ec0184)
... ... $now = time();
8 8 require_once("/etc/rocketgit/config.php"); require_once("/etc/rocketgit/config.php");
9 9
10 10 $INC = dirname(__FILE__) . "/../inc"; $INC = dirname(__FILE__) . "/../inc";
11 require_once($INC . "/init.inc.php");
11 12 require_once($INC . "/log.inc.php"); require_once($INC . "/log.inc.php");
12 13 require_once($INC . "/sql.inc.php"); require_once($INC . "/sql.inc.php");
13 14 require_once($INC . "/struct.inc.php"); require_once($INC . "/struct.inc.php");
File scripts/q.php changed (mode: 100644) (index 021ff62..92e7925)
... ... $_s = microtime(TRUE);
10 10 require_once("/etc/rocketgit/config.php"); require_once("/etc/rocketgit/config.php");
11 11
12 12 $INC = dirname(__FILE__) . "/../inc"; $INC = dirname(__FILE__) . "/../inc";
13 require_once($INC . "/init.inc.php");
13 14 require_once($INC . "/log.inc.php"); require_once($INC . "/log.inc.php");
14 15 require_once($INC . "/sql.inc.php"); require_once($INC . "/sql.inc.php");
15 16 require_once($INC . "/struct.inc.php"); require_once($INC . "/struct.inc.php");
 
... ... while (TRUE) {
84 85 if ($row['master'] == 0) { if ($row['master'] == 0) {
85 86 $r = rg_git_init($dst); $r = rg_git_init($dst);
86 87 if ($r === FALSE) { if ($r === FALSE) {
87 rg_log("\tCannot init master!");
88 rg_log("\tCannot init master (" . rg_git_error() . ")!");
88 89 continue; continue;
89 90 } }
90 91
 
... ... while (TRUE) {
93 94 $rr = array("repo_id" => $row['master']); $rr = array("repo_id" => $row['master']);
94 95 $mi = rg_repo_info($db, $rr); $mi = rg_repo_info($db, $rr);
95 96 if ($mi['exists'] != 1) { if ($mi['exists'] != 1) {
96 rg_log("\tCannot find master!");
97 rg_log("\tCannot find master (" . rg_repo_error() . ")!");
97 98 continue; continue;
98 99 } }
99 100
100 101 $ui = rg_user_info($db, $mi['uid'], "", ""); $ui = rg_user_info($db, $mi['uid'], "", "");
101 102 if ($ui['ok'] != 1) { if ($ui['ok'] != 1) {
102 103 rg_log("\tCannot lookup uid " rg_log("\tCannot lookup uid "
103 . $mi['uid'] . " (" . rg_user_info() . ")!");
104 . $mi['uid'] . " (" . rg_user_error() . ")!");
104 105 continue; continue;
105 106 } }
106 107
 
... ... while (TRUE) {
111 112 $src = rg_repo_name2base($rr) . $mi['name'] . ".git"; $src = rg_repo_name2base($rr) . $mi['name'] . ".git";
112 113 $r = rg_git_clone($src, $dst); $r = rg_git_clone($src, $dst);
113 114 if ($r === FALSE) { if ($r === FALSE) {
114 rg_log("\tCould not create repo!");
115 rg_log("\tCould not create repo (" . rg_git_error() . ")!");
115 116 continue; continue;
116 117 } }
117 118
File scripts/remote.php changed (mode: 100644) (index c0ae1ea..78e4c5f)
... ... ini_set("track_errors", "On");
6 6 require_once("/etc/rocketgit/config.php"); require_once("/etc/rocketgit/config.php");
7 7
8 8 $INC = dirname(__FILE__) . "/../inc"; $INC = dirname(__FILE__) . "/../inc";
9 require_once($INC . "/init.inc.php");
9 10 require_once($INC . "/util.inc.php"); require_once($INC . "/util.inc.php");
10 11 require_once($INC . "/log.inc.php"); require_once($INC . "/log.inc.php");
11 12 require_once($INC . "/sql.inc.php"); require_once($INC . "/sql.inc.php");
File tests/Makefile changed (mode: 100644) (index e5d6bc2..a225ac1)
1 tests := util db keys repo rights state user git prof hook_update hook_update_anon bug
1 tests := util db keys repo rights state user git prof bug log \
2 hook_update hook_update_anon bug
2 3 .PHONY: $(tests) .PHONY: $(tests)
3 4
4 5 all: $(tests) all: $(tests)
 
... ... prof:
33 34 bug: bug:
34 35 php bug.php php bug.php
35 36
37 log:
38 php log.php
39
36 40 hook_update: hook_update:
37 41 ./hook_update.sh ./hook_update.sh
38 42
File tests/bug.php changed (mode: 100644) (index 0942697..cb7de83)
... ... error_reporting(E_ALL | E_STRICT);
3 3 ini_set("track_errors", "On"); ini_set("track_errors", "On");
4 4
5 5 $INC = "../inc"; $INC = "../inc";
6 require_once($INC . "/init.inc.php");
6 7 require_once($INC . "/bug.inc.php"); require_once($INC . "/bug.inc.php");
7 8 require_once($INC . "/sql.inc.php"); require_once($INC . "/sql.inc.php");
8 9 require_once($INC . "/struct.inc.php"); require_once($INC . "/struct.inc.php");
File tests/git.php changed (mode: 100644) (index 0cd4299..22cf8aa)
... ... error_reporting(E_ALL | E_STRICT);
3 3 ini_set("track_errors", "On"); ini_set("track_errors", "On");
4 4
5 5 $INC = "../inc"; $INC = "../inc";
6 require_once($INC . "/init.inc.php");
6 7 require_once($INC . "/git.inc.php"); require_once($INC . "/git.inc.php");
7 8
8 9 rg_log_set_file("git.log"); rg_log_set_file("git.log");
File tests/git2.php changed (mode: 100644) (index eaf6ce8..10b0780)
... ... error_reporting(E_ALL | E_STRICT);
3 3 ini_set("track_errors", "On"); ini_set("track_errors", "On");
4 4
5 5 $INC = "../inc"; $INC = "../inc";
6 require_once($INC . "/init.inc.php");
6 7 require_once($INC . "/git.inc.php"); require_once($INC . "/git.inc.php");
7 8
8 9 rg_log_set_file("git2.log"); rg_log_set_file("git2.log");
File tests/keys.php changed (mode: 100644) (index 9a8605f..d1878bd)
... ... error_reporting(E_ALL | E_STRICT);
3 3 ini_set("track_errors", "On"); ini_set("track_errors", "On");
4 4
5 5 $INC = "../inc"; $INC = "../inc";
6 require_once($INC . "/init.inc.php");
6 7 require_once($INC . "/util.inc.php"); require_once($INC . "/util.inc.php");
7 8 require_once($INC . "/keys.inc.php"); require_once($INC . "/keys.inc.php");
8 9 require_once($INC . "/sql.inc.php"); require_once($INC . "/sql.inc.php");
File tests/log.php added (mode: 100644) (index 0000000..192a08b)
1 <?php
2 error_reporting(E_ALL | E_STRICT);
3 ini_set("track_errors", "On");
4
5 $INC = "../inc";
6 require_once($INC . "/init.inc.php");
7 require_once($INC . "/util.inc.php");
8 require_once($INC . "/log.inc.php");
9
10 rg_log_set_file("log.log");
11
12 $rg_scripts = ".";
13 $rg_theme = "util";
14
15 $n = "șacal\n\t";
16 rg_log($n);
17
18 rg_log_ml("Multiline test\nline2\nline3");
19
20 ?>
File tests/prof.php changed (mode: 100644) (index 06e77c0..dfccd18)
... ... error_reporting(E_ALL | E_STRICT);
3 3 ini_set("track_errors", "On"); ini_set("track_errors", "On");
4 4
5 5 $INC = "../inc"; $INC = "../inc";
6 require_once($INC . "/init.inc.php");
6 7 require_once($INC . "/util.inc.php"); require_once($INC . "/util.inc.php");
7 8 require_once($INC . "/log.inc.php"); require_once($INC . "/log.inc.php");
8 9 require_once($INC . "/prof.inc.php"); require_once($INC . "/prof.inc.php");
File tests/repo.php changed (mode: 100644) (index 9c1f318..07ab152)
... ... error_reporting(E_ALL | E_STRICT);
3 3 ini_set("track_errors", "On"); ini_set("track_errors", "On");
4 4
5 5 $INC = "../inc"; $INC = "../inc";
6 require_once($INC . "/init.inc.php");
6 7 require_once($INC . "/repo.inc.php"); require_once($INC . "/repo.inc.php");
7 8 require_once($INC . "/sql.inc.php"); require_once($INC . "/sql.inc.php");
8 9 require_once($INC . "/struct.inc.php"); require_once($INC . "/struct.inc.php");
File tests/rights.php changed (mode: 100644) (index ed9fa58..2863c50)
... ... error_reporting(E_ALL | E_STRICT);
3 3 ini_set("track_errors", "On"); ini_set("track_errors", "On");
4 4
5 5 $INC = "../inc"; $INC = "../inc";
6 require_once($INC . "/init.inc.php");
6 7 require_once($INC . "/rights.inc.php"); require_once($INC . "/rights.inc.php");
7 8
8 9 rg_log_set_file("rights.log"); rg_log_set_file("rights.log");
File tests/sql.php changed (mode: 100644) (index 25ee6b4..d6e99ad)
... ... error_reporting(E_ALL | E_STRICT);
3 3 ini_set("track_errors", "On"); ini_set("track_errors", "On");
4 4
5 5 $INC = "../inc"; $INC = "../inc";
6 require_once($INC . "/init.inc.php");
6 7 require_once($INC . "/log.inc.php"); require_once($INC . "/log.inc.php");
7 8 require_once($INC . "/sql.inc.php"); require_once($INC . "/sql.inc.php");
8 9
File tests/state.php changed (mode: 100644) (index 8d88961..867926e)
... ... error_reporting(E_ALL | E_STRICT);
3 3 ini_set("track_errors", "On"); ini_set("track_errors", "On");
4 4
5 5 $INC = "../inc"; $INC = "../inc";
6 require_once($INC . "/init.inc.php");
6 7 require_once($INC . "/log.inc.php"); require_once($INC . "/log.inc.php");
7 8 require_once($INC . "/sql.inc.php"); require_once($INC . "/sql.inc.php");
8 9 require_once($INC . "/struct.inc.php"); require_once($INC . "/struct.inc.php");
File tests/user.php changed (mode: 100644) (index 023f968..20b84b8)
... ... error_reporting(E_ALL | E_STRICT);
3 3 ini_set("track_errors", "On"); ini_set("track_errors", "On");
4 4
5 5 $INC = "../inc"; $INC = "../inc";
6 require_once($INC . "/init.inc.php");
6 7 require_once($INC . "/user.inc.php"); require_once($INC . "/user.inc.php");
7 8 require_once($INC . "/sql.inc.php"); require_once($INC . "/sql.inc.php");
8 9 require_once($INC . "/struct.inc.php"); require_once($INC . "/struct.inc.php");
File tests/util.php changed (mode: 100644) (index 0c617f2..e3b7ff7)
... ... error_reporting(E_ALL | E_STRICT);
3 3 ini_set("track_errors", "On"); ini_set("track_errors", "On");
4 4
5 5 $INC = "../inc"; $INC = "../inc";
6 require_once($INC . "/init.inc.php");
6 7 require_once($INC . "/util.inc.php"); require_once($INC . "/util.inc.php");
7 8 require_once($INC . "/log.inc.php"); require_once($INC . "/log.inc.php");
8 9
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