@@ -19,7 +19,7 @@ public function __construct($host,$pwd,$usr,$db) {
1919 $ this ->_cnx =new MongoDB \Driver \Manager ($ con );
2020 }
2121 public function commands ($ db ,$ cmd ) {
22- return $ this ->_cnx ->executeCommand ($ db , new MongoDB \Driver \Command ($ cmd ));
22+ return $ this ->_cnx ->executeCommand ($ db ,new MongoDB \Driver \Command ($ cmd ));
2323 }
2424 public function select ($ con ,$ filter =[],$ option =[]) {
2525 $ qry =new MongoDB \Driver \Query ($ filter ,$ option );
@@ -32,7 +32,7 @@ protected function prepare($time=1000) {
3232 public function insert ($ con ,$ doc ) {
3333 $ this ->prepare ();
3434 if (count ($ doc ) != count ($ doc ,COUNT_RECURSIVE )) {
35- foreach ($ doc as $ dc ) $ this ->bw ->insert ($ dc );
35+ foreach ($ doc as $ dc ) $ this ->bw ->insert ($ dc );
3636 } else {
3737 $ this ->bw ->insert ($ doc );
3838 }
@@ -54,7 +54,7 @@ public function delete($con,$doc=[]) {
5454 protected function execute ($ con ) {
5555 return $ this ->_cnx ->executeBulkWrite ($ con ,$ this ->bw ,$ this ->wc );
5656 }
57- public function convert_id ($ doc , $ oid ='' ) {
57+ public function convert_id ($ doc ,$ oid ='' ) {
5858 if ($ doc instanceof MongoDB \BSON \ObjectId) {
5959 $ doc =$ doc ->__toString ();
6060 } elseif (is_numeric ($ doc )) {
@@ -73,7 +73,7 @@ public function convert_arr($doc) {
7373 return json_encode ($ doc );
7474 }
7575 public function num_row ($ con ,$ filter =[],$ option =[]) {
76- return count ($ this ->select ($ con , $ filter , $ option ));
76+ return count ($ this ->select ($ con ,$ filter ,$ option ));
7777 }
7878}
7979class ED {
@@ -362,15 +362,14 @@ public function imp_xml($body) {
362362a{color:#842;text-decoration:none}
363363a:hover{text-decoration:underline}
364364a,a:active,a:hover{outline:0}
365- table a,.l1 a,.l2 a{padding:0 3px }
365+ table a,.l1 a,.l2 a{padding:0 2px }
366366table{border-collapse:collapse;border-spacing:0;border-bottom:1px solid #555}
367367td,th{padding:4px;vertical-align:top}
368368input[type=checkbox],input[type=radio]{position:relative;vertical-align:middle;bottom:1px}
369369input[type=text],input[type=password],input[type=file],textarea,button,select{width:100%;padding:2px;border:1px solid #9be;outline:none;border-radius:3px;box-sizing:border-box}
370- select{padding:1px 0}
371370optgroup option{padding-left:8px}
372- textarea{white-space:pre-wrap}
373- .msg{position:absolute ;top:0;right:0;z-index:9}
371+ textarea{white-space:pre-wrap;min-width:180px }
372+ .msg{position:fixed ;top:0;right:0;z-index:9}
374373.ok,.err{padding:8px;font-weight:bold}
375374.ok{background:#efe;color:#080;border-bottom:2px solid #080}
376375.err{background:#fee;color:#f00;border-bottom:2px solid #f00}
@@ -478,7 +477,7 @@ public function imp_xml($body) {
478477 if ($ ed ->post ('vn ' ,'!e ' )) {//create view
479478 $ flds =[];
480479 if (!empty ($ ed ->post ('fld ' ))) {
481- $ fld =explode (", " , $ ed ->post ('fld ' ));
480+ $ fld =explode (", " ,$ ed ->post ('fld ' ));
482481 foreach ($ fld as $ fl ) $ flds [trim ($ fl )]=0 ;
483482 }
484483 $ create =['create ' =>$ ed ->sanitize ($ ed ->post ('vn ' )),'viewOn ' =>$ ed ->post ('tbl ' )];
@@ -513,7 +512,7 @@ public function imp_xml($body) {
513512 }
514513 if (!empty ($ ed ->sg [3 ])) {//drop
515514 try {
516- $ ed ->con ->commands ($ db ,['dropIndexes ' =>$ tb , 'index ' =>$ ed ->sg [3 ]]);
515+ $ ed ->con ->commands ($ db ,['dropIndexes ' =>$ tb ,'index ' =>$ ed ->sg [3 ]]);
517516 $ ed ->redir ("15/ $ db/ $ tb " ,['ok ' =>"Successfully dropped index " ]);
518517 } catch (Exception $ e ) {
519518 $ ed ->redir ("15/ $ db/ $ tb " ,['err ' =>"Can't drop index " ]);
@@ -528,7 +527,7 @@ public function imp_xml($body) {
528527 echo "<table><tr><th>Name</th><th>Key</th><th>Order</th><th>Unique</th><th>Actions</th></tr> " ;
529528 foreach ($ ed ->con ->commands ($ db ,['listIndexes ' =>$ tb ])->toArray () as $ idx ) {
530529 $ bg =($ bg ==1 )?2 :1 ;
531- $ key =key ($ idx ->key );
530+ $ key =key (( array ) $ idx ->key );
532531 echo "<tr class='r c $ bg'><td> {$ idx ->name }</td><td> " .$ key ."</td><td> " .($ idx ->key ->$ key ==1 ? 'ASC ' :'DESC ' )."</td><td> " .(empty ($ idx ->unique )?'No ' :'Yes ' )."</td><td> " .($ idx ->name =="_id_ " ? "Primary " :(in_array ($ db ,$ ed ->deny )?"" :"<a href=' {$ ed ->path }15/ $ db/ $ tb/ " .$ idx ->name ."'>Drop</a> " ))."</td></tr> " ;
533532 }
534533 echo "</table> " ;
0 commit comments