Exemplo n.º 1
0
if ($VPSOrderID) {
    #-------------------------------------------------------------------------------
    # ищщем старый контракт - сравниваем номерки
    $OldContractID = DB_Select('VPSOrders', '(SELECT `ContractID` FROM `Orders` WHERE `Orders`.`ID`=`VPSOrders`.`OrderID`) AS `ContractID`', array('UNIQ', 'ID' => $VPSOrderID));
    #-------------------------------------------------------------------------------
    switch (ValueOf($OldContractID)) {
        case 'error':
            return ERROR | @Trigger_Error(500);
        case 'exception':
            return ERROR | @Trigger_Error(400);
        case 'array':
            #-------------------------------------------------------------------------------
            if ($OldContractID['ContractID'] != $ContractID) {
                #-------------------------------------------------------------------------------
                # проверяем есть ли профиль у нового контракта
                $Count = DB_Count('Contracts', array('Where' => SPrintF('`ID` = %u AND `ProfileID` IS NOT NULL', $ContractID)));
                if (Is_Error($Count)) {
                    return ERROR | @Trigger_Error(500);
                }
                #-------------------------------------------------------------------------------
                if (!$Count) {
                    return new gException('CONTRACT_WITHOUT_PROFILE', 'У выбранного договора отсутствует профиль. Выберите другой договор, или, пусть клиент создаст и назначит профиль для этого договора.');
                }
                #-------------------------------------------------------------------------------
            }
            #-------------------------------------------------------------------------------
            break;
            #-------------------------------------------------------------------------------
        #-------------------------------------------------------------------------------
        default:
            return ERROR | @Trigger_Error(101);
Exemplo n.º 2
0
function gf_resyncforum($id)
{
    global $_CONF, $_TABLES;
    COM_errorLog("Re-Syncing Forum id:{$id}");
    // Update all the Topics lastupdated timestamp to that of the last posted comment
    $topicsQuery = DB_query("SELECT id FROM {$_TABLES['gf_topic']} WHERE forum={$id} and pid=0");
    $topicCount = DB_numRows($topicsQuery);
    if ($topicCount > 0) {
        $lastTopicQuery = DB_query("SELECT MAX(id) as maxid FROM {$_TABLES['gf_topic']} WHERE forum={$id}");
        $lasttopic = DB_fetchArray($lastTopicQuery);
        DB_query("UPDATE {$_TABLES['gf_forums']} SET last_post_rec = {$lasttopic['maxid']} WHERE forum_id={$id}");
        $postCount = DB_Count($_TABLES['gf_topic'], 'forum', $id);
        // Update the forum definition record to know the number of topics and number of posts
        DB_query("UPDATE {$_TABLES['gf_forums']} SET topic_count={$topicCount}, post_count={$postCount} WHERE forum_id={$id}");
        $recCount = 0;
        while ($trecord = DB_fetchArray($topicsQuery)) {
            $recCount++;
            // Retrieve the oldest post records for this topic and update the lastupdated time in the parent topic record
            $lsql = DB_query("SELECT MAX(id)as maxid FROM {$_TABLES['gf_topic']} WHERE pid={$trecord['id']}");
            $lastrec = DB_fetchArray($lsql);
            if ($lastrec['maxid'] != NULL) {
                $postCount = DB_count($_TABLES['gf_topic'], 'forum', $id);
                $latest = DB_getITEM($_TABLES['gf_topic'], date, "id={$lastrec['maxid']}");
                DB_query("UPDATE {$_TABLES['gf_topic']} SET lastupdated = '{$latest}' where id='{$trecord['id']}'");
                // Update the parent topic record to know the id of the Last Reply
                DB_query("UPDATE {$_TABLES['gf_topic']} SET last_reply_rec = {$lastrec['maxid']} where id='{$trecord['id']}'");
            } else {
                $latest = DB_getITEM($_TABLES['gf_topic'], date, "id={$trecord['id']}");
                DB_query("UPDATE {$_TABLES['gf_topic']} SET lastupdated = '{$latest}' WHERE id='{$trecord['id']}'");
            }
            // Recalculate and Update the number of replies
            $numreplies = DB_Count($_TABLES['gf_topic'], "pid", $trecord['id']);
            DB_query("UPDATE {$_TABLES['gf_topic']} SET replies = '{$numreplies}' WHERE id='{$trecord['id']}'");
        }
        COM_errorLog("{$recCount} Topic Records Updated");
    } else {
        DB_query("UPDATE {$_TABLES['gf_forums']} SET topic_count=0, post_count=0 WHERE forum_id={$id}");
        COM_errorLog("No topic records to resync");
    }
}
            if (Is_Error(DB_Transaction($TransactionID = UniqID('comp/Tasks/GC/SetDeletedWaitingInvoice')))) {
                return ERROR | @Trigger_Error(500);
            }
            #-------------------------------------------------------------------------
            $Comp = Comp_Load('www/API/StatusSet', array('ModeID' => 'Invoices', 'StatusID' => 'Rejected', 'RowsIDs' => $Invoice['ID'], 'Comment' => SPrintF('Автоматическая отмена счёта, неоплачен более %d дней', $Params['Invoices']['DaysBeforeDeleted'])));
            #-------------------------------------------------------------------------
            switch (ValueOf($Comp)) {
                case 'array':
                    $Event = array('UserID' => $Invoice['UserID'], 'PriorityID' => 'Billing', 'Text' => SPrintF('Автоматическая отмена счёта #%d, неоплачен более %d дней', $Invoice['ID'], $Params['Invoices']['DaysBeforeDeleted']));
                    $Event = Comp_Load('Events/EventInsert', $Event);
                    if (!$Event) {
                        return ERROR | @Trigger_Error(500);
                    }
                    break;
                default:
                    return ERROR | @Trigger_Error(500);
            }
            #-------------------------------------------------------------------------
            if (Is_Error(DB_Commit($TransactionID))) {
                return ERROR | @Trigger_Error(500);
            }
            #-------------------------------------------------------------------------
        }
        $Count = DB_Count('Invoices', array('Where' => $Where));
        if (Is_Error($Count)) {
            return ERROR | @Trigger_Error(500);
        }
        return $Count ? $Count : TRUE;
    default:
        return ERROR | @Trigger_Error(101);
}
Exemplo n.º 4
0
 #-----------------------------------------------------------------
 $DaysRemainded = $VPSOrder['DaysRemainded'];
 #-----------------------------------------------------------------
 $sDate = Comp_Load('Formats/Date/Simple', Time() + $DaysRemainded * 86400);
 if (Is_Error($sDate)) {
     return ERROR | @Trigger_Error(500);
 }
 #-----------------------------------------------------------------
 $tDate = Comp_Load('Formats/Date/Simple', Time() + ($DaysRemainded + $DaysPay) * 86400);
 if (Is_Error($tDate)) {
     return ERROR | @Trigger_Error(500);
 }
 #-----------------------------------------------------------------
 $IBasket = array('OrderID' => $VPSOrder['OrderID'], 'Comment' => SPrintF('Тариф: %s, с %s по %s', $VPSScheme['Name'], $sDate, $tDate), 'Amount' => $DaysPay, 'Summ' => $CostPay);
 #-----------------------------------------------------------------
 $Count = DB_Count('Basket', array('Where' => SPrintF('`OrderID` = %u', $VPSOrder['OrderID'])));
 if (Is_Error($Count)) {
     return ERROR | @Trigger_Error(500);
 }
 #-----------------------------------------------------------------
 if ($Count) {
     #---------------------------------------------------------------
     $IsInsert = DB_Update('Basket', $IBasket, array('Where' => SPrintF('`OrderID` = %u', $VPSOrder['OrderID'])));
     if (Is_Error($IsInsert)) {
         return ERROR | @Trigger_Error(500);
     }
 } else {
     #---------------------------------------------------------------
     $IsInsert = DB_Insert('Basket', $IBasket);
     if (Is_Error($IsInsert)) {
         return ERROR | @Trigger_Error(500);
Exemplo n.º 5
0
<?php

#-------------------------------------------------------------------------------
/** @author Великодный В.В. (Joonte Ltd.) */
/******************************************************************************/
/******************************************************************************/
$__args_list = array('ISPswScheme');
/******************************************************************************/
eval(COMP_INIT);
/******************************************************************************/
/******************************************************************************/
$Count = DB_Count('ISPswOrders', array('Where' => SPrintF('`SchemeID` = %u', $ISPswScheme['ID'])));
if (Is_Error($Count)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if ($Count) {
    return new gException('DELETE_DENIED', SPrintF('Удаление тарифа (%s) не возможно, %u заказ(ов) на ПО ISPsystem используют данный тариф', $ISPswScheme['Name'], $Count));
}
#-------------------------------------------------------------------------------
return TRUE;
#-------------------------------------------------------------------------------
Exemplo n.º 6
0
<?php

#-------------------------------------------------------------------------------
/** @author Великодный В.В. (Joonte Ltd.) */
/******************************************************************************/
/******************************************************************************/
eval(COMP_INIT);
/******************************************************************************/
/******************************************************************************/
$Args = Args();
#-------------------------------------------------------------------------------
$ClauseID = (int) @$Args['ClauseID'];
$Rating = (int) @$Args['Rating'];
#-------------------------------------------------------------------------------
$Count = DB_Count('Clauses', array('ID' => $ClauseID));
if (Is_Error($Count)) {
    return ERROR | Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if (!$Count) {
    return new gException('CLAUSE_NOT_FOUND', 'Указанная статья не найдена');
}
#-------------------------------------------------------------------------------
if ($Rating < 1 || $Rating > 5) {
    return new gException('WRONG_RATTING', 'Неверный рейтинг');
}
#-------------------------------------------------------------------------------
$IsInsert = DB_Insert('ClausesRating', array('ClauseID' => $ClauseID, 'IP' => $_SERVER['REMOTE_ADDR'], 'Rating' => $Rating));
if (Is_Error($IsInsert)) {
    return ERROR | Trigger_Error(500);
}
Exemplo n.º 7
0
<?php

#-------------------------------------------------------------------------------
$Users = DB_Select('Users', 'ID');
#-------------------------------------------------------------------------------
switch (ValueOf($Users)) {
    case 'error':
        return ERROR | @Trigger_Error(500);
    case 'exception':
        # No more...
        break;
    case 'array':
        #---------------------------------------------------------------------------
        foreach ($Users as $User) {
            #-------------------------------------------------------------------------
            $Count = DB_Count('Contracts', array('Where' => SPrintF("`UserID` = %u AND `TypeID` != 'Default'", $User['ID'])));
            if (Is_Error($Count)) {
                return ERROR | @Trigger_Error(500);
            }
            #-------------------------------------------------------------------------
            if ($Count) {
                #-----------------------------------------------------------------------
                $IsDelete = DB_Delete('Contracts', array('Where' => SPrintF("`UserID` = %u AND `TypeID` = 'Default'", $User['ID'])));
                if (Is_Error($IsDelete)) {
                    return ERROR | @Trigger_Error(500);
                }
            }
        }
        break;
    default:
        return ERROR | @Trigger_Error(101);
Exemplo n.º 8
0
            $IExtraIPOrders = array(array('OrderID' => $ExtraIPOrder['OrderID'], 'CostDay' => $ExtraIPOrder['CostDay']));
            #-------------------------------------------------------------------------------
            if ($ExtraIPOrder['StatusID'] != 'Active') {
                return new gException('ExtraIP_ORDER_NOT_ACTIVE', 'Заказ ExtraIP не активен');
            }
            #-------------------------------------------------------------------------------
            break;
            #-------------------------------------------------------------------------------
        #-------------------------------------------------------------------------------
        default:
            return ERROR | @Trigger_Error(101);
    }
    #-------------------------------------------------------------------------------
} else {
    #-------------------------------------------------------------------------------
    $Count = DB_Count('ExtraIPSchemes', array('ID' => $ExtraIPSchemeID));
    if (Is_Error($Count)) {
        return ERROR | @Trigger_Error(500);
    }
    #-------------------------------------------------------------------------------
    if (!$Count) {
        return new gException('SCHEME_NOT_FOUND', 'Выбранный тарифный план не найден');
    }
    #-------------------------------------------------------------------------------
    $ExtraIPOrders = DB_Select('ExtraIPOrders', array('ID', 'OrderID', '(SELECT `CostDay` FROM `ExtraIPSchemes` WHERE `ExtraIPSchemes`.`ID` = `ExtraIPOrders`.`SchemeID`) as `CostDay`'), array('Where' => SPrintF('`SchemeID` = %u', $ExtraIPSchemeID)));
    #-------------------------------------------------------------------------------
    switch (ValueOf($ExtraIPOrders)) {
        case 'error':
            return ERROR | @Trigger_Error(500);
        case 'exception':
            return new gException('ExtraIP_ORDERS_NOT_FOUND', 'Нет активных заказов на IP адреса по этому тарифному плану');
Exemplo n.º 9
0
 case 'exception':
     return new gException('PROFILE_NOT_FOUND', 'Профиль не найден');
 case 'array':
     #-------------------------------------------------------------------------
     $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':
             #---------------------------------------------------------------------
             $Count = DB_Count('Contracts', array('Where' => SPrintF('`ProfileID` = %u', $ProfileID)));
             if (Is_Error($Count)) {
                 return ERROR | @Trigger_Error(500);
             }
             #---------------------------------------------------------------------
             if ($Count) {
                 return new gException('PROFILE_ALREADY_USING', 'Для даного профиля уже сформирован договор');
             }
             #---------------------------------------------------------------------
             if ($Profile['TemplateID'] != $Type['ProfileTemplateID']) {
                 return new gException('WRONG_PROFILE_TEMPLATE', 'Профиль не может быть использован для формирования договоров данного типа');
             }
             #---------------------------------------------------------------------
             $dContract['ProfileID'] = $ProfileID;
             $dContract['Customer'] = $Profile['Name'];
             #---------------------------------------------------------------------
Exemplo n.º 10
0
eval(COMP_INIT);
/******************************************************************************/
/******************************************************************************/
$Config = Config();
#-------------------------------------------------------------------------------
$Settings = $Config['Interface']['Administrator']['Notes']['Tasks'];
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!$Settings['ShowUnExecuted']) {
    return $Result;
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Result = array();
#-------------------------------------------------------------------------------
$Count = DB_Count('Tasks', array('Where' => "(`IsActive` = 'no' OR `Errors` > 0) AND `IsExecuted` = 'no'"));
if (Is_Error($Count)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if ($Count) {
    #-------------------------------------------------------------------------------
    $Result = array();
    #-------------------------------------------------------------------------------
    $NoBody = new Tag('NOBODY');
    #-------------------------------------------------------------------------------
    $NoBody->AddHTML(TemplateReplace('Notes.Administrator.Tasks', array('Tasks' => $Count)));
    #-------------------------------------------------------------------------------
    $Result = array($NoBody);
    #-------------------------------------------------------------------------------
}
Exemplo n.º 11
0
#-------------------------------------------------------------------------------
$Answer = array('Status' => 'Ok');
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if ($IsDefault) {
    #-------------------------------------------------------------------------------
    $IsUpdate = DB_Update('Servers', array('IsDefault' => FALSE), array('Where' => SPrintF('`ServersGroupID` = %u', $ServersGroupID)));
    if (Is_Error($IsUpdate)) {
        return ERROR | @Trigger_Error(500);
    }
    #-------------------------------------------------------------------------------
} else {
    #-------------------------------------------------------------------------------
    if ($ServersGroupID) {
        #-------------------------------------------------------------------------------
        $Count = DB_Count('Servers', array('Where' => SPrintF("`ServersGroupID` = %u AND `IsDefault` = 'yes'", $ServersGroupID)));
        if (Is_Error($Count)) {
            return ERROR | @Trigger_Error(500);
        }
        #-------------------------------------------------------------------------------
        if (!$Count) {
            $UServer['IsDefault'] = TRUE;
        }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if ($ServerID) {
    #-------------------------------------------------------------------------------
Exemplo n.º 12
0
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# проверяем наличие любых счетов
$Count = DB_Count('InvoicesOwners', array('Where' => SPrintF("`UserID` = %u", $User['ID'])));
if ($Count) {
    return new gException('USER_HAVE_INVOICES', SPrintF('Пользователь [%s] не может быть удален, поскольку у него есть счета на оплату', $User['Email']));
}
#-------------------------------------------------------------------------------
# проверяем наличие оплаченных счетов
$Count = DB_Count('InvoicesOwners', array('Where' => SPrintF("`StatusID` = 'Payed' AND `UserID` = %u", $User['ID'])));
if ($Count) {
    return new gException('USER_HAVE_PAYED_INVOICES', SPrintF('Пользователь [%s] не может быть удален, поскольку у него есть оплаченные счета', $User['Email']));
}
#-------------------------------------------------------------------------------
# проверяем наличие заказов
$Count = DB_Count('OrdersOwners', array('Where' => SPrintF("`UserID` = %u", $User['ID'])));
if ($Count) {
    return new gException('USER_HAVE_INVOICES', SPrintF('Пользователь [%s] не может быть удален, поскольку у него есть заказанные услуги', $User['Email']));
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
// удаляем события этого юзера
$Where = SPrintF('`UserID` = %u', $User['ID']);
#-------------------------------------------------------------------------------
$IsDelete = DB_Delete('Events', array('Where' => $Where));
if (Is_Error($IsDelete)) {
    return new gException('USERs_EVENTS_CAN_NOT_DELETED', SPrintF('Не удалось удалить события пользователя [%s]', $User['Email']));
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!DeleteUploadedFile('Users', $User['ID'])) {
Exemplo n.º 13
0
$Config =& Config();
#-------------------------------------------------------------------------------
$Notifies = $Config['Notifies'];
#-------------------------------------------------------------------------------
$Methods = Explode(',', $Task['Params']['Methods']);
#-------------------------------------------------------------------------------
$iWhere = array();
#-------------------------------------------------------------------------------
foreach (Array_Keys($Notifies['Methods']) as $MethodID) {
    if ($Notifies['Methods'][$MethodID]['IsActive'] && In_Array($MethodID, $Methods)) {
        $iWhere[] = SPrintF("`TypeID` = '%s'", $MethodID);
    }
}
#-------------------------------------------------------------------------------
$Where = SPrintF("(%s) AND `IsExecuted` = 'no'", Implode(' OR ', $iWhere));
$Count = DB_Count('TasksOwners', array('Where' => $Where));
#-------------------------------------------------------------------------------
if (Is_Error($Count)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if ($Count > $Settings['Limit'] - 1) {
    #-------------------------------------------------------------------------------
    $GLOBALS['TaskReturnInfo']['Messages In Queue'] = array($Count);
    #-------------------------------------------------------------------------------
    return $ExecuteTime;
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$SendToIDs = Explode(',', $Task['Params']['SendToIDs']);
Exemplo n.º 14
0
<?php

#-------------------------------------------------------------------------------
/** @author Alex Keda, for www.host-food.ru */
/******************************************************************************/
/******************************************************************************/
$__args_list = array('Task');
/******************************************************************************/
eval(COMP_INIT);
/******************************************************************************/
/******************************************************************************/
$Count = DB_Count('Profiles');
if (Is_Error($Count)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if ($Count) {
    #-------------------------------------------------------------------------------
    for ($i = 0; $i < $Count; $i += 10) {
        #-------------------------------------------------------------------------------
        $Profiles = DB_Select('Profiles', array('ID', 'TemplateID', 'Attribs'), array('Limits' => array('Start' => $i, 'Length' => 10)));
        #-------------------------------------------------------------------------------
        switch (ValueOf($Profiles)) {
            case 'error':
                return ERROR | @Trigger_Error(500);
            case 'exception':
                # No more...
                break;
            case 'array':
                #-------------------------------------------------------------------------------
                foreach ($Profiles as $Profile) {
Exemplo n.º 15
0
 #-------------------------------------------------------------------------------
 # сравниваем список от регистратора со списокм в биллинге
 $RegList = Array_Keys($Prices);
 #-------------------------------------------------------------------------------
 ASort($NewSchemes);
 #-------------------------------------------------------------------------------
 ASort($RegList);
 #-------------------------------------------------------------------------------
 $DomainsOdd = Array_Diff($NewSchemes, $RegList);
 #-------------------------------------------------------------------------------
 if (SizeOf($DomainsOdd)) {
     #-------------------------------------------------------------------------------
     foreach ($DomainsOdd as $Odd) {
         #-------------------------------------------------------------------------------
         # проверяем наличие заказов по этому тарифу
         $Count = DB_Count('DomainOrdersOwners', array('Where' => array(SPrintF('`ServerID` = %u', $Registrator['ID']), SPrintF('`Name` = "%s"', $Odd))));
         if (Is_Error($Count)) {
             return ERROR | @Trigger_Error(500);
         }
         #-------------------------------------------------------------------------------
         if ($Count) {
             #-------------------------------------------------------------------------------
             $Message = SPrintF('Обнаружен тариф отсутствующий у регистратора: %s/%s, число заказов: %u', $Registrator['Params']['Name'], $Odd, $Count);
             #-------------------------------------------------------------------------------
             Debug(SPrintF('[comp/Tasks/GC/DomainCheckPriceList]: %s', $Message));
             #-------------------------------------------------------------------------------
             if ($Settings['IsEvent']) {
                 #-------------------------------------------------------------------------------
                 $Event = array('Text' => $Message, 'PriorityID' => 'Error', 'IsReaded' => FALSE);
                 $Event = Comp_Load('Events/EventInsert', $Event);
                 if (!$Event) {
Exemplo n.º 16
0
 public static function sendMsg(Msg $msg, $Methods = array())
 {
     #-------------------------------------------------------------------------------
     $Executor = Comp_Load('www/Administrator/API/ProfileCompile', array('ProfileID' => 100));
     #-------------------------------------------------------------------------------
     switch (ValueOf($Executor)) {
         case 'error':
             return ERROR | @Trigger_Error(500);
         case 'exception':
             # No more...
             break;
         case 'array':
             #-------------------------------------------------------------------------------
             $msg->setParam('Executor', $Executor['Attribs']);
             #-------------------------------------------------------------------------------
             break;
             #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
         default:
             return ERROR | @Trigger_Error(101);
     }
     #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     $User = DB_Select('Users', array('ID', 'Name', 'Sign', 'Email', 'UniqID', 'IsNotifies', 'Params'), array('UNIQ', 'ID' => $msg->getTo()));
     #-------------------------------------------------------------------------------
     switch (ValueOf($User)) {
         case 'error':
             return ERROR | @Trigger_Error('[Email_Send]: не удалось выбрать получателя');
         case 'exception':
             return new gException('EMAIL_RECIPIENT_NOT_FOUND', 'Получатель письма не найден');
         case 'array':
             #-------------------------------------------------------------------------------
             $TypeID = $msg->getTemplate();
             #-------------------------------------------------------------------------------
             Debug(SPrintF('[system/classes/NotificationManager]: TypeID = %s', $TypeID));
             #-------------------------------------------------------------------------------
             if ($TypeID != 'UserPasswordRestore') {
                 if (!$User['IsNotifies']) {
                     return new gException('NOTIFIES_RECIPIENT_DISABLED', 'Уведомления для получателя отключены');
                 }
             }
             #-------------------------------------------------------------------------------
             $msg->setParam('User', $User);
             #-------------------------------------------------------------------------------
             break;
             #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
         default:
             return ERROR | @Trigger_Error(101);
     }
     #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     $From = DB_Select('Users', array('ID', 'Name', 'Sign', 'Email', 'UniqID', 'Params'), array('UNIQ', 'ID' => $msg->getFrom()));
     #-------------------------------------------------------------------------------
     switch (ValueOf($From)) {
         case 'error':
             return ERROR | @Trigger_Error('[Email_Send]: не удалось выбрать отправителя');
         case 'exception':
             return new gException('EMAIL_SENDER_NOT_FOUND', 'Отправитель не найден');
         case 'array':
             #-------------------------------------------------------------------------------
             $msg->setParam('From', $From);
             #-------------------------------------------------------------------------------
             break;
             #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
         default:
             return ERROR | @Trigger_Error(101);
     }
     #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     $Config = Config();
     #-------------------------------------------------------------------------------
     $Notifies = $Config['Notifies'];
     #-------------------------------------------------------------------------------
     # вариант когда методы не заданы - значит все доступные
     if (SizeOf($Methods) == 0) {
         #-------------------------------------------------------------------------------
         $Array = array();
         #-------------------------------------------------------------------------------
         foreach (Array_Keys($Notifies['Methods']) as $MethodID) {
             $Array[] = $MethodID;
         }
         #-------------------------------------------------------------------------------
         $Methods = $Array;
         #-------------------------------------------------------------------------------
     }
     #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     $sentMsgCnt = 0;
     #-------------------------------------------------------------------------------
     foreach (Array_Keys($Notifies['Methods']) as $MethodID) {
         #-------------------------------------------------------------------------------
         if (!$Notifies['Methods'][$MethodID]['IsActive'] || !In_Array($MethodID, $Methods)) {
             continue;
         }
         #-------------------------------------------------------------------------------
         # проверяем контакт, если не мыло - должен быть подтверждён
         if ($MethodID != 'Email') {
             if (!$User['Params']['NotificationMethods'][$MethodID]['Confirmed']) {
                 continue;
             }
         }
         #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
         # кусок от JBS-879
         if (!isset($Notifies['Types'][$TypeID])) {
             #-------------------------------------------------------------------------------
             Debug(SPrintF('[system/classes/NotificationManager]: TypeID = %s not found', $TypeID));
             #-------------------------------------------------------------------------------
         } else {
             #-------------------------------------------------------------------------------
             # такие оповещения вообще могут быть отключены (пока, не настраиваемо, т.к. не нужно)
             if (!$Notifies['Types'][$TypeID]['IsActive']) {
                 continue;
             }
             #-------------------------------------------------------------------------------
             # проверяем, не отключены ли такие оповещения глобально
             $UseName = SPrintF('Use%s', $MethodID);
             #-------------------------------------------------------------------------------
             if (isset($Notifies['Types'][$TypeID][$UseName]) && !$Notifies['Types'][$TypeID][$UseName]) {
                 continue;
             }
             #-------------------------------------------------------------------------------
         }
         #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
         # проверяем, не отключены ли такие оповещения в настройках юзера
         $Count = DB_Count('Notifies', array('Where' => SPrintF("`UserID` = %u AND `MethodID` = '%s' AND `TypeID` = '%s'", $msg->getTo(), $MethodID, $TypeID)));
         if (Is_Error($Count)) {
             return ERROR | @Trigger_Error(500);
         }
         #-------------------------------------------------------------------------------
         if ($Count) {
             continue;
         }
         #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
         # JBS-1126: save $MethodID settings
         $msg->setParam('MethodSettings', $Notifies['Methods'][$MethodID]);
         #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
         if (!class_exists($MethodID)) {
             return new gException('DISPATCHER_NOT_FOUND', 'Dispatcher not found: ' . $MethodID);
         }
         #-------------------------------------------------------------------------------
         #$dispatcher = $MethodID::get();
         $dispatcher = call_user_func($MethodID . '::get', true);
         #-------------------------------------------------------------------------------
         try {
             #-------------------------------------------------------------------------------
             $dispatcher->send($msg);
             #-------------------------------------------------------------------------------
             $sentMsgCnt++;
             #-------------------------------------------------------------------------------
         } catch (jException $e) {
             #-------------------------------------------------------------------------------
             Debug(SPrintF("[system/classes/NotificationManager]: Error while sending message [userId=%s, message=%s]", $User['ID'], $e->getMessage()));
             #-------------------------------------------------------------------------------
         }
         #-------------------------------------------------------------------------------
     }
     #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     if ($sentMsgCnt < 1) {
         #-------------------------------------------------------------------------------
         Debug(SPrintF("[system/classes/NotificationManager]: Couldn't send notify by any methods to user #%s", $User['ID']));
         #-------------------------------------------------------------------------------
         return new gException('USER_NOT_NOTIFIED', 'Не удалось оповестить пользователя ни одним из методов');
         #-------------------------------------------------------------------------------
     }
     #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     return TRUE;
     #-------------------------------------------------------------------------------
     #------------------------------------------------------------------------------
 }
Exemplo n.º 17
0
 #-------------------------------------------------------------------------------
 $MessageID = DB_Insert('EdesksMessages', $ITicketMessage);
 if (Is_Error($MessageID)) {
     return ERROR | @Trigger_Error(500);
 }
 #-------------------------------------------------------------------------------
 if (isset($ITicketMessage['FileName'])) {
     if (!SaveUploadedFile('EdesksMessages', $MessageID, $Upload['Data'])) {
         return new gException('CANNOT_SAVE_UPLOADED_FILE', 'Не удалось сохранить загруженный файл');
     }
 }
 #-------------------------------------------------------------------------------
 #-------------------------------------------------------------------------------
 if ($__USER['ID'] != (int) $Ticket['UserID']) {
     #-------------------------------------------------------------------------------
     $Count = DB_Count('EdesksMessages', array('Where' => SPrintF('`EdeskID` = %d AND `UserID` != %u', $Ticket['ID'], (int) $Ticket['UserID'])));
     if (Is_Error($Count)) {
         return ERROR | Trigger_Error(500);
     }
     #-------------------------------------------------------------------------------
     // First message from support and ticket hasn't assigned to somebody yet.
     if ($Count == 1 && $Ticket['TargetUserID'] == 100) {
         #-------------------------------------------------------------------------------
         $IsUpdate = DB_Update('Edesks', array('UpdateDate' => Time(), 'TargetUserID' => (int) $__USER['ID']), array('ID' => $Ticket['ID']));
         if (Is_Error($IsUpdate)) {
             return ERROR | @Trigger_Error(500);
         }
         #-------------------------------------------------------------------------------
     }
     #-------------------------------------------------------------------------------
 }
Exemplo n.º 18
0
            break;
        default:
            return ERROR | @Trigger_Error(101);
    }
    #-------------------------------------------------------------------------------
    if (IntVal($User['OwnerID']) > 0 && $PromoCode['ForceOwner'] || IntVal($User['OwnerID']) == 0) {
        $IsUpdate = DB_Update('Users', array('OwnerID' => $PromoCode['OwnerID']), array('ID' => $GLOBALS['__USER']['ID']));
        if (Is_Error($IsUpdate)) {
            return ERROR | @Trigger_Error(500);
        }
    }
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# считаем число заюзанных промокодов
$Count = DB_Count('PromoCodesExtinguished', array('Where' => SPrintF('`PromoCodeID` = %u', $PromoCode['ID'])));
if (Is_Error($Count)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
# обновляем число заюзанных промокодов
# TODO подумать надо ли это. можно просто SELECT по двум таблицам гонять и не парится
$IsUpdate = DB_Update('PromoCodes', array('CurrentAmount' => $Count), array('ID' => $PromoCode['ID']));
if (Is_Error($IsUpdate)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (Is_Error(DB_Commit($TransactionID))) {
    return ERROR | @Trigger_Error(500);
}
Exemplo n.º 19
0
#-------------------------------------------------------------------------------
/** @author Великодный В.В. (Joonte Ltd.) */
/******************************************************************************/
/******************************************************************************/
$__args_list = array('ExtraIPOrder');
/******************************************************************************/
eval(COMP_INIT);
/******************************************************************************/
/******************************************************************************/
switch ($ExtraIPOrder['StatusID']) {
    case 'Waiting':
        # No more...
        break;
    case 'Deleted':
        #-------------------------------------------------------------------------------
        $Count = DB_Count('Tasks', array('Where' => array(SPrintF('`UserID` = %u', $ExtraIPOrder['UserID']), "`IsExecuted` = 'no'")));
        if (Is_Error($Count)) {
            return ERROR | @Trigger_Error(500);
        }
        #-------------------------------------------------------------------------------
        if ($Count) {
            if (Time() - $ExtraIPOrder['StatusDate'] < 600) {
                return new gException('SYNCHRONIZATION_WAITING', 'Синхронизация по удалению заказа с сервера еще не произведена. Пожалуйста, повторите запрос через 10 минут.');
            }
        }
        #-------------------------------------------------------------------------------
        break;
        #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    default:
        return new gException('DELETE_DENIED', 'Удаление заказа не возможно');
Exemplo n.º 20
0
eval(COMP_INIT);
/******************************************************************************/
/******************************************************************************/
$Config = Config();
#-------------------------------------------------------------------------------
$Settings = $Config['Interface']['Administrator']['Notes']['Events'];
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!$Settings['ShowUnReaded']) {
    return $Result;
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Result = array();
#-------------------------------------------------------------------------------
$Count = DB_Count('Events', array('Where' => "`IsReaded` != 'yes'"));
if (Is_Error($Count)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if ($Count) {
    #-------------------------------------------------------------------------------
    $Result = array();
    #-------------------------------------------------------------------------------
    $NoBody = new Tag('NOBODY');
    #-------------------------------------------------------------------------------
    $NoBody->AddHTML(TemplateReplace('Notes.Administrator.Events', array('Count' => $Count)));
    #-------------------------------------------------------------------------------
    $Result = array($NoBody);
    #-------------------------------------------------------------------------------
}
Exemplo n.º 21
0
         $Customer = SPrintF('%s...', Mb_SubStr($Customer, 0, 20));
     }
     #-------------------------------------------------------------------------------
     $Options[$Contract['ID']] = $Customer;
     #-------------------------------------------------------------------------------
 }
 #-------------------------------------------------------------------------------
 $Comp = Comp_Load('Form/Select', array('name' => 'ContractID', 'style' => 'width: 100%;'), $Options, $ContractID);
 if (Is_Error($Comp)) {
     return ERROR | @Trigger_Error(500);
 }
 #-------------------------------------------------------------------------------
 $Table[] = array('Базовый договор', $Comp);
 #-------------------------------------------------------------------------------
 #-------------------------------------------------------------------------------
 $Count = DB_Count('BasketOwners', array('Where' => SPrintF('`ContractID` = %u', $Contract['ID'])));
 if (Is_Error($Count)) {
     return ERROR | @Trigger_Error(500);
 }
 #-------------------------------------------------------------------------------
 if (!$Count) {
     #-------------------------------------------------------------------------------
     $Table[] = new Tag('TD', array('width' => 350, 'colspan' => 2, 'class' => 'Standard', 'style' => 'background-color:#FDF6D3;'), 'Ваша корзина заказов пуста, однако, Вы можете пополнить баланс Вашего договора, чтобы в дальнейшем использовать эти денежные средства для оплаты услуг.');
     #-------------------------------------------------------------------------------
     $Comp = Comp_Load('Form/Summ');
     if (Is_Error($Comp)) {
         return ERROR | @Trigger_Error(500);
     }
     #-------------------------------------------------------------------------------
     $Table[] = array('Сумма для зачисления', $Comp);
     #-------------------------------------------------------------------------------
Exemplo n.º 22
0
#-------------------------------------------------------------------------------
if (Is_Error($DOM->Load('Base'))) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$DOM->AddText('Title', 'Домашняя страница');
#-------------------------------------------------------------------------------
$__MESSAGES =& $GLOBALS['__MESSAGES'];
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (IS_DEBUG) {
    $__MESSAGES[] = 'Биллинговая система работает в режиме отладки. Отключите данный режим после устанения проблем, удалив файл DEBUG в корневой папке системы.';
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Count = DB_Count('Profiles', array('ID' => 100));
if (Is_Error($Count)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if (!$Count) {
    #-------------------------------------------------------------------------------
    $__MESSAGES[] = 'Профиль исполнителя не найден. Возможность формирования договоров не доступна.';
    #-------------------------------------------------------------------------------
    $DOM->AddAttribs('Body', array('onload' => "ShowWindow('/ProfileEdit',{TemplatesIDs:'Juridical,Individual'});"));
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!CacheManager::isEnabled()) {
    $__MESSAGES[] = 'Система кеширования недоступна. Биллинг может работать быстрее используя ресурсы оперативной памяти. Убедитесь что memcached запущен и модуль для PHP установлен.';
Exemplo n.º 23
0
if (Is_Error(System_Load('modules/Authorisation.mod'))) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Args = Args();
#-------------------------------------------------------------------------------
$ISPswLicenseID = (int) @$Args['ISPswLicenseID'];
$Flag = (string) @$Args['Flag'];
#$pricelist_id	= (integer) @$Args['pricelist_id'];
#$period	=  (string) @$Args['period'];
#$addon		= (integer) @$Args['addon'];
$IsInternal = (bool) @$Args['IsInternal'];
$IsUsed = (bool) @$Args['IsUsed'];
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Count = DB_Count('ISPswLicenses', array('ID' => $ISPswLicenseID));
if (Is_Error($Count)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if (!$Count) {
    return new gException('LICENSE_NOT_FOUND', 'Лицензия не найдена');
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$IISPswLicense = array('Flag' => $Flag, 'IsInternal' => $IsInternal, 'IsUsed' => $IsUsed);
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$IsUpdate = DB_Update('ISPswLicenses', $IISPswLicense, array('ID' => $ISPswLicenseID));
if (Is_Error($IsUpdate)) {
    return ERROR | @Trigger_Error(500);
Exemplo n.º 24
0
if (Is_Error($Count)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if ($Count) {
    return new gException('DUPLICATE_SERVICE_SHORT_NAME', SPrintF('Услуга с коротким именем "%s" уже есть. Выберите другое сокращённое имя услуги', $NameShort));
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Where = array(SPrintF("`Item` = '%s'", $Item));
#-------------------------------------------------------------------------------
if ($ServiceID) {
    $Where[] = SPrintF("`ID` != %u", $ServiceID);
}
#-------------------------------------------------------------------------------
$Count = DB_Count('Services', array('Where' => $Where));
if (Is_Error($Count)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if ($Count) {
    return new gException('DUPLICATE_SERVICE_ITEM', SPrintF('Услуга с именем "%s" для раздела меню уже есть. Выберите другое имя услуги для меню', $Item));
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#Debug(SPrintF('[comp/www/Administrator/API/ServiceEdit]: Statuses = %s',print_r($Statuses,true)));
#-------------------------------------------------------------------------------
$IService = array('GroupID' => $GroupID, 'UserID' => $UserID, 'ServicesGroupID' => $ServicesGroupID, 'Name' => $Name, 'NameShort' => $NameShort, 'Item' => $Item, 'Measure' => $Measure, 'ConsiderTypeID' => $ConsiderTypeID, 'CostOn' => $CostOn, 'Cost' => $Cost, 'PartnersRewardPercent' => $PartnersRewardPercent, 'IsActive' => $IsActive, 'IsProlong' => $IsProlong, 'IsConditionally' => $IsConditionally, 'IsAutoInvoicing' => $IsAutoInvoicing, 'Params' => array('Statuses' => $Statuses), 'SortID' => $SortID);
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Answer = array('Status' => 'Ok');
Exemplo n.º 25
0
 $Count = DB_Count('OrdersConsider', array('Where' => $Where));
 if (Is_Error($Count)) {
     return ERROR | @Trigger_Error(500);
 }
 #-------------------------------------------------------------------------------
 if ($Count) {
     continue;
 }
 #-------------------------------------------------------------------------------
 #-------------------------------------------------------------------------------
 #Debug(SPrintF('[comp/Tasks/GC/ResetOrdersDays]: UserID = %s; OrderIDs = %s',$UserID,Implode(',',$Array)));
 #-------------------------------------------------------------------------------
 # а ещё у него могут быть домены... которые учитываются иначе ... а ещё могут быть услуги настраиваемые вручную...
 $Where = array('`StatusID` = "Suspended" OR `StatusID` = "Active"', SPrintF('`UserID` = %u', $UserID), SPrintF('`ID` NOT IN (%s)', Implode(',', $Array)));
 #-------------------------------------------------------------------------------
 $Count = DB_Count('OrdersOwners', array('Where' => $Where));
 if (Is_Error($Count)) {
     return ERROR | @Trigger_Error(500);
 }
 #-------------------------------------------------------------------------------
 #Debug(SPrintF('[comp/Tasks/GC/ResetOrdersDays]: OrdersOwners Count = %s',$Count));
 #-------------------------------------------------------------------------------
 if ($Count) {
     continue;
 }
 #-------------------------------------------------------------------------------
 Debug(SPrintF('[comp/Tasks/GC/ResetOrdersDays]: Изменено число оставшихся дней (%u->%u) для заказa OrderID = %s; юзер = %s', $OrderConsider['SumDaysRemainded'], $Settings['ResetDaysTo'], $OrderID, $UserID));
 #-------------------------------------------------------------------------------
 #----------------------------------TRANSACTION----------------------------------
 if (Is_Error(DB_Transaction($TransactionID = UniqID('ResetOrdersDays')))) {
     return ERROR | @Trigger_Error(500);
Exemplo n.º 26
0
    return new gException('SERVERS_GROUP_NOT_FOUND', 'Группа серверов не найдена');
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if ($HardServerID > 0) {
    #-------------------------------------------------------------------------------
    $Count = DB_Count('Servers', array('ID' => $HardServerID));
    if (Is_Error($Count)) {
        return ERROR | @Trigger_Error(500);
    }
    #-------------------------------------------------------------------------------
    if (!$Count) {
        return new gException('WRONG_HardServerID', 'Указанного сервера не существует');
    }
    #-------------------------------------------------------------------------------
    $Count = DB_Count('Servers', array('Where' => SPrintF('`ID` = %u AND `ServersGroupID` = %u', $HardServerID, $ServersGroupID)));
    if (Is_Error($Count)) {
        return ERROR | @Trigger_Error(500);
    }
    #-------------------------------------------------------------------------------
    if (!$Count) {
        return new gException('WRONG_HardServerID_Group', 'Указанный сервер размещения относится к другой группе серверов');
    }
    #-------------------------------------------------------------------------------
} else {
    #-------------------------------------------------------------------------------
    $HardServerID = NULL;
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
            }
            #-------------------------------------------------------------------------------
            $GLOBALS['TaskReturnInfo'][$DomainOrder['Params']['Name']][] = SPrintF('%s.%s', $DomainOrder['DomainName'], $DomainOrder['DomainZone']);
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
        break;
        #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    case 'true':
        #-------------------------------------------------------------------------------
        break;
        #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    default:
        return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Count = DB_Count('DomainOrders', array('Where' => $Where));
if (Is_Error($Count)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if ($Count) {
    $GLOBALS['TaskReturnInfo']['Estimated'] = array($Count);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
return $Count ? $ExecutePeriod : $ExecuteTime;
#-------------------------------------------------------------------------------
Exemplo n.º 28
0
<?php

#-------------------------------------------------------------------------------
/** @author Великодный В.В. (Joonte Ltd.) */
/******************************************************************************/
/******************************************************************************/
$__args_list = array('VPSScheme');
/******************************************************************************/
eval(COMP_INIT);
/******************************************************************************/
/******************************************************************************/
$Count = DB_Count('VPSOrders', array('Where' => SPrintF('`SchemeID` = %u', $VPSScheme['ID'])));
if (Is_Error($Count)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if ($Count) {
    return new gException('DELETE_DENIED', SPrintF('Удаление тарифа (%s) не возможно, %u заказ(ов) на VPS используют данный тариф', $VPSScheme['Name'], $Count));
}
#-------------------------------------------------------------------------------
return TRUE;
#-------------------------------------------------------------------------------
Exemplo n.º 29
0
     exit;
 } else {
     $topicparent = DB_getITEM($_TABLES['gf_topic'], "pid", "id='{$msgid}'");
     if ($top == 'yes') {
         // Need to check for any attachments and delete if required
         $q1 = DB_query("SELECT id FROM {$_TABLES['gf_topic']} WHERE pid={$msgid} OR id={$msgid}");
         while ($A = DB_fetchArray($q1)) {
             $q2 = DB_query("SELECT id FROM {$_TABLES['gf_attachments']} WHERE topic_id={$A['id']}");
             while ($B = DB_fetchArray($q2)) {
                 forum_delAttachment($B['id']);
             }
         }
         DB_query("DELETE FROM {$_TABLES['gf_topic']} WHERE (id='{$msgid}')");
         DB_query("DELETE FROM {$_TABLES['gf_topic']} WHERE (pid='{$msgid}')");
         DB_query("DELETE FROM {$_TABLES['gf_watch']} WHERE (id='{$msgid}')");
         $postCount = DB_Count($_TABLES['gf_topic'], 'forum', $forum);
         DB_query("UPDATE {$_TABLES['gf_forums']} SET topic_count=topic_count-1,post_count={$postCount} WHERE forum_id={$forum}");
         $query = DB_query("SELECT MAX(id)as maxid FROM {$_TABLES['gf_topic']} WHERE forum={$forum}");
         list($last_topic) = DB_fetchArray($query);
         if ($last_topic > 0) {
             DB_query("UPDATE {$_TABLES['gf_forums']} SET last_post_rec={$last_topic} WHERE forum_id={$forum}");
         } else {
             DB_query("UPDATE {$_TABLES['gf_forums']} SET last_post_rec=0 WHERE forum_id={$forum}");
         }
     } else {
         // Need to check for any attachments and delete if required
         $q1 = DB_query("SELECT id FROM {$_TABLES['gf_topic']} WHERE id={$msgid}");
         while ($A = DB_fetchArray($q1)) {
             $q2 = DB_query("SELECT id FROM {$_TABLES['gf_attachments']} WHERE topic_id={$A['id']}");
             while ($B = DB_fetchArray($q2)) {
                 forum_delAttachment($B['id']);
Exemplo n.º 30
0
$DOM = new DOM();
#-------------------------------------------------------------------------------
$Links =& Links();
# Коллекция ссылок
$Links['DOM'] =& $DOM;
#-------------------------------------------------------------------------------
if (Is_Error($DOM->Load('Base'))) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$DOM->AddText('Title', 'Центр поддержки → Запросы в поддержку');
#-------------------------------------------------------------------------------
if ($TicketID) {
    #-------------------------------------------------------------------------------
    $Count = DB_Count('Edesks', array('ID' => $TicketID));
    if (Is_Error($Count)) {
        return ERROR | @Trigger_Error(500);
    }
    #-------------------------------------------------------------------------------
    if ($Count) {
        $DOM->AddAttribs('Body', array('onload' => SPrintF("ShowWindow('/TicketRead',{TicketID:%u})", $TicketID)));
    }
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Comp = Comp_Load('Tables/Super', 'Tickets');
if (Is_Error($Comp)) {
    return ERROR | @Trigger_Error(500);
}