return ERROR | @Trigger_Error(500); case 'exception': return new gException('ROWS_NOT_FOUND', 'Записи не найдены'); case 'array': #-------------------------------TRANSACTION--------------------------------- if (Is_Error(DB_Transaction($TransactionID = UniqID('Delete')))) { return ERROR | @Trigger_Error(500); } #--------------------------------------------------------------------------- $Trigger = System_Element(SPrintF('comp/%s.comp.php', $Path = SPrintF('Triggers/OnDelete/%s', $TableID))); #--------------------------------------------------------------------------- $RowsIDs = array(); #--------------------------------------------------------------------------- foreach ($Rows as $Row) { #------------------------------------------------------------------------- $IsPermission = Permission_Check(SPrintF('%sDelete', $TableID), (int) $GLOBALS['__USER']['ID'], (int) $Row['UserID']); #------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': #--------------------------------------------------------------------- if (!Is_Error($Trigger)) { #------------------------------------------------------------------- $OnDelete = Comp_Load($Path, $Row, COMP_ALL_HOSTS); #------------------------------------------------------------------- switch (ValueOf($OnDelete)) {
#------------------------------------------------------------------------------- switch (ValueOf($ISPswOrder)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('HOSTING_ORDER_NOT_FOUND', 'Выбранный заказ не найден'); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $__USER = $GLOBALS['__USER']; #------------------------------------------------------------------------------- $IsPermission = Permission_Check('ISPswOrdersSchemeChange', (int) $__USER['ID'], (int) $ISPswOrder['UserID']); #------------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
#------------------------------------------------------------------------------- switch (ValueOf($Order)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $IsPermission = Permission_Check('ServiceAutoProlongation', (int) $GLOBALS['__USER']['ID'], (int) $Order['UserID']); #------------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return new gException('NO_PERMISSION', 'У вас отсутствуют права на изменение настроек автопродления'); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
if (Is_Error(System_Load('modules/Authorisation.mod', 'classes/DOM.class.php', 'libs/Upload.php'))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Profile = DB_Select('Profiles', array('ID', 'UserID', 'CreateDate', 'TemplateID', 'StatusID', 'StatusDate'), array('UNIQ', 'ID' => $ProfileID)); #------------------------------------------------------------------------------- switch (ValueOf($Profile)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': #--------------------------------------------------------------------------- $__USER = $GLOBALS['__USER']; #--------------------------------------------------------------------------- $IsPermission = Permission_Check('ProfileRead', (int) $__USER['ID'], (int) $Profile['UserID']); #--------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': #----------------------------------------------------------------------- $DOM = new DOM(); #----------------------------------------------------------------------- $Links =& Links(); # Коллекция ссылок $Links['DOM'] =& $DOM;
#------------------------------------------------------------------------------- switch (ValueOf($Ticket)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $__USER = $GLOBALS['__USER']; #------------------------------------------------------------------------------- $IsPermission = Permission_Check('TicketRead', (int) $__USER['ID'], (int) $Ticket['UserID']); #------------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
$Columns = array('ID', 'OrderID', 'ServiceID', 'IP', 'StatusID', 'UserID', 'SchemeID', 'DaysRemainded', '(SELECT `TypeID` FROM `Contracts` WHERE `DSOrdersOwners`.`ContractID` = `Contracts`.`ID`) as `ContractTypeID`', '(SELECT `Balance` FROM `Contracts` WHERE `DSOrdersOwners`.`ContractID` = `Contracts`.`ID`) as `ContractBalance`', '(SELECT `GroupID` FROM `Users` WHERE `DSOrdersOwners`.`UserID` = `Users`.`ID`) as `GroupID`', '(SELECT `IsPayed` FROM `Orders` WHERE `Orders`.`ID` = `DSOrdersOwners`.`OrderID`) as `IsPayed`', '(SELECT SUM(`DaysReserved`*`Cost`*(1-`Discont`)) FROM `OrdersConsider` WHERE `OrderID`=`DSOrdersOwners`.`OrderID`) AS PayedSumm'); #------------------------------------------------------------------------------- $Where = $DSOrderID ? SPrintF('`ID` = %u', $DSOrderID) : SPrintF('`OrderID` = %u', $OrderID); #------------------------------------------------------------------------------- $DSOrder = DB_Select('DSOrdersOwners', $Columns, array('UNIQ', 'Where' => $Where)); #------------------------------------------------------------------------------- switch (ValueOf($DSOrder)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': #--------------------------------------------------------------------------- $UserID = (int) $DSOrder['UserID']; #--------------------------------------------------------------------------- $IsPermission = Permission_Check('DSOrdersRead', (int) $GLOBALS['__USER']['ID'], $UserID); #--------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': #----------------------------------------------------------------------- $DOM = new DOM(); #----------------------------------------------------------------------- $Links =& Links(); # Коллекция ссылок $Links['DOM'] =& $DOM;
case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $ExtraIPDepend = array('Login' => '', 'Address' => ''); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $__USER = $GLOBALS['__USER']; #------------------------------------------------------------------------------- $IsPermission = Permission_Check('ExtraIPOrdersRead', (int) $__USER['ID'], (int) $ExtraIPOrder['UserID']); #------------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- $DOM = new DOM();
#------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Columns = array('ID', 'UserID', 'SchemeID', '(SELECT `ServersGroupID` FROM `Servers` WHERE `Servers`.`ID` = (SELECT `ServerID` FROM `OrdersOwners` WHERE `OrdersOwners`.`ID` = `HostingOrdersOwners`.`OrderID`)) AS `ServersGroupID`', '(SELECT `Params` FROM `Servers` WHERE `Servers`.`ID` = (SELECT `ServerID` FROM `OrdersOwners` WHERE `OrdersOwners`.`ID` = `HostingOrdersOwners`.`OrderID`)) AS `Params`', 'StatusID'); #------------------------------------------------------------------------------- $HostingOrder = DB_Select('HostingOrdersOwners', $Columns, array('UNIQ', 'ID' => $HostingOrderID)); #------------------------------------------------------------------------------- switch (ValueOf($HostingOrder)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': #------------------------------------------------------------------------------- $__USER = $GLOBALS['__USER']; #------------------------------------------------------------------------------- $IsPermission = Permission_Check('HostingOrdersRead', (int) $__USER['ID'], (int) $HostingOrder['UserID']); #------------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': #------------------------------------------------------------------------------- if (!In_Array($HostingOrder['StatusID'], array('Active', 'Suspended'))) { return new gException('ORDER_NOT_ACTIVE', 'Тариф можно изменить только для активного или заблокированного заказа'); } #------------------------------------------------------------------------------- $OldScheme = DB_Select('HostingSchemes', array('IsSchemeChange', 'IsReselling'), array('UNIQ', 'ID' => $HostingOrder['SchemeID']));
return new gException('CONTRACT_NOT_FOUND', 'Договор не найден'); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # проверяем наличие файла if (!GetUploadedFileSize('Contracts', $Contract['ID'])) { return new gException('DOCUMENT_NOT_BUILDED', 'Документ не сформирован'); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # проверяем разрешения на скачивание файла $Permission = Permission_Check('ContractRead', (int) $GLOBALS['__USER']['ID'], (int) $Contract['UserID']); #------------------------------------------------------------------------------- switch (ValueOf($Permission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
if (Is_Error(System_Load('modules/Authorisation.mod', 'classes/DOM.class.php'))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $MotionDocument = DB_Select('MotionDocumentsOwners', '*', array('UNIQ', 'ID' => $MotionDocumentID)); #------------------------------------------------------------------------------- switch (ValueOf($MotionDocument)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': #--------------------------------------------------------------------------- $__USER = $GLOBALS['__USER']; #--------------------------------------------------------------------------- $IsPermission = Permission_Check('MotionDocumentRead', (int) $__USER['ID'], $MotionDocument['UserID'] ? (int) $MotionDocument['UserID'] : 100); #--------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': #----------------------------------------------------------------------- $DOM = new DOM(); #----------------------------------------------------------------------- $Links =& Links(); # Коллекция ссылок $Links['DOM'] =& $DOM;
#------------------------------------------------------------------------------- switch (ValueOf($DNSmanagerOrder)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $__USER = $GLOBALS['__USER']; #------------------------------------------------------------------------------- $IsPermission = Permission_Check('DNSmanagerOrdersRead', (int) $__USER['ID'], (int) $DNSmanagerOrder['UserID']); #------------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
#------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Span->AddChild(new Tag('SPAN', '-')); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- } else { # $IsAdmin false->true #------------------------------------------------------------------------------- # дополнительно проверяем - не сотрудник ли это, для сотрудников не надо линки в подпись лепить #Debug("[comp/Edesks/Message]: check for links, user id = " . (integer)$User['ID']); $IsPermission = Permission_Check('/Administrator/', (int) $User['ID']); switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': #------------------------------------------------------------------------------- # не сотрудник, выводим всё #------------------------------------------------------------------------------- # шукаем его заказы на услуги $Columns = array('Item', 'Code', 'Name'); $Where = array('`Services`.`ID`=`OrdersOwners`.`ServiceID`', SPrintF('`OrdersOwners`.`UserID`=%s', $UserID)); $Items = DB_Select(array('OrdersOwners', 'Services'), $Columns, array('Where' => $Where, 'GroupBy' => 'Code', 'SortOn' => '`Services`.`SortID`')); #------------------------------------------------------------------------------- switch (ValueOf($Items)) {
if ($UserID) { #----------------------------------------------------------------------------- $User = DB_Select('Users', array('ID', 'IsActive'), array('UNIQ', 'ID' => $UserID)); #----------------------------------------------------------------------------- switch (ValueOf($User)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': #------------------------------------------------------------------------- $UserID = $User['ID']; #------------------------------------------------------------------------- if (!In_Array($UserID, $UsersIDs)) { #----------------------------------------------------------------------- $IsPermission = Permission_Check('UserSwitch', (int) $__USER['ID'], (int) $UserID); #----------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return new gException('USER_MANAGMENT_DISABLED', 'Управление пользователем запрещено'); case 'true': Array_UnShift($UsersIDs, $UserID); break; default: return ERROR | @Trigger_Error(101); } } else {
if (Is_Error(System_Load('modules/Authorisation.mod', 'classes/DOM.class.php'))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Invoice = DB_Select('InvoicesOwners', array('ID', 'UserID', 'CreateDate', 'ContractID', 'PaymentSystemID', 'Summ', 'StatusID', 'StatusDate'), array('UNIQ', 'ID' => $InvoiceID)); #------------------------------------------------------------------------------- switch (ValueOf($Invoice)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': #--------------------------------------------------------------------------- $__USER = $GLOBALS['__USER']; #--------------------------------------------------------------------------- $IsPermission = Permission_Check('InvoiceRead', (int) $__USER['ID'], (int) $Invoice['UserID']); #--------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': #----------------------------------------------------------------------- $DOM = new DOM(); #----------------------------------------------------------------------- $Links =& Links(); # Коллекция ссылок $Links['DOM'] =& $DOM;
if (Is_Error(System_Load('modules/Authorisation.mod', 'libs/HTMLDoc.php', 'libs/Upload.php'))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $TypeID = DB_Escape($TypeID); #------------------------------------------------------------------------------- $FileData = DB_Select($TypeID, '*', array('UNIQ', 'ID' => $FileID)); #------------------------------------------------------------------------------- switch (ValueOf($FileData)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': #--------------------------------------------------------------------------- $Permission = Permission_Check('EdeskRead', (int) $GLOBALS['__USER']['ID'], (int) $FileData['UserID']); #--------------------------------------------------------------------------- switch (ValueOf($Permission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': #----------------------------------------------------------------------- $Length = GetUploadedFileSize($TypeID, $FileID); #----------------------------------------------------------------------- if (!$Length) { return new gException('CANNOT_GET_FILE_SIZE', 'Не удалось получить размер файла'); }
if (Is_Exception($DOM)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------- $DOM = Current($DOM->Childs); } else { $DOM = new Tag('DIV', array('force-escape' => 'yes'), $Text); } #--------------------------------------------------------------------------- $Result['DOM'] = $DOM; #--------------------------------------------------------------------------- if ($IsEdit) { #------------------------------------------------------------------------- if (isset($GLOBALS['__USER'])) { #----------------------------------------------------------------------- $Permission = Permission_Check('ClauseEdit', (int) $GLOBALS['__USER']['ID'], (int) $Clause['AuthorID']); #----------------------------------------------------------------------- switch (ValueOf($Permission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': # No more... break; case 'true': #------------------------------------------------------------------- $NoBody = new Tag('NOBODY'); #------------------------------------------------------------------- $NoBody->AddChild($DOM); #-------------------------------------------------------------------
#------------------------------------------------------------------------------- $Array[] = $Tr; #------------------------------------------------------------------------------- $RemainderSumm += (double) $ConsiderItem['Cost'] * (int) $ConsiderItem['YearsRemainded'] * (1 - (double) $ConsiderItem['Discont']); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $Comp = Comp_Load('Tables/Extended', $Array, 'Способ учета'); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Table[] = new Tag('DIV', array('align' => 'center'), $Comp); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $IsPermission = Permission_Check('DomainOrdersConsider', (int) $__USER['ID'], (int) $DomainOrder['UserID']); #------------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': # No more... break; case 'true': #------------------------------------------------------------------------------- if ($RemainderSumm) { #------------------------------------------------------------------------------- $Comp = Comp_Load('Formats/Currency', $RemainderSumm); if (Is_Error($Comp)) {
#------------------------------------------------------------------------------- switch (ValueOf($DomainOrder)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('DOMAIN_ORDER_NOT_FOUND', 'Выбранный заказ не найден'); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $__USER = $GLOBALS['__USER']; #------------------------------------------------------------------------------- $IsPermission = Permission_Check('DomainOrdersNsChange', (int) $__USER['ID'], (int) $DomainOrder['UserID']); #------------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
#------------------------------------------------------------------------------- $Row = DB_Select(SPrintF('%sOwners', $ModeID), 'UserID', array('UNIQ', 'Limits' => array(0, 1), 'Where' => SPrintF("`ID` = %u", $RowID))); #------------------------------------------------------------------------------- switch (ValueOf($Row)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $IsPermission = Permission_Check('StatusesHistory', (int) $GLOBALS['__USER']['ID'], (int) $Row['UserID']); #------------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
#------------------------------------------------------------------------------- switch (ValueOf($User)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $__USER = $GLOBALS['__USER']; #------------------------------------------------------------------------------- $IsPermission = Permission_Check('UserRead', (int) $__USER['ID'], (int) $User['ID']); #------------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return new gException('USER_MANAGMENT_DISABLED', 'Просмотр информации запрещен'); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
#------------------------------------------------------------------------------- switch (ValueOf($ISPswOrder)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $__USER = $GLOBALS['__USER']; #------------------------------------------------------------------------------- $IsPermission = Permission_Check('ISPswOrdersRead', (int) $__USER['ID'], (int) $ISPswOrder['UserID']); #------------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
#------------------------------------------------------------------------------- switch (ValueOf($Invoice)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $PaymentSystemID = $Invoice['PaymentSystemID']; #------------------------------------------------------------------------------- $IsPermission = Permission_Check('InvoiceRead', (int) $GLOBALS['__USER']['ID'], (int) $Invoice['UserID']); #------------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Order = DB_Select(SPrintF('%sOrdersOwners', $Service['Code'] == 'Default' ? '' : $Service['Code']), array('*'), array('UNIQ', 'ID' => $ServiceOrderID)); #------------------------------------------------------------------------------- switch (ValueOf($Order)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': #--------------------------------------------------------------------------- $IsPermission = Permission_Check('OrdersTransfer', (int) $__USER['ID'], (int) $Order['UserID']); #--------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- break;
$VPSOrder = DB_Select('VPSOrdersOwners', array('ID', 'UserID', 'StatusID', 'Login'), array('UNIQ', 'ID' => $VPSOrderID)); #------------------------------------------------------------------------------- switch (ValueOf($VPSOrder)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': #--------------------------------------------------------------------------- if ($VPSOrder['StatusID'] != 'Active') { return new gException('VPS_ORDER_NOT_ACTIVE', 'Заказ виртуального сервера не активен'); } #--------------------------------------------------------------------------- $__USER = $GLOBALS['__USER']; #--------------------------------------------------------------------------- $IsPermission = Permission_Check('VPSManage', (int) $__USER['ID'], (int) $VPSOrder['UserID']); #--------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': #----------------------------------------------------------------------- $DOM = new DOM(); #----------------------------------------------------------------------- $Links =& Links(); # Коллекция ссылок $Links['DOM'] =& $DOM;
#------------------------------------------------------------------------------- switch (ValueOf($Contract)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('CONTRACT_NOT_FOUND', 'Договор не найден'); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $__USER = $GLOBALS['__USER']; #------------------------------------------------------------------------------- $IsPermission = Permission_Check('ContractRead', (int) $__USER['ID'], (int) $Contract['UserID']); #------------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
return ERROR | @Trigger_Error(400); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Path = SPrintF('classes/%sServer.class.php', $Server['TemplateID']); #------------------------------------------------------------------------------- if (Is_Error(System_Load($Path))) { return new gException('CLASS_NOT_FOUND', SPrintF('Не найден класс для управления сервером: %s', $Path)); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $IsPermission = Permission_Check('ServerManage', (int) $GLOBALS['__USER']['ID'], 100); #------------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
} #------------------------------------------------------------------------------- $Columns = array('ID', 'OrderID', 'ServiceID', 'ContractID', 'StatusID', 'UserID', 'Login', 'Domain', 'DaysRemainded', 'SchemeID', '(SELECT `GroupID` FROM `Users` WHERE `VPSOrdersOwners`.`UserID` = `Users`.`ID`) as `GroupID`', '(SELECT `Balance` FROM `Contracts` WHERE `VPSOrdersOwners`.`ContractID` = `Contracts`.`ID`) as `ContractBalance`', '(SELECT `IsPayed` FROM `Orders` WHERE `Orders`.`ID` = `VPSOrdersOwners`.`OrderID`) as `IsPayed`', '(SELECT SUM(`DaysReserved`*`Cost`*(1-`Discont`)) FROM `OrdersConsider` WHERE `OrderID`=`VPSOrdersOwners`.`OrderID`) AS PayedSumm'); #------------------------------------------------------------------------------- $VPSOrder = DB_Select('VPSOrdersOwners', $Columns, array('UNIQ', 'ID' => $VPSOrderID)); #------------------------------------------------------------------------------- switch (ValueOf($VPSOrder)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('VPS_ORDER_NOT_FOUND', 'Выбранный заказ не найден'); case 'array': #--------------------------------------------------------------------------- $UserID = (int) $VPSOrder['UserID']; #--------------------------------------------------------------------------- $IsPermission = Permission_Check('VPSOrdersPay', (int) $GLOBALS['__USER']['ID'], $UserID); #--------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': #----------------------------------------------------------------------- $StatusID = $VPSOrder['StatusID']; #----------------------------------------------------------------------- if (!In_Array($StatusID, array('Waiting', 'Active', 'Suspended'))) { return new gException('VPS_ORDER_CAN_NOT_PAY', 'Заказ не может быть оплачен'); }
#------------------------------------------------------------------------------- switch (ValueOf($ServiceOrder)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $__USER = $GLOBALS['__USER']; #------------------------------------------------------------------------------- $IsPermission = Permission_Check('ServiceOrderRead', (int) $__USER['ID'], (int) $ServiceOrder['UserID']); #------------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
if (Is_Error(System_Load('modules/Authorisation.mod', 'libs/Wizard.php', 'classes/DOM.class.php', 'libs/HTMLDoc.php'))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Contract = DB_Select('Contracts', array('ID', 'CreateDate', 'UserID', 'TypeID', 'IsUponConsider', 'ProfileID'), array('UNIQ', 'ID' => $ContractID)); #------------------------------------------------------------------------------- switch (ValueOf($Contract)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('CONTRACT_NOT_FOUND', 'Указанный договор не найден'); case 'array': #--------------------------------------------------------------------------- $ContractID = (int) $Contract['ID']; #--------------------------------------------------------------------------- $Permission = Permission_Check('WorksCompliteRead', (int) $GLOBALS['__USER']['ID'], (int) $Contract['UserID']); #--------------------------------------------------------------------------- switch (ValueOf($Permission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': #----------------------------------------------------------------------- $Where = SPrintF('`ContractID` = %u AND `Month` = %u', $ContractID, $Month); #----------------------------------------------------------------------- $WorksComplite = DB_Select('WorksCompliteAgregate', '*', array('Where' => $Where)); #----------------------------------------------------------------------- switch (ValueOf($WorksComplite)) {
#------------------------------------------------------------------------------- $Contract = DB_Select('Contracts', array('UserID', 'IsUponConsider', 'StatusID'), array('UNIQ', 'ID' => $ContractID)); #------------------------------------------------------------------------------- switch (ValueOf($Contract)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Permission = Permission_Check('ContractConsiderEdit', (int) $GLOBALS['__USER']['ID'], (int) $Contract['UserID']); #------------------------------------------------------------------------------- switch (ValueOf($Permission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------