Example #1
0
#-------------------------------------------------------------------------------
$UserID = (int) @$Args['UserID'];
#-------------------------------------------------------------------------------
if (Is_Error(System_Load('libs/Image.php', 'libs/Upload.php'))) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$UserID = $UserID ? $UserID : @$GLOBALS['__USER']['ID'];
#-------------------------------------------------------------------------------
if (!$UserID) {
    return 'No user defined';
}
#-------------------------------------------------------------------------------
# проверяем наличие файла
if (!GetUploadedFileSize('Users', $UserID)) {
    #-------------------------------------------------------------------------------
    $Path = Styles_Element('Images/UserFoto.jpg');
    if (Is_Error($Path)) {
        return ERROR | @Trigger_Error(500);
    }
    #-------------------------------------------------------------------------------
    $Foto = IO_Read($Path);
    if (Is_Error($Foto)) {
        return ERROR | @Trigger_Error(500);
    }
    #-------------------------------------------------------------------------------
} else {
    #-------------------------------------------------------------------------------
    $File = GetUploadedFile('Users', $UserID);
    #-------------------------------------------------------------------------------
Example #2
0
 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', 'Не удалось получить размер файла');
             }
             #-----------------------------------------------------------------------
             $Data = GetUploadedFile($TypeID, $FileID);
             #-----------------------------------------------------------------------
             $FileName = SPrintF('%s.bin', $FileData['ID']);
             if ($TypeID == 'EdesksMessages') {
                 $FileName = $FileData['FileName'];
             }
             if ($TypeID == 'Profiles') {
                 $FileName = SPrintF('document_%s.%s', $FileData['ID'], $FileData['Format']);
             }
             #-------------------------------------------------------------------------------
Example #3
0
 $Attribs = $Template['Attribs'];
 #-------------------------------------------------------------------
 foreach (Array_Keys($Attribs) as $AttribID) {
     #-----------------------------------------------------------------
     $Attrib = $Attribs[$AttribID];
     #-----------------------------------------------------------------
     if (isset($Attrib['Title'])) {
         $Table[] = $Attrib['Title'];
     }
     #-----------------------------------------------------------------
     $Table[] = $Compile['Attribs'][$AttribID];
 }
 #-------------------------------------------------------------------
 $Table[] = 'Подтверждение введенных данных';
 #-------------------------------------------------------------------
 $FileLength = GetUploadedFileSize('Profiles', $ProfileID);
 #-------------------------------------------------------------------
 $Table[] = array('Копия документа подтверждающего достоверность данных', $FileLength ? new Tag('TD', array('class' => 'Standard'), new Tag('SPAN', SPrintF('%01.2f Кб.', $FileLength / 1024)), new Tag('A', array('href' => SPrintF('/FileDownload?TypeID=Profiles&FileID=%s', $Profile['ID'])), '[скачать]')) : 'не загружены');
 #-------------------------------------------------------------------
 $Comp = Comp_Load('Statuses/State', 'Profiles', $Profile);
 if (Is_Error($Comp)) {
     return ERROR | @Trigger_Error(500);
 }
 #-------------------------------------------------------------------
 $Table = Array_Merge($Table, $Comp);
 #-------------------------------------------------------------------
 $Comp = Comp_Load('Tables/Standard', $Table, array('style' => 'width:500px;'));
 if (Is_Error($Comp)) {
     return ERROR | @Trigger_Error(500);
 }
 #-------------------------------------------------------------------
#-------------------------------------------------------------------------------
# проверяем наличие договора
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);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# проверяем наличие файла
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':
Example #5
0
$Config = Config();
#-------------------------------------------------------------------------------
$PaymentSystem = $Config['Invoices']['PaymentSystems'][$PaymentSystemID];
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!$IsPayed) {
    #-------------------------------------------------------------------------------
    $A = new Tag('A', array('style' => 'font-size:12px;', 'href' => SPrintF("javascript:ShowWindow('/InvoiceEdit',{InvoiceID:%u});", $Invoice['ID'])), '[изменить]');
    #-------------------------------------------------------------------------------
    $DOM->AddChild('Into', new Tag('DIV', array('class' => 'Title'), new Tag('CDATA', $PaymentSystem['Name']), $A));
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# проверяем наличие файла
if (!GetUploadedFileSize('Invoices', $Invoice['ID'])) {
    return new gException('INVOICE_NOT_BUILDED', 'Счёт не сформирован');
}
#-------------------------------------------------------------------------------
$File = GetUploadedFile('Invoices', $Invoice['ID']);
#-------------------------------------------------------------------------------
$Document = new DOM($File['Data']);
#-------------------------------------------------------------------------------
$Document->Delete('Logo');
#-------------------------------------------------------------------------------
$Document->Delete('Rubbish');
#-------------------------------------------------------------------------------
$Document->DeleteIDs();
#-------------------------------------------------------------------------------
$Div = new Tag('DIV', array('class' => 'Standard', 'style' => 'max-width:700px;'), $Document->Object);
#-------------------------------------------------------------------------------
Example #6
0
         $NoBody->AddChild(new Tag('SPAN', array('class' => 'Comment'), SPrintF('Например: %s', $Attrib['Example'])));
     }
     #-------------------------------------------------------------------------------
     #Debug(SPrintF('[comp/www/ProfileEdit]: Attrib = %s',print_r($Attrib,true)));
     if (!isset($Attrib['NotActive'])) {
         $Table[] = array($NoBody, $Comp);
     }
     #-------------------------------------------------------------------------------
 }
 #-------------------------------------------------------------------------------
 #-------------------------------------------------------------------------------
 if (!$Simple) {
     #-------------------------------------------------------------------------------
     $Table[] = 'Подтверждение введенных данных';
     #-------------------------------------------------------------------------------
     $Document = $ProfileID ? GetUploadedFileSize('Profiles', $ProfileID) : 0;
     #-------------------------------------------------------------------------------
     $Comp = Comp_Load('Upload', 'Document', $Document ? SPrintF('%01.2f Кб.', $Document / 1024) : 'не загружены');
     if (Is_Error($Comp)) {
         return ERROR | @Trigger_Error(500);
     }
     #-------------------------------------------------------------------------------
     $Table[] = array('Копия документа подтверждающего достоверность данных', $Comp);
     #-------------------------------------------------------------------------------
 }
 #-------------------------------------------------------------------------------
 #-------------------------------------------------------------------------------
 if (!$GLOBALS['__USER']['IsAdmin']) {
     #-------------------------------------------------------------------------------
     $Table[] = 'Обработка персональных данных №152-ФЗ "О персональных данных"';
     #-------------------------------------------------------------------------------
Example #7
0
#-------------------------------------------------------------------------------
switch (ValueOf($Group)) {
    case 'error':
        return ERROR | @Trigger_Error(500);
    case 'exception':
        return ERROR | @Trigger_Error(400);
    case 'array':
        # No more...
        break;
    default:
        return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# проверяем наличие аттача
$FileLength = GetUploadedFileSize('EdesksMessages', $MessageID);
#-------------------------------------------------------------------------------
if ((int) $FileLength) {
    #-------------------------------------------------------------------------------
    # проверяем наличие точки в имени (значит расширение определить удастся)
    if (StrRIPos($FileName, '.')) {
        #-------------------------------------------------------------------------------
        # проверяем что это картинка
        if ($__USER['Params']['Settings']['EdeskImagesPreview'] == "Yes" && In_Array(StrToLower(SubStr($FileName, StrRIPos($FileName, '.') + 1, 4)), array('png', 'gif', 'jpg', 'jpeg'))) {
            #-------------------------------------------------------------------------------
            # добавляем к тексту превьюху
            $Content = SPrintF("%s\n\n[image]%s://%s/FileDownload?TypeID=EdesksMessages&FileID=%u[/image]", $Content, Url_Scheme(), HOST_ID, $MessageID);
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
    }
Example #8
0
 $TargetUserID = (int) $Message['TargetUserID'];
 $TargetGroupID = (int) $Message['TargetGroupID'];
 #-------------------------------------------------------------------------------
 $Upload = Upload_Get('TicketMessageFile', $Message['FileName']);
 #-------------------------------------------------------------------------------
 switch (ValueOf($Upload)) {
     case 'error':
         return ERROR | @Trigger_Error(500);
     case 'exception':
         # No more...
         break;
     case 'array':
         #-------------------------------------------------------------------------------
         $Data = GetUploadedFile('EdesksMessages', $Message['ID']);
         #-------------------------------------------------------------------------------
         $EmailAttachments = array(array('Name' => $Upload['Name'], 'Size' => GetUploadedFileSize('EdesksMessages', $Message['ID']), 'Mime' => GetFileMimeType('EdesksMessages', $Message['ID']), 'Data' => Chunk_Split(Base64_Encode($Data['Data']))));
         #-------------------------------------------------------------------------------
         break;
         #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     default:
         return ERROR | @Trigger_Error(101);
 }
 #-------------------------------------------------------------------------------
 #-------------------------------------------------------------------------------
 if ($TargetGroupID != 1) {
     #-------------------------------------------------------------------------------
     $IsOwner = $Message['UserID'] == ($OwnerID = $Message['OwnerID']);
     #-------------------------------------------------------------------------------
     if ($IsOwner) {
         #-------------------------------------------------------------------------------
        if (Is_Error($Comp)) {
            return ERROR | @Trigger_Error(500);
        }
        #-------------------------------------------------------------------------------
        $NoBody->AddChild($Comp);
        #-------------------------------------------------------------------------------
        $Table[] = array('Код подтверждения', $NoBody);
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Table[] = 'Данные для участия в обсуждениях';
#-------------------------------------------------------------------------------
$Foto = GetUploadedFileSize('Users', $__USER['ID']);
#-------------------------------------------------------------------------------
$Comp = Comp_Load('Upload', 'UserFoto', $Foto ? SPrintF('%01.2f Кб.', $Foto / 1024) : 'не загружена');
if (Is_Error($Comp)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Table[] = array('Аватар (90x110)', $Comp);
#-------------------------------------------------------------------------------
if ($Foto) {
    #-------------------------------------------------------------------------------
    $Comp = Comp_Load('Form/Input', array('type' => 'checkbox', 'name' => 'IsClear', 'value' => 'yes'));
    if (Is_Error($Comp)) {
        return ERROR | @Trigger_Error(500);
    }
    #-------------------------------------------------------------------------------
/** @author Alex Keda, for www.host-food.ru */
/******************************************************************************/
/******************************************************************************/
eval(COMP_INIT);
/******************************************************************************/
/******************************************************************************/
$Args = Args();
#-------------------------------------------------------------------------------
$ContractEnclosureID = (int) @$Args['ContractEnclosureID'];
#-------------------------------------------------------------------------------
if (Is_Error(System_Load('modules/Authorisation.mod', 'libs/HTMLDoc.php', 'libs/Upload.php'))) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!GetUploadedFileSize('ContractsEnclosures', $ContractEnclosureID)) {
    return new gException('DOCUMENT_NOT_BUILDED', 'Документ не сформирован');
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Columns = array('ID', 'ContractID', 'Number', 'UserID', 'TypeID');
#-------------------------------------------------------------------------------
$ContractEnclosure = DB_Select('ContractsEnclosuresOwners', $Columns, array('UNIQ', 'ID' => $ContractEnclosureID));
#-------------------------------------------------------------------------------
switch (ValueOf($ContractEnclosure)) {
    case 'error':
        return ERROR | @Trigger_Error(500);
    case 'exception':
        return new gException('CONTRACT_ENCLOSURE_NOT_FOUND', 'Приложение к договору не найдено');
    case 'array':
        break;
Example #11
0
if (Is_Error($Comp)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Table[] = array('Краткое название услуги', $Comp);
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Comp = Comp_Load('Form/Input', array('type' => 'text', 'name' => 'Item', 'value' => $Service['Item'], 'prompt' => 'Название для отображения в меню'));
if (Is_Error($Comp)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Table[] = array('Раздел меню', $Comp);
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Comp = Comp_Load('Upload', 'Emblem', $ServiceID ? SPrintF('%01.2f Кб.', GetUploadedFileSize('Services', $Service['ID']) / 1024) : 'не загружена');
if (Is_Error($Comp)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Table[] = array('Эмблема (72x72, *.jpg)', $Comp);
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Comp = Comp_Load('Form/Input', array('type' => 'checkbox', 'name' => 'IsActive', 'value' => 'yes'));
if (Is_Error($Comp)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if ($Service['IsActive']) {
    $Comp->AddAttribs(array('checked' => 'yes'));
}
Example #12
0
#-------------------------------------------------------------------------------
$CacheID = Md5($__FILE__ . $ServiceID);
$Result = CacheManager::get($CacheID);
if ($Result) {
    Header('Content-Type: image');
    Header('Cache-Control: private, max-age=86400');
    return $Result;
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (Is_Error(System_Load('libs/Upload.php'))) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!GetUploadedFileSize('Services', $ServiceID)) {
    #-------------------------------------------------------------------------------
    # нету файла по стандартным путям хранения файлов
    $Service = DB_Select('Services', array('ID', 'Code'), array('UNIQ', 'ID' => $ServiceID));
    #-------------------------------------------------------------------------------
    switch (ValueOf($Service)) {
        case 'error':
            return ERROR | @Trigger_Error(500);
        case 'exception':
            return ERROR | @Trigger_Error(400);
        case 'array':
            #-------------------------------------------------------------------------------
            $Emblem = Styles_Element(SPrintF('Images/Icons/%s.png', $Service['Code']));
            if (Is_Error($Emblem)) {
                return ERROR | @Trigger_Error(500);
            }