Esempio n. 1
0
 /**
  * Get menu code.
  * @return string
  */
 public function getCode()
 {
     $aMenuItemSelected = $this->_getSelectedMenuItem();
     if (isset($aMenuItemSelected['set_name']) && 'sys_site' == $aMenuItemSelected['set_name'] && 'home' == $aMenuItemSelected['name']) {
         return '';
     }
     $this->_addJsCss();
     $oMenuSubmenu = BxDolMenu::getObjectInstance($this->_sObjectSubmenu);
     $aVars = array('object' => $this->_sObject, 'id' => 'bx-menu-submenu-menu', 'title' => $aMenuItemSelected['title'], 'link' => BxDolPermalinks::getInstance()->permalink($aMenuItemSelected['link']), 'popup' => $oMenuSubmenu ? BxTemplFunctions::getInstance()->transBox('bx-menu-submenu-menu', '<div class="bx-def-padding">' . $oMenuSubmenu->getCode() . '</div>', true) : '', 'bx_if:menu' => array('condition' => $oMenuSubmenu, 'content' => array()), 'bx_if:image' => array('condition' => false !== strpos($aMenuItemSelected['icon'], '.'), 'content' => array('icon_url' => $aMenuItemSelected['icon'])), 'bx_if:icon' => array('condition' => false === strpos($aMenuItemSelected['icon'], '.'), 'content' => array('icon' => $aMenuItemSelected['icon'])), 'bx_repeat:menus' => array());
     $aMenus = $this->getSubmenuParams($aMenuItemSelected);
     foreach ($aMenus as $aMenu) {
         $sPopupContent = '';
         if (isset($aMenu['object']) && ($oMenu = BxDolMenu::getObjectInstance($aMenu['object']))) {
             $sPopupContent = $oMenu->getCode();
         } elseif (isset($aMenu['service']) && is_array($aMenu['service'])) {
             $sPopupContent = BxDolService::call($aMenu['service']['module'], $aMenu['service']['method'], isset($aMenu['service']['params']) ? $aMenu['service']['params'] : array(), isset($aMenu['service']['class']) ? $aMenu['service']['class'] : 'Module');
         }
         if (!$sPopupContent) {
             continue;
         }
         $aVars['bx_repeat:menus'][] = array('id' => $aMenu['id'], 'icon' => $aMenu['icon'], 'popup' => BxTemplFunctions::getInstance()->transBox($aMenu['id'], '<div class="bx-def-padding">' . $sPopupContent . '</div>', true));
     }
     if (!$aVars['bx_repeat:menus'] && (!$oMenuSubmenu || !$aMenuItemSelected)) {
         return '';
     }
     $sMenu = $this->_oTemplate->parseHtmlByName($this->_aObject['template'], $aVars);
     return $this->_oTemplate->parseHtmlByName('menu_main_submenu_wrapper.html', array('menu' => $sMenu));
 }
Esempio n. 2
0
 public function performActionAdd()
 {
     $sAction = 'add';
     $sMsg = $this->_oModule->isAllowedAdd();
     if ($sMsg !== CHECK_ACTION_RESULT_ALLOWED) {
         $this->_echoResultJson(array('msg' => $sMsg), true);
         return;
     }
     $oForm = BxDolForm::getObjectInstance('bx_sites', 'bx_sites_site_add');
     if (!$oForm) {
         $this->_echoResultJson(array('msg' => _t('_sys_txt_error_occured')), true);
         return;
     }
     $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction;
     $oForm->initChecker();
     if (!$oForm->isSubmittedAndValid()) {
         $sContent = BxTemplFunctions::getInstance()->popupBox('bx-sites-site-create-popup', _t('_bx_sites_grid_browse_popup_create'), $this->_oModule->_oTemplate->parseHtmlByName('block_create.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
         $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
         return;
     }
     $sDomain = $oForm->getCleanValue('domain');
     if ($this->_oModule->_oDb->isAccount(array('domain' => $sDomain))) {
         $this->_echoResultJson(array('msg' => _t('_bx_sites_txt_err_site_exists')), true);
         return;
     }
     $iAccountId = $oForm->insert(array('owner_id' => bx_get_logged_profile_id(), 'created' => time(), 'status' => BX_SITES_ACCOUNT_STATUS_UNCONFIRMED));
     if (!$iAccountId) {
         $this->_echoResultJson(array('msg' => _t('_bx_sites_txt_err_site_creation')), true);
         return;
     }
     $oAccount = $this->_oModule->getObject('Account');
     $oAccount->onAccountCreated($iAccountId);
     $sUrl = $this->_oModule->startSubscription($iAccountId);
     $this->_echoResultJson(array('eval' => 'window.open(\'' . $sUrl . '\', \'_self\');', 'popup_not_hide' => 1), true);
 }
 /**
  * Show uploader form.
  * @return HTML string
  */
 public function getUploaderForm($isMultiple = true, $iContentId = false)
 {
     parent::getUploaderForm($isMultiple, $iContentId);
     $sForm = $this->_oTemplate->parseHtmlByName('uploader_form_simple.html', array('form_container_id' => $this->_sFormContainerId, 'errors_container_id' => $this->_sErrorsContainerId, 'uploader_instance_name' => $this->getNameJsInstanceUploader(), 'restrictions_text' => $this->getRestrictionsText(), 'iframe_id' => $this->_sIframeId, 'engine' => $this->_aObject['object'], 'storage_object' => $this->_sStorageObject, 'uniq_id' => $this->_sUniqId, 'multiple' => $isMultiple, 'content_id' => $iContentId));
     bx_import('BxTemplFunctions');
     return BxTemplFunctions::getInstance()->transBox('', $sForm);
 }
Esempio n. 4
0
 public function getProfilesByAccount($aContentInfo, $iMaxVisible = 2)
 {
     $oProfilesQuery = BxDolProfileQuery::getInstance();
     $aProfiles = $oProfilesQuery->getProfilesByAccount($aContentInfo['id']);
     $iProfiles = count($aProfiles);
     $aTmplVars = array('class_cnt' => '', 'bx_repeat:profiles' => array(), 'bx_if:profiles_more' => array('condition' => $iProfiles > $iMaxVisible, 'content' => array('html_id' => $this->_oConfig->getHtmlIds('profile_more_popup') . $aContentInfo['id'], 'more' => _t('_bx_accnt_txt_more', $iProfiles - $iMaxVisible), 'more_attr' => bx_html_attribute(_t('_bx_accnt_txt_see_more')), 'popup' => '')));
     $aTmplVarsPopup = array('class_cnt' => ' bx-def-padding', 'bx_repeat:profiles' => array(), 'bx_if:profiles_more' => array('condition' => false, 'content' => array()));
     $i = 0;
     foreach ($aProfiles as $iProfileId => $aProfile) {
         $oProfile = BxDolProfile::getInstance($iProfileId);
         if (!$oProfile) {
             continue;
         }
         $sName = $oProfile->getDisplayName();
         $aTmplVarsProfile = array('html_id' => $this->_oConfig->getHtmlIds('profile') . $aProfile['id'], 'id' => $oProfile->id(), 'url' => $oProfile->getUrl(), 'name' => $sName, 'name_attr' => bx_html_attribute($sName));
         if ($i < $iMaxVisible) {
             $aTmplVars['bx_repeat:profiles'][] = $aTmplVarsProfile;
         }
         if ($i >= $iMaxVisible) {
             $aTmplVarsPopup['bx_repeat:profiles'][] = $aTmplVarsProfile;
         }
         ++$i;
     }
     if ($aTmplVarsPopup['bx_repeat:profiles']) {
         $aTmplVars['bx_if:profiles_more']['content']['popup'] = BxTemplFunctions::getInstance()->transBox('', $this->parseHtmlByName('profiles.html', $aTmplVarsPopup));
     }
     return $this->parseHtmlByName('profiles.html', $aTmplVars);
 }
Esempio n. 5
0
 /**
  * Show uploader form.
  * @return HTML string
  */
 public function getUploaderForm($isMultiple = true, $iContentId = false)
 {
     parent::getUploaderForm($isMultiple, $iContentId);
     $sForm = $this->_oTemplate->parseHtmlByName('uploader_form_html5.html', array('form_container_id' => $this->_sFormContainerId, 'errors_container_id' => $this->_sErrorsContainerId, 'uploader_instance_name' => $this->getNameJsInstanceUploader(), 'restrictions_text' => $this->getRestrictionsText(), 'div_id' => $this->_sDivId, 'content_id' => $iContentId));
     bx_import('BxTemplFunctions');
     return BxTemplFunctions::getInstance()->transBox('', $sForm);
 }
 /**
  * Get profile cover
  */
 function cover($aData, $sTemplateName = 'cover.html')
 {
     $CNF =& $this->_oConfig->CNF;
     bx_import('BxDolPermalinks');
     $oModule = BxDolModule::getInstance($this->MODULE);
     $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aData[$CNF['FIELD_ID']]);
     $sUrlPicture = $this->urlPicture($aData);
     $sUrlAvatar = $this->urlAvatar($aData);
     $sUrlPictureChange = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_EDIT_ENTRY'] . '&id=' . $aData[$CNF['FIELD_ID']]);
     $sUrlCover = $this->urlCover($aData);
     $sUrlCoverChange = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_EDIT_COVER'] . '&id=' . $aData[$CNF['FIELD_ID']]);
     $sCoverPopup = '';
     $sCoverPopupId = $this->MODULE . '-popup-cover';
     if ($aData[$CNF['FIELD_COVER']]) {
         bx_import('BxTemplFunctions');
         $sCoverPopup = BxTemplFunctions::getInstance()->transBox($sCoverPopupId, $this->parseHtmlByName('image_popup.html', array('image_url' => $sUrlCover, 'bx_if:owner' => array('condition' => CHECK_ACTION_RESULT_ALLOWED === $oModule->checkAllowedChangeCover($aData), 'content' => array('change_image_url' => $sUrlCoverChange)))), true, true);
     }
     $sPicturePopup = '';
     $sPicturePopupId = $this->MODULE . '-popup-picture';
     if ($aData[$CNF['FIELD_PICTURE']]) {
         bx_import('BxTemplFunctions');
         $sPicturePopup = BxTemplFunctions::getInstance()->transBox($sPicturePopupId, $this->parseHtmlByName('image_popup.html', array('image_url' => $sUrlPicture, 'bx_if:owner' => array('condition' => CHECK_ACTION_RESULT_ALLOWED === $oModule->checkAllowedEdit($aData), 'content' => array('change_image_url' => $sUrlPictureChange)))), true, true);
     }
     // generate html
     $aVars = array('id' => $aData[$CNF['FIELD_ID']], 'content_url' => $sUrl, 'title' => $aData[$CNF['FIELD_NAME']], 'picture_avatar_url' => $sUrlAvatar, 'picture_popup' => $sPicturePopup, 'picture_popup_id' => $sPicturePopupId, 'picture_url' => $sUrlPicture, 'picture_href' => !$aData[$CNF['FIELD_PICTURE']] && CHECK_ACTION_RESULT_ALLOWED === $oModule->checkAllowedEdit($aData) ? $sUrlPictureChange : 'javascript:void(0);', 'cover_popup' => $sCoverPopup, 'cover_popup_id' => $sCoverPopupId, 'cover_url' => $sUrlCover, 'cover_href' => !$aData[$CNF['FIELD_COVER']] && CHECK_ACTION_RESULT_ALLOWED === $oModule->checkAllowedChangeCover($aData) ? $sUrlCoverChange : 'javascript:void(0);');
     return $this->parseHtmlByName($sTemplateName, $aVars);
 }
 public function performActionSetAclLevel()
 {
     $oMenu = BxDolMenu::getObjectInstance('sys_set_acl_level');
     $aIds = bx_get('ids');
     if (!$aIds || !is_array($aIds) || !$oMenu) {
         $this->_echoResultJson(array());
         return;
     }
     $aIdsResult = array();
     foreach ($aIds as $iId) {
         $aContentInfo = $this->_oModule->_oDb->getContentInfoById($iId);
         if ($this->_oModule->checkAllowedSetMembership($aContentInfo) !== CHECK_ACTION_RESULT_ALLOWED) {
             continue;
         }
         $aIdsResult[] = $this->_getProfileId($iId);
     }
     if (empty($aIdsResult)) {
         $this->_echoResultJson(array());
         return;
     }
     if (count($aIdsResult) == 1) {
         $aIdsResult = $aIdsResult[0];
     }
     $sContent = $this->_oTemplate->parseHtmlByName('set_acl_popup.html', array('content' => $oMenu->getCode($aIdsResult)));
     $sContent = BxTemplFunctions::getInstance()->transBox($this->_oModule->_oConfig->getName() . 'set_acl_level_popup', $sContent);
     $this->_echoResultJson(array('popup' => $sContent), true);
 }
Esempio n. 8
0
 public function serviceDnsblList()
 {
     bx_import('BxTemplFunctions');
     $s = _t('_bx_antispam_dnsbl_status', BxTemplFunctions::getInstance()->statusOnOff((bool) $this->_oConfig->getAntispamOption('dnsbl_enable'), true), BxTemplFunctions::getInstance()->statusOnOff((bool) $this->_oConfig->getAntispamOption('uridnsbl_enable'), true), mb_strtolower(_t('_bx_antispam_dnsbl_behaviour_login_' . $this->_oConfig->getAntispamOption('dnsbl_behaviour_login'))), mb_strtolower(_t('_bx_antispam_dnsbl_behaviour_join_' . $this->_oConfig->getAntispamOption('dnsbl_behaviour_join'))));
     $s .= $this->_grid('bx_antispam_grid_dnsbl');
     return $s;
 }
Esempio n. 9
0
 public function getLinkPopup($sLink)
 {
     $sId = $this->_oConfig->getHtmlIds('link_popup');
     $sTitle = _t('_bx_invites_txt_link_popup_title');
     $sContent = $this->parseHtmlByName('popup_link.html', array('style_prefix' => $this->_oConfig->getPrefix('style'), 'html_id_link' => $this->_oConfig->getHtmlIds('link_input'), 'link' => $sLink));
     return BxTemplFunctions::getInstance()->popupBox($sId, $sTitle, $sContent, true);
 }
Esempio n. 10
0
/**
 * page code function
 */
function PageCompMainCode()
{
    ob_start();
    // transBox
    echo BxTemplFunctions::getInstance()->transBox('bx-sample-popup-transbox', '<div class="bx-def-padding">transBox</div>', true);
    echo '<button class="bx-btn" onclick="$(\'#bx-sample-popup-transbox\').dolPopup()">transBox</button>';
    // transBox AJAX
    echo '<button class="bx-btn bx-def-margin-left" onclick="$(window).dolPopupAjax({url: \'samples/popup.php?_t=a' . time() . '\'})">transBox AJAX</button>';
    // popupBox
    echo BxTemplFunctions::getInstance()->popupBox('bx-sample-popup-box', 'popupBox', 'popupBox content', true);
    echo '<button class="bx-btn bx-def-margin-left" onclick="$(\'#bx-sample-popup-box\').dolPopup()">popupBox</button>';
    // popupBox without fog
    echo BxTemplFunctions::getInstance()->popupBox('bx-sample-popup-box-without-fog', 'popupBox', 'popupBox without fog content', true);
    echo '<button class="bx-btn bx-def-margin-left" onclick="$(\'#bx-sample-popup-box-without-fog\').dolPopup({fog:0})">popupBox without fog</button>';
    echo '<div class="bx-clear"></div>';
    echo '<hr class="bx-def-hr" />';
    // transBox with pointer
    echo BxTemplFunctions::getInstance()->transBox('bx-sample-popup-transbox-with-pointer', '<div class="bx-def-padding">transBox with pointer</div>', true);
    echo '<button class="bx-btn" onclick="$(\'#bx-sample-popup-transbox-with-pointer\').dolPopup({pointer:{el:$(this)}})">transBox with pointer</button>';
    // popupBox with pointer
    echo BxTemplFunctions::getInstance()->popupBox('bx-sample-popup-box-with-pointer', 'popupBox', 'popupBox with pointer content', true);
    echo '<button class="bx-btn bx-def-margin-left" onclick="$(\'#bx-sample-popup-box-with-pointer\').dolPopup({pointer:{el:$(this)}})">popupBox with pointer</button>';
    // popupBox with pointer AJAX
    echo BxTemplFunctions::getInstance()->popupBox('bx-sample-popup-box-with-pointer', 'popupBox', 'popupBox with pointer AJAX', true);
    echo '<button class="bx-btn bx-def-margin-left" onclick="$(this).dolPopupAjax({url: \'samples/popup.php?_t=b' . time() . '\'})">popupBox with pointer AJAX</button>';
    echo '<div class="bx-clear"></div>';
    return DesignBoxContent("Sample popup", ob_get_clean(), BX_DB_PADDING_DEF);
}
 public function performActionImport()
 {
     $oGrid = BxDolGrid::getObjectInstance('sys_studio_nav_import');
     if (!$oGrid) {
         return '';
     }
     $sContent = BxTemplFunctions::getInstance()->popupBox('adm-nav-item-import-popup', _t('_adm_nav_txt_items_import_popup'), $this->_oTemplate->parseHtmlByName('nav_import_item.html', array('grid' => $oGrid->getCode())));
     $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
 }
Esempio n. 12
0
 function __construct($oFunctions = false)
 {
     parent::__construct();
     if ($oFunctions) {
         $this->oFunctions = $oFunctions;
     } else {
         $this->oFunctions = BxTemplFunctions::getInstance();
     }
 }
Esempio n. 13
0
 public function performActionInfo()
 {
     $aIds = bx_get('ids');
     if (!$aIds || !is_array($aIds)) {
         $this->_echoResultJson(array());
         exit;
     }
     $aRequest = $this->_oModule->_oDb->getRequests(array('type' => 'by_id', 'value' => (int) array_shift($aIds)));
     if (empty($aRequest) || !is_array($aRequest)) {
         $this->_echoResultJson(array());
         exit;
     }
     $sContent = BxTemplFunctions::getInstance()->transBox('bx-invites-info-popup', $this->_oModule->_oTemplate->getBlockRequestText($aRequest));
     $this->_echoResultJson(array('popup' => array('html' => $sContent)), true);
 }
Esempio n. 14
0
/**
 * page code function
 */
function PageCompMainCode()
{
    ob_start();
    // transBox
    echo BxTemplFunctions::getInstance()->transBox('bx-sample-popup-transbox', '<div class="bx-def-padding">transBox</div>', true);
    echo '<div></div><button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-transbox\').dolPopup()">transBox</button>';
    // transBox AJAX
    echo '<button class="bx-btn bx-def-margin-sec" onclick="$(window).dolPopupAjax({url: \'samples/popup.php?_t=a' . time() . '\'})">transBox AJAX</button>';
    // popupBox
    echo BxTemplFunctions::getInstance()->popupBox('bx-sample-popup-box', 'popupBox', 'popupBox content', true);
    echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-box\').dolPopup()">popupBox</button>';
    // popupBox without fog
    echo BxTemplFunctions::getInstance()->popupBox('bx-sample-popup-box-without-fog', 'popupBox', 'popupBox without fog content', true);
    echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-box-without-fog\').dolPopup({fog:0})">popupBox without fog</button>';
    echo '<div class="bx-clear"></div>';
    echo '<hr class="bx-def-hr" />';
    // transBox
    echo BxTemplFunctions::getInstance()->transBox('bx-sample-popup-transbox-scrolled', '<div class="bx-def-padding">' . str_repeat('transBox transBox transBox <br />', 100) . '</div>', true);
    echo '<div></div><button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-transbox-scrolled\').dolPopup()">transBox scrolled</button>';
    // popupBox
    echo BxTemplFunctions::getInstance()->popupBox('bx-sample-popup-box-scrolled', 'popupBox', str_repeat('popupBox ', 1000), true);
    echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-box-scrolled\').dolPopup()">popupBox scrolled</button>';
    echo '<div class="bx-clear"></div>';
    echo '<hr class="bx-def-hr" />';
    // transBox with pointer
    echo BxTemplFunctions::getInstance()->transBox('bx-sample-popup-transbox-with-pointer', '<div class="bx-def-padding">transBox with pointer</div>', true);
    echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-transbox-with-pointer\').dolPopup({pointer:{el:$(this)}})">transBox with pointer</button>';
    // popupBox with pointer
    echo BxTemplFunctions::getInstance()->popupBox('bx-sample-popup-box-with-pointer', 'popupBox', 'popupBox with pointer content', true);
    echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-box-with-pointer\').dolPopup({pointer:{el:$(this)}})">popupBox with pointer</button>';
    // popupBox with pointer AJAX
    echo BxTemplFunctions::getInstance()->popupBox('bx-sample-popup-box-with-pointer', 'popupBox', 'popupBox with pointer AJAX', true);
    echo '<button class="bx-btn bx-def-margin-sec" onclick="$(this).dolPopupAjax({url: \'samples/popup.php?_t=b' . time() . '\'})">popupBox with pointer AJAX</button>';
    echo '<div class="bx-clear"></div>';
    echo '<hr class="bx-def-hr" />';
    // image popup
    echo BxTemplFunctions::getInstance()->transBox('bx-sample-popup-image', '<img src="samples/img/landscape.jpg" />', true, true);
    echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-image\').dolPopupImage(\'samples/img/landscape.jpg\', this)">popupImage (landscape)</button>';
    echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-image\').dolPopupImage(\'samples/img/landscape_wide.jpg\', this)">popupImage (landscape wide)</button>';
    echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-image\').dolPopupImage(\'samples/img/portrate.jpg\', this)">popupImage (portrate)</button>';
    echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-image\').dolPopupImage(\'samples/img/portrate_thin.jpg\', this)">popupImage (portrate thin)</button>';
    echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-image\').dolPopupImage(\'samples/img/small.jpg\', this)">popupImage (small)</button>';
    echo '<button class="bx-btn bx-def-margin-sec" onclick="$(\'#bx-sample-popup-image\').dolPopupImage(\'samples/img/square.jpg\', this)">popupImage (square)</button>';
    echo str_repeat('&nbsp; <br />', 100);
    return DesignBoxContent("Sample popup", ob_get_clean(), BX_DB_PADDING_DEF);
}
Esempio n. 15
0
 public function entryCollaborators($aContentInfo, $iMaxVisible = 2, $sFloat = 'left')
 {
     $oModule = BxDolModule::getInstance($this->MODULE);
     $CNF =& $oModule->_oConfig->CNF;
     bx_import('BxDolProfile');
     $aCollaborators = $this->_oDb->getCollaborators($aContentInfo[$CNF['FIELD_ID']]);
     //unset($aCollaborators[$aContentInfo[$CNF['FIELD_AUTHOR']]]);
     // sort collaborators: first - current user, second - last replier, third - author, all others sorted by max number of posts
     $aCollaborators = $oModule->sortCollaborators($aCollaborators, $aContentInfo['last_reply_profile_id'], $aContentInfo[$CNF['FIELD_AUTHOR']]);
     $iCollaboratorsNum = count($aCollaborators);
     // prepare template variables
     $aVarsPopup = array('float' => 'none', 'bx_repeat:collaborators' => array(), 'bx_if:collaborators_more' => array('condition' => false, 'content' => array()));
     $aVars = array('float' => $sFloat, 'bx_repeat:collaborators' => array(), 'bx_if:collaborators_more' => array('condition' => $iCollaboratorsNum > $iMaxVisible, 'content' => array('popup' => '', 'title_more' => _t('_bx_cnv_more', $iCollaboratorsNum - $iMaxVisible), 'float' => $sFloat, 'id' => $this->MODULE . '-popup-' . $aContentInfo[$CNF['FIELD_ID']])));
     $i = 0;
     foreach ($aCollaborators as $iProfileId => $iReadComments) {
         $oProfile = BxDolProfile::getInstance($iProfileId);
         if (!$oProfile) {
             continue;
         }
         $sInfo = '';
         if ($aContentInfo[$CNF['FIELD_AUTHOR']] == $iProfileId) {
             $sInfo = _t('_bx_cnv_collaborator_author');
         }
         if ($aContentInfo['last_reply_profile_id'] == $iProfileId) {
             $sInfo .= ', ' . _t('_bx_cnv_collaborator_last_replier');
         }
         $sInfo = trim($sInfo, ', ');
         $sInfo = $sInfo ? _t('_bx_cnv_collaborator_info', $oProfile->getDisplayName(), $sInfo) : $oProfile->getDisplayName();
         $aCollaborator = array('id' => $oProfile->id(), 'url' => $oProfile->getUrl(), 'thumb_url' => $oProfile->getThumb(), 'title' => $oProfile->getDisplayName(), 'title_attr' => bx_html_attribute($sInfo), 'float' => $sFloat, 'class' => $aContentInfo[$CNF['FIELD_AUTHOR']] == $iProfileId ? 'bx-cnv-collaborator-author' : '', 'bx_if:last_replier' => array('condition' => $aContentInfo['last_reply_profile_id'] == $iProfileId, 'content' => array('id' => $oProfile->id())), 'bx_if:author' => array('condition' => $aContentInfo[$CNF['FIELD_AUTHOR']] == $iProfileId, 'content' => array('id' => $oProfile->id())));
         if ($i < $iMaxVisible) {
             $aVars['bx_repeat:collaborators'][] = $aCollaborator;
         }
         if ($i >= $iMaxVisible) {
             $aVarsPopup['bx_repeat:collaborators'][] = $aCollaborator;
         }
         ++$i;
     }
     if ($aVarsPopup['bx_repeat:collaborators']) {
         bx_import('BxTemplFunctions');
         $aVars['bx_if:collaborators_more']['content']['popup'] = BxTemplFunctions::getInstance()->transBox('', '<div class="bx-def-padding">' . $this->parseHtmlByName('collaborators.html', $aVarsPopup) . '</div>');
     }
     return $this->parseHtmlByName('collaborators.html', $aVars);
 }
Esempio n. 16
0
 /**
  * 'add' action handler
  */
 public function performActionAdd()
 {
     $oModule = BxDolModule::getInstance('bx_oauth');
     bx_import('FormAdd', $oModule->_aModule);
     $oForm = new BxOAuthFormAdd($oModule);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         // if form is submitted and all fields are valid
         $iNewId = $oForm->insert(array(), true);
         // insert record to database
         if ($iNewId) {
             $aRes = array('grid' => $this->getCode(false), 'blink' => $iNewId);
         } else {
             $aRes = array('msg' => "Error occured");
         }
         // if record adding failed, display error message
         $this->_echoResultJson($aRes, true);
     } else {
         // if form is not submitted or some fields are invalid, display popup with form
         // we need to use 'transBox' function to properly display 'popup'
         $s = BxTemplFunctions::getInstance()->transBox('', '
             <div class="bx-def-padding bx-def-color-bg-block">' . $oForm->getCode() . '</div>
             <script>
                 $(document).ready(function () {
                     $("#bx-oauth-add").ajaxForm({
                         dataType: "json",
                         beforeSubmit: function (formData, jqForm, options) {
                             bx_loading($("#' . $oForm->aFormAttrs['id'] . '"), true);
                         },
                         success: function (data) {
                             $(".bx-popup-active").dolPopupHide();
                             glGrids.' . $this->_sObject . '.processJson(data, "add");
                         }
                     });
                 });
             </script>');
         $this->_echoResultJson(array('popup' => array('html' => $s, 'options' => array('closeOnOuterClick' => false))), true);
     }
 }
Esempio n. 17
0
 protected function _performAction($sAction, $sDisplay, $iId = 0)
 {
     $oForm = BxDolForm::getObjectInstance('bx_antispam_ip_table_form', $sDisplay);
     // get form instance for specified form object and display
     if (!$oForm) {
         $this->_echoResultJson(array('msg' => _t('_sys_txt_error_occured')), true);
         exit;
     }
     $oForm->addMarkers(array('grid_object' => $this->_sObject, 'grid_action' => $sAction));
     $aIpTableDirective = array();
     if ($iId) {
         $oModule = BxDolModule::getInstance('bx_antispam');
         $oAntispamIp = bx_instance('BxAntispamIP', array(), $oModule->_aModule);
         $aIpTableDirective = $oAntispamIp->getIpTableDirective($iId);
         $aIpTableDirective['From'] = long2ip($aIpTableDirective['From']);
         $aIpTableDirective['To'] = long2ip($aIpTableDirective['To']);
     }
     $oForm->initChecker($aIpTableDirective);
     if ($oForm->isSubmittedAndValid()) {
         // if form is submitted and all fields are valid
         $aCustomValues = array('From' => sprintf("%u", ip2long($oForm->getCleanValue('From'))), 'To' => sprintf("%u", ip2long($oForm->getCleanValue('To'))));
         if ($iId) {
             if ($oForm->update($iId, $aCustomValues)) {
                 // update record
                 $iRecentId = $iId;
             }
         } else {
             $iRecentId = $oForm->insert($aCustomValues, true);
             // insert new record
         }
         if ($iRecentId) {
             $aRes = array('grid' => $this->getCode(false), 'blink' => $iRecentId);
         } else {
             $aRes = array('msg' => _t('_sys_txt_error_occured'));
         }
         // if record adding failed, display error message
         $this->_echoResultJson($aRes, true);
     } else {
         // if form is not submitted or some fields are invalid, display popup with form
         $s = BxTemplFunctions::getInstance()->popupBox($oForm->getId() . '_form', _t('_bx_antispam_form_ip_table_add'), $oForm->getCode() . '
             <script>
                 $(document).ready(function () {
                     $("#' . $oForm->getId() . '").ajaxForm({
                         dataType: "json",
                         beforeSubmit: function (formData, jqForm, options) {
                             bx_loading($("#' . $oForm->getId() . '"), true);
                         },
                         success: function (data) {
                             $(".bx-popup-applied:visible").dolPopupHide();
                             glGrids.' . $this->_sObject . '.processJson(data, "' . $sAction . '");
                         }
                     });
                 });
             </script>');
         $this->_echoResultJson(array('popup' => array('html' => $s, 'options' => array('closeOnOuterClick' => false))), true);
     }
 }
Esempio n. 18
0
/**
 * page code function
 */
function PageCompMainCode()
{
    ob_start();
    $sTranscoderObjectPoster = 'sample_video_poster';
    $sTranscoderObjectMP4 = 'sample_video_mp4';
    $sTranscoderObjectWebM = 'sample_video_webm';
    $sStorageObjectOrig = 'sample_transcoder_video_orig';
    $iProfileId = bx_get_logged_profile_id();
    if (!$iProfileId) {
        echo "You aren't logged in.";
        exit;
    }
    $iPrunedFiles = BxDolTranscoder::pruning();
    if ($iPrunedFiles) {
        echo "iPrunedFiles: {$iPrunedFiles}";
        exit;
    }
    $oTranscoderPoster = BxDolTranscoderVideo::getObjectInstance($sTranscoderObjectPoster);
    $oTranscoderMP4 = BxDolTranscoderVideo::getObjectInstance($sTranscoderObjectMP4);
    $oTranscoderWebM = BxDolTranscoderVideo::getObjectInstance($sTranscoderObjectWebM);
    if (!$oTranscoderPoster || !$oTranscoderMP4 || !$oTranscoderWebM) {
        echo "Transcoder object is not available: " . $sTranscoderObjectPoster . ', ' . $sTranscoderObjectMP4 . ', ' . $sTranscoderObjectWebM;
        exit;
    }
    echo "registerHandlers poster: [" . $oTranscoderPoster->registerHandlers() . "] <br />\n";
    echo "registerHandlers mp4: [" . $oTranscoderMP4->registerHandlers() . "] <br />\n";
    echo "registerHandlers webm: [" . $oTranscoderWebM->registerHandlers() . "] <hr class='bx-def-hr' />\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>";
            // force transcode
            echo "Force transcode: <br />";
            echo "poster: " . $oTranscoderPoster->getFileUrl($iId) . '<br />';
            echo "mp4: " . $oTranscoderMP4->getFileUrl($iId) . '<br />';
            echo "webm: " . $oTranscoderWebM->getFileUrl($iId) . '<hr class="bx-def-hr" />';
        } 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) {
            $sUrlPoster = $oTranscoderPoster->getFileUrl($r['id']);
            $sUrlMP4 = $oTranscoderMP4->getFileUrl($r['id']);
            $sUrlWebM = $oTranscoderWebM->getFileUrl($r['id']);
            echo '<h3>' . $r['file_name'] . '</h3>';
            echo BxTemplFunctions::getInstance()->videoPlayer($sUrlPoster, $sUrlMP4, $sUrlWebM, false, 'height:200px;');
            echo '<hr class="bx-def-hr" />';
        }
    }
    $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>
<?php 
    $s = ob_get_clean();
    return DesignBoxContent("Sample video transcoder", $s, BX_DB_PADDING_DEF);
}
Esempio n. 19
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);
 }
Esempio n. 20
0
 protected function _getTmplVarsMenuItemManage(&$aEvent)
 {
     bx_import('BxDolMenu');
     $oMenu = BxDolMenu::getObjectInstance($this->_oConfig->getObject('menu_item_manage'));
     $oMenu->setEvent($aEvent);
     bx_import('BxTemplFunctions');
     $sMenu = BxTemplFunctions::getInstance()->designBoxMenu($oMenu);
     if (empty($sMenu)) {
         return array();
     }
     return array('style_prefix' => $this->_oConfig->getPrefix('style'), 'js_object' => $this->_oConfig->getJsObject('view'), 'menu_item_manage' => $sMenu);
 }
Esempio n. 21
0
 /**
  * Parse system keys.
  *
  * @param  string $sKey key
  * @return string value associated with the key.
  */
 function parseSystemKey($sKey, $mixedKeyWrapperHtml = null, $bProcessInjection = true)
 {
     $aKeyWrappers = $this->_getKeyWrappers($mixedKeyWrapperHtml);
     $sRet = '';
     switch ($sKey) {
         case 'page_charset':
             $sRet = 'UTF-8';
             break;
         case 'page_robots':
             if (!empty($this->aPage['robots']) && is_string($this->aPage['robots'])) {
                 $sRet = '<meta name="robots" content="' . bx_html_attribute($this->aPage['robots']) . '" />';
             }
             break;
         case 'page_keywords':
             if (!empty($this->aPage['keywords']) && is_array($this->aPage['keywords'])) {
                 $sRet = '<meta name="keywords" content="' . bx_html_attribute(implode(',', $this->aPage['keywords'])) . '" />';
             }
             break;
         case 'page_description':
             if (!empty($this->aPage['description']) && is_string($this->aPage['description'])) {
                 $sRet = '<meta name="description" content="' . bx_html_attribute($this->aPage['description']) . '" />';
             }
             break;
         case 'page_header':
             if (isset($this->aPage['header'])) {
                 $sRet = bx_process_output(strip_tags($this->aPage['header']));
             }
             break;
         case 'page_header_text':
             if (isset($this->aPage['header_text'])) {
                 $sRet = bx_process_output($this->aPage['header_text']);
             }
             break;
         case 'page_icons':
             bx_import('BxTemplFunctions');
             $sRet = BxTemplFunctions::getInstance()->getMetaIcons();
             break;
         case 'popup_loading':
             $sContent = $this->parsePageByName('popup_loading.html', array());
             bx_import('BxTemplFunctions');
             $sRet = BxTemplFunctions::getInstance()->transBox('bx-popup-loading', $sContent, true);
             break;
         case 'lang':
             $sRet = bx_lang_name();
             break;
         case 'main_logo':
             bx_import('BxTemplFunctions');
             $sRet = BxTemplFunctions::getInstance()->getMainLogo();
             break;
         case 'informer':
             bx_import('BxDolInformer');
             $oInformer = BxDolInformer::getInstance($this);
             $sRet = $oInformer ? $oInformer->display() : '';
             break;
         case 'dol_images':
             $sRet = $this->_processJsImages();
             break;
         case 'dol_lang':
             $sRet = $this->_processJsTranslations();
             break;
         case 'dol_options':
             $sRet = $this->_processJsOptions();
             break;
         case 'bottom_text':
             $sRet = _t('_bottom_text', date('Y'));
             break;
         case 'copyright':
             $sRet = _t('_copyright', date('Y')) . getVersionComment();
             break;
         case 'extra_js':
             $sRet = empty($this->aPage['extra_js']) ? '' : $this->aPage['extra_js'];
             break;
         case 'is_profile_page':
             $sRet = defined('BX_PROFILE_PAGE') ? 'true' : 'false';
             break;
         default:
             bx_import('BxTemplFunctions');
             $sRet = ($sTemplAdd = BxTemplFunctions::getInstance()->TemplPageAddComponent($sKey)) !== false ? $sTemplAdd : $aKeyWrappers['left'] . $sKey . $aKeyWrappers['right'];
     }
     if ($bProcessInjection) {
         $sRet = $this->processInjection($this->getPageNameIndex(), $sKey, $sRet);
     }
     return $sRet;
 }
Esempio n. 22
0
 protected function _limitMaxLength($mixedValue, $sKey, $aField, $aRow, $isDisplayPopupOnTextOverflow, $bReturnString = true)
 {
     if ($aField['chars_limit'] > 0) {
         bx_import('BxTemplFunctions');
         $mixedValue = BxTemplFunctions::getInstance()->getStringWithLimitedLength($mixedValue, $aField['chars_limit'], $isDisplayPopupOnTextOverflow, $bReturnString);
     }
     return $mixedValue;
 }
Esempio n. 23
0
 protected function _performAction(&$oForm, $sAction, $bReturnAccount = true)
 {
     $iAccountId = (int) bx_get('account');
     if ($iAccountId !== false) {
         $oForm->aInputs['id']['value'] = $iAccountId;
     }
     $oForm->aInputs['info']['content'] = _t('_bx_sites_form_site_input_info_' . $sAction);
     $oForm->initChecker();
     if (!$oForm->isSubmittedAndValid()) {
         $sContent = BxTemplFunctions::getInstance()->popupBox('bx-sites-site-' . $sAction . '-popup', _t('_bx_sites_grid_overview_popup_' . $sAction), $this->_oModule->_oTemplate->parseHtmlByName('block_' . $sAction . '.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
         $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
         return;
     }
     if (!$bReturnAccount) {
         return;
     }
     $iAccount = $oForm->getCleanValue('id');
     $aAccount = $this->_oModule->_oDb->getAccount(array('type' => 'id', 'value' => $iAccount));
     if (empty($aAccount) || !is_array($aAccount)) {
         $this->_echoResultJson(array('msg' => _t('_bx_sites_txt_err_site_is_not_defined')), true);
         return;
     }
     return $aAccount;
 }
Esempio n. 24
0
 /**
  * Parse system keys.
  *
  * @param  string $sKey key
  * @return string value associated with the key.
  */
 function parseSystemKey($sKey, $mixedKeyWrapperHtml = null, $bProcessInjection = true)
 {
     $aKeyWrappers = $this->_getKeyWrappers($mixedKeyWrapperHtml);
     $sRet = '';
     switch ($sKey) {
         case 'page_charset':
             $sRet = 'UTF-8';
             break;
         case 'page_robots':
             if (!empty($this->aPage['robots']) && is_string($this->aPage['robots'])) {
                 $sRet = '<meta name="robots" content="' . bx_html_attribute($this->aPage['robots']) . '" />';
             }
             break;
         case 'meta_info':
             $sRet = $this->getMetaInfo();
             break;
         case 'page_header':
             if (isset($this->aPage['header'])) {
                 $sRet = bx_process_output(strip_tags($this->aPage['header']));
             }
             break;
         case 'page_header_text':
             if (isset($this->aPage['header_text'])) {
                 $sRet = bx_process_output($this->aPage['header_text']);
             }
             break;
         case 'popup_loading':
             bx_import('BxTemplFunctions');
             $s = $this->parsePageByName('popup_loading.html', array());
             $sRet = BxTemplFunctions::getInstance()->transBox('bx-popup-loading', $s, true);
             bx_import('BxTemplSearch');
             $oSearch = new BxTemplSearch();
             $oSearch->setLiveSearch(true);
             $sRet .= $this->parsePageByName('search.html', array('search_form' => $oSearch->getForm(BX_DB_CONTENT_ONLY), 'results' => $oSearch->getResultsContainer()));
             $sRet .= $this->getMenu('sys_site');
             $sRet .= isLogged() ? $this->getMenu('sys_add_content') : '';
             $sRet .= isLogged() ? $this->getMenu('sys_account_popup') : '';
             break;
         case 'lang':
             $sRet = bx_lang_name();
             break;
         case 'main_logo':
             bx_import('BxTemplFunctions');
             $sRet = BxTemplFunctions::getInstance()->getMainLogo();
             break;
         case 'informer':
             bx_import('BxDolInformer');
             $oInformer = BxDolInformer::getInstance($this);
             $sRet = $oInformer ? $oInformer->display() : '';
             break;
         case 'dol_images':
             $sRet = $this->_processJsImages();
             break;
         case 'dol_lang':
             $sRet = $this->_processJsTranslations();
             break;
         case 'dol_options':
             $sRet = $this->_processJsOptions();
             break;
         case 'bottom_text':
             $sRet = _t('_bottom_text', date('Y'));
             break;
         case 'copyright':
             $sRet = _t('_copyright', date('Y')) . getVersionComment();
             break;
         case 'extra_js':
             $sRet = empty($this->aPage['extra_js']) ? '' : $this->aPage['extra_js'];
             break;
         case 'is_profile_page':
             $sRet = defined('BX_PROFILE_PAGE') ? 'true' : 'false';
             break;
         default:
             bx_import('BxTemplFunctions');
             $sRet = ($sTemplAdd = BxTemplFunctions::getInstance()->TemplPageAddComponent($sKey)) !== false ? $sTemplAdd : $aKeyWrappers['left'] . $sKey . $aKeyWrappers['right'];
     }
     if ($bProcessInjection) {
         $sRet = $this->processInjection($this->getPageNameIndex(), $sKey, $sRet);
     }
     return $sRet;
 }
Esempio n. 25
0
 public function serviceGetBlockHostTools($bDynamic = true)
 {
     $sJsObject = $this->getPageJsObject();
     $aMenu = array(array('name' => 'audit', 'title' => _t('_sys_inst_server_audit'), 'link' => 'javascript:void(0)', 'onclick' => $sJsObject . '.serverAudit()'), array('name' => 'permissions', 'title' => _t('_sys_audit_permissions'), 'link' => 'javascript:void(0)', 'onclick' => $sJsObject . '.permissions()'));
     bx_import('BxDolStudioToolsAudit');
     $oAudit = new BxDolStudioToolsAudit();
     $aTmplVarsItems = array();
     if (!$bDynamic) {
         bx_import('BxTemplFunctions');
         $oFunc = BxTemplFunctions::getInstance();
         $aLevels = array(BX_DOL_AUDIT_FAIL, BX_DOL_AUDIT_WARN, BX_DOL_AUDIT_UNDEF);
         $aTmplVarsItems = array();
         foreach ($this->aItemsHTools as $sTitle => $sFunc) {
             $sStatus = BX_DOL_AUDIT_OK;
             foreach ($aLevels as $sLevel) {
                 $a = $oAudit->checkRequirements($sLevel, $sFunc);
                 if (!empty($a)) {
                     $sStatus = $sLevel;
                     break;
                 }
             }
             $aTmplVarsItems[] = array('status' => $oFunc->statusOnOff($sStatus), 'msg' => _t('_adm_dbd_txt_htools_status', $sTitle, $oAudit->typeToTitle($sStatus)));
         }
     }
     $sContent = BxDolStudioTemplate::getInstance()->parseHtmlByName('dbd_htools.html', array('bx_if:show_content' => array('condition' => !$bDynamic, 'content' => array('bx_repeat:items' => $aTmplVarsItems)), 'bx_if:show_loader' => array('condition' => $bDynamic, 'content' => array('js_object' => $sJsObject))));
     return array('content' => $sContent, 'menu' => $aMenu);
 }
Esempio n. 26
0
/**
 * Output time wrapped in <time> tag in HTML.
 * Then time is autoformatted using JS upon page load, this is aumatically converted to user's timezone and
 * updated in realtime in case of short periods of 'from now' time format.
 *
 * This is just short version for:
 * @see BxTemplFunctions::timeForJs
 *
 * @param $iUnixTimestamp time as unixtimestamp
 * @param $sFormatIdentifier output format identifier
 *     @see BX_FORMAT_DATE
 *     @see BX_FORMAT_TIME
 *     @see BX_FORMAT_DATE_TIME
 * @param $bForceFormat force provided format and don't use "from now" time autoformat.
 */
function bx_time_js($iUnixTimestamp, $sFormatIdentifier = BX_FORMAT_DATE, $bForceFormat = false)
{
    return BxTemplFunctions::getInstance()->timeForJs($iUnixTimestamp, $sFormatIdentifier, $bForceFormat);
}
Esempio n. 27
0
 protected function _getImagePopup()
 {
     $sViewImagePopupId = $this->_oConfig->getHtmlIds('view', 'photo_popup');
     $sViewImagePopupContent = $this->parseHtmlByName('popup_image.html', array('image_url' => ''));
     bx_import('BxTemplFunctions');
     return BxTemplFunctions::getInstance()->transBox($sViewImagePopupId, $sViewImagePopupContent, true);
 }
Esempio n. 28
0
 protected function _getViewImagePopup()
 {
     $sViewImagePopupId = 'cmts-box-' . $this->_sSystem . '-' . $this->getId() . '-view-image-popup';
     $sViewImagePopupContent = BxDolTemplate::getInstance()->parseHtmlByName('popup_image.html', array('image_url' => ''));
     bx_import('BxTemplFunctions');
     return BxTemplFunctions::getInstance()->transBox($sViewImagePopupId, $sViewImagePopupContent, true);
 }
Esempio n. 29
0
 /**
  * 'recheck' action handler
  */
 public function performActionAdd()
 {
     bx_import('BxTemplFormView');
     $aForm = array('form_attrs' => array('id' => 'bx_antispam_form_dnsbl_add', 'action' => BX_DOL_URL_ROOT . 'grid.php?o=bx_antispam_grid_dnsbl&a=add', 'method' => 'post'), 'params' => array('db' => array('table' => 'bx_antispam_dnsbl_rules', 'key' => 'id', 'submit_name' => 'do_submit')), 'inputs' => array('country' => array('type' => 'select', 'name' => 'country', 'caption' => _t('_bx_antispam_field_country'), 'values' => BxDolForm::getDataItems('Country')), 'chain' => array('type' => 'radio_set', 'name' => 'chain', 'caption' => _t('_bx_antispam_field_action'), 'values' => array('spammers' => _t('_bx_antispam_chain_spammers'), 'whitelist' => _t('_bx_antispam_chain_whitelist')), 'value' => 'spammers'), 'submit' => array('type' => 'input_set', 0 => array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_sys_submit')), 1 => array('type' => 'reset', 'name' => 'close', 'value' => _t('_sys_close'), 'attrs' => array('class' => 'bx-def-margin-sec-left', 'onclick' => '$(\'.bx-popup-applied:visible\').dolPopupHide();')))));
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         // if form is submitted and all fields are valid
         $aCustomValues = array('chain' => $oForm->getCleanValue('chain'), 'zonedomain' => sprintf("%s.countries.nerd.dk.", strtolower($oForm->getCleanValue('country'))), 'postvresp' => '127.0.0.2', 'url' => 'http://countries.nerd.dk/', 'comment' => '_bx_antispam_rule_note_country', 'added' => time(), 'active' => 1);
         $iRecentId = $oForm->insert($aCustomValues, true);
         // insert new record
         if ($iRecentId) {
             $aRes = array('grid' => $this->getCode(false), 'blink' => $iRecentId);
         } else {
             $aRes = array('msg' => _t('_sys_txt_error_occured'));
         }
         // if record adding failed, display error message
         $this->_echoResultJson($aRes, true);
     } else {
         // if form is not submitted or some fields are invalid, display popup with form
         bx_import('BxTemplFunctions');
         $s = BxTemplFunctions::getInstance()->popupBox($oForm->getId() . '_form', _t('_bx_antispam_popup_dnsbl_add'), $oForm->getCode() . '
             <script>
                 $(document).ready(function () {
                     $("#' . $oForm->getId() . '").ajaxForm({
                         dataType: "json",
                         beforeSubmit: function (formData, jqForm, options) {
                             bx_loading($("#' . $oForm->getId() . '"), true);
                         },
                         success: function (data) {
                             $(".bx-popup-applied:visible").dolPopupHide();
                             glGrids.' . $this->_sObject . '.processJson(data, "add");
                         }
                     });
                 });
             </script>');
         $this->_echoResultJson(array('popup' => array('html' => $s, 'options' => array('closeOnOuterClick' => false))), true);
     }
 }
Esempio n. 30
0
 /**
  * functions for limiting maximal string length
  */
 function getStringWithLimitedLength($sString, $iWidth = 45, $isPopupOnOverflow = false, $bReturnString = true)
 {
     if (empty($sString) || mb_strlen($sString, 'UTF-8') <= $iWidth) {
         return $bReturnString ? $sString : array($sString);
     }
     $sResult = '';
     $aWords = mb_split("[\\s\r\n]", $sString);
     $iPosition = 0;
     $iWidthReal = $iWidth - 3;
     $iWidthMin = $iWidth - 15;
     foreach ($aWords as $sWord) {
         $sWord = trim($sWord);
         $iWord = mb_strlen($sWord, 'UTF-8');
         if ($iPosition + $iWord > $iWidthReal) {
             break;
         }
         // add word and continue
         $sResult .= ' ' . $sWord;
         $iPosition += 1 + $iWord;
     }
     // last word is too long, cut it
     if (!$iPosition || $iPosition < $iWidthMin) {
         $sResult .= ' ' . mb_substr($sWord, 0, $iWidthReal - $iPosition - $iWord, 'UTF-8');
     }
     $sResult = trim($sResult);
     // add tripple dot
     if (!$isPopupOnOverflow) {
         $sResult .= '...';
         return $bReturnString ? $sResult : array($sResult);
     }
     // add button width popup
     $sId = 'bx-str-limit-' . rand(1, PHP_INT_MAX);
     $sPopup = '<img class="bx-str-limit" onclick="$(\'#' . $sId . '\').dolPopup({pointer:{el:$(this), offset:\'10 1\'}})" src="' . $this->getTemplateImage('str-limit.png') . '"/>';
     $sPopup .= '<div id="' . $sId . '" style="display:none;">' . BxTemplFunctions::getInstance()->transBox('', '<div class="bx-def-padding bx-def-color-bg-block">' . $sString . '</div>') . '</div>';
     return $bReturnString ? $sResult . $sPopup : array($sResult, $sPopup);
 }