/**
  * Display captcha.
  */
 public function display($bDynamicMode = false)
 {
     $sId = 'sys-captcha-' . time() . rand(0, PHP_INT_MAX);
     $sInit = "\n            Recaptcha.create('" . $this->_sKeyPublic . "', '" . $sId . "', {\n                lang: '" . bx_lang_name() . "',\n                theme: '" . $this->_sSkin . "',\n                custom_theme_widget: '" . $sId . "'\n            });\n        ";
     if ($bDynamicMode) {
         $sCode = "\n            <script>\n                if ('undefined' == typeof(window.Recaptcha)) {\n                    \$.getScript('{$this->_sProto}://www.google.com/recaptcha/api/js/recaptcha_ajax.js', function(data, textStatus, jqxhr) {\n                        {$sInit}\n                    });\n                } else {\n                    {$sInit}\n                }\n            </script>";
     } else {
         $sCode = "\n            <script>\n                \$(document).ready(function () {\n                    {$sInit}\n                });\n            </script>";
     }
     return $this->_addJsCss($bDynamicMode) . $GLOBALS['oSysTemplate']->parseHtmlByName('reCaptcha.html', array('id' => $sId)) . $sCode;
 }
 /**
  * Display captcha.
  */
 public function display()
 {
     $bDynamicMode = false;
     $sId = 'sys-captcha-' . time() . rand(0, PHP_INT_MAX);
     $sInit = "\n            Recaptcha.create('" . $this->_sKeyPublic . "', '" . $sId . "', {\n                lang: '" . bx_lang_name() . "',\n                theme: '" . $this->_sSkin . "'\n            });\n        ";
     if ($bDynamicMode) {
         $sCode = "\n            <script>\n                if ('undefined' == typeof(window.Recaptcha)) {\n                    \$.getScript('{$this->_sProto}://www.google.com/recaptcha/api/js/recaptcha_ajax.js', function(data, textStatus, jqxhr) {\n                        {$sInit}\n                    });\n                } else {\n                    {$sInit}\n                }\n            </script>";
     } else {
         $sCode = "\n            <script>\n                \$(document).ready(function () {\n                    {$sInit}\n                });\n            </script>";
     }
     return $this->_addJsCss($bDynamicMode) . '<div id="' . $sId . '"></div>' . $sCode;
 }
Example #3
0
 function uninstall($aParams)
 {
     $aResult = parent::uninstall($aParams);
     if ($aResult['result']) {
         $bInclude = @(include $this->sFilePath);
         if (!$bInclude || empty($LANG) || empty($LANG_INFO) || !$this->_removeLanguage($LANG, $LANG_INFO)) {
             return array('operation_title' => _t('_adm_txt_modules_operation_install', $this->_aConfig['title']), 'message' => 'Language file parse error: ' . $this->sFileName, 'result' => false);
         }
         // delete compiled lang file
         @unlink(BX_DIRECTORY_PATH_ROOT . "langs/lang-{$LANG_INFO['Name']}.php");
         $GLOBALS['MySQL']->cleanCache('checkLangExists_' . $LANG_INFO['Name']);
         if (bx_lang_name() == $LANG_INFO['Name']) {
             getCurrentLangName(true);
         }
     }
     return $aResult;
 }
Example #4
0
 /**
  * Get file name where the template would be cached.
  *
  * @param  string $sAbsolutePath template's real path.
  * @return string the result of operation.
  */
 function _getCacheFileName($sType, $sAbsolutePath)
 {
     $sResult = md5($sAbsolutePath . $GLOBALS['site']['ver'] . $GLOBALS['site']['build'] . $GLOBALS['site']['url']);
     switch ($sType) {
         case 'html':
             $sResult = $this->_sCacheFilePrefix . bx_lang_name() . '_' . $this->_sCode . '_' . $sResult;
             break;
         case 'css':
             $sResult = $this->_sCssCachePrefix . $sResult;
             break;
         case 'js':
             $sResult = $this->_sJsCachePrefix . $sResult;
             break;
     }
     return $sResult;
 }
Example #5
0
 /**
  * Get file name where the template would be cached.
  *
  * @param  string $sAbsolutePath template's real path.
  * @return string the result of operation.
  */
 function _getCacheFileName($sType, $sAbsolutePath)
 {
     $sResult = bx_site_hash($sAbsolutePath);
     switch ($sType) {
         case 'html':
             $sResult = $this->_sCacheFilePrefix . bx_lang_name() . '_' . $this->_sCode . '_' . $sResult;
             break;
         case 'css':
             $sResult = $this->_sCssCachePrefix . $sResult;
             break;
         case 'js':
             $sResult = $this->_sJsCachePrefix . $sResult;
             break;
     }
     return $sResult;
 }
Example #6
0
 /**
  * Block with entry's location map
  * @param $sPart module/part name
  * @param $iEntryId entry's id which location is shown on the map
  * @return html with entry's location map
  */
 function serviceLocationBlock($sPart, $iEntryId)
 {
     if (!isset($this->_aParts[$sPart])) {
         return '';
     }
     $sParamPrefix = 'bx_wmap_entry_' . $sPart;
     $iEntryId = (int) $iEntryId;
     $r = $this->_oDb->getDirectLocation($iEntryId, $this->_aParts[$sPart]);
     $sBoxContent = '';
     if ($r && !empty($r['lat'])) {
         $aVars = array('msg_incorrect_google_key' => _t('_bx_wmap_msg_incorrect_google_key'), 'loading' => _t('_loading ...'), 'map_control' => getParam($sParamPrefix . '_control_type'), 'map_is_type_control' => getParam($sParamPrefix . '_is_type_control') == 'on' ? 1 : 0, 'map_is_scale_control' => getParam($sParamPrefix . '_is_scale_control') == 'on' ? 1 : 0, 'map_is_overview_control' => getParam($sParamPrefix . '_is_overview_control') == 'on' ? 1 : 0, 'map_is_dragable' => getParam($sParamPrefix . '_is_map_dragable') == 'on' ? 1 : 0, 'map_lat' => $r['lat'], 'map_lng' => $r['lng'], 'map_zoom' => -1 != $r['zoom'] ? $r['zoom'] : (getParam($sParamPrefix . '_zoom') ? getParam($sParamPrefix . '_zoom') : BX_WMAP_ZOOM_DEFAULT_ENTRY), 'map_type' => $r['type'] ? $r['type'] : (getParam($sParamPrefix . '_map_type') ? getParam($sParamPrefix . '_map_type') : 'normal'), 'parts' => $sPart, 'custom' => '', 'suffix' => 'Location', 'subclass' => 'bx_wmap_location_box', 'data_url' => BX_DOL_URL_MODULES . "' + '?r=wmap/get_data_location/" . $iEntryId . "/" . $sPart . "/{instance}", 'save_data_url' => '', 'save_location_url' => '', 'shadow_url' => '', 'lang' => bx_lang_name());
         $this->_oTemplate->addJs($this->_sProto . '://www.google.com/jsapi?key=' . getParam('bx_wmap_key'));
         $this->_oTemplate->addJs('BxWmap.js');
         $this->_oTemplate->addCss('main.css');
         $aVars2 = array('map' => $this->_oTemplate->parseHtmlByName('map', $aVars));
         $sBoxContent = $this->_oTemplate->parseHtmlByName('entry_location', $aVars2);
     }
     $sBoxFooter = '';
     if ($r['author_id'] == $this->_iProfileId || $this->isAdmin()) {
         $aVars = array('icon' => $this->_oTemplate->getIconUrl('more.png'), 'url' => $this->_oConfig->getBaseUri() . "edit/{$iEntryId}/{$sPart}", 'title' => _t('_bx_wmap_box_footer_edit'));
         $sBoxFooter = $this->_oTemplate->parseHtmlByName('box_footer', $aVars);
         if (!$sBoxContent) {
             $sBoxContent = MsgBox(_t('_bx_wmap_msg_locations_is_not_defined'));
         }
     }
     if ($sBoxContent || $sBoxFooter) {
         return array($sBoxContent, array(), $sBoxFooter);
     }
     return '';
 }