+ Mind3rd IDE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/index.php b/index.php
index be3e2fa..2438609 100755
--- a/index.php
+++ b/index.php
@@ -22,4 +22,5 @@
default :
$_REQ['data']= null;
}
+
include('mind3rd/API/utils/utils.php');
\ No newline at end of file
diff --git a/mind3rd/API/facade/Set.php b/mind3rd/API/facade/Set.php
new file mode 100644
index 0000000..c68c3d8
--- /dev/null
+++ b/mind3rd/API/facade/Set.php
@@ -0,0 +1,108 @@
+
+ * @license licenses/mind3rd.license
+ */
+ namespace API;
+ /**
+ * This is a facade to help you getting generic data.
+ * This class offers you a bunch of "shortcuts" to many different data or results.
+ *
+ * @author felipe
+ */
+ class Get{
+
+ /**
+ * Gets a list of installed plugins.
+ *
+ * @param boolean $echoes If the plugins list should be sent to the output
+ * @return Array
+ */
+ public static function plugins($echoes=false)
+ {
+ return \MindPlugin::listPlugins($echoes);
+ }
+
+ /**
+ * Gets an array with all the installed lobes.
+ * @return Array
+ */
+ public static function lobes()
+ {
+ return \Lobe\Neuron::listLobes();
+ }
+
+ /**
+ * Gets all the information about the current project.
+ * @return string
+ */
+ public static function projectData()
+ {
+ $dt= \Mind::$currentProject;
+ return $dt;
+ }
+
+ /**
+ * Returns a list of identified tables for the current project.
+ * @return Array
+ */
+ public static function tables()
+ {
+ return \Analyst::getUniverse();
+ }
+
+ /**
+ * Returns an array with all the DDL codes for the current project.
+ * @return Array
+ */
+ public static function DDL()
+ {
+ $dbDriver= \Mind::$currentProject['database_drive'];
+ \DQB\QueryFactory::setUp($dbDriver);
+ return \DQB\QueryFactory::getCompleteQuery(false, true, 'array');
+ }
+
+ /**
+ *
+ * Returns an array with all the DDL codes for the current project.
+ * This method returns each DDL comand as a decorated command, containing HTML tags.
+ * @return Array
+ */
+ public static function DecoratedDDL()
+ {
+ $dbDriver= \Mind::$currentProject['database_drive'];
+ \DQB\QueryFactory::setUp($dbDriver);
+ return \DQB\QueryFactory::getCompleteQuery(true, false, 'array');
+ }
+
+ /**
+ * Gets the currently opened project or false if none.
+ *
+ * @return \MindProject|false
+ */
+ public static function currentProject()
+ {
+ return \Mind::$project? \Mind::$project:
+ false;
+ }
+
+ /**
+ * Gets an array with all the source code, for the current project.
+ * @return Array
+ */
+ public static function source()
+ {
+ return \API\Project::source();
+ }
+
+ /**
+ * Gets the list of currently instaled idioms.
+ * @return Array
+ */
+ public static function idioms()
+ {
+ return \Mind::getIdiomsList();
+ }
+ }
\ No newline at end of file
diff --git a/mind3rd/API/http.php b/mind3rd/API/http.php
index 5620859..1f3d327 100755
--- a/mind3rd/API/http.php
+++ b/mind3rd/API/http.php
@@ -20,26 +20,32 @@
}
if(!isset($_REQ['data']))
$_REQ['data']= Array();
-
+
foreach($_POST as $k=>$value)
{
$_REQ['data'][$k]= preg_replace("/['\"\\\.\/]/", '', $value);
}
- if(isset($_SESSION['currentProject']))
+ if(isset($_SESSION['currentProject']) && $_SESSION['currentProject'])
{
$p= Array();
$p['pk_project']= $_SESSION['currentProject'];
$p['name']= $_SESSION['currentProjectName'];
Mind::openProject($p);
}
-
+
if(isset($app))
{
if(!isset($_REQ['data']) || !isset($_REQ['data']['program']))
{
- Mind::write('programRequired');
- return false;
+ if($_MIND->defaults['use_default_ide'] != false){
+ header('Location: '.$_MIND->defaults['use_default_ide']);
+ exit;
+ }else{
+ Mind::write('programRequired');
+ return false;
+ }
+
}
$program= $app->findCommand($_REQ['data']['program']);
$program= $program->getFileName();
diff --git a/mind3rd/API/utils/utils.php b/mind3rd/API/utils/utils.php
index c4cdc5e..272ed8e 100755
--- a/mind3rd/API/utils/utils.php
+++ b/mind3rd/API/utils/utils.php
@@ -46,11 +46,12 @@
}
$d->close();
}
+
// building the application
define('SYSTEM_NAME', 'mind');
$app= new Symfony\Component\Console\Application(SYSTEM_NAME);
-
+
// defining the programs/commands to be used
$programs= Array();
$d = dir(_MINDSRC_.'/mind3rd/API/programs');
@@ -66,6 +67,7 @@
$d->close();
$app->addCommands($programs);
\MIND::$programs= $programs;
+
// starting the application
if($_REQ['env']=='shell'){
include(_MINDSRC_.'/mind3rd/API/shell.php');
diff --git a/mind3rd/env/defaults.ini b/mind3rd/env/defaults.ini
index cef6a49..4ef55d5 100755
--- a/mind3rd/env/defaults.ini
+++ b/mind3rd/env/defaults.ini
@@ -43,4 +43,6 @@ fk_prefix="fk_"
counter_col="counter"
; Varchar and Char properties should have mandatorily a size, if none is passed,
; the following value will be used as size
-default_character_length=255
\ No newline at end of file
+default_character_length=255
+; should it open an IDE when HTTP requests come with no program param?
+use_default_ide=ide/
\ No newline at end of file