Файл: RootPanel 1.7.0 FreeCode/RootPanel 1.7.0 FreeCode/cron5min.php
Строк: 138
<?
$full_home_path = dirname(__FILE__);
require_once($full_home_path.'/_rootload.php');
mconnect();
EnableLanguages(1);
if (!GetCurrentCurrency()) { print $_lang[ErrorGetCurrentCurrency]; mclose(); exit; }
@set_time_limit(0);
$company_name=GetSetting('company_name');
$company_url=GetSetting('company_url');
$billing_url=GetSetting('billing_url');
$support_url=GetSetting('support_url');
$manager_email=GetSetting('manager_email');
# Проверка статуса заявок на регистрацию доменов через started.ru
$domains = @mysql_query("select d.* from orders_domains as d, registrators as r where NOT(d.startedRequestId=0) and d.autoregby=r.id and r.type='started'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($domains) > 0) {
while ($domain = mysql_fetch_object($domains)) {
$user = GetUserById($domain->uid);
$registrator = GetRegistratorById($domain->autoregby);
$started_url = $registrator->url;
$started_user = $registrator->text1;
$started_password = $registrator->text2;
if ($started_url and $started_user and $started_password) {
$started = new STARTED;
$started->init($started_url,$started_user,$started_password);
$result = $started->checkDomainState($domain->startedRequestId);
if ($result[domainId] and $result[state] == "done") {
@mysql_query("update orders_domains set startedDomainId='$result[domainId]',startedRequestId='0',ns1='',ns2='',ns3='',ns4='',status=1 where id=$domain->id") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$tpl=GetTpl('email_touser_domain_create', $user->lang);
$subject=$tpl[subject]; $template=$tpl[template];
if ($subject and $template) {
$subject = str_replace('{domain}',$domain->domain,$subject);
$template = str_replace('{company_name}',$company_name,$template);
$template = str_replace('{company_url}',$company_url,$template);
$template = str_replace('{support_url}',$support_url,$template);
$template = str_replace('{domain}',$domain->domain,$template);
if ($domain->panel_url and $domain->panel_user) {
$template = str_replace('{panel}',"Control Panel:rnrnURL: $domain->panel_urlrnLogin: $domain->panel_userrnPassword: $domain->panel_pwdrnrn",$template);
} else {
$template = str_replace('{panel}',"",$template);
}
WriteMailLog($subject,$template,$user->id);
sendmail($user->email,$company_name,$manager_email,$subject,$template);
sendmail($user->email2,$company_name,$manager_email,$subject,$template);
}
} else if ($result[state] == "canceled") {
@mysql_query("update orders_domains set startedRequestId='0',autoregby='',panel_url='',panel_user='',panel_pwd='' where id=$domain->id") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
} else if (!$result[state]) {
$result[state] = "Ошибка при попытке получить статус заявки (".$started->error.")";
}
if ($result[state] != "done" and $result[state] != "new" and $result[state] != "processing" and $result[state] != "waiting" and $result[state] != "ready") {
if ($domain->startedSentStatus != $result[state]) {
@mysql_query("update orders_domains set startedSentStatus='$result[state]' where id=$domain->id") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$template = "Неудовлетворительный статус заявки по регистрации домена $domain->domain для пользователя $user->login через $registrator->namennСтатус заявки: ".$result[state]."rnrn--rnRootPanel";
$subject="Ошибка при проверке статуса регистрации домена";
$admEmails=GetAdminEmailsWhereTrueParam("senderror");
if (count($admEmails) > 0) {
WriteMailLog($subject,$template);
}
while (list($i,$em) = @each($admEmails)) {
sendmail($em,'',$manager_email,$subject,$template);
}
}
}
}
}
}
mclose();
?>