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; }
$res .= "</td>"; $res .= "</tr>"; } $res .= "</tbody></table></center>"; print $res; exit; } } if ($action == "showenqueued") { $mg = mg_connect($config, "", "", ""); if ($mg) { $stmt = new mg_stmt_select($mg, "sources"); //$stmt->setWhereClause("enabled = 1 and deleted = 0 and (crawl_process_status='' or crawl_process_status='0') and id_account = " . $id_account_current); $query = array('$and' => array(array(enabled => "1"), array(deleted => "0"), array(id_account => intval($id_account_current)), array('$or' => array(array(crawl_process_status => null), array(crawl_process_status => "0"))))); //$query = array('$and' => array(array(enabled => "1"), array(deleted => "0"))); $stmt->setQuery($query); $stmt->setSort(array("crawl_priority" => -1, "crawl_nexttime" => 1)); //$stmt->setSort(array( "crawl_nexttime" => 1 )); if ($limit != "0") { $stmt->setLimit($limit); } $count = $stmt->execute(); if ($count == 0) { print ""; exit; } $cursor = $stmt->getCursor(); $res .= "<center><table>"; $res .= "<tr><th>Title</th><th>Starting URL</th><th>Next crawl date</th><th class='priority'>Priority</th></tr><tbody>"; while ($cursor->hasNext()) { $rs = $cursor->getNext();
function getAvailableTargets($config, $account) { $aTargetsFinal = null; $mg = mg_connect($config, "", "", ""); if ($mg) { $stmt = new mg_stmt_select($mg, "targets"); $stmt->setFields(array("id" => "true", "name" => "true")); $query = array('$or' => array(array("id_account" => 0), array("id_account" => intval($account)))); $stmt->setQuery($query); $stmt->setSort(array("name" => 1)); $count = $stmt->execute(); if ($count > 0) { $aTargetsFinal = array(); $cursor = $stmt->getCursor(); while ($cursor->hasNext()) { $rs = $cursor->getNext(); $id = strtolower(trim($rs['id'])); $name = trim($rs['name']); $aTargetsFinal[$id] = $name; } } } return $aTargetsFinal; }