File inc/admin/users/user.form.php changed (mode: 100644) (index c6a7746..cbb4eb9) |
1 |
1 |
<?php |
<?php |
2 |
2 |
$_form = '<div class="formarea">' . "\n"; |
$_form = '<div class="formarea">' . "\n"; |
3 |
3 |
|
|
|
4 |
|
$_form .= "<div class=\"formarea_title\">Change user details</div><br />\n"; |
|
5 |
|
|
4 |
6 |
if ($admin_mode == 1) { |
if ($admin_mode == 1) { |
5 |
7 |
$sel_is_admin = array(0 => "", 1 => ""); |
$sel_is_admin = array(0 => "", 1 => ""); |
6 |
8 |
$sel_is_admin[$is_admin] = " selected=\"selected\""; |
$sel_is_admin[$is_admin] = " selected=\"selected\""; |
|
... |
... |
if (count($errmsg) > 0) |
10 |
12 |
$_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n"; |
$_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n"; |
11 |
13 |
|
|
12 |
14 |
$_form .= ' |
$_form .= ' |
13 |
|
<form method="post" action="' . rg_re_post($op) . '"> |
|
14 |
|
<input type="hidden" name="op" value="' . $op . '" /> |
|
15 |
|
<input type="hidden" name="subop" value="' . $subop . '" /> |
|
16 |
|
<input type="hidden" name="subsubop" value="' . $subsubop . '" /> |
|
|
15 |
|
<form method="post" action="' . rg_re_post($cop) . '"> |
17 |
16 |
<input type="hidden" name="doit" value="1" /> |
<input type="hidden" name="doit" value="1" /> |
18 |
17 |
<input type="hidden" name="token" value="' . rg_token_get($db, $sid) . '" /> |
<input type="hidden" name="token" value="' . rg_token_get($db, $sid) . '" /> |
19 |
|
<input type="hidden" name="uid" value="' . $uid . '" /> |
|
|
18 |
|
'; |
20 |
19 |
|
|
|
20 |
|
if ($admin_mode == 1) |
|
21 |
|
$_form .= '<input type="hidden" name="uid" value="' . $uid . '" />'; |
|
22 |
|
|
|
23 |
|
$_form .= ' |
21 |
24 |
<label for="xuser"> |
<label for="xuser"> |
22 |
25 |
<span class="form_item_title">User name</span><br /> |
<span class="form_item_title">User name</span><br /> |
23 |
26 |
<input type="text" name="xuser" value="' . $xuser . '" /> |
<input type="text" name="xuser" value="' . $xuser . '" /> |
File inc/feedback/suggestion.form.php changed (mode: 100644) (index 9b9cc30..54c65d0) |
1 |
1 |
<?php |
<?php |
2 |
2 |
$_form = '<div class="formarea">' . "\n"; |
$_form = '<div class="formarea">' . "\n"; |
3 |
3 |
|
|
|
4 |
|
$_form .= '<div class="formarea_title">Send a suggestion</div><br />' . "\n"; |
|
5 |
|
|
4 |
6 |
if (count($errmsg) > 0) |
if (count($errmsg) > 0) |
5 |
7 |
$_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n"; |
$_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n"; |
6 |
8 |
|
|
7 |
9 |
$_form .= ' |
$_form .= ' |
8 |
|
<form method="post" action="' . rg_re_post("suggestion") . '"> |
|
9 |
|
<input type="hidden" name="op" value="suggestion" /> |
|
|
10 |
|
<form method="post" action="' . rg_re_post($cop) . '"> |
10 |
11 |
<input type="hidden" name="doit" value="1" /> |
<input type="hidden" name="doit" value="1" /> |
11 |
12 |
<input type="hidden" name="token" value="' . rg_token_get($db, $sid) . '" /> |
<input type="hidden" name="token" value="' . rg_token_get($db, $sid) . '" /> |
12 |
13 |
|
|
File inc/git.inc.php changed (mode: 100644) (index 5abc8db..4c7d1d2) |
... |
... |
function rg_git_diff2array($diff) |
336 |
336 |
continue; |
continue; |
337 |
337 |
} |
} |
338 |
338 |
|
|
|
339 |
|
// Ignore, for now, "\ No newline at end of file" (TODO) |
|
340 |
|
if (strncmp($line, "\\", 1) == 0) { |
|
341 |
|
rg_log("\tINFO: warn line: [$line]."); |
|
342 |
|
continue; |
|
343 |
|
} |
|
344 |
|
|
339 |
345 |
if (empty($line)) { |
if (empty($line)) { |
340 |
346 |
rg_log("\tWARN: empty line [$line]!"); |
rg_log("\tWARN: empty line [$line]!"); |
341 |
347 |
continue; |
continue; |
|
... |
... |
function rg_git_log_template($log, $template_dir, $more) |
457 |
463 |
{ |
{ |
458 |
464 |
$t = array(); |
$t = array(); |
459 |
465 |
|
|
460 |
|
foreach ($log as $index => $info) { |
|
461 |
|
$v = array(); |
|
462 |
|
foreach ($info['vars'] as $var => $value) |
|
463 |
|
$v[$var] = $value; |
|
464 |
|
$t[] = $v; |
|
|
466 |
|
if (count($log) > 0) { |
|
467 |
|
foreach ($log as $index => $info) { |
|
468 |
|
$v = array(); |
|
469 |
|
foreach ($info['vars'] as $var => $value) |
|
470 |
|
$v[$var] = $value; |
|
471 |
|
$t[] = $v; |
|
472 |
|
} |
465 |
473 |
} |
} |
466 |
474 |
|
|
467 |
475 |
return rg_template_table($template_dir, $t, $more); |
return rg_template_table($template_dir, $t, $more); |
File inc/login/login.form.php changed (mode: 100644) (index 54e9d96..bed284e) |
... |
... |
if (count($errmsg) > 0) |
5 |
5 |
$_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n"; |
$_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n"; |
6 |
6 |
|
|
7 |
7 |
$_form .= ' |
$_form .= ' |
8 |
|
<form method="post" action="' . rg_re_post($op) . '"> |
|
9 |
|
<input type="hidden" name="op" value="' . $op . '" /> |
|
|
8 |
|
<form method="post" action="' . rg_re_post($cop) . '"> |
10 |
9 |
<input type="hidden" name="subop" value="1" /> |
<input type="hidden" name="subop" value="1" /> |
11 |
10 |
<input type="hidden" name="doit" value="1" /> |
<input type="hidden" name="doit" value="1" /> |
12 |
11 |
|
|
|
... |
... |
$_form .= ' |
30 |
29 |
</form> |
</form> |
31 |
30 |
<br /> |
<br /> |
32 |
31 |
|
|
33 |
|
<a href="' . rg_re_url("forgot_send") . '">Forgot your password?</a> |
|
|
32 |
|
<a href="' . rg_re_url("/op/forgot_send") . '">Forgot your password?</a> |
34 |
33 |
'; |
'; |
35 |
34 |
|
|
36 |
35 |
if ($rg_account_allow_creation == 1) { |
if ($rg_account_allow_creation == 1) { |
37 |
36 |
$_form .= ' |
$_form .= ' |
38 |
37 |
<br /> |
<br /> |
39 |
|
<a href="' . rg_re_url("create_account") . '">Create a new account</a> |
|
|
38 |
|
<a href="' . rg_re_url("/op/create_account") . '">Create a new account</a> |
40 |
39 |
'; |
'; |
41 |
40 |
} |
} |
42 |
41 |
|
|
File inc/prof.inc.php added (mode: 100644) (index 0000000..a4e8d77) |
|
1 |
|
<?php |
|
2 |
|
// Profiling functions |
|
3 |
|
|
|
4 |
|
$rg_prof_main = array(); |
|
5 |
|
$rg_prof_start = array(); |
|
6 |
|
|
|
7 |
|
function rg_prof_start($label) |
|
8 |
|
{ |
|
9 |
|
global $rg_prof_tmp; |
|
10 |
|
global $rg_prof_state; |
|
11 |
|
|
|
12 |
|
if (isset($rg_prof_tmp[$label])) |
|
13 |
|
return; |
|
14 |
|
|
|
15 |
|
$rg_prof_tmp[$label] = $rg_prof_state; |
|
16 |
|
$rg_prof_tmp[$label]['_ts'] = microtime(TRUE); |
|
17 |
|
} |
|
18 |
|
|
|
19 |
|
function rg_prof_end($label) |
|
20 |
|
{ |
|
21 |
|
global $rg_prof_tmp; |
|
22 |
|
global $rg_prof_state; |
|
23 |
|
global $rg_prof_main; |
|
24 |
|
|
|
25 |
|
if (!isset($rg_prof_tmp[$label])) |
|
26 |
|
return; |
|
27 |
|
|
|
28 |
|
$c = $rg_prof_state; |
|
29 |
|
$c['time'] = microtime(TRUE) - $rg_prof_tmp[$label]['_ts']; unset($c['_ts']); |
|
30 |
|
$c['runs'] = 1; |
|
31 |
|
|
|
32 |
|
foreach ($rg_prof_tmp[$label] as $key => $val) |
|
33 |
|
$c[$key] -= $val; |
|
34 |
|
|
|
35 |
|
// add to main label |
|
36 |
|
if (!isset($rg_prof_main[$label])) { |
|
37 |
|
$rg_prof_main[$label] = $c; |
|
38 |
|
} else { |
|
39 |
|
foreach ($c as $key => $val) |
|
40 |
|
$rg_prof_main[$label][$key] += $val; |
|
41 |
|
} |
|
42 |
|
|
|
43 |
|
unset($rg_state_tmp[$label]); |
|
44 |
|
} |
|
45 |
|
|
|
46 |
|
function rg_prof_get() |
|
47 |
|
{ |
|
48 |
|
global $rg_prof_main; |
|
49 |
|
|
|
50 |
|
return $rg_prof_main; |
|
51 |
|
} |
|
52 |
|
|
|
53 |
|
function rg_prof_get_total() |
|
54 |
|
{ |
|
55 |
|
global $rg_prof_main; |
|
56 |
|
|
|
57 |
|
$t = array(); |
|
58 |
|
|
|
59 |
|
$ret = ""; |
|
60 |
|
foreach ($rg_prof_main as $label => $per_label) { |
|
61 |
|
foreach ($per_label as $k => $v) { |
|
62 |
|
if ($isset($t[$k])) |
|
63 |
|
$t[$k] = $v; |
|
64 |
|
else |
|
65 |
|
$t[$k] += $v; |
|
66 |
|
} |
|
67 |
|
} |
|
68 |
|
|
|
69 |
|
return $t; |
|
70 |
|
} |
|
71 |
|
|
|
72 |
|
?> |
File inc/repo/repo.form.php changed (mode: 100644) (index 706c462..9fd5d1c) |
... |
... |
if (count($errmsg) > 0) |
5 |
5 |
$_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n"; |
$_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n"; |
6 |
6 |
|
|
7 |
7 |
$_form .= ' |
$_form .= ' |
8 |
|
<form method="post" action="' . rg_re_post($op) . '/create"> |
|
9 |
|
<input type="hidden" name="op" value="' . $op . '" /> |
|
10 |
|
<input type="hidden" name="subop" value="' . $subop . '" /> |
|
|
8 |
|
<form method="post" action="' . rg_re_post($cop . "/create") . '"> |
11 |
9 |
<input type="hidden" name="repo_id" value="' . $repo_id . '" /> |
<input type="hidden" name="repo_id" value="' . $repo_id . '" /> |
12 |
10 |
<input type="hidden" name="master_repo_id" value="' . $master_repo_id . '" /> |
<input type="hidden" name="master_repo_id" value="' . $master_repo_id . '" /> |
13 |
11 |
<input type="hidden" name="doit" value="1" /> |
<input type="hidden" name="doit" value="1" /> |
File inc/repo/rights.form.php changed (mode: 100644) (index c533c4d..a1889d2) |
... |
... |
$_form = '<div class="formarea">' . "\n"; |
4 |
4 |
if (count($errmsg) > 0) |
if (count($errmsg) > 0) |
5 |
5 |
$_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n"; |
$_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n"; |
6 |
6 |
|
|
7 |
|
<form method="post" action="' . rg_re_post($op) . '"> |
|
8 |
|
<input type="hidden" name="op" value="' . $op . '" /> |
|
9 |
|
<input type="hidden" name="subop" value="' . $subop . '" /> |
|
|
7 |
|
<form method="post" action="' . rg_re_post($cop) . '"> |
10 |
8 |
<input type="hidden" name="repo_id" value="' . $repo_id . '" /> |
<input type="hidden" name="repo_id" value="' . $repo_id . '" /> |
11 |
9 |
<input type="hidden" name="doit" value="1" /> |
<input type="hidden" name="doit" value="1" /> |
12 |
10 |
<input type="hidden" name="token" value="' . rg_token_get($db, $sid) . '" /> |
<input type="hidden" name="token" value="' . rg_token_get($db, $sid) . '" /> |
File inc/user.inc.php changed (mode: 100644) (index acbb613..b790b48) |
... |
... |
function rg_user_login_by_sid($db, $sid, &$rg_ui) |
237 |
237 |
$rg_ui = array(); |
$rg_ui = array(); |
238 |
238 |
$rg_ui['uid'] = 0; |
$rg_ui['uid'] = 0; |
239 |
239 |
$rg_ui['is_admin'] = 0; |
$rg_ui['is_admin'] = 0; |
|
240 |
|
$rg_ui['organization'] = 0; |
|
241 |
|
$rg_ui['username'] = ""; |
240 |
242 |
|
|
241 |
|
if (empty($sid)) |
|
|
243 |
|
if (empty($sid)) { |
|
244 |
|
rg_log("\tNo sid!"); |
242 |
245 |
return FALSE; |
return FALSE; |
|
246 |
|
} |
243 |
247 |
|
|
244 |
248 |
$uid = rg_sess_valid($db, $sid); |
$uid = rg_sess_valid($db, $sid); |
245 |
249 |
if ($uid == 0) |
if ($uid == 0) |
|
... |
... |
function rg_user_login_by_sid($db, $sid, &$rg_ui) |
247 |
251 |
|
|
248 |
252 |
$rg_ui = rg_user_info($db, $uid, "", ""); |
$rg_ui = rg_user_info($db, $uid, "", ""); |
249 |
253 |
if ($rg_ui['exists'] != 1) { |
if ($rg_ui['exists'] != 1) { |
|
254 |
|
rg_log("\tUid $uid does not exists (" . rg_user_error() . ")!"); |
250 |
255 |
rg_user_set_error("invalid uid"); |
rg_user_set_error("invalid uid"); |
251 |
256 |
return FALSE; |
return FALSE; |
252 |
257 |
} |
} |
|
... |
... |
function rg_user_forgot_pass_mail($db, $email) |
627 |
632 |
. "If you want to reset the password, follow:\n" |
. "If you want to reset the password, follow:\n" |
628 |
633 |
. (@strcmp($_SERVER['HTTPS'], "on") == 0 ? "https://" : "http://") |
. (@strcmp($_SERVER['HTTPS'], "on") == 0 ? "https://" : "http://") |
629 |
634 |
. @$_SERVER['HTTP_HOST'] |
. @$_SERVER['HTTP_HOST'] |
630 |
|
. rg_re_url("forgot_link") . "&forgot_token=$forgot_token", |
|
|
635 |
|
. rg_re_url("/op/forgot_link") . "&forgot_token=$forgot_token", |
631 |
636 |
$headers, |
$headers, |
632 |
637 |
"-f $rg_admin_email")) { |
"-f $rg_admin_email")) { |
633 |
638 |
rg_user_set_error("Cannot send mail ($php_errormsg)!"); |
rg_user_set_error("Cannot send mail ($php_errormsg)!"); |
|
... |
... |
function rg_user_confirm_send($email, $token) |
693 |
698 |
. "Please confirm your account creation following:\n" |
. "Please confirm your account creation following:\n" |
694 |
699 |
. (@strcmp($_SERVER['HTTPS'], "on") == 0 ? "https://" : "http://") |
. (@strcmp($_SERVER['HTTPS'], "on") == 0 ? "https://" : "http://") |
695 |
700 |
. @$_SERVER['HTTP_HOST'] |
. @$_SERVER['HTTP_HOST'] |
696 |
|
. rg_re_url("confirm") . "&token=$token", |
|
|
701 |
|
. rg_re_url("/op/confirm") . "&token=$token", |
697 |
702 |
$headers, |
$headers, |
698 |
703 |
"-f $rg_admin_email")) { |
"-f $rg_admin_email")) { |
699 |
704 |
rg_user_set_error("Cannot send mail ($php_errormsg)!"); |
rg_user_set_error("Cannot send mail ($php_errormsg)!"); |
File inc/user/keys/add.form.php changed (mode: 100644) (index 83d74f7..c270760) |
1 |
1 |
<?php |
<?php |
|
2 |
|
// TODO: Do not pass op anymore in a hidden input field! |
2 |
3 |
$_form = '<div class="formarea">' . "\n"; |
$_form = '<div class="formarea">' . "\n"; |
3 |
4 |
|
|
|
5 |
|
$_form .= "<div class=\"formarea_title\">Add a new ssh key</div><br />\n"; |
|
6 |
|
|
4 |
7 |
if (count($errmsg) > 0) |
if (count($errmsg) > 0) |
5 |
8 |
$_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n"; |
$_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n"; |
6 |
9 |
|
|
7 |
10 |
$_form .= ' |
$_form .= ' |
8 |
|
<form method="post" action="' . rg_re_post($op) . '"> |
|
9 |
|
<input type="hidden" name="op" value="' . $op . '" /> |
|
10 |
|
<input type="hidden" name="subop" value="' . $subop . '" /> |
|
|
11 |
|
<form method="post" action="' . rg_re_post($cop) . '"> |
11 |
12 |
<input type="hidden" name="add" value="1" /> |
<input type="hidden" name="add" value="1" /> |
12 |
13 |
<input type="hidden" name="token" value="' . rg_token_get($db, $sid) . '" /> |
<input type="hidden" name="token" value="' . rg_token_get($db, $sid) . '" /> |
13 |
14 |
|
|
14 |
|
<label for="key"> |
|
15 |
|
<span class="form_item_title">Add key (starts with ssh-...)</span><br /> |
|
|
15 |
|
<label for="key">Key string (starts with ssh-...)</label><br /> |
16 |
16 |
<textarea name="key" value="' . $key . '" rows="4" cols="50"></textarea> |
<textarea name="key" value="' . $key . '" rows="4" cols="50"></textarea> |
17 |
|
</label> |
|
18 |
17 |
<br /> |
<br /> |
19 |
18 |
<br /> |
<br /> |
20 |
19 |
|
|
File inc/user/pass/pass.form.php changed (mode: 100644) (index 5cadb84..7fa0b75) |
1 |
1 |
<?php |
<?php |
2 |
2 |
$_chpass_form = '<div class="formarea">' . "\n"; |
$_chpass_form = '<div class="formarea">' . "\n"; |
3 |
3 |
|
|
|
4 |
|
$_chpass_form .= '<div class="formarea_title">Change password</div><br />' . "\n"; |
|
5 |
|
|
4 |
6 |
if (count($errmsg) > 0) |
if (count($errmsg) > 0) |
5 |
7 |
$_chpass_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n"; |
$_chpass_form .= '<span class="error">' . implode("<br />\n", $errmsg) . '</span><br /><br />' . "\n"; |
6 |
8 |
|
|
7 |
9 |
$_chpass_form .= ' |
$_chpass_form .= ' |
8 |
|
<form method="post" action="' . rg_re_post($op) . '"> |
|
9 |
|
<input type="hidden" name="op" value="' . $op . '" /> |
|
|
10 |
|
<form method="post" action="' . rg_re_post($cop) . '"> |
10 |
11 |
<input type="hidden" name="doit" value="1" /> |
<input type="hidden" name="doit" value="1" /> |
11 |
12 |
<input type="hidden" name="token" value="' . rg_token_get($db, $sid) . '" /> |
<input type="hidden" name="token" value="' . rg_token_get($db, $sid) . '" /> |
12 |
13 |
|
|
File inc/user/repo-page.php changed (mode: 100644) (index d51e8a9..fbc178d) |
... |
... |
if (strcmp($subop, "tree") == 0) { |
46 |
46 |
$_home .= rg_template($THEME . "/repo/blob.html", $blob, $_more); |
$_home .= rg_template($THEME . "/repo/blob.html", $blob, $_more); |
47 |
47 |
} else { // log |
} else { // log |
48 |
48 |
if (empty($paras[0])) { |
if (empty($paras[0])) { |
|
49 |
|
rg_log("Show full log"); |
49 |
50 |
$log = rg_git_log(10, "", "", FALSE); |
$log = rg_git_log(10, "", "", FALSE); |
50 |
51 |
rg_log("log: " . print_r($log, TRUE)); |
rg_log("log: " . print_r($log, TRUE)); |
51 |
52 |
$_home .= rg_git_log_template($log, $THEME . "/repo/log", $_more); |
$_home .= rg_git_log_template($log, $THEME . "/repo/log", $_more); |
52 |
53 |
} else { |
} else { |
53 |
54 |
$commit = rg_git_reference($paras[0]); |
$commit = rg_git_reference($paras[0]); |
|
55 |
|
rg_log("Show diff for commit [$commit]"); |
54 |
56 |
|
|
55 |
57 |
$log = rg_git_log(1, $commit . "~1", $commit, TRUE); |
$log = rg_git_log(1, $commit . "~1", $commit, TRUE); |
56 |
58 |
rg_log("log: " . print_r($log, TRUE)); |
rg_log("log: " . print_r($log, TRUE)); |
File inc/util.inc.php changed (mode: 100644) (index 2d8512d..469a8cd) |
... |
... |
function rg_load() |
74 |
74 |
/* |
/* |
75 |
75 |
* Builds URLs |
* Builds URLs |
76 |
76 |
*/ |
*/ |
77 |
|
function rg_re_url($op) |
|
|
77 |
|
function rg_re_url($area) |
78 |
78 |
{ |
{ |
79 |
79 |
if (isset($_REQUEST['rwe'])) |
if (isset($_REQUEST['rwe'])) |
80 |
|
return "/op/" . $op; |
|
|
80 |
|
return $area; |
81 |
81 |
|
|
82 |
|
return "/?op=" . $op; |
|
|
82 |
|
return "/?vv=" . $area; |
83 |
83 |
} |
} |
84 |
84 |
|
|
85 |
85 |
/* |
/* |
|
... |
... |
function rg_re_url($op) |
88 |
88 |
function rg_re_post($op) |
function rg_re_post($op) |
89 |
89 |
{ |
{ |
90 |
90 |
if (isset($_REQUEST['rwe'])) |
if (isset($_REQUEST['rwe'])) |
91 |
|
return "/op/" . $op; |
|
|
91 |
|
return $op; |
92 |
92 |
|
|
93 |
|
return "/"; |
|
|
93 |
|
return "/?vv=$op"; |
|
94 |
|
} |
|
95 |
|
|
|
96 |
|
function rg_re_userpage($rr) |
|
97 |
|
{ |
|
98 |
|
if (strcmp($rr['type'], "user") == 0) |
|
99 |
|
$prefix = "/user"; |
|
100 |
|
else |
|
101 |
|
$prefix = ""; |
|
102 |
|
|
|
103 |
|
$s = $prefix . "/" . $rr['user']; |
|
104 |
|
|
|
105 |
|
if (isset($_REQUEST['rwe'])) |
|
106 |
|
return $s; |
|
107 |
|
|
|
108 |
|
return $_SERVER['PHP_SELF'] . "?vv=$s"; |
94 |
109 |
} |
} |
95 |
110 |
|
|
96 |
111 |
function rg_re_repopage($rr) |
function rg_re_repopage($rr) |
|
... |
... |
function rg_menu($a, $rg_ui) |
196 |
211 |
$menu = "<div class=\"menu\">\n"; |
$menu = "<div class=\"menu\">\n"; |
197 |
212 |
$menu .= "\t<ul>\n"; |
$menu .= "\t<ul>\n"; |
198 |
213 |
$menu2 = ""; |
$menu2 = ""; |
199 |
|
foreach ($a as $_op => $_info) { |
|
|
214 |
|
foreach ($a as $_id => $_info) { |
200 |
215 |
// we ignore fake menus like 'home' |
// we ignore fake menus like 'home' |
201 |
216 |
if (!isset($_info['text'])) |
if (!isset($_info['text'])) |
202 |
217 |
continue; |
continue; |
|
... |
... |
function rg_menu($a, $rg_ui) |
211 |
226 |
continue; |
continue; |
212 |
227 |
|
|
213 |
228 |
$_text = $_info['text']; |
$_text = $_info['text']; |
214 |
|
$_url = rg_re_url($_op); |
|
|
229 |
|
$_url = rg_re_url($_info['op']); |
|
230 |
|
//$menu .= "<!-- op=" . $_info['op'] . " url=$_url." . " -->\n"; |
215 |
231 |
$menu .= "\t\t<li><a href=\"" . $_url . "\">$_text</a></li>\n"; |
$menu .= "\t\t<li><a href=\"" . $_url . "\">$_text</a></li>\n"; |
216 |
232 |
|
|
217 |
233 |
if (!isset($_info['sub']) || (count($_info['sub']) == 0)) |
if (!isset($_info['sub']) || (count($_info['sub']) == 0)) |
|
... |
... |
function rg_menu($a, $rg_ui) |
221 |
237 |
$menu2 .= "\t<ul>\n"; |
$menu2 .= "\t<ul>\n"; |
222 |
238 |
foreach ($_info['sub'] as $junk => $_info2) { |
foreach ($_info['sub'] as $junk => $_info2) { |
223 |
239 |
$_text2 = $_info2['text']; |
$_text2 = $_info2['text']; |
|
240 |
|
$_url2 = $_url . "/" . $_info2['op']; |
224 |
241 |
$menu2 .= "\t\t<li><a href=\"" |
$menu2 .= "\t\t<li><a href=\"" |
225 |
|
. $_url . $_info2['url'] |
|
|
242 |
|
. $_url2 |
226 |
243 |
. "\">$_text2</a></li>\n"; |
. "\">$_text2</a></li>\n"; |
227 |
244 |
} |
} |
228 |
245 |
$menu2 .= "\t</ul>\n"; |
$menu2 .= "\t</ul>\n"; |
|
... |
... |
function rg_template_table($dir, $data, $more) |
262 |
279 |
{ |
{ |
263 |
280 |
rg_log("template_table($dir)"); |
rg_log("template_table($dir)"); |
264 |
281 |
|
|
|
282 |
|
$m_what = array(); $m_values = array(); |
|
283 |
|
rg_prepare_replace($more, $m_what, $m_values); |
|
284 |
|
|
|
285 |
|
if (empty($data)) { |
|
286 |
|
$no_data = @file_get_contents($dir . "/nodata.html"); |
|
287 |
|
if ($no_data === FALSE) |
|
288 |
|
$no_data = ""; |
|
289 |
|
return preg_replace($m_what, $m_values, $no_data); |
|
290 |
|
} |
|
291 |
|
|
265 |
292 |
$head = @file_get_contents($dir . "/header.html"); |
$head = @file_get_contents($dir . "/header.html"); |
266 |
293 |
if ($head === FALSE) |
if ($head === FALSE) |
267 |
294 |
$head = ""; |
$head = ""; |
|
... |
... |
function rg_template_table($dir, $data, $more) |
274 |
301 |
if ($foot === FALSE) |
if ($foot === FALSE) |
275 |
302 |
$foot = ""; |
$foot = ""; |
276 |
303 |
|
|
277 |
|
$m_what = array(); $m_values = array(); |
|
278 |
|
rg_prepare_replace($more, $m_what, $m_values); |
|
279 |
|
|
|
280 |
304 |
$head = preg_replace($m_what, $m_values, $head); |
$head = preg_replace($m_what, $m_values, $head); |
281 |
305 |
$foot = preg_replace($m_what, $m_values, $foot); |
$foot = preg_replace($m_what, $m_values, $foot); |
282 |
306 |
|
|
File root/index.php changed (mode: 100644) (index e3d7565..e8d6d7f) |
... |
... |
include_once($INC . "/token.inc.php"); |
23 |
23 |
rg_log_set_file("/var/log/rocketgit-web/main.log"); |
rg_log_set_file("/var/log/rocketgit-web/main.log"); |
24 |
24 |
|
|
25 |
25 |
// Init variables |
// Init variables |
26 |
|
$op = ""; $subop = ""; $subsubop = ""; |
|
27 |
|
$type = ""; $user = ""; $repo = ""; |
|
|
26 |
|
$op = ""; $subop = ""; $subsubop = ""; $cop = ""; |
|
27 |
|
$type = ""; $prefix = ""; $user = ""; $repo = ""; |
28 |
28 |
$paras = array(); |
$paras = 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"); |
32 |
|
if (strncmp($vv, "/op/", 4) == 0) { // command |
|
33 |
|
$op = substr($vv, 4); |
|
34 |
|
$_t = explode("/", $op); |
|
|
32 |
|
if (strcmp($vv, "/") == 0) { // main page for site (not for user) |
|
33 |
|
$op = "main"; |
|
34 |
|
} else if (strncmp($vv, "/op/", 4) == 0) { // command |
|
35 |
|
$_t = substr($vv, 4); |
|
36 |
|
$_t = explode("/", $_t); |
35 |
37 |
$op = $_t[0]; |
$op = $_t[0]; |
36 |
38 |
if (isset($_t[1])) { |
if (isset($_t[1])) { |
37 |
39 |
$subop = $_t[1]; |
$subop = $_t[1]; |
|
... |
... |
if (strncmp($vv, "/op/", 4) == 0) { // command |
42 |
44 |
if (strncmp($vv, "/user/", 6) == 0) { |
if (strncmp($vv, "/user/", 6) == 0) { |
43 |
45 |
$vv = substr($vv, 6); |
$vv = substr($vv, 6); |
44 |
46 |
$type = "user"; |
$type = "user"; |
|
47 |
|
$prefix = "/user"; |
45 |
48 |
} else { |
} else { |
46 |
49 |
$type = "org"; |
$type = "org"; |
|
50 |
|
$prefix = ""; |
47 |
51 |
} |
} |
48 |
52 |
$_t = explode("/", $vv); |
$_t = explode("/", $vv); |
49 |
53 |
$user = $_t[0]; |
$user = $_t[0]; |
|
... |
... |
if (strncmp($vv, "/op/", 4) == 0) { // command |
65 |
69 |
$op = "home-page"; |
$op = "home-page"; |
66 |
70 |
} |
} |
67 |
71 |
} |
} |
68 |
|
$rr = array("type" => $type, "user" => $user,"repo" => $repo); |
|
|
72 |
|
$cop = rtrim("/op/" . $op . "/" . $subop . "/" . $subsubop, "/"); |
|
73 |
|
|
|
74 |
|
$rr = array( |
|
75 |
|
"type" => $type, |
|
76 |
|
"prefix" => $prefix, |
|
77 |
|
"user" => $user, |
|
78 |
|
"repo" => $repo); |
69 |
79 |
|
|
70 |
80 |
$doit = rg_var_uint("doit"); |
$doit = rg_var_uint("doit"); |
71 |
81 |
$sid = rg_var_re("sid", "/[^A-Za-z0-9]/"); |
$sid = rg_var_re("sid", "/[^A-Za-z0-9]/"); |
|
... |
... |
$token = rg_var_re("token", "/[^A-Za-z0-9]/"); |
74 |
84 |
rg_log("IP: " . @$_SERVER['REMOTE_ADDR']); |
rg_log("IP: " . @$_SERVER['REMOTE_ADDR']); |
75 |
85 |
rg_log("_REQUEST: " . trim(print_r($_REQUEST, TRUE))); |
rg_log("_REQUEST: " . trim(print_r($_REQUEST, TRUE))); |
76 |
86 |
rg_log("_COOKIE: " . trim(print_r($_COOKIE, TRUE))); |
rg_log("_COOKIE: " . trim(print_r($_COOKIE, TRUE))); |
77 |
|
rg_log("Start! op=$op/$subop/$subsubop, user=$user repo=$repo doit=$doit, sid=$sid..."); |
|
|
87 |
|
rg_log("Start! cop=[$cop] op=$op subop=$subop subsubop=$subsubop" |
|
88 |
|
. " user=$user repo=$repo" |
|
89 |
|
. " doit=$doit, sid=$sid..."); |
78 |
90 |
rg_log("paras: " . implode("|", $paras)); |
rg_log("paras: " . implode("|", $paras)); |
79 |
91 |
|
|
80 |
92 |
|
|
|
... |
... |
do { |
101 |
113 |
|
|
102 |
114 |
// menu |
// menu |
103 |
115 |
$first_menu = array( |
$first_menu = array( |
104 |
|
"login" => array("text" => "Login", "uid0" => 1), |
|
105 |
|
"home-page" => array("text" => "Personal"), |
|
106 |
|
"repo" => array("text" => "Repositories"), |
|
107 |
|
"admin" => array("text" => "Admin", "needs_admin" => 1), |
|
108 |
|
"suggestion"=> array("text" => "Suggestion"), |
|
109 |
|
"logout" => array("text" => "Logout") |
|
|
116 |
|
"login" => array( |
|
117 |
|
"text" => "Login", |
|
118 |
|
"uid0" => 1, |
|
119 |
|
"op" => "/op/login"), |
|
120 |
|
"home-page" => array( |
|
121 |
|
"text" => "Home", |
|
122 |
|
"op" => ($rg_ui['organization'] == 1) ? "/" : "/user/" . $rg_ui['username']), |
|
123 |
|
"personal" => array( |
|
124 |
|
"text" => "Personal", |
|
125 |
|
"op" => "/op/personal"), |
|
126 |
|
"repo" => array( |
|
127 |
|
"text" => "Repositories", |
|
128 |
|
"op" => "/op/repo"), |
|
129 |
|
"admin" => array( |
|
130 |
|
"text" => "Admin", |
|
131 |
|
"needs_admin" => 1, |
|
132 |
|
"op" => "/op/admin"), |
|
133 |
|
"suggestion"=> array( |
|
134 |
|
"text" => "Suggestion", |
|
135 |
|
"op" => "/op/suggestion"), |
|
136 |
|
"logout" => array( |
|
137 |
|
"text" => "Logout", |
|
138 |
|
"op" => "/op/logout") |
110 |
139 |
); |
); |
111 |
140 |
$first_menu[$op]['sub'] = $second_menu; |
$first_menu[$op]['sub'] = $second_menu; |
112 |
141 |
$menu = implode("", rg_menu($first_menu, $rg_ui)); |
$menu = implode("", rg_menu($first_menu, $rg_ui)); |
|
... |
... |
else |
119 |
148 |
$_diff = sprintf("%u", (microtime(TRUE) - $_s) * 1000); |
$_diff = sprintf("%u", (microtime(TRUE) - $_s) * 1000); |
120 |
149 |
include($THEME . "/index.php"); |
include($THEME . "/index.php"); |
121 |
150 |
|
|
122 |
|
$_diff = sprintf("%u", (microtime(TRUE) - $_s) * 1000); |
|
123 |
151 |
rg_log("Done in $_diff ms."); |
rg_log("Done in $_diff ms."); |
124 |
152 |
?> |
?> |
File root/themes/default/main.css changed (mode: 100644) (index b616e01..88c2437) |
4 |
4 |
} |
} |
5 |
5 |
|
|
6 |
6 |
body { |
body { |
7 |
|
font-family: Verdana, arial, helvetica, sans-serif; |
|
|
7 |
|
font-family: sans-serif; |
8 |
8 |
font-size: 10pt; |
font-size: 10pt; |
9 |
9 |
line-height: 100%; |
line-height: 100%; |
10 |
10 |
} |
} |
|
... |
... |
th, td { |
88 |
88 |
margin: 5px auto; |
margin: 5px auto; |
89 |
89 |
background-color: #dddddd; |
background-color: #dddddd; |
90 |
90 |
padding: 5px; |
padding: 5px; |
91 |
|
width: 400px; |
|
|
91 |
|
width: 800px; |
92 |
92 |
border-radius: 4px 4px 4px 4px; |
border-radius: 4px 4px 4px 4px; |
93 |
93 |
border: 1px solid #cccccc; |
border: 1px solid #cccccc; |
94 |
94 |
} |
} |
95 |
95 |
|
|
|
96 |
|
.formarea_title { |
|
97 |
|
font-weight: bold; |
|
98 |
|
font-size: 12pt; |
|
99 |
|
} |
|
100 |
|
|
96 |
101 |
#profiling { |
#profiling { |
97 |
102 |
border-top: 1px solid #000000; |
border-top: 1px solid #000000; |
98 |
103 |
background-color: #eeeeee; |
background-color: #eeeeee; |
|
... |
... |
th, td { |
107 |
112 |
|
|
108 |
113 |
.form_item_title { |
.form_item_title { |
109 |
114 |
font-weight: bold; |
font-weight: bold; |
|
115 |
|
margin-bottom: 5px; |
|
116 |
|
} |
|
117 |
|
|
|
118 |
|
label { |
|
119 |
|
font-weight: bold; |
|
120 |
|
margin-bottom: 5px; |
110 |
121 |
} |
} |
111 |
122 |
|
|
112 |
123 |
.rg_keys_list { |
.rg_keys_list { |
113 |
124 |
margin: 20px auto; |
margin: 20px auto; |
114 |
125 |
background-color: #dddddd; |
background-color: #dddddd; |
115 |
126 |
padding: 5px; |
padding: 5px; |
116 |
|
width: 600px; |
|
|
127 |
|
width: 650px; |
117 |
128 |
border-radius: 4px 4px 4px 4px; |
border-radius: 4px 4px 4px 4px; |
118 |
129 |
border: 1px solid #cccccc; |
border: 1px solid #cccccc; |
119 |
130 |
} |
} |
|
... |
... |
th, td { |
139 |
150 |
} |
} |
140 |
151 |
|
|
141 |
152 |
.source { |
.source { |
142 |
|
font-family: monospace; |
|
143 |
|
font-size: 10pt; |
|
|
153 |
|
font-size: 9pt; |
|
154 |
|
line-height: 110%; |
144 |
155 |
} |
} |
145 |
156 |
|
|
146 |
157 |
.diff { |
.diff { |
147 |
|
width: 880px; |
|
148 |
158 |
} |
} |
|
159 |
|
|
File tests/util.php changed (mode: 100644) (index e0cb505..fad5706) |
... |
... |
if ($r['code'] != 5) { |
44 |
44 |
exit(1); |
exit(1); |
45 |
45 |
} |
} |
46 |
46 |
|
|
|
47 |
|
// test rg_template_table($dir, $data, $more) with no data |
|
48 |
|
$r = rg_template_table("./util/t1", array(), array("a" => "A")); |
|
49 |
|
$e = "XAX"; |
|
50 |
|
if (strcmp($r, $e) != 0) { |
|
51 |
|
echo "util.php: nodata.html is not working (r=$r e=$e)!\n"; |
|
52 |
|
exit(1); |
|
53 |
|
} |
|
54 |
|
|
|
55 |
|
// test rg_template_table($dir, $data, $more) with data |
|
56 |
|
$data = array(array("a" => "A", "b" => "B"), array("a" => "A2", "b" => "B2")); |
|
57 |
|
$r = rg_template_table("./util/t2", $data, array("c" => "C")); |
|
58 |
|
$e = "HEADCABCA2B2CFOOTC"; |
|
59 |
|
if (strcmp($r, $e) != 0) { |
|
60 |
|
echo "util.php: rg_template_table is not working (r=$r e=$e)!\n"; |
|
61 |
|
exit(1); |
|
62 |
|
} |
|
63 |
|
|
47 |
64 |
echo "util: OK!\n"; |
echo "util: OK!\n"; |
48 |
65 |
?> |
?> |