function getSwitcherLanguage() { $sContent = ''; $iLangsCount = count(getLangsArr()); if ($iLangsCount <= 1) { return ''; } $sLangName = getCurrentLangName(); $aTmplVars = array(); $aTmplVars[] = array('caption' => _t('_sys_bm_language', $sLangName), 'link' => 'javascript:void(0)', 'script' => 'onclick="javascript:showPopupLanguage()"', 'target' => ''); $sContent .= $GLOBALS['oSysTemplate']->parseHtmlByName('extra_' . $this->sName . '_menu.html', array('bx_repeat:items' => $aTmplVars)); $sContent .= $GLOBALS['oFunctions']->getLanguageSwitcher($sLangName); return $sContent; }
public static function getTopMenu() { $sTmplVarsAddons = ''; $aTmplVarsItems = array(); $aItems = array(); if (count(getLangsArr()) > 1) { $aItems[] = array('caption' => '_adm_tmi_language', 'url' => 'javascript:void(0)', 'onclick' => 'showPopupLanguage()', 'target' => '', 'icon' => 'language'); $sLangName = getCurrentLangName(); $sTmplVarsAddons .= $GLOBALS['oFunctions']->getLanguageSwitcher($sLangName); } $aItems = array_merge($aItems, $GLOBALS['MySQL']->getAll("SELECT `caption`, `url`, `target`, `icon` FROM `sys_menu_admin_top` ORDER BY `Order`")); foreach ($aItems as $aItem) { $aTmplVarsItems[] = array('caption' => _t($aItem['caption']), 'url' => str_replace(array('{site_url}', '{admin_url}'), array($GLOBALS['site']['url'], $GLOBALS['site']['url_admin']), $aItem['url']), 'target' => !empty($aItem['target']) ? $aItem['target'] : '_self', 'bx_if:show_onclick' => array('condition' => isset($aItem['onclick']) && !empty($aItem['onclick']), 'content' => array('onclick' => isset($aItem['onclick']) ? $aItem['onclick'] : '')), 'icon' => false === strpos($aItem['icon'], '.') ? '<i class="sys-icon ' . $aItem['icon'] . '"></i>' : '<img src="' . $GLOBALS['oAdmTemplate']->getIconUrl($aItem['icon']) . '" alt="' . _t($aItem['caption']) . '" />'); } return $GLOBALS['oAdmTemplate']->parseHtmlByName('top_menu.html', array('bx_repeat:items' => $aTmplVarsItems, 'addons' => $sTmplVarsAddons)); }
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; }
function createProfile($aData, $bSendMails = true, $iMainMemberID = 0) { if (!$aData or !is_array($aData) or empty($aData)) { return false; } unset($aData['Couple']); unset($aData['Captcha']); unset($aData['TermsOfUse']); unset($aData['ProfilePhoto']); /* @var $this ->oPF BxDolProfileFields */ $this->oPF = new BxDolProfileFields(100); if (!$this->oPF->aArea) { echo 'Profile Fields cache not loaded. Cannot continue.'; return false; } $this->aItems = $this->oPF->aArea[0]['Items']; if ($iMainMemberID) { $aMainMember = $this->getProfileInfo($iMainMemberID); } else { $aMainMember = false; } // begin profile info collecting $aNewProfile = array(); foreach ($this->aItems as $aItem) { $sItemName = $aItem['Name']; if (array_key_exists($sItemName, $aData)) { $aNewProfile[$sItemName] = $aData[$sItemName]; } elseif ($aMainMember and array_key_exists($sItemName, $aMainMember) and $aItem['Type'] != 'system') { if ($aItem['Unique']) { $aNewProfile[$sItemName] = $this->genUniqueValue($sItemName, $aMainMember[$sItemName]); } else { $aNewProfile[$sItemName] = $aMainMember[$sItemName]; } } else { switch ($aItem['Type']) { case 'pass': $aNewProfile[$sItemName] = $this->genRandomPassword(); break; case 'num': $aNewProfile[$sItemName] = (int) $aItem['Default']; break; case 'bool': $aNewProfile[$sItemName] = (bool) $aItem['Default']; break; case 'system': switch ($sItemName) { case 'ID': //set automatically //set automatically case 'Captcha': //not been inserted //not been inserted case 'Location': //not been inserted //not been inserted case 'Keyword': //not been inserted //not been inserted case 'TermsOfUse': //not been inserted //pass break; case 'DateReg': $aNewProfile[$sItemName] = date('Y-m-d H:i:s'); // set current date break; case 'DateLastEdit': case 'DateLastLogin': $aNewProfile[$sItemName] = '0000-00-00'; break; case 'Couple': $aNewProfile[$sItemName] = $aMainMember ? $iMainMemberID : 0; //if main member exists, set him as a couple link break; case 'Featured': $aNewProfile[$sItemName] = false; break; case 'Status': if (getParam('autoApproval_ifNoConfEmail') == 'on') { if (getParam('autoApproval_ifJoin') == 'on' && !(getParam('sys_dnsbl_enable') && 'approval' == getParam('sys_dnsbl_behaviour') && bx_is_ip_dns_blacklisted('', 'join'))) { $aNewProfile[$sItemName] = 'Active'; } else { $aNewProfile[$sItemName] = 'Approval'; } } else { $aNewProfile[$sItemName] = 'Unconfirmed'; } break; } break; default: $aNewProfile[$sItemName] = $aItem['Default']; } } } //we completed collecting // set default language $aNewProfile['LangID'] = getLangIdByName(getCurrentLangName()); // set default privacy bx_import('BxDolPrivacyQuery'); $oPrivacy = new BxDolPrivacyQuery(); $aNewProfile['allow_view_to'] = $oPrivacy->getDefaultValueModule('profile', 'view_block'); $sSet = $this->collectSetString($aNewProfile); $sQuery = "INSERT INTO `Profiles` SET \n{$sSet}"; $rRes = db_res($sQuery); if ($rRes) { $iNewID = db_last_id(); $this->createProfileCache($iNewID); if ($aMainMember) { $this->updateProfile($iMainMemberID, array('Couple' => $iNewID)); } //set main member's couple. they will be linked each other //collect status text if ($bSendMails and !$aMainMember) { //send mail only to main member, not to couple $sStatusText = $aNewProfile['Status']; if (getParam('autoApproval_ifNoConfEmail') == 'on') { if ('Active' == $sStatusText) { $this->sendActivationMail($iNewID); } else { $this->sendApprovalMail($iNewID); } } else { if (!$this->sendConfMail($iNewID)) { $sStatusText = 'NotSent'; } } } else { $sStatusText = 'OK'; } //set crypted password $sSalt = genRndSalt(); $this->updateProfile($iNewID, array('Password' => encryptUserPwd($aNewProfile['Password'], $sSalt), 'Salt' => $sSalt)); bx_member_ip_store($iNewID); return array($iNewID, $sStatusText); } else { return array(false, 'Failed'); } }
function setLanguage($sLang) { if ('English' == $sLang || !preg_match('/^[a-zA-Z]+$/', $sLang)) { $sLang = 'en'; } $_GET['lang'] = $sLang; $sCurrentLanguage = getCurrentLangName(); global $LANG; require_once BX_DIRECTORY_PATH_ROOT . "langs/lang-{$sCurrentLanguage}.php"; }
/** * get extra files list for given module * * @param $sModule - module name * @param $sFolder - folder name where to look for files * @param $bGetUserFile - get current user file (true) or default file (false) * @param $bGetDate - get dates of files * @return $aResult - files array without extension and/or current file */ function getExtraFiles($sModule, $sFolder = "langs", $bGetUserFile = true, $bGetDate = false) { global $sModulesPath; $sFilesPath = $sModulesPath . $sModule . "/" . $sFolder . "/"; $aFiles = array(); $aDates = array(); $sExtension = getFileExtension($sModule, $sFolder); if ($bGetDate) { clearstatcache(); } if ($sFolder == "langs") { $sSysLang = getCurrentLangName(false); } else { $aResult = getSettingValue($sModule, FILE_DEFAULT_KEY, $sFolder, true); if ($aResult['status'] == FAILED_VAL || empty($aResult['value'])) { $sDefaultFile = $sFolder == "langs" ? "english" : "default"; } else { $sDefaultFile = $aResult['value']; } } if ($rDirHandle = opendir($sFilesPath)) { while (false !== ($sFile = readdir($rDirHandle))) { if (is_file($sFilesPath . $sFile) && $sFile != "." && $sFile != ".." && $sExtension == substr($sFile, strpos($sFile, ".") + 1)) { $aFiles[] = substr($sFile, 0, strpos($sFile, ".")); if ($bGetDate) { $aDates[] = filectime($sFilesPath . $sFile); } if ($sFolder == "langs" && $sSysLang == substr($sFile, 0, 2)) { $sDefaultFile = substr($sFile, 0, strpos($sFile, ".")); } } } } closedir($rDirHandle); $sCurrentFile = in_array($sDefaultFile, $aFiles) ? $sDefaultFile : $aFiles[0]; if ($bGetUserFile) { $sCookieValue = $_COOKIE["ray_" . $sFolder . "_" . $sModule]; $sCurrentFile = isset($sCookieValue) && in_array($sCookieValue, $aFiles) ? $sCookieValue : $sCurrentFile; } return array('files' => $aFiles, 'dates' => $aDates, 'current' => $sCurrentFile, 'extension' => $sExtension); }
/** * Generate name for cache * * @param $iProfileId integer * @return string */ function getCacheKey($iProfileId) { global $site; return $this->sMenuMemberKeysCache . $iProfileId . '_' . md5($site['ver'] . $site['build'] . $site['url'] . getCurrentLangName(false) . $GLOBALS['oSysTemplate']->getCode()) . '.php'; }
function genBlocksCacheKey($sId) { global $site; return 'pb_' . $sId . '_' . md5($site['ver'] . $site['build'] . $site['url'] . getCurrentLangName(false) . $GLOBALS['oSysTemplate']->getCode()) . '.php'; }
/** * 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 . getCurrentLangName() . '_' . $this->_sCode . '_' . $sResult; break; case 'css': $sResult = $this->_sCssCachePrefix . $sResult; break; case 'js': $sResult = $this->_sJsCachePrefix . $sResult; break; } return $sResult; }
define('BX_DOL_LANGUAGE_DEFAULT', 'en'); define('BX_DOL_LANGUAGE_CATEGORY_SYSTEM', 1); if (!defined('BX_SKIP_INSTALL_CHECK')) { $sCurrentLanguage = getCurrentLangName(false); if (!$sCurrentLanguage) { echo '<br /><b>Fatal error:</b> Cannot apply localization.'; exit; } require_once BX_DIRECTORY_PATH_ROOT . "langs/lang-{$sCurrentLanguage}.php"; } require_once BX_DIRECTORY_PATH_INC . 'db.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'params.inc.php'; if (!defined('BX_SKIP_INSTALL_CHECK')) { getCurrentLangName(true); if (isset($_GET['lang'])) { bx_import('BxDolPermalinks'); $oPermalinks = new BxDolPermalinks(); if ($oPermalinks->redirectIfNecessary(array('lang'))) { exit; } } } function getCurrentLangName($isSetCookie = true) { $sLang = ''; if (!$sLang && !empty($_GET['lang'])) { $sLang = tryToGetLang($_GET['lang'], $isSetCookie); } if (!$sLang && !empty($_POST['lang'])) {
* This file is part of Dolphin - Smart Community Builder * * Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License. * http://creativecommons.org/licenses/by/3.0/ * * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the Creative Commons Attribution 3.0 License for more details. * You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin, * see license.txt file; if not, write to marketing@boonex.com ***************************************************************************/ require_once 'header.inc.php'; require_once 'db.inc.php'; require_once 'utils.inc.php'; define('LANGUAGE_CATEGORY_ID_PROFILE_FIELDS', 24); $sCurrentLanguage = getCurrentLangName(); if (!$sCurrentLanguage) { echo '<br /><b>Fatal error:</b> Cannot apply localization.'; exit; } require_once "{$dir['root']}langs/lang-{$sCurrentLanguage}.php"; function getCurrentLangName() { $sLang = ''; if (!$sLang) { $sLang = tryToGetLang($_GET['lang'], true); } if (!$sLang) { $sLang = tryToGetLang($_POST['lang'], true); } if (!$sLang) {