Файл: _rootadmin/_shopsettings.inc.php
Строк: 1201
<?
if (!$sub) {$sub='list';}
if ($sub == "groups" or $sub == "addgroup" or $sub == "editgroup" or $sub == "addgroup2" or $sub == "editgroup2" or $sub == "deletegroup") {
if ($sub == "deletegroup") {
checkAdminAccess('sShopGroupDelete',1);
if ($id) {
$r = GetShopItemGroupById($id);
if ($r->id) {
@mysql_query("delete from shop_groups where id='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
@mysql_query("update shop_items set itemgroup='0' where itemgroup='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
writeAdminLog("Удалена группа товаров ID # $id, $r->name");
print "Группа товаров успешно удалена.";
} else {
print "Группа товаров не найдена.";
}
}
else {
print "Утерян идентификатор группы товаров.";
}
print "<BR><BR>";
}
if ($sub == "addgroup2" or $sub == "editgroup2") {
if (!$name) {print "Не указано название группы товаров.";}
else {
if ($sub == 'addgroup2') {
checkAdminAccess('sShopGroupCreate',1);
$r=@mysql_query("select * from shop_groups where name='$name'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($r) > 0) {print "Группа товаров <B>$name</b> уже присутствует в базе.";}
else {
@mysql_query("insert into shop_groups (name) values('$name')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$newid=mysql_insert_id();
writeAdminLog("Добавлена группа товаров ID # $newid, $name");
print "Группа товаров <B>$name</b> успешно добавлена в базу.";
}
$name = "";
}
else if ($sub == 'editgroup2') {
checkAdminAccess('sShopGroupEdit',1);
if ($id) {
@mysql_query("update shop_groups set name='$name' where id='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
writeAdminLog("Изменена группа товаров ID # $id, $name");
print "Группа товаров <B>$name</b> успешно изменена.";
}
else {
print "Утерян идентификатор группы товаров.";
}
$name=""; $id="";
}
}
print "<BR><BR>";
}
checkAdminAccess('sShopGroupRead',1);
$r=@mysql_query("select * from shop_groups order by name") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
?>
<table cellpadding=3 width=95%>
<tr><td colspan=4 align=center bgcolor=<? print $font_head?>><B>Группы товаров</b></td></tr>
<tr bgcolor=<? print $font_head?>><td align=center>ID</td><td align=center>Название</td><td align=center>Ссылка</td><td align=center></td></tr>
<?
$cnt=0;
while ($rr = mysql_fetch_object($r)) {
getfont();
print "
<tr bgcolor=$font_row>
<td width=30 align=center>$rr->id</td>
<td>$rr->name</td>
<Td>order.php?type=shop&group=$rr->id</td>
<td width=100 align=center><A href=?do=$do&sub=editgroup&id=$rr->id><img src=./_rootimages/edit.gif alt=Изменить border=0></a><A href=?do=$do&sub=deletegroup&id=$rr->id onclick="javascript: return confirm('Вы уверены, что хотите удалить группу товаров?');"><img src=./_rootimages/del.gif alt=Удалить border=0></a></td>
</tr>
";
$cnt++;
}
?>
<tr bgcolor=<? print $font_head?>><Td colspan=4>Всего групп товаров: <? print $cnt?></td></tr>
</table>
<?
if ($sub == 'editgroup') {
$r=@mysql_query("select * from shop_groups where id='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$r=mysql_fetch_object($r);
$id=$r->id;
$name=$r->name;
$sub = "editgroup";
$txt = "Изменение";
$button = 'Изменить';
} else {
$sub = "addgroup";
$txt = "Добавление";
$button = 'Добавить';
}
?><BR>
<form method=post>
<input type=hidden name=do value="<? print $do?>">
<input type=hidden name=sub value="<? print $sub?>2">
<input type=hidden name=id value="<? print $id?>">
<table>
<tr><td colspan=4 align=center bgcolor=#EAEAEA><B><? print $txt?> группы товаров</b></td></tr>
<tr><td>Название:</td><td><input type=text size=20 name=name value="<? print $name?>"></td><td></td><Td><input type=submit value=<? print $button?>></td></tr>
</table>
</form>
<?
}
if ($sub == 'addbytpl2') {
checkAdminAccess('sShopCreate',1);
$sub = "addbytpl";
if (!$name) {print "Не указано название товара.";}
else if (!$tplid) {print "Не указан товар используемый в качестве шаблона.";}
else {
$tplShopItem = GetShopItemById($tplid);
if (!$tplShopItem->id) {print "Товар, указанный в качестве шаблона, не найден.";}
else {
$r=@mysql_query("select * from shop_items where name='$name'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($r) > 0) {print "Товар <B>$name</b> уже присутствует в базе.";}
else {
@mysql_query("insert into shop_items (name,costtype,cost,itemgroup,active,description,type,field1,field2,field3,field4,tplsubj,tplmsg,tplIsHtml) values('$name','$tplShopItem->costtype','$tplShopItem->cost','$tplShopItem->itemgroup','$tplShopItem->active','$tplShopItem->description','$tplShopItem->type','$tplShopItem->field1','$tplShopItem->field2','$tplShopItem->field3','$tplShopItem->field4','$tplShopItem->tplsubj','$tplShopItem->tplmsg','$tplShopItem->tplIsHtml')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$id=mysql_insert_id();
writeAdminLog("Добавлен товар ID # $id, $name");
print "Товар <B>$name</b> успешно добавлен.";
if ($tplShopItem->costtype != 'one') {
$r=@mysql_query("select * from shop_sroki where item='$tplid'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
while ($rr = @mysql_fetch_object($r)) {
@mysql_query("insert into shop_sroki (item,months,`order`,renew,discount) VALUES('$id','$rr->months','$rr->order','$rr->renew','$rr->discount')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
}
}
$sub='edit';
}
}
}
print "<BR><BR>";
}
if ($sub == 'addbytpl') {
checkAdminAccess('sShopCreate',1);
$button='Добавить';
$txt='Добавление';
?>
<form method=post>
<input type=hidden name=do value=<? print $do?>>
<input type=hidden name=sub value=<? print $sub?>2>
<table>
<tr><td colspan=2 align=center bgcolor=#EAEAEA><B><? print $txt?> товара</b></td></tr>
<tr><td width=150>Название:</td><td><input type=text size=50 name=name value="<? print $name?>"></td></tr>
<tr><td>Шаблон:<img src="./_rootimages/question.gif" alt="Товар будет создан с использованием настроек того товара/услуги, который указан в качестве шаблона."></td><td colspan=2><select name=tplid><option></option>
<?
$shopItems = @mysql_query("select * from shop_items order by itemgroup,name") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
while ($oneShopItem = mysql_fetch_object($shopItems)) {
if ($oneShopItem->itemgroup) { $shopItemGroup = GetShopItemGroupById($oneShopItem->itemgroup); $shopItemGroup = $shopItemGroup->name." / "; } else { $shopItemGroup = ""; }
if ($tplid == $oneShopItem->id) { $selected = "selected"; } else { $selected = ""; }
print "<option $selected value=$oneShopItem->id>$shopItemGroup$oneShopItem->name</option>";
}
?>
</select></td></tr>
<tr><Td colspan=2 align=center><BR><input type=submit value=<? print $button?>></td></tr>
</table>
</form>
<?
}
if ($sub == 'add2' or $sub == 'edit2') {
if ($sub == 'add2') {$sub2='add'; checkAdminAccess('sShopCreate',1);}
if ($sub == 'edit2') {$sub2='edit'; checkAdminAccess('sShopEdit',1);}
if (!$name) {print "Не указано название товара.";}
else if (!$costtype) {print "Не указан тип цены для товара.";}
else if ($cost == '') {print "Не указана цена товара.";}
else if (($type == 'avdesk' or $type == 'avdesk6') and !$field1) {print "Не указан путь к AV-Desk.";}
else if (($type == 'avdesk' or $type == 'avdesk6') and !$field2) {print "Не указан логин администратора.";}
else if (($type == 'avdesk' or $type == 'avdesk6') and !$field3) {print "Не указан пароль администратора.";}
else if (($type == 'avdesk' or $type == 'avdesk6') and !$field4) {print "Не указано название группы.";}
else if (($type == "ispmanagerlite" or $type == "ispmanagerlitefull" or $type == "ispmanagerlitetrial" or $type == "ispmanagerpro" or $type == "ispmanagerprofull" or $type == "ispmanagerprotrial" or $type == "vdsmanagerlinux" or $type == "vdsmanagerlinuxfull" or $type == "vdsmanagerfreebsd" or $type == "vdsmanagerfreebsdfull" or $type == "billmanagerstandart" or $type == "billmanageradvanced" or $type == "billmanagercorporate" or $type == "dsmanager" or $type == "dsmanagerfull" or $type == "dnsmanagerfull" or $type == "ipmanagerfull") and !$ispLogin) { print "Не указан логин от BILLmanager/API."; }
else if (($type == "ispmanagerlite" or $type == "ispmanagerlitefull" or $type == "ispmanagerlitetrial" or $type == "ispmanagerpro" or $type == "ispmanagerprofull" or $type == "ispmanagerprotrial" or $type == "vdsmanagerlinux" or $type == "vdsmanagerlinuxfull" or $type == "vdsmanagerfreebsd" or $type == "vdsmanagerfreebsdfull" or $type == "billmanagerstandart" or $type == "billmanageradvanced" or $type == "billmanagercorporate" or $type == "dsmanager" or $type == "dsmanagerfull" or $type == "dnsmanagerfull" or $type == "ipmanagerfull") and !$ispPassword) { print "Не указан пароль от BILLmanager/API."; }
else if (($type == "ispmanagerlite" or $type == "ispmanagerlitefull" or $type == "ispmanagerlitetrial" or $type == "ispmanagerpro" or $type == "ispmanagerprofull" or $type == "ispmanagerprotrial" or $type == "vdsmanagerlinux" or $type == "vdsmanagerlinuxfull" or $type == "vdsmanagerfreebsd" or $type == "vdsmanagerfreebsdfull" or $type == "billmanagerstandart" or $type == "billmanageradvanced" or $type == "billmanagercorporate" or $type == "dsmanager" or $type == "dsmanagerfull" or $type == "dnsmanagerfull" or $type == "ipmanagerfull") and !$ispProvider) { print "Не указан провайдер."; }
else if ($type == 'soft' and !$softFile) {print "Не указано имя файла.";}
else {
if ($type == "ispmanagerlite" or $type == "ispmanagerlitefull" or $type == "ispmanagerlitetrial" or $type == "ispmanagerpro" or $type == "ispmanagerprofull" or $type == "ispmanagerprotrial" or $type == "vdsmanagerlinux" or $type == "vdsmanagerlinuxfull" or $type == "vdsmanagerfreebsd" or $type == "vdsmanagerfreebsdfull" or $type == "billmanagerstandart" or $type == "billmanageradvanced" or $type == "billmanagercorporate" or $type == "dsmanager" or $type == "dsmanagerfull" or $type == "dnsmanagerfull" or $type == "ipmanagerfull") {
$field1 = "";
$field2 = $ispLogin;
$field3 = encodePwd($ispPassword);
$field4 = $ispProvider;
$tplsubj = $ispTplSubj;
$tplmsg = $ispTplMsg;
$tplIsHtml = $ispTplIsHtml;
}
else if ($type == "soft") {
$field1 = $softFile;
$field2 = $softDays;
$field3 = $softDownloads;
$field4 = $softAttach;
$tplsubj = $softTplSubj;
$tplmsg = $softTplMsg;
$tplIsHtml = $softTplIsHtml;
}
else if ($type == "avdesk" or $type == "avdesk6") {
$field3 = encodePwd($field3);
}
else {
$field1 = "";
$field2 = "";
$field3 = "";
$field4 = "";
$tplsubj = "";
$tplmsg = "";
$tplIsHtml = "";
}
if ($sub == 'add2') {
$r=@mysql_query("select * from shop_items where name='$name'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($r) > 0) {print "Товар <B>$name</b> уже присутствует в базе.";}
else {
@mysql_query("insert into shop_items (name,costtype,cost,itemgroup,active,description,type,field1,field2,field3,field4,tplsubj,tplmsg,tplIsHtml) values('$name','$costtype','$cost','$itemgroup','$active','$description','$type','$field1','$field2','$field3','$field4','$tplsubj','$tplmsg','$tplIsHtml')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$id=mysql_insert_id();
writeAdminLog("Добавлен товар ID # $id, $name");
print "Товар <B>$name</b> успешно добавлен.";
if ($costtype != 'one') { print "<BR>Вам необходимо указать <A href=?do=$do&sub=sroki&id=$id>доступные сроки заказа для товара</a>."; }
$sub2='list';
}
}
else if ($sub == 'edit2') {
if ($id) {
@mysql_query("update shop_items set name='$name',costtype='$costtype',cost='$cost',itemgroup='$itemgroup',active='$active',description='$description',type='$type',field1='$field1',field2='$field2',field3='$field3',field4='$field4',tplsubj='$tplsubj',tplmsg='$tplmsg',tplIsHtml='$tplIsHtml' where id='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
writeAdminLog("Изменен товар ID # $id, $name");
print "Товар <B>$name</b> успешно изменен.";
$sub2='list';
}
else {
print "Утерян идентификатор товара.";
$sub2='list';
}
}
}
if ($sub2) {print "<BR><BR>";$sub=$sub2;}
else {$sub='';}
}
if ($sub == 'add' or $sub == 'edit') {
if ($sub == 'add') {checkAdminAccess('sShopCreate',1);}
if ($sub == 'edit') {checkAdminAccess('sShopRead',1);}
if ($sub == 'edit') {
$r=@mysql_query("select * from shop_items where id='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$r=mysql_fetch_object($r);
$name=$r->name;
$costtype=$r->costtype;
$cost=$r->cost;
$itemgroup=$r->itemgroup;
$active=$r->active;
$description=$r->description;
$type=$r->type;
if ($type == "ispmanagerlite" or $type == "ispmanagerlitefull" or $type == "ispmanagerlitetrial" or $type == "ispmanagerpro" or $type == "ispmanagerprofull" or $type == "ispmanagerprotrial" or $type == "vdsmanagerlinux" or $type == "vdsmanagerlinuxfull" or $type == "vdsmanagerfreebsd" or $type == "vdsmanagerfreebsdfull" or $type == "billmanagerstandart" or $type == "billmanageradvanced" or $type == "billmanagercorporate" or $type == "dsmanager" or $type == "dsmanagerfull" or $type == "dnsmanagerfull" or $type == "ipmanagerfull") {
$ispLogin = $r->field2;
$ispPassword = decodePwd($r->field3);
$ispProvider = $r->field4;
$ispTplSubj = $r->tplsubj;
$ispTplMsg = $r->tplmsg;
$ispTplIsHtml = $r->tplIsHtml;
}
else if ($type == "soft") {
$softFile = $r->field1;
$softDays = $r->field2;
$softDownloads = $r->field3;
$softAttach = $r->field4;
$softTplSubj = $r->tplsubj;
$softTplMsg = $r->tplmsg;
$softTplIsHtml = $r->tplIsHtml;
}
else if ($type == "avdesk" or $type == "avdesk6") {
$field1 = $r->field1;
$field2 = $r->field2;
$field3 = decodePwd($r->field3);
$field4 = $r->field4;
$tplsubj = $r->tplsubj;
$tplmsg = $r->tplmsg;
$tplIsHtml = $r->tplIsHtml;
}
$button='Изменить';
$txt='Изменение';
} else {
$button='Добавить';
$txt='Добавление';
}
if ($costtype == "year") { $costtypeselect3 = "checked"; }
else if ($costtype == "month") { $costtypeselect2 = "checked"; }
else if ($costtype == "one") { $costtypeselect1 = "checked"; }
?>
<form method=post>
<input type=hidden name=do value=<? print $do?>>
<input type=hidden name=sub value=<? print $sub?>2>
<input type=hidden name=id value=<? print $id?>>
<table>
<tr><td colspan=2 align=center bgcolor=#EAEAEA><B><? print $txt?> товара</b></td></tr>
<tr><td width=150>Название:</td><td><input type=text size=50 name=name value="<? print $name?>"></td></tr>
<tr><td width=150 valign=top>Спец. тип товара:</td><td>
<input type=radio name=type value="" onclick="document.getElementById('costOne').disabled=0; document.getElementById('costMonth').disabled=0; document.getElementById('costYear').disabled=0; hidediv('avdeskdiv'); hidediv('ispdiv'); hidediv('softdiv');" <? if ($type == "") { print "checked"; } ?>> нет
<input type=radio name=type value="soft" <? if ($type == "soft") { print "checked"; } ?> onclick="document.getElementById('costOne').disabled=0; document.getElementById('costMonth').disabled=1; document.getElementById('costYear').disabled=1; hidediv('avdeskdiv'); hidediv('ispdiv'); showdiv('softdiv');"> Скрипт / Программа /Файл
<input type=radio name=type value="avdesk" <? if ($type == "avdesk") { print "checked"; } ?> onclick="document.getElementById('costOne').disabled=1; document.getElementById('costMonth').disabled=0; document.getElementById('costYear').disabled=0; showdiv('avdeskdiv'); hidediv('ispdiv'); hidediv('softdiv');"> Dr.Web AV-Desk
<input type=radio name=type value="avdesk6" <? if ($type == "avdesk6") { print "checked"; } ?> onclick="document.getElementById('costOne').disabled=1; document.getElementById('costMonth').disabled=0; document.getElementById('costYear').disabled=0; showdiv('avdeskdiv'); hidediv('ispdiv'); hidediv('softdiv');"> Dr.Web AV-Desk 6<BR><BR>
<B>Лицензии ISPsystem:</B><BR>
<input type=radio name=type value="ispmanagerlitetrial" <? if ($type == "ispmanagerlitetrial") { print "checked"; } ?> onclick="document.getElementById('paylicenseru').disabled=0; document.getElementById('costOne').disabled=0; document.getElementById('costMonth').disabled=1; document.getElementById('costYear').disabled=1; hidediv('avdeskdiv'); hidediv('softdiv'); showdiv('ispdiv');"> ISPManager Lite Trial
<input type=radio name=type value="ispmanagerlite" <? if ($type == "ispmanagerlite") { print "checked"; } ?> onclick="document.getElementById('paylicenseru').disabled=0; document.getElementById('costOne').disabled=1; document.getElementById('costMonth').disabled=0; document.getElementById('costYear').disabled=1; hidediv('avdeskdiv'); hidediv('softdiv'); showdiv('ispdiv');"> ISPManager Lite
<input type=radio name=type value="ispmanagerlitefull" <? if ($type == "ispmanagerlitefull") { print "checked"; } ?> onclick="document.getElementById('paylicenseru').disabled=0; document.getElementById('costOne').disabled=0; document.getElementById('costMonth').disabled=1; document.getElementById('costYear').disabled=1; hidediv('avdeskdiv'); hidediv('softdiv'); showdiv('ispdiv');"> ISPManager Lite Вечная
<input type=radio name=type value="ispmanagerprotrial" <? if ($type == "ispmanagerprotrial") { print "checked"; } ?> onclick="document.getElementById('paylicenseru').disabled=0; document.getElementById('costOne').disabled=0; document.getElementById('costMonth').disabled=1; document.getElementById('costYear').disabled=1; hidediv('avdeskdiv'); hidediv('softdiv'); showdiv('ispdiv');"> ISPManager Pro Trial<BR>
<input type=radio name=type value="ispmanagerpro" <? if ($type == "ispmanagerpro") { print "checked"; } ?> onclick="document.getElementById('paylicenseru').disabled=0; document.getElementById('costOne').disabled=1; document.getElementById('costMonth').disabled=0; document.getElementById('costYear').disabled=1; hidediv('avdeskdiv'); hidediv('softdiv'); showdiv('ispdiv');"> ISPManager Pro
<input type=radio name=type value="ispmanagerprofull" <? if ($type == "ispmanagerprofull") { print "checked"; } ?> onclick="document.getElementById('paylicenseru').disabled=0; document.getElementById('costOne').disabled=0; document.getElementById('costMonth').disabled=1; document.getElementById('costYear').disabled=1; hidediv('avdeskdiv'); hidediv('softdiv'); showdiv('ispdiv');"> ISPManager Pro Вечная<BR>
<input type=radio name=type value="vdsmanagerlinux" <? if ($type == "vdsmanagerlinux") { print "checked"; } ?> onclick="document.getElementById('paylicenseru').disabled=1; document.getElementById('costOne').disabled=1; document.getElementById('costMonth').disabled=0; document.getElementById('costYear').disabled=1; hidediv('avdeskdiv'); hidediv('softdiv'); showdiv('ispdiv');"> VDSManager-Linux
<input type=radio name=type value="vdsmanagerlinuxfull" <? if ($type == "vdsmanagerlinuxfull") { print "checked"; } ?> onclick="document.getElementById('paylicenseru').disabled=1; document.getElementById('costOne').disabled=0; document.getElementById('costMonth').disabled=1; document.getElementById('costYear').disabled=1; hidediv('avdeskdiv'); hidediv('softdiv'); showdiv('ispdiv');"> VDSManager-Linux Вечная
<input type=radio name=type value="vdsmanagerfreebsd" <? if ($type == "vdsmanagerfreebsd") { print "checked"; } ?> onclick="document.getElementById('paylicenseru').disabled=1; document.getElementById('costOne').disabled=1; document.getElementById('costMonth').disabled=0; document.getElementById('costYear').disabled=1; hidediv('avdeskdiv'); hidediv('softdiv'); showdiv('ispdiv');"> VDSManager-FreeBSD
<input type=radio name=type value="vdsmanagerfreebsdfull" <? if ($type == "vdsmanagerfreebsdfull") { print "checked"; } ?> onclick="document.getElementById('paylicenseru').disabled=1; document.getElementById('costOne').disabled=0; document.getElementById('costMonth').disabled=1; document.getElementById('costYear').disabled=1; hidediv('avdeskdiv'); hidediv('softdiv'); showdiv('ispdiv');"> VDSManager-FreeBSD Вечная<BR>
<input type=radio name=type value="billmanagerstandart" <? if ($type == "billmanagerstandart") { print "checked"; } ?> onclick="document.getElementById('paylicenseru').disabled=1; document.getElementById('costOne').disabled=1; document.getElementById('costMonth').disabled=0; document.getElementById('costYear').disabled=0; hidediv('avdeskdiv'); hidediv('softdiv'); showdiv('ispdiv');"> BILLmanager Standart
<input type=radio name=type value="billmanageradvanced" <? if ($type == "billmanageradvanced") { print "checked"; } ?> onclick="document.getElementById('paylicenseru').disabled=1; document.getElementById('costOne').disabled=1; document.getElementById('costMonth').disabled=0; document.getElementById('costYear').disabled=0; hidediv('avdeskdiv'); hidediv('softdiv'); showdiv('ispdiv');"> BILLmanager Advanced
<input type=radio name=type value="billmanagercorporate" <? if ($type == "billmanagercorporate") { print "checked"; } ?> onclick="document.getElementById('paylicenseru').disabled=1; document.getElementById('costOne').disabled=1; document.getElementById('costMonth').disabled=0; document.getElementById('costYear').disabled=0; hidediv('avdeskdiv'); hidediv('softdiv'); showdiv('ispdiv');"> BILLmanager Corporate<BR>
<input type=radio name=type value="dsmanager" <? if ($type == "dsmanager") { print "checked"; } ?> onclick="document.getElementById('paylicenseru').disabled=1; document.getElementById('costOne').disabled=1; document.getElementById('costMonth').disabled=0; document.getElementById('costYear').disabled=0; hidediv('avdeskdiv'); hidediv('softdiv'); showdiv('ispdiv');"> DSmanager
<input type=radio name=type value="dsmanagerfull" <? if ($type == "dsmanagerfull") { print "checked"; } ?> onclick="document.getElementById('paylicenseru').disabled=1; document.getElementById('costOne').disabled=0; document.getElementById('costMonth').disabled=1; document.getElementById('costYear').disabled=1; hidediv('avdeskdiv'); hidediv('softdiv'); showdiv('ispdiv');"> DSmanager Вечная
<input type=radio name=type value="dnsmanagerfull" <? if ($type == "dnsmanagerfull") { print "checked"; } ?> onclick="document.getElementById('paylicenseru').disabled=1; document.getElementById('costOne').disabled=0; document.getElementById('costMonth').disabled=1; document.getElementById('costYear').disabled=1; hidediv('avdeskdiv'); hidediv('softdiv'); showdiv('ispdiv');"> DNSmanager Вечная
<input type=radio name=type value="ipmanagerfull" <? if ($type == "ipmanagerfull") { print "checked"; } ?> onclick="document.getElementById('paylicenseru').disabled=1; document.getElementById('costOne').disabled=0; document.getElementById('costMonth').disabled=1; document.getElementById('costYear').disabled=1; hidediv('avdeskdiv'); hidediv('softdiv'); showdiv('ispdiv');"> IPmanager Вечная
</td></tr>
<tr><Td valign=top>Группа:</td><td><? printShopItemGroupsSelect($itemgroup) ?> <span style="<? print $styleHelp?>">можно занести товар в группу товаров</td></tr>
<tr><td>Тип цены:</td><td><input type=radio name=costtype id=costOne value="one" <? print $costtypeselect1?>> разовая оплата <input type=radio name=costtype id=costMonth value="month" <? print $costtypeselect2?>> ежемесячная оплата <input type=radio name=costtype id=costYear value="year" <? print $costtypeselect3?>> ежегодная оплата</td></tr>
<tr><td>Цена, <? print CURAS?>:</td><td><input type=text size=5 name=cost value=<? print $cost?>></td></tr>
<tr><td valign=top>Товар активен:</td><td><input type=checkbox name=active <? if ($active) {print "checked";}?> value=1> <span style="<? print $styleHelp?>">клиент может купить только активный товар</td></tr>
<tr><td valign=top>Описание товара:</td><td><textarea name=description cols=40 rows=5><? print $description?></textarea></td></tr>
<tr><td colspan=2>
<div id="avdeskdiv" style="display: <? if ($type == "avdesk" or $type == "avdesk6") { print "block;"; } else { print "none;"; } ?>">
<table width=100%>
<tr><td colspan=2 align=center bgcolor=#EAEAEA><B>Настройки для Dr.Web AV-Desk</b></td></tr>
<tr><td width=150>Путь к AV-Desk:</td><td><input type=text size=25 name=field1 value=<? print $field1?>> <span style="<? print $styleHelp?>">пример: http://drweb.domain.ru:9080/</td></tr>
<tr><td>Логин администратора:</td><td><input type=text size=25 name=field2 value=<? print $field2?>></td></tr>
<tr><td>Пароль администратора:</td><td><input type=password size=25 name=field3 value=<? print $field3?>></td></tr>
<tr><td>ID группы:</td><td><input type=text size=25 name=field4 value=<? print $field4?>> <span style="<? print $styleHelp?>">пример: 2888b7ff-3625-465e-bcb8-957de17f6458</td></tr>
<tr><td colspan=2 align=center bgcolor=#EAEAEA><B>Шаблон письма, высылаемого после обработки заказа</b></td></tr>
<tr><td valign=top>Тема:</td><td><input type=text size=53 name=tplsubj value="<? print $tplsubj?>"></td></tr>
<tr><td valign=top>Сообщение:</td><td><textarea name=tplmsg cols=40 rows=5><? print $tplmsg?></textarea><BR><span style="<? print $styleHelp?>">В сообщении можно использовать следующие макросы:<BR>{company_name}, {company_url}, {support_url}, {login}, {password}, {url}</td></tr>
<tr><td valign=top>Шаблон в HTML-формате:</td><td><input type=checkbox name=tplIsHtml <? if ($tplIsHtml) {print "checked";}?> value=1> да</td></tr>
</table>
</div>
<div id="ispdiv" style="display: <? if ($type == "ispmanagerlite" or $type == "ispmanagerlitefull" or $type == "ispmanagerlitetrial" or $type == "ispmanagerpro" or $type == "ispmanagerprofull" or $type == "ispmanagerprotrial" or $type == "vdsmanagerlinux" or $type == "vdsmanagerlinuxfull" or $type == "vdsmanagerfreebsd" or $type == "vdsmanagerfreebsdfull" or $type == "billmanagerstandart" or $type == "billmanageradvanced" or $type == "billmanagercorporate" or $type == "dsmanager" or $type == "dsmanagerfull" or $type == "dnsmanagerfull" or $type == "ipmanagerfull") { print "block;"; } else { print "none;"; } ?>">
<table width=100%>
<tr><td colspan=2 align=center bgcolor=#EAEAEA><B>Интеграция</b></td></tr>
<tr><td>Провайдер:</td><td><input type=radio name=ispProvider value=ispsystemru <? if (!$ispProvider or $ispProvider == "ispsystemru") {print "checked";} ?>> ISPSystem.ru <input type=radio name=ispProvider value=isplicenseru <? if ($ispProvider == "isplicenseru") {print "checked";} ?>> ISPLicense.ru <input type=radio name=ispProvider id=paylicenseru <? if (!($type == "ispmanagerlite" or $type == "ispmanagerlitefull" or $type == "ispmanagerlitetrial" or $type == "ispmanagerpro" or $type == "ispmanagerprofull" or $type == "ispmanagerprotrial")) { print "disabled"; } ?> value=paylicenseru <? if ($ispProvider == "paylicenseru") {print "checked";} ?>> PayLicense.ru</td></tr>
<tr><td>Логин от BILLmanager/API:</td><td><input type=text size=25 name=ispLogin value=<? print $ispLogin?>></td></tr>
<tr><td>Пароль от BILLmanager/API:</td><td><input type=password size=25 name=ispPassword value=<? print $ispPassword?>></td></tr>
<tr><td colspan=2 align=center bgcolor=#EAEAEA><B>Шаблон письма, высылаемого после обработки заказа</b></td></tr>
<tr><td valign=top>Тема:</td><td><input type=text size=53 name=ispTplSubj value="<? print $ispTplSubj?>"></td></tr>
<tr><td valign=top>Сообщение:</td><td><textarea name=ispTplMsg cols=40 rows=5><? print $ispTplMsg?></textarea><BR><span style="<? print $styleHelp?>">В сообщении можно использовать следующие макросы:<BR>{company_name}, {company_url}, {support_url}, {license}, {ip}</td></tr>
<tr><td valign=top>Шаблон в HTML-формате:</td><td><input type=checkbox name=ispTplIsHtml <? if ($ispTplIsHtml) {print "checked";}?> value=1> да</td></tr>
</table>
</div>
<div id="softdiv" style="display: <? if ($type == "soft") { print "block;"; } else { print "none;"; } ?>">
<table width=100%>
<tr><td colspan=2 align=center bgcolor=#EAEAEA><B>Настройки для Скрипт / Программа / Файл</b></td></tr>
<tr><td>Имя файла: <img src="./_rootimages/question.gif" alt="Клиент сможет скачать данный файл только после авторизации по ссылке, сгенерированной биллинговой системой.<BR><BR><B>Данный файл должен находиться в папке _rootsoft</b><BR><BR>Пример: soft1.zip<BR>"></td><td><input type=text size=25 name=softFile value=<? print $softFile?>></td></tr>
<tr><td>Срок жизни ссылки, дней: <img src="./_rootimages/question.gif" alt="Количество дней в течение которых ссылка будет работоспособна.<BR><BR>0 - без ограничений"></td><td><input type=text size=2 name=softDays value=<? print $softDays?>></td></tr>
<tr><td>Кол-во загрузок: <img src="./_rootimages/question.gif" alt="Клиент сможет скачать данный файл столько раз, сколько указано в данном поле.<BR><BR>0 - без ограничений"></td><td><input type=text size=2 name=softDownloads value=<? print $softDownloads?>></td></tr>
<tr><td>Прикрепить файл: <img src="./_rootimages/question.gif" alt="Если включено, то файл будет прикреплен к email-сообщению, отправляемому клиенту после оплаты счета на базе шаблона, указанного ниже."></td><td><input type=radio name=softAttach value=0 <? if (!$softAttach) { print "checked"; } ?>> нет <input type=radio name=softAttach value=1 <? if ($softAttach) { print "checked"; } ?>> да</td></tr>
<tr><td colspan=2 align=center bgcolor=#EAEAEA><B>Шаблон письма, высылаемого после обработки заказа</b></td></tr>
<tr><td valign=top>Тема:</td><td><input type=text size=53 name=softTplSubj value="<? print $softTplSubj?>"></td></tr>
<tr><td valign=top>Сообщение:</td><td><textarea name=softTplMsg cols=40 rows=5><? print $softTplMsg?></textarea><BR><span style="<? print $styleHelp?>">В сообщении можно использовать следующие макросы:<BR>{company_name}, {company_url}, {support_url}, {url}, {days}</td></tr>
<tr><td valign=top>Шаблон в HTML-формате:</td><td><input type=checkbox name=softTplIsHtml <? if ($softTplIsHtml) {print "checked";}?> value=1> да</td></tr>
</table>
</div>
</td></tr>
<tr><Td colspan=2 align=center><BR><input type=submit value=<? print $button?>></td></tr>
</table>
</form>
<?
}
if ($sub == 'delete') {
checkAdminAccess('sShopDelete',1);
if ($id) {
if (IsShopItemInUse($id)) {print "Вы не можете удалить товар <B>$name</b>, т.к. он используется в заказах.<BR>Вы можете сделать товар не активным.";}
else {
@mysql_query("delete from shop_items where id=$id") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
writeAdminLog("Удален товар ID # $id, $name");
print "Товар <B>$name</b> успешно удален.";
}
}
else {print "Утерян идентификатор.";}
print "<BR><BR>";
$sub="list";
}
if ($sub == 'deletesrok') {
checkAdminAccess('sShopSrokiDelete',1);
if ($id) {
@mysql_query("delete from shop_sroki where id='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
writeAdminLog("Удален срок заказа для товара ID # $item, $name");
print "Срок заказа для товара <B>$name</b> успешно удален.";
}
else {print "Утерян идентификатор.";}
print "<BR><BR>";
$sub=sroki; $id=$item;
}
if ($sub == 'addsrok') {
checkAdminAccess('sShopSrokiCreate',1);
if (!$months) {print "Не указан срок заказа.";}
else if (!$order and !$renew) {print "Срока заказа как минимум должен быть доступен либо для новых заказов, либо для продления.";}
else {
$r=@mysql_query("select * from shop_sroki where months='$months' and item='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($r) > 0) {print "Срок заказа для данного товара уже присутствует в базе.";}
else {
@mysql_query("insert into shop_sroki (item,months,discount,`order`,renew) values('$id','$months','$discount','$order','$renew')") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$newid=mysql_insert_id();
writeAdminLog("Добавлен срок заказа ID # $newid для товара ID # $id, $name");
print "Срок заказа успешно добавлен.";
$months=''; $discount='';
}
}
print "<BR><BR>";
$sub='sroki';
}
if ($sub == 'sroki') {
checkAdminAccess('sShopSrokiRead',1);
$k=@mysql_query("select name from shop_items where id=$id") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$k=mysql_fetch_object($k);
$r=@mysql_query("select * from shop_sroki where item=$id order by months") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
?>
<table cellpadding=3>
<tr><td colspan=6 align=center bgcolor=<? print $font_head?>><B>Доступные сроки заказа для товара <? print $k->name?></b></td></tr>
<tr bgcolor=<? print $font_head?>><td align=center>срок, месяцев</td><td align=center>для новых заказов</td><td align=center>для продления</td><td align=center>скидка, %</td><td></td></tr>
<?
$cnt=0;
while ($rr = mysql_fetch_object($r)) {
getfont();
print "
<tr bgcolor=$font_row>
<td align=center>$rr->months</td>
<td align=center>".$_yes[$rr->order]."</td>
<td align=center>".$_yes[$rr->renew]."</td>
<td align=center>$rr->discount</td>
<Td align=center><A href=?do=$do&sub=deletesrok&id=$rr->id&item=$rr->item&name=$k->name onclick="javascript: return confirm('Вы уверены, что хотите удалить срок для товара?');"><img src=./_rootimages/del.gif alt=Удалить border=0></a></td>
</tr>";
$cnt++;
}
?>
<tr bgcolor=<? print $font_head?>><Td colspan=8>Всего доступных сроков заказа: <? print $cnt?></td></tr>
</table><BR><BR>
<form method=post>
<input type=hidden name=do value=<? print $do?>>
<input type=hidden name=sub value=addsrok>
<input type=hidden name=id value=<? print $id?>>
<input type=hidden name=name value="<? print $k->name?>">
<table>
<tr><td colspan=2 align=center bgcolor=#EAEAEA><B>Добавление срока заказа для товара <? print $k->name?></b></td></tr>
<tr><td>Срок заказа, месяцев:</td><td><input type=text size=5 name=months value=<? print $months?>></td></tr>
<tr><td>Доступен для новых заказов:</td><td><input type=radio name=order value=1 <? if ($order or $order == "") {print "checked";}?>> да <input type=radio name=order value=0 <? if (!$order and $order != "") {print "checked";}?>> нет</td></tr>
<tr><td>Доступен для продления:</td><td><input type=radio name=renew value=1 <? if ($renew or $renew == "") {print "checked";}?>> да <input type=radio name=renew value=0 <? if (!$renew and $renew != "") {print "checked";}?>> нет</td></tr>
<tr><td>Скидка при заказе на данный срок, %:</td><td><input type=text size=5 name=discount value=<? print $discount?>></td></tr>
<tr><Td colspan=3 align=center><BR><input type=submit value=Добавить></td></tr>
</table>
</form>
<?
}
if ($sub == 'list') {
checkAdminAccess('sShopRead',1);
$shopgroups = GetShopItemGroups();
if (@mysql_num_rows($shopgroups) > 0) {
print "Группы товаров:";
while ($shopgroup = mysql_fetch_object($shopgroups)) {
print " [ <a href=?do=$do&group=$shopgroup->id>$shopgroup->name</a> ] ";
}
print " [ <a href=?do=$do&group=0>Без группы</a> ] ";
print "<BR>";
print " [ <a href=?do=$do>Все товары</a> ]<BR><BR> ";
}
if ($group != "") {
$where = "WHERE itemgroup='$group'";
if ($group) {
$shopgroup=GetShopItemGroupById($group);
$txt = "$shopgroup->name";
}
}
$r=@mysql_query("select * from shop_items $where order by name") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
?>
<table cellpadding=3 width=95%>
<tr><td colspan=5 align=center bgcolor=<? print $font_head?>><B>Товары <? if ($txt) { print "($txt)"; } ?></b></td></tr>
<tr bgcolor=<? print $font_head?>><td align=center>название</td><td align=center>тип цены</td><td align=center>цена, <? print CURAS?></td><Td align=center>активность</td><td></td></tr>
<?
$cnt=0;
while ($rr = mysql_fetch_object($r)) {
getfont();
$rr->description = htmlDecode($rr->description);
$rr->description = preg_replace("/n/u","<br>",$rr->description);
print "
<tr bgcolor=$font_row>
<td>$rr->name "; if ($rr->description) {print "<img src=./_rootimages/info.gif alt="$rr->description" border=0>";} print "</td>
<td align=center>";
$srokiUrl = "<BR>[ <A href=?do=$do&sub=sroki&id=$rr->id>доступные сроки заказа</a> ]";
if ($rr->costtype == "one") { print "разовая оплата"; $costaddon="";}
else if ($rr->costtype == "month") { print "ежемесячная оплата".$srokiUrl; $costaddon="/ месяц";}
else if ($rr->costtype == "year") { print "ежегодная оплата".$srokiUrl; $costaddon="/ год"; }
print "</td>
<Td align=center>$rr->cost $costaddon</td>
<td align=center>".$_yes[$rr->active]."</td>
<Td align=center><A href=?do=$do&sub=edit&id=$rr->id><img src=./_rootimages/edit.gif alt=Изменить border=0></a><A href=?do=$do&sub=delete&id=$rr->id&name=$rr->name onclick="javascript: return confirm('Вы уверены, что хотите удалить товар?');"><img src=./_rootimages/del.gif alt=Удалить border=0></a></td>
</tr>
";
$cnt++;
}
?>
<tr bgcolor=<? print $font_head?>><Td colspan=5>Всего товаров: <? print $cnt?></td></tr>
</table>
<?
}
?>