本文整理汇总了PHP中BxDolDb类的典型用法代码示例。如果您正苦于以下问题:PHP BxDolDb类的具体用法?PHP BxDolDb怎么用?PHP BxDolDb使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BxDolDb类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: __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();
}
示例4: 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;
}
示例5: BxDolCmtsQuery
function BxDolCmtsQuery(&$aSystem)
{
$this->_aSystem =& $aSystem;
$this->_sTable = $this->_aSystem['table_cmts'];
$this->_sTableTrack = $this->_aSystem['table_track'];
parent::BxDolDb();
}
示例6: BxDolModuleDb
function BxDolModuleDb($oConfig = null)
{
parent::BxDolDb();
if (is_a($oConfig, 'BxDolConfig')) {
$this->_sPrefix = $oConfig->getDbPrefix();
}
}
示例7: _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;
}
示例8: __construct
function __construct()
{
parent::__construct();
if (class_exists('BxDolDb') && BxDolDb::getInstance()) {
$this->_aConfig['aLessConfig']['bx-page-width'] = getParam('main_div_width');
}
}
示例9: 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;
}
示例10: 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;
}
示例11: getInstance
/**
* Get singleton instance of the class
*/
public static function getInstance($aDbConf = false, &$sError = null)
{
if (!isset($GLOBALS['bxDolClasses'][__CLASS__])) {
if (false === $aDbConf && !defined('BX_DATABASE_HOST')) {
return null;
}
$o = new BxDolDb($aDbConf);
$sErrorMessage = $o->connect();
if ($sErrorMessage) {
if ($sError !== null) {
$sError = $sErrorMessage;
}
return null;
} else {
$GLOBALS['bxDolClasses'][__CLASS__] = $o;
}
}
return $GLOBALS['bxDolClasses'][__CLASS__];
}
示例12: 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;
}
示例13: BxDolPermalinks
function BxDolPermalinks()
{
parent::BxDolDb();
$oCache = $GLOBALS['MySQL']->getDbCacheObject();
$this->aLinks = $oCache->getData($GLOBALS['MySQL']->genDbCacheKey('sys_permalinks'));
if (null === $this->aLinks) {
if (!$this->cache()) {
$this->aLinks = array();
}
}
}
示例14: __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();
}
}
}
示例15: cache
function cache()
{
$this->_aParams = $this->_oDb->getPairs("SELECT `Name`, `VALUE` FROM `sys_options`", "Name", "VALUE");
if (empty($this->_aParams)) {
$this->_aParams = array();
return false;
}
return $this->_oCache->setData($this->_sCacheFile, $this->_aParams);
}