示例#1
0
 /**
  * Constructor
  */
 public function Mind()
 {
     $path = _MINDSRC_;
     $this->about = parse_ini_file($path . '/mind3rd/env/about.ini');
     $this->defaults = parse_ini_file($path . '/mind3rd/env/defaults.ini');
     $this->conf = parse_ini_file($path . '/mind3rd/env/mind.ini');
     include $path . '/mind3rd/API/L10N/' . $this->defaults['defaul_human_language'] . '.php';
     Mind::$l10n = new $this->defaults['defaul_human_language']();
 }
示例#2
0
 private function runStep2()
 {
     if (!($db = new SQLiteDatabase(_MINDSRC_ . '/mind3rd/SQLite/mind'))) {
         Mind::message('Database', '[Fail]');
         return false;
     }
     Mind::message('Database', '[OK]');
     return true;
 }
示例#3
0
文件: En.php 项目: jaydson/theWebMind
    public function __construct()
    {
        $this->messages['programRequired'] = Mind::message("API: You must send the program name, to execute", '[Fail]', false);
        $this->messages['loginRequired'] = Mind::message("Auth: Both login and password are required", '[Fail]', false);
        $this->messages['passwordRequired'] = "I need a password for this user, please: ";
        $this->messages['autenticated'] = Mind::message("\nMain: %s autenticated", "[OK]", false);
        //"\n[OK] %s autenticated\n";
        $this->messages['not_allowed'] = Mind::message("\nMain: You have not autenticated your credentials yet", '[Fail]', false);
        $this->messages['not_allowed_tip'] = "Try calling the command\n    auth < login >\nA password will be required.\n";
        $this->messages['no_such_file'] = Mind::message("\nMain: No such command '%s'", "[Fail]", false);
        $this->messages['auth_fail'] = Mind::message("\nAuth: Wrong user or password", "[Fail]", false);
        $this->messages['bye'] = "Logging out...\n";
        $this->messages['http_invalid_requisition'] = <<<MESSAGE
   Invalid HTTP requisition.
   You *must* send some POST data acoording your request, and also a variable "program" by post, with the name of the program you want to run.
MESSAGE;
    }
示例#4
0
 private function action()
 {
     if ($db = new SQLiteDatabase(_MINDSRC_ . '/mind3rd/SQLite/mind')) {
         $result = $db->query("SELECT * FROM user where login='******' AND pwd='" . sha1($this->pwd) . "' AND status= 'A'");
         $row = false;
         while ($result->valid()) {
             $row = $result->current();
             $_SESSION['auth'] = JSON_encode($row);
             $_SESSION['login'] = $row['login'];
             break;
         }
         if (!$row) {
             Mind::write('auth_fail', true);
             return false;
         }
     } else {
         die('Database not found!');
     }
     return $this;
 }
示例#5
0
<?php

/**
 * This is the server file which will receive the requisition
 * All the HTTP requests are goning to reach this file, so,
 * it will treat the POST data before routing the requisition
 * With this, you can send by post, the program variable, saying
 * the program you want to execute, and the parameters you want
 * to pass
 */
if (!isset($_REQ)) {
    Mind::write("http_invalid_requisition");
    exit;
}
if (!isset($_REQ['data'])) {
    $_REQ['data'] = array();
}
foreach ($_POST as $k => $value) {
    $_REQ['data'][$k] = preg_replace("/['\"\\\\.\\/]/", '', $value);
}
if (isset($app)) {
    if (!isset($_REQ['data']) || !isset($_REQ['data']['program'])) {
        Mind::write('programRequired');
        return false;
    }
    $program = $app->findCommand($_REQ['data']['program']);
    $program = $program->getFileName();
    $program = new $program();
    $program->HTTPExecute();
}
示例#6
0
 private function action()
 {
     session_destroy();
     Mind::write('bye');
     return $this;
 }