Пример #1
0
 /**
  * Get processed message
  *
  * @param $aMessages array
  * @param $bDeleteAllowed boolean
  * @param $bBlockAllowed boolean
  * @return text
  */
 function getProcessedMessages($aMessages = array(), $bDeleteAllowed = false, $bBlockAllowed = false)
 {
     global $oFunctions;
     if (!$aMessages) {
         return;
     }
     $sOutputCode = '';
     $aLanguageKeys = array('by' => _t('_bx_shoutbox_by'), 'visitor' => _t('_Visitor'), 'delete' => _t('_bx_shoutbox_delete_message'), 'sure' => _t('_Are_you_sure'), 'block' => _t('_bx_shoutbox_block_ip'));
     foreach ($aMessages as $iKey => $aItems) {
         $sMemberIcon = '';
         $aProfileInfo = $aItems['OwnerID'] > 0 ? getProfileInfo($aItems['OwnerID']) : array();
         // define some profile's data;
         if ($aProfileInfo) {
             $sNickName = getNickName($aProfileInfo['ID']);
             $sLink = getProfileLink($aItems['OwnerID']);
             $sMemberIcon = $oFunctions->getMemberIcon($aItems['OwnerID']);
         } else {
             $sLink = 'javascript:void(0)';
             $sNickName = $aLanguageKeys['visitor'];
         }
         $aKeys = array('owner_icon' => $sMemberIcon, 'message' => WordWrapStr($aItems['Message']), 'by' => $aLanguageKeys['by'], 'owner_nick' => $sNickName, 'date' => defineTimeInterval($aItems['DateTS'], true, true), 'owner_link' => $sLink, 'bx_if:delete_allowed' => array('condition' => $bDeleteAllowed, 'content' => array('delete_cpt' => bx_html_attribute($aLanguageKeys['delete']), 'sure_cpt' => bx_js_string($aLanguageKeys['sure']), 'message_id' => $aItems['ID'])), 'bx_if:block_allowed' => array('condition' => $bBlockAllowed, 'content' => array('block_cpt' => bx_html_attribute($aLanguageKeys['block']), 'sure_cpt' => bx_js_string($aLanguageKeys['sure']), 'message_id' => $aItems['ID'])));
         $sTemplateName = $aProfileInfo ? 'message.html' : 'visitor_message.html';
         $sOutputCode .= $this->parseHtmlByName($sTemplateName, $aKeys);
     }
     return $sOutputCode;
 }
Пример #2
0
 /**
  * Attach editor to HTML element, in most cases - textarea.
  * @param $sSelector - jQuery selector to attach editor to.
  * @param $iViewMode - editor view mode: BX_EDITOR_STANDARD, BX_EDITOR_MINI, BX_EDITOR_FULL
  * @param $bDynamicMode - is AJAX mode or not, the HTML with editor area is loaded dynamically.
  */
 public function attachEditor($sSelector, $iViewMode = BX_EDITOR_STANDARD, $bDynamicMode = false)
 {
     // set visual mode
     switch ($iViewMode) {
         case BX_EDITOR_MINI:
             $sToolsItems = self::$CONF_MINI;
             break;
         case BX_EDITOR_FULL:
             $sToolsItems = self::$CONF_FULL;
             break;
         case BX_EDITOR_STANDARD:
         default:
             $sToolsItems = self::$CONF_STANDARD;
     }
     // detect language
     $sLang = BxDolLanguages::getInstance()->detectLanguageFromArray(self::$CONF_LANGS);
     // initialize editor
     $sInitEditor = $this->_replaceMarkers(self::$CONF_COMMON, array('bx_var_custom_init' => $sToolsItems, 'bx_var_custom_conf' => $this->_sConfCustom, 'bx_var_plugins_path' => bx_js_string(BX_DOL_URL_PLUGINS, BX_ESCAPE_STR_APOS), 'bx_var_css_path' => bx_js_string($this->_oTemplate->getCssUrl('editor.css'), BX_ESCAPE_STR_APOS), 'bx_var_skin' => bx_js_string($this->_aObject['skin'], BX_ESCAPE_STR_APOS), 'bx_var_lang' => bx_js_string($sLang, BX_ESCAPE_STR_APOS), 'bx_var_selector' => bx_js_string($sSelector, BX_ESCAPE_STR_APOS), 'bx_url_root' => bx_js_string(BX_DOL_URL_ROOT, BX_ESCAPE_STR_APOS), 'bx_url_tinymce' => bx_js_string(BX_DOL_URL_PLUGINS_PUBLIC . 'tinymce/', BX_ESCAPE_STR_APOS)));
     if ($bDynamicMode) {
         $sScript = "<script>\n                if ('undefined' == typeof(jQuery(document).tinymce)) {\n                    window.tinyMCEPreInit = {base : '" . bx_js_string(BX_DOL_URL_PLUGINS_PUBLIC . 'tinymce', BX_ESCAPE_STR_APOS) . "', suffix : '.min', query : ''};\n                    \$.getScript('" . bx_js_string(BX_DOL_URL_ROOT . 'inc/js/editor.tinymce.js', BX_ESCAPE_STR_APOS) . "');\n                    \$.getScript('" . bx_js_string(BX_DOL_URL_PLUGINS_PUBLIC . 'tinymce/tinymce.min.js', BX_ESCAPE_STR_APOS) . "', function(data, textStatus, jqxhr) {\n                        \$.getScript('" . bx_js_string(BX_DOL_URL_PLUGINS_PUBLIC . 'tinymce/jquery.tinymce.min.js', BX_ESCAPE_STR_APOS) . "', function(data, textStatus, jqxhr) {\n                            {$sInitEditor}\n                        });\n                    });\n                } else {\n                    {$sInitEditor}\n                }\n            </script>";
     } else {
         $sScript = "\n            <script>\n                \$(document).ready(function () {\n                    {$sInitEditor}\n                });\n            </script>";
     }
     return $this->_addJsCss($bDynamicMode) . $sScript;
 }
Пример #3
0
 public function getJsScript($bDynamicMode = false)
 {
     $aParams = array('sObjName' => $this->_sJsObjName, 'sSystem' => $this->getSystemName(), 'iAuthorId' => $this->_getAuthorId(), 'iObjId' => $this->getId(), 'iLikeMode' => $this->isLikeMode() ? 1 : 0, 'sRootUrl' => BX_DOL_URL_ROOT, 'sStylePrefix' => $this->_sStylePrefix, 'aHtmlIds' => $this->_aHtmlIds);
     $sCode = $this->_sJsObjName . " = new BxDolVote(" . json_encode($aParams) . ");";
     if ($bDynamicMode) {
         $sCode = "var " . $this->_sJsObjName . " = null; \n\t\t\t\$.getScript('" . bx_js_string($this->_oTemplate->getJsUrl('BxDolVote.js'), BX_ESCAPE_STR_APOS) . "', function(data, textStatus, jqxhr) {\n\t\t\t\tbx_get_style('" . bx_js_string($this->_oTemplate->getCssUrl('vote.css'), BX_ESCAPE_STR_APOS) . "');\n\t\t\t\t" . $sCode . "\n        \t}); ";
     } else {
         $sCode = "var " . $sCode;
     }
     $this->addCssJs($bDynamicMode);
     return $this->_oTemplate->_wrapInTagJsCode($sCode);
 }
Пример #4
0
function PageCodeClear()
{
    global $oAdmTemplate, $oCacheUtilities, $aCacheTypes;
    $sChartData = '';
    foreach ($aCacheTypes as $r) {
        if ('all' == $r['action']) {
            continue;
        }
        $iSize = $oCacheUtilities->size($r['action']);
        $sChartData .= ",\n['" . bx_js_string($r['title'], BX_ESCAPE_STR_APOS) . "', {v:" . $iSize . ", f:'" . bx_js_string(_t_format_size($iSize)) . "'}]";
    }
    $s = $oAdmTemplate->parseHtmlByName('cache.html', array('bx_repeat:clear_action' => $aCacheTypes, 'chart_data' => trim($sChartData, ',')));
    return DesignBoxAdmin(_t('_adm_txt_cache'), $s, $GLOBALS['aTopItems'], '', 11);
}
Пример #5
0
function PageCodeClear()
{
    global $oAdmTemplate, $oCacheUtilities, $aCacheTypes;
    $aChartData = array();
    foreach ($aCacheTypes as $r) {
        if ('all' == $r['action']) {
            continue;
        }
        $aChartData[] = array('value' => round($oCacheUtilities->size($r['action']) / 1024, 2), 'color' => '#' . dechex(rand(0x0, 0xffffff)), 'highlight' => '', 'label' => bx_js_string($r['title'], BX_ESCAPE_STR_APOS));
    }
    $sChartData = json_encode($aChartData);
    $oAdmTemplate->addJsTranslation(array('_sys_kilobyte'));
    $oAdmTemplate->addJsSystem(array('chart.min.js'));
    $s = $oAdmTemplate->parseHtmlByName('cache.html', array('bx_repeat:clear_action' => $aCacheTypes, 'chart_data' => $sChartData));
    return DesignBoxAdmin(_t('_adm_txt_cache'), $s, $GLOBALS['aTopItems'], '', 11);
}
 function GenIPBlackListTable()
 {
     $sSQL = "SELECT *, FROM_UNIXTIME(`LastDT`) AS `LastDT_U` FROM `sys_ip_list` ORDER BY `From` ASC";
     $rIPList = db_res($sSQL);
     $aTmplVarsItems = array();
     while ($aIPList = mysql_fetch_assoc($rIPList)) {
         $iID = (int) $aIPList['ID'];
         $sFrom = long2ip($aIPList['From']);
         $sTo = $aIPList['To'] == 0 ? '' : long2ip($aIPList['To']);
         $sType = process_html_output($aIPList['Type']);
         $sLastDT_Formatted = getLocaleDate($aIPList['LastDT'], BX_DOL_LOCALE_DATE);
         $sLastDT = preg_replace('/([\\d]{2}):([\\d]{2}):([\\d]{2})/', '$1:$2', $aIPList['LastDT_U']);
         $sDesc = process_html_output($aIPList['Desc']);
         $sDescAttr = bx_html_attribute(bx_js_string($aIPList['Desc'], BX_ESCAPE_STR_APOS));
         $aTmplVarsItems[] = array('id' => $iID, 'from' => $sFrom, 'to' => $sTo, 'type' => $sType, 'date' => $sLastDT, 'date_uf' => $sLastDT_Formatted, 'description' => $sDesc, 'description_attr' => $sDescAttr, 'delete_action_url' => bx_append_url_params($this->_sActionUrl, array('action' => 'apply_delete', 'id' => $iID)));
     }
     if (empty($aTmplVarsItems)) {
         return MsgBox(_t('_Empty'));
     }
     return $GLOBALS['oAdmTemplate']->parseHtmlByName('ip_blacklist_list_filters.html', array('bx_repeat:items' => $aTmplVarsItems));
 }
Пример #7
0
    exit;
}
// generate all active menu items ;
$sTopQuery = "SELECT `ID`, `Name`, `Movable` FROM `" . $oMenu->sDbTable . "`\tWHERE `Active`='1' ORDER BY `Order`";
$rTopItems = db_res($sTopQuery);
$sAllQuery = "SELECT `ID`, `Name` FROM `" . $oMenu->sDbTable . "` WHERE `Clonable`='1' OR (`Clonable`='0' AND `Active`='0') ORDER BY `Name`";
$rAllItems = db_res($sAllQuery);
$sComposerInit = "\n    <script type=\"text/javascript\">\n        topParentID = 'menu_app_wrapper';\n        parserUrl = '" . $GLOBALS['site']['url_admin'] . "service_menu_compose.php?';\n\n        allowNewItem = true;\n        allowAddToTop = true;\n        allowAddToCustom = false;\n        iInactivePerRow = 5;\n        sendSystemOrder = false;\n\n        aCoords = {};\n        aCoords['startX'] = 6;\n        aCoords['startY'] = 24;\n        aCoords['width']  = 117;\n        aCoords['height'] = 28;\n        aCoords['diffX']  = 122;\n        aCoords['diffY']  = 32;\n\n        aTopItems = {};\n        aCustomItems = {};\n        aSystemItems = {};\n        aAllItems = {};\n";
$iIndex = 0;
while (($aTopItem = $rTopItems->fetch()) !== false) {
    $sComposerInit .= "\n\n        aTopItems[{$iIndex}] = [{$aTopItem['ID']}, '" . addslashes($aTopItem['Name']) . "', {$aTopItem['Movable']}];\n        aCustomItems[{$iIndex}] = {};";
    $iIndex++;
}
$sComposerInit .= "\n";
while (($aAllItem = $rAllItems->fetch()) !== false) {
    $sComposerInit .= "\n        aAllItems['{$aAllItem['ID']} '] = '" . bx_js_string($aAllItem['Name'], BX_ESCAPE_STR_APOS) . "';";
}
$sComposerInit .= "\n    </script>\n";
$iNameIndex = 12;
$_page = array('name_index' => $iNameIndex, 'css_name' => array('menu_compose.css', 'forms_adv.css'), 'js_name' => array('menu_compose.js', 'BxDolMenu.js'), 'header' => _t('_adm_smbuilder_page_title'));
$sContent = $GLOBALS['oAdmTemplate']->parseHtmlByName('menu_compose.html', array('extra_js' => $sComposerInit));
$_page_cont[$iNameIndex]['controls'] = '';
$_page_cont[$iNameIndex]['page_main_code'] = DesignBoxAdmin(_t('_adm_smbuilder_box_title'), $sContent);
PageCodeAdmin();
function showEditForm($aItem)
{
    $aForm = array('form_attrs' => array('id' => 'formItemEdit', 'name' => 'formItemEdit', 'action' => $GLOBALS['site']['url_admin'] . 'bottom_menu_compose.php', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'inputs' => array('Name' => array('type' => 'text', 'name' => 'Name', 'caption' => _t('_adm_mbuilder_System_Name'), 'value' => $aItem['Name'], 'attrs' => array()), 'Caption' => array('type' => 'text', 'name' => 'Caption', 'caption' => _t('_adm_mbuilder_Language_Key'), 'value' => $aItem['Caption'], 'attrs' => array()), 'LangCaption' => array('type' => 'text', 'name' => 'LangCaption', 'caption' => _t('_adm_mbuilder_Default_Name'), 'value' => _t($aItem['Caption']), 'attrs' => array()), 'Link' => array('type' => 'text', 'name' => 'Link', 'caption' => _t('_URL'), 'value' => htmlspecialchars_adv($aItem['Link']), 'attrs' => array()), 'Script' => array('type' => 'text', 'name' => 'Script', 'caption' => _t('_adm_mbuilder_script'), 'value' => htmlspecialchars_adv($aItem['Script']), 'attrs' => array()), 'Icon' => array('type' => 'text', 'name' => 'Icon', 'caption' => _t('_adm_mbuilder_icon'), 'value' => htmlspecialchars_adv($aItem['Icon']), 'attrs' => array()), 'Target' => array('type' => 'radio_set', 'name' => 'Target', 'caption' => _t('_adm_mbuilder_Target_Window'), 'value' => $aItem['Target'] == '_blank' ? '_blank' : '_self', 'values' => array('_self' => _t('_adm_mbuilder_Same'), '_blank' => _t('_adm_mbuilder_New')), 'attrs' => array()), 'Visible' => array('type' => 'checkbox_set', 'name' => 'Visible', 'caption' => _t('_adm_mbuilder_Visible_for'), 'value' => array(), 'values' => array('non' => _t('_Guest'), 'memb' => _t('_Member')), 'attrs' => array()), 'submit' => array('type' => 'input_set', array('type' => 'button', 'name' => 'save', 'value' => _t('_Save Changes'), 'attrs' => array('onclick' => 'javascript:saveItem(' . $aItem['ID'] . ');')), array('type' => 'button', 'name' => 'delete', 'value' => _t('_Delete'), 'attrs' => array('onclick' => 'javascript:deleteItem(' . $aItem['ID'] . ');')))));
    foreach ($aForm['inputs'] as $sKey => $aInput) {
        if (in_array($aInput['type'], array('text', 'checkbox')) && !$aItem['Editable']) {
            $aForm['inputs'][$sKey]['attrs']['disabled'] = "disabled";
        }
Пример #8
0
 /**
  * ACTION METHODS
  * Post somthing on the wall.
  *
  * @return string with JavaScript code.
  */
 function actionPost()
 {
     $sResult = "parent." . $this->_sJsPostObject . "._loading(null, false);\n";
     $this->_iOwnerId = (int) $_POST['WallOwnerId'];
     if (!$this->_isCommentPostAllowed(true)) {
         return "<script>" . $sResult . "alert('" . bx_js_string(_t('_wall_msg_not_allowed_post')) . "');</script>";
     }
     $sPostType = process_db_input($_POST['WallPostType'], BX_TAGS_STRIP);
     $sContentType = process_db_input($_POST['WallContentType'], BX_TAGS_STRIP);
     $sMethod = "_process" . ucfirst($sPostType) . ucfirst($sContentType);
     if (method_exists($this, $sMethod)) {
         $aResult = $this->{$sMethod}();
         if ((int) $aResult['code'] == 0) {
             $iId = $this->_oDb->insertEvent(array('owner_id' => $this->_iOwnerId, 'object_id' => $aResult['object_id'], 'type' => $this->_oConfig->getCommonPostPrefix() . $sPostType, 'action' => '', 'content' => process_db_input($aResult['content'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION), 'title' => process_db_input($aResult['title'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION), 'description' => process_db_input($aResult['description'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION)));
             //--- Event -> Post for Alerts Engine ---//
             bx_import('BxDolAlerts');
             $oAlert = new BxDolAlerts($this->_oConfig->getAlertSystemName(), 'post', $iId, $this->_getAuthorId());
             $oAlert->alert();
             //--- Event -> Post for Alerts Engine ---//
             $sResult = "parent.\$('form#WallPost" . ucfirst($sPostType) . "').find(':input:not(:button,:submit,[type = hidden],[type = radio],[type = checkbox])').val('');\n";
             $sResult .= "parent." . $this->_sJsPostObject . "._getPost(null, " . $iId . ");";
         } else {
             $sResult .= "alert('" . bx_js_string(_t($aResult['message'])) . "');";
         }
     } else {
         $sResult .= "alert('" . bx_js_string(_t('_wall_msg_failed_post')) . "');";
     }
     return '<script>' . $sResult . '</script>';
 }
 /**
  * Function will generate messenger's js core ;
  *
  * @return : (text) - js code;
  */
 function getSimpleMessengerCore()
 {
     $sOutputCode = null;
     if (!$this->iLoggedMemberId) {
         return;
     }
     $this->_oTemplate->addJs(array('emoji-picker/js/jquery.emojipicker.js', 'emoji-picker/js/jquery.emojipicker.tw.js', 'messenger_core.js'));
     $this->_oTemplate->addCss(array('plugins/emoji-picker/css/|jquery.emojipicker.css', 'simple_messenger.css', 'simple_messenger_phone.css'));
     $this->_oTemplate->addCssAsync('plugins/emoji-picker/css|jquery.emojipicker.tw.css');
     // it's toooooooo big, so include it separately
     $sEmptyMessage = bx_js_string(_t('_simple_messenger_empty_message'));
     $sWaitMessage = bx_js_string(_t('_simple_messenger_wait'));
     $sOutputCode .= "\n                <script type=\"text/javascript\">\n                    \$(document).ready(function () {\n                        var sMemberMenuOutputBlock = '{$this->aCoreSettings['output_block']}';\n\n                        // if member menu was defined;\n                        \$('#' + sMemberMenuOutputBlock).each(\n                            function(){\n                                oSimpleMessenger.chatBoxSettings =\n                                {\n                                    // the page which will process all AJAX queries ;\n                                    sPageReceiver           :   '{$this->aCoreSettings['page_receiver']}',\n\n                                    // contain block's id where the list of messages will be generated ;\n                                    sOutputBlockId          :   sMemberMenuOutputBlock,\n\n                                    // time (in seconds) script checks for new messages ;\n                                    updateTime              :   {$this->aCoreSettings['update_time']},\n\n                                    // contain descriptor of the created timeout ;\n                                    updateTimeNotifyHandler : '',\n\n                                    // the number of visible messages into chat box ;\n                                    iNumberVisibleMessages  :   {$this->aCoreSettings['number_visible_messages']},\n\n                                    // contains history block's prefix (block's name where will add the new messages);\n                                    sHistoryBlockPrefix     :   '{$this->aCoreSettings['history_block_prefix']}',\n\n                                    iParentContainerHeight  : 0,\n\n                                    // current member's menu position ;\n                                    sMemberMenuPosition     :   '{$this->sMemberMenuPosition}',\n\n                                    // wrapper for chat boxes;\n                                    sChatBox                :   'simple_messenger_chat_block',\n\n                                    // flashing signals amount of the non-active window ;\n                                    iMaxBlinkCounter        :   '{$this->aCoreSettings['blink_counter']}'\n                                };\n\n                                oSimpleMessenger.systemMessages.emptyMessage = '{$sEmptyMessage}';\n                                oSimpleMessenger.systemMessages.waitMessage  = '{$sWaitMessage}';\n\n                                var oMenuContainer = \$(this).parents('div:first');\n                                var iContainerHeight =  parseInt( oMenuContainer.height() );\n\n                                oSimpleMessenger.chatBoxSettings.iParentContainerHeight = (iContainerHeight) ? iContainerHeight + 5 : 0;\n                                oSimpleMessenger.oDefinedChatBoxes.boxes  = Array();\n                                oSimpleMessenger.messageNotification();\n                            }\n                        );\n                    });\n                </script>\n            ";
     return $sOutputCode;
 }
Пример #10
0
 public function getCode($isDisplayHeader = true)
 {
     $this->_replaceMarkers();
     if ($isDisplayHeader && empty($this->_aOptions['paginate_url'])) {
         // reset page query params if grid is just initialized and it uses AJAX paginate
         $this->resetQueryParams();
     }
     $sPaginate = '';
     $aData = array();
     $sIdWrapper = 'bx-grid-wrap-' . $this->_sObject;
     $sIdContainer = 'bx-grid-cont-' . $this->_sObject;
     $sIdTable = 'bx-grid-table-' . $this->_sObject;
     $sFilter = bx_unicode_urldecode(bx_process_input(bx_get('filter')));
     $sOrderField = bx_unicode_urldecode(bx_process_input(bx_get('order_field')));
     $sOrderDir = 0 == strcasecmp('desc', bx_get('order_dir')) ? 'DESC' : 'ASC';
     if ($this->_aOptions['paginate_get_start']) {
         $iStart = (int) bx_get($this->_aOptions['paginate_get_start']);
     } else {
         $iStart = 0;
     }
     if ($this->_aOptions['paginate_get_per_page'] && (int) bx_get($this->_aOptions['paginate_get_per_page']) > 0) {
         $iPerPage = (int) bx_get($this->_aOptions['paginate_get_per_page']);
     } elseif ($this->_aOptions['paginate_per_page']) {
         $iPerPage = (int) $this->_aOptions['paginate_per_page'];
     } else {
         $iPerPage = 10;
     }
     if ($this->_aOptions['paginate_get_start']) {
         $aData = $this->_getData($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage + 1);
         $sPageUrl = false;
         if (!empty($this->_aOptions['paginate_url'])) {
             $sPageUrl = $this->_aOptions['paginate_url'];
             $aParamsAppend = array();
             if ($sFilter) {
                 $aParamsAppend['filter'] = bx_process_input(bx_get('filter'));
             }
             if ($sOrderField) {
                 $aParamsAppend['order_field'] = bx_process_input(bx_get('order_field'));
                 $aParamsAppend['order_dir'] = bx_process_input(bx_get('order_dir'));
             }
             if ($aParamsAppend) {
                 $sPageUrl = bx_append_url_params($sPageUrl, $aParamsAppend);
             }
         }
         $aPaginateParams = array('start' => $iStart, 'per_page' => $iPerPage, 'page_url' => $sPageUrl ? $sPageUrl : "javascript:glGrids." . $this->_sObject . ".reload('{start}'); void(0);");
         bx_import('BxTemplPaginate');
         $oPaginate = new BxTemplPaginate($aPaginateParams, $this->_oTemplate);
         $oPaginate->setNumFromDataArray($aData);
         if (isset($this->_aOptions['paginate_simple']) && false !== $this->_aOptions['paginate_simple']) {
             $sPaginate = $oPaginate->getSimplePaginate($this->_aOptions['paginate_simple']);
         } else {
             $sPaginate = $oPaginate->getPaginate();
         }
     } else {
         $aData = $this->_getData($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
     }
     $sPopupOptions = '{}';
     if (!empty($this->_aPopupOptions) && is_array($this->_aPopupOptions)) {
         $sPopupOptions = json_encode($this->_aPopupOptions);
     }
     $aQueryAppend = array_merge(is_array($this->_aQueryAppend) ? $this->_aQueryAppend : array(), is_array($this->_aMarkers) ? $this->_aMarkers : array());
     $sQueryAppend = '{}';
     if (!empty($aQueryAppend) && is_array($aQueryAppend)) {
         $sQueryAppend = json_encode($aQueryAppend);
     }
     $sConfirmMessages = '{}';
     if (!empty($this->_aConfirmMessages) && is_array($this->_aConfirmMessages)) {
         $sConfirmMessages = json_encode($this->_aConfirmMessages);
     }
     $aVars = array('object' => $this->_sObject, 'id_table' => $sIdTable, 'id_cont' => $sIdContainer, 'id_wrap' => $sIdWrapper, 'sortable' => empty($this->_aOptions['field_order']) ? 0 : 1, 'sorting' => empty($this->_aOptions['sorting_fields']) ? 0 : 1, 'sorting_field' => $sOrderField, 'sorting_dir' => $sOrderDir, 'bx_repeat:row_header' => $this->_getRowHeader(), 'bx_repeat:rows_data' => $this->_getRowsDataDesign($aData), 'paginate' => $sPaginate, 'paginate_get_start' => $this->_aOptions['paginate_get_start'], 'paginate_get_per_page' => $this->_aOptions['paginate_get_per_page'], 'start' => $iStart, 'per_page' => $iPerPage, 'filter' => bx_js_string($sFilter, BX_ESCAPE_STR_APOS), 'order_field' => bx_js_string($sOrderField, BX_ESCAPE_STR_APOS), 'order_dir' => bx_js_string($sOrderDir, BX_ESCAPE_STR_APOS), 'popup_options' => $sPopupOptions, 'query_append' => $sQueryAppend, 'confirm_messages' => $sConfirmMessages, 'columns' => count($this->_aOptions['fields']), 'bx_if:actions_bulk' => array('condition' => !empty($this->_aOptions['actions_bulk']), 'content' => array('actions_bulk' => $this->_getActions('bulk'))), 'bx_if:display_header' => array('condition' => $isDisplayHeader, 'content' => array('bx_if:actions_independent' => array('condition' => !empty($this->_aOptions['actions_independent']), 'content' => array('actions_independent' => $this->_getActions('independent'))), 'bx_if:filter' => array('condition' => !empty($this->_aOptions['filter_fields']) || !empty($this->_aOptions['filter_fields_translatable']), 'content' => array('controls' => $this->_getFilterControls())))));
     $this->_addJsCss();
     return $this->_oTemplate->parseHtmlByName('grid.html', $aVars);
 }
Пример #11
0
 function _wrapMobileUnit($sContent, $iPostID, $oMain)
 {
     $aVars = array('content' => $sContent, 'url' => bx_js_string($oMain->genBlogSubUrl() . '?action=mobile&mode=post&id=' . $iPostID));
     bx_import('BxDolMobileTemplate');
     $oMobileTemplate = new BxDolMobileTemplate($oMain->_oConfig, $oMain->_oDb);
     return $oMobileTemplate->parseHtmlByName($this->sMobileWrapper, $aVars);
 }
Пример #12
0
 function msgBox($sText, $iTimer = 0, $sOnTimer = "")
 {
     $iId = mktime() . mt_rand(1, 1000);
     return $GLOBALS['oSysTemplate']->parseHtmlByName('messageBox.html', array('id' => $iId, 'msgText' => $sText, 'bx_if:timer' => array('condition' => $iTimer > 0, 'content' => array('id' => $iId, 'time' => 1000 * $iTimer, 'on_timer' => bx_js_string($sOnTimer, BX_ESCAPE_STR_QUOTE)))));
 }
Пример #13
0
 function getCodeStats()
 {
     $aStats = getSiteStatArray();
     $aTmplItemsCom = $aTmplItemsImp = array();
     foreach ($aStats as $aStat) {
         $mixedItem = $this->_getStatsItem($aStat);
         if ($mixedItem !== false) {
             $aTmplItemsCom[] = $mixedItem;
         }
         $mixedItem = $this->_getStatsItem($aStat, 'adm_');
         if ($mixedItem !== false) {
             $aTmplItemsImp[] = $mixedItem;
         }
     }
     $aCommonChartData = array();
     foreach ($aTmplItemsCom as $r) {
         $aCommonChartData[] = array('value' => $r['number'], 'color' => '#' . dechex(rand(0x0, 0xffffff)), 'highlight' => '', 'label' => bx_js_string($r['caption'], BX_ESCAPE_STR_APOS));
     }
     $sCommonChartData = json_encode($aCommonChartData);
     $GLOBALS['oAdmTemplate']->addJsSystem(array('chart.min.js'));
     $sContent = $GLOBALS['oAdmTemplate']->parseHtmlByName('dashboard_stats.html', array('bx_repeat:items_common' => $aTmplItemsCom, 'bx_repeat:items_important' => $aTmplItemsImp, 'common_chart_data' => $sCommonChartData));
     return DesignBoxAdmin(_t('_adm_box_cpt_content'), $sContent, '', '', 11);
 }
Пример #14
0
 /**
  * Generate Select Box Element
  *
  * @param  array  $aInput
  * @return string
  */
 function genInputFiles(&$aInput, $sInfo = '', $sError = '')
 {
     bx_import('BxDolUploader');
     $sUniqId = genRndPwd(8, false);
     $sUploaders = '';
     $oUploader = null;
     foreach ($aInput['uploaders'] as $sUploaderObject) {
         $oUploader = BxDolUploader::getObjectInstance($sUploaderObject, $aInput['storage_object'], $sUniqId);
         if (!$oUploader) {
             continue;
         }
         $sGhostTemplate = false;
         if (isset($aInput['ghost_template']) && is_object($aInput['ghost_template'])) {
             // form is not submitted and ghost template is BxDolFormNested object
             $oFormNested = $aInput['ghost_template'];
             if ($oFormNested instanceof BxDolFormNested) {
                 $sGhostTemplate = $oFormNested->getCode();
             }
         } elseif (isset($aInput['ghost_template']) && is_array($aInput['ghost_template']) && isset($aInput['ghost_template']['inputs'])) {
             // form is not submitted and ghost template is form array
             bx_import('BxDolFormNested');
             $oFormNested = new BxDolFormNested($aInput['name'], $aInput['ghost_template'], $this->aParams['db']['submit_name'], $this->oTemplate);
             $sGhostTemplate = $oFormNested->getCode();
         } elseif (isset($aInput['ghost_template']) && is_array($aInput['ghost_template']) && $aInput['ghost_template']) {
             // form is submitted and ghost template is array of BxDolFormNested objects
             bx_import('BxDolFormNested');
             $sGhostTemplate = array();
             foreach ($aInput['ghost_template'] as $iFileId => $oFormNested) {
                 if (is_object($oFormNested) && $oFormNested instanceof BxDolFormNested) {
                     $sGhostTemplate[$iFileId] = $oFormNested->getCode();
                 }
             }
         } elseif (isset($aInput['ghost_template']) && is_string($aInput['ghost_template'])) {
             // ghost template is just string template, without nested form
             $sGhostTemplate = $aInput['ghost_template'];
         }
         $aParams = array('button_title' => bx_js_string($oUploader->getUploaderButtonTitle(isset($aInput['upload_buttons_titles']) ? $aInput['upload_buttons_titles'] : false)), 'content_id' => isset($aInput['content_id']) ? $aInput['content_id'] : '');
         if (isset($aInput['images_transcoder']) && $aInput['images_transcoder']) {
             $aParams['images_transcoder'] = bx_js_string($aInput['images_transcoder']);
         }
         $sUploaders .= $oUploader->getUploaderButton($sGhostTemplate, isset($aInput['multiple']) ? $aInput['multiple'] : true, $aParams);
     }
     return $this->oTemplate->parseHtmlByName('form_field_uploader.html', array('uploaders_buttons' => $sUploaders, 'info' => $sInfo, 'error' => $sError, 'id_container_errors' => $oUploader ? $oUploader->getIdContainerErrors() : '', 'id_container_result' => $oUploader ? $oUploader->getIdContainerResult() : '', 'uploader_instance_name' => $oUploader ? $oUploader->getNameJsInstanceUploader() : '', 'is_init_ghosts' => isset($aInput['init_ghosts']) && !$aInput['init_ghosts'] ? 0 : 1));
 }
Пример #15
0
 /**
  * Cmts Player
  */
 function serviceResponseCmtsPlayer($oAlert)
 {
     if (!($iFileId = (int) $oAlert->iObject)) {
         return false;
     }
     if (!($aFile = $this->_oDb->getRow("SELECT * FROM `RayVideo_commentsFiles` WHERE `ID` = {$iFileId}"))) {
         return false;
     }
     global $sIncPath;
     global $sModulesPath;
     global $sFilesPath;
     global $sFilesUrl;
     global $oDb;
     require_once $sIncPath . 'db.inc.php';
     $sModule = "video_comments";
     $sModulePath = $sModulesPath . $sModule . '/inc/';
     require_once $sModulesPath . $sModule . '/inc/header.inc.php';
     require_once $sModulesPath . $sModule . '/inc/constants.inc.php';
     require_once $sModulesPath . $sModule . '/inc/functions.inc.php';
     require_once $sModulesPath . $sModule . '/inc/customFunctions.inc.php';
     $sOverride = false;
     switch ($aFile['Status']) {
         case VC_STATUS_DISAPPROVED:
             $sOverride = $this->_oTemplate->addCss(array('default.css', 'common.css', 'general.css'), true) . MsgBox(_t('_sys_media_disapproved'));
             break;
         case VC_STATUS_PENDING:
         case VC_STATUS_PROCESSING:
             $sOverride = $this->_oTemplate->addCss(array('default.css', 'common.css', 'general.css'), true) . MsgBox(_t('_sys_media_processing'));
             break;
         case VC_STATUS_APPROVED:
             if (file_exists($sFilesPath . $iFileId . VC_M4V_EXTENSION)) {
                 $sToken = _getToken($iFileId);
                 if (file_exists($sFilesPath . $iFileId . '.webm')) {
                     $sSourceWebm = '<source type=\'video/webm; codecs="vp8, vorbis"\' src="' . BX_DOL_URL_ROOT . "flash/modules/video_comments/get_file.php?id=" . $iFileId . "&ext=webm&token=" . $sToken . '" />';
                 }
                 $sFlash = $oAlert->aExtras['data'];
                 $sId = 'bx-media-' . genRndPwd(8, false);
                 $sOverride = '
                     <video controls preload="auto" autobuffer id="' . $sId . '">
                         ' . $sSourceWebm . '
                         <source src="' . BX_DOL_URL_ROOT . "flash/modules/video_comments/get_file.php?id=" . $iFileId . "&ext=m4v&token=" . $sToken . '" />
                         ' . (BX_H5AV_FALLBACK ? $sFlash : '<b>Can not playback media - your browser doesn\'t support HTML5 audio/video tag.</b>') . '
                     </video>' . ($sSourceWebm ? '' : '<script>
                             var eMedia = document.createElement("video");
                             if (eMedia.canPlayType && !eMedia.canPlayType("video/x-m4v")) {
                                 var sReplace = "' . bx_js_string(BX_H5AV_FALLBACK ? $sFlash : '<b>Your browser doesn\'t support this media playback.</b>', BX_ESCAPE_STR_QUOTE) . '";
                                 $("#' . $sId . '").replaceWith(sReplace);
                             }
                         </script>');
                 break;
             }
         case VC_STATUS_FAILED:
         default:
             if (!BX_H5AV_FALLBACK || !file_exists($sFilesPath . $iFileId . FLV_EXTENSION)) {
                 $sOverride = $this->_oTemplate->addCss(array('default.css', 'common.css', 'general.css'), true) . MsgBox(_t('_sys_media_not_found'));
             }
             break;
     }
     if ($sOverride) {
         $oAlert->aExtras['data'] = $sOverride;
     }
     return true;
 }
Пример #16
0
function genListRows($sList)
{
    global $aFields;
    $aRows = getPreValues($sList);
    ?>
        <tr class="headers">
    <?php 
    foreach ($aFields as $sField => $sHelp) {
        ?>
            <th>
                <span class="tableLabel" onmouseover="showFloatDesc( '<?php 
        echo bx_js_string($sHelp);
        ?>
' );" onmousemove="moveFloatDesc( event );" onmouseout="hideFloatDesc();"><?php 
        echo $sField;
        ?>
</span>
            </th>
        <?php 
    }
    ?>
            <th>&nbsp;</th>
        </tr>
	<?php 
    $iCounter = 0;
    foreach ($aRows as $aRow) {
        ?>
        <tr>
        <?php 
        foreach ($aFields as $sField => $sHelp) {
            echo '<td><input type="text" class="value_input" name="PreList[' . $iCounter . '][' . $sField . ']" value="' . htmlspecialchars($aRow[$sField]) . '" /></td>';
        }
        ?>
            <th class="row_controls"><a class="row_control bx-def-margin-thd-left-auto" href="javascript:void(0)" onclick="javascript:delRow(this);" title="<?php 
        echo bx_html_attribute(_t('_Delete'));
        ?>
"><i class="sys-icon times"></i></a><a class="row_control bx-def-margin-thd-left-auto" href="javascript:void(0)" onclick="javascript:moveUpRow(this);" title="<?php 
        echo bx_html_attribute(_t('_adm_pvalues_txt_move_up'));
        ?>
"><i class="sys-icon arrow-up"></i></a><a class="row_control bx-def-margin-thd-left-auto" href="javascript:void(0)" onclick="javascript:moveDownRow(this);" title="<?php 
        echo bx_html_attribute(_t('_adm_pvalues_txt_move_down'));
        ?>
"><i class="sys-icon arrow-down"></i></a></th>
        </tr>
	<?php 
        $iCounter++;
    }
    ?>
        <tr class="headers">
            <td colspan="<?php 
    echo count($aFields);
    ?>
">&nbsp;</td>
            <th class="row_controls">
				<a class="row_control" href="javascript:void(0)" onclick="javascript:addRow(this);" title="<?php 
    echo bx_html_attribute(_t('_adm_pvalues_txt_add_record'));
    ?>
"><i class="sys-icon plus"></i></a>
            </th>
        </tr>
    <?php 
    return $iCounter;
}
Пример #17
0
    $sQuery = "SELECT `id`, `title` FROM `sys_menu_admin` WHERE `parent_id`='{$aTopItem['id']}' ORDER BY `order`";
    $iSubIndex = 0;
    $rCustomItems = db_res($sQuery);
    while (($aCustomItem = $rCustomItems->fetch()) !== false) {
        $sCustomTitle = bx_js_string(_t($aCustomItem['title']), BX_ESCAPE_STR_APOS);
        $sComposerInit .= "\n        aCustomItems[{$iIndex}][" . $iSubIndex++ . "] = [{$aCustomItem['id']}, '{$sCustomTitle}', 3];";
    }
    $iIndex++;
}
$sComposerInit .= "\n";
foreach ($aAllTopItems as $iId => $sLangKey) {
    $aAllTopItems[$iId] = _t($sLangKey);
}
asort($aAllTopItems);
foreach ($aAllTopItems as $iId => $sTitle) {
    $sTopTitle = bx_js_string($sTitle, BX_ESCAPE_STR_APOS);
    $sComposerInit .= "\n        aAllItems['{$iId} '] = '{$sTopTitle}';";
}
$sComposerInit .= "\n    </script>\n";
$iNameIndex = 12;
$_page = array('name_index' => $iNameIndex, 'css_name' => array('menu_compose.css', 'forms_adv.css'), 'js_name' => array('menu_compose.js', 'BxDolMenu.js'), 'header' => _t('_adm_ambuilder_title'));
$sContent = $GLOBALS['oAdmTemplate']->parseHtmlByName('menu_compose.html', array('extra_js' => $sComposerInit));
$_page_cont[$iNameIndex]['page_main_code'] = DesignBoxAdmin(_t('_adm_ambuilder_title'), $sContent);
PageCodeAdmin();
// Functions
function showEditFormCustom($aItem)
{
    $aForm = array('form_attrs' => array('id' => 'formItemEdit', 'name' => 'formItemEdit', 'action' => $GLOBALS['site']['url_admin'] . 'menu_compose_admin.php', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'inputs' => array('Title' => array('type' => 'text', 'name' => 'title', 'caption' => _t('_Title'), 'value' => $aItem['title'], 'attrs' => array()), 'Url' => array('type' => 'text', 'name' => 'url', 'caption' => _t('_URL'), 'value' => $aItem['url'], 'attrs' => array()), 'Check' => array('type' => 'text', 'name' => 'check', 'caption' => _t('_adm_ambuilder_Check'), 'value' => htmlspecialchars_adv($aItem['check']), 'attrs' => array()), 'Description' => array('type' => 'text', 'name' => 'description', 'caption' => _t('_Description'), 'value' => htmlspecialchars_adv($aItem['description']), 'attrs' => array()), 'Icon' => array('type' => 'text', 'name' => 'icon', 'caption' => _t('_adm_ambuilder_Icon'), 'value' => htmlspecialchars_adv($aItem['icon']), 'attrs' => array()), 'submit' => array('type' => 'input_set', array('type' => 'button', 'name' => 'save', 'value' => _t('_Save Changes'), 'attrs' => array('onclick' => 'javascript:saveItem(' . $aItem['id'] . ');')), array('type' => 'button', 'name' => 'delete', 'value' => _t('_Delete'), 'attrs' => array('onclick' => 'javascript:deleteItem(' . $aItem['id'] . ');')))));
    $oForm = new BxTemplFormView($aForm);
    return PopupBox('amc_edit_popup_custom', _t('_adm_mbuilder_edit_item'), $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $oForm->getCode() . LoadingBox('formItemEditLoading'))));
}
Пример #18
0
 function getAdminPart($aCondition = array(), $aCustom = array())
 {
     $this->oSearch->bAdminMode = true;
     $iPerPage = isset($_GET['per_page']) ? (int) $_GET['per_page'] : (int) $this->oConfig->getGlParam('number_albums_browse');
     $iPage = isset($_GET['page']) ? (int) $_GET['page'] : $this->oSearch->aCurrent['paginate']['page'];
     $aCondition['show_empty'] = true;
     $aCondition['hide_default'] = true;
     $aCondition['owner'] = $this->iOwnerId;
     $sCode = $this->oSearch->getAlbumList($iPage, $iPerPage, $aCondition);
     $iCount = $this->oSearch->aCurrent['paginate']['totalAlbumNum'];
     $aBtns = array(0 => array('type' => 'submit', 'name' => 'action_delete', 'value' => _t('_Delete'), 'onclick' => 'onclick="return confirm(\'' . bx_js_string(_t('_Are_you_sure')) . '\');"'));
     $sPaginate = '';
     if ($iCount > $iPerPage) {
         $sSection = isset($aCustom['section']) ? strip_tags($aCustom['section']) : '';
         $iId = isset($aCustom['page_block_id']) ? (int) $aCustom['page_block_id'] : 1;
         $aLinkAddon = $this->oSearch->getLinkAddByPrams(array('r'));
         $sLink = $sLinkJs = $sViewAllUrl = BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . 'albums/my/' . $sSection;
         if ($this->oConfig->isPermalinkEnabled) {
             $sLinkJs .= '?';
             $sViewAllUrl .= '?';
         } else {
             $sViewAllUrl .= '&amp;';
         }
         $sLinkJs .= $aLinkAddon['params'];
         $sViewAllUrl .= 'per_page=' . $iCount;
         $oPaginate = new BxDolPaginate(array('page_url' => $sLink, 'count' => $iCount, 'per_page' => $iPerPage, 'page' => $iPage, 'on_change_page' => 'return !loadDynamicBlock(' . $iId . ', \'' . $sLinkJs . '&page={page}&per_page={per_page}\');', 'on_change_per_page' => 'return !loadDynamicBlock(' . $iId . ', \'' . $sLinkJs . '&page=1&per_page=\' + this.value);'));
         $sPaginate = $oPaginate->getSimplePaginate($sViewAllUrl);
     }
     $sManage = $this->oSearch->showAdminActionsPanel($this->oSearch->aCurrent['name'] . '_admin_form', $aBtns);
     $aUnit = array('main_code' => $sCode, 'paginate' => $sPaginate, 'manage' => $sManage, 'bx_if:hidden' => '');
     return $this->oTemplate->parseHtmlByName('manage_form_albums.html', $aUnit);
 }
Пример #19
0
    /**
     * returns search results XML
     *
     * @param $text        search string
     * @param $type        search type: msgs - messages | tlts - titles
     * @param $forum       forum id to search within
     * @param $u           search posts of this user only
     * @param $disp        display: topics | posts
     * @param $start       for pagination
     */
    function getSearchResultsXML($text, $type, $forum, $u, $disp, $start = 0, $isWholePage = false)
    {
        global $gConf;
        if (!$this->_checkUserPerm('', '', 'search')) {
            return $this->_no_access();
        }
        $num = 0;
        switch ($type) {
            case 'msgs':
            case 'tlts':
                $a = $this->fdb->searchMessages(filter_to_db($text), filter_to_db($u), $forum, $type, 'posts' == $disp ? 1 : 0, $start, $num);
                break;
            default:
                return '<error>[L[Wrong search type]]</error>';
        }
        $ws = preg_split("/\\s+/", $text);
        $ui = array();
        $s = '';
        reset($a);
        switch ($type) {
            case 'tlts':
                while (list(, $r) = each($a)) {
                    encode_post_text($r['cat_name']);
                    encode_post_text($r['forum_title']);
                    encode_post_text($r['topic_title'], true);
                    // search hightlight
                    if ($text) {
                        reset($ws);
                        while (list(, $w) = each($ws)) {
                            if ($w) {
                                $wreg = str_replace(array('(', ')'), array('\\(', '\\)'), $w);
                                $r['topic_title'] = preg_replace("/({$wreg})/i", "<span style=\"background-color:yellow\">{$w}</span>", $r['topic_title']);
                            }
                        }
                    }
                    // acquire user info
                    if (!isset($ui[$r['user']]) && ($aa = $this->_getUserInfoReadyArray($r['user']))) {
                        $ui[$r['user']] = $aa;
                    }
                    $r['date'] = bx_html_attribute(orca_format_date($r['date']));
                    $s .= <<<EOF
                    <sr date="{$r['date']}">
                        <c id="{$r['cat_id']}" uri="{$r['cat_uri']}">{$r['cat_name']}</c>
                        <f id="{$r['forum_id']}" uri="{$r['forum_uri']}">{$r['forum_title']}</f>
                        <t id="{$r['topic_id']}" uri="{$r['topic_uri']}">{$r['topic_title']}</t>
                        <u>
                            <avatar>{$ui[$r['user']]['avatar']}</avatar>
                            <avatar_medium>{$ui[$r['user']]['avatar64']}</avatar_medium>
                            <profile>{$ui[$r['user']]['url']}</profile>
                            <profile_title>{$ui[$r['user']]['title']}</profile_title>
                            <onclick>{$ui[$r['user']]['onclick']}</onclick>
                            <role>{$ui[$r['user']]['role']}</role>
                        </u>
                    </sr>
EOF;
                }
                break;
            case 'msgs':
                while (list(, $r) = each($a)) {
                    // search hightlight
                    if ($text) {
                        reset($ws);
                        while (list(, $w) = each($ws)) {
                            if ($w) {
                                $wreg = str_replace(array('(', ')'), array('\\(', '\\)'), $w);
                                $ind = preg_match("([^>]*<)/i", $r['post_text'], $ind);
                                // html tags?
                                if ($ind) {
                                    $r['post_text'] = preg_replace("/({$wreg})(?=[^>]*<)/i", "<span style=\"background-color:yellow\">{$w}</span>", "<div>{$r['post_text']}</div>");
                                } else {
                                    $r['post_text'] = preg_replace("/({$wreg})/i", "<span style=\"background-color:yellow\">{$w}</span>", $r['post_text']);
                                }
                            }
                        }
                    }
                    encode_post_text($r['post_text']);
                    encode_post_text($r['cat_name']);
                    encode_post_text($r['forum_title']);
                    encode_post_text($r['topic_title'], true);
                    if ($text) {
                        reset($ws);
                        while (list(, $w) = each($ws)) {
                            $wreg = str_replace(array('(', ')'), array('\\(', '\\)'), $w);
                            $r['topic_title'] = preg_replace("/({$wreg})/i", "<span style=\"background-color:yellow\">{$w}</span>", $r['topic_title']);
                        }
                    }
                    // acquire user info
                    if (!isset($ui[$r['user']]) && ($aa = $this->_getUserInfoReadyArray($r['user']))) {
                        $ui[$r['user']] = $aa;
                    }
                    $r['date'] = bx_html_attribute(orca_format_date($r['date']));
                    $s .= <<<EOF
                    <sr date="{$r['date']}">
                        <c id="{$r['cat_id']}" uri="{$r['cat_uri']}">{$r['cat_name']}</c>
                        <f id="{$r['forum_id']}" uri="{$r['forum_uri']}">{$r['forum_title']}</f>
                        <t id="{$r['topic_id']}" uri="{$r['topic_uri']}">{$r['topic_title']}</t>
                        <p id="{$r['post_id']}">{$r['post_text']}</p>
                        <u name="{$r['user']}">
                            <avatar>{$ui[$r['user']]['avatar']}</avatar>
                            <avatar_medium>{$ui[$r['user']]['avatar64']}</avatar_medium>
                            <profile>{$ui[$r['user']]['url']}</profile>
                            <profile_title>{$ui[$r['user']]['title']}</profile_title>
                            <onclick>{$ui[$r['user']]['onclick']}</onclick>
                            <role>{$ui[$r['user']]['role']}</role>
                        </u>
                    </sr>
EOF;
                }
                break;
        }
        $p = $this->_getPages($start, $num, $gConf['topics_per_page']);
        $textEncoded = bx_js_string($text, BX_ESCAPE_STR_APOS);
        $userEncoded = bx_js_string($u, BX_ESCAPE_STR_APOS);
        $sp = <<<EOS
<search_text><![CDATA[{$text}]]></search_text>
<search_params>
    <text><![CDATA[{$textEncoded}]]></text>
    <type>{$type}</type>
    <forum>{$forum}</forum>
    <user><![CDATA[{$userEncoded}]]></user>
    <disp>{$disp}</disp>
</search_params>
EOS;
        $cu = $this->getUrlsXml();
        encode_post_text($text);
        if ($isWholePage) {
            $this->setTitle('<![CDATA[[L[Search Results For:]]' . $text . ']]>');
            $li = $this->_getLoginInfo($u);
            return $this->addHeaderFooter($li, "<search>{$sp}<pages num=\"{$num}\" per_page=\"{$gConf['topics_per_page']}\">{$p}</pages>{$s}</search>");
        } else {
            return "<root>{$cu}<search>{$sp}<pages num=\"{$num}\" per_page=\"{$gConf['topics_per_page']}\">{$p}</pages>{$s}</search></root>";
        }
    }
Пример #20
0
    public function generateJs()
    {
        $sUrlSelf = bx_js_string($_SERVER['PHP_SELF'], BX_ESCAPE_STR_APOS);
        ?>
        <script language="javascript">
            function bx_sys_adm_audit_test_email()
            {
                var sEmail = prompt('<?php 
        echo _t('_Email');
        ?>
', '<?php 
        echo class_exists('BxDolDb') && BxDolDb::getInstance() ? BxDolDb::getInstance()->getParam('site_email') : '';
        ?>
');
                if (null == sEmail || ('string' == (typeof sEmail) && !sEmail.length))
                    return;

                $('#bx-sys-adm-audit-test-email').html('Sending...');
                $.post('<?php 
        echo bx_append_url_params($sUrlSelf, array('action' => 'audit_send_test_email'));
        ?>
&email=' + sEmail, function(data) {
                    $('#bx-sys-adm-audit-test-email').html(data);
                });
            }

            function bx_sys_adm_audit_phpinfo()
            {
                $(window).dolPopupAjax({url: '<?php 
        echo bx_append_url_params($sUrlSelf, array('action' => 'phpinfo_popup'));
        ?>
'});
            }
        </script>
        <?php 
    }
Пример #21
0
 /**
  * Function will generate window with reply message or new compose message;
  *
  * @param        : $iRecipientID (integer) - recipient's ID ;
  * @param        : $iMessageID (integer) - message ID (optional parameter);
  * @return        : Html presentation data;
  */
 function genReplayMessage($iRecipientID, $iMessageID = 0)
 {
     global $oSysTemplate;
     $iMessageID = (int) $iMessageID;
     $iRecipientID = (int) $iRecipientID;
     // init some needed variables ;
     $sOutputHtml = '';
     $aMemberInfo = getProfileInfo($this->aMailBoxSettings['member_id']);
     $aRecipientInfo = getProfileInfo($iRecipientID);
     $aLanguageKeys = array('information' => $iMessageID ? _t('_Reply') : _t('_COMPOSE_H1'), 'cancel' => bx_js_string(_t('_Cancel')), 'send' => bx_js_string(_t('_Send')), 'send_copy' => _t('_Send copy to personal email', $aRecipientInfo['NickName']), 'send_copy_my' => _t('_Send copy to my personal email'), 'notify' => _t('_Notify by e-mail', $aRecipientInfo['NickName']), 'error_message' => bx_js_string(_t('_please_fill_next_fields_first')));
     if (!empty($aMemberInfo) && !empty($aRecipientInfo)) {
         // ** generate recipient's information ;
         $sMemberIcon = get_member_thumbnail($this->aMailBoxSettings['member_id'], 'none');
         $sMemberNickName = $aMemberInfo['NickName'];
         $sMemberLocation = getProfileLink($aMemberInfo['ID']);
         $sClockImgPath = getTemplateIcon('clock.png');
         $sCurrentDate = date('d.m.Y G:i');
         $sMessageSubject = $iMessageID ? $this->addReToSubject(db_value("\r\n                            SELECT \r\n                                `Subject` \r\n                            FROM \r\n                                `sys_messages` \r\n                            WHERE \r\n                                `ID` = {$iMessageID} \r\n                                    AND \r\n                                (\r\n                                `Sender` = {$this->aMailBoxSettings['member_id']} \r\n                                    OR \r\n                                `Recipient` = {$this->aMailBoxSettings['member_id']}\r\n                                )\r\n                            ")) : null;
         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['send'], 'attrs' => array('onclick' => 'if(typeof oMailBoxReplayMessage != \'undefined\') oMailBoxReplayMessage.sendMessage(' . $iRecipientID . ')')), 1 => array('type' => 'button', 'value' => $aLanguageKeys['cancel'], 'attrs' => array('onclick' => 'if(typeof oMailBoxReplayMessage != \'undefined\') oMailBoxReplayMessage.cancelReplay()')))));
         $oForm = new BxTemplFormView($aForm);
         $sMessageBoxActions = $oForm->getCode();
         $aTemplateKeys = array('error_message' => $aLanguageKeys['error_message'], 'current_page' => 'mail.php', 'information' => $aLanguageKeys['information'], 'member_thumbnail' => $sMemberIcon, 'member_nick_name' => $sMemberNickName, 'member_location' => $sMemberLocation, 'clock_img' => $sClockImgPath, 'date_create' => $sCurrentDate, 'message_subject' => $sMessageSubject, 'send_copy_my' => $aLanguageKeys['send_copy_my'], 'send_copy_to' => $aLanguageKeys['send_copy'], 'notify' => $aLanguageKeys['notify'], 'action_buttons' => $sMessageBoxActions);
         $sOutputHtml = $oSysTemplate->parseHtmlByName($this->aUsedTemplates['message_replay'], $aTemplateKeys);
     }
     return $sOutputHtml;
 }
Пример #22
0
 function getFileAddError($sMessage = '')
 {
     $sMessage = empty($sMessage) ? _t('_sys_txt_upload_failed') : $sMessage;
     return '<script type="text/javascript">alert("' . bx_js_string($sMessage) . '"); parent.' . $this->_sJsPostObject . '._loading(false);</script>';
 }
    function getJsCode($bWrap = false)
    {
        $sJsMainClass = $this->_oConfig->getJsClass();
        $sJsMainObject = $this->_oConfig->getJsObject();
        ob_start();
        ?>
        var <?php 
        echo $sJsMainObject;
        ?>
 = new <?php 
        echo $sJsMainClass;
        ?>
({
        sReset: '<?php 
        echo bx_js_string(_t('_bx_profile_customize_js_reset'));
        ?>
',
        sErrThemeName: '<?php 
        echo bx_js_string(_t('_bx_profile_customize_js_err_theme_name'));
        ?>
',
        sErrChooseTheme: '<?php 
        echo bx_js_string(_t('_bx_profile_customize_js_err_choose_theme'));
        ?>
',
        sDeleteTheme: '<?php 
        echo bx_js_string(_t('_bx_profile_customize_js_delete_theme'));
        ?>
',
        sResetPage: '<?php 
        echo bx_js_string(_t('_bx_profile_customize_js_reset_page'));
        ?>
'
        });
        <?php 
        $sContent = ob_get_clean();
        return $bWrap ? $this->_wrapInTagJsCode($sContent) : $sContent;
    }
Пример #24
0
 /**
  * Compile content
  *
  * @param  string  $sContent            template.
  * @param  string  $aVarName            variable name to be saved in the output file.
  * @param  integer $iVarDepth           depth is used to process nesting, for example, in cycles.
  * @param  array   $aVarValues          values to be compiled in.
  * @param  mixed   $mixedKeyWrapperHtml key wrapper(string value if left and right parts are the same, array(0 => left, 1 => right) otherwise).
  * @return string  the result of operation.
  */
 function _compileContent($sContent, $aVarName, $iVarDepth, $aVarValues, $mixedKeyWrapperHtml = null)
 {
     $aKeys = array_keys($aVarValues);
     $aValues = array_values($aVarValues);
     $aKeyWrappers = $this->_getKeyWrappers($mixedKeyWrapperHtml);
     for ($i = 0; $i < count($aKeys); $i++) {
         if (strpos($aKeys[$i], 'bx_repeat:') === 0) {
             $sKey = "'<" . $aKeys[$i] . ">(.*)<\\/" . $aKeys[$i] . ">'s";
             $aMatches = array();
             preg_match($sKey, $sContent, $aMatches);
             $sValue = '';
             if (isset($aMatches[1]) && !empty($aMatches[1])) {
                 if (empty($aValues[$i]) || !is_array($aValues[$i])) {
                     return false;
                 }
                 $sIndex = "\$" . str_repeat("i", $iVarDepth);
                 $sValue .= '<' . "?php if(is_array(" . $aVarName . "['" . $aKeys[$i] . "'])) for(" . $sIndex . "=0; " . $sIndex . "<count(" . $aVarName . "['" . $aKeys[$i] . "']); " . $sIndex . "++){ ?" . '>';
                 if (($sInnerValue = $this->_compileContent($aMatches[1], $aVarName . "['" . $aKeys[$i] . "'][" . $sIndex . "]", $iVarDepth + 1, current($aValues[$i]), $mixedKeyWrapperHtml)) === false) {
                     return false;
                 }
                 $sValue .= $sInnerValue;
                 $sValue .= '<' . "?php } else if(is_string(" . $aVarName . "['" . $aKeys[$i] . "'])) echo " . $aVarName . "['" . $aKeys[$i] . "']; ?" . '>';
             }
         } else {
             if (strpos($aKeys[$i], 'bx_if:') === 0) {
                 $sKey = "'<" . $aKeys[$i] . ">(.*)<\\/" . $aKeys[$i] . ">'s";
                 $aMatches = array();
                 preg_match($sKey, $sContent, $aMatches);
                 $sValue = '';
                 if (isset($aMatches[1]) && !empty($aMatches[1])) {
                     if (!is_array($aValues[$i]) || !isset($aValues[$i]['content']) || empty($aValues[$i]['content']) || !is_array($aValues[$i]['content'])) {
                         return false;
                     }
                     $sValue .= '<' . "?php if(" . $aVarName . "['" . $aKeys[$i] . "']['condition']){ ?" . '>';
                     if (($sInnerValue = $this->_compileContent($aMatches[1], $aVarName . "['" . $aKeys[$i] . "']['content']", $iVarDepth, $aValues[$i]['content'], $mixedKeyWrapperHtml)) === false) {
                         return false;
                     }
                     $sValue .= $sInnerValue;
                     $sValue .= '<' . '?php } ?' . '>';
                 }
             } else {
                 $sKey = "'" . $aKeyWrappers['left'] . $aKeys[$i] . $aKeyWrappers['right'] . "'s";
                 $sValue = '<' . '?=' . $aVarName . "['" . $aKeys[$i] . "'];?" . '>';
             }
         }
         $aKeys[$i] = $sKey;
         $aValues[$i] = $sValue;
     }
     $aKeys = array_merge($aKeys, array("'<bx_include_auto:([^\\s]+) \\/>'s", "'<bx_include_base:([^\\s]+) \\/>'s", "'<bx_include_tmpl:([^\\s]+) \\/>'s", "'<bx_injection:([^\\s]+) />'s", "'<bx_image_url:([^\\s]+) \\/>'s", "'<bx_icon_url:([^\\s]+) \\/>'s", "'<bx_text:([_\\{\\}\\w\\d\\s]+[^\\s]{1}) \\/>'s", "'<bx_text_js:([^\\s]+) \\/>'s", "'<bx_text_attribute:([^\\s]+) \\/>'s", "'<bx_url_root />'", "'<bx_url_admin />'"));
     $aValues = array_merge($aValues, array(function ($matches) use($aVarValues, $mixedKeyWrapperHtml) {
         return $this->getCached($matches[1], $aVarValues, $mixedKeyWrapperHtml, BX_DOL_TEMPLATE_CHECK_IN_BOTH, false);
     }, function ($matches) use($aVarValues, $mixedKeyWrapperHtml) {
         return $this->getCached($matches[1], $aVarValues, $mixedKeyWrapperHtml, BX_DOL_TEMPLATE_CHECK_IN_BASE, false);
     }, function ($matches) use($aVarValues, $mixedKeyWrapperHtml) {
         return $this->getCached($matches[1], $aVarValues, $mixedKeyWrapperHtml, BX_DOL_TEMPLATE_CHECK_IN_TMPL, false);
     }, function ($matches) {
         return '<?=$this->processInjection($GLOBALS[\'_page\'][\'name_index\'], "' . $matches[1] . '")?>';
     }, function ($matches) {
         return $this->getImageUrl($matches[1]);
     }, function ($matches) {
         return $this->getIconUrl($matches[1]);
     }, function ($matches) {
         return _t($matches[1]);
     }, function ($matches) {
         return bx_js_string(_t($matches[1]));
     }, function ($matches) {
         return bx_html_attribute(_t($matches[1]));
     }, BX_DOL_URL_ROOT, BX_DOL_URL_ADMIN));
     //--- Parse Predefined Keys ---//
     $aCombined = array_combine($aKeys, $aValues);
     foreach ($aCombined as $sPattern => $sValue) {
         if (is_object($sValue) && $sValue instanceof Closure) {
             $sContent = preg_replace_callback($sPattern, $sValue, $sContent);
             continue;
         }
         $sContent = preg_replace_callback($sPattern, function ($matches) use($sValue) {
             return $sValue;
         }, $sContent);
     }
     //--- Parse System Keys ---//
     $sContent = preg_replace("'" . $aKeyWrappers['left'] . "([a-zA-Z0-9_-]+)" . $aKeyWrappers['right'] . "'", "<?=\$this->parseSystemKey('\\1', \$mixedKeyWrapperHtml);?" . ">", $sContent);
     return $sContent;
 }
Пример #25
0
 /**
  * Process all added images and return them as a string.
  *
  * @return string with JS code.
  */
 function _processJsImages()
 {
     $sReturn = '';
     if (isset($this->aPage['js_images']) && is_array($this->aPage['js_images'])) {
         foreach ($this->aPage['js_images'] as $sKey => $sUrl) {
             $sReturn .= "'" . bx_js_string($sKey) . "': '" . bx_js_string($sUrl) . "',";
         }
         $sReturn = substr($sReturn, 0, -1);
     }
     return '<script type="text/javascript" language="javascript">var aDolImages = {' . $sReturn . '};</script>';
 }
Пример #26
0
 /**
  * View list of latest entries for mobile app
  */
 function actionMobileLatestEntries($iPage = 1)
 {
     $sUri = $this->_oConfig->getUri();
     $iPerPage = 10;
     $iPage = (int) $iPage;
     if ($iPage < 1) {
         $iPage = 1;
     }
     bx_import('BxDolMobileTemplate');
     $oMobileTemplate = new BxDolMobileTemplate($this->_oConfig, $this->_oDb);
     $oMobileTemplate->pageStart();
     $sCaption = _t('_' . $sUri . '_bcaption_latest');
     $aParams = array('sample_type' => 'archive', 'sample_params' => '', 'viewer_type' => $this->_oTextData->getViewerType(), 'start' => ($iPage - 1) * $iPerPage, 'count' => $iPerPage, 'filter_value' => '');
     $iTotalCount = $this->_oDb->getCount($aParams);
     $aEntries = $iTotalCount ? $this->_oDb->getEntries($aParams) : array();
     if (empty($aEntries)) {
         $oMobileTemplate->displayNoData($sCaption);
         return;
     }
     foreach ($aEntries as $aEntry) {
         $aVars = array('content' => '<h2>' . $aEntry['caption'] . '</h2>' . getLocaleDate($aEntry['when_uts'], BX_DOL_LOCALE_DATE), 'url' => bx_js_string(BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'mobile_entry/' . $aEntry['id']));
         echo $oMobileTemplate->parseHtmlByName('mobile_row.html', $aVars);
     }
     bx_import('BxDolPaginate');
     $oPaginate = new BxDolPaginate(array('page_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'mobile_latest_entries/{page}', 'count' => $iTotalCount, 'per_page' => $iPerPage, 'page' => $iPage));
     echo $oPaginate->getMobilePaginate();
     $oMobileTemplate->pageCode($sCaption, false);
 }
Пример #27
0
 public function serviceGetBlockSpace($bDynamic = false)
 {
     $bInclideScriptSpace = false;
     //Use dynamic loading by default if this setting is enabled.
     $sJsObject = $this->getPageJsObject();
     $aChartData = array();
     if (!$bDynamic) {
         $aItems = array(array('label' => '_adm_dbd_txt_su_database', 'value' => $this->getDbSize()));
         if ($bInclideScriptSpace) {
             $iSizeDiskTotal = $this->getFolderSize(BX_DIRECTORY_PATH_ROOT);
             $iSizeDiskMedia = $this->getFolderSize(BX_DIRECTORY_STORAGE);
             $aItems[] = array('label' => '_adm_dbd_txt_su_system', 'value' => $iSizeDiskTotal - $iSizeDiskMedia);
         }
         bx_import('BxDolModuleQuery');
         $aModules = BxDolModuleQuery::getInstance()->getModulesBy(array('type' => 'all'));
         foreach ($aModules as $aModule) {
             $sName = $aModule['name'];
             $sTitle = $aModule['title'];
             if ($aModule['name'] == 'system') {
                 $sName = 'sys';
                 $sTitle = _t('_adm_dbd_txt_su_system_media');
             }
             $aItems[] = array('label' => $sTitle, 'value' => (int) $this->oDb->getModuleStorageSize($sName));
         }
         $iSizeTotal = 0;
         $aChartData = array();
         foreach ($aItems as $sColor => $aItem) {
             $iSizeTotal += $aItem['value'];
             $aChartData[] = array(bx_js_string(strip_tags(_t($aItem['label'])), BX_ESCAPE_STR_APOS), array('v' => $aItem['value'], 'f' => bx_js_string(_t_format_size($aItem['value']))));
         }
     }
     $sContent = BxDolStudioTemplate::getInstance()->parseHtmlByName('dbd_space.html', array('bx_if:show_content' => array('condition' => !$bDynamic, 'content' => array('js_object' => $sJsObject, 'chart_data' => json_encode($aChartData))), 'bx_if:show_loader' => array('condition' => $bDynamic, 'content' => array('js_object' => $sJsObject))));
     return array('content' => $sContent);
 }
Пример #28
0
 /**
  * Function will generate block with actions;
  */
 function getBlockCode_ActionsBlock()
 {
     $sCode = '';
     if (!$this->aPollInfo) {
         return MsgBox(_t('_Empty'));
     }
     // prepare all needed keys
     $aUnitInfo = array('ViewerID' => (int) $this->iMemberId, 'ID' => (int) $this->aPollInfo['id_poll'], 'BaseUri' => $this->oModule->_oConfig->getBaseUri());
     $aUnitInfo['base_url'] = BX_DOL_URL_ROOT . $aUnitInfo['BaseUri'];
     $aUnitInfo['approved_cpt'] = '';
     $aUnitInfo['approved_act'] = '';
     $aUnitInfo['del_poll_title'] = $aUnitInfo['del_poll_url'] = $aUnitInfo['del_poll_script'];
     if (isLogged() && ($this->aPollInfo['id_profile'] == $this->iMemberId || isAdmin())) {
         $sDeleteLink = $this->oModule->getModulePath() . '&action=delete_poll&id=' . $aUnitInfo['ID'];
         $aUnitInfo['del_poll_title'] = _t('_bx_poll_delete');
         $aUnitInfo['del_poll_url'] = $sDeleteLink;
         $aUnitInfo['del_poll_script'] = "if(confirm('" . bx_js_string(_t('_Are_you_sure')) . "')) window.open ('" . $sDeleteLink . "','_self'); return false;";
     }
     $sMainPrefix = 'bx_poll';
     if (isAdmin($this->iMemberId) || isModerator($this->iMemberId) && $this->aPollInfo['id_profile'] != $this->iMemberId) {
         $sMsg = '_';
         $iAppr = 1;
         if ($this->aPollInfo['poll_approval'] == 1) {
             $sMsg .= 'dis';
             $iAppr = 0;
         }
         $aUnitInfo['approved_cpt'] = _t('_' . $sMainPrefix . $sMsg . 'approve');
         $aUnitInfo['approved_act'] = $iAppr;
     }
     $oSubscription = BxDolSubscription::getInstance();
     $aButton = $oSubscription->getButton($this->iMemberId, $sMainPrefix, '', $this->aPollInfo['id_poll']);
     $sCode .= $oSubscription->getData();
     $aUnitInfo['sbs_poll_title'] = $aButton['title'];
     $aUnitInfo['sbs_poll_script'] = $aButton['script'];
     $aUnitInfo['TitleShare'] = $this->oModule->isAllowedShare($this->aPollInfo) ? _t('_Share') : '';
     if (BxDolRequest::serviceExists('wall', 'get_repost_js_click')) {
         $sCode .= BxDolService::call('wall', 'get_repost_js_script');
         $aUnitInfo['repostCpt'] = _t('_Repost');
         $aUnitInfo['repostScript'] = BxDolService::call('wall', 'get_repost_js_click', array($this->iMemberId, $sMainPrefix, 'add', $this->aPollInfo['id_poll']));
     }
     $sActions = $GLOBALS['oFunctions']->genObjectsActions($aUnitInfo, $sMainPrefix);
     if (empty($sActions)) {
         return '';
     }
     return $sCode . $sActions;
 }
Пример #29
0
 /**
  * Site avatars html
  * @param $iPage - current page in site avatars
  * @return html with site avatars
  */
 function serviceGetSiteAvatars($iPage)
 {
     $iPage = (int) $iPage ? (int) $iPage : 1;
     $iPerPage = 12;
     $iCounter = 0;
     $iStart = ($iPage - 1) * $iPerPage;
     $aFiles = array();
     if ($h = opendir(BX_AVA_DIR_SITE_AVATARS)) {
         while (($sFile = readdir($h)) !== false) {
             if ('.' == $sFile[0]) {
                 continue;
             }
             if ($iCounter++ < $iStart) {
                 continue;
             }
             if ($iCounter - $iStart <= $iPerPage) {
                 $aFiles[] = array('url' => BX_AVA_URL_SITE_AVATARS . $sFile, 'name' => $sFile);
             }
         }
         closedir($h);
     }
     bx_import('BxDolPaginate');
     $oPaginate = new BxDolPaginate(array('page_url' => 'javascript:void(0);', 'count' => $iCounter, 'per_page' => $iPerPage, 'page' => $iPage, 'on_change_page' => "getHtmlData('bx_ava_site_avatars', '" . $this->_oConfig->getBaseUri() . "get_site_avatars/{page}');"));
     $sAjaxPaginate = $oPaginate->getSimplePaginate('', -1, -1, false);
     $sScript = "<script>\n            \$(document).ready(function() {\n                \$('#bx_ava_site_avatars .bx_ava_tar .bx_ava_actions a').bind('click', function (e) {\n                    var e = \$(this);\n                    getHtmlData('bx_ava_my_avatars', '" . $this->_oConfig->getBaseUri() . "set_site_avatar/' + \$(this).attr('alt'), function () {\n                        e.html('" . bx_js_string(_t('_bx_ava_ok'), BX_ESCAPE_STR_APOS) . "');\n                    }, 'post');\n                });\n            });\n        </script>";
     $aVars = array('bx_repeat:avatars' => $aFiles);
     return $sAjaxPaginate . '<div class="bx-def-padding-thd">' . $GLOBALS['oFunctions']->centerContent($this->_oTemplate->parseHtmlByName('avatars_site', $aVars), '.bx_ava_tar') . '</div>' . $sAjaxPaginate . $sScript;
 }
Пример #30
0
 /**
  * Function will generate received rows ;
  *
  * @return  : Html presentation data ;
  */
 function getProcessingRows($bShowEmpty = true)
 {
     global $oSysTemplate, $site, $oFunctions;
     // ** init some needed variables ;
     $sPageContent = $sActionsList = $sSettings = '';
     $bShowSettings = false;
     $aRows = array();
     $sEmptyMessage = '_Empty';
     $sRowsTemplName = $this->aUsedTemplates['communicator_page'];
     $sJsObject = $this->_getJsObject();
     // define the member's nickname;
     $sMemberNickName = getNickName($this->aCommunicatorSettings['member_id']);
     // all primary language's keys ;
     $aLanguageKeys = array('author' => _t('_Author'), 'type' => _t('_Type'), 'date' => _t('_Date'), 'click_sort' => _t('_Click to sort'), 'from_me' => _t('_From') . ' ' . $sMemberNickName, 'to_me' => _t('_To') . ' ' . $sMemberNickName, 'accept' => _t('_sys_cnts_btn_fr_accept'), 'reject' => _t('_sys_cnts_btn_fr_reject'), 'delete' => _t('_Delete'), 'back_invite' => _t('_Back Invite'), 'fave' => _t('_sys_cnts_btn_fave'), 'visitor' => _t('_Visitor'), 'unblock' => _t('_Unblock'), 'block' => _t('_Block'), 'select' => _t('_Select'), 'all' => _t('_All'), 'none' => _t('_None'), 'read' => _t('_Read'), 'unread' => _t('_Unread'));
     // get all requests from DB ;
     switch ($this->aCommunicatorSettings['communicator_mode']) {
         case 'friends_requests':
             $sEmptyMessage = '_sys_cnts_msg_fr_empty';
             $sRowsTemplName = $this->aUsedTemplates['communicator_page_fr'];
             $aTypes = array('from' => _t('_MEMBERS_INVITE_YOU_FRIENDLIST'), 'to' => _t('_MEMBERS_YOU_INVITED_FRIENDLIST'));
             $aRows = $this->getRequests('sys_friend_list', $aTypes, ' AND `sys_friend_list`.`Check` = 0 ');
             break;
         case 'hotlist_requests':
             $aTypes = array('from' => _t('_MEMBERS_YOU_HOTLISTED'), 'to' => _t('_MEMBERS_YOU_HOTLISTED_BY'));
             $aRows = $this->getRequests('sys_fave_list', $aTypes);
             break;
         case 'greeting_requests':
             $aTypes = array('from' => _t('_MEMBERS_YOU_KISSED'), 'to' => _t('_MEMBERS_YOU_KISSED_BY'), 'specific_key' => '_N times');
             $aRows = $this->getRequests('sys_greetings', $aTypes, null, 'Number');
             break;
         case 'blocks_requests':
             $aTypes = array('from' => _t('_MEMBERS_YOU_BLOCKLISTED'), 'to' => _t('_MEMBERS_YOU_BLOCKLISTED_BY'));
             $aRows = $this->getRequests('sys_block_list', $aTypes);
             break;
         case 'friends_list':
             $aTypes = array('from' => _t('_Friend list'), 'to' => _t('_Friend list'));
             $aRows = $this->getRequests('sys_friend_list', $aTypes, ' AND `sys_friend_list`.`Check` = 1 OR ( `sys_friend_list`.`ID` = ' . $this->aCommunicatorSettings['member_id'] . ' AND `sys_friend_list`.`Check` = 1 )');
             break;
         default:
             $aTypes = array('from' => _t('_MEMBERS_INVITE_YOU_FRIENDLIST'), 'to' => _t('_MEMBERS_YOU_INVITED_FRIENDLIST'));
             $aRows = $this->getRequests('sys_friend_list', $aTypes, ' AND `sys_friend_list`.`Check` = 0 ');
     }
     if (empty($aRows) && !$bShowEmpty) {
         return '';
     }
     // ** Generate the page's pagination ;
     // fill array with all necessary `get` parameters ;
     $aNeededParameters = array('communicator_mode', 'person_switcher', 'sorting');
     // collect the page's URL ;
     $sRequest = BX_DOL_URL_ROOT . 'communicator.php?action=get_page';
     // add additional parameters ;
     foreach ($aNeededParameters as $sKey) {
         $sRequest .= (array_key_exists($sKey, $this->aCommunicatorSettings) and $this->aCommunicatorSettings[$sKey]) ? '&' . $sKey . '=' . $this->aCommunicatorSettings[$sKey] : null;
     }
     $sCuttedUrl = $sRequest;
     $sRequest .= '&page={page}&per_page={per_page}';
     // create  the pagination object ;
     $oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $this->iTotalRequestsCount, 'per_page' => $this->aCommunicatorSettings['per_page'], 'sorting' => $this->aCommunicatorSettings['sorting'], 'page' => $this->aCommunicatorSettings['page'], 'per_page_changer' => false, 'page_reloader' => true, 'on_change_page' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".getPaginatePage('{$sRequest}')", 'on_change_per_page' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".getPage(this.value, '{$sCuttedUrl}')"));
     $sPagination = $oPaginate->getPaginate();
     // process received requests;
     if ($aRows) {
         $iIndex = 1;
         foreach ($aRows as $iKey => $aItems) {
             // if member not a visitor ;
             if ($aItems['member_id']) {
                 // ** some member's information ;
                 $aProfileInfo = getProfileInfo($aItems['member_id']);
                 // member's Icon ;
                 $sMemberIcon = get_member_thumbnail($aProfileInfo['ID'], 'left', $this->aCommunicatorSettings['communicator_mode'] != 'friends_requests');
                 // member's profile location ;
                 $sMemberLocation = getProfileLink($aProfileInfo['ID']);
                 // member's nickname ;
                 $sMemberNickName = getNickName($aProfileInfo['ID']);
                 // define the member's age ;
                 $sMemberAge = $aProfileInfo['DateOfBirth'] != "0000-00-00" ? _t("_y/o", age($aProfileInfo['DateOfBirth'])) : null;
                 // define the member's country, sex, etc ... ;
                 $sMemberCountry = $aProfileInfo['Country'];
                 $sMemberFlag = $site['flags'] . strtolower($sMemberCountry) . $this->sMembersFlagExtension;
                 $sMemberSexImg = $oFunctions->genSexIcon($aProfileInfo['Sex']);
                 if ($sMemberCountry) {
                     $sMemberCountryFlag = '<img src="' . $sMemberFlag . '" alt="' . $sMemberCountry . '" />';
                 }
                 $iMemberMutualFriends = getMutualFriendsCount($aItems['member_id'], getLoggedId());
             } else {
                 // ** if it's a visitor
                 // member's Icon ;
                 $sMemberIcon = $aLanguageKeys['visitor'];
                 // member's profile location ;
                 $sMemberLocation = null;
                 $sMemberSexImg = null;
                 $sMemberAge = null;
                 $sMemberCountryFlag = null;
                 $sMemberCountry = null;
             }
             $aProcessedRows[] = array('js_object' => $sJsObject, 'row_value' => $aItems['member_id'], 'member_icon' => $sMemberIcon, 'member_nick_name' => $sMemberNickName, 'member_location' => $sMemberLocation ? '<a href="' . $sMemberLocation . '">' . $sMemberNickName . '</a>' : '', 'member_sex_img' => $sMemberSexImg ? ' <img src="' . $sMemberSexImg . '" alt="' . $aProfileInfo['Sex'] . '" />' : '', 'member_age' => $sMemberAge, 'member_flag' => $sMemberCountryFlag, 'member_country' => $sMemberCountry, 'member_mutual_friends' => _t('_sys_cnts_txt_mutual_friends', $iMemberMutualFriends > 0 ? $iMemberMutualFriends : _t('_sys_cnts_txt_mf_no')), 'type' => $aItems['type'], 'message_date' => $aItems['date']);
             $iIndex++;
         }
         // init the sort toggle ellements ;
         switch ($this->aCommunicatorSettings['sorting']) {
             case 'date':
                 $aSortToglleElements['date_sort_toggle'] = 'toggle_up';
                 break;
             case 'date_desc':
                 $aSortToglleElements['date_sort_toggle'] = 'toggle_down';
                 break;
             case 'author':
                 $aSortToglleElements['author_sort_toggle'] = 'toggle_up';
                 break;
             case 'author_desc':
                 $aSortToglleElements['author_sort_toggle'] = 'toggle_down';
                 break;
         }
         // define the actions list for type of requests;
         switch ($this->aCommunicatorSettings['communicator_mode']) {
             case 'friends_requests':
                 // define the person mode ;
                 switch ($this->aCommunicatorSettings['person_switcher']) {
                     case 'to':
                         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['accept'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'accept_friends_request', 'getProcessingRows')")), 1 => array('type' => 'button', 'value' => $aLanguageKeys['reject'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'reject_friends_request', 'getProcessingRows')")))));
                         $oForm = new BxTemplFormView($aForm);
                         $sActionsList = $oForm->getCode();
                         break;
                     case 'from':
                         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['back_invite'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'delete_friends_request', 'getProcessingRows')")))));
                         $oForm = new BxTemplFormView($aForm);
                         $sActionsList = $oForm->getCode();
                         break;
                 }
                 break;
             case 'hotlist_requests':
                 // define the person mode ;
                 switch ($this->aCommunicatorSettings['person_switcher']) {
                     case 'to':
                         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['fave'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'add_hotlist', 'getProcessingRows')")))));
                         $oForm = new BxTemplFormView($aForm);
                         $sActionsList = $oForm->getCode();
                         break;
                     case 'from':
                         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'delete_hotlisted', 'getProcessingRows')")))));
                         $oForm = new BxTemplFormView($aForm);
                         $sActionsList = $oForm->getCode();
                         break;
                 }
                 break;
             case 'greeting_requests':
                 $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'delete_greetings', 'getProcessingRows')")))));
                 $oForm = new BxTemplFormView($aForm);
                 $sActionsList = $oForm->getCode();
                 break;
             case 'blocks_requests':
                 // define the person mode ;
                 switch ($this->aCommunicatorSettings['person_switcher']) {
                     case 'to':
                         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['block'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'block_unblocked', 'getProcessingRows')")))));
                         $oForm = new BxTemplFormView($aForm);
                         $sActionsList = $oForm->getCode();
                         break;
                     case 'from':
                         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['unblock'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'unblock_blocked', 'getProcessingRows')")))));
                         $oForm = new BxTemplFormView($aForm);
                         $sActionsList = $oForm->getCode();
                         break;
                 }
                 break;
             case 'friends_list':
                 $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'reject_friends_request', 'getProcessingRows')")))));
                 $oForm = new BxTemplFormView($aForm);
                 $sActionsList = $oForm->getCode();
                 break;
         }
         // processing the sort link ;
         $sSortLink = getClearedParam('sorting', $sCuttedUrl) . '&page=' . $this->aCommunicatorSettings['page'] . '&per_page=' . $this->aCommunicatorSettings['per_page'];
         // fill array with template keys ;
         $aTemplateKeys = array('js_object' => $sJsObject, 'from_me' => $aLanguageKeys['from_me'], 'to_me' => $aLanguageKeys['to_me'], 'selected_from' => $this->aCommunicatorSettings['person_switcher'] == 'from' ? 'checked="checked"' : null, 'selected_to' => $this->aCommunicatorSettings['person_switcher'] == 'to' ? 'checked="checked"' : null, 'page_sort_url' => $sSortLink, 'sort_date' => $this->aCommunicatorSettings['sorting'] == 'date' ? 'date_desc' : 'date', 'sort_author' => $this->aCommunicatorSettings['sorting'] == 'author' ? 'author_desc' : 'author', 'date_sort_toggle_ellement' => $aSortToglleElements['date_sort_toggle'], 'author_sort_toggle_ellement' => $aSortToglleElements['author_sort_toggle'], 'author' => $aLanguageKeys['author'], 'type' => $aLanguageKeys['type'], 'date' => $aLanguageKeys['date'], 'click_sort' => $aLanguageKeys['click_sort'], 'bx_repeat:rows' => $aProcessedRows, 'actions_list' => $sActionsList, 'current_page' => 'communicator.php', 'select' => $aLanguageKeys['select'], 'all_messages' => $aLanguageKeys['all'], 'none_messages' => $aLanguageKeys['none'], 'read_messages' => $aLanguageKeys['read'], 'unread_messages' => $aLanguageKeys['unread'], 'page_pagination' => $sPagination);
         $sPageContent = $oSysTemplate->parseHtmlByName($sRowsTemplName, $aTemplateKeys);
     } else {
         $sPageContent = $oSysTemplate->parseHtmlByName('default_margin.html', array('content' => MsgBox(_t($sEmptyMessage))));
     }
     // ** Process the final template ;
     // generate the page settings ;
     if ($bShowSettings) {
         $aTemplateKeys = array('js_object' => $sJsObject, 'from_me' => $aLanguageKeys['from_me'], 'to_me' => $aLanguageKeys['to_me'], 'selected_from' => $this->aCommunicatorSettings['person_switcher'] == 'from' ? 'checked="checked"' : null, 'selected_to' => $this->aCommunicatorSettings['person_switcher'] == 'to' ? 'checked="checked"' : null);
         $sSettings = $oSysTemplate->parseHtmlByName($this->aUsedTemplates['communicator_settings'], $aTemplateKeys);
     }
     // fill array with template keys ;
     $aTemplateKeys = array('js_object' => $sJsObject, 'current_page' => 'communicator.php', 'communicator_mode' => $this->aCommunicatorSettings['communicator_mode'], 'communicator_person_mode' => $this->aCommunicatorSettings['person_switcher'], 'error_message' => bx_js_string(_t('_Please, select at least one message')), 'sure_message' => bx_js_string(_t('_Are you sure?')), 'settings' => $sSettings, 'page_content' => $sPageContent);
     return $oSysTemplate->parseHtmlByName($this->aUsedTemplates['communicator_settings_page'], $aTemplateKeys);
 }