コード例 #1
0
ファイル: attachment.php プロジェクト: pombredanne/ArcherSys
	/**
	 * @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);
				}
			}
		}
	}
コード例 #2
0
ファイル: index.php プロジェクト: pkdevboxy/webmail-lite
 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;
 }
コード例 #3
0
ファイル: Client.php プロジェクト: Git-Host/email
 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;
 }
コード例 #4
0
ファイル: PDOExt.php プロジェクト: pkdevboxy/webmail-lite
 /**
  * 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);
 }
コード例 #5
0
ファイル: user.php プロジェクト: pombredanne/ArcherSys
	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()

		));
	}
コード例 #6
0
 protected function GetTwofactorauthManager()
 {
     if (null === $this->oApiTwofactorauth) {
         $this->oApiTwofactorauth = \CApi::Manager('twofactorauth');
     }
     return $this->oApiTwofactorauth;
 }
コード例 #7
0
ファイル: identity.php プロジェクト: BertLasker/Catch-design
 /**
  * @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));
 }
コード例 #8
0
ファイル: group.php プロジェクト: BertLasker/Catch-design
 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));
 }
コード例 #9
0
 public function getContactsManager()
 {
     if (!isset($this->oApiContactsManager)) {
         $this->oApiContactsManager = \CApi::Manager('contacts');
     }
     return $this->oApiContactsManager;
 }
コード例 #10
0
ファイル: index.php プロジェクト: hallnewman/webmail-lite
 /**
  * @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);
         }
     }
 }
コード例 #11
0
 /**
  * @param CAccount $oAccount
  */
 public function BeforeValidateLicenseKey()
 {
     $oLicensingApi = CApi::Manager('licensing');
     if ($oLicensingApi && 0 === strlen($oLicensingApi->GetLicenseKey())) {
         $oLicensingApi->UpdateLicenseKey($oLicensingApi->GetT());
     }
 }
コード例 #12
0
ファイル: Backend.php プロジェクト: Git-Host/email
 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;
 }
コード例 #13
0
 /**
  * @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="******"&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);
             }
         }
     }
 }
コード例 #14
0
ファイル: populate.php プロジェクト: pkdevboxy/webmail-lite
 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);
         }
     }
 }
コード例 #15
0
ファイル: post.php プロジェクト: BertLasker/Catch-design
 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;
         }
     }
 }
コード例 #16
0
ファイル: post.php プロジェクト: hallnewman/webmail-lite
 public function CommonSocial()
 {
     $oApiCapa = CApi::Manager('capability');
     /* @var $oApiCapa CApiCapabilityManager */
     if ($oApiCapa) {
         $oTenant = $this->oModule->GetTenantAdminObject();
         if ($oTenant) {
             $oTenant->SocialFacebookAllow = CPost::Get('chSocialFacebookAllow');
             $oTenant->SocialFacebookId = CPost::Get('txtSocialFacebookId');
             $oTenant->SocialFacebookSecret = CPost::Get('txtSocialFacebookSecret');
             $oTenant->SocialGoogleAllow = CPost::Get('chSocialGoogleAllow');
             $oTenant->SocialGoogleId = CPost::Get('txtSocialGoogleId');
             $oTenant->SocialGoogleSecret = CPost::Get('txtSocialGoogleSecret');
             $oTenant->SocialGoogleApiKey = CPost::Get('txtSocialGoogleApiKey');
             $oTenant->SocialTwitterAllow = CPost::Get('chSocialTwitterAllow');
             $oTenant->SocialTwitterId = CPost::Get('txtSocialTwitterId');
             $oTenant->SocialTwitterSecret = CPost::Get('txtSocialTwitterSecret');
             $oTenant->SocialDropboxAllow = CPost::Get('chSocialDropboxAllow');
             $oTenant->SocialDropboxKey = CPost::Get('txtSocialDropboxKey');
             $oTenant->SocialDropboxSecret = CPost::Get('txtSocialDropboxSecret');
         }
         if ($oTenant && $this->oModule->UpdateTenantAdminObject($oTenant)) {
             $this->LastMessage = AP_LANG_SAVESUCCESSFUL;
             $this->LastError = '';
         } else {
             $this->LastMessage = '';
             $this->LastError = AP_LANG_SAVEUNSUCCESSFUL;
         }
     }
 }
コード例 #17
0
ファイル: Digest.php プロジェクト: afterlogic/dav
 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;
 }
コード例 #18
0
ファイル: CalendarHome.php プロジェクト: afterlogic/dav
 /**
  * Returns a list of calendars
  *
  * @return array
  */
 public function getChildren()
 {
     $aCalendars = $this->caldavBackend->getCalendarsForUser($this->principalInfo['uri']);
     $aObjs = array();
     foreach ($aCalendars as $aCalendarInfo) {
         if ($this->caldavBackend instanceof \Sabre\CalDAV\Backend\SharingSupport) {
             if (isset($aCalendarInfo['{http://calendarserver.org/ns/}shared-url'])) {
                 $aObjs[] = new SharedCalendar($this->caldavBackend, $aCalendarInfo, $this->principalInfo);
             } else {
                 $aObjs[] = new ShareableCalendar($this->caldavBackend, $aCalendarInfo);
             }
         } else {
             $aObjs[] = new Calendar($this->caldavBackend, $aCalendarInfo);
         }
     }
     $aObjs[] = new \Sabre\CalDAV\Schedule\Outbox($this->principalInfo['uri']);
     if ($this->caldavBackend instanceof \Sabre\CalDAV\Backend\SchedulingSupport) {
         $aObjs[] = new \Sabre\CalDAV\Schedule\Inbox($this->caldavBackend, $this->principalInfo['uri']);
         $aObjs[] = new \Sabre\CalDAV\Schedule\Outbox($this->principalInfo['uri']);
     }
     // If the backend supports subscriptions, we'll add those as well,
     if ($this->caldavBackend instanceof \Sabre\CalDAV\Backend\SubscriptionSupport) {
         foreach ($this->caldavBackend->getSubscriptionsForUser($this->principalInfo['uri']) as $subscription) {
             $aObjs[] = new \Sabre\CalDAV\Subscriptions\Subscription($this->caldavBackend, $subscription);
         }
     }
     // We're adding a notifications node, if it's supported by the backend.
     if ($this->caldavBackend instanceof \Sabre\CalDAV\Backend\NotificationSupport && \CApi::GetConf('labs.dav.caldav.notification', false)) {
         $aObjs[] = new \Sabre\CalDAV\Notifications\Collection($this->caldavBackend, $this->principalInfo['uri']);
     }
     return $aObjs;
 }
コード例 #19
0
ファイル: manager.php プロジェクト: pkdevboxy/webmail-lite
 /**
  * @return CApiTenantsManager|null
  */
 private function _getApiTenantsManager()
 {
     if (null === $this->oApiTenantsManager) {
         $this->oApiTenantsManager = CApi::Manager('tenants');
     }
     return $this->oApiTenantsManager;
 }
コード例 #20
0
ファイル: Plugin.php プロジェクト: BertLasker/Catch-design
 public function getMinMan()
 {
     if ($this->oApiMin == null) {
         $this->oApiMin = \CApi::Manager('min');
     }
     return $this->oApiMin;
 }
コード例 #21
0
ファイル: login.php プロジェクト: BertLasker/Catch-design
    /**
     * @param CAdminPanel $oAdminPanel
     * @return ap_Login_Screen
     */
    public function __construct(CAdminPanel &$oAdminPanel)
    {
        parent::__construct($oAdminPanel, 'login.php');
        $sError = '';
        if (isset($_GET['auth_error'])) {
            $sError = AP_LANG_LOGIN_AUTH_ERROR;
        } else {
            if (isset($_GET['sess_error'])) {
                $sError = AP_LANG_LOGIN_SESS_ERROR;
            } else {
                if (isset($_GET['access_error'])) {
                    $sError = AP_LANG_LOGIN_ACCESS_ERROR;
                }
            }
        }
        if (0 < strlen($sError)) {
            $this->Data->SetValue('LoginErrorDesc', '<div class="wm_login_error"><div class="wm_login_error_icon"></div><div class="wm_login_error_message" id="login_error_message">' . $sError . '</div></div>');
        }
        $this->JsAddInitText('$(\'#loginId\').focus();');
        $this->CssAddFile('static/styles/screens/login.css');
        $this->Data->SetValue('AdminLogin', CApi::GetConf('demo.adminpanel.login', ''));
        $this->Data->SetValue('AdminPassword', CApi::GetConf('demo.adminpanel.password', ''));
        if (CApi::GetConf('demo.adminpanel.enable', false)) {
            $this->Data->SetValue('LoginDemoFooter', '<div class="info" id="demo_info" dir="ltr">
<div class="demo_note">
This is a demo version of administrative interface. <br />For WebMail demo interface, click <a href="..">here</a>.
</div>
</div>');
        }
    }
コード例 #22
0
ファイル: manager.php プロジェクト: BertLasker/Catch-design
 /**
  * @return CSubscription|null
  */
 public function TenantManager()
 {
     if (null === $this->oTenants) {
         $this->oTenants = CApi::Manager('tenants');
     }
     return $this->oTenants;
 }
コード例 #23
0
ファイル: csv.php プロジェクト: BertLasker/Catch-design
 /**
  * @param int $iUserId
  * @param string $sTempFileName
  * @param int $iParsedCount
  * @param int $iGroupId
  * @param bool $bIsShared
  * @return int
  */
 public function Import($iUserId, $sTempFileName, &$iParsedCount, $iGroupId, $bIsShared)
 {
     $iCount = -1;
     $iParsedCount = 0;
     if (file_exists($sTempFileName)) {
         $aCsv = api_Utils::CsvToArray($sTempFileName);
         if (is_array($aCsv)) {
             $oApiUsersManager = CApi::Manager('users');
             $oAccount = $oApiUsersManager->GetDefaultAccount($iUserId);
             $iCount = 0;
             foreach ($aCsv as $aCsvItem) {
                 set_time_limit(30);
                 $this->oParser->Reset();
                 $oContact = new CContact();
                 $oContact->IdUser = $iUserId;
                 $this->oParser->SetContainer($aCsvItem);
                 $aParameters = $this->oParser->GetParameters();
                 foreach ($aParameters as $sPropertyName => $mValue) {
                     if ($oContact->IsProperty($sPropertyName)) {
                         $oContact->{$sPropertyName} = $mValue;
                     }
                 }
                 if (0 === strlen($oContact->FullName)) {
                     $oContact->FullName = trim($oContact->FirstName . ' ' . $oContact->LastName);
                 }
                 if (0 !== strlen($oContact->HomeEmail)) {
                     $oContact->PrimaryEmail = \EPrimaryEmailType::Home;
                     $oContact->ViewEmail = $oContact->HomeEmail;
                 } else {
                     if (0 !== strlen($oContact->BusinessEmail)) {
                         $oContact->PrimaryEmail = \EPrimaryEmailType::Business;
                         $oContact->ViewEmail = $oContact->BusinessEmail;
                     } else {
                         if (0 !== strlen($oContact->OtherEmail)) {
                             $oContact->PrimaryEmail = \EPrimaryEmailType::Other;
                             $oContact->ViewEmail = $oContact->OtherEmail;
                         }
                     }
                 }
                 if (strlen($oContact->BirthdayYear) === 2) {
                     $oDt = DateTime::createFromFormat('y', $oContact->BirthdayYear);
                     $oContact->BirthdayYear = $oDt->format('Y');
                 }
                 $iParsedCount++;
                 $oContact->__SKIP_VALIDATE__ = true;
                 if ($oAccount) {
                     $oContact->IdDomain = $oAccount->IdDomain;
                     $oContact->IdTenant = $oAccount->IdTenant;
                 }
                 $oContact->SharedToAll = $bIsShared;
                 $oContact->GroupsIds = array($iGroupId);
                 if ($this->oApiContactsManager->CreateContact($oContact)) {
                     $iCount++;
                 }
                 unset($oContact, $aParameters, $aCsvItem);
             }
         }
     }
     return $iCount;
 }
コード例 #24
0
ファイル: post.php プロジェクト: BertLasker/Catch-design
 public function SystemLogging()
 {
     if (isset($_POST['btnClearLog']) || isset($_POST['btnUserActivityClearLog'])) {
         /* @var $oApiLoggerManager CApiLoggerManager */
         $oApiLoggerManager = CApi::Manager('logger');
         $bResult = false;
         if (isset($_POST['btnClearLog'])) {
             $bResult = $oApiLoggerManager->DeleteCurrentLog();
         } else {
             $bResult = $oApiLoggerManager->DeleteCurrentUserActivityLog();
         }
         if ($bResult) {
             $this->LastMessage = WM_INFO_LOGCLEARSUCCESSFUL;
         } else {
             $this->LastError = AP_LANG_ERROR;
         }
     } else {
         if ($this->isStandartSubmit()) {
             $this->oSettings->SetConf('Common/EnableLogging', CPost::GetCheckBox('ch_EnableDebugLogging'));
             $this->oSettings->SetConf('Common/EnableEventLogging', CPost::GetCheckBox('ch_EnableUserActivityLogging'));
             $this->oSettings->SetConf('Common/LoggingLevel', EnumConvert::FromPost(CPost::Get('selVerbosity', ''), 'ELogLevel'));
             $this->checkBolleanWithMessage($this->oSettings->SaveToXml());
         }
     }
 }
コード例 #25
0
ファイル: Plugin.php プロジェクト: afterlogic/dav
 /**
  * __construct
  *
  * @return void
  */
 public function __construct()
 {
     $oContactsModule = \CApi::GetModule('Contacts');
     if ($oContactsModule instanceof \AApiModule) {
         $this->oApiContactsManager = $oContactsModule->GetManager('main');
     }
 }
コード例 #26
0
ファイル: Basic.php プロジェクト: BertLasker/Catch-design
 /**
  * Validates a username and password
  *
  * This method should return true or false depending on if login
  * succeeded.
  *
  * @return bool
  */
 protected function validateUserPass($sUserName, $sPassword)
 {
     if (class_exists('CApi') && \CApi::IsValid()) {
         /* @var $oApiCalendarManager \CApiCalendarManager */
         $oApiCalendarManager = \CApi::Manager('calendar');
         /* @var $oApiCapabilityManager \CApiCapabilityManager */
         $oApiCapabilityManager = \CApi::Manager('capability');
         if ($oApiCalendarManager && $oApiCapabilityManager) {
             $oAccount = \afterlogic\DAV\Utils::GetAccountByLogin($sUserName);
             if ($oAccount && $oAccount->IsDisabled) {
                 return false;
             }
             $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 && $oAccount->IncomingMailPassword === $sPassword && ($bIsMobileSync && !$bIsOutlookSyncClient || $bIsOutlookSync && $bIsOutlookSyncClient) || $bIsDemo || $sUserName === $oApiCalendarManager->GetPublicUser()) {
                 \afterlogic\DAV\Utils::CheckPrincipals($sUserName);
                 return true;
             }
         }
     }
     return false;
 }
コード例 #27
0
ファイル: PDO.php プロジェクト: afterlogic/dav
 /**
  * Sets up the object
  */
 public function __construct()
 {
     parent::__construct(\CApi::GetPDO());
     $sDbPrefix = \CApi::GetSettings()->GetConf('Common/DBPrefix');
     $this->cardsTableName = $sDbPrefix . Constants::T_CARDS;
     $this->addressBooksTableName = $sDbPrefix . Constants::T_ADDRESSBOOKS;
     $this->addressBookChangesTableName = $sDbPrefix . Constants::T_ADDRESSBOOKCHANGES;
 }
コード例 #28
0
ファイル: PDO.php プロジェクト: pkdevboxy/webmail-lite
 /**
  * Creates the backend object. 
  *
  * @return void
  */
 public function __construct()
 {
     $dBPrefix = \CApi::GetSettings()->GetConf('Common/DBPrefix');
     $this->pdo = \CApi::GetPDO();
     $this->table = $dBPrefix . Constants::T_REMINDERS;
     $this->calendarTbl = $dBPrefix . Constants::T_CALENDARS;
     $this->principalsTbl = $dBPrefix . Constants::T_PRINCIPALS;
 }
コード例 #29
0
ファイル: PDO.php プロジェクト: pombredanne/ArcherSys
	/**
     * Sets up the object
     */
    public function __construct() {

		$oPdo = \CApi::GetPDO();
		$sDbPrefix = \CApi::GetSettings()->GetConf('Common/DBPrefix');

		parent::__construct($oPdo, $sDbPrefix.Constants::T_ADDRESSBOOKS, $sDbPrefix.Constants::T_CARDS);

    }
コード例 #30
0
ファイル: PDO.php プロジェクト: pombredanne/ArcherSys
    /**
     * Constructor 
     */
    public function __construct() {

		$oPdo = \CApi::GetPDO();
		$dbPrefix = \CApi::GetSettings()->GetConf('Common/DBPrefix');
		
		parent::__construct($oPdo, $dbPrefix.Constants::T_LOCKS);

    }