6
6
* www.Vork.us
7
7
* www.MongoDB.org
8
8
*
9
- * @version 1.0.4
9
+ * @version 1.0.5
10
10
* @author Eric David Benari, Chief Architect, phpMoAdmin
11
11
*/
12
12
@@ -286,7 +286,7 @@ public function getStats() {
286
286
. ' minutes ' ;
287
287
$ unshift ['mongo ' ] = $ return ['version ' ];
288
288
$ unshift ['mongoPhpDriver ' ] = Mongo::VERSION ;
289
- $ unshift ['phpMoAdmin ' ] = '1.0.4 ' ;
289
+ $ unshift ['phpMoAdmin ' ] = '1.0.5 ' ;
290
290
$ unshift ['gitVersion ' ] = $ return ['gitVersion ' ];
291
291
unset($ return ['ok ' ], $ return ['version ' ], $ return ['gitVersion ' ]);
292
292
$ return = array_merge (array ('version ' => $ unshift ), $ return );
@@ -459,7 +459,7 @@ public function editObject($collection, $_id, $idtype) {
459
459
* @return array
460
460
*/
461
461
public function saveObject ($ collection , $ obj ) {
462
- eval ('$obj= ' . $ obj. '; ' ); //cast from string to array
462
+ eval ('$obj= ' . $ obj . '; ' ); //cast from string to array
463
463
return $ this ->mongo ->selectCollection ($ collection )->save ($ obj );
464
464
}
465
465
}
@@ -1573,26 +1573,22 @@ public function getCheckboxes(array $args) {
1573
1573
}
1574
1574
1575
1575
/**
1576
- * phpMoAdmin bootstrap
1576
+ * phpMoAdmin specific functionality
1577
1577
*/
1578
- if (!isset ($ _GET ['db ' ])) {
1579
- $ _GET ['db ' ] = 'admin ' ;
1580
- } else if (strpos ($ _GET ['db ' ], '. ' ) !== false ) {
1581
- $ _GET ['db ' ] = $ _GET ['newdb ' ];
1582
- }
1583
- try {
1584
- moadminComponent::$ model = new moadminModel ($ _GET ['db ' ]);
1585
- } catch (Exception $ e ) {
1586
- echo $ e ;
1587
- exit (0 );
1588
- }
1589
- $ html = get::helper ('html ' );
1590
- $ form = new formHelper ;
1591
- $ mo = new moadminComponent ;
1592
-
1593
1578
class phpMoAdmin {
1579
+ /**
1580
+ * Sets the depth limit for phpMoAdmin::getArrayKeys (and prevents an endless loop with self-referencing objects)
1581
+ */
1594
1582
const DRILL_DOWN_DEPTH_LIMIT = 8 ;
1595
1583
1584
+ /**
1585
+ * Retrieves all the keys & subkeys of an array recursively drilling down
1586
+ *
1587
+ * @param array $array
1588
+ * @param string $path
1589
+ * @param int $drillDownDepthCount
1590
+ * @return array
1591
+ */
1596
1592
public static function getArrayKeys (array $ array , $ path = '' , $ drillDownDepthCount = 0 ) {
1597
1593
$ return = array ();
1598
1594
if ($ drillDownDepthCount ) {
@@ -1608,7 +1604,40 @@ public static function getArrayKeys(array $array, $path = '', $drillDownDepthCou
1608
1604
}
1609
1605
return $ return ;
1610
1606
}
1607
+
1608
+ /**
1609
+ * Strip slashes recursively - used only when magic quotes is enabled (this reverses magic quotes)
1610
+ *
1611
+ * @param mixed $val
1612
+ * @return mixed
1613
+ */
1614
+ public static function stripslashes ($ val ) {
1615
+ return (is_array ($ val ) ? array_map (array ('self ' , 'stripslashes ' ), $ val ) : stripslashes ($ val ));
1616
+ }
1617
+ }
1618
+
1619
+ /**
1620
+ * phpMoAdmin bootstrap
1621
+ */
1622
+ if (get_magic_quotes_gpc ()) {
1623
+ $ _GET = phpMoAdmin::stripslashes ($ _GET );
1624
+ $ _POST = phpMoAdmin::stripslashes ($ _POST );
1625
+ }
1626
+
1627
+ if (!isset ($ _GET ['db ' ])) {
1628
+ $ _GET ['db ' ] = 'admin ' ;
1629
+ } else if (strpos ($ _GET ['db ' ], '. ' ) !== false ) {
1630
+ $ _GET ['db ' ] = $ _GET ['newdb ' ];
1631
+ }
1632
+ try {
1633
+ moadminComponent::$ model = new moadminModel ($ _GET ['db ' ]);
1634
+ } catch (Exception $ e ) {
1635
+ echo $ e ;
1636
+ exit (0 );
1611
1637
}
1638
+ $ html = get::helper ('html ' );
1639
+ $ form = new formHelper ;
1640
+ $ mo = new moadminComponent ;
1612
1641
1613
1642
/**
1614
1643
* phpMoAdmin front-end view-element
0 commit comments