diff --git a/docs/help/main.php b/docs/help/main.php
new file mode 100644
index 0000000..3404ef5
--- /dev/null
+++ b/docs/help/main.php
@@ -0,0 +1 @@
+Documentation and help file, here.
\ No newline at end of file
diff --git a/index.php b/index.php
index b29eeac..69efc49 100755
--- a/index.php
+++ b/index.php
@@ -15,4 +15,4 @@
default:
$_REQ['data']= null;
}
- include('mind3rd/API/utils.php');
+ include('mind3rd/API/utils.php');
\ No newline at end of file
diff --git a/mind b/mind
index 330e990..13b8bcb 100755
--- a/mind
+++ b/mind
@@ -21,35 +21,60 @@
// installation should create the required SQLite database and a shortcut command
if($_SERVER['argv'][1] == 'install')
{
+ // first, for linux and mac computers
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
{
- echo ".";
- echo shell_exec("sudo touch /bin/mind; echo .");
- echo shell_exec("sudo echo '#!/usr/bin/env php' > /bin/mind; echo .");
- echo shell_exec("sudo echo '> /bin/mind; echo .");
-
- echo shell_exec("sudo echo \"".'\$_REQ= Array(); \$_REQ[\'env\']= \'shell\';'.
- " define('_MINDSRC_', '". getcwd()."'); ".
- " require('".getcwd()."/mind3rd/API/utils.php');\" >> /bin/mind; echo .");
- echo shell_exec("sudo chmod 777 /bin/mind; echo .");
+ echo "starting the installation...\n";
+ echo "creating the file...\n";
+ echo shell_exec("sudo touch /bin/mind");
+ echo "writing the header...\n";
+ echo shell_exec("sudo echo '#!/usr/bin/env php' > ".
+ "/bin/mind");
+ echo "writing the main commands...\n";
+ echo shell_exec("sudo echo '> /bin/mind");
+ echo shell_exec("sudo echo \""."\$_REQ= Array(); ".
+ "\$_REQ[\'env\']= \'shell\'; ".
+ "define('_MINDSRC_', '". getcwd()."'); ".
+ "require('".getcwd()."/mind3rd/API/utils.php');\"".
+ ">> /bin/mind;");
+ echo "setting permissions...\n";
+ echo shell_exec("sudo chmod 777 /bin/mind");
}else{
// TODO: prepare it to other operating systems
}
+
+ echo "creating database...\n";
if($db = new SQLiteDatabase('mind3rd/SQLite/mind'))
{
$DDL= file_get_contents('mind3rd/SQLite/ddl.sql');
- if(!$db->queryExec($DDL))
+ if(!@$db->queryExec($DDL))
{
- die($err);
+ echo "Database already exists...it wont be touched\n";
}
- $db->queryExec("INSERT into user(name, login, pwd, status, type) VALUES ('Administrator', 'admin', '".sha1('admin')."', 'A', 'A');");
- chmod('mind3rd/SQLite/mind', '777');
+ echo "adding the main user...\n";
+ $db->queryExec("INSERT into user(
+ name,
+ login,
+ pwd,
+ status,
+ type
+ )VALUES(
+ 'Administrator'
+ 'admin',
+ '".sha1('admin')."',
+ 'A',
+ 'A'
+ );");
+ echo "setting database permissions...\n";
+ echo shell_exec('sudo chmod 777 '.getcwd().'/mind3rd/SQLite/mind');
}else{
- die($err);
+ echo "SQLite Database could not be created. ".
+ "Is your server working properly with SQLite?\n";
+ exit;
}
- echo "Done\n";
+ echo "Finished\n";
exit;
}
// if not installing, it should be redirected to mind3rd/API/shell.php
include('location:./mind3rd/API/shell.php');
- }
+ }
\ No newline at end of file
diff --git a/mind3rd/API/classes/Mind.php b/mind3rd/API/classes/Mind.php
index c93f5b1..75e44fa 100755
--- a/mind3rd/API/classes/Mind.php
+++ b/mind3rd/API/classes/Mind.php
@@ -26,6 +26,15 @@
public static $content= "";
public static $curLang= 'en';
+ /**
+ * Verifies wheter the software is installed or not
+ * @return boolean
+ */
+ public static function isInstalled()
+ {
+ return file_exists('mind3rd/SQLite/mind');
+ }
+
/**
* This method returns or outputs messages using the L10N library
* You can pass a rich string with %s, %i, etc, sending extra parameters
diff --git a/mind3rd/API/utils.php b/mind3rd/API/utils.php
index 243d185..2fdcc32 100755
--- a/mind3rd/API/utils.php
+++ b/mind3rd/API/utils.php
@@ -10,11 +10,12 @@
define('_CONSOLE_LINE_LENGTH_', 80);
require(_MINDSRC_.'/mind3rd/API/classes/Mind.php');
- /*require(_MINDSRC_.'/mind3rd/API/interfaces/program.php');
- require(_MINDSRC_.'/mind3rd/API/classes/Mind.php');
- require(_MINDSRC_.'/mind3rd/API/classes/MindDB.php');
- require(_MINDSRC_.'/mind3rd/API/classes/MindPlugin.php');
- require(_MINDSRC_.'/mind3rd/API/classes/MindCommand.php');*/
+ if(!Mind::isInstalled())
+ {
+ include(_MINDSRC_.'/wizard/installation-1.php');
+ exit;
+ }
+
require_once(_MINDSRC_.'/mind3rd/API/external/Symfony/Component/Console/Shell.php');
require_once(_MINDSRC_.'/mind3rd/API/external/Symfony/Component/Console/Application.php');
require_once(_MINDSRC_.'/mind3rd/API/external/Symfony/Component/Console/Command/Command.php');
diff --git a/mind3rd/SQLite/mind b/mind3rd/SQLite/mind
index 9f6189c..bac542d 100755
Binary files a/mind3rd/SQLite/mind and b/mind3rd/SQLite/mind differ
diff --git a/mind3rd/projects/x/sources/main.mnd b/mind3rd/projects/x/sources/main.mnd
index 62944be..b20bddf 100755
--- a/mind3rd/projects/x/sources/main.mnd
+++ b/mind3rd/projects/x/sources/main.mnd
@@ -11,4 +11,6 @@ blabelaebamimi
*/
aluno tem pai, mãe e papagaio.
aluno tem nome:caractere(128, obrigatório, não nulo, "josé's da conceição")
-pai tem \pilha.
\ No newline at end of file
+pai tem \pilha.
+mae tem nome, idade e sexo:char().
+mãe tem nome, idade e sexo.
\ No newline at end of file
diff --git a/wizard/installation-1.php b/wizard/installation-1.php
new file mode 100644
index 0000000..651eba9
--- /dev/null
+++ b/wizard/installation-1.php
@@ -0,0 +1,25 @@
+ You must install mind, first
+ You got two options to install it.
+