$WEB_ROOT_FS = realpath(dirname(__FILE__));
$BASE_URL = "/";\r
-global $WEB_ROOT_FS, $BASE_URL;
+global $WEB_ROOT_FS, $BASE_URL, $IS_WEB_REQUEST;
+$IS_WEB_REQUEST = false;\r
if(file_exists("../www/config.php")) require_once("../www/config.php");
else if(file_exists("/etc/gwvpmini/config.php")) require_once("/etc/gwvpmini/config.php");
if(file_exists("../gwvpmini/gwvpmini.php")) require_once("../gwvpmini/gwvpmini.php");
else if(file_exists("/usr/share/gwvpmini/lib/gwvpmini/gwvpmini.php")) require_once("/usr/share/gwvpmini/lib/gwvpmini/gwvpmini.php");
-global $IS_WEB_REQUEST;
+if(isset($argv["1"])) {
+ switch($argv["1"]) {
+ case "updatehook":
+ gwvpcmdtool_UpdateHook();
+ break;
+ default:
+ gwvpcmdtool_Usage();
+ }
+} else gwvpcmdtool_Usage();
+return;
-$IS_WEB_REQUEST = false;
+
+function gwvpcmdtool_Usage()
+{
+ global $argv;
+
+ echo "Usage: ".$argv[0]."\n";
+ echo "\tupdatehook <user> <ref> <firstupdate> <lastupdate>\n";
+}
+
+function gwvpcmdtool_UpdateHook()
+{
+
+}
?>
\ No newline at end of file
require_once("gwvpmini_activity.php");
require_once("gwvpmini_register.php");
require_once("gwvpmini_user.php");
-if(gwvpmini_isLoggedIn()) if(gwvpmini_isUserAdmin()) {
+if($IS_WEB_REQUEST) {
+ if(gwvpmini_isLoggedIn()) if(gwvpmini_isUserAdmin()) {
+ require_once("gwvpmini_admin.php");
+ }
+} else {
require_once("gwvpmini_admin.php");
}
<?php
-$reg = gwvpmini_getConfigVal("activityloglength");\r
-\r
-$activity_log_length = false;\r
-if($reg == null) {\r
- gwvpmini_setConfigVal("activityloglength", "100");\r
-} else if($reg == 1) {\r
- $activityloglength = true;\r
-} else {\r
- $activityloglength = false;\r
-}\r
-\r
-global $use_gravatar;\r
+
+if($IS_WEB_REQUEST) {
+ $reg = gwvpmini_getConfigVal("activityloglength");\r
+ \r
+ $activity_log_length = false;\r
+ if($reg == null) {\r
+ gwvpmini_setConfigVal("activityloglength", "100");\r
+ } else if($reg == 1) {\r
+ $activityloglength = true;\r
+ } else {\r
+ $activityloglength = false;\r
+ }\r
+} \r
// this will add a repo activity (a commit for eg)
<?php
-if(gwvpmini_isLoggedIn()) if(gwvpmini_isUserAdmin()) {
- $MENU_ITEMS["20repos"]["text"] = "Administration";\r
- $MENU_ITEMS["20repos"]["link"] = "$BASE_URL/admin";
- $CALL_ME_FUNCTIONS["admin"] = "gwvpmini_AdminCallMe";
-}
-
-$reg = gwvpmini_getConfigVal("gravatarenabled");
-
-$use_gravatar = false;\r
-if($reg == null) {\r
- gwvpmini_setConfigVal("gravatarenabled", "1");\r
-} else if($reg == 1) {\r
- $use_gravatar = true;\r
-} else {\r
+if($IS_WEB_REQUEST) {
+ if(gwvpmini_isLoggedIn()) if(gwvpmini_isUserAdmin()) {
+ $MENU_ITEMS["20repos"]["text"] = "Administration";\r
+ $MENU_ITEMS["20repos"]["link"] = "$BASE_URL/admin";
+ $CALL_ME_FUNCTIONS["admin"] = "gwvpmini_AdminCallMe";
+ }
+
+
+ $reg = gwvpmini_getConfigVal("gravatarenabled");
+
$use_gravatar = false;\r
-}\r
-\r
-global $use_gravatar;
+ if($reg == null) {\r
+ gwvpmini_setConfigVal("gravatarenabled", "1");\r
+ } else if($reg == 1) {\r
+ $use_gravatar = true;\r
+ } else {\r
+ $use_gravatar = false;\r
+ }\r
+ \r
+ global $use_gravatar;
+}
function gwvpmini_AdminCallMe()\r
{\r
<?php
-session_start();
+if($IS_WEB_REQUEST) session_start();
$CALL_ME_FUNCTIONS["auth"] = "gwvpmini_AuthCallMe";\r
<?php
-$CALL_ME_FUNCTIONS["register"] = "gwvpmini_RegisterCallMe";
-
-global $can_register, $reg_reqs_confirm, $confirm_from_address;\r
-
-$reg = gwvpmini_getConfigVal("canregister");\r
-$reg2 = gwvpmini_getConfigVal("registerrequiresconfirm");
-$reg3 = gwvpmini_getConfigVal("eamilfromaddress");\r
-\r
-if($reg == null) {\r
- gwvpmini_setConfigVal("canregister", "1");\r
-} else if($reg == 1) {\r
- $can_register = true;\r
-} else {\r
- $can_register = false;\r
-}
-
-if($reg2 == null) {\r
- gwvpmini_setConfigVal("registerrequiresconfirm", "0");\r
-} else if($reg2 == 1) {\r
- $reg_reqs_confirm = true;\r
-} else {\r
- $reg_reqs_confirm = false;\r
-}\r
-\r
-if($reg3 == null) {\r
- gwvpmini_setConfigVal("eamilfromaddress", "admin@localhost");
- $confirm_from_address = "admin@localhost";\r
-} else {\r
- $confirm_from_address = $reg3;\r
-}\r
+if($IS_WEB_REQUEST) {
+ $CALL_ME_FUNCTIONS["register"] = "gwvpmini_RegisterCallMe";
+
+ global $can_register, $reg_reqs_confirm, $confirm_from_address;\r
+
+ $reg = gwvpmini_getConfigVal("canregister");\r
+ $reg2 = gwvpmini_getConfigVal("registerrequiresconfirm");
+ $reg3 = gwvpmini_getConfigVal("eamilfromaddress");\r
+ \r
+ if($reg == null) {\r
+ gwvpmini_setConfigVal("canregister", "1");\r
+ } else if($reg == 1) {\r
+ $can_register = true;\r
+ } else {\r
+ $can_register = false;\r
+ }
+
+ if($reg2 == null) {\r
+ gwvpmini_setConfigVal("registerrequiresconfirm", "0");\r
+ } else if($reg2 == 1) {\r
+ $reg_reqs_confirm = true;\r
+ } else {\r
+ $reg_reqs_confirm = false;\r
+ }\r
+ \r
+ if($reg3 == null) {\r
+ gwvpmini_setConfigVal("eamilfromaddress", "admin@localhost");
+ $confirm_from_address = "admin@localhost";\r
+ } else {\r
+ $confirm_from_address = $reg3;\r
+ }\r
+}
function gwvpmini_RegisterCallMe()
{
\r
global $WEB_ROOT_FS, $BASE_URL, $data_directory, $db_type, $db_name, $db_username, $db_password, $IS_WEB_REQUEST;
-$IS_WEB_REQUEST = false;\r
+$IS_WEB_REQUEST = true;\r
if(file_exists("./config.php")) require_once("./config.php");
else if(file_exists("/etc/gwvpmini/config.php")) require_once("/etc/gwvpmini/config.php");