コード例 #1
0
                 foreach ($item->children() as $name => $data) {
                     if (!in_array($name, $ignore)) {
                         $d = (string) $data;
                         if ($name == 'params') {
                             $stmt->addColumnValue($name, base64_decode($d));
                         } else {
                             $stmt->addColumnValue($name, $d);
                         }
                     }
                 }
                 if ($mode == 'insert' && !$stmt->checkNotNull($mg_source_not_null)) {
                     $arr = array('status' => 'error');
                     //echo json_encode($arr);
                     //exit();
                 } else {
                     $rs = $stmt->execute();
                 }
             }
         }
         $arr = array('status' => 'success');
         echo json_encode($arr);
     } else {
         $arr = array('status' => 'error');
         $arr = array('message' => 'parsing');
         echo json_encode($arr);
     }
 } else {
     $err = $_FILES['import-dialog-form-file']['error'];
     $arr = array('status' => 'error');
     if ($err == 2) {
         $arr = array('message' => 'too big file');
コード例 #2
0
    if ($mg) {
        $stmt = new mg_stmt_update($mg, "sources");
        $query = array("id" => intval($_GET["id"]));
        $stmt->setQuery($query);
        if ($action == "stopsource") {
            $stmt->addColumnValue("crawl_process_status", "5");
        }
        if ($action == "pausesource") {
            $stmt->addColumnValue("crawl_process_status", "2");
        }
        if ($action == "resumesource") {
            $stmt->addColumnValue("crawl_process_status", "3");
            $stmt->addColumnValue("crawl_priority", "1");
        }
        $stmt->addColumnValueDate("crawl_nexttime");
        $stmt->execute();
        /*
        if (!$rs)
        {
        	$res = "Error";
        }
        else
        {
        	$res = "Success";
        }
        */
        $res = "Success";
    }
    print $res;
    exit;
}
コード例 #3
0
 private function login_internal($config, $name, $password)
 {
     $mg = mg_connect($config, "", "", "");
     if ($mg) {
         $stmt = new mg_stmt_select($mg, "users");
         $query_username = array('user_name' => $name);
         if (isset($password) && !empty($password)) {
             $query_password = array('$or' => array(array('user_password' => md5($password)), array('user_password' => $password)));
             $query = array('$and' => array($query_username, $query_password));
         } else {
             $query = $query_username;
         }
         $stmt->setQuery($query);
         $count = $stmt->execute();
         if ($count == 1) {
             $cursor = $stmt->getCursor();
             $rs = $cursor->getNext();
             $this->id = $rs["id"];
             $this->name = $rs["user_name"];
             $this->level = intval($rs["user_level"]);
             $this->id_account = $rs["id_account"];
             $this->change_password = $rs["change_password_next_logon"] == "1";
             // mise a jour login_lasttime
             $stmt = new mg_stmt_update($mg, "users");
             $stmt->addColumnValueDate("login_lasttime");
             $stmt->setQuery(array('id' => $this->id));
             $stmt->execute();
             return true;
         }
     }
     return false;
 }