git branching and pushing is doing my head in
authorPaul J R <me@pjr.cc>
Sun, 23 Sep 2012 22:01:18 +0000 (08:01 +1000)
committerPaul J R <me@pjr.cc>
Sun, 23 Sep 2012 22:01:18 +0000 (08:01 +1000)
bin/gwvpminicmdtool.php
gwvpmini/gwvpmini.php
gwvpmini/gwvpmini_activity.php
gwvpmini/gwvpmini_admin.php
gwvpmini/gwvpmini_auth.php
gwvpmini/gwvpmini_register.php
www/index.php

index 7fb27d4..3d23011 100644 (file)
@@ -3,7 +3,8 @@
 $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");
@@ -12,8 +13,29 @@ else $noconfig = true;
 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
index ad44251..7b23820 100644 (file)
@@ -11,7 +11,11 @@ require_once("gwvpmini_view.php");
 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");
 }
 
index cf2e122..4f07fc5 100644 (file)
@@ -1,17 +1,18 @@
 <?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)
index b4f9db6..2bdef07 100644 (file)
@@ -1,24 +1,27 @@
 <?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
index 89aec63..fc75359 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-session_start();
+if($IS_WEB_REQUEST) session_start();
 
 $CALL_ME_FUNCTIONS["auth"] = "gwvpmini_AuthCallMe";\r
 
index 4fdd90e..b0c5147 100644 (file)
@@ -1,35 +1,37 @@
 <?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()
 {
index 1482ceb..c0b765b 100644 (file)
@@ -5,7 +5,7 @@ $BASE_URL = dirname($_SERVER["PHP_SELF"]);
 \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");