Example #1
0
     }
     #-------------------------------------------------------------------------------
 }
 #-------------------------------------------------------------------------------
 #-------------------------------------------------------------------------------
 # если есть превышения за вчера, за неделю, и разрешено лочить
 if ($SUsage > $HostingOrder['QuotaCPU'] * $Settings['LockRatio'] && $BUsage > $HostingOrder['QuotaCPU'] * $Settings['LockRatio'] && $BUsage > $Settings['LockBeginFrom'] && $Settings['LockOverlimits'] && Date('d') % $Settings['LockDays'] == 0) {
     // разрешено лочить именно в этот день
     #-------------------------------------------------------------------------------
     Debug(SPrintF('[comp/Tasks/HostingCPUUsage]: Надо лочить: Login = %s; SUsage = %s; BUsage = %s; QuotaCPU = %s', $HostingOrder['Login'], $SUsage, $BUsage, $HostingOrder['QuotaCPU']));
     #-------------------------------------------------------------------------------
     $LockedCount++;
     #-------------------------------------------------------------------------------
     if (!$Settings['CreateTicket']) {
         #-------------------------------------------------------------------------------
         $IsSend = NotificationManager::sendMsg(new Message('HostingCPUUsageNoticeLock', $HostingOrder['UserID'], array('HostingOrder' => $Params)));
         #-------------------------------------------------------------------------------
         switch (ValueOf($IsSend)) {
             case 'error':
                 return ERROR | @Trigger_Error(500);
             case 'exception':
                 # No more...
             # No more...
             case 'true':
                 #-------------------------------------------------------------------------------
                 # событие, чтоле прибить...
                 #-------------------------------------------------------------------------------
                 break;
                 #-------------------------------------------------------------------------------
             #-------------------------------------------------------------------------------
             default:
Example #2
0
$SendToIDs = Explode(',', $Task['Params']['SendToIDs']);
$SendedIDs = isset($Task['Params']['SendedIDs']) ? Explode(',', $Task['Params']['SendedIDs']) : array();
#-------------------------------------------------------------------------------
$Count = 0;
$Replace = array('Theme' => $Task['Params']['Theme'], 'Message' => $Task['Params']['Message']);
#-------------------------------------------------------------------------------
foreach ($SendToIDs as $User) {
    # пропускаем циклы, если счётчик уже больше 10
    if ($Count > $Settings['Limit'] - 1) {
        continue;
    }
    #-------------------------------------------------------------------------
    Debug(SPrintF('[comp/Tasks/Dispatch]: send message to UserID = %s;', $User));
    #-------------------------------------------------------------------------
    $msg = new DispatchMsg($Replace, (int) $User, $Task['Params']['FromID']);
    $IsSend = NotificationManager::sendMsg($msg, $Methods);
    #-------------------------------------------------------------------------
    switch (ValueOf($IsSend)) {
        case 'error':
            return ERROR | @Trigger_Error(500);
        case 'exception':
            # Исключение - системные юзеры, например...
            $SendedIDs[] = $User;
            Array_Shift($SendToIDs);
            break;
        case 'true':
            #-------------------------------------------------------------------------
            $Count++;
            $SendedIDs[] = $User;
            Array_Shift($SendToIDs);
            #-------------------------------------------------------------------------
Example #3
0
         return new gException('CANNOT_SAVE_UPLOADED_FILE', 'Не удалось сохранить загруженный файл');
     }
 }
 #---------------------------------------------------------------------------
 $Users = DB_Select('Users', 'ID', array('Where' => SPrintF('`ID` != %u AND `ID` > 50', $__USER['ID'])));
 #---------------------------------------------------------------------------
 switch (ValueOf($Users)) {
     case 'error':
         return ERROR | @Trigger_Error(500);
     case 'exception':
         return ERROR | @Trigger_Error(400);
     case 'array':
         #-----------------------------------------------------------------------
         foreach ($Users as $User) {
             #---------------------------------------------------------------------
             $IsSend = NotificationManager::sendMsg('EdeskCreate', (int) $User['ID'], array('EdeskID' => $EdeskID, 'Theme' => $Theme, 'Message' => $Message));
             #---------------------------------------------------------------------
             switch (ValueOf($IsSend)) {
                 case 'error':
                     return ERROR | @Trigger_Error(500);
                 case 'exception':
                     # No more...
                 # No more...
                 case 'true':
                     # No more...
                     break;
                 default:
                     return ERROR | @Trigger_Error(101);
             }
         }
         #-----------------------------------------------------------------------
 #-------------------------------------------------------------------------------
 if ($Accounts[$Order['Login']]['Limit'] < $Accounts[$Order['Login']]['Used']) {
     Debug(SPrintF('[comp/Tasks/GC/DiskUsageNotifies]: account %s overlimit, used %s/%s', $Order['Login'], $Accounts[$Order['Login']]['Used'], $Accounts[$Order['Login']]['Limit']));
 }
 #-------------------------------------------------------------------------------
 if (Ceil($Accounts[$Order['Login']]['Used'] / $Accounts[$Order['Login']]['Limit'] * 100) > $Settings['DiskUsageNotifiesPercent']) {
     #-------------------------------------------------------------------------------
     Debug(SPrintF('[comp/Tasks/GC/DiskUsageNotifies]: account %s used %s/%s', $Order['Login'], $Accounts[$Order['Login']]['Used'], $Accounts[$Order['Login']]['Limit']));
     #-------------------------------------------------------------------------------
     if (!$Settings['IsNotify']) {
         continue;
     }
     #-------------------------------------------------------------------------------
     $Array = array('Login' => $Order['Login'], 'Used' => $Accounts[$Order['Login']]['Used'], 'Limit' => $Accounts[$Order['Login']]['Limit']);
     #-------------------------------------------------------------------------------
     $IsSend = NotificationManager::sendMsg(new Message('DiskUsageNotice', (int) $Order['UserID'], array('Order' => $Array)));
     #-------------------------------------------------------------------------------
     switch (ValueOf($IsSend)) {
         case 'error':
             return ERROR | @Trigger_Error(500);
         case 'exception':
             # No more...
         # No more...
         case 'true':
             # No more...
             break;
         default:
             return ERROR | @Trigger_Error(101);
     }
     #-------------------------------------------------------------------------------
 }
Example #5
0
if (!Preg_Match($Regulars['Email'], $Email)) {
    return new gException('WRONG_EMAIL', 'Неверно указан электронный адрес');
}
#-------------------------------------------------------------------------------
if (!$Message) {
    return new gException('MESSAGE_IS_EMPTY', 'Не указано сообщение');
}
#-------------------------------------------------------------------------------
$Update = DB_Update('Users', array('Email' => $Email), array('ID' => 200));
if (Is_Error($Update)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$msg = new Message('Feedback', 100, array('Message' => $Message), 200);
#-------------------------------------------------------------------------------
$IsSend = NotificationManager::sendMsg($msg);
#-------------------------------------------------------------------------------
switch (ValueOf($IsSend)) {
    case 'error':
        return ERROR | @Trigger_Error(500);
    case 'exception':
        return ERROR | @Trigger_Error(400);
    case 'true':
        #---------------------------------------------------------------------------
        $Update = DB_Update('Users', array('Email' => '*****@*****.**'), array('ID' => 200));
        if (Is_Error($Update)) {
            return ERROR | @Trigger_Error(500);
        }
        #---------------------------------------------------------------------------
        return array('Status' => 'Ok');
    default:
#-------------------------------------------------------------------------------
$Orders = DB_Select('OrdersOwners', $Columns, array('Where' => $Where));
#-------------------------------------------------------------------------------
switch (ValueOf($Orders)) {
    case 'error':
        return ERROR | @Trigger_Error(500);
    case 'exception':
        # No more...
        break;
    case 'array':
        #---------------------------------------------------------------------------
        $GLOBALS['TaskReturnInfo'] = SPrintF('Handled %u orders', SizeOf($Orders));
        #---------------------------------------------------------------------------
        foreach ($Orders as $Order) {
            #-------------------------------------------------------------------------
            $IsSend = NotificationManager::sendMsg(new Message('OrdersSuspend', (int) $Order['UserID'], array('Order' => $Order)));
            #-------------------------------------------------------------------------
            switch (ValueOf($IsSend)) {
                case 'error':
                    return ERROR | @Trigger_Error(500);
                case 'exception':
                    # No more...
                # No more...
                case 'true':
                    # No more...
                    break;
                default:
                    return ERROR | @Trigger_Error(101);
            }
        }
        # end foreach
 $Employers = DB_Select('Users', 'ID', array('Where' => SPrintF('`GroupID` IN (%s)', $String)));
 #---------------------------------------------------------------
 switch (ValueOf($Employers)) {
     case 'error':
         return ERROR | @Trigger_Error(500);
     case 'exception':
         # No more...
         break;
     case 'array':
         # send messages to personal
         Debug("[comp/Tasks/CaclulatePartnersReward]: Need send messages to users = " . SizeOf($Employers));
         foreach ($Employers as $Employer) {
             # select real users
             if ($Employer['ID'] > 2000 || $Employer['ID'] == 100) {
                 Debug("[comp/Tasks/CaclulatePartnersReward]: Need send messages to #" . (int) $Employer['ID']);
                 $IsSend = NotificationManager::sendMsg(new Message('PartnersReward', (int) $Employer['ID'], array('Theme' => $Theme, 'Message' => $MessageToAdmins, 'Summ' => SPrintF('%01.2f', $TotalSumm))));
                 #---------------------------------------------------------
                 switch (ValueOf($IsSend)) {
                     case 'error':
                         return ERROR | @Trigger_Error(500);
                     case 'exception':
                         # No more...
                     # No more...
                     case 'true':
                         # No more...
                         break;
                     default:
                         return ERROR | @Trigger_Error(101);
                 }
             }
         }
                return ERROR | @Trigger_Error(500);
            }
            #-------------------------------------------------------------------------
            foreach ($SessionIDsIDs as $SessionID) {
                #-----------------------------------------------------------------------
                if (Preg_Match(SPrintF('/^(REMEBMER|SESSION)%s/', MD5($User['ID'])), $SessionID)) {
                    #-------------------------------------------------------------------
                    if (!@UnLink(SPrintF('%s/%s', $Path, $SessionID))) {
                        return ERROR | @Trigger_Error(500);
                    }
                }
            }
        }
        #-----------------------------------------------------------------------------
        #---------------------------------------------------------------------------
        $IsSend = NotificationManager::sendMsg(new Message('UserPasswordRestore', (int) $User['ID'], array('Password' => $Password, 'ChargeFree' => TRUE, 'IsImmediately' => TRUE)));
        #---------------------------------------------------------------------------
        switch (ValueOf($IsSend)) {
            case 'error':
                return ERROR | @Trigger_Error(500);
            case 'exception':
                return ERROR | @Trigger_Error(400);
            case 'true':
                return array('Status' => 'Ok');
            default:
                return ERROR | @Trigger_Error(101);
        }
    default:
        return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
Example #9
0
$Comp = Comp_Load('www/API/ContractMake', array('TypeID' => 'Default'));
#-------------------------------------------------------------------------------
switch (ValueOf($Comp)) {
    case 'error':
        return ERROR | @Trigger_Error(500);
    case 'exception':
        return ERROR | @Trigger_Error(400);
    case 'array':
        break;
    default:
        return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
$ContractID = $Comp['ContractID'];
#-------------------------------------------------------------------------------
$IsSend = NotificationManager::sendMsg(new Message('UserRegister', (int) $UserID, array('Password' => $Password)));
#-------------------------------------------------------------------------------
switch (ValueOf($IsSend)) {
    case 'error':
        return ERROR | @Trigger_Error(500);
    case 'exception':
        break;
    case 'true':
        break;
    default:
        return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
$Event = array('UserID' => 1, 'Text' => SPrintF('%s (%s)', $Message ? $Message : 'Зарегистрирован пользователь', $Email));
$Event = Comp_Load('Events/EventInsert', $Event);
if (!$Event) {
     #-------------------------------------------------------------------------------
     $Summ = Comp_Load('Formats/Currency', $InvoicesItem['Summ']);
     if (Is_Error($Summ)) {
         return ERROR | @Trigger_Error(500);
     }
     #-------------------------------------------------------------------------------
     $Items[] = SPrintF("\t* %s / %s%s", $InvoicesItem['ServiceName'], $Comment, $Summ);
     #-------------------------------------------------------------------------------
 }
 #-------------------------------------------------------------------------------
 #----------------------------------TRANSACTION----------------------------------
 if (Is_Error(DB_Transaction($TransactionID = UniqID('comp/Tasks/GC/NotifyWaitingInvoice')))) {
     return ERROR | @Trigger_Error(500);
 }
 #-------------------------------------------------------------------------
 $IsSend = NotificationManager::sendMsg(new Message('NotPayedInvoice', (int) $Invoice['UserID'], array('Theme' => SPrintF('Неоплаченный счёт #%d', $Invoice['ID']), 'InvoiceID' => $Invoice['ID'], 'Items' => Implode("\n", $Items))));
 #-------------------------------------------------------------------------
 switch (ValueOf($IsSend)) {
     case 'true':
         #-------------------------------------------------------------------------------
         $Event = array('UserID' => $Invoice['UserID'], 'PriorityID' => 'Billing', 'Text' => SPrintF('Уведомление о неоплаченном счёте #%d, неоплачен более %d дней', $Invoice['ID'], $Params['Invoices']['DaysBeforeNotice']));
         $Event = Comp_Load('Events/EventInsert', $Event);
         #-------------------------------------------------------------------------------
         if (!$Event) {
             return ERROR | @Trigger_Error(500);
         }
         #-------------------------------------------------------------------------------
         break;
         #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     case 'exception':