Added friendly message for extra parameter error
Added redirect to setup page when accessing the index before installing it
Esse commit está contido em:
@@ -64,6 +64,7 @@ class En implements l10n{
|
||||
$this->messages['runnintPHPUnit'] = "Please wait...running PHPUnit...\n";
|
||||
$this->messages['mustBeAdmin'] = Mind::message("API: You must be the admin to perform this action", '[Fail]', false);
|
||||
$this->messages['cannotInstall'] = Mind::message("API: To install a component, you need to change the 'allow_installation' property into mind.ini file, setting it as true", '[Fail]', false);
|
||||
$this->messages['wrongParam'] = Mind::message("\nMain: The parameter '%s', whose value is '%s', is not valid!", '[Fail]', false);
|
||||
$this->messages['phpunitNotFound'] = "You must specify where to find phpUnit classes\n".
|
||||
"You can configure it on mind3rd/env/mind.ini ini file\n".
|
||||
"changing the phpunit-src ini property\n";;
|
||||
|
||||
@@ -72,6 +72,7 @@ class pt implements l10n{
|
||||
$this->messages['runnintPHPUnit'] = "Aguarde...executando testes unitários...\n";
|
||||
$this->messages['mustBeAdmin'] = Mind::message("API: Você precisa ser o administrador para executar esta instrução", '[Fail]', false);
|
||||
$this->messages['cannotInstall'] = Mind::message("API: Para instalar um componente, será preciso alterar a propriedade 'allow_installation' no arquivo mind.ini para true", '[Fail]', false);
|
||||
$this->messages['wrongParam'] = Mind::message("\nMain: O parâmetro '%s', com valor '%s' é inválido!", '[Fail]', false);
|
||||
$this->messages['phpunitNotFound'] = "Especifique onde encontram-se as classes do PHPUnit\n".
|
||||
"Você pode configurar isto em mind3rd/env/mind.ini ini file\n".
|
||||
"alterando a propriedade phpunit-src\n";
|
||||
|
||||
@@ -160,7 +160,13 @@
|
||||
echo self::getHelp($programName);
|
||||
return;
|
||||
}
|
||||
$program->$realArgs[$k]= $arg;
|
||||
|
||||
if(!key_exists($k, $realArgs)){
|
||||
\Mind::write('wrongParam', true, $k, $arg);
|
||||
exit;
|
||||
}else{
|
||||
$program->$realArgs[$k]= $arg;
|
||||
}
|
||||
}
|
||||
|
||||
if(is_string($program->commandAction))
|
||||
|
||||
+17
-5
@@ -11,8 +11,20 @@
|
||||
* @author Felipe Nascimento de Moura <felipenmoura@gmail.com>
|
||||
* @license licenses/mind3rd.license
|
||||
*/
|
||||
|
||||
require(_MINDSRC_.'/mind3rd/API/utils/header.php');
|
||||
|
||||
if(!Mind::isInstalled()){
|
||||
if($_REQ['env']=='shell'){
|
||||
echo "You have to install the application!\nTo install it, please run: sudo php mind install";
|
||||
}else{
|
||||
header('location:setup.php');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
include(_MINDSRC_.'/mind3rd/API/utils/constants.php');
|
||||
require(_MINDSRC_.'/mind3rd/env/setup/Setup.php');
|
||||
|
||||
/**
|
||||
* @global Mind $_MIND This variable contains many information about the proect, the system and also have some methods an attributes to deal with such data
|
||||
@@ -54,9 +66,9 @@
|
||||
$d->close();
|
||||
$app->addCommands($programs);
|
||||
\MIND::$programs= $programs;
|
||||
|
||||
// starting the application
|
||||
if($_REQ['env']=='shell')
|
||||
include('shell.php');
|
||||
else
|
||||
include('http.php');
|
||||
if($_REQ['env']=='shell'){
|
||||
include('shell.php');
|
||||
}else{
|
||||
include('http.php');
|
||||
}
|
||||
@@ -9,77 +9,77 @@
|
||||
define('_CONSOLE_LINE_LENGTH_', 80);
|
||||
require(_MINDSRC_.'/mind3rd/API/classes/Mind.php');
|
||||
|
||||
if(!Mind::isInstalled())
|
||||
if(Mind::isInstalled())
|
||||
{
|
||||
//include(_MINDSRC_.'/wizard/installation-1.php');
|
||||
exit;
|
||||
}
|
||||
Mind::autoloadRegisterPath(Array(
|
||||
_MINDSRC_.'/mind3rd/API/external/',
|
||||
_MINDSRC_.'/mind3rd/API/interfaces/',
|
||||
_MINDSRC_.'/mind3rd/API/programs/',
|
||||
_MINDSRC_.'/mind3rd/API/L10N/',
|
||||
_MINDSRC_.'/mind3rd/API/classes/',
|
||||
_MINDSRC_.'/mind3rd/API/cortex/Lexer/',
|
||||
_MINDSRC_.'/mind3rd/API/cortex/tokenizer/',
|
||||
_MINDSRC_.'/mind3rd/API/cortex/canonic/',
|
||||
_MINDSRC_.'/mind3rd/API/cortex/syntaxer/',
|
||||
_MINDSRC_.'/mind3rd/API/cortex/analyst/',
|
||||
_MINDSRC_.'/mind3rd/API/languages/',
|
||||
_MINDSRC_.'/mind3rd/API/DBMS/',
|
||||
_MINDSRC_.'/mind3rd/API/Lobe/',
|
||||
_MINDSRC_.'/mind3rd/API/'
|
||||
));
|
||||
|
||||
Mind::autoloadRegisterPath(Array(
|
||||
_MINDSRC_.'/mind3rd/API/external/',
|
||||
_MINDSRC_.'/mind3rd/API/interfaces/',
|
||||
_MINDSRC_.'/mind3rd/API/programs/',
|
||||
_MINDSRC_.'/mind3rd/API/L10N/',
|
||||
_MINDSRC_.'/mind3rd/API/classes/',
|
||||
_MINDSRC_.'/mind3rd/API/cortex/Lexer/',
|
||||
_MINDSRC_.'/mind3rd/API/cortex/tokenizer/',
|
||||
_MINDSRC_.'/mind3rd/API/cortex/canonic/',
|
||||
_MINDSRC_.'/mind3rd/API/cortex/syntaxer/',
|
||||
_MINDSRC_.'/mind3rd/API/cortex/analyst/',
|
||||
_MINDSRC_.'/mind3rd/API/languages/',
|
||||
_MINDSRC_.'/mind3rd/API/DBMS/',
|
||||
_MINDSRC_.'/mind3rd/API/Lobe/',
|
||||
_MINDSRC_.'/mind3rd/API/'
|
||||
));
|
||||
|
||||
function __autoload($what)
|
||||
{
|
||||
GLOBAL $_MIND;
|
||||
$what= preg_replace("/[ '\"\.\/]/", '', $what);
|
||||
$what= str_replace('\\', '/', $what);
|
||||
$what= str_replace('.', '', $what);
|
||||
|
||||
if(file_exists(_MINDSRC_.'/mind3rd/API/programs/'.$what.'.php'))
|
||||
function __autoload($what)
|
||||
{
|
||||
include(_MINDSRC_.'/mind3rd/API/programs/'.$what.'.php');
|
||||
return true;
|
||||
}
|
||||
|
||||
// checking if the class is not a facad from the API
|
||||
if(strpos($what, 'API/')!==false)
|
||||
{
|
||||
$what= explode('/', $what);
|
||||
$classFile= array_pop($what);
|
||||
$what= str_replace('/', '\\', $what);
|
||||
$file= _MINDSRC_.'/mind3rd/API/facade/'.$classFile.".php";
|
||||
if(file_exists($file))
|
||||
{
|
||||
include($file);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// checking if the class is inside any of the autoload paths
|
||||
$dirs= Mind::$autoloadPaths;
|
||||
GLOBAL $_MIND;
|
||||
$what= preg_replace("/[ '\"\.\/]/", '', $what);
|
||||
$what= str_replace('\\', '/', $what);
|
||||
$what= str_replace('.', '', $what);
|
||||
|
||||
for($i=0; $i<sizeof($dirs); $i++)
|
||||
{
|
||||
if(file_exists($dirs[$i].$what.'.php'))
|
||||
if(file_exists(_MINDSRC_.'/mind3rd/API/programs/'.$what.'.php'))
|
||||
{
|
||||
require_once($dirs[$i].$what.'.php');
|
||||
include(_MINDSRC_.'/mind3rd/API/programs/'.$what.'.php');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// let's check if it is a language
|
||||
$langPath= _MINDSRC_.'/mind3rd/API/languages/'.$_MIND->defaults['default_human_languageName'].'/'.$what.'.php';
|
||||
if(file_exists($langPath))
|
||||
{
|
||||
require_once($langPath);
|
||||
return true;
|
||||
}
|
||||
// checking if the class is not a facad from the API
|
||||
if(strpos($what, 'API/')!==false)
|
||||
{
|
||||
$what= explode('/', $what);
|
||||
$classFile= array_pop($what);
|
||||
$what= str_replace('/', '\\', $what);
|
||||
$file= _MINDSRC_.'/mind3rd/API/facade/'.$classFile.".php";
|
||||
if(file_exists($file))
|
||||
{
|
||||
include($file);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// ok, if it's reached here...it didn't go well!
|
||||
echo " [ERROR] Class not found: ".$what."\n";
|
||||
return false;
|
||||
// checking if the class is inside any of the autoload paths
|
||||
$dirs= Mind::$autoloadPaths;
|
||||
|
||||
for($i=0; $i<sizeof($dirs); $i++)
|
||||
{
|
||||
if(file_exists($dirs[$i].$what.'.php'))
|
||||
{
|
||||
require_once($dirs[$i].$what.'.php');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// let's check if it is a language
|
||||
$langPath= _MINDSRC_.'/mind3rd/API/languages/'.
|
||||
$_MIND->defaults['default_human_languageName'].'/'.
|
||||
$what.'.php';
|
||||
|
||||
if(file_exists($langPath))
|
||||
{
|
||||
require_once($langPath);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ok, if it's reached here...it didn't go well!
|
||||
echo " [ERROR] Class not found: ".$what."\n";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
externo
+4
@@ -135,6 +135,10 @@ abstract class Setup {
|
||||
return self::$installationOk= $phpVsOk && $sqliteOk && $projectsDir && $sqliteDir && $apiDir;
|
||||
}
|
||||
|
||||
public static function isInstalled(){
|
||||
return file_exists('mind3rd/SQLite/mind');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the SQLite DataBase.
|
||||
*
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário