Example #1
0
 public function getUser($c, $p)
 {
     $data = array();
     if (empty($p["id"])) {
         $temp = Router::exec("/ip/hotspot/user/getall");
         foreach ($temp as $r) {
             if ($r[".id"] != "*0") {
                 $data[] = $r;
             }
         }
     } else {
         if ($p["query"]) {
             $data = array();
             if ($p["isAdmin"] == "false") {
                 $rows = g::db()->getRows("SELECT * FROM `authenuser` WHERE `u_id` = ? ORDER by `a_id` DESC limit {$p['limit_mac']} ", array($p['id']));
                 /*
                 $data[] =  $data.push($xxxx);
                 */
                 foreach ($rows as $r) {
                     //$c->log($r["authen_user"]);
                     $tmp = Router::comm("/ip/hotspot/user/print", array("?name" => $r["authen_user"]), false);
                     if (!empty($tmp)) {
                         foreach ($tmp as $trow) {
                             $trow["a_id"] = $r["a_id"];
                             $trow["_name"] = $trow["name"];
                             $data[] = $trow;
                         }
                     }
                 }
                 Router::disconnect();
             } else {
                 if ($p["isAdmin"] == "true") {
                     $c->log("4");
                     $data = g::db()->getRows("SELECT * FROM `authenuser` ");
                     Router::open();
                     $data = Router::comm("/ip/hotspot/user/getall");
                 }
             }
         } else {
             //edit
             $data = Router::comm("/ip/hotspot/user/print", array("?.id" => "*" . $p["id"]));
         }
     }
     if ($data != null) {
         //$c->log($data);
         $c->data(array("rows" => $data));
         $c->send(true);
     } else {
         $c->send(false);
     }
 }