<?
$NETCAT_FOLDER = join(strstr(__FILE__, "/") ? "/" : "\\", array_slice(preg_split("/[\/\\\]+/", __FILE__), 0, -4)) . (strstr(__FILE__, "/") ? "/" : "\\");
include_once($NETCAT_FOLDER . "vars.inc.php");
require_once($ADMIN_FOLDER . "function.inc.php");
require_once($ADMIN_FOLDER . "modules/ui.php");
BeginHtml();


$nc_core = nc_core();

// Активировать модуль
if ($nc_core->db->query("UPDATE `Module` SET `Inside_Admin` = 1, `Installed` = 1  WHERE `Keyword` = 'dashamail'")) {
  nc_print_status("Модуль успешно установлен. Перезагрузите страницу", "ok");
}

// Добавить задачи в крон
if (!$nc_core->db->get_var("SELECT `Cron_ID` FROM `CronTasks` WHERE `Cron_Script_URL` LIKE '%/dashamail/cron_user_leave.php%'")) {
  $nc_core->db->query("INSERT INTO `CronTasks` SET `Cron_Minutes` = 1, `Cron_Hours` = 0, `Cron_Days` = 0, `Cron_Months` = 0, `Cron_Weekdays` = 0,`Cron_Script_URL` = '/netcat/modules/dashamail/cron_user_leave.php'");
}
if (!$nc_core->db->get_var("SELECT `Cron_ID` FROM `CronTasks` WHERE `Cron_Script_URL` LIKE '%/dashamail/cron_autoimport.php%'")) {
  $nc_core->db->query("INSERT INTO `CronTasks` SET `Cron_Minutes` = 10, `Cron_Hours` = 0, `Cron_Days` = 0, `Cron_Months` = 0, `Cron_Weekdays` = 0,`Cron_Script_URL` = '/netcat/modules/dashamail/cron_autoimport.php'");
}


EndHtml();
