View file ISP4Mobile/xrex/cron.edit.php

File size: 30.83Kb
<?php
### Decoded IonCube by pimnik98 
### Декодировал Пиминов Никита 
### vk.com/piminov_remont
### Заказать декодирование: https://bymas.ru/forum/viewtopic.php?topic_id=131647

echo '<div class="head">' . "\n" . '<div class="logo"> Панель управления</div>' . "\n" . '</div><div class="menu" style="text-align:right"><img src="images/lv-server.png" alt="." />' . $server . ' | ' . "\n";
echo '<img src="images/lv-5.png" alt="." />' . htmlentities($_SESSION['username'], ENT_QUOTES, 'UTF-8') . ' | ' . "\n";
echo '<img src="images/sb-logout.gif" alt="." /><a href="?func=exit">Выйти</a>' . "\n";
echo '<hr /></div><div class="menu">' . "\n";

if (empty($_GET['elid'])) {
	if (empty($_POST['submit'])) {
		echo '<img src="images/t-new.png" alt="." />Создание задания<br />' . "\n";
		echo '<br />' . "\n";
		echo '<form action="?func=cron.edit" method="post">' . "\n";
		echo 'Команда:<br />' . "\n";
		echo '<input name="name" /><br />' . "\n";
		echo 'Период:<br />' . "\n";
		echo '<select name="period">' . "\n";
		echo '<option value="hourly">каждый час</option>' . "\n";
		echo '<option value="daily">каждый день</option>' . "\n";
		echo '<option value="weekly">раз в неделю</option>' . "\n";
		echo '<option value="monthly">раз в месяц</option>' . "\n";
		echo '<option value="yearly">раз в год</option>' . "\n";
		echo '<option value="reboot">при перезагрузке</option>' . "\n";
		echo '<option value="custom">другое</option>' . "\n";
		echo '</select><br />' . "\n";
		echo '<br />' . "\n";
		echo 'Другое:<br />' . "\n";
		echo 'Минуты:<br />' . "\n";
		echo '<select name="crmin">' . "\n";
		echo '<option value="all">все</option>' . "\n";
		echo '<option value="every">каждые</option>' . "\n";
		echo '<option value="selected">указанные</option>' . "\n";
		echo '</select><br />' . "\n";
		echo 'Каждые:<br />' . "\n";
		echo '<select name="evmin">' . "\n";
		echo '<option value="02">02</option>' . "\n";
		echo '<option value="03">03</option>' . "\n";
		echo '<option value="04">04</option>' . "\n";
		echo '<option value="05">05</option>' . "\n";
		echo '<option value="06">06</option>' . "\n";
		echo '<option value="07">07</option>' . "\n";
		echo '<option value="08">08</option>' . "\n";
		echo '<option value="09">09</option>' . "\n";
		echo '<option value="10">10</option>' . "\n";
		echo '<option value="11">11</option>' . "\n";
		echo '<option value="12">12</option>' . "\n";
		echo '<option value="13">13</option>' . "\n";
		echo '<option value="14">14</option>' . "\n";
		echo '<option value="15">15</option>' . "\n";
		echo '<option value="16">16</option>' . "\n";
		echo '<option value="17">17</option>' . "\n";
		echo '<option value="18">18</option>' . "\n";
		echo '<option value="19">19</option>' . "\n";
		echo '<option value="20">20</option>' . "\n";
		echo '<option value="21">21</option>' . "\n";
		echo '<option value="22">22</option>' . "\n";
		echo '<option value="23">23</option>' . "\n";
		echo '<option value="24">24</option>' . "\n";
		echo '<option value="25">25</option>' . "\n";
		echo '<option value="26">26</option>' . "\n";
		echo '<option value="27">27</option>' . "\n";
		echo '<option value="28">28</option>' . "\n";
		echo '<option value="29">29</option>' . "\n";
		echo '<option value="30">30</option>' . "\n";
		echo '</select><br />' . "\n";
		echo 'Указанные:<br />' . "\n";
		echo '<input name="semin" /><br />' . "\n";
		echo 'Часы:<br />' . "\n";
		echo '<select name="crhour">' . "\n";
		echo '<option value="all">все</option>' . "\n";
		echo '<option value="every">каждые</option>' . "\n";
		echo '<option value="selected">указанные</option>' . "\n";
		echo '</select><br />' . "\n";
		echo 'Каждые:<br />' . "\n";
		echo '<select name="evhour">' . "\n";
		echo '<option value="02">02</option>' . "\n";
		echo '<option value="03">03</option>' . "\n";
		echo '<option value="04">04</option>' . "\n";
		echo '<option value="05">05</option>' . "\n";
		echo '<option value="06">06</option>' . "\n";
		echo '<option value="07">07</option>' . "\n";
		echo '<option value="08">08</option>' . "\n";
		echo '<option value="09">09</option>' . "\n";
		echo '<option value="10">10</option>' . "\n";
		echo '<option value="11">11</option>' . "\n";
		echo '<option value="12">12</option>' . "\n";
		echo '</select><br />' . "\n";
		echo 'Указанные:<br />' . "\n";
		echo '<input name="sehour" /><br />' . "\n";
		echo 'Дни месяца:<br />' . "\n";
		echo '<select name="crmday">' . "\n";
		echo '<option value="all">все</option>' . "\n";
		echo '<option value="every">каждые</option>' . "\n";
		echo '<option value="selected">указанные</option>' . "\n";
		echo '</select><br />' . "\n";
		echo 'Каждые:<br />' . "\n";
		echo '<select name="evmday">' . "\n";
		echo '<option value="02">02</option>' . "\n";
		echo '<option value="03">03</option>' . "\n";
		echo '<option value="04">04</option>' . "\n";
		echo '<option value="05">05</option>' . "\n";
		echo '<option value="06">06</option>' . "\n";
		echo '<option value="07">07</option>' . "\n";
		echo '<option value="08">08</option>' . "\n";
		echo '<option value="09">09</option>' . "\n";
		echo '<option value="10">10</option>' . "\n";
		echo '<option value="11">11</option>' . "\n";
		echo '<option value="12">12</option>' . "\n";
		echo '<option value="13">13</option>' . "\n";
		echo '<option value="14">14</option>' . "\n";
		echo '<option value="15">15</option>' . "\n";
		echo '</select><br />' . "\n";
		echo 'Указанные:<br />' . "\n";
		echo '<input name="semday" /><br />' . "\n";
		echo 'Месяцы:<br />' . "\n";
		echo '<select name="crmonth">' . "\n";
		echo '<option value="all">все</option>' . "\n";
		echo '<option value="every">каждые</option>' . "\n";
		echo '<option value="selected">указанные</option>' . "\n";
		echo '</select><br />' . "\n";
		echo 'Каждые:<br />' . "\n";
		echo '<select name="evmonth">' . "\n";
		echo '<option value="02">02</option>' . "\n";
		echo '<option value="03">03</option>' . "\n";
		echo '<option value="04">04</option>' . "\n";
		echo '<option value="05">05</option>' . "\n";
		echo '<option value="06">06</option>' . "\n";
		echo '</select><br />' . "\n";
		echo 'Указанные:<br />' . "\n";
		echo '<input name="semonth" /><br />' . "\n";
		echo 'Дни недели:<br />' . "\n";
		echo '<select name="crwday">' . "\n";
		echo '<option value="all">все</option>' . "\n";
		echo '<option value="every">каждые</option>' . "\n";
		echo '<option value="selected">указанные</option>' . "\n";
		echo '</select><br />' . "\n";
		echo 'Каждые:<br />' . "\n";
		echo '<select name="evwday">' . "\n";
		echo '<option value="02">02</option>' . "\n";
		echo '<option value="03">03</option>' . "\n";
		echo '</select><br />' . "\n";
		echo 'Указанные:<br />' . "\n";
		echo '<input name="sewday" /><br />' . "\n";
		echo '<input type="checkbox" name="hideout" value="on" checked="checked" /> не посылать отчёт по e-mail<br />' . "\n";
		echo '<input name="submit" type="submit" value="Создать" /><br />' . "\n";
		echo '</form>' . "\n";
		echo '<br />' . "\n";
		echo '<img src="images/t-back.png" alt=".." /><a href="?func=cron">Вернуться</a>' . "\n";
	}
	else {
		$hideout = (isset($_POST['hideout']) ? 'on' : '');

		if ($_POST['period'] == 'custom') {
			if ($_POST['crmin'] == 'all') {
				$min = '*';
			}
			else if ($_POST['crmin'] == 'every') {
				$min = '*/' . $_POST['evmin'];
			}
			else if ($_POST['crmin'] == 'selected') {
			}

			if ($_POST['crhour'] == 'all') {
				$hour = '*';
			}
			else if ($_POST['crhour'] == 'every') {
				$hour = '*/' . $_POST['evhour'];
			}
			else if ($_POST['crhour'] == 'selected') {
				$hour = $_POST['sehour'];
			}

			if ($_POST['crmday'] == 'all') {
				$mday = '*';
			}
			else if ($_POST['crmday'] == 'every') {
				$mday = '*/' . $_POST['evmday'];
			}
			else if ($_POST['crmday'] == 'selected') {
				$mday = $_POST['semday'];
			}

			if ($_POST['crmonth'] == 'all') {
				$month = '*';
			}
			else if ($_POST['crmonth'] == 'every') {
				$month = '*/' . $_POST['evmonth'];
			}
			else if ($_POST['crmonth'] == 'selected') {
				$month = $_POST['semonth'];
			}

			if ($_POST['crwday'] == 'all') {
				$wday = '*';
			}
			else if ($_POST['crwday'] == 'every') {
				$wday = '*/' . $_POST['evwday'];
			}
			else if ($_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=' . urlencode($_SESSION['username']) . ':' . urlencode($_SESSION['password']));
		}
		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=' . urlencode($_SESSION['username']) . ':' . urlencode($_SESSION['password']));
		}

		$parse_xml = simplexml_load_string($content);

		if (isset($parse_xml->ok)) {
			echo '<div style="text-align:center">' . "\n";
			echo 'Задание данных успешно создано!<br />' . "\n";
			echo '<a href="?func=cron">Продолжить&#187;</a>' . "\n";
			echo '</div>' . "\n";
		}
		else {
			echo '<div style="text-align:center">' . "\n";
			echo 'Ошибка при создании задания!<br />' . "\n";
			echo '<a href="?func=cron">Продолжить&#187;</a>' . "\n";
			echo '</div>' . "\n";
		}
	}
}
else if (empty($_POST['submit'])) {
	$content = api_query('https://' . $server . '/manager/ispmgr?func=cron.edit&elid=' . urlencode($_GET['elid']) . '&out=xml&authinfo=' . urlencode($_SESSION['username']) . ':' . urlencode($_SESSION['password']));
	$parse_xml = simplexml_load_string($content);
	echo '<img src="images/t-edit.png" alt="." />Изменение задания<br />' . "\n";
	echo '<br />' . "\n";
	echo '<form action="?func=cron.edit&amp;elid=' . urlencode($_GET['elid']) . '" method="post">' . "\n";
	echo 'Команда:<br />' . "\n";
	echo '<input name="name" value="' . htmlentities((string) $parse_xml->name, ENT_QUOTES, 'UTF-8') . '" /><br />' . "\n";
	echo 'Период:<br />' . "\n";
	echo '<select name="period">' . "\n";
	echo '<option value="hourly"';

	if ((string) $parse_xml->period == 'hourly') {
		echo ' selected="selected"';
	}

	echo '>каждый час</option>' . "\n";
	echo '<option value="daily"';

	if ((string) $parse_xml->period == 'daily') {
		echo ' selected="selected"';
	}

	echo '>каждый день</option>' . "\n";
	echo '<option value="weekly"';

	if ((string) $parse_xml->period == 'weekly') {
		echo ' selected="selected"';
	}

	echo '>раз в неделю</option>' . "\n";
	echo '<option value="monthly"';

	if ((string) $parse_xml->period == 'monthly') {
		echo ' selected="selected"';
	}

	echo '>раз в месяц</option>' . "\n";
	echo '<option value="yearly"';

	if ((string) $parse_xml->period == 'yearly') {
		echo ' selected="selected"';
	}

	echo '>раз в год</option>' . "\n";
	echo '<option value="reboot"';

	if ((string) $parse_xml->period == 'reboot') {
		echo ' selected="selected"';
	}

	echo '>при перезагрузке</option>' . "\n";
	echo '<option value="custom"';

	if ((string) $parse_xml->period == 'custom') {
		echo ' selected="selected"';
	}

	echo '>другое</option>' . "\n";
	echo '</select><br />' . "\n";
	echo '<br />' . "\n";
	echo 'Другое:<br />' . "\n";
	echo 'Минуты:<br />' . "\n";
	echo '<select name="crmin">' . "\n";
	echo '<option value="all"';

	if ((substr((string) $parse_xml->min, 0, 1) == '*') && (substr((string) $parse_xml->min, 1, 1) != '/') && ((string) $parse_xml->period == 'custom')) {
		echo ' selected="selected"';
	}

	echo '>все</option>' . "\n";
	echo '<option value="every"';

	if ((substr((string) $parse_xml->min, 0, 1) == '*') && (substr((string) $parse_xml->min, 1, 1) == '/') && ((string) $parse_xml->period == 'custom')) {
		$evmin = true;
		echo ' selected="selected"';
	}

	echo '>каждые</option>' . "\n";
	echo '<option value="selected"';

	if ((substr((string) $parse_xml->min, 0, 1) != '*') && (substr((string) $parse_xml->min, 1, 1) != '/') && ((string) $parse_xml->period == 'custom')) {
		$semin = true;
		echo ' selected="selected"';
	}

	echo '>указанные</option>' . "\n";
	echo '</select><br />' . "\n";
	echo 'Каждые:<br />' . "\n";
	echo '<select name="evmin">' . "\n";
	echo '<option value="02"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '02')) {
		echo ' selected="selected"';
	}

	echo '>02</option>' . "\n";
	echo '<option value="03"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '03')) {
		echo ' selected="selected"';
	}

	echo '>03</option>' . "\n";
	echo '<option value="04"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '04')) {
		echo ' selected="selected"';
	}

	echo '>04</option>' . "\n";
	echo '<option value="05"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '05')) {
		echo ' selected="selected"';
	}

	echo '>05</option>' . "\n";
	echo '<option value="06"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '06')) {
		echo ' selected="selected"';
	}

	echo '>06</option>' . "\n";
	echo '<option value="07"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '07')) {
		echo ' selected="selected"';
	}

	echo '>07</option>' . "\n";
	echo '<option value="08"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '08')) {
		echo ' selected="selected"';
	}

	echo '>08</option>' . "\n";
	echo '<option value="09"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '09')) {
		echo ' selected="selected"';
	}

	echo '>09</option>' . "\n";
	echo '<option value="10"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '10')) {
		echo ' selected="selected"';
	}

	echo '>10</option>' . "\n";
	echo '<option value="11"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '11')) {
		echo ' selected="selected"';
	}

	echo '>11</option>' . "\n";
	echo '<option value="12"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '12')) {
		echo ' selected="selected"';
	}

	echo '>12</option>' . "\n";
	echo '<option value="13"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '13')) {
		echo ' selected="selected"';
	}

	echo '>13</option>' . "\n";
	echo '<option value="14"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '14')) {
		echo ' selected="selected"';
	}

	echo '>14</option>' . "\n";
	echo '<option value="15"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '15')) {
		echo ' selected="selected"';
	}

	echo '>15</option>' . "\n";
	echo '<option value="16"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '16')) {
		echo ' selected="selected"';
	}

	echo '>16</option>' . "\n";
	echo '<option value="17"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '17')) {
		echo ' selected="selected"';
	}

	echo '>17</option>' . "\n";
	echo '<option value="18"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '18')) {
		echo ' selected="selected"';
	}

	echo '>18</option>' . "\n";
	echo '<option value="19"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '19')) {
		echo ' selected="selected"';
	}

	echo '>19</option>' . "\n";
	echo '<option value="20"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '20')) {
		echo ' selected="selected"';
	}

	echo '>20</option>' . "\n";
	echo '<option value="21"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '21')) {
		echo ' selected="selected"';
	}

	echo '>21</option>' . "\n";
	echo '<option value="22"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '22')) {
		echo ' selected="selected"';
	}

	echo '>22</option>' . "\n";
	echo '<option value="23"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '23')) {
		echo ' selected="selected"';
	}

	echo '>23</option>' . "\n";
	echo '<option value="24"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '24')) {
		echo ' selected="selected"';
	}

	echo '>24</option>' . "\n";
	echo '<option value="25"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '25')) {
		echo ' selected="selected"';
	}

	echo '>25</option>' . "\n";
	echo '<option value="26"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '26')) {
		echo ' selected="selected"';
	}

	echo '>26</option>' . "\n";
	echo '<option value="27"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '27')) {
		echo ' selected="selected"';
	}

	echo '>27</option>' . "\n";
	echo '<option value="28"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '28')) {
		echo ' selected="selected"';
	}

	echo '>28</option>' . "\n";
	echo '<option value="29"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '29')) {
		echo ' selected="selected"';
	}

	echo '>29</option>' . "\n";
	echo '<option value="30"';

	if (isset($evmin) && (substr((string) $parse_xml->min, 2) == '30')) {
		echo ' selected="selected"';
	}

	echo '>30</option>' . "\n";
	echo '</select><br />' . "\n";
	echo 'Указанные:<br />' . "\n";
	echo '<input name="semin"';

	if (isset($semin)) {
		echo ' value="' . substr((string) $parse_xml->min, 2) . '"';
	}

	echo ' /><br />' . "\n";
	echo 'Часы:<br />' . "\n";
	echo '<select name="crhour">' . "\n";
	echo '<option value="all"';

	if ((substr((string) $parse_xml->hour, 0, 1) == '*') && (substr((string) $parse_xml->hour, 1, 1) != '/') && ((string) $parse_xml->period == 'custom')) {
		echo ' selected="selected"';
	}

	echo '>все</option>' . "\n";
	echo '<option value="every"';

	if ((substr((string) $parse_xml->hour, 0, 1) == '*') && (substr((string) $parse_xml->hour, 1, 1) == '/') && ((string) $parse_xml->period == 'custom')) {
		$evhour = true;
		echo ' selected="selected"';
	}

	echo '>каждые</option>' . "\n";
	echo '<option value="selected"';

	if ((substr((string) $parse_xml->hour, 0, 1) != '*') && (substr((string) $parse_xml->hour, 1, 1) != '/') && ((string) $parse_xml->period == 'custom')) {
		$sehour = true;
		echo ' selected="selected"';
	}

	echo '>указанные</option>' . "\n";
	echo '</select><br />' . "\n";
	echo 'Каждые:<br />' . "\n";
	echo '<select name="evhour">' . "\n";
	echo '<option value="02"';

	if (isset($evhour) && (substr((string) $parse_xml->hour, 2) == '02')) {
		echo ' selected="selected"';
	}

	echo '>02</option>' . "\n";
	echo '<option value="03"';

	if (isset($evhour) && (substr((string) $parse_xml->hour, 2) == '03')) {
		echo ' selected="selected"';
	}

	echo '>03</option>' . "\n";
	echo '<option value="04"';

	if (isset($evhour) && (substr((string) $parse_xml->hour, 2) == '04')) {
		echo ' selected="selected"';
	}

	echo '>04</option>' . "\n";
	echo '<option value="05"';

	if (isset($evhour) && (substr((string) $parse_xml->hour, 2) == '05')) {
		echo ' selected="selected"';
	}

	echo '>05</option>' . "\n";
	echo '<option value="06"';

	if (isset($evhour) && (substr((string) $parse_xml->hour, 2) == '06')) {
		echo ' selected="selected"';
	}

	echo '>06</option>' . "\n";
	echo '<option value="07"';

	if (isset($evhour) && (substr((string) $parse_xml->hour, 2) == '07')) {
		echo ' selected="selected"';
	}

	echo '>07</option>' . "\n";
	echo '<option value="08"';

	if (isset($evhour) && (substr((string) $parse_xml->hour, 2) == '08')) {
		echo ' selected="selected"';
	}

	echo '>08</option>' . "\n";
	echo '<option value="09"';

	if (isset($evhour) && (substr((string) $parse_xml->hour, 2) == '09')) {
		echo ' selected="selected"';
	}

	echo '>09</option>' . "\n";
	echo '<option value="10"';

	if (isset($evhour) && (substr((string) $parse_xml->hour, 2) == '10')) {
		echo ' selected="selected"';
	}

	echo '>10</option>' . "\n";
	echo '<option value="11"';

	if (isset($evhour) && (substr((string) $parse_xml->hour, 2) == '11')) {
		echo ' selected="selected"';
	}

	echo '>11</option>' . "\n";
	echo '<option value="12"';

	if (isset($evhour) && (substr((string) $parse_xml->hour, 2) == '12')) {
		echo ' selected="selected"';
	}

	echo '>12</option>' . "\n";
	echo '</select><br />' . "\n";
	echo 'Указанные:<br />' . "\n";
	echo '<input name="sehour"';

	if (isset($sehour)) {
		echo ' value="' . substr((string) $parse_xml->hour, 2) . '"';
	}

	echo ' /><br />' . "\n";
	echo 'Дни месяца:<br />' . "\n";
	echo '<select name="crmday">' . "\n";
	echo '<option value="all"';

	if ((substr((string) $parse_xml->mday, 0, 1) == '*') && (substr((string) $parse_xml->mday, 1, 1) != '/') && ((string) $parse_xml->period == 'custom')) {
		echo ' selected="selected"';
	}

	echo '>все</option>' . "\n";
	echo '<option value="every"';

	if ((substr((string) $parse_xml->mday, 0, 1) == '*') && (substr((string) $parse_xml->mday, 1, 1) == '/') && ((string) $parse_xml->period == 'custom')) {
		$evmday = true;
		echo ' selected="selected"';
	}

	echo '>каждые</option>' . "\n";
	echo '<option value="selected"';

	if ((substr((string) $parse_xml->mday, 0, 1) != '*') && (substr((string) $parse_xml->mday, 1, 1) != '/') && ((string) $parse_xml->period == 'custom')) {
		$semday = true;
		echo ' selected="selected"';
	}

	echo '>указанные</option>' . "\n";
	echo '</select><br />' . "\n";
	echo 'Каждые:<br />' . "\n";
	echo '<select name="evmday">' . "\n";
	echo '<option value="02"';

	if (isset($evmday) && (substr((string) $parse_xml->mday, 2) == '02')) {
		echo ' selected="selected"';
	}

	echo '>02</option>' . "\n";
	echo '<option value="03"';

	if (isset($evmday) && (substr((string) $parse_xml->mday, 2) == '03')) {
		echo ' selected="selected"';
	}

	echo '>03</option>' . "\n";
	echo '<option value="04"';

	if (isset($evmday) && (substr((string) $parse_xml->mday, 2) == '04')) {
		echo ' selected="selected"';
	}

	echo '>04</option>' . "\n";
	echo '<option value="05"';

	if (isset($evmday) && (substr((string) $parse_xml->mday, 2) == '05')) {
		echo ' selected="selected"';
	}

	echo '>05</option>' . "\n";
	echo '<option value="06"';

	if (isset($evmday) && (substr((string) $parse_xml->mday, 2) == '06')) {
		echo ' selected="selected"';
	}

	echo '>06</option>' . "\n";
	echo '<option value="07"';

	if (isset($evmday) && (substr((string) $parse_xml->mday, 2) == '07')) {
		echo ' selected="selected"';
	}

	echo '>07</option>' . "\n";
	echo '<option value="08"';

	if (isset($evmday) && (substr((string) $parse_xml->mday, 2) == '08')) {
		echo ' selected="selected"';
	}

	echo '>08</option>' . "\n";
	echo '<option value="09"';

	if (isset($evmday) && (substr((string) $parse_xml->mday, 2) == '09')) {
		echo ' selected="selected"';
	}

	echo '>09</option>' . "\n";
	echo '<option value="10"';

	if (isset($evmday) && (substr((string) $parse_xml->mday, 2) == '10')) {
		echo ' selected="selected"';
	}

	echo '>10</option>' . "\n";
	echo '<option value="11"';

	if (isset($evmday) && (substr((string) $parse_xml->mday, 2) == '11')) {
		echo ' selected="selected"';
	}

	echo '>11</option>' . "\n";
	echo '<option value="12"';

	if (isset($evmday) && (substr((string) $parse_xml->mday, 2) == '12')) {
		echo ' selected="selected"';
	}

	echo '>12</option>' . "\n";
	echo '<option value="13"';

	if (isset($evmday) && (substr((string) $parse_xml->mday, 2) == '13')) {
		echo ' selected="selected"';
	}

	echo '>13</option>' . "\n";
	echo '<option value="14"';

	if (isset($evmday) && (substr((string) $parse_xml->mday, 2) == '14')) {
		echo ' selected="selected"';
	}

	echo '>14</option>' . "\n";
	echo '<option value="15"';

	if (isset($evmday) && (substr((string) $parse_xml->mday, 2) == '15')) {
		echo ' selected="selected"';
	}

	echo '>15</option>' . "\n";
	echo '</select><br />' . "\n";
	echo 'Указанные:<br />' . "\n";
	echo '<input name="semday"';

	if (isset($semday)) {
		echo ' value="' . substr((string) $parse_xml->mday, 2) . '"';
	}

	echo ' /><br />' . "\n";
	echo 'Месяцы:<br />' . "\n";
	echo '<select name="crmonth">' . "\n";
	echo '<option value="all"';

	if ((substr((string) $parse_xml->month, 0, 1) == '*') && (substr((string) $parse_xml->month, 1, 1) != '/') && ((string) $parse_xml->period == 'custom')) {
		echo ' selected="selected"';
	}

	echo '>все</option>' . "\n";
	echo '<option value="every"';

	if ((substr((string) $parse_xml->month, 0, 1) == '*') && (substr((string) $parse_xml->month, 1, 1) == '/') && ((string) $parse_xml->period == 'custom')) {
		$evmonth = true;
		echo ' selected="selected"';
	}

	echo '>каждые</option>' . "\n";
	echo '<option value="selected"';

	if ((substr((string) $parse_xml->month, 0, 1) != '*') && (substr((string) $parse_xml->month, 1, 1) != '/') && ((string) $parse_xml->period == 'custom')) {
		$semonth = true;
		echo ' selected="selected"';
	}

	echo '>указанные</option>' . "\n";
	echo '</select><br />' . "\n";
	echo 'Каждые:<br />' . "\n";
	echo '<select name="evmonth">' . "\n";
	echo '<option value="02"';

	if (isset($evmonth) && (substr((string) $parse_xml->month, 2) == '02')) {
		echo ' selected="selected"';
	}

	echo '>02</option>' . "\n";
	echo '<option value="03"';

	if (isset($evmonth) && (substr((string) $parse_xml->month, 2) == '03')) {
		echo ' selected="selected"';
	}

	echo '>03</option>' . "\n";
	echo '<option value="04"';

	if (isset($evmonth) && (substr((string) $parse_xml->month, 2) == '04')) {
		echo ' selected="selected"';
	}

	echo '>04</option>' . "\n";
	echo '<option value="05"';

	if (isset($evmonth) && (substr((string) $parse_xml->month, 2) == '05')) {
		echo ' selected="selected"';
	}

	echo '>05</option>' . "\n";
	echo '<option value="06"';

	if (isset($evmonth) && (substr((string) $parse_xml->month, 2) == '06')) {
		echo ' selected="selected"';
	}

	echo '>06</option>' . "\n";
	echo '</select><br />' . "\n";
	echo 'Указанные:<br />' . "\n";
	echo '<input name="semonth"';

	if (isset($semonth)) {
		echo ' value="' . substr((string) $parse_xml->month, 2) . '"';
	}

	echo ' /><br />' . "\n";
	echo 'Дни недели:<br />' . "\n";
	echo '<select name="crwday">' . "\n";
	echo '<option value="all"';

	if ((substr((string) $parse_xml->wday, 0, 1) == '*') && (substr((string) $parse_xml->wday, 1, 1) != '/') && ((string) $parse_xml->period == 'custom')) {
		echo ' selected="selected"';
	}

	echo '>все</option>' . "\n";
	echo '<option value="every"';

	if ((substr((string) $parse_xml->wday, 0, 1) == '*') && (substr((string) $parse_xml->wday, 1, 1) == '/') && ((string) $parse_xml->period == 'custom')) {
		$evwday = true;
		echo ' selected="selected"';
	}

	echo '>каждые</option>' . "\n";
	echo '<option value="selected"';

	if ((substr((string) $parse_xml->wday, 0, 1) != '*') && (substr((string) $parse_xml->wday, 1, 1) != '/') && ((string) $parse_xml->period == 'custom')) {
		$sewday = true;
		echo ' selected="selected"';
	}

	echo '>указанные</option>' . "\n";
	echo '</select><br />' . "\n";
	echo 'Каждые:<br />' . "\n";
	echo '<select name="evwday">' . "\n";
	echo '<option value="02"';

	if (isset($evwday) && (substr((string) $parse_xml->wday, 2) == '02')) {
		echo ' selected="selected"';
	}

	echo '>02</option>' . "\n";
	echo '<option value="03"';

	if (isset($evwday) && (substr((string) $parse_xml->wday, 2) == '03')) {
		echo ' selected="selected"';
	}

	echo '>03</option>' . "\n";
	echo '</select><br />' . "\n";
	echo 'Указанные:<br />' . "\n";
	echo '<input name="sewday"';

	if (isset($sewday)) {
		echo ' value="' . substr((string) $parse_xml->wday, 2) . '"';
	}

	echo ' /><br />' . "\n";
	echo '<input type="checkbox" name="hideout" value="on"';

	if (isset($parse_xml->hideout)) {
		echo ' checked="checked"';
	}

	echo ' /> не посылать отчёт по e-mail<br />' . "\n";
	echo '<input name="submit" type="submit" value="Изменить" /><br />' . "\n";
	echo '</form>' . "\n";
	echo '<br />' . "\n";
	echo '<img src="images/t-back.png" alt=".." /><a href="?func=cron">Вернуться</a>' . "\n";
}
else {
	$hideout = (isset($_POST['hideout']) ? 'on' : '');

	if ($_POST['period'] == 'custom') {
		if ($_POST['crmin'] == 'all') {
			$min = '*';
		}
		else if ($_POST['crmin'] == 'every') {
			$min = '*/' . $_POST['evmin'];
		}
		else if ($_POST['crmin'] == 'selected') {
		}

		if ($_POST['crhour'] == 'all') {
			$hour = '*';
		}
		else if ($_POST['crhour'] == 'every') {
			$hour = '*/' . $_POST['evhour'];
		}
		else if ($_POST['crhour'] == 'selected') {
			$hour = $_POST['sehour'];
		}

		if ($_POST['crmday'] == 'all') {
			$mday = '*';
		}
		else if ($_POST['crmday'] == 'every') {
			$mday = '*/' . $_POST['evmday'];
		}
		else if ($_POST['crmday'] == 'selected') {
			$mday = $_POST['semday'];
		}

		if ($_POST['crmonth'] == 'all') {
			$month = '*';
		}
		else if ($_POST['crmonth'] == 'every') {
			$month = '*/' . $_POST['evmonth'];
		}
		else if ($_POST['crmonth'] == 'selected') {
			$month = $_POST['semonth'];
		}

		if ($_POST['crwday'] == 'all') {
			$wday = '*';
		}
		else if ($_POST['crwday'] == 'every') {
			$wday = '*/' . $_POST['evwday'];
		}
		else if ($_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=' . urlencode($_SESSION['username']) . ':' . urlencode($_SESSION['password']));
	}
	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=' . urlencode($_SESSION['username']) . ':' . urlencode($_SESSION['password']));
	}

	$parse_xml = simplexml_load_string($content);

	if (isset($parse_xml->ok)) {
		echo '<div style="text-align:center">' . "\n";
		echo 'Задание данных успешно изменено!<br />' . "\n";
		echo '<a href="?func=cron">Продолжить&#187;</a>' . "\n";
		echo '</div>' . "\n";
	}
	else {
		echo '<div style="text-align:center">' . "\n";
		echo 'Ошибка при изменении задания!<br />' . "\n";
		echo '<a href="?func=cron">Продолжить&#187;</a>' . "\n";
		echo '</div>' . "\n";
	}
}

echo '</div>';

?>