add tables for apprentices
[brisk.git] / web / Obj / brisk.phh
index 3e7870d..d543267 100644 (file)
@@ -28,6 +28,7 @@ define('FTOK_PATH', "/var/lib/brisk");
 define('LEGAL_PATH', "/tmp/legal_brisk");
 define('PROXY_PATH', "/var/lib/brisk_proxy");
 define('TABLES_N', 36);
+define('TABLES_APPR_N', 12);
 define('TABLES_AUTH_N', 8);
 define('TABLES_CERT_N', 4);
 define('PLAYERS_N', 3);
@@ -634,8 +635,9 @@ class Vect {
 }
 
 define('TABLE_AUTH_TY_PUBL', 0);
-define('TABLE_AUTH_TY_AUTH', 1);
-define('TABLE_AUTH_TY_CERT', 2);
+define('TABLE_AUTH_TY_APPR', 1);
+define('TABLE_AUTH_TY_AUTH', 2);
+define('TABLE_AUTH_TY_CERT', 3);
 
 
 class Table {
@@ -671,6 +673,8 @@ class Table {
         $thiz->auth_type =   TABLE_AUTH_TY_CERT;
     else if ($idx < TABLES_AUTH_N)
         $thiz->auth_type =   TABLE_AUTH_TY_AUTH;
+    else if ($idx < TABLES_APPR_N)
+        $thiz->auth_type =   TABLE_AUTH_TY_APPR;
     else
         $thiz->auth_type =   TABLE_AUTH_TY_PUBL;
 
@@ -825,6 +829,12 @@ class Table {
               else
                   $act = 'reserved';
               break;
+          case TABLE_AUTH_TY_APPR:
+              if ($user->is_auth())
+                  $act = "sitappr";
+              else
+                  $act = 'reserved';
+              break;
           default:
               $act = 'sit';
               break;
@@ -1732,7 +1742,6 @@ class Brisk
       $user_code = -1;
       $ret = 0;
 
-
       do {
           if (($json = json_decode($json_s)) == FALSE) {
               $ret = 1;
@@ -1744,13 +1753,13 @@ class Brisk
               break;
           }
 
-          if (($user_item = $bdb->usersnet_save($user->code, $json)) == FALSE) {
-              $ret = 4;
+          if (($user_item = $bdb->usersnet_save($user->code, $json)) != 0) {
+              $ret = 4000 + $user_item;
               break;
           }
-          return (TRUE);
       } while(0);
-      return (FALSE);
+
+      return ($ret);
   }
 
   function room_outstandup($user)
@@ -2115,7 +2124,6 @@ class Brisk
     else if (strncmp($msg, "/info ", 6) == 0) {
         $info_user = substr($msg, 6);
 
-        error_log("here [" . $info_user."][".escsql(urldecode($info_user)). "]");
         echo $this->info_show($user, urldecode($info_user), $dt);
     }
     else if (strncmp($msg, "/st ", 4) == 0) {