Файл: api_manager/cron.edit.php
Строк: 848
<?php
if (empty($_GET['elid'])) {
if (empty($_POST['submit'])) {
echo '<div class=content><img src="images/t-new.png" alt="." />Создание задания</div>';
echo '<form action="?func=cron.edit" method="post">';
echo '<div class=subhead>Команда: ';
echo '<input name="name" /></div>';
echo '<div class=subhead>Период: ';
echo '<select name="period">';
echo '<option value="hourly">каждый час</option>';
echo '<option value="daily">каждый день</option>';
echo '<option value="weekly">раз в неделю</option>';
echo '<option value="monthly">раз в месяц</option>';
echo '<option value="yearly">раз в год</option>';
echo '<option value="reboot"><img src=images/r_s.png> При перезагрузке</option>';
echo '<option value="custom">другое</option>';
echo '</select></div>';
echo '<div class=subhead>Другое:</div>';
echo '<div class=subhead>Минуты: ';
echo '<select name="crmin">';
echo '<option value="all">все</option>';
echo '<option value="every">каждые</option>';
echo '<option value="selected">указанные</option>';
echo '</select></div>';
echo '<div class=subhead>Каждые: ';
echo '<select name="evmin">';
echo '<option value="02">02</option>';
echo '<option value="03">03</option>';
echo '<option value="04">04</option>';
echo '<option value="05">05</option>';
echo '<option value="06">06</option>';
echo '<option value="07">07</option>';
echo '<option value="08">08</option>';
echo '<option value="09">09</option>';
echo '<option value="10">10</option>';
echo '<option value="11">11</option>';
echo '<option value="12">12</option>';
echo '<option value="13">13</option>';
echo '<option value="14">14</option>';
echo '<option value="15">15</option>';
echo '<option value="16">16</option>';
echo '<option value="17">17</option>';
echo '<option value="18">18</option>';
echo '<option value="19">19</option>';
echo '<option value="20">20</option>';
echo '<option value="21">21</option>';
echo '<option value="22">22</option>';
echo '<option value="23">23</option>';
echo '<option value="24">24</option>';
echo '<option value="25">25</option>';
echo '<option value="26">26</option>';
echo '<option value="27">27</option>';
echo '<option value="28">28</option>';
echo '<option value="29">29</option>';
echo '<option value="30">30</option>';
echo '</select></div>';
echo '<div class=subhead>Указанные: ';
echo '<input name="semin" /></div>';
echo '<div class=subhead>Часы: ';
echo '<select name="crhour">';
echo '<option value="all">все</option>';
echo '<option value="every">каждые</option>';
echo '<option value="selected">указанные</option>';
echo '</select></div>';
echo '<div class=subhead>Каждые: ';
echo '<select name="evhour">';
echo '<option value="02">02</option>';
echo '<option value="03">03</option>';
echo '<option value="04">04</option>';
echo '<option value="05">05</option>';
echo '<option value="06">06</option>';
echo '<option value="07">07</option>';
echo '<option value="08">08</option>';
echo '<option value="09">09</option>';
echo '<option value="10">10</option>';
echo '<option value="11">11</option>';
echo '<option value="12">12</option>';
echo '</select></div>';
echo '<div class=subhead>Указанные: ';
echo '<input name="sehour" /></div>';
echo '<div class=subhead>Дни месяца: ';
echo '<select name="crmday">';
echo '<option value="all">все</option>';
echo '<option value="every">каждые</option>';
echo '<option value="selected">указанные</option>';
echo '</select></div>';
echo '<div class=subhead>Каждые: ';
echo '<select name="evmday">';
echo '<option value="02">02</option>';
echo '<option value="03">03</option>';
echo '<option value="04">04</option>';
echo '<option value="05">05</option>';
echo '<option value="06">06</option>';
echo '<option value="07">07</option>';
echo '<option value="08">08</option>';
echo '<option value="09">09</option>';
echo '<option value="10">10</option>';
echo '<option value="11">11</option>';
echo '<option value="12">12</option>';
echo '<option value="13">13</option>';
echo '<option value="14">14</option>';
echo '<option value="15">15</option>';
echo '</select></div>';
echo '<div class=subhead>Указанные: ';
echo '<input name="semday" /></div>';
echo '<div class=subhead>Месяцы: ';
echo '<select name="crmonth">';
echo '<option value="all">все</option>';
echo '<option value="every">каждые</option>';
echo '<option value="selected">указанные</option>';
echo '</select></div>';
echo '<div class=subhead>Каждые: ';
echo '<select name="evmonth">';
echo '<option value="02">02</option>';
echo '<option value="03">03</option>';
echo '<option value="04">04</option>';
echo '<option value="05">05</option>';
echo '<option value="06">06</option>';
echo '</select></div>';
echo '<div class=subhead>Указанные: ';
echo '<input name="semonth" /></div>';
echo '<div class=subhead>Дни недели: ';
echo '<select name="crwday">';
echo '<option value="all">все</option>';
echo '<option value="every">каждые</option>';
echo '<option value="selected">указанные</option>';
echo '</select></div>';
echo '<div class=subhead>Каждые: ';
echo '<select name="evwday">';
echo '<option value="02">02</option>';
echo '<option value="03">03</option>';
echo '</select></div>';
echo '<div class=subhead>Указанные: ';
echo '<input name="sewday" /></div>';
echo '<div class=subhead><input type="checkbox" name="hideout" value="on" checked="checked" /> не посылать отчёт по e-mail</div>';
echo '<div class=subhead><input name="submit" type="submit" value="Создать" /></div>';
echo '</form>';
} else {
$hideout = isset($_POST['hideout'])?'on':'';
if ($_POST['period'] == 'custom') {
if ($_POST['crmin'] == 'all') {
$min = '*';
} elseif ($_POST['crmin'] == 'every') {
$min = '*/' . $_POST['evmin'];
} elseif ($_POST['crmin'] == 'selected') {
$min = $_POST['semin'];
}
if ($_POST['crhour'] == 'all') {
$hour = '*';
} elseif ($_POST['crhour'] == 'every') {
$hour = '*/' . $_POST['evhour'];
} elseif ($_POST['crhour'] == 'selected') {
$hour = $_POST['sehour'];
}
if ($_POST['crmday'] == 'all') {
$mday = '*';
} elseif ($_POST['crmday'] == 'every') {
$mday = '*/' . $_POST['evmday'];
} elseif ($_POST['crmday'] == 'selected') {
$mday = $_POST['semday'];
}
if ($_POST['crmonth'] == 'all') {
$month = '*';
} elseif ($_POST['crmonth'] == 'every') {
$month = '*/' . $_POST['evmonth'];
} elseif ($_POST['crmonth'] == 'selected') {
$month = $_POST['semonth'];
}
if ($_POST['crwday'] == 'all') {
$wday = '*';
} elseif ($_POST['crwday'] == 'every') {
$wday = '*/' . $_POST['evwday'];
} elseif ($_POST['crwday'] == 'selected') {
$wday = $_POST['sewday'];
}
$content = api_query('https://' . $server . '/manager/ispmgr?min=' . urlencode($min) . '&hour=' . urlencode($hour) . '&mday=' . urlencode($mday) . '&month=' . urlencode($month) . '&wday=' . urlencode($wday) . '&period=' . urlencode($_POST['period']) . '&name=' . urlencode($_POST['name']) . '&hideout=' . $hideout . '&func=cron.edit&sok=ok&out=xml&authinfo=' . $user['isp_login'] . ':' . $user['isp_paswd']);
} else {
$content = api_query('https://' . $server . '/manager/ispmgr?period=' . urlencode($_POST['period']) . '&name=' . urlencode($_POST['name']) . '&hideout=' . $hideout . '&func=cron.edit&sok=ok&out=xml&authinfo=' . $user['isp_login'] . ':' . $user['isp_paswd']);
}
$parse_xml = simplexml_load_string($content);
if (isset($parse_xml->ok)) {
echo '<div class=erors>Задание данных успешно создано! ';
echo '</div><a class=subhead href="?func=cron"><img src=images/r_s.png> Продолжить</a>';
} else {
echo '<div class=erors>Ошибка при создании задания! ';
echo '</div><a class=subhead href="?func=cron"><img src=images/r_s.png> Продолжить</a>';
}
}
} else {
if (empty($_POST['submit'])) {
$content = api_query('https://' . $server . '/manager/ispmgr?func=cron.edit&elid=' . urlencode($_GET['elid']) . '&out=xml&authinfo=' . $user['isp_login'] . ':' . $user['isp_paswd']);
$parse_xml = simplexml_load_string($content);
echo ' <div class=content><img src="images/t-edit.png" alt="." />Изменение задания</div>';
echo '<form action="?func=cron.edit&elid=' . urlencode($_GET['elid']) . '" method="post">';
echo '<div class=subhead>Команда: ';
echo '<input name="name" value="' . htmlentities((string)$parse_xml->name, ENT_QUOTES, 'UTF-8') . '" /></div>';
echo '<div class=subhead>Период: ';
echo '<select name="period">';
echo '<option value="hourly"';
if ((string)$parse_xml->period == 'hourly') {
echo ' selected="selected"';
}
echo '>каждый час</option>';
echo '<option value="daily"';
if ((string)$parse_xml->period == 'daily') {
echo ' selected="selected"';
}
echo '>каждый день</option>';
echo '<option value="weekly"';
if ((string)$parse_xml->period == 'weekly') {
echo ' selected="selected"';
}
echo '>раз в неделю</option>';
echo '<option value="monthly"';
if ((string)$parse_xml->period == 'monthly') {
echo ' selected="selected"';
}
echo '>раз в месяц</option>';
echo '<option value="yearly"';
if ((string)$parse_xml->period == 'yearly') {
echo ' selected="selected"';
}
echo '>раз в год</option>';
echo '<option value="reboot"';
if ((string)$parse_xml->period == 'reboot') {
echo ' selected="selected"';
}
echo '>при перезагрузке</option>';
echo '<option value="custom"';
if ((string)$parse_xml->period == 'custom') {
echo ' selected="selected"';
}
echo '>другое</option>';
echo '</select></div>';
echo '<div class=subhead>Другое:</div>';
echo '<div class=subhead>Минуты: ';
echo '<select name="crmin">';
echo '<option value="all"';
if (substr((string)$parse_xml->min, 0, 1) == '*' and substr((string)$parse_xml->min, 1, 1) <> '/' and (string)$parse_xml->period == 'custom') {
echo ' selected="selected"';
}
echo '>все</option>';
echo '<option value="every"';
if (substr((string)$parse_xml->min, 0, 1) == '*' and substr((string)$parse_xml->min, 1, 1) == '/' and (string)$parse_xml->period == 'custom') {
$evmin = true;
echo ' selected="selected"';
}
echo '>каждые</option>';
echo '<option value="selected"';
if (substr((string)$parse_xml->min, 0, 1) <> '*' and substr((string)$parse_xml->min, 1, 1) <> '/' and (string)$parse_xml->period == 'custom') {
$semin = true;
echo ' selected="selected"';
}
echo '>указанные</option>';
echo '</select></div>';
echo '<div class=subhead>Каждые: ';
echo '<select name="evmin">';
echo '<option value="02"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '02') {
echo ' selected="selected"';
}
echo '>02</option>';
echo '<option value="03"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '03') {
echo ' selected="selected"';
}
echo '>03</option>';
echo '<option value="04"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '04') {
echo ' selected="selected"';
}
echo '>04</option>';
echo '<option value="05"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '05') {
echo ' selected="selected"';
}
echo '>05</option>';
echo '<option value="06"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '06') {
echo ' selected="selected"';
}
echo '>06</option>';
echo '<option value="07"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '07') {
echo ' selected="selected"';
}
echo '>07</option>';
echo '<option value="08"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '08') {
echo ' selected="selected"';
}
echo '>08</option>';
echo '<option value="09"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '09') {
echo ' selected="selected"';
}
echo '>09</option>';
echo '<option value="10"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '10') {
echo ' selected="selected"';
}
echo '>10</option>';
echo '<option value="11"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '11') {
echo ' selected="selected"';
}
echo '>11</option>';
echo '<option value="12"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '12') {
echo ' selected="selected"';
}
echo '>12</option>';
echo '<option value="13"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '13') {
echo ' selected="selected"';
}
echo '>13</option>';
echo '<option value="14"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '14') {
echo ' selected="selected"';
}
echo '>14</option>';
echo '<option value="15"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '15') {
echo ' selected="selected"';
}
echo '>15</option>';
echo '<option value="16"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '16') {
echo ' selected="selected"';
}
echo '>16</option>';
echo '<option value="17"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '17') {
echo ' selected="selected"';
}
echo '>17</option>';
echo '<option value="18"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '18') {
echo ' selected="selected"';
}
echo '>18</option>';
echo '<option value="19"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '19') {
echo ' selected="selected"';
}
echo '>19</option>';
echo '<option value="20"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '20') {
echo ' selected="selected"';
}
echo '>20</option>';
echo '<option value="21"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '21') {
echo ' selected="selected"';
}
echo '>21</option>';
echo '<option value="22"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '22') {
echo ' selected="selected"';
}
echo '>22</option>';
echo '<option value="23"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '23') {
echo ' selected="selected"';
}
echo '>23</option>';
echo '<option value="24"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '24') {
echo ' selected="selected"';
}
echo '>24</option>';
echo '<option value="25"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '25') {
echo ' selected="selected"';
}
echo '>25</option>';
echo '<option value="26"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '26') {
echo ' selected="selected"';
}
echo '>26</option>';
echo '<option value="27"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '27') {
echo ' selected="selected"';
}
echo '>27</option>';
echo '<option value="28"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '28') {
echo ' selected="selected"';
}
echo '>28</option>';
echo '<option value="29"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '29') {
echo ' selected="selected"';
}
echo '>29</option>';
echo '<option value="30"';
if (isset($evmin) and substr((string)$parse_xml->min, 2) == '30') {
echo ' selected="selected"';
}
echo '>30</option>';
echo '</select></div>';
echo '<div class=subhead>Указанные: ';
echo '<input name="semin"';
if (isset($semin)) {
echo ' value="' . substr((string)$parse_xml->min, 2) . '"';
}
echo ' /></div>';
echo '<div class=subhead>Часы: ';
echo '<select name="crhour">';
echo '<option value="all"';
if (substr((string)$parse_xml->hour, 0, 1) == '*' and substr((string)$parse_xml->hour, 1, 1) <> '/' and (string)$parse_xml->period == 'custom') {
echo ' selected="selected"';
}
echo '>все</option>';
echo '<option value="every"';
if (substr((string)$parse_xml->hour, 0, 1) == '*' and substr((string)$parse_xml->hour, 1, 1) == '/' and (string)$parse_xml->period == 'custom') {
$evhour = true;
echo ' selected="selected"';
}
echo '>каждые</option>';
echo '<option value="selected"';
if (substr((string)$parse_xml->hour, 0, 1) <> '*' and substr((string)$parse_xml->hour, 1, 1) <> '/' and (string)$parse_xml->period == 'custom') {
$sehour = true;
echo ' selected="selected"';
}
echo '>указанные</option>';
echo '</select></div>';
echo '<div class=subhead>Каждые: ';
echo '<select name="evhour">';
echo '<option value="02"';
if (isset($evhour) and substr((string)$parse_xml->hour, 2) == '02') {
echo ' selected="selected"';
}
echo '>02</option>';
echo '<option value="03"';
if (isset($evhour) and substr((string)$parse_xml->hour, 2) == '03') {
echo ' selected="selected"';
}
echo '>03</option>';
echo '<option value="04"';
if (isset($evhour) and substr((string)$parse_xml->hour, 2) == '04') {
echo ' selected="selected"';
}
echo '>04</option>';
echo '<option value="05"';
if (isset($evhour) and substr((string)$parse_xml->hour, 2) == '05') {
echo ' selected="selected"';
}
echo '>05</option>';
echo '<option value="06"';
if (isset($evhour) and substr((string)$parse_xml->hour, 2) == '06') {
echo ' selected="selected"';
}
echo '>06</option>';
echo '<option value="07"';
if (isset($evhour) and substr((string)$parse_xml->hour, 2) == '07') {
echo ' selected="selected"';
}
echo '>07</option>';
echo '<option value="08"';
if (isset($evhour) and substr((string)$parse_xml->hour, 2) == '08') {
echo ' selected="selected"';
}
echo '>08</option>';
echo '<option value="09"';
if (isset($evhour) and substr((string)$parse_xml->hour, 2) == '09') {
echo ' selected="selected"';
}
echo '>09</option>';
echo '<option value="10"';
if (isset($evhour) and substr((string)$parse_xml->hour, 2) == '10') {
echo ' selected="selected"';
}
echo '>10</option>';
echo '<option value="11"';
if (isset($evhour) and substr((string)$parse_xml->hour, 2) == '11') {
echo ' selected="selected"';
}
echo '>11</option>';
echo '<option value="12"';
if (isset($evhour) and substr((string)$parse_xml->hour, 2) == '12') {
echo ' selected="selected"';
}
echo '>12</option>';
echo '</select></div>';
echo '<div class=subhead>Указанные: ';
echo '<input name="sehour"';
if (isset($sehour)) {
echo ' value="' . substr((string)$parse_xml->hour, 2) . '"';
}
echo ' /></div>';
echo '<div class=subhead>Дни месяца: ';
echo '<select name="crmday">';
echo '<option value="all"';
if (substr((string)$parse_xml->mday, 0, 1) == '*' and substr((string)$parse_xml->mday, 1, 1) <> '/' and (string)$parse_xml->period == 'custom') {
echo ' selected="selected"';
}
echo '>все</option>';
echo '<option value="every"';
if (substr((string)$parse_xml->mday, 0, 1) == '*' and substr((string)$parse_xml->mday, 1, 1) == '/' and (string)$parse_xml->period == 'custom') {
$evmday = true;
echo ' selected="selected"';
}
echo '>каждые</option>';
echo '<option value="selected"';
if (substr((string)$parse_xml->mday, 0, 1) <> '*' and substr((string)$parse_xml->mday, 1, 1) <> '/' and (string)$parse_xml->period == 'custom') {
$semday = true;
echo ' selected="selected"';
}
echo '>указанные</option>';
echo '</select></div>';
echo '<div class=subhead>Каждые: ';
echo '<select name="evmday">';
echo '<option value="02"';
if (isset($evmday) and substr((string)$parse_xml->mday, 2) == '02') {
echo ' selected="selected"';
}
echo '>02</option>';
echo '<option value="03"';
if (isset($evmday) and substr((string)$parse_xml->mday, 2) == '03') {
echo ' selected="selected"';
}
echo '>03</option>';
echo '<option value="04"';
if (isset($evmday) and substr((string)$parse_xml->mday, 2) == '04') {
echo ' selected="selected"';
}
echo '>04</option>';
echo '<option value="05"';
if (isset($evmday) and substr((string)$parse_xml->mday, 2) == '05') {
echo ' selected="selected"';
}
echo '>05</option>';
echo '<option value="06"';
if (isset($evmday) and substr((string)$parse_xml->mday, 2) == '06') {
echo ' selected="selected"';
}
echo '>06</option>';
echo '<option value="07"';
if (isset($evmday) and substr((string)$parse_xml->mday, 2) == '07') {
echo ' selected="selected"';
}
echo '>07</option>';
echo '<option value="08"';
if (isset($evmday) and substr((string)$parse_xml->mday, 2) == '08') {
echo ' selected="selected"';
}
echo '>08</option>';
echo '<option value="09"';
if (isset($evmday) and substr((string)$parse_xml->mday, 2) == '09') {
echo ' selected="selected"';
}
echo '>09</option>';
echo '<option value="10"';
if (isset($evmday) and substr((string)$parse_xml->mday, 2) == '10') {
echo ' selected="selected"';
}
echo '>10</option>';
echo '<option value="11"';
if (isset($evmday) and substr((string)$parse_xml->mday, 2) == '11') {
echo ' selected="selected"';
}
echo '>11</option>';
echo '<option value="12"';
if (isset($evmday) and substr((string)$parse_xml->mday, 2) == '12') {
echo ' selected="selected"';
}
echo '>12</option>';
echo '<option value="13"';
if (isset($evmday) and substr((string)$parse_xml->mday, 2) == '13') {
echo ' selected="selected"';
}
echo '>13</option>';
echo '<option value="14"';
if (isset($evmday) and substr((string)$parse_xml->mday, 2) == '14') {
echo ' selected="selected"';
}
echo '>14</option>';
echo '<option value="15"';
if (isset($evmday) and substr((string)$parse_xml->mday, 2) == '15') {
echo ' selected="selected"';
}
echo '>15</option>';
echo '</select></div>';
echo '<div class=subhead>Указанные: ';
echo '<input name="semday"';
if (isset($semday)) {
echo ' value="' . substr((string)$parse_xml->mday, 2) . '"';
}
echo ' /></div>';
echo '<div class=subhead>Месяцы: ';
echo '<select name="crmonth">';
echo '<option value="all"';
if (substr((string)$parse_xml->month, 0, 1) == '*' and substr((string)$parse_xml->month, 1, 1) <> '/' and (string)$parse_xml->period == 'custom') {
echo ' selected="selected"';
}
echo '>все</option>';
echo '<option value="every"';
if (substr((string)$parse_xml->month, 0, 1) == '*' and substr((string)$parse_xml->month, 1, 1) == '/' and (string)$parse_xml->period == 'custom') {
$evmonth = true;
echo ' selected="selected"';
}
echo '>каждые</option>';
echo '<option value="selected"';
if (substr((string)$parse_xml->month, 0, 1) <> '*' and substr((string)$parse_xml->month, 1, 1) <> '/' and (string)$parse_xml->period == 'custom') {
$semonth = true;
echo ' selected="selected"';
}
echo '>указанные</option>';
echo '</select></div>';
echo '<div class=subhead>Каждые: ';
echo '<select name="evmonth">';
echo '<option value="02"';
if (isset($evmonth) and substr((string)$parse_xml->month, 2) == '02') {
echo ' selected="selected"';
}
echo '>02</option>';
echo '<option value="03"';
if (isset($evmonth) and substr((string)$parse_xml->month, 2) == '03') {
echo ' selected="selected"';
}
echo '>03</option>';
echo '<option value="04"';
if (isset($evmonth) and substr((string)$parse_xml->month, 2) == '04') {
echo ' selected="selected"';
}
echo '>04</option>';
echo '<option value="05"';
if (isset($evmonth) and substr((string)$parse_xml->month, 2) == '05') {
echo ' selected="selected"';
}
echo '>05</option>';
echo '<option value="06"';
if (isset($evmonth) and substr((string)$parse_xml->month, 2) == '06') {
echo ' selected="selected"';
}
echo '>06</option>';
echo '</select></div>';
echo '<div class=subhead>Указанные: ';
echo '<input name="semonth"';
if (isset($semonth)) {
echo ' value="' . substr((string)$parse_xml->month, 2) . '"';
}
echo ' /></div>';
echo '<div class=subhead>Дни недели: ';
echo '<select name="crwday">';
echo '<option value="all"';
if (substr((string)$parse_xml->wday, 0, 1) == '*' and substr((string)$parse_xml->wday, 1, 1) <> '/' and (string)$parse_xml->period == 'custom') {
echo ' selected="selected"';
}
echo '>все</option>';
echo '<option value="every"';
if (substr((string)$parse_xml->wday, 0, 1) == '*' and substr((string)$parse_xml->wday, 1, 1) == '/' and (string)$parse_xml->period == 'custom') {
$evwday = true;
echo ' selected="selected"';
}
echo '>каждые</option>';
echo '<option value="selected"';
if (substr((string)$parse_xml->wday, 0, 1) <> '*' and substr((string)$parse_xml->wday, 1, 1) <> '/' and (string)$parse_xml->period == 'custom') {
$sewday = true;
echo ' selected="selected"';
}
echo '>указанные</option>';
echo '</select></div>';
echo '<div class=subhead>Каждые: ';
echo '<select name="evwday">';
echo '<option value="02"';
if (isset($evwday) and substr((string)$parse_xml->wday, 2) == '02') {
echo ' selected="selected"';
}
echo '>02</option>';
echo '<option value="03"';
if (isset($evwday) and substr((string)$parse_xml->wday, 2) == '03') {
echo ' selected="selected"';
}
echo '>03</option>';
echo '</select></div>';
echo '<div class=subhead>Указанные: ';
echo '<input name="sewday"';
if (isset($sewday)) {
echo ' value="' . substr((string)$parse_xml->wday, 2) . '"';
}
echo ' /></div>';
echo '<div class=subhead><input type="checkbox" name="hideout" value="on"';
if (isset($parse_xml->hideout)) {
echo ' checked="checked"';
}
echo ' /> не посылать отчёт по e-mail</div>';
echo '<div class=subhead><input name="submit" type="submit" value="Изменить" /></div>';
echo '</form>';
} else {
$hideout = isset($_POST['hideout'])?'on':'';
if ($_POST['period'] == 'custom') {
if ($_POST['crmin'] == 'all') {
$min = '*';
} elseif ($_POST['crmin'] == 'every') {
$min = '*/' . $_POST['evmin'];
} elseif ($_POST['crmin'] == 'selected') {
$min = $_POST['semin'];
}
if ($_POST['crhour'] == 'all') {
$hour = '*';
} elseif ($_POST['crhour'] == 'every') {
$hour = '*/' . $_POST['evhour'];
} elseif ($_POST['crhour'] == 'selected') {
$hour = $_POST['sehour'];
}
if ($_POST['crmday'] == 'all') {
$mday = '*';
} elseif ($_POST['crmday'] == 'every') {
$mday = '*/' . $_POST['evmday'];
} elseif ($_POST['crmday'] == 'selected') {
$mday = $_POST['semday'];
}
if ($_POST['crmonth'] == 'all') {
$month = '*';
} elseif ($_POST['crmonth'] == 'every') {
$month = '*/' . $_POST['evmonth'];
} elseif ($_POST['crmonth'] == 'selected') {
$month = $_POST['semonth'];
}
if ($_POST['crwday'] == 'all') {
$wday = '*';
} elseif ($_POST['crwday'] == 'every') {
$wday = '*/' . $_POST['evwday'];
} elseif ($_POST['crwday'] == 'selected') {
$wday = $_POST['sewday'];
}
$content = api_query('https://' . $server . '/manager/ispmgr?elid=' . urlencode($_GET['elid']) . '&min=' . urlencode($min) . '&hour=' . urlencode($hour) . '&mday=' . urlencode($mday) . '&month=' . urlencode($month) . '&wday=' . urlencode($wday) . '&period=' . urlencode($_POST['period']) . '&name=' . urlencode($_POST['name']) . '&hideout=' . $hideout . '&func=cron.edit&sok=ok&out=xml&authinfo=' . $user['isp_login'] . ':' . $user['isp_paswd']);
} else {
$content = api_query('https://' . $server . '/manager/ispmgr?elid=' . urlencode($_GET['elid']) . '&period=' . urlencode($_POST['period']) . '&name=' . urlencode($_POST['name']) . '&hideout=' . $hideout . '&func=cron.edit&sok=ok&out=xml&authinfo=' . $user['isp_login'] . ':' . $user['isp_paswd']);
}
$parse_xml = simplexml_load_string($content);
if (isset($parse_xml->ok)) {
echo '<div class=erors>Задание данных успешно изменено! ';
echo '</div><a class=subhead href="?func=cron"><img src=images/r_s.png> Продолжить</a>';
} else {
echo '<div class=erors>Ошибка при изменении задания! ';
echo '</div><a class=subhead href="?func=cron"><img src=images/r_s.png> Продолжить</a>';
}
}
}
?>