diff --git a/mind3rd/API/Lobe/Neuron.php b/mind3rd/API/Lobe/Neuron.php index 81ee75b..c69773c 100755 --- a/mind3rd/API/Lobe/Neuron.php +++ b/mind3rd/API/Lobe/Neuron.php @@ -20,7 +20,7 @@ abstract class Neuron { public static function listLobes() { $list= Array(); - $d = dir(\theos\ProjectFileManager::getLobesDir()); + $d = dir(\theos\Gosh::getLobesDir()); while (false !== ($entry = $d->read())) { if($entry!= 'Neuron.php' && $entry[0] != '.') diff --git a/mind3rd/API/classes/MindLog.php b/mind3rd/API/classes/MindLog.php old mode 100644 new mode 100755 diff --git a/mind3rd/API/classes/MindProject.php b/mind3rd/API/classes/MindProject.php index 79d7e14..280c4f3 100755 --- a/mind3rd/API/classes/MindProject.php +++ b/mind3rd/API/classes/MindProject.php @@ -156,8 +156,10 @@ class MindProject extends VersionManager{ project.name as name from project_user, project - where fk_user= ".$user." - and fk_project = pk_project + where fk_project = pk_project + "; + if(!\API\User::isAdmin()) + $hasProject.= " and fk_user= ".$user." "; $data= $db->query($hasProject); return $data; diff --git a/mind3rd/API/classes/MindSpeaker.php b/mind3rd/API/classes/MindSpeaker.php index fc0b9e6..556fcd5 100755 --- a/mind3rd/API/classes/MindSpeaker.php +++ b/mind3rd/API/classes/MindSpeaker.php @@ -28,17 +28,25 @@ class MindSpeaker { $msg= Mind::message("L10N: Message $k does not exist", '[Fail]', false); } - if(!is_array($args)) + if(!is_array($args)){ $args= func_get_args(); + array_shift($args); + array_shift($args); // ugly, isn't it?! + } + $parms= ""; - if(sizeof($args)>2) + if(sizeof($args)>=1) { - for($i=2; $iquery("SELECT * from user where login = '".addslashes($login)."'"); + foreach($usrs as $k=>$usr) + { + $user= $usr; + break; + } + return $user; + } + /** * Retrieves the list of users. * @param boolean $detailed diff --git a/mind3rd/API/languages/en/ignore.list b/mind3rd/API/languages/en/ignore.list index 4506b78..2b3f06a 100755 --- a/mind3rd/API/languages/en/ignore.list +++ b/mind3rd/API/languages/en/ignore.list @@ -5,5 +5,12 @@ which whom whose well +we too -also \ No newline at end of file +also +I +you +they +he +she +it \ No newline at end of file diff --git a/mind3rd/API/languages/pt/ignore.list b/mind3rd/API/languages/pt/ignore.list index 78d60f9..f6fd88c 100755 --- a/mind3rd/API/languages/pt/ignore.list +++ b/mind3rd/API/languages/pt/ignore.list @@ -16,4 +16,14 @@ na mínimo máximo minimo -maximo \ No newline at end of file +maximo +eu +nós +nos +vocês +voces +eles +elas +ele +ela +tu \ No newline at end of file diff --git a/mind3rd/API/models/mind/sources/main.mnd b/mind3rd/API/models/mind/sources/main.mnd index 16d664d..c62c207 100755 --- a/mind3rd/API/models/mind/sources/main.mnd +++ b/mind3rd/API/models/mind/sources/main.mnd @@ -1,6 +1,6 @@ /** - * This is a model, created to ilustrate how and where + * This is a model, created to illustrate how and where * you can write your code - * You may have as many files as you want, altough, the + * You may have as many files as you want, although, the * main.mnd is required */ diff --git a/mind3rd/API/programs/Set.php b/mind3rd/API/programs/Set.php index 4303fb9..c938b18 100755 --- a/mind3rd/API/programs/Set.php +++ b/mind3rd/API/programs/Set.php @@ -39,12 +39,35 @@ public function executableFunction() { - if($this->whose == 'user') + $property= explode('.', $this->property); + if(sizeof($property) <= 1){ + //\MindSpeaker::write('wrongParam', $this->property); + \MindSpeaker::write('wrongParam', true, "property", $this->property); + return false; + } + $entity= $property[0]; + $property= $property[1]; + if($entity == 'user'){ + if($property == 'pwd' && !$this->extra){ + $this->prompt('pwd', "What will be the password?", true); + if($this->value) + $this->extra= $this->value; + $this->value= $this->answers['pwd']; + } + if($this->extra){ + \MindUser::set($property, $this->value, $this->extra); + }else{ + \MindUser::set($property, $this->value); + } + }else{ + \MindUser::set($property, $this->value); + } + /*if($this->whose == 'user') { $this->setUserData(); }else{ $this->setProjectData(); - } + }*/ } public function __construct() @@ -61,15 +84,15 @@ Where status may be 'A' or 'I', and type may be 'A' or 'N'") ->setAction('executableFunction'); - $this->addRequiredArgument('whose', - 'Who will suffer the update', - Array('user', 'project')); - $this->addRequiredArgument('attribute', - 'The attribute you will change'); + $this->addRequiredArgument('property', + 'Who will suffer the update. Use entity.property(eg. user.pwd'/*, + Array('user', 'project')*/); + /*$this->addRequiredArgument('attribute', + 'The attribute you will change');*/ $this->addOptionalArgument('value', - 'The value for that attribute(optional only for pwd)'); + 'The value for that attribute(optional for pwd)'); $this->addOptionalArgument('extra', - 'An extra data about the defined attribute(the status or type for users or projects)'); + 'An extra data about the defined attribute(eg. if admin, the user to be changed)'); $this->init(); } diff --git a/mind3rd/API/programs/Show.php b/mind3rd/API/programs/Show.php index afb3469..3de0423 100755 --- a/mind3rd/API/programs/Show.php +++ b/mind3rd/API/programs/Show.php @@ -33,7 +33,11 @@ EOT 'idioms', 'plugins', 'ddl', + 'source', 'info', + 'data', + 'props', + 'properties', 'lobes'); asort($opts); $this->addRequiredArgument('what', @@ -67,6 +71,35 @@ EOT $this->printMatrix($projectList); } break; + case 'data': + case 'props': + case 'properties': + //var_dump($_MIND); + $p= \Mind::$currentProject; + if($p){ + if($_REQ['env']=='http') + echo JSON_encode($p); + else{ + foreach($p as $k=>$v){ + if($k == 'database_user' || $k == 'database_pwd'){ + if(!\API\User::isAdmin()) + continue; + } + echo " ".str_pad($k, 16, " ").": ".$v."\n"; + } + } + }else{ + \MindSpeaker::write("currentProjectRequired"); + } + break; + case 'source': + $p= \Mind::$currentProject; + if($p){ + var_dump(\MindProject::loadSource()); + }else{ + \MindSpeaker::write("currentProjectRequired"); + } + break; case 'users': $users= $this->loadUsersList(); $userList= Array(); @@ -151,13 +184,23 @@ EOT MindPlugin::listPlugins($_REQ['env']!='http'); break; case 'idioms': - Mind::getIdiomsList(); + if($_REQ['env']=='http'){ + echo JSON_encode(Mind::getIdiomsList()); + }else{ + echo " ".implode(', ', Mind::getIdiomsList())."\n"; + } break; case 'ddl': - $ddls= $this->detailed? \API\Get::DecoratedDDL(): - \API\Get::DDL(); - foreach($ddls as $ddlCommand) - echo $ddlCommand; + $p= \Mind::$currentProject; + if($p){ + $ddls= $this->detailed? \API\Get::DecoratedDDL(): + \API\Get::DDL(); + foreach($ddls as $ddlCommand){ + echo $ddlCommand; + } + }else{ + \MindSpeaker::write("currentProjectRequired"); + } break; case 'lobes': echo implode("\n", \Lobe\Neuron::listLobes()); diff --git a/mind3rd/API/programs/who.php b/mind3rd/API/programs/who.php index 2071661..17b00c2 100755 --- a/mind3rd/API/programs/who.php +++ b/mind3rd/API/programs/who.php @@ -29,7 +29,7 @@ $this->setCommandName('who') ->setDescription("Show information about the currently logged used") ->setRestrict(true) - ->setHelp("Show information about the currently logged used") + ->setHelp("Show information about the currently logged used.\n used as $ who am i?") ->setAction(function($class){ $class->executableFunction(); });