Merge branch 'ipclass-ban' into certified_ipclass-ban
[brisk.git] / web / briskin5 / Obj / briskin5.phh
index ce0fa1d..ee69b35 100644 (file)
@@ -1079,7 +1079,6 @@ class Bin5_user extends User {
           $this->rd_step  = $this->step;
       } /* if ($this->rd_step == -1) { */
       else {
-          /* $sem = Brisk::lock_data(FALSE); */
           $S_load_stat['rU_heavy']++;
 
           if ($this->rd_step < $this->step) {
@@ -1087,7 +1086,6 @@ class Bin5_user extends User {
                   if ($this->rd_step + COMM_N < $this->step) {
                       if ($this->rd_stat != $this->stat) {
                           $to_stat = $this->stat;
-                          /* Brisk::unlock_data($sem); */
                           log_load("RESYNC");
                           printf("xXx BIN5_USER::MAINCHECK\n");
                           return ($this->page_sync($this->sess, ($to_stat == "table" ? "index.php" : "../index.php"), $this->table, $this->table_token));
@@ -1136,7 +1134,6 @@ class Bin5_user extends User {
               } /* if ($this->the_end == TRUE) { ... */
           } /* if ($this->rd_step < $this->step) { */
 
-          /* Brisk::unlock_data($sem); */
       }  /* else of if ($this->rd_step == -1) { */
 
 
@@ -1231,7 +1228,32 @@ class Bin5 {
 
         return (FALSE);
     }
+    function banned_kickoff()
+    {
+        $is_ban = FALSE;
+
+        for ($i = 0 ; $i < BIN5_MAX_PLAYERS ; $i++) {
+            $user_cur = $this->user[$i];
+
+            // check if the IP is blacklisted
+            if ($this->brisk->black_check($user_cur->ip)) {
+                $user_cur->lacc = 0;
+                $is_ban = TRUE;
+                continue;
+            }
 
+            // if authorized not check if banlisted
+            if ($user_cur->flags & USER_FLAG_AUTH) {
+                continue;
+            }
+
+            if ($this->brisk->ban_check($user_cur->ip)) {
+                $user_cur->lacc = 0;
+                $is_ban = TRUE;
+            }
+        }
+        return ($is_ban);
+    }
 
     function garbage_manager($force)
     {
@@ -1452,7 +1474,7 @@ class Bin5 {
 
     static function request_mgr(&$s_a_p, $header, &$header_out, &$new_socket, $path, $addr, $get, $post, $cookie)
     {
-        GLOBAL $G_black_list;
+        GLOBAL $G_ban_list, $G_black_list;
 
         printf("NEW_SOCKET (root): %d\n", intval($new_socket));