本文整理汇总了PHP中BxDolDb::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP BxDolDb::getInstance方法的具体用法?PHP BxDolDb::getInstance怎么用?PHP BxDolDb::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BxDolDb
的用法示例。
在下文中一共展示了BxDolDb::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: serviceLoginForm
public function serviceLoginForm($sParams = '', $sForceRelocate = '')
{
if (isLogged()) {
return false;
}
// get all auth types
$aAuthTypes = BxDolDb::getInstance()->fromCache('sys_objects_auths', 'getAll', 'SELECT * FROM `sys_objects_auths`');
// define additional auth types
if ($aAuthTypes) {
$aAddInputEl[''] = _t('_Basic');
// procces all additional menu's items
foreach ($aAuthTypes as $iKey => $aItems) {
$aAddInputEl[$aItems['Link']] = _t($aItems['Title']);
}
$aAuthTypes = array('type' => 'select', 'caption' => _t('_Auth type'), 'values' => $aAddInputEl, 'value' => '', 'attrs' => array('onchange' => 'if (this.value) { location.href = "' . BX_DOL_URL_ROOT . '" + this.value }'));
} else {
$aAuthTypes = array('type' => 'hidden');
}
$oForm = BxDolForm::getObjectInstance('sys_login', 'sys_login');
$sCustomHtmlBefore = '';
$sCustomHtmlAfter = '';
bx_alert('profile', 'show_login_form', 0, 0, array('oForm' => $oForm, 'sParams' => &$sParams, 'sCustomHtmlBefore' => &$sCustomHtmlBefore, 'sCustomHtmlAfter' => &$sCustomHtmlAfter, 'aAuthTypes' => &$aAuthTypes));
if ($sForceRelocate && 0 === mb_stripos($sForceRelocate, BX_DOL_URL_ROOT)) {
$oForm->aInputs['relocate']['value'] = $sForceRelocate;
} elseif ('homepage' == $sForceRelocate) {
$oForm->aInputs['relocate']['value'] = BX_DOL_URL_ROOT;
}
$sFormCode = $oForm->getCode();
$sJoinText = '';
if (strpos($sParams, 'no_join_text') === false) {
$sJoinText = '<hr class="bx-def-hr bx-def-margin-sec-topbottom" /><div>' . _t('_sys_txt_login_description', BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=create-account')) . '</div>';
}
BxDolTemplate::getInstance()->addJs(array('jquery.form.min.js'));
return $sCustomHtmlBefore . $sFormCode . $sCustomHtmlAfter . $sJoinText;
}
示例2: _action
protected function _action($sCache, $sMode = 'clear')
{
$sFuncCacheObject = $sMode == 'clear' ? '_clearObject' : '_getSizeObject';
$sFuncCacheFile = $sMode == 'clear' ? '_clearFile' : '_getSizeFile';
$mixedResult = false;
switch ($sCache) {
case 'db':
if (getParam('sys_db_cache_enable') != 'on') {
break;
}
$oCacheDb = BxDolDb::getInstance()->getDbCacheObject();
$mixedResult = $this->{$sFuncCacheObject}($oCacheDb, 'db_');
break;
case 'template':
if (getParam('sys_template_cache_enable') != 'on') {
break;
}
$oCacheTemplates = BxDolTemplate::getInstance()->getTemplatesCacheObject();
$mixedResult = $this->{$sFuncCacheObject}($oCacheTemplates, BxDolStudioTemplate::getInstance()->getCacheFilePrefix($sCache));
break;
case 'css':
if (getParam('sys_template_cache_css_enable') != 'on') {
break;
}
$mixedResult = $this->{$sFuncCacheFile}(BxDolStudioTemplate::getInstance()->getCacheFilePrefix($sCache), BX_DIRECTORY_PATH_CACHE_PUBLIC);
break;
case 'js':
if (getParam('sys_template_cache_js_enable') != 'on') {
break;
}
$mixedResult = $this->{$sFuncCacheFile}(BxDolStudioTemplate::getInstance()->getCacheFilePrefix($sCache), BX_DIRECTORY_PATH_CACHE_PUBLIC);
break;
}
return $mixedResult;
}
示例3: getGridObject
public static function getGridObject($sObject)
{
$oDb = BxDolDb::getInstance();
$sQuery = $oDb->prepare("SELECT * FROM `sys_objects_grid` WHERE `object` = ?", $sObject);
$aObject = $oDb->getRow($sQuery);
if (!$aObject || !is_array($aObject)) {
return false;
}
// paginate
if (!empty($aObject['paginate_url']) && 0 != strncasecmp($aObject['paginate_url'], 'http://', 7) && 0 != strncasecmp($aObject['paginate_url'], 'https://', 8)) {
$aObject['paginate_url'] = BX_DOL_URL_ROOT . $aObject['paginate_url'];
}
// filter
if ($aObject['filter_fields']) {
$aObject['filter_fields'] = array_map('trim', explode(',', $aObject['filter_fields']));
}
if ($aObject['filter_fields_translatable']) {
$aObject['filter_fields_translatable'] = array_map('trim', explode(',', $aObject['filter_fields_translatable']));
}
// sorting
if ($aObject['sorting_fields']) {
$aObject['sorting_fields'] = array_map('trim', explode(',', $aObject['sorting_fields']));
}
if ($aObject['sorting_fields_translatable']) {
$aObject['sorting_fields_translatable'] = array_map('trim', explode(',', $aObject['sorting_fields_translatable']));
$aObject['sorting_fields'] = array_merge($aObject['sorting_fields'], $aObject['sorting_fields_translatable']);
}
// get fields
$sQuery = $oDb->prepare("SELECT * FROM `sys_grid_fields` WHERE `object` = ? ORDER BY `order`", $sObject);
$aFields = $oDb->getAllWithKey($sQuery, 'name');
if (!$aFields || !is_array($aFields)) {
// it is impossible to have grid without any fields
return false;
}
foreach ($aFields as $sKey => $aRow) {
$aObject['fields'][$sKey] = array('title' => _t($aRow['title']), 'width' => $aRow['width'], 'translatable' => $aRow['translatable'], 'chars_limit' => $aRow['chars_limit']);
if (empty($aRow['params'])) {
continue;
}
$aAdd = unserialize($aRow['params']);
if (!empty($aAdd) && is_array($aAdd)) {
$aObject['fields'][$sKey] = array_merge($aObject['fields'][$sKey], $aAdd);
}
}
// get actions
$a = array('bulk', 'single', 'independent');
foreach ($a as $sActionType) {
$sActionField = 'actions_' . $sActionType;
$aObject[$sActionField] = array();
$sQuery = $oDb->prepare("SELECT * FROM `sys_grid_actions` WHERE `object` = ? AND `type` = ? ORDER BY `order`", $sObject, $sActionType);
$aActions = $oDb->getAllWithKey($sQuery, 'name');
if (!$aActions || !is_array($aActions)) {
continue;
}
foreach ($aActions as $sKey => $aRow) {
$aObject[$sActionField][$sKey] = $aRow['title'] || $aRow['icon'] ? array('title' => _t($aRow['title']), 'icon' => $aRow['icon'], 'confirm' => $aRow['confirm'], 'icon_only' => $aRow['icon_only']) : array();
}
}
return $aObject;
}
示例4: __construct
function __construct()
{
parent::__construct();
if (class_exists('BxDolDb') && BxDolDb::getInstance()) {
$this->_aConfig['aLessConfig']['bx-page-width'] = getParam('main_div_width');
}
}
示例5: __construct
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->aZonesUrls = array(2 => BX_DIRECTORY_PATH_MODULES . "boonex/antispam/data/two-level-tlds", 3 => BX_DIRECTORY_PATH_MODULES . "boonex/antispam/data/three-level-tlds");
$this->oDb = BxDolDb::getInstance();
$this->initZones();
}
示例6: serviceLoginForm
public function serviceLoginForm($sParams = '', $sForceRelocate = '')
{
if (isLogged()) {
return false;
}
// get all auth types
$aAuthTypes = BxDolDb::getInstance()->fromCache('sys_objects_auths', 'getAll', 'SELECT * FROM `sys_objects_auths`');
$oForm = BxDolForm::getObjectInstance('sys_login', 'sys_login');
$sCustomHtmlBefore = '';
$sCustomHtmlAfter = '';
bx_alert('profile', 'show_login_form', 0, 0, array('oForm' => $oForm, 'sParams' => &$sParams, 'sCustomHtmlBefore' => &$sCustomHtmlBefore, 'sCustomHtmlAfter' => &$sCustomHtmlAfter, 'aAuthTypes' => &$aAuthTypes));
if ($sForceRelocate && 0 === mb_stripos($sForceRelocate, BX_DOL_URL_ROOT)) {
$oForm->aInputs['relocate']['value'] = $sForceRelocate;
} elseif ('homepage' == $sForceRelocate) {
$oForm->aInputs['relocate']['value'] = BX_DOL_URL_ROOT;
}
$sFormCode = $oForm->getCode();
$sJoinText = '';
if (strpos($sParams, 'no_join_text') === false) {
$sJoinText = '<hr class="bx-def-hr bx-def-margin-sec-topbottom" /><div class="bx-def-font-align-center">' . _t('_sys_txt_login_description', BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=create-account')) . '</div>';
}
BxDolTemplate::getInstance()->addJs(array('jquery.form.min.js'));
$sAuth = $this->serviceMemberAuthCode($aAuthTypes);
return $sCustomHtmlBefore . $sAuth . $sFormCode . $sCustomHtmlAfter . $sJoinText;
}
示例7: initVideoFile
function initVideoFile($sId, $sTitle, $sCategory, $sTags, $sDesc)
{
global $sModule;
$oDb = BxDolDb::getInstance();
$sDBModule = DB_PREFIX . ucfirst($sModule);
getResult("UPDATE `" . $sDBModule . "Files` SET `Categories`='" . $sCategory . "', `Title`='" . $sTitle . "', `Tags`='" . $sTags . "', `Description`='" . $sDesc . "' WHERE `ID`='" . $sId . "'");
return $oDb->getAffectedRows() > 0 ? true : false;
}
示例8: getPrivacyObject
public static function getPrivacyObject($sObject)
{
$oDb = BxDolDb::getInstance();
$sQuery = $oDb->prepare("SELECT * FROM `sys_objects_privacy` WHERE `object` = ?", $sObject);
$aObject = $oDb->getRow($sQuery);
if (!$aObject || !is_array($aObject)) {
return false;
}
return $aObject;
}
示例9: initFile
function initFile($sId, $sTitle, $sCategory, $sTags, $sDesc)
{
global $sModule;
$oDb = BxDolDb::getInstance();
$sUri = mp3_genUri($sTitle);
$sUriPart = empty($sUri) ? "" : "`Uri`='" . $sUri . "', ";
$sDBModule = DB_PREFIX . ucfirst($sModule);
getResult("UPDATE `" . $sDBModule . "Files` SET `Categories`= ?, `Title`= ?, " . $sUriPart . "`Tags`= ?, `Description`= ? WHERE `ID`= ?", [$sCategory, $sTitle, $sTags, $sDesc, $sId]);
return $oDb->getAffectedRows() > 0 ? true : false;
}
示例10: __construct
function __construct()
{
$this->oDb = BxDolDb::getInstance();
$this->iViewer = getLoggedId();
$this->sCacheFile = 'sys_objects_tag';
$this->sNonParseParams = 'tags_non_parsable';
$this->sCacheTable = 'sys_objects_tag';
$this->sTagTable = 'sys_tags';
$this->aTagFields = array('id' => 'ObjID', 'type' => 'Type', 'tag' => 'Tag', 'date' => 'Date');
$this->aObjFields = array('id' => 'ID', 'name' => 'ObjectName', 'query' => 'Query', 'perm_param' => 'PermalinkParam', 'perm_enable' => 'EnabledPermalink', 'perm_disable' => 'DisabledPermalink', 'lang_key' => 'LangKey');
}
示例11: __construct
function __construct(&$aModule)
{
parent::__construct($aModule);
$aConfig = array('client_table' => 'bx_oauth_clients', 'access_token_table' => 'bx_oauth_access_tokens', 'refresh_token_table' => 'bx_oauth_refresh_tokens', 'code_table' => 'bx_oauth_authorization_codes', 'user_table' => 'Profiles', 'jwt_table' => '', 'jti_table' => '', 'scope_table' => 'bx_oauth_scopes', 'public_key_table' => '');
$this->_oStorage = new OAuth2\Storage\Pdo(BxDolDb::getInstance()->getLink(), $aConfig);
$this->_oServer = new OAuth2\Server($this->_oStorage, array('require_exact_redirect_uri' => false));
// Add the "Client Credentials" grant type (it is the simplest of the grant types)
$this->_oServer->addGrantType(new OAuth2\GrantType\ClientCredentials($this->_oStorage));
// Add the "Authorization Code" grant type (this is where the oauth magic happens)
$this->_oServer->addGrantType(new OAuth2\GrantType\AuthorizationCode($this->_oStorage));
}
示例12: setPageWidth
protected function setPageWidth($sParamName)
{
if (!class_exists('BxDolDb') || !BxDolDb::getInstance() || empty($sParamName)) {
return;
}
$mixedWidth = getParam($sParamName);
if (is_numeric($mixedWidth)) {
$mixedWidth .= 'px';
}
$this->_aConfig['aLessConfig']['bx-page-width'] = $mixedWidth;
}
示例13: __construct
function __construct()
{
$this->oDb = BxDolDb::getInstance();
$oCache = $this->oDb->getDbCacheObject();
$this->aLinks = $oCache->getData($this->oDb->genDbCacheKey('sys_permalinks'));
if (null === $this->aLinks) {
if (!$this->cache()) {
$this->aLinks = array();
}
}
}
示例14: getMemberInfoKeysByType
public static function getMemberInfoKeysByType($sType)
{
$oDb = BxDolDb::getInstance();
$sQuery = "SELECT * FROM `sys_objects_member_info` WHERE `type` = ? ORDER BY `title` ASC";
$aObjects = $oDb->getPairs($sQuery, 'object', 'title', [$sType]);
if (!$aObjects || !is_array($aObjects)) {
return false;
}
foreach ($aObjects as $k => $v) {
$aObjects[$k] = _t($v);
}
return $aObjects;
}
示例15: getSystems
public function getSystems()
{
if (!isset($GLOBALS['bx_dol_live_updates_systems'])) {
$GLOBALS['bx_dol_live_updates_systems'] = BxDolDb::getInstance()->fromCache('sys_objects_live_updates', 'getAllWithKey', '
SELECT
`id` as `id`,
`name` AS `name`,
`frequency` AS `frequency`,
`service_call` AS `service_call`,
`active` AS `active`
FROM `sys_objects_live_updates`', 'name');
}
return $GLOBALS['bx_dol_live_updates_systems'];
}