本文整理汇总了PHP中CApi::Inc方法的典型用法代码示例。如果您正苦于以下问题:PHP CApi::Inc方法的具体用法?PHP CApi::Inc怎么用?PHP CApi::Inc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CApi
的用法示例。
在下文中一共展示了CApi::Inc方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ChangePasswordProcess
/**
* @param CAccount $oAccount
*/
public function ChangePasswordProcess($oAccount)
{
if (0 < strlen($oAccount->PreviousMailPassword) && $oAccount->PreviousMailPassword !== $oAccount->IncomingMailPassword) {
if (null === $this->oPopPassD) {
CApi::Inc('common.net.protocols.poppassd');
$this->oPopPassD = new CApiPoppassdProtocol(CApi::GetConf('plugins.poppassd-change-password.config.host', '127.0.0.1'), CApi::GetConf('plugins.poppassd-change-password.config.port', 106));
}
if ($this->oPopPassD && $this->oPopPassD->Connect()) {
try {
// if ($this->oPopPassD->Login(api_Utils::GetAccountNameFromEmail($oAccount->IncomingMailLogin), $oAccount->PreviousMailPassword))
if ($this->oPopPassD->Login($oAccount->IncomingMailLogin, $oAccount->PreviousMailPassword)) {
if (!$this->oPopPassD->NewPass($oAccount->IncomingMailPassword)) {
throw new CApiManagerException(Errs::UserManager_AccountNewPasswordRejected);
}
} else {
throw new CApiManagerException(Errs::UserManager_AccountOldPasswordNotCorrect);
}
} catch (Exception $oException) {
$this->oPopPassD->Disconnect();
throw $oException;
}
} else {
throw new CApiManagerException(Errs::UserManager_AccountNewPasswordUpdateError);
}
}
}
示例2: Ldap
/**
* @staticvar CLdapConnector|null $oLdap
* @param CAccount $oAccount
* @return CLdapConnector|bool
*/
private function Ldap($oAccount)
{
// if ($oAccount)
// {
// // TODO
// $aCustomFields = $oAccount->CustomFields;
// $aCustomFields['LdapPabUrl'] = 'ldap://192.168.0.197:389/ou=TestUser2,ou=PAB,dc=example,dc=com';
// $aCustomFields['LdapPabUrl'] = 'ldap://jes7dir.netvision.net.il:389/ou=24606995,ou=People,o=netvision.net.il,o=NVxSP,o=pab';
// $oAccount->CustomFields = $aCustomFields;
// }
static $aLdap = array();
if (!$oAccount || !isset($oAccount->CustomFields) || empty($oAccount->CustomFields['LdapPabUrl'])) {
return false;
}
$sPabUrl = $oAccount->CustomFields['LdapPabUrl'];
$aPabUrl = api_Utils::LdapUriParse($sPabUrl);
if (isset($aLdap[$sPabUrl]) && $aLdap[$sPabUrl]) {
return $aLdap[$sPabUrl];
}
if (!extension_loaded('ldap')) {
CApi::Log('LDAP: Can\'t load LDAP extension.', ELogLevel::Error);
return false;
}
if (!class_exists('CLdapConnector')) {
CApi::Inc('common.ldap');
}
$oLdap = new CLdapConnector($aPabUrl['search_dn']);
$oLdap = $oLdap->Connect((string) $aPabUrl['host'], (int) $aPabUrl['port'], (string) CApi::GetConf('contacts.ldap.bind-dn', ''), (string) CApi::GetConf('contacts.ldap.bind-password', '')) ? $oLdap : false;
if ($oLdap) {
if (!$oLdap->Search('(objectClass=*)')) {
CApi::Log('LDAP: Init PabUrl Entry');
$sNewDn = $oLdap->GetSearchDN();
$aDnExplode = ldap_explode_dn($sNewDn, 1);
$sOu = isset($aDnExplode[0]) ? trim($aDnExplode[0]) : '';
$aPabUrlEntry = CApi::GetConf('contacts.ldap.pab-url-entry', array('objectClass' => array('top', 'organizationalUnit')));
if (isset($aPabUrlEntry['objectClass'])) {
$aPabUrlEntry['ou'] = $sOu;
if (0 < strlen($sOu)) {
if (!$oLdap->Add('', $aPabUrlEntry)) {
$oLdap = false;
}
} else {
CApi::Log('LDAP: empty Ou in SearchDn = ' . $sNewDn);
$oLdap = false;
}
} else {
CApi::Log('LDAP: pab-url-entry format error');
CApi::Log(print_r($aPabUrlEntry, true));
$oLdap = false;
}
}
}
$aLdap[$sPabUrl] = $oLdap;
return $oLdap;
}
示例3: CommandCreatorHelperFabric
/**
* @param int $iDbType = EDbType::MySQL
* @return IDbHelper
*/
public static function CommandCreatorHelperFabric($iDbType = EDbType::MySQL)
{
$oHelper = null;
if (EDbType::PostgreSQL === $iDbType) {
CApi::Inc('common.db.pdo.postgres_helper');
$oHelper = new CPdoPostgresHelper();
} else {
CApi::Inc('common.db.pdo.mysql_helper');
$oHelper = new CPdoMySqlHelper();
}
return $oHelper;
}
示例4: __construct
/**
* @param CApiGlobalManager &$oManager
*/
public function __construct(CApiGlobalManager &$oManager, $sForcedStorage = '')
{
parent::__construct('sieve', $oManager);
CApi::Inc('common.net.protocols.sieve');
$this->inc('classes.enum');
$this->inc('classes.filter');
$this->aSieves = array();
$this->sGeneralPassword = '';
$this->sSieveFileName = CApi::GetConf('sieve.config.file', 'sieve');
$this->sSieveFolderCharset = CApi::GetConf('sieve.config.filters-folder-charset', 'utf-8');
$this->bSectionsParsed = false;
$this->aSectionsData = array();
$this->aSectionsOrders = array('forward', 'autoresponder', 'filters');
}
示例5: __construct
/**
* @param CApiGlobalManager &$oManager
*/
public function __construct(CApiGlobalManager &$oManager)
{
parent::__construct('carddav', $oManager);
CApi::Inc('common.dav.client');
$this->Dav = null;
$this->Settings = CApi::GetSettings();
$this->Pdo = CApi::GetPDO();
$this->User = null;
$this->Account = null;
$this->Connected = false;
$this->aAddressBooksCache = array();
$this->aGroupItemsCache = array();
$this->ContactsCache = array();
$this->GroupsCache = array();
$this->DbPrefix = $this->Settings->GetConf('Common/DBPrefix');
$this->ApiUsersManager = CApi::Manager('users');
$this->ApiDavManager = CApi::Manager('dav');
}
示例6: prefix
<?php
/*
* Copyright 2004-2015, AfterLogic Corp.
* Licensed under AGPLv3 license or AfterLogic license
* if commercial version of the product was purchased.
* See the LICENSE file for a full license statement.
*/
CApi::Inc('common.db.table');
/**
* @package Db
* @subpackage Classes
*/
class CDbSchemaHelper
{
/**
* @staticvar string $sPrefix
*
* @return string
*/
public static function prefix()
{
static $sPrefix = null;
if (null === $sPrefix) {
$oSettings = null;
$oSettings =& CApi::GetSettings();
$sPrefix = $oSettings->GetConf('Common/DBPrefix');
}
return $sPrefix;
}
/**
示例7:
<?php
/*
* Copyright 2004-2015, AfterLogic Corp.
* Licensed under AGPLv3 license or AfterLogic license
* if commercial version of the product was purchased.
* See the LICENSE file for a full license statement.
*/
CApi::Inc('common.db.sql');
/**
* @package Api
* @subpackage Db
*/
class CDbPdoPostgres extends CDbSql
{
/**
* @var bool
*/
protected $bUseExplain;
/**
* @var bool
*/
protected $bUseExplainExtended;
/**
* @var PDO database object
*/
protected $oPDO;
/**
* @var PDO resource
*/
protected $rResultId;
示例8: EscapeString
<?php
/*
* Copyright 2004-2015, AfterLogic Corp.
* Licensed under AGPLv3 license or AfterLogic license
* if commercial version of the product was purchased.
* See the LICENSE file for a full license statement.
*/
CApi::Inc('common.db.helper');
/**
* @package Api
* @subpackage Db
*/
class CPdoPostgresHelper implements IDbHelper
{
/**
* @param string $sValue
* @param bool $bWithOutQuote = false
* @param bool $bSearch = false
* @return string
*/
public function EscapeString($sValue, $bWithOutQuote = false, $bSearch = false)
{
$sResult = '';
if ($bWithOutQuote) {
$sResult = str_replace('\'', '\'\'', $sValue);
} else {
$sResult = 0 === strlen($sValue) ? '\'\'' : '\'' . str_replace('\'', '\'\'', $sValue) . '\'';
}
if ($bSearch) {
$sResult = str_replace(array("%", "_"), array("\\%", "\\_"), $sResult);
示例9: EscapeString
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program 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
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
CApi::Inc('db.helper');
/**
* @package Api
* @subpackage Db
*/
class CPdoMySqlHelper implements IDbHelper
{
/**
* @param string $sValue
* @param bool $bWithOutQuote = false
* @param bool $bSearch = false
* @return string
*/
public function EscapeString($sValue, $bWithOutQuote = false, $bSearch = false)
{
$sResult = '';
示例10:
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program 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
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
CApi::Inc('db.sql');
/**
* @package Api
* @subpackage Db
*/
class CDbPdoPostgres extends CDbSql
{
/**
* @var bool
*/
protected $bUseExplain;
/**
* @var bool
*/
protected $bUseExplainExtended;
/**
示例11: class_exists
<?php
class_exists('CApi') or die;
CApi::Inc('common.plugins.change-password');
class CCustomChangePasswordPlugin extends AApiChangePasswordPlugin
{
/**
* @param CApiPluginManager $oPluginManager
*/
public function __construct(CApiPluginManager $oPluginManager)
{
parent::__construct('1.0', $oPluginManager);
}
private function crypt_password($cleartext_password)
{
$salt = "\$1\$";
$base64_alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
for ($n = 0; $n < 8; $n++) {
$salt .= $base64_alphabet[mt_rand(0, 63)];
}
$salt .= "\$";
return crypt($cleartext_password, $salt);
}
/**
* @param CAccount $oAccount
* @return bool
*/
public function validateIfAccountCanChangePassword($oAccount)
{
$bResult = false;
if ($oAccount instanceof CAccount) {
示例12: StorageInc
/**
* @return bool
*/
public static function StorageInc($sManagerName, $sStorageName, $sFileName)
{
$sManagerName = preg_replace('/[^a-z]/', '', strtolower($sManagerName));
$sStorageName = preg_replace('/[^a-z]/', '', strtolower($sStorageName));
return CApi::Inc('Managers.' . $sManagerName . '.storages.' . $sStorageName . '.' . $sFileName);
}
示例13: __construct
/**
* @param CApiGlobalManager &$oManager
*/
public function __construct(CApiGlobalManager &$oManager, $sForcedStorage = '')
{
parent::__construct('dav', $oManager);
CApi::Inc('common.dav.client');
$this->aDavClients = array();
}
示例14: prefix
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program 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
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
CApi::Inc('db.table');
/**
* @package Db
* @subpackage Classes
*/
class CDbSchemaHelper
{
/**
* @staticvar string $sPrefix
*
* @return string
*/
public static function prefix()
{
static $sPrefix = null;
if (null === $sPrefix) {
示例15: class_exists
<?php
/*
* Copyright 2004-2015, AfterLogic Corp.
* Licensed under AGPLv3 license or AfterLogic license
* if commercial version of the product was purchased.
* See the LICENSE file for a full license statement.
*/
class_exists('CApi') or die;
CApi::Inc('common.plugins.two-factor-auth');
include_once CApi::LibrariesPath() . 'PHPGangsta/GoogleAuthenticator.php';
class TwoFactorAuthenticationPlugin extends AApiTwoFactorAuthPlugin
{
protected $logs = false;
protected $discrepancy = 2;
public static $setAccountIsLoggedIn = false;
/**
* @param string $sText
*/
private function _writeLogs($sText)
{
if ($this->logs === true) {
$this->Log($sText);
}
}
/**
* @param CApiPluginManager $oPluginManager
*/
public function __construct(CApiPluginManager $oPluginManager)
{
parent::__construct('1.0', $oPluginManager);