<?php
error_reporting(E_ALL);
ini_set("track_errors", "On");
$_s = microtime(TRUE);
$INC = dirname(__FILE__) . "/../inc";
$ROOT = dirname(__FILE__);
$THEME_NAME = "default";
$THEME = $ROOT . "/themes/" . $THEME_NAME;
$THEME_URL = "themes/" . $THEME_NAME;
$THEME_COMMON = "themes/common";
require_once("/etc/rocketgit/config.php");
require_once($INC . "/log.inc.php");
include_once($INC . "/sql.inc.php");
include_once($INC . "/user.inc.php");
include_once($INC . "/repo.inc.php");
include_once($INC . "/keys.inc.php");
include_once($INC . "/token.inc.php");
rg_log_set_file("/var/log/rocketgit-web/main.log");
// TODO: make subop and subsubop as strings
$op = rg_var_str("op");
$subop = rg_var_uint("subop");
$subsubop = rg_var_uint("subsubop");
$doit = rg_var_uint("doit");
$sid = rg_var_re("sid", "/[^A-Za-z0-9]/");
$token = rg_var_re("token", "/[^A-Za-z0-9]/");
rg_log("IP: " . @$_SERVER['REMOTE_ADDR']);
rg_log("_REQUEST: " . trim(print_r($_REQUEST, TRUE)));
rg_log("_COOKIE: " . trim(print_r($_COOKIE, TRUE)));
rg_log("Start! op=$op/$subop/$subsubop, doit=$doit, sid=$sid...");
// database connection
$db = rg_sql_open($rg_sql);
if ($db === FALSE)
die("Cannot open database!");
rg_user_login_by_sid($db, $sid, $rg_ui);
rg_log("After login_by_sid, rg_ui=" . print_r($rg_ui, TRUE));
$body = "";
// Chain dispatching
do {
$redispatch = 0;
// Re-init second line menu
$second_menu = array();
include($INC . "/dispatch/dispatch.php");
} while ($redispatch == 1);
// menu
$first_menu = array(
"login" => array("text" => "Login", "uid0" => 1),
"personal" => array("text" => "Personal"),
"repo" => array("text" => "Repositories"),
"keys" => array("text" => "SSH keys"),
"admin" => array("text" => "Admin", "needs_admin" => 1),
"suggestion"=> array("text" => "Suggestion"),
"logout" => array("text" => "Logout")
);
$first_menu[$op]['sub'] = $second_menu;
$menu = implode("\t<br />\n", rg_menu($first_menu, $rg_ui));
if ($rg_ui['uid'] > 0)
$rg_username = $rg_ui['username'];
else
$rg_username = "Not logged in";
$_diff = sprintf("%u", (microtime(TRUE) - $_s) * 1000);
include($THEME . "/index.php");
$_diff = sprintf("%u", (microtime(TRUE) - $_s) * 1000);
rg_log("Done in $_diff ms.");
?>
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