function initChecker($aValues = array(), $aSpecificValues = array())
 {
     parent::initChecker($aValues, $aSpecificValues);
     $CNF =& $this->_oModule->_oConfig->CNF;
     foreach ($this->_aImageFields as $sField => $aVals) {
         if (!isset($this->aInputs[$sField])) {
             continue;
         }
         if ($aValues && !empty($aValues[$CNF['FIELD_ID']])) {
             $this->aInputs[$sField]['content_id'] = $aValues[$CNF['FIELD_ID']];
         }
         $sErrorString = '';
         $this->aInputs[$sField]['file_id'] = $this->_processFile($sField, isset($aValues[$sField]) ? $aValues[$sField] : 0, $sErrorString);
         if ($sErrorString) {
             $this->aInputs[$sField]['error'] = $sErrorString;
             $this->setValid(false);
         }
         if (!isset($this->aInputs[$aVals['field_preview']]) || !empty($this->aInputs[$aVals['field_preview']]['content'])) {
             continue;
         }
         $oTranscoder = BxDolTranscoderImage::getObjectInstance($aVals['images_transcoder']);
         $aVars = array('bx_if:picture' => array('condition' => $oTranscoder && isset($aValues[$sField]) && $aValues[$sField] ? true : false, 'content' => array('picture_url' => $oTranscoder && isset($aValues[$sField]) && $aValues[$sField] ? $oTranscoder->getFileUrl($aValues[$sField]) : '')), 'bx_if:no_picture' => array('condition' => !$oTranscoder || !isset($aValues[$sField]) || !$aValues[$sField] ? true : false, 'content' => array()));
         $this->aInputs[$aVals['field_preview']]['content'] = $this->_oModule->_oTemplate->parseHtmlByName('picture_preview.html', $aVars);
     }
 }
Exemplo n.º 2
0
 function genRowImageUploader(&$aInput)
 {
     $aTmplVarsPreview = array('bx_if:show_empty' => array('condition' => true, 'content' => array()), 'bx_if:show_image' => array('condition' => false, 'content' => array()));
     if (($iId = (int) $aInput['value']) != 0) {
         $sFileUrl = false;
         if (!empty($aInput['transcoder_object'])) {
             $oTranscoder = BxDolTranscoderImage::getObjectInstance($aInput['transcoder_object']);
             $sFileUrl = $oTranscoder->getFileUrlNotReady($iId);
             if (isset($aInput['transcoder_image_width']) && $aInput['transcoder_image_width'] > 0) {
                 $sFileUrl = bx_append_url_params($sFileUrl, array('x' => $aInput['transcoder_image_width']));
             }
             if (isset($aInput['transcoder_image_height']) && $aInput['transcoder_image_height'] > 0) {
                 $sFileUrl = bx_append_url_params($sFileUrl, array('y' => $aInput['transcoder_image_height']));
             }
         } else {
             $sStorage = isset($aInput['storage_object']) && $aInput['storage_object'] != '' ? $aInput['storage_object'] : BX_DOL_STORAGE_OBJ_IMAGES;
             $oStorage = BxDolStorage::getObjectInstance($sStorage);
             $sFileUrl = $oStorage->getFileUrlById($iId);
         }
         if ($sFileUrl !== false) {
             $aTmplVarsPreview['bx_if:show_empty']['condition'] = false;
             $aTmplVarsPreview['bx_if:show_image'] = array('condition' => true, 'content' => array('url' => $sFileUrl, 'bx_if:show_action_delete' => array('condition' => isset($aInput['ajax_action_delete']) && $aInput['ajax_action_delete'] != "", 'content' => array('action' => $aInput['ajax_action_delete']))));
         }
     }
     $sRow = '';
     $aInputPreview = array('type' => 'custom', 'name' => 'preview', 'caption' => isset($aInput['caption_preview']) ? $aInput['caption_preview'] : _t('_adm_txt_form_view_iu_preview'), 'content' => $this->oTemplate->parseHtmlByName('form_view_iu_preview.html', $aTmplVarsPreview));
     $sRow .= $this->genRow($aInputPreview);
     $aInput['type'] = 'file';
     $sRow .= $this->genRow($aInput);
     return $sRow;
 }
 function initChecker($aValues = array(), $aSpecificValues = array())
 {
     $CNF =& $this->_oModule->_oConfig->CNF;
     if (!empty($aValues[$CNF['FIELD_PICTURE']]) && $aValues[$CNF['FIELD_PICTURE']] && isset($this->aInputs[$CNF['FIELD_PICTURE']]) && $this->aInputs[$CNF['FIELD_PICTURE']]) {
         $this->aInputs[$CNF['FIELD_PICTURE']]['required'] = false;
         unset($this->aInputs[$CNF['FIELD_PICTURE']]['checker']);
     }
     parent::initChecker($aValues, $aSpecificValues);
     foreach ($this->_aImageFields as $sField => $aVals) {
         if (!isset($this->aInputs[$sField])) {
             continue;
         }
         if ($aValues && !empty($aValues[$CNF['FIELD_ID']])) {
             $this->aInputs[$sField]['content_id'] = $aValues[$CNF['FIELD_ID']];
         }
         $sErrorString = '';
         $this->aInputs[$sField]['file_id'] = $this->_processFile(!empty($aValues[$CNF['FIELD_ID']]) ? $aValues[$CNF['FIELD_ID']] : 0, $sField, isset($aValues[$sField]) ? $aValues[$sField] : 0, $sErrorString);
         if ($sErrorString) {
             $this->aInputs[$sField]['error'] = $sErrorString;
             $this->setValid(false);
         }
         if (!isset($this->aInputs[$aVals['field_preview']]) || !empty($this->aInputs[$aVals['field_preview']]['content'])) {
             continue;
         }
         $oTranscoder = BxDolTranscoderImage::getObjectInstance($aVals['images_transcoder']);
         $aVars = array('bx_if:picture' => array('condition' => $oTranscoder && isset($aValues[$sField]) && $aValues[$sField] ? true : false, 'content' => array('picture_url' => $oTranscoder && isset($aValues[$sField]) && $aValues[$sField] ? $oTranscoder->getFileUrl($aValues[$sField]) : '')), 'bx_if:no_picture' => array('condition' => !$oTranscoder || !isset($aValues[$sField]) || !$aValues[$sField] ? true : false, 'content' => array()), 'bx_if:delete' => array('condition' => $oTranscoder && isset($aValues[$sField]) && $aValues[$sField] && $sField == $CNF['FIELD_COVER'] ? true : false, 'content' => array('action_ajax' => isset($aValues[$sField]) ? BX_DOL_URL_ROOT . $this->_oModule->_oConfig->getBaseUri() . 'delete_profile_img/' . $aValues[$sField] . '/' . (!empty($aValues[$CNF['FIELD_ID']]) ? $aValues[$CNF['FIELD_ID']] : 0) . '/' . $sField : '')));
         $this->aInputs[$aVals['field_preview']]['content'] = $this->_oModule->_oTemplate->parseHtmlByName('picture_preview.html', $aVars);
     }
 }
Exemplo n.º 4
0
 /**
  * Clean database by deleting some expired data
  */
 protected function cleanDatabase()
 {
     // clean expired membership levels
     bx_import('BxDolAcl');
     $oAcl = BxDolAcl::getInstance();
     $iDeleteMemLevels = $oAcl ? $oAcl->maintenance() : 0;
     //--- Clean sessions ---//
     bx_import('BxDolSession');
     $oSession = BxDolSession::getInstance();
     $iSessions = $oSession ? $oSession->maintenance() : 0;
     // clean old views
     bx_import('BxDolView');
     $iDeletedViews = BxDolView::maintenance();
     // clean storage engine expired private file tokens
     bx_import('BxDolStorage');
     $iDeletedExpiredTokens = BxDolStorage::pruning();
     // clean outdated transcoded images
     bx_import('BxDolTranscoderImage');
     $iDeletedTranscodedImages = BxDolTranscoderImage::pruning();
     // clean expired keys
     bx_import('BxDolKey');
     $oKey = BxDolKey::getInstance();
     $iDeletedKeys = $oKey ? $oKey->prune() : 0;
     // clean old votes
     bx_import('BxDolVote');
     $iDeletedVotes = BxDolVote::maintenance();
     echo _t('_sys_pruning_db', $iDeleteMemLevels, $iSessions, $iDeletedViews, $iDeletedVotes, $iDeletedKeys, $iDeletedExpiredTokens, $iDeletedTranscodedImages);
 }
Exemplo n.º 5
0
 /**
  * Depending on original file mime type call appropriate transcoder 
  */
 public function getFileUrl($mixedHandler)
 {
     $oStorageOriginal = BxDolStorage::getObjectInstance($this->_aObject['source_params']['object']);
     if (!$oStorageOriginal) {
         return false;
     }
     $aFile = $oStorageOriginal->getFile($mixedHandler);
     if (!$aFile) {
         return false;
     }
     $sTranscoder = '';
     if (0 === strncmp($aFile['mime_type'], 'image/', 6) && !empty($this->_aObject['source_params']['image'])) {
         $sTranscoder = $this->_aObject['source_params']['image'];
     } elseif (0 === strncmp($aFile['mime_type'], 'video/', 6) && !empty($this->_aObject['source_params']['video_poster'])) {
         $sTranscoder = $this->_aObject['source_params']['video_poster'];
         // if additional video transcoders provided call it to force video conversion
         if (empty($this->_aObject['source_params']['video'])) {
             continue;
         }
         foreach ($this->_aObject['source_params']['video'] as $sVideoTranscoder) {
             if (!($oTranscoder = BxDolTranscoderImage::getObjectInstance($sVideoTranscoder))) {
                 continue;
             }
             $oTranscoder->getFileUrl($mixedHandler);
         }
     }
     if (!$sTranscoder) {
         return false;
     }
     if (!($oTranscoder = BxDolTranscoderImage::getObjectInstance($sTranscoder))) {
         return false;
     }
     return $oTranscoder->getFileUrl($mixedHandler);
 }
Exemplo n.º 6
0
/**
 * page code function
 */
function PageCompMainCode()
{
    ob_start();
    $iProfileId = 123;
    $oTranscoder = BxDolTranscoderImage::getObjectInstance('sample');
    if (!$oTranscoder) {
        die('Transcoder object isn\'t defined');
    }
    echo "registerHandlers: [" . $oTranscoder->registerHandlers() . "] <hr />\n";
    echo "\n<script>\n\$(document).ready(function () {\n    \$('img').on('load', function () {\n        \$(this).after(' <span>size: <b>' + \$(this).width() + 'x' + \$(this).height() + '</b></span>')\n    });\n});\n</script>\n";
    $oStorage = $oTranscoder->getStorage();
    if (isset($_POST['delete'])) {
        foreach ($_POST['file_id'] as $iFileId) {
            $bRet = $oStorage->deleteFile($iFileId, $iProfileId);
            if ($bRet) {
                echo "<hr />deleted file id: " . $iFileId . "<hr />";
            } else {
                echo "<hr />file deleting error: " . $oStorage->getErrorString() . "<hr />";
            }
        }
    } else {
        $sPath = BX_DIRECTORY_PATH_ROOT . 'samples/img/';
        $h = opendir($sPath);
        while (false !== ($sFile = readdir($h))) {
            if ('.' == $sFile[0] || !is_file($sPath . $sFile)) {
                continue;
            }
            $sUrl = $oTranscoder->getFileUrl($sFile);
            echo $sFile . ' : <img src="' . $sUrl . '" /> <br /> ' . $sUrl . ' <hr />';
        }
    }
    $a = $oStorage->getFilesAll();
    echo "<hr /> <h2>Files List:</h2>";
    echo '<form method="POST">';
    foreach ($a as $r) {
        echo '<input type="checkbox" name="file_id[]" value="' . $r['id'] . '" /> ' . $r['file_name'] . '<br />';
    }
    echo '<input type="submit" name="delete" value="Delete" />';
    echo '</form>';
    $s = ob_get_clean();
    return DesignBoxContent("Sample transcoder", $s, BX_DB_PADDING_DEF);
}
Exemplo n.º 7
0
 protected function _associalFileWithContent($oStorage, $iFileId, $iProfileId, $iContentId)
 {
     parent::_associalFileWithContent($oStorage, $iFileId, $iProfileId, $iContentId);
     $CNF =& $this->_oModule->_oConfig->CNF;
     $sData = '';
     $sExif = '';
     $aExif = false;
     $aFile = $oStorage->getFile($iFileId);
     if (0 == strncmp('image/', $aFile['mime_type'], 6)) {
         $oImageReize = BxDolImageResize::getInstance();
         $oTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_BIG']);
         $a = $oImageReize->getImageSize($oTranscoder->getFileUrl($iFileId));
         $sData = isset($a['w']) && isset($a['h']) ? $a['w'] . 'x' . $a['h'] : '';
         if ($aExif = $oImageReize->getExifInfo($oStorage->getFileUrlById($iFileId))) {
             $a = array('Make', 'Model', 'FocalLength', 'ShutterSpeedValue', 'ExposureTime', 'ISOSpeedRatings', 'Orientation', 'Artist', 'Copyright', 'Flash', 'WhiteBalance', 'DateTimeOriginal', 'DateTimeDigitized', 'ExifVersion', 'COMPUTED', 'GPSLatitudeRef', 'GPSLatitude', 'GPSLongitudeRef', 'GPSLongitude', 'GPSAltitudeRef', 'GPSAltitude', 'GPSTimeStamp', 'GPSImgDirectionRef', 'GPSImgDirection', 'GPSDateStamp');
             $aExifFiltered = array();
             foreach ($a as $sIndex) {
                 if (isset($aExif[$sIndex])) {
                     $aExifFiltered[$sIndex] = $aExif[$sIndex];
                 }
             }
             $sExif = serialize($aExifFiltered);
         }
     }
     if (false === $this->_oModule->_oDb->associateFileWithContent($iContentId, $iFileId, $this->getCleanValue('title-' . $iFileId), $sData, $sExif)) {
         return;
     }
     $aMediaInfo = $this->_oModule->_oDb->getMediaInfoSimpleByFileId($iFileId);
     if ($aMediaInfo && !empty($CNF['OBJECT_METATAGS_MEDIA'])) {
         $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS_MEDIA']);
         if ($oMetatags->keywordsIsEnabled()) {
             $oMetatags->keywordsAdd($aMediaInfo['id'], $aMediaInfo['title']);
         }
     }
     if ($aMediaInfo && isset($aExif['Make']) && !empty($CNF['OBJECT_METATAGS_MEDIA_CAMERA'])) {
         $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS_MEDIA_CAMERA']);
         if ($oMetatags->keywordsIsEnabled()) {
             $oMetatags->keywordsAddOne($aMediaInfo['id'], $oMetatags->keywordsCameraModel($aExif));
         }
     }
 }
Exemplo n.º 8
0
 /**
  * Get profile picture icon url
  */
 function _image($sField, $sTranscodeObject, $sNoImage, $aData, $bSubstituteNoImage = true)
 {
     $sImageUrl = false;
     if ($aData[$sField]) {
         bx_import('BxDolTranscoderImage');
         $oImagesTranscoder = BxDolTranscoderImage::getObjectInstance($sTranscodeObject);
         if ($oImagesTranscoder) {
             $sImageUrl = $oImagesTranscoder->getFileUrl($aData[$sField]);
         }
     }
     return $bSubstituteNoImage && !$sImageUrl ? $this->getImageUrl($sNoImage) : $sImageUrl;
 }
Exemplo n.º 9
0
 /**
  * Get HTML code for meta icons.
  * @return HTML string to insert into HEAD section
  */
 function getMetaIcons()
 {
     $iId = (int) getParam('sys_site_icon');
     $sImageUrlFav = $sImageUrlFcb = $sImageUrlApl = '';
     if (!empty($iId)) {
         // favicon icon
         $oTranscoder = BxDolTranscoderImage::getObjectInstance(BX_DOL_TRANSCODER_OBJ_ICON_FAVICON);
         $sImageUrlFav = $oTranscoder->getFileUrl($iId);
         // facebook icon
         $oTranscoder = BxDolTranscoderImage::getObjectInstance(BX_DOL_TRANSCODER_OBJ_ICON_FACEBOOK);
         $sImageUrlFcb = $oTranscoder->getFileUrl($iId);
         // apple touch icon
         $oTranscoder = BxDolTranscoderImage::getObjectInstance(BX_DOL_TRANSCODER_OBJ_ICON_APPLE);
         $sImageUrlApl = $oTranscoder->getFileUrl($iId);
     }
     if (empty($sImageUrlFav)) {
         $sImageUrlFav = $this->_oTemplate->getIconUrl('favicon.png');
     }
     if (empty($sImageUrlFcb)) {
         $sImageUrlFcb = $this->_oTemplate->getIconUrl('facebook-icon.png');
     }
     if (empty($sImageUrlApl)) {
         $sImageUrlApl = $this->_oTemplate->getIconUrl('apple-touch-icon.png');
     }
     $sRet = '';
     $sRet .= '<link rel="shortcut icon" type="image/x-icon" href="' . $sImageUrlFav . '" />';
     $sRet .= '<link rel="image_src" sizes="100x100" href="' . $sImageUrlFcb . '" />';
     $sRet .= '<link rel="apple-touch-icon" sizes="152x152" href="' . $sImageUrlApl . '" />';
     return $sRet;
 }
Exemplo n.º 10
0
/**
 * page code function
 */
function PageCompMainCode()
{
    ob_start();
    $sTranscoderObject = 'sys_custom_images';
    $sStorageObjectOrig = 'sys_images_custom';
    $iProfileId = bx_get_logged_profile_id();
    if (!isAdmin()) {
        echo "You aren't operator.";
        exit;
    }
    $iPrunedFiles = BxDolTranscoder::pruning();
    if ($iPrunedFiles) {
        echo "iPrunedFiles: {$iPrunedFiles}";
        exit;
    }
    $oTranscoderObject = BxDolTranscoderImage::getObjectInstance($sTranscoderObject);
    if (!$oTranscoderObject) {
        echo "Transcoder object is not available: " . $sTranscoderObject;
        exit;
    }
    //echo "registerHandlers: [" . $oTranscoderObject->registerHandlers() . "] <br />\n";
    $oStorageOrig = BxDolStorage::getObjectInstance($sStorageObjectOrig);
    if (!$oStorageOrig) {
        echo "Storage object is not available: " . $sStorageObjectOrig;
        exit;
    }
    if (isset($_POST['upload'])) {
        $iId = $oStorageOrig->storeFileFromForm($_FILES['file'], true, $iProfileId);
        if ($iId) {
            $iCount = $oStorageOrig->afterUploadCleanup($iId, $iProfileId);
            echo "<h2>Uploaded file id: " . $iId . "(deleted ghosts:" . $iCount . ") </h2>";
        } else {
            echo "<h2>Error uploading file: " . $oStorage->getErrorString() . '</h2><hr class="bx-def-hr" />';
        }
    } elseif (isset($_POST['delete'])) {
        foreach ($_POST['file_id'] as $iFileId) {
            $bRet = $oStorageOrig->deleteFile($iFileId, $iProfileId);
            if ($bRet) {
                echo "<h2>Deleted file id: " . $iFileId . '</h2><hr class="bx-def-hr" />';
            } else {
                echo "<h2>File deleting error: " . $oStorageOrig->getErrorString() . '</h2><hr class="bx-def-hr" />';
            }
        }
    } else {
        $a = $oStorageOrig->getFilesAll();
        foreach ($a as $r) {
            $sUrlImage = $oTranscoderObject->getFileUrl($r['id']);
            ?>
            <div class="bx-def-font-h2 bx-def-margin-sec-topbottom"><?php 
            echo $r['file_name'];
            ?>
</div>
            Size: <input id="size-<?php 
            echo $r['id'];
            ?>
" type="text" class="bx-def-font-inputs bx-form-input-text bx-def-margin-sec-bottom bx-transcoder-custom-images-size" placeholder="320x240" />
            Copy&amp;paste URL: <input id="input-<?php 
            echo $r['id'];
            ?>
" type="text" value="<?php 
            echo $oTranscoderObject->getFileUrlNotReady($r['id']);
            ?>
" class="bx-def-font-inputs bx-form-input-text bx-def-margin-sec-bottom" /> <br />
            <img src="<?php 
            echo $sUrlImage;
            ?>
" style="height:200px; width:auto;" />
            <hr class="bx-def-hr" />
<?php 
        }
    }
    $a = $oStorageOrig->getFilesAll();
    ?>
    <h2>Files List</h2>
    <form method="POST">
        <?php 
    foreach ($a as $r) {
        ?>
            <input type="checkbox" name="file_id[]" value="<?php 
        echo $r['id'];
        ?>
" />
            <?php 
        echo $r['file_name'];
        ?>
            <br />
        <?php 
    }
    ?>
        <input type="submit" name="delete" value="Delete" class="bx-btn bx-btn-small bx-def-margin-sec-top" style="float:none;" />
    </form>
    <hr class="bx-def-hr" /> 


    <h2>Upload</h2>
    <form enctype="multipart/form-data" method="POST">
        <input type="file" name="file" />
        <br />
        <input type="submit" name="upload" value="Upload" class="bx-btn bx-btn-small bx-def-margin-sec-top" style="float:none;" />
    </form>

    <script>
        $(document).ready(function () {
            $('.bx-transcoder-custom-images-size').on('change input', function () {
                var sId = $(this).attr('id').replace('size-', '');
                var a = $('#input-' + sId).val().split('&');
                var aSize = this.value.split('x');
                var s = '';
                for (var i in a) {
                    if (-1 == a[i].indexOf('t=') && -1 == a[i].indexOf('x=') && -1 == a[i].indexOf('y='))
                        s += a[i] + '&';
                }

                s = s.replace(/&$/, '');
                
                if (parseInt(aSize[0]) > 0)
                    s = bx_append_url_params(s, 'x=' + aSize[0]);
                if (parseInt(aSize[1]) > 0)
                    s = bx_append_url_params(s, 'y=' + aSize[1]);

                $('#input-' + sId).val(s);
            });
        });
    </script>
<?php 
    $s = ob_get_clean();
    return DesignBoxContent("Custom images transcoder", $s, BX_DB_PADDING_DEF);
}
Exemplo n.º 11
0
 /**
  * get one just posted comment
  *
  * @param  int    $iCmtId - comment id
  * @return string
  */
 function getComment($mixedCmt, $aBp = array(), $aDp = array())
 {
     $oTemplate = BxDolTemplate::getInstance();
     $iUserId = $this->_getAuthorId();
     $aCmt = !is_array($mixedCmt) ? $this->getCommentRow((int) $mixedCmt) : $mixedCmt;
     if (!$aCmt) {
         return '';
     }
     list($sAuthorName, $sAuthorLink, $sAuthorIcon) = $this->_getAuthorInfo($aCmt['cmt_author_id']);
     $sClass = '';
     if (isset($aCmt['vote_rate']) && (double) $aCmt['vote_rate'] < $this->_aSystem['viewing_threshold']) {
         $oTemplate->pareseHtmlByName('comment_hidden.html', array('js_object' => $this->_sJsObjName, 'id' => $aCmt['cmt_id'], 'title' => bx_process_output(_t('_hidden_comment', $sAuthorName)), 'bx_if:show_replies' => array('condition' => $aCmt['cmt_replies'] > 0, 'content' => array('replies' => _t('_Show N replies', $aCmt['cmt_replies'])))));
         $sClass = ' cmt-hidden';
     }
     if ($aCmt['cmt_author_id'] == $iUserId) {
         $sClass .= ' cmt-mine';
     }
     if (!empty($aDp['blink']) && in_array($aCmt['cmt_id'], $aDp['blink'])) {
         $sClass .= ' cmt-blink';
     }
     $sActions = $this->_getActionsBox($aCmt, $aDp);
     $aTmplReplyTo = array();
     if ((int) $aCmt['cmt_parent_id'] != 0) {
         $aParent = $this->getCommentRow($aCmt['cmt_parent_id']);
         list($sParAuthorName, $sParAuthorLink, $sParAuthorIcon) = $this->_getAuthorInfo($aParent['cmt_author_id']);
         $aTmplReplyTo = array('style_prefix' => $this->_sStylePrefix, 'par_cmt_link' => $this->getBaseUrl() . '#' . $this->_sSystem . $aCmt['cmt_parent_id'], 'par_cmt_title' => bx_html_attribute(_t('_in_reply_to', $sParAuthorName)), 'par_cmt_author' => $sParAuthorName);
     }
     $aTmplImages = array();
     if ($this->isAttachImageEnabled()) {
         $aImages = $this->_oQuery->getImages($this->_aSystem['system_id'], $aCmt['cmt_id']);
         if (!empty($aImages) && is_array($aImages)) {
             $oStorage = BxDolStorage::getObjectInstance($this->getStorageObjectName());
             $oTranscoder = BxDolTranscoderImage::getObjectInstance($this->getTranscoderPreviewName());
             foreach ($aImages as $aImage) {
                 $aTmplImages[] = array('style_prefix' => $this->_sStylePrefix, 'js_object' => $this->_sJsObjName, 'image' => $oTranscoder->getFileUrl($aImage['image_id']), 'image_orig' => $oStorage->getFileUrlById($aImage['image_id']));
             }
         }
     }
     $sReplies = '';
     if ((int) $aCmt['cmt_replies'] > 0 && !empty($aDp) && $aDp['type'] == BX_CMT_DISPLAY_THREADED) {
         $aDp['show_empty'] = false;
         $sReplies = $this->getComments(array('parent_id' => $aCmt['cmt_id'], 'vparent_id' => $aCmt['cmt_id'], 'type' => $aBp['type']), $aDp);
     }
     $sAgo = bx_time_js($aCmt['cmt_time']);
     $bObjectTitle = !empty($this->_aSystem['trigger_field_title']);
     return $oTemplate->parseHtmlByName('comment.html', array_merge(array('system' => $this->_sSystem, 'style_prefix' => $this->_sStylePrefix, 'js_object' => $this->_sJsObjName, 'id' => $aCmt['cmt_id'], 'class' => $sClass, 'bx_if:show_reply_to' => array('condition' => !empty($aTmplReplyTo), 'content' => $aTmplReplyTo), 'bx_if:show_ago_link' => array('condition' => $bObjectTitle, 'content' => array('style_prefix' => $this->_sStylePrefix, 'view_link' => $this->getViewUrl($aCmt['cmt_id']), 'ago' => $sAgo)), 'bx_if:show_ago_text' => array('condition' => !$bObjectTitle, 'content' => array('ago' => $sAgo)), 'bx_if:show_attached' => array('condition' => !empty($aTmplImages), 'content' => array('style_prefix' => $this->_sStylePrefix, 'bx_repeat:attached' => $aTmplImages)), 'actions' => $sActions, 'replies' => $sReplies), $this->_getTmplVarsAuthor($aCmt), $this->_getTmplVarsText($aCmt)));
 }
Exemplo n.º 12
0
 function entryAttachments($aData)
 {
     $oModule = BxDolModule::getInstance($this->MODULE);
     $CNF =& $oModule->_oConfig->CNF;
     bx_import('BxTemplFunctions');
     bx_import('BxDolStorage');
     bx_import('BxDolTranscoderImage');
     $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']);
     $oTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW']);
     $aTranscodersVideo = false;
     if ($CNF['OBJECT_VIDEOS_TRANSCODERS']) {
         $aTranscodersVideo = array('poster' => BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['poster']), 'mp4' => BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['mp4']), 'webm' => BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['webm']));
     }
     $aGhostFiles = $oStorage->getGhosts($aData[$CNF['FIELD_AUTHOR']], $aData[$CNF['FIELD_ID']]);
     if (!$aGhostFiles) {
         return false;
     }
     foreach ($aGhostFiles as $k => $a) {
         $isImage = $oTranscoder && 0 == strncmp('image/', $a['mime_type'], 6);
         // preview for images, transcoder object for preview must be defined
         $isVideo = $aTranscodersVideo && 0 == strncmp('video/', $a['mime_type'], 6);
         // preview for videos, transcoder object for video must be defined
         $sUrlOriginal = $oStorage->getFileUrlById($a['id']);
         $sImgPopupId = 'bx-messages-atachment-popup-' . $a['id'];
         // images are displayed with preview and popup upon clicking
         $aGhostFiles[$k]['bx_if:image'] = array('condition' => $isImage, 'content' => array('url_original' => $sUrlOriginal, 'attr_file_name' => bx_html_attribute($a['file_name']), 'popup_id' => $sImgPopupId, 'url_preview' => $oTranscoder->getFileUrl($a['id']), 'popup' => BxTemplFunctions::getInstance()->transBox($sImgPopupId, '<img src="' . $sUrlOriginal . '" />', true, true)));
         // videos are displayed inline
         $aGhostFiles[$k]['bx_if:video'] = array('condition' => $isVideo, 'content' => array('video' => $aTranscodersVideo ? BxTemplFunctions::getInstance()->videoPlayer($aTranscodersVideo['poster']->getFileUrl($a['id']), $aTranscodersVideo['mp4']->getFileUrl($a['id']), $aTranscodersVideo['webm']->getFileUrl($a['id']), false, '') : ''));
         // non-images are displayed as text links to original file
         $aGhostFiles[$k]['bx_if:not_image'] = array('condition' => !$isImage && !$isVideo, 'content' => array('url_original' => $sUrlOriginal, 'attr_file_name' => bx_html_attribute($a['file_name']), 'file_name' => bx_process_output($a['file_name'])));
     }
     $aVars = array('bx_repeat:attachments' => $aGhostFiles);
     return $this->parseHtmlByName('attachments.html', $aVars);
 }
Exemplo n.º 13
0
 * @{
 */
if (isset($_GET['devicePixelRatio'])) {
    $sDpr = $_GET['devicePixelRatio'];
    if ('' . ceil(intval($sDpr)) !== $sDpr) {
        $sDpr = '1';
    }
    setcookie('devicePixelRatio', $sDpr, time() + 60 * 60 * 24 * 365);
    exit;
}
ob_start();
require_once './inc/header.inc.php';
$sTranscoderObject = bx_process_input(bx_get('o'));
$sHandler = bx_process_input(bx_get('h'));
bx_import('BxDolTranscoderImage');
$oTranscoder = BxDolTranscoderImage::getObjectInstance($sTranscoderObject);
if (!$oTranscoder) {
    ob_end_clean();
    bx_transcoder_error_occured();
    exit;
}
ob_end_clean();
if (!$oTranscoder->isFileReady($sHandler) && !$oTranscoder->transcode($sHandler)) {
    bx_transcoder_error_occured();
    exit;
}
$sImageUrl = $oTranscoder->getFileUrl($sHandler);
if (!$sImageUrl) {
    bx_transcoder_error_occured();
    exit;
}
Exemplo n.º 14
0
 /**
  * Display uploaded, but not saved files - ghosts
  * @return HTML or JSON string
  */
 public function getGhosts($iProfileId, $sFormat, $sImagesTranscoder = false, $iContentId = false)
 {
     bx_import('BxDolStorage');
     $oStorage = BxDolStorage::getObjectInstance($this->_sStorageObject);
     $oImagesTranscoder = false;
     if ($sImagesTranscoder) {
         bx_import('BxDolTranscoderImage');
         $oImagesTranscoder = BxDolTranscoderImage::getObjectInstance($sImagesTranscoder);
     }
     $a = '';
     $aGhosts = $oStorage->getGhosts($iProfileId, $iContentId);
     foreach ($aGhosts as $aFile) {
         $sFileIcon = $oImagesTranscoder && 0 == strncmp($aFile['mime_type'], 'image/', 6) ? $oImagesTranscoder->getFileUrl($aFile['id']) : $this->_oTemplate->getIconUrl($oStorage->getIconNameByFileName($aFile['file_name']));
         $a[$aFile['id']] = array('file_id' => $aFile['id'], 'file_name' => $aFile['file_name'], 'file_title' => $oStorage->getFileTitle($aFile['file_name']), 'file_icon' => $sFileIcon, 'file_url' => $oStorage->getFileUrlById($aFile['id']), 'js_instance_name' => $this->_sUploaderJsInstance);
     }
     if ('json' == $sFormat) {
         return json_encode($a);
     } else {
         // html format is not suported for this data type
         return false;
     }
 }
Exemplo n.º 15
0
 public function serviceAlertResponseFileDeleteOrig($oAlert, $sObject)
 {
     bx_import('BxDolTranscoderImage');
     BxDolTranscoderImage::onAlertResponseFileDeleteOrig($oAlert, $sObject);
 }
Exemplo n.º 16
0
 protected function _getImagesForTimelinePost($aEvent, $aContentInfo, $sUrl)
 {
     $CNF =& $this->_oConfig->CNF;
     if (!($aMediaList = $this->_oDb->getMediaListByContentId($aContentInfo[$CNF['FIELD_ID']]))) {
         return array();
     }
     $oTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW']);
     $aMediaList = array_slice($aMediaList, 0, 3);
     $aOutput = array();
     foreach ($aMediaList as $aMedia) {
         $aOutput[] = array('url' => $this->_oTemplate->getViewMediaUrl($CNF, $aMedia['id']), 'src' => $oTranscoder->getFileUrl($aMedia['file_id']));
     }
     return $aOutput;
 }
Exemplo n.º 17
0
 /**
  * get one just posted comment
  *
  * @param  int    $iCmtId - comment id
  * @return string
  */
 function getComment($mixedCmt, $aBp = array(), $aDp = array())
 {
     $oTemplate = BxDolTemplate::getInstance();
     $iUserId = $this->_getAuthorId();
     $aCmt = !is_array($mixedCmt) ? $this->getCommentRow((int) $mixedCmt) : $mixedCmt;
     list($sAuthorName, $sAuthorLink, $sAuthorIcon) = $this->_getAuthorInfo($aCmt['cmt_author_id']);
     $sClass = '';
     if (isset($aCmt['vote_rate']) && (double) $aCmt['vote_rate'] < $this->_aSystem['viewing_threshold']) {
         $oTemplate->pareseHtmlByName('comment_hidden.html', array('js_object' => $this->_sJsObjName, 'id' => $aCmt['cmt_id'], 'title' => bx_process_output(_t('_hidden_comment', $sAuthorName)), 'bx_if:show_replies' => array('condition' => $aCmt['cmt_replies'] > 0, 'content' => array('replies' => _t('_Show N replies', $aCmt['cmt_replies'])))));
         $sClass = ' cmt-hidden';
     }
     if ($aCmt['cmt_author_id'] == $iUserId) {
         $sClass .= ' cmt-mine';
     }
     if (!empty($aDp['blink']) && in_array($aCmt['cmt_id'], $aDp['blink'])) {
         $sClass .= ' cmt-blink';
     }
     $sActions = $this->_getActionsBox($aCmt, $aDp);
     $sText = $aCmt['cmt_text'];
     $sTextMore = '';
     $iMaxLength = (int) $this->_aSystem['chars_display_max'];
     if (strlen($sText) > $iMaxLength) {
         $iLength = strpos($sText, ' ', $iMaxLength);
         $sTextMore = trim(substr($sText, $iLength));
         $sText = trim(substr($sText, 0, $iLength));
     }
     $sText = $this->_prepareTextForOutput($sText, $aCmt['cmt_id']);
     $sTextMore = $this->_prepareTextForOutput($sTextMore, $aCmt['cmt_id']);
     $aTmplReplyTo = array();
     if ((int) $aCmt['cmt_parent_id'] != 0) {
         $aParent = $this->getCommentRow($aCmt['cmt_parent_id']);
         list($sParAuthorName, $sParAuthorLink, $sParAuthorIcon) = $this->_getAuthorInfo($aParent['cmt_author_id']);
         $aTmplReplyTo = array('style_prefix' => $this->_sStylePrefix, 'par_cmt_link' => $this->getBaseUrl() . '#' . $this->_sSystem . $aCmt['cmt_parent_id'], 'par_cmt_author' => $sParAuthorName);
     }
     $aTmplImages = array();
     if ($this->isAttachImageEnabled()) {
         $aImages = $this->_oQuery->getImages($this->_aSystem['system_id'], $aCmt['cmt_id']);
         if (!empty($aImages) && is_array($aImages)) {
             bx_import('BxDolStorage');
             $oStorage = BxDolStorage::getObjectInstance($this->getStorageObjectName());
             bx_import('BxDolTranscoderImage');
             $oTranscoder = BxDolTranscoderImage::getObjectInstance($this->getTranscoderPreviewName());
             foreach ($aImages as $aImage) {
                 $aTmplImages[] = array('style_prefix' => $this->_sStylePrefix, 'js_object' => $this->_sJsObjName, 'image' => $oTranscoder->getFileUrl($aImage['image_id']), 'image_orig' => $oStorage->getFileUrlById($aImage['image_id']));
             }
         }
     }
     $sReplies = '';
     if ((int) $aCmt['cmt_replies'] > 0 && !empty($aDp) && $aDp['type'] == BX_CMT_DISPLAY_THREADED) {
         $sReplies = $this->getComments(array('parent_id' => $aCmt['cmt_id'], 'vparent_id' => $aCmt['cmt_id'], 'type' => $aBp['type']), $aDp);
     }
     $bAuthorIcon = !empty($sAuthorIcon);
     return $oTemplate->parseHtmlByName('comment.html', array('system' => $this->_sSystem, 'style_prefix' => $this->_sStylePrefix, 'js_object' => $this->_sJsObjName, 'id' => $aCmt['cmt_id'], 'class' => $sClass, 'bx_if:show_icon' => array('condition' => $bAuthorIcon, 'content' => array('author_icon' => $sAuthorIcon)), 'bx_if:show_icon_empty' => array('condition' => !$bAuthorIcon, 'content' => array()), 'bx_if:show_author_link' => array('condition' => !empty($sAuthorLink), 'content' => array('author_link' => $sAuthorLink, 'author_name' => $sAuthorName)), 'bx_if:show_author_text' => array('condition' => empty($sAuthorLink), 'content' => array('author_name' => $sAuthorName)), 'bx_if:show_reply_to' => array('condition' => !empty($aTmplReplyTo), 'content' => $aTmplReplyTo), 'text' => $sText, 'bx_if:show_more' => array('condition' => !empty($sTextMore), 'content' => array('style_prefix' => $this->_sStylePrefix, 'js_object' => $this->_sJsObjName, 'text_more' => $sTextMore)), 'bx_if:show_attached' => array('condition' => !empty($aTmplImages), 'content' => array('style_prefix' => $this->_sStylePrefix, 'bx_repeat:attached' => $aTmplImages)), 'actions' => $sActions, 'replies' => $sReplies));
 }
Exemplo n.º 18
0
 protected function _getImagesForTimelinePost($aEvent, $aContentInfo, $sUrl)
 {
     $CNF =& $this->_oConfig->CNF;
     $sImage = '';
     if (isset($aContentInfo[$CNF['FIELD_THUMB']]) && $aContentInfo[$CNF['FIELD_THUMB']]) {
         $oTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_GALLERY']);
         if ($oTranscoder) {
             $sImage = $oTranscoder->getFileUrl($aContentInfo[$CNF['FIELD_THUMB']]);
         }
     }
     if (empty($sImage)) {
         return array();
     }
     return array(array('url' => $sUrl, 'src' => $sImage));
 }
Exemplo n.º 19
0
 /**
  * 
  * Process the list of transcoders provided in config array. 
  * Transcoder objects to automatically register/unregister necessary alerts for.
  * @param string $sOperation - operation type.
  */
 protected function actionUnregisterTranscoders($sOperation)
 {
     if (empty($this->_aConfig['transcoders'])) {
         return BX_DOL_STUDIO_INSTALLER_FAILED;
     }
     BxDolTranscoderImage::unregisterHandlersArray($this->_aConfig['transcoders']);
     BxDolTranscoderImage::cleanupObjectsArray($this->_aConfig['transcoders']);
     return BX_DOL_STUDIO_INSTALLER_SUCCESS;
 }
Exemplo n.º 20
0
 protected function _getCommonData(&$aEvent)
 {
     $oModule = $this->getModule();
     $sJsObject = $this->_oConfig->getJsObject('view');
     $sPrefix = $this->_oConfig->getPrefix('common_post');
     $sType = str_replace($sPrefix, '', $aEvent['type']);
     $aResult = array('owner_id' => $aEvent['object_id'], 'content_type' => $sType, 'content' => array('sample' => '_bx_timeline_txt_sample', 'url' => $this->_oConfig->getItemViewUrl($aEvent)), 'votes' => '', 'comments' => '', 'title' => '', 'description' => '');
     switch ($sType) {
         case BX_TIMELINE_PARSE_TYPE_POST:
             if (!empty($aEvent['content'])) {
                 $aResult['content'] = array_merge($aResult['content'], unserialize($aEvent['content']));
             }
             $aLinks = $this->_oDb->getLinks($aEvent['id']);
             if (!empty($aLinks) && is_array($aLinks)) {
                 foreach ($aLinks as $aLink) {
                     $aResult['content']['links'][] = array('url' => $aLink['url'], 'title' => $aLink['title'], 'text' => $aLink['text']);
                 }
             }
             $aPhotos = $this->_oDb->getMedia(BX_TIMELINE_MEDIA_PHOTO, $aEvent['id']);
             if (!empty($aPhotos) && is_array($aPhotos)) {
                 $oStorage = BxDolStorage::getObjectInstance($this->_oConfig->getObject('storage_photos'));
                 $oTranscoder = BxDolTranscoderImage::getObjectInstance($this->_oConfig->getObject('transcoder_photos_view'));
                 foreach ($aPhotos as $iPhotoId) {
                     $sPhotoSrcOrig = $oStorage->getFileUrlById($iPhotoId);
                     $aResult['content']['images'][] = array('src' => $oTranscoder->getFileUrl($iPhotoId), 'src_orig' => $sPhotoSrcOrig, 'title' => '', 'onclick' => $sJsObject . '.showPhoto(this, \'' . $sPhotoSrcOrig . '\')');
                 }
             }
             $aVideos = $this->_oDb->getMedia(BX_TIMELINE_MEDIA_VIDEO, $aEvent['id']);
             if (!empty($aVideos) && is_array($aVideos)) {
                 $oTranscoderPoster = BxDolTranscoderVideo::getObjectInstance($this->_oConfig->getObject('transcoder_videos_poster'));
                 $oTranscoderMp4 = BxDolTranscoderVideo::getObjectInstance($this->_oConfig->getObject('transcoder_videos_mp4'));
                 $oTranscoderWebm = BxDolTranscoderVideo::getObjectInstance($this->_oConfig->getObject('transcoder_videos_webm'));
                 foreach ($aVideos as $iVideoId) {
                     $aResult['content']['videos'][] = array('src_poster' => $oTranscoderPoster->getFileUrl($iVideoId), 'src_mp4' => $oTranscoderMp4->getFileUrl($iVideoId), 'src_webm' => $oTranscoderWebm->getFileUrl($iVideoId));
                 }
             }
             break;
         case BX_TIMELINE_PARSE_TYPE_SHARE:
             if (empty($aEvent['content'])) {
                 return array();
             }
             $aContent = unserialize($aEvent['content']);
             if (!$this->_oConfig->isSystem($aContent['type'], $aContent['action'])) {
                 $aShared = $this->_oDb->getEvents(array('browse' => 'id', 'value' => $aContent['object_id']));
                 $aShared = $this->_getCommonData($aShared);
             } else {
                 $aShared = $this->_getSystemData($aContent);
             }
             if (empty($aShared) || !is_array($aShared)) {
                 return array();
             }
             $aResult['content'] = array_merge($aContent, $aShared['content']);
             $aResult['content']['parse_type'] = !empty($aShared['content_type']) ? $aShared['content_type'] : BX_TIMELINE_PARSE_TYPE_DEFAULT;
             $aResult['content']['owner_id'] = $aShared['owner_id'];
             list($aResult['content']['owner_name'], $aResult['content']['owner_url']) = $oModule->getUserInfo($aShared['owner_id']);
             list($sUserName) = $oModule->getUserInfo($aEvent['object_id']);
             $sSample = !empty($aResult['content']['sample']) ? $aResult['content']['sample'] : '_bx_timeline_txt_sample';
             $aResult['title'] = _t('_bx_timeline_txt_user_shared_sample', $sUserName, $aResult['content']['owner_name'], _t($sSample));
             $aResult['description'] = '';
             break;
     }
     $sSystem = $this->_oConfig->getObject('vote');
     if ($oModule->getVoteObject($sSystem, $aEvent['id']) !== false) {
         $aResult['votes'] = array('system' => $sSystem, 'object_id' => $aEvent['id'], 'count' => $aEvent['votes']);
     }
     $sSystem = $this->_oConfig->getObject('comment');
     if ($oModule->getCmtsObject($sSystem, $aEvent['id']) !== false) {
         $aResult['comments'] = array('system' => $sSystem, 'object_id' => $aEvent['id'], 'count' => $aEvent['comments']);
     }
     return $aResult;
 }
Exemplo n.º 21
0
 protected function getIcon()
 {
     $oTemplate = BxDolStudioTemplate::getInstance();
     $sPreview = "";
     $aTmplVars = array('bx_repeat:images' => array());
     if (($iId = (int) getParam('sys_site_icon')) != 0) {
         $aTranscoders = array(BX_DOL_TRANSCODER_OBJ_ICON_APPLE => '_adm_dsg_txt_icon_apple', BX_DOL_TRANSCODER_OBJ_ICON_FACEBOOK => '_adm_dsg_txt_icon_facebook', BX_DOL_TRANSCODER_OBJ_ICON_FAVICON => '_adm_dsg_txt_icon_favicon');
         foreach ($aTranscoders as $sTranscoder => $sTitle) {
             $oTranscoder = BxDolTranscoderImage::getObjectInstance($sTranscoder);
             $sImageUrl = $oTranscoder->getFileUrl($iId);
             if ($sImageUrl === false) {
                 setParam('sys_site_icon', 0);
                 break;
             }
             $aTmplVars['bx_repeat:images'][] = array('caption' => _t($sTitle), 'url' => $sImageUrl);
         }
         $sPreview = $oTemplate->parseHtmlByName('dsr_icon_preview.html', $aTmplVars);
     }
     $aForm = array('form_attrs' => array('id' => $this->sIconFormId, 'name' => $this->sIconFormId, 'action' => BX_DOL_URL_STUDIO . 'designer.php', 'method' => 'post', 'enctype' => 'multipart/form-data', 'target' => $this->sIconIframeId), 'params' => array('db' => array('table' => '', 'key' => '', 'uri' => '', 'uri_title' => '', 'submit_name' => 'save')), 'inputs' => array('page' => array('type' => 'hidden', 'name' => 'page', 'value' => $this->sPage), 'preview' => array('type' => 'custom', 'name' => 'preview', 'content' => $sPreview), 'image' => array('type' => 'file', 'name' => 'image', 'caption' => _t('_adm_dsg_txt_upload_icon')), 'save' => array('type' => 'submit', 'name' => 'save', 'value' => _t('_adm_btn_designer_submit'))));
     $oForm = new BxTemplStudioFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         echo $this->submitIcon($oForm);
         exit;
     }
     $aTmplVars = array('js_object' => $this->getPageJsObject(), 'bx_repeat:blocks' => array(array('caption' => '', 'panel_top' => '', 'items' => $oTemplate->parseHtmlByName('dsr_icon.html', array('icon_iframe_id' => $this->sIconIframeId, 'form' => $oForm->getCode())), 'panel_bottom' => '')));
     return $oTemplate->parseHtmlByName('designer.html', $aTmplVars);
 }
Exemplo n.º 22
0
 protected function mediaVars($aMediaInfo, $sImageTranscoder = false, $sVideoPosterTranscoder = false, $aParams = array())
 {
     $oModule = BxDolModule::getInstance($this->MODULE);
     $CNF =& $oModule->_oConfig->CNF;
     $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']);
     $oTranscoder = BxDolTranscoderImage::getObjectInstance($sImageTranscoder);
     $aTranscodersVideo = false;
     if ($CNF['OBJECT_VIDEOS_TRANSCODERS']) {
         $aTranscodersVideo = array('poster' => BxDolTranscoderImage::getObjectInstance($sVideoPosterTranscoder), 'mp4' => BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['mp4']), 'webm' => BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_VIDEOS_TRANSCODERS']['webm']));
     }
     $aFileInfo = $oStorage->getFile($aMediaInfo['file_id']);
     if (!$aFileInfo) {
         return '';
     }
     $isImage = 0 == strncmp('image/', $aFileInfo['mime_type'], 6);
     // preview for images, transcoder object for preview must be defined
     $isVideo = $aTranscodersVideo && 0 == strncmp('video/', $aFileInfo['mime_type'], 6);
     // preview for videos, transcoder object for video must be defined
     $sMediaTitle = bx_process_output($aMediaInfo['title']);
     $sMediaTitleAttr = bx_html_attribute($aMediaInfo['title']);
     $mixedContext = isset($aParams['context']) ? $aParams['context'] : '';
     $sUrl = $this->getViewMediaUrl($CNF, $aMediaInfo['id'], $mixedContext);
     $aSize = $aMediaInfo['data'] ? explode('x', $aMediaInfo['data']) : array(0, 0);
     $aVars = array('bx_if:image' => array('condition' => $isImage, 'content' => array('title_attr' => $sMediaTitleAttr, 'title' => $sMediaTitle, 'url' => $sUrl, 'url_img' => $oTranscoder ? $oTranscoder->getFileUrl($aFileInfo['id']) : $oStorage->getFileUrlById($aFileInfo['id']), 'media_id' => $aMediaInfo['id'], 'w' => $aSize[0], 'h' => $aSize[1], 'context' => $mixedContext)), 'bx_if:video' => array('condition' => $isVideo, 'content' => array('title_attr' => $sMediaTitleAttr, 'title' => $sMediaTitle, 'url' => $sUrl, 'url_img' => $isVideo ? $aTranscodersVideo['poster']->getFileUrl($aMediaInfo['file_id']) : '', 'video' => $isVideo && $aTranscodersVideo ? BxTemplFunctions::getInstance()->videoPlayer($aTranscodersVideo['poster']->getFileUrl($aMediaInfo['file_id']), $aTranscodersVideo['mp4']->getFileUrl($aMediaInfo['file_id']), $aTranscodersVideo['webm']->getFileUrl($aMediaInfo['file_id']), false, 'max-height:' . $CNF['OBJECT_VIDEO_TRANSCODER_HEIGHT']) : '')));
     return $aVars;
 }