当前位置: 首页>>代码示例>>PHP>>正文


PHP CApi类代码示例

本文整理汇总了PHP中CApi的典型用法代码示例。如果您正苦于以下问题:PHP CApi类的具体用法?PHP CApi怎么用?PHP CApi使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CApi类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PopulateContent

	/**
	 * @param \CHelpdeskUser $oUser
	 * @param \CApiHelpdeskManager $oApiHelpdesk
	 * @param \CApiFilestorageManager $oApiFilestorage
	 */
	public function PopulateContent($oUser, $oApiHelpdesk, $oApiFilestorage)
	{
		$aHash = \CApi::DecodeKeyValues($this->Hash);
		if (isset($aHash['StorageType'], $aHash['Path'], $aHash['Name']) && $oApiHelpdesk && $oApiFilestorage)
		{
			$oHelpdeskUserFromAttachment = null;
			if (isset($aHash['HelpdeskUserID'], $aHash['HelpdeskTenantID']))
			{
				if ($oUser && $aHash['HelpdeskUserID'] === $oUser->IdHelpdeskUser)
				{
					$oHelpdeskUserFromAttachment = $oUser;
				}
				else
				{
					$oHelpdeskUserFromAttachment = $oApiHelpdesk->GetUserById(
						$aHash['HelpdeskTenantID'], $aHash['HelpdeskUserID']);
				}
			}

			if ($oHelpdeskUserFromAttachment && $oApiFilestorage->FileExists(
					$oHelpdeskUserFromAttachment, $aHash['StorageType'], $aHash['Path'], $aHash['Name']
			))
			{
				$mResult = $oApiFilestorage->GetFile(
					$oHelpdeskUserFromAttachment, $aHash['StorageType'], $aHash['Path'], $aHash['Name']
				);

				if (is_resource($mResult))
				{
					$this->Content = stream_get_contents($mResult);
				}
			}
		}
	}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:39,代码来源:attachment.php

示例2: Init

 public static function Init($oTenant = null)
 {
     parent::Init($oTenant);
     $bResult = false;
     $oUser = null;
     $oClient = self::CreateClient($oTenant);
     if ($oClient) {
         if ($success = $oClient->Initialize()) {
             if ($success = $oClient->Process()) {
                 if (strlen($oClient->access_token)) {
                     $success = $oClient->CallAPI('https://api.twitter.com/1.1/account/verify_credentials.json', 'GET', array(), array('FailOnAccessError' => true), $oUser);
                 }
             }
             $success = $oClient->Finalize($success);
         }
         if ($oClient->exit) {
             $bResult = false;
             exit;
         }
         if ($success && $oUser) {
             // if you need re-ask user for permission
             //$oClient->ResetAccessToken();
             $aSocial = array('type' => self::$ConnectorName, 'id' => $oUser->id, 'name' => $oUser->name, 'email' => isset($oUser->email) ? $oUser->email : '', 'access_token' => $oClient->access_token, 'scopes' => self::$Scopes);
             \CApi::Log('social_user_' . self::$ConnectorName);
             \CApi::LogObject($oUser);
             $bResult = $aSocial;
         } else {
             $bResult = false;
             $oClient->ResetAccessToken();
             self::_socialError($oClient->error, self::$ConnectorName);
         }
     }
     return $bResult;
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:34,代码来源:index.php

示例3: request

 public function request($method, $url = '', $body = null, $headers = array())
 {
     $headers['user-agent'] = Constants::DAV_USER_AGENT;
     $sLog = "REQUEST: " . $method;
     if ($url != '') {
         $sLog = $sLog . " " . $url;
     }
     if ($body != null) {
         $sLog = $sLog . "\r\nBody:\r\n" . $body;
     }
     \CApi::Log($sLog, \ELogLevel::Full, 'dav-');
     \CApi::LogObject($headers, \ELogLevel::Full, 'dav-');
     $response = array();
     try {
         $response = parent::request($method, $url, $body, $headers);
     } catch (\Sabre\DAV\Exception $ex) {
         \CApi::LogObject($ex->getMessage(), \ELogLevel::Full, 'dav-');
         throw $ex;
     }
     $sLog = "RESPONSE: " . $method;
     if (!empty($response['body'])) {
         $sLog = $sLog . "\r\nBody:\r\n" . $response['body'];
     }
     \CApi::Log($sLog, \ELogLevel::Full, 'dav-');
     if (!empty($response['headers'])) {
         \CApi::LogObject($response['headers'], \ELogLevel::Full, 'dav-');
     }
     return $response;
 }
开发者ID:Git-Host,项目名称:email,代码行数:29,代码来源:Client.php

示例4: __construct

 /**
  * Sets up the backend.
  */
 public function __construct()
 {
     $oPdo = \CApi::GetPDO();
     $dbPrefix = \CApi::GetSettings()->GetConf('Common/DBPrefix');
     $this->oApiUsersManager = \CApi::Manager('users');
     parent::__construct($oPdo, $dbPrefix . Constants::T_PRINCIPALS, $dbPrefix . Constants::T_GROUPMEMBERS);
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:10,代码来源:PDOExt.php

示例5: __construct

	public function __construct()
	{
		parent::__construct(get_class($this));

		$this->SetTrimer(array('Name', 'Email', 'PasswordHash'));

		$this->SetLower(array('Email'));

		$oSettings =& CApi::GetSettings();

		$this->SetDefaults(array(
			'IdHelpdeskUser'		=> 0,
			'IdSystemUser'			=> 0,
			'IdTenant'				=> 0,
			'Activated'				=> false,
			'Blocked'				=> false,
			'IsAgent'				=> false,
//			'IsSocial'				=> false,
			'Name'					=> '',
			'Email'					=> '',
			'NotificationEmail'		=> '',
			'SocialId'				=> '',
			'SocialType'			=> '',
			'ActivateHash'			=> md5(microtime(true).rand(1000, 9999)),
			'Language'				=> $oSettings->GetConf('Common/DefaultLanguage'),
			'DateFormat'			=> $oSettings->GetConf('Common/DefaultDateFormat'),
			'TimeFormat'			=> $oSettings->GetConf('Common/DefaultTimeFormat'),
			'NotificationPassword'	=> '',
			'PasswordHash'			=> '',
			'PasswordSalt'			=> md5(microtime(true).rand(10000, 99999)),
			'MailNotifications'		=> false,
			'Created'				=> time()

		));
	}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:35,代码来源:user.php

示例6: GetTwofactorauthManager

 protected function GetTwofactorauthManager()
 {
     if (null === $this->oApiTwofactorauth) {
         $this->oApiTwofactorauth = \CApi::Manager('twofactorauth');
     }
     return $this->oApiTwofactorauth;
 }
开发者ID:BertLasker,项目名称:Catch-design,代码行数:7,代码来源:two-factor-auth.php

示例7: __construct

 /**
  * @param CDomain $oDomain
  * @return void
  */
 public function __construct()
 {
     parent::__construct(get_class($this), 'IdIdentity');
     $this->SetTrimer(array('Email', 'FriendlyName'));
     $this->SetDefaults(array('IdIdentity' => 0, 'IdUser' => 0, 'IdAccount' => 0, 'Virtual' => false, 'Default' => false, 'Enabled' => true, 'Email' => '', 'FriendlyName' => '', 'Signature' => '', 'SignatureType' => EAccountSignatureType::Html, 'UseSignature' => false));
     CApi::Plugin()->RunHook('api-identity-construct', array(&$this));
 }
开发者ID:BertLasker,项目名称:Catch-design,代码行数:11,代码来源:identity.php

示例8: __construct

 public function __construct()
 {
     parent::__construct(get_class($this), 'IdGroup');
     $this->__USE_TRIM_IN_STRINGS__ = true;
     $this->SetDefaults(array('IdGroup' => '', 'IdGroupStr' => '', 'IdUser' => 0, 'Name' => '', 'IsOrganization' => false, 'Email' => '', 'Company' => '', 'Street' => '', 'City' => '', 'State' => '', 'Zip' => '', 'Country' => '', 'Phone' => '', 'Fax' => '', 'Web' => '', 'Events' => array()));
     CApi::Plugin()->RunHook('api-group-construct', array(&$this));
 }
开发者ID:BertLasker,项目名称:Catch-design,代码行数:7,代码来源:group.php

示例9: getContactsManager

 public function getContactsManager()
 {
     if (!isset($this->oApiContactsManager)) {
         $this->oApiContactsManager = \CApi::Manager('contacts');
     }
     return $this->oApiContactsManager;
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:7,代码来源:AddressBook.php

示例10: 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);
         }
     }
 }
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:29,代码来源:index.php

示例11: BeforeValidateLicenseKey

 /**
  * @param CAccount $oAccount
  */
 public function BeforeValidateLicenseKey()
 {
     $oLicensingApi = CApi::Manager('licensing');
     if ($oLicensingApi && 0 === strlen($oLicensingApi->GetLicenseKey())) {
         $oLicensingApi->UpdateLicenseKey($oLicensingApi->GetT());
     }
 }
开发者ID:afterlogic,项目名称:plugin-trial-license-key,代码行数:10,代码来源:index.php

示例12: getInstance

 public static function getInstance()
 {
     if (null === self::$instance) {
         self::$instance = \CApi::GetConf('labs.dav.use-digest-auth', false) ? new Backend\Digest() : new Backend\Basic();
     }
     return self::$instance;
 }
开发者ID:Git-Host,项目名称:email,代码行数:7,代码来源:Backend.php

示例13: ChangePasswordProcess

 /**
  * @param CAccount $oAccount
  */
 public function ChangePasswordProcess($oAccount)
 {
     if (0 < strlen($oAccount->PreviousMailPassword) && $oAccount->PreviousMailPassword !== $oAccount->IncomingMailPassword) {
         $cpanel_hostname = CApi::GetConf('plugins.cpanel-change-password.config.hostname', 'localhost');
         $cpanel_username = CApi::GetConf('plugins.cpanel-change-password.config.username', 'local');
         $cpanel_password = CApi::GetConf('plugins.cpanel-change-password.config.password', '');
         $email_user = urlencode($oAccount->Email);
         $email_password = urlencode($oAccount->IncomingMailPassword);
         $email_domain = urlencode($oAccount->Domain->Name);
         $query = "https://" . $cpanel_hostname . ":2083/execute/Email/passwd_pop?email=" . $email_user . "&password=" . $email_password . "&domain=" . $email_domain;
         $curl = curl_init();
         curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
         curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
         curl_setopt($curl, CURLOPT_HEADER, 0);
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
         $header[0] = "Authorization: Basic " . base64_encode($cpanel_username . ":" . $cpanel_password) . "\n\r";
         curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
         curl_setopt($curl, CURLOPT_URL, $query);
         $result = curl_exec($curl);
         if ($result == false) {
             CApi::Log("curl_exec threw error \"" . curl_error($curl) . "\" for {$query}");
             curl_close($curl);
             throw new CApiManagerException(Errs::UserManager_AccountNewPasswordUpdateError);
         } else {
             curl_close($curl);
             $json_res = json_decode($result);
             if (!$json_res->status) {
                 throw new CApiManagerException(Errs::UserManager_AccountNewPasswordUpdateError);
             }
         }
     }
 }
开发者ID:afterlogic,项目名称:plugin-cpanel-change-password,代码行数:35,代码来源:index.php

示例14: CommonSocial

 public function CommonSocial(ap_Standard_Screen &$oScreen)
 {
     $oApiCapa = CApi::Manager('capability');
     /* @var $oApiCapa CApiCapabilityManager */
     if ($oApiCapa && !$this->oAdminPanel->IsOnlyReadAuthType()) {
         $oTenant = $this->oModule->GetTenantAdminObject();
         if ($oTenant) {
             $aConnectors = array();
             $oPlugin = \CApi::Plugin()->GetPluginByName('external-services');
             if ($oPlugin) {
                 $aEnableConnectors = $oPlugin->GetEnabledConnectors();
                 $aSocials = $oTenant->getSocials();
                 foreach ($aSocials as $sKey => $oSocial) {
                     if (in_array($sKey, $aEnableConnectors)) {
                         $oSocial->SupportedScopes = $oPlugin->GetSupportedScopes($sKey);
                         $oSocial->TranslatedScopes = $oPlugin->GetTranslatedScopes($oSocial->SupportedScopes);
                         $oSocial->HasApiKey = $oPlugin->HasApiKey($sKey);
                         $aConnectors[$sKey] = $oSocial;
                     }
                 }
             }
             $oScreen->Data->SetValue('Socials', $aConnectors);
         }
     }
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:25,代码来源:populate.php

示例15: CommonSocial

 public function CommonSocial()
 {
     $oApiCapa = CApi::Manager('capability');
     /* @var $oApiCapa CApiCapabilityManager */
     if ($oApiCapa) {
         $oTenant = $this->oModule->GetTenantAdminObject();
         if ($oTenant) {
             $aSocials = $oTenant->GetDefaultSocials();
             $aTenentSocials = array();
             foreach ($aSocials as $sKey => $oSocial) {
                 $oTenentSocial = new CTenantSocials();
                 $oTenentSocial->IdTenant = $oTenant->IdTenant;
                 $oTenentSocial->SocialAllow = CPost::GetCheckBox($sKey . '_chSocialAllow');
                 $oTenentSocial->SocialName = ucfirst($sKey);
                 $oTenentSocial->SocialId = CPost::Get($sKey . '_txtSocialId');
                 $oTenentSocial->SocialSecret = CPost::Get($sKey . '_txtSocialSecret');
                 $oTenentSocial->SocialApiKey = CPost::Get($sKey . '_txtSocialApiKey');
                 $oTenentSocial->SocialScopes = CPost::Get($sKey . '_txtSocialScopes');
                 $aTenentSocials[$sKey] = $oTenentSocial;
             }
             $oTenant->SetSocials($aTenentSocials);
         }
         if ($oTenant && $this->oModule->UpdateTenantAdminObject($oTenant)) {
             $this->LastMessage = AP_LANG_SAVESUCCESSFUL;
             $this->LastError = '';
         } else {
             $this->LastMessage = '';
             $this->LastError = AP_LANG_SAVEUNSUCCESSFUL;
         }
     }
 }
开发者ID:BertLasker,项目名称:Catch-design,代码行数:31,代码来源:post.php


注:本文中的CApi类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。