本文整理汇总了PHP中CApi::GetSystemManager方法的典型用法代码示例。如果您正苦于以下问题:PHP CApi::GetSystemManager方法的具体用法?PHP CApi::GetSystemManager怎么用?PHP CApi::GetSystemManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CApi
的用法示例。
在下文中一共展示了CApi::GetSystemManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTenantsMan
public function getTenantsMan()
{
if ($this->oApiTenants === null) {
$this->oApiTenants = \CApi::GetSystemManager('tenants');
}
return $this->oApiTenants;
}
示例2: getUsersManager
public function getUsersManager()
{
if (!isset($this->oApiUsersManager)) {
$this->oApiUsersManager = \CApi::GetSystemManager('users');
}
return $this->oApiUsersManager;
}
示例3: getDigestHash
public function getDigestHash($sRealm, $sUserName)
{
if (class_exists('CApi') && \CApi::IsValid()) {
/* @var $oApiCapabilityManager \CApiCapabilityManager */
$oApiCapabilityManager = \CApi::GetSystemManager('capability');
if ($oApiCapabilityManager) {
$oAccount = \Afterlogic\DAV\Utils::GetAccountByLogin($sUserName);
if ($oAccount && $oAccount->IsDisabled) {
return null;
}
$bIsOutlookSyncClient = \Afterlogic\DAV\Utils::ValidateClient('outlooksync');
$bIsMobileSync = false;
$bIsOutlookSync = false;
$bIsDemo = false;
if ($oAccount) {
$bIsMobileSync = $oApiCapabilityManager->isMobileSyncSupported($oAccount);
$bIsOutlookSync = $oApiCapabilityManager->isOutlookSyncSupported($oAccount);
\CApi::Plugin()->RunHook('plugin-is-demo-account', array(&$oAccount, &$bIsDemo));
}
if ($oAccount && ($bIsMobileSync && !$bIsOutlookSyncClient || $bIsOutlookSync && $bIsOutlookSyncClient) || $bIsDemo || $sUserName === \CApi::ExecuteMethod('Dav::GetPublicUser')) {
return md5($sUserName . ':' . $sRealm . ':' . ($bIsDemo ? 'demo' : $oAccount->IncomingMailPassword));
}
}
}
return null;
}
示例4: GetCurrentNumberOfUsers
/**
* @return int
*/
public function GetCurrentNumberOfUsers()
{
static $iCache = null;
if (null === $iCache) {
/* @var $oApiUsersManager CApiUsersManager */
$oApiUsersManager = CApi::GetSystemManager('users');
$iCache = $oApiUsersManager->getTotalUsersCount();
}
return $iCache;
}
示例5: getTenantUser
public static function getTenantUser($oAccount)
{
$sEmail = 'default_' . Constants::DAV_TENANT_PRINCIPAL;
if ($oAccount->IdTenant > 0) {
$oApiTenantsMan = \CApi::GetSystemManager('tenants');
$oTenant = $oApiTenantsMan ? $oApiTenantsMan->getTenantById($oAccount->IdTenant) : null;
if ($oTenant) {
$sEmail = $oTenant->Login . '_' . Constants::DAV_TENANT_PRINCIPAL;
}
}
return $sEmail;
}
示例6: getChildForPrincipal
public function getChildForPrincipal(array $aPrincipal)
{
/* @var \CApiCapabilityManager */
$oApiCapabilityManager = \CApi::GetSystemManager('capability');
// $oAccount = $this->getAccount($aPrincipal['uri']);
$bEmpty = false;
/*!($oAccount instanceof \CAccount &&
$oApiCapabilityManager->isPersonalContactsSupported($oAccount));*/
$oAddressBookHome = new AddressBookHome($this->carddavBackend, $aPrincipal['uri']);
$oAddressBookHome->setEmpty($bEmpty);
return $oAddressBookHome;
}
示例7: Login
public static function Login($sUserName, $sPassword)
{
$mResult = false;
$aArguments = array('Login' => $sUserName, 'Password' => $sPassword, 'SignMe' => false);
\CApi::GetModuleManager()->broadcastEvent('Dav', 'Login', $aArguments, $mResult);
if (isset($mResult['id'])) {
$oManagerApi = \CApi::GetSystemManager('eav', 'db');
$oEntity = $oManagerApi->getEntityById((int) $mResult['id']);
$mResult = $oEntity->sUUID;
} else {
$mResult = false;
}
return $mResult;
}
示例8: validateUserPass
/**
* Validates a username and password
*
* This method should return true or false depending on if login
* succeeded.
*
* @return bool
*/
protected function validateUserPass($sUserName, $sPassword)
{
$mResult = false;
if (class_exists('CApi') && \CApi::IsValid()) {
/* @var $oApiCapabilityManager \CApiCapabilityManager */
$oApiCapabilityManager = \CApi::GetSystemManager('capability');
if ($oApiCapabilityManager) {
$oDavDecorator = \CApi::GetModuleDecorator('Dav');
if ($oDavDecorator) {
$mResult = $oDavDecorator->Login($sUserName, $sPassword);
}
$bIsOutlookSyncClient = \Afterlogic\DAV\Utils::ValidateClient('outlooksync');
$bIsMobileSync = false;
$bIsOutlookSync = false;
$bIsDemo = false;
// if ($mResult !== false) {
// $iIdUser = isset($mResult['id']) ? $mResult['id'] : 0;
// return true;
/*
$bIsMobileSync = $oApiCapabilityManager->isMobileSyncSupported($iIdUser);
$bIsOutlookSync = $oApiCapabilityManager->isOutlookSyncSupported($iIdUser);
\CApi::Plugin()->RunHook(
'plugin-is-demo-account',
array(&$oAccount, &$bIsDemo)
);
*
*/
// }
/*
if (($oAccount && $oAccount->IncomingMailPassword === $sPassword &&
(($bIsMobileSync && !$bIsOutlookSyncClient) ||
($bIsOutlookSync && $bIsOutlookSyncClient))) ||
$bIsDemo || $sUserName === \CApi::ExecuteMethod('Dav::GetPublicUser')) {
return true;
}
*
*/
}
}
return $mResult;
}
示例9: __construct
public function __construct()
{
$bErrorCreateDir = false;
/* Public files folder */
$publicDir = \CApi::DataPath() . Constants::FILESTORAGE_PATH_ROOT;
if (!file_exists($publicDir)) {
if (!@mkdir($publicDir)) {
$bErrorCreateDir = true;
}
}
$publicDir .= Constants::FILESTORAGE_PATH_CORPORATE;
if (!file_exists($publicDir)) {
if (!@mkdir($publicDir)) {
$bErrorCreateDir = true;
}
}
$personalDir = \CApi::DataPath() . Constants::FILESTORAGE_PATH_ROOT . Constants::FILESTORAGE_PATH_PERSONAL;
if (!file_exists($personalDir)) {
if (!@mkdir($personalDir)) {
$bErrorCreateDir = true;
}
}
$sharedDir = \CApi::DataPath() . Constants::FILESTORAGE_PATH_ROOT . Constants::FILESTORAGE_PATH_SHARED;
if (!file_exists($sharedDir)) {
if (!@mkdir($sharedDir)) {
$bErrorCreateDir = true;
}
}
if ($bErrorCreateDir) {
throw new \Sabre\DAV\Exception('Can\'t create directory in ' . \CApi::DataPath() . Constants::FILESTORAGE_PATH_ROOT, 500);
}
$this->aTree = array(new RootPersonal($personalDir));
$oApiCapaManager = \CApi::GetSystemManager('capability');
if ($oApiCapaManager->isCollaborationSupported()) {
array_push($this->aTree, new RootPublic($publicDir));
}
if (\CApi::GetConf('labs.files-sharing', false)) {
array_push($this->aTree, new RootShared($sharedDir));
}
}
示例10: getChildren
/**
* @return array
*/
public function getChildren()
{
$oAccount = $this->getUser();
$aCards = array();
$oApiCapabilityManager = \CApi::GetSystemManager('capability');
if ($oAccount instanceof \CAccount && $oApiCapabilityManager->isGlobalContactsSupported($oAccount)) {
$aContacts = array();
$oContactsModule = \CApi::GetModule('Contacts');
if ($oContactsModule instanceof \AApiModule) {
$oGlobalContactManager = $oContactsModule->GetManager('global');
if ($oGlobalContactManager) {
$aContacts = $oGlobalContactManager->getContactItems($oAccount, \EContactSortField::EMail, \ESortOrder::ASC, 0, 9999);
}
}
foreach ($aContacts as $oContact) {
$sUID = md5($oContact->Email . '-' . $oContact->Id);
$vCard = new \Sabre\VObject\Component\VCard(array('VERSION' => '3.0', 'UID' => $sUID, 'FN' => $oContact->Name));
$vCard->add('EMAIL', $oContact->Email, array('type' => array('work'), 'pref' => 1));
$aCards[] = new Card(array('uri' => $sUID . '.vcf', 'carddata' => $vCard->serialize(), 'lastmodified' => $oContact->DateModified));
}
}
return $aCards;
}
示例11: getChildren
/**
* Returns a list of addressbooks
*
* @return array
*/
public function getChildren()
{
$objs = array();
if ($this->isEmpty) {
return $objs;
}
/* @var $oApiCapaManager \CApiCapabilityManager */
$oApiCapaManager = \CApi::GetSystemManager('capability');
$aAddressbooks = $this->carddavBackend->getAddressbooksForUser($this->principalUri);
if (count($aAddressbooks) === 0) {
$this->carddavBackend->createAddressBook($this->principalUri, \Afterlogic\DAV\Constants::ADDRESSBOOK_DEFAULT_NAME, ['{DAV:}displayname' => \Afterlogic\DAV\Constants::ADDRESSBOOK_DEFAULT_DISPLAY_NAME]);
$this->carddavBackend->createAddressBook($this->principalUri, \Afterlogic\DAV\Constants::ADDRESSBOOK_COLLECTED_NAME, ['{DAV:}displayname' => \Afterlogic\DAV\Constants::ADDRESSBOOK_COLLECTED_DISPLAY_NAME]);
$aAddressbooks = $this->carddavBackend->getAddressbooksForUser($this->principalUri);
}
foreach ($aAddressbooks as $addressbook) {
$objs[] = new AddressBook($this->carddavBackend, $addressbook);
}
if ($oApiCapaManager->isCollaborationSupported()) {
$sharedAddressbook = $this->carddavBackend->getSharedAddressBook($this->principalUri);
$objs[] = new Shared\AddressBook($this->carddavBackend, $sharedAddressbook, $this->principalUri);
}
return $objs;
}
示例12: updateEnabledForEntity
/**
*
* @param \AEntity $oEntity
*/
public function updateEnabledForEntity(&$oEntity, $bEnabled = true)
{
$oEavManager = \CApi::GetSystemManager('eav');
if ($oEavManager) {
$sDisabledModules = isset($oEntity->{'@DisabledModules'}) ? $oEntity->{'@DisabledModules'} : '';
$aDisabledModules = !empty(trim($sDisabledModules)) ? array($sDisabledModules) : array();
if ($i = substr_count($sDisabledModules, "|")) {
$aDisabledModules = explode("|", $sDisabledModules);
}
if ($bEnabled) {
if (in_array($this->GetName(), $aDisabledModules)) {
$aDisabledModules = array_diff($aDisabledModules, array($this->GetName()));
}
} else {
if (!in_array($this->GetName(), $aDisabledModules)) {
$aDisabledModules[] = $this->GetName();
}
}
$sDisabledModules = implode('|', $aDisabledModules);
$oEntity->{'@DisabledModules'} = $sDisabledModules;
$oEavManager->setAttributes(array($oEntity->iId), array(new \CAttribute('@DisabledModules', $sDisabledModules, 'string')));
}
}
示例13: getShares
/**
* Returns the list of people whom this calendar is shared with.
*
* Every element in this array should have the following properties:
* * href - Often a mailto: address
* * commonname - Optional, for example a first + last name
* * status - See the Sabre\CalDAV\SharingPlugin::STATUS_ constants.
* * readOnly - boolean
* * summary - Optional, a description for the share
*
* @return array
*/
public function getShares($mCalendarId)
{
// $fields = implode(', ', $this->sharesProperties);
$stmt = $this->pdo->prepare("SELECT * FROM " . $this->calendarSharesTableName . " AS calendarShares WHERE calendarShares.calendarid = ? ORDER BY calendarShares.calendarid ASC");
$stmt->execute(array($mCalendarId));
$aShares = array();
$oUsersManager = \CApi::GetSystemManager('users');
while ($aRow = $stmt->fetch(\PDO::FETCH_ASSOC)) {
$sCommonName = basename($aRow['principaluri']);
$oAccount = \Afterlogic\DAV\Utils::GetAccountByLogin($sCommonName);
if ($oAccount instanceof \CAccount) {
$sCommonName = $oAccount->FriendlyName;
}
$aShare = array('calendarid' => $aRow['calendarid'], 'principalpath' => $aRow['principaluri'], 'readOnly' => $aRow['readonly'], 'summary' => $aRow['summary'], 'href' => basename($aRow['principaluri']), 'commonName' => $sCommonName, 'displayname' => $aRow['displayname'], 'status' => $aRow['status'], 'color' => $aRow['color']);
// add it to main array
$aShares[] = $aShare;
}
return $aShares;
}
示例14: __construct
public function __construct($baseUri = '/')
{
$this->debugExceptions = true;
self::$exposeVersion = false;
$this->setBaseUri($baseUri);
date_default_timezone_set('GMT');
if (\CApi::GetPDO()) {
/* Authentication Plugin */
$this->addPlugin(new \Afterlogic\DAV\Auth\Plugin(Backend::Auth(), 'SabreDAV'));
/* Logs Plugin */
// $this->addPlugin(new Logs\Plugin());
/* DAV ACL Plugin */
$aclPlugin = new \Sabre\DAVACL\Plugin();
$aclPlugin->hideNodesFromListings = true;
$aclPlugin->defaultUsernamePath = Constants::PRINCIPALS_PREFIX;
$mAdminPrincipal = \CApi::GetConf('labs.dav.admin-principal', false);
$aclPlugin->adminPrincipals = $mAdminPrincipal !== false ? array(Constants::PRINCIPALS_PREFIX . '/' . $mAdminPrincipal) : array();
$this->addPlugin($aclPlugin);
$bIsOwncloud = false;
/* Directory tree */
$aTree = array($bIsOwncloud ? new CardDAV\AddressBookRoot(Backend::Principal(), Backend::getBackend('carddav-owncloud')) : new CardDAV\AddressBookRoot(Backend::Principal(), Backend::Carddav()), new CalDAV\CalendarRoot(Backend::Principal(), Backend::Caldav()), new CardDAV\GAB\AddressBooks('gab', Constants::GLOBAL_CONTACTS));
$this->oApiCapaManager = \CApi::GetSystemManager('capability');
/* Files folder */
if ($this->oApiCapaManager->isFilesSupported()) {
array_push($aTree, new \Afterlogic\DAV\FS\FilesRoot());
$this->addPlugin(new FS\Plugin());
// Automatically guess (some) contenttypes, based on extesion
$this->addPlugin(new \Sabre\DAV\Browser\GuessContentType());
}
$oPrincipalColl = new \Sabre\DAVACL\PrincipalCollection(Backend::Principal());
// $oPrincipalColl->disableListing = true;
array_push($aTree, $oPrincipalColl);
/* Initializing server */
parent::__construct($aTree);
$this->httpResponse->setHeader("X-Server", Constants::DAV_SERVER_NAME);
/* Reminders Plugin */
$this->addPlugin(new Reminders\Plugin(Backend::Reminders()));
$this->addPlugin(new \Sabre\CalDAV\Schedule\Plugin());
$this->addPlugin(new \Sabre\CalDAV\Schedule\IMipPlugin('test@local.host'));
/* Contacts Plugin */
$this->addPlugin(new Contacts\Plugin());
// if ($this->oApiCapaManager->isMobileSyncSupported()) {
/* CalDAV Plugin */
$this->addPlugin(new \Sabre\CalDAV\Plugin());
/* CardDAV Plugin */
$this->addPlugin(new \Sabre\CardDAV\Plugin());
/* ICS Export Plugin */
$this->addPlugin(new \Sabre\CalDAV\ICSExportPlugin());
/* VCF Export Plugin */
$this->addPlugin(new \Sabre\CardDAV\VCFExportPlugin());
// }
/* Calendar Sharing Plugin */
$this->addPlugin(new \Sabre\CalDAV\SharingPlugin());
/* DAV Sync Plugin */
$this->addPlugin(new \Sabre\DAV\Sync\Plugin());
/* HTML Frontend Plugin */
if (\CApi::GetConf('labs.dav.use-browser-plugin', false) !== false) {
$this->addPlugin(new \Sabre\DAV\Browser\Plugin());
}
/* Locks Plugin */
// $this->addPlugin(new \Sabre\DAV\Locks\Plugin());
$this->on('beforeGetProperties', array($this, 'beforeGetProperties'), 90);
}
}
示例15: getAuthenticatedUser
public static function getAuthenticatedUser($iUserId = '')
{
static $oUser = null;
if ($oUser === null) {
if (!empty($iUserId)) {
\CApi::getAuthenticatedUserId($iUserId);
// called for saving in session
} else {
if (!empty(self::$aUserSession['UserId'])) {
$iUserId = self::$aUserSession['UserId'];
}
}
$oApiIntegrator = \CApi::GetSystemManager('integrator');
if ($oApiIntegrator) {
$oUser = $oApiIntegrator->getAuthenticatedUserByIdHelper($iUserId);
}
}
return $oUser;
}