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();
            $query = array('$and' => array(array("type" => "cnx"), array("id" => intval($rs["type"]))));
            mg_get_value($mg, "plugins", "class_php", $query, $class);
            $source = SourceFactory::createInstance($class, $config, $id_account_current, $mg, $aLanguages, $aCountries);
            $source->load($rs);