Exemplo n.º 1
0
 public function getAll()
 {
     $connections = parent::getAll();
     // Explode jcli command output to fetch groups
     $exploded = explode("#", $connections);
     // Unset first and second elements that include unwanted results from the command group -l
     unset($exploded[0]);
     unset($exploded[1]);
     $connections = [];
     foreach ($exploded as $expl) {
         $connector = trim($expl);
         //fetch string before the "Total Users:" phrase. This has the last user that was parsed from jcli
         $ff = strstr($expl, 'Total Users:', true);
         if (!empty($ff)) {
             $connector = trim($ff);
         }
         $temp_connector = explode(" ", $connector);
         $temp_connector = array_filter($temp_connector);
         $fixed_connector = array();
         foreach ($temp_connector as $temp) {
             array_push($fixed_connector, $temp);
         }
         $connections[] = ['uid' => $fixed_connector[0], 'gid' => $fixed_connector[1], 'username' => $fixed_connector[2], 'balance' => $fixed_connector[3], 'mt' => $fixed_connector[4], 'throughput' => $fixed_connector[5]];
     }
     return $connections;
 }
Exemplo n.º 2
0
 public function getAll()
 {
     $connectors = parent::getAll();
     // Explode jcli command output to fetch groups
     $exploded = explode("#", $connectors);
     // Unset first and second elements that include unwanted results from the command group -l
     unset($exploded[0]);
     unset($exploded[1]);
     $connectors = [];
     foreach ($exploded as $expl) {
         $user = trim($expl);
         //fetch string before the "Total Users:" phrase. This has the last user that was parsed from jcli
         $ff = strstr($expl, 'Total Users:', true);
         if (!empty($ff)) {
             $user = trim($ff);
         }
         $temp_user = explode(" ", $user);
         $temp_user = array_filter($temp_user);
         $fixed_user = array();
         foreach ($temp_user as $temp) {
             array_push($fixed_user, $temp);
         }
         $userz['cid'] = $fixed_user[0];
         $userz['status'] = $fixed_user[1];
         $userz['session'] = $fixed_user[2];
         $userz['starts'] = isset($fixed_user[3]) ? $fixed_user[3] : 0;
         $userz['stops'] = isset($fixed_user[4]) ? $fixed_user[4] : 0;
         array_push($connectors, $userz);
     }
     return $connectors;
 }
Exemplo n.º 3
0
 public function getAll()
 {
     $fetch_groups = parent::getAll();
     // Explode jcli command output to fetch groups
     $exploded = explode("#", $fetch_groups);
     // Unset first and second elements that include unwanted results from the command group -l
     unset($exploded[0]);
     unset($exploded[1]);
     $groups = [];
     foreach ($exploded as $expl) {
         $group = trim($expl);
         //fetch string before the "Total Groups:" lectic
         $ff = strstr($expl, 'Total Groups:', true);
         if (!empty($ff)) {
             $group = trim($ff);
         }
         $groups[] = ['gid' => $group];
     }
     return $groups;
 }