print $res; exit; } if ($action == "saveaccount") { $id = $_POST["account_id"]; if ($id == "") { $res = "Error "; print $res; exit; } $mg = mg_connect($config, "", "", ""); if ($mg) { $stmt = new mg_stmt_update($mg, "accounts"); $query = array("id" => intval($id)); $stmt->setQuery($query); $stmt->addColumnValue("name", $_POST["account_name"]); $stmt->addColumnValue("id_engine", intval($_POST["id_engine"])); $stmt->addColumnValue("id_target", intval($_POST["id_target"])); $stmt->execute(); $res = "Success "; } print $res; exit; } if ($action == "deleteaccount") { $id = $_POST["account_id"]; if ($id == "") { $res = "Error "; print $res; exit; }
<?php //============================================================================ // (c) 2009-2010, Eolya - All Rights Reserved. // This source code is the property of Eolya. // The license applying to this source code is available at : // http://www.crawl-anywhere.com/licenses/ //============================================================================ if ($action == "stopsource" || $action == "pausesource" || $action == "resumesource") { $mg = mg_connect($config, "", "", ""); 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"; }
print $res; exit; } if ($action == "savetarget") { $id = $_POST["id"]; if ($id == "") { $res = "Error "; print $res; exit; } $mg = mg_connect($config, "", "", ""); if ($mg) { $stmt = new mg_stmt_update($mg, "targets"); $query = array("id" => intval($id)); $stmt->setQuery($query); $stmt->addColumnValue("name", $_POST["name"]); $stmt->addColumnValue("id_account", intval($_POST["id_account"])); $stmt->addColumnValue("target_type", $_POST["target_type"]); $stmt->addColumnValue("target_parameters", $_POST["target_parameters"]); $stmt->addColumnValue("queue_dir", $_POST["queue_dir"]); $stmt->execute(); $res = "Success "; } print $res; exit; } if ($action == "deletetarget") { $id = $_POST["id"]; if ($id == "") { $res = "Error "; print $res;
exit; } if ($action == "saveuser") { $id = $_POST["user_id"]; if ($id == "") { $res = "Error "; print $res; exit; } $mg = mg_connect($config, "", "", ""); if ($mg) { $stmt = new mg_stmt_update($mg, "users"); $query = array("id" => intval($id)); $stmt->setQuery($query); if ($_POST["user_level"] == "2") { $stmt->addColumnValue("id_account", 0); } else { if (isset($_POST["id_account"])) { $stmt->addColumnValue("id_account", intval($_POST["id_account"])); } } if (isset($_POST["user_password"]) && trim($_POST["user_password"] != "")) { $stmt->addColumnValue("user_password", trim($_POST["user_password"])); } if (isset($_POST["user_level"])) { $stmt->addColumnValue("user_level", $_POST["user_level"]); } if (isset($_POST["change_password"]) && trim($_POST["change_password"] == "1")) { if (isset($_POST["user_password"]) && trim($_POST["user_password"] != "") && $_POST["user_id"] == $user->getId()) { $stmt->addColumnValue("change_password_next_logon", "0"); } else {
} } if ($mode == 'insert') { $stmt = new mg_stmt_insert($mg, "sources", $mg_source_defaults); $stmt->addColumnValue("id_account", intval($id_account_current)); $stmt->addColumnValueDate("createtime"); $enabled = $status; } else { if ($strategy == 'skip') { continue; } $stmt = new mg_stmt_update($mg, "sources"); $stmt->setQuery($query); $enabled = (string) $item->enabled; } $stmt->addColumnValue("deleted", "0"); $stmt->addColumnValue("enabled", $enabled); if ($reset == "1") { $stmt->addColumnValue("crawl_mode", "2"); } else { $stmt->addColumnValue("crawl_mode", "0"); } $stmt->addColumnValue("crawl_firstcompleted", "0"); $stmt->addColumnValue("crawl_priority", $priority); $stmt->addColumnValueDate("crawl_nexttime"); $stmt->addColumnValue("crawl_process_status", "0"); $query = array("id" => intval($id_account_current)); mg_get_value($mg, "accounts", "id_target", $query, $id_target); if (!empty($id_target)) { $stmt->addColumnValue("id_target", intval($id_target)); }
print $res; exit; } if ($action == "saveengine") { $id = $_POST["engine_id"]; if ($id == "") { $res = "Error "; print $res; exit; } $mg = mg_connect($config, "", "", ""); if ($mg) { $stmt = new mg_stmt_update($mg, "engines"); $query = array("id" => intval($id)); $stmt->setQuery($query); $stmt->addColumnValue("name", $_POST["engine_name"]); $stmt->execute(); $res = "Success "; } print $res; exit; } if ($action == "deleteengine") { $id = $_POST["engine_id"]; if ($id == "") { $res = "Error "; print $res; exit; } $mg = mg_connect($config, "", "", ""); if ($mg) {
$stmt = new mg_stmt_insert($mg, "sources", $mg_source_defaults); $stmt->addColumnValue("id_account", intval($id_account_current)); $stmt->addColumnValueDate("createtime"); $enabled = $status; $import_update_fields = array(); } else { if ($strategy == 'skip') { continue; } $stmt = new mg_stmt_update($mg, "sources"); $stmt->setQuery($query); $enabled = (string) $item->enabled; $import_update_fields = array_map('trim', explode(',', $config->getDefault("sources.import_update_fields", ""))); } if (!empty($import_id_field) && strtolower($import_id_field) != 'name') { $stmt->addColumnValue("import_id", (string) $item->{$match}); } if (update_field("deleted", $import_update_fields)) { $stmt->addColumnValue("deleted", "0"); } if (update_field("enabled", $import_update_fields)) { $stmt->addColumnValue("enabled", $enabled); } if ($reset == "1") { $stmt->addColumnValue("crawl_mode", "2"); } else { $stmt->addColumnValue("crawl_mode", "0"); } if (update_field("crawl_firstcompleted", $import_update_fields)) { $stmt->addColumnValue("crawl_firstcompleted", "0"); }