本文整理汇总了PHP中CApi::GetSettingsConf方法的典型用法代码示例。如果您正苦于以下问题:PHP CApi::GetSettingsConf方法的具体用法?PHP CApi::GetSettingsConf怎么用?PHP CApi::GetSettingsConf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CApi
的用法示例。
在下文中一共展示了CApi::GetSettingsConf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckPrincipals
public static function CheckPrincipals($sUserName)
{
if (trim($sUserName) !== '') {
$oPdo = \CApi::GetPDO();
$dbPrefix = \CApi::GetSettingsConf('Common/DBPrefix');
$sPrincipal = \afterlogic\DAV\Constants::PRINCIPALS_PREFIX . '/' . $sUserName;
$oStmt = $oPdo->prepare('SELECT id FROM ' . $dbPrefix . Constants::T_PRINCIPALS . ' WHERE uri = ? LIMIT 1');
$oStmt->execute(array($sPrincipal));
if (count($oStmt->fetchAll()) === 0) {
$oStmt = $oPdo->prepare('INSERT INTO ' . $dbPrefix . Constants::T_PRINCIPALS . '
(uri,email,displayname) VALUES (?, ?, ?)');
try {
$oStmt->execute(array($sPrincipal, $sUserName, ''));
} catch (Exception $e) {
}
}
$oStmt = $oPdo->prepare('SELECT principaluri FROM ' . $dbPrefix . Constants::T_CALENDARS . '
WHERE principaluri = ?');
$oStmt->execute(array($sPrincipal));
if (count($oStmt->fetchAll()) === 0) {
$oStmt = $oPdo->prepare('INSERT INTO ' . $dbPrefix . Constants::T_CALENDARS . '
(principaluri, displayname, uri, description, components, ctag, calendarcolor)
VALUES (?, ?, ?, ?, ?, 1, ?)');
$oAccount = self::GetAccountByLogin($sUserName);
$oStmt->execute(array($sPrincipal, \CApi::ClientI18N('CALENDAR/CALENDAR_DEFAULT_NAME', $oAccount), \Sabre\DAV\UUIDUtil::getUUID(), '', 'VEVENT,VTODO', Constants::CALENDAR_DEFAULT_COLOR));
}
$oStmt = $oPdo->prepare('SELECT principaluri FROM ' . $dbPrefix . Constants::T_CALENDARS . '
WHERE principaluri = ? and uri = ? LIMIT 1');
$oStmt->execute(array($sPrincipal, Constants::CALENDAR_DEFAULT_NAME));
if (count($oStmt->fetchAll()) !== 0) {
$oStmt = $oPdo->prepare('UPDATE ' . $dbPrefix . Constants::T_CALENDARS . '
SET uri = ? WHERE principaluri = ? and uri = ?');
$oStmt->execute(array(\Sabre\DAV\UUIDUtil::getUUID(), $sPrincipal, Constants::CALENDAR_DEFAULT_NAME));
}
$oStmt = $oPdo->prepare('SELECT principaluri FROM ' . $dbPrefix . Constants::T_ADDRESSBOOKS . '
WHERE principaluri = ? and uri = ? LIMIT 1');
$oStmt->execute(array($sPrincipal, Constants::ADDRESSBOOK_DEFAULT_NAME));
$bHasDefaultAddressbooks = count($oStmt->fetchAll()) != 0;
$oStmt->execute(array($sPrincipal, Constants::ADDRESSBOOK_DEFAULT_NAME_OLD));
$bHasOldDefaultAddressbooks = count($oStmt->fetchAll()) != 0;
$oStmt->execute(array($sPrincipal, Constants::ADDRESSBOOK_COLLECTED_NAME));
$bHasCollectedAddressbooks = count($oStmt->fetchAll()) != 0;
$stmt1 = $oPdo->prepare('INSERT INTO ' . $dbPrefix . Constants::T_ADDRESSBOOKS . '
(principaluri, displayname, uri, description, ctag)
VALUES (?, ?, ?, ?, 1)');
if (!$bHasDefaultAddressbooks) {
if ($bHasOldDefaultAddressbooks) {
$oStmt = $oPdo->prepare('UPDATE ' . $dbPrefix . Constants::T_ADDRESSBOOKS . '
SET uri = ? WHERE principaluri = ? and uri = ?');
$oStmt->execute(array(Constants::ADDRESSBOOK_DEFAULT_NAME, $sPrincipal, Constants::ADDRESSBOOK_DEFAULT_NAME_OLD));
} else {
$stmt1->execute(array($sPrincipal, Constants::ADDRESSBOOK_DEFAULT_DISPLAY_NAME, Constants::ADDRESSBOOK_DEFAULT_NAME, Constants::ADDRESSBOOK_DEFAULT_DISPLAY_NAME));
}
}
if (!$bHasCollectedAddressbooks) {
$stmt1->execute(array($sPrincipal, Constants::ADDRESSBOOK_COLLECTED_DISPLAY_NAME, Constants::ADDRESSBOOK_COLLECTED_NAME, Constants::ADDRESSBOOK_COLLECTED_DISPLAY_NAME));
}
}
}
示例2: isMobileSyncSupported
/**
* @param CAccount $oAccount = null
* @return bool
*/
public function isMobileSyncSupported($oAccount = null)
{
$bResult = $this->isNotLite() && $this->isDavSupported() && ($this->isContactsSupported() || $this->isGlobalContactsSupported() || $this->isCalendarSupported() || $this->isHelpdeskSupported());
if ($bResult) {
$bResult = \CApi::GetSettingsConf('Common/EnableMobileSync');
}
if ($bResult && $oAccount) {
$bResult = $oAccount->User->getCapa(ECapa::MOBILE_SYNC) && ($this->isContactsSupported($oAccount) || $this->isGlobalContactsSupported($oAccount) || $this->isCalendarSupported($oAccount) || $this->isHelpdeskSupported($oAccount));
}
return $bResult;
}