/** * @param CAccount $oAccount */ public function __construct(CAccount $oAccount) { parent::__construct(get_class($this)); $this->SetTrimer(array('Name', 'Signature', 'IncomingMailServer', 'IncomingMailLogin', 'IncomingMailPassword', 'OutgoingMailServer')); $this->SetLower(array('IncomingMailServer', 'OutgoingMailServer')); $this->SetDefaults(array('IdFetcher' => 0, 'IdAccount' => $oAccount->IdAccount, 'IdUser' => $oAccount->IdUser, 'IdDomain' => $oAccount->IdDomain, 'IdTenant' => $oAccount->IdTenant, 'IsEnabled' => true, 'IsLocked' => false, 'CheckInterval' => 0, 'CheckLastTime' => 0, 'Name' => '', 'Email' => '', 'Signature' => '', 'SignatureOptions' => EAccountSignatureOptions::DontAdd, 'LeaveMessagesOnServer' => true, 'IncomingMailServer' => '', 'IncomingMailPort' => 110, 'IncomingMailLogin' => '', 'IncomingMailPassword' => '', 'IncomingMailSecurity' => \MailSo\Net\Enumerations\ConnectionSecurityType::NONE, 'IsOutgoingEnabled' => false, 'OutgoingMailServer' => '', 'OutgoingMailPort' => 25, 'OutgoingMailAuth' => true, 'OutgoingMailSecurity' => \MailSo\Net\Enumerations\ConnectionSecurityType::NONE, 'Folder' => 'INBOX')); }
/** * @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)); }
public function __construct() { parent::__construct(get_class($this)); $this->SetTrimer(array('Subject')); $this->Owner = null; $this->SetDefaults(array('IdHelpdeskThread' => 0, 'StrHelpdeskThreadHash' => trim(base_convert(md5(microtime(true) . rand(1000, 9999)), 16, 32), '0'), 'IdTenant' => 0, 'IdOwner' => 0, 'ItsMe' => false, 'IsArchived' => false, 'Type' => EHelpdeskThreadType::None, 'Subject' => '', 'Created' => time(), 'Updated' => time(), 'PostCount' => 0, 'LastPostId' => 0, 'LastPostOwnerId' => 0, 'Notificated' => false, 'HasAttachments' => false, 'IsRead' => false)); }
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() )); }
public function __construct() { parent::__construct(get_class($this)); $this->SetDefaults(array( 'Id' => '', 'Type' => EFileStorageType::Personal, 'Path' => '', 'Name' => '', 'Size' => 0, 'IsFolder' => false, 'IsLink' => false, 'LinkType' => EFileStorageLinkType::Unknown, 'LinkUrl' => '', 'LastModified' => 0, 'ContentType' => '', 'Thumb' => false, 'ThumbnailLink' => '', 'Hash' => '', 'Shared' => false, 'Owner' => '', 'Content' => '', 'IsExternal' => false )); }
public function __construct() { parent::__construct(get_class($this)); $this->SetTrimer(array('Text')); $this->Owner = null; $this->Attachments = null; $this->SetDefaults(array('IdHelpdeskPost' => 0, 'IdHelpdeskThread' => 0, 'IdTenant' => 0, 'IdOwner' => 0, 'Type' => EHelpdeskPostType::Normal, 'SystemType' => EHelpdeskPostSystemType::None, 'Created' => time(), 'IsThreadOwner' => true, 'ItsMe' => false, 'Text' => '')); }
/** * @return bool */ public function InitBeforeChange() { parent::InitBeforeChange(); if (0 === strlen($this->IdGroupStr)) { $this->IdGroupStr = $this->GenerateStrId(); } return true; }
public function __construct($sLogin = '', $Description = '') { parent::__construct(get_class($this), 'IdTenant'); $this->__USE_TRIM_IN_STRINGS__ = true; $oSettings =& CApi::GetSettings(); $this->SetDefaults(array('IdTenant' => 0, 'IdChannel' => 0, 'IsDisabled' => false, 'IsDefault' => false, 'Login' => $sLogin, 'Email' => '', 'PasswordHash' => '', 'Description' => $Description, 'IsEnableAdminPanelLogin' => false, 'QuotaInMB' => 0, 'AllocatedSpaceInMB' => 0, 'FilesUsageInBytes' => '0', 'FilesUsageInMB' => 0, 'FilesUsageDynamicQuotaInMB' => 0, 'UserCountLimit' => 0, 'DomainCountLimit' => 0, 'Capa' => (string) $oSettings->GetConf('Common/TenantGlobalCapa'), 'AllowChangeAdminEmail' => true, 'AllowChangeAdminPassword' => true, 'Expared' => 0, 'PayUrl' => '', 'IsTrial' => false, 'HelpdeskAdminEmailAccount' => '', 'HelpdeskClientIframeUrl' => '', 'HelpdeskAgentIframeUrl' => '', 'HelpdeskSiteName' => '', 'HelpdeskStyleAllow' => false, 'HelpdeskStyleImage' => '', 'HelpdeskStyleText' => '', 'LoginStyleImage' => '', 'AppStyleImage' => '', 'HelpdeskFacebookAllow' => !!$oSettings->GetConf('Helpdesk/FacebookAllow'), 'HelpdeskFacebookId' => (string) $oSettings->GetConf('Helpdesk/FacebookId'), 'HelpdeskFacebookSecret' => (string) $oSettings->GetConf('Helpdesk/FacebookSecret'), 'HelpdeskGoogleAllow' => !!$oSettings->GetConf('Helpdesk/GoogleAllow'), 'HelpdeskGoogleId' => (string) $oSettings->GetConf('Helpdesk/GoogleId'), 'HelpdeskGoogleSecret' => (string) $oSettings->GetConf('Helpdesk/GoogleSecret'), 'HelpdeskTwitterAllow' => !!$oSettings->GetConf('Helpdesk/TwitterAllow'), 'HelpdeskTwitterId' => (string) $oSettings->GetConf('Helpdesk/TwitterId'), 'HelpdeskTwitterSecret' => (string) $oSettings->GetConf('Helpdesk/TwitterSecret'), 'HelpdeskFetcherType' => EHelpdeskFetcherType::NONE, 'HelpdeskAllowFetcher' => false, 'HelpdeskFetcherTimer' => 0, 'SipAllow' => !!$oSettings->GetConf('Sip/AllowSip'), 'SipAllowConfiguration' => false, 'SipRealm' => (string) $oSettings->GetConf('Sip/Realm'), 'SipWebsocketProxyUrl' => (string) $oSettings->GetConf('Sip/WebsocketProxyUrl'), 'SipOutboundProxyUrl' => (string) $oSettings->GetConf('Sip/OutboundProxyUrl'), 'SipCallerID' => (string) $oSettings->GetConf('Sip/CallerID'), 'TwilioAllow' => !!$oSettings->GetConf('Twilio/AllowTwilio'), 'TwilioAllowConfiguration' => false, 'TwilioPhoneNumber' => (string) $oSettings->GetConf('Twilio/PhoneNumber'), 'TwilioAccountSID' => (string) $oSettings->GetConf('Twilio/AccountSID'), 'TwilioAuthToken' => (string) $oSettings->GetConf('Twilio/AuthToken'), 'TwilioAppSID' => (string) $oSettings->GetConf('Twilio/AppSID'), 'Socials' => $this->getDefaultSocials(), 'CalendarNotificationEmailAccount' => '', 'InviteNotificationEmailAccount' => '')); $this->SetLower(array('Login', 'Email', 'HelpdeskAdminEmailAccount', 'CalendarNotificationEmailAccount', 'InviteNotificationEmailAccount')); $this->SetUpper(array('Capa')); }
/** * @return void */ public function __construct(CDomain $oDomain) { parent::__construct(get_class($this), 'IdUser'); $oSettings =& CApi::GetSettings(); $iSaveMail = $oSettings->GetConf('WebMail/SaveMail'); $iSaveMail = ESaveMail::Always !== $iSaveMail ? $oSettings->GetConf('WebMail/SaveMail') : ESaveMail::DefaultOn; $this->oSubCache = null; $this->__USE_TRIM_IN_STRINGS__ = true; $this->SetUpper(array('Capa')); $this->SetDefaults(array('IdUser' => 0, 'IdSubscription' => 0, 'IdHelpdeskUser' => 0, 'MailsPerPage' => $oDomain->MailsPerPage, 'ContactsPerPage' => $oDomain->ContactsPerPage, 'AutoCheckMailInterval' => $oDomain->AutoCheckMailInterval, 'CreatedTime' => 0, 'LastLogin' => 0, 'LastLoginNow' => 0, 'LoginsCount' => 0, 'DefaultSkin' => $oDomain->DefaultSkin, 'DefaultLanguage' => $oDomain->DefaultLanguage, 'DefaultEditor' => EUserHtmlEditor::Html, 'SaveMail' => $iSaveMail, 'Layout' => $oDomain->Layout, 'DefaultTimeZone' => 0, 'DefaultTimeFormat' => $oDomain->DefaultTimeFormat, 'DefaultDateFormat' => $oDomain->DefaultDateFormat, 'DefaultIncomingCharset' => CApi::GetConf('webmail.default-inc-charset', 'iso-8859-1'), 'Question1' => '', 'Question2' => '', 'Answer1' => '', 'Answer2' => '', 'TwilioNumber' => '', 'TwilioEnable' => true, 'TwilioDefaultNumber' => false, 'SipEnable' => true, 'SipImpi' => '', 'SipPassword' => '', 'Capa' => '', 'ClientTimeZone' => '', 'UseThreads' => $oDomain->UseThreads, 'SaveRepliedMessagesToCurrentFolder' => false, 'DesktopNotifications' => false, 'AllowChangeInputDirection' => false, 'EnableOpenPgp' => false, 'AllowAutosaveInDrafts' => true, 'AutosignOutgoingEmails' => false, 'AllowHelpdeskNotifications' => false, 'CustomFields' => '', 'FilesEnable' => true)); CApi::Plugin()->RunHook('api-user-construct', array(&$this)); }
/** * @param CAccount $oAccount */ public function __construct(CAccount $oAccount) { parent::__construct(get_class($this)); $this->SetDefaults(array( 'IdAccount' => $oAccount->IdAccount, 'Enable' => true, 'Field' => EFilterFiels::From, 'Filter' => '', 'Condition' => EFilterCondition::ContainSubstring, 'Action' => EFilterAction::DoNothing, 'FolderFullName' => '' )); }
public function __construct() { parent::__construct(get_class($this), 'Id'); $this->__USE_TRIM_IN_STRINGS__ = true; $this->SetDefaults(array( 'Id' => 0, 'IdAccount' => 0, 'IdSocial' => '', 'Type' => \ESocialType::Unknown, 'Name' => '', 'AccessToken' => '', 'RefreshToken' => '' )); }
public function __construct() { parent::__construct(get_class($this)); $this->SetDefaults(array( 'IdHelpdeskAttachment' => 0, 'IdHelpdeskPost' => 0, 'IdHelpdeskThread' => 0, 'IdTenant' => 0, 'IdOwner' => 0, 'Created' => time(), 'SizeInBytes' => 0, 'FileName' => '', 'Content' => '', 'Hash' => '' )); }
/** * @param int $iUserId * @return void */ public function __construct($iUserId) { parent::__construct(get_class($this), 'IdCalUser'); $iUserId = (int) $iUserId; $oDomain = null; $oSettings =& CApi::GetSettings(); if (0 < $iUserId) { /* @var $oApiUsersManager CApiUsersManager */ $oApiUsersManager = CApi::Manager('users'); $iDomainId = $oApiUsersManager->GetDefaultAccountDomainId($iUserId); if (0 < $iDomainId) { /* @var $oApiDomainsManager CApiDomainsManager */ $oApiDomainsManager = CApi::Manager('domains'); $oDomain = $oApiDomainsManager->GetDomainById($iDomainId); } } $this->SetDefaults(array('IdCalUser' => 0, 'IdUser' => (int) $iUserId, 'ShowWeekEnds' => (bool) ($oDomain ? $oDomain->CalendarShowWeekEnds : $oSettings->GetConf('Calendar/ShowWeekEnds')), 'ShowWorkDay' => (bool) ($oDomain ? $oDomain->CalendarShowWorkDay : $oSettings->GetConf('Calendar/ShowWorkDay')), 'WorkDayStarts' => (int) ($oDomain ? $oDomain->CalendarWorkdayStarts : $oSettings->GetConf('Calendar/WorkdayStarts')), 'WorkDayEnds' => (int) ($oDomain ? $oDomain->CalendarWorkdayEnds : $oSettings->GetConf('Calendar/WorkdayEnds')), 'WeekStartsOn' => (int) ($oDomain ? $oDomain->CalendarWeekStartsOn : $oSettings->GetConf('Calendar/WeekStartsOn')), 'DefaultTab' => (int) ($oDomain ? $oDomain->CalendarDefaultTab : $oSettings->GetConf('Calendar/DefaultTab')))); CApi::Plugin()->RunHook('api-caluser-construct', array(&$this)); }
/** * @param object $oObject * @param object $oHelper * @return array */ public static function DbInsertArrays($oObject, $oHelper) { $aResult = array(false, false); $sQueryParams = ''; $bUseLogQueryParams = (bool) CApi::GetConf('labs.db.log-query-params', false); $oObject->initBeforeChange(); $aStaticMap = $oObject->getMap(); $aMap = api_AContainer::DbWriteKeys($aStaticMap, true); $aDbKeys = array_keys($aMap); $aResult[0] = array_map(array(&$oHelper, 'EscapeColumn'), $aDbKeys); $aDbValues = array_values($aMap); foreach ($aDbValues as $iIndex => $sKey) { $mValue = $oObject->{$sKey}; if (isset($aStaticMap[$sKey][0])) { if ('password' === $aStaticMap[$sKey][0]) { $mValue = api_Utils::EncodePassword($mValue); } else { if ('datetime' === $aStaticMap[$sKey][0]) { $mValue = $oHelper->TimeStampToDateFormat($mValue); } else { if ('serialize' === $aStaticMap[$sKey][0]) { $mValue = '' === $mValue ? '' : serialize($mValue); } } } } $aDbValues[$iIndex] = is_string($mValue) ? $oHelper->EscapeString($mValue) : (int) $mValue; if ($bUseLogQueryParams) { $sDbKey = isset($aDbKeys[$iIndex]) ? $aDbKeys[$iIndex] : '!unknown!'; $sQueryParams .= API_CRLF . API_TAB . $sDbKey . ' = ' . $aDbValues[$iIndex]; } } $aResult[1] = $aDbValues; if ($bUseLogQueryParams) { CApi::Log($sQueryParams); } return $aResult; }
/** * @return bool */ public function InitBeforeChange() { parent::InitBeforeChange(); if (0 === strlen($this->IdContactStr) && ((is_int($this->IdContact) && 0 < $this->IdContact) || (is_string($this->IdContact) && 0 < strlen($this->IdContact))) ) { $this->IdContactStr = $this->GenerateStrId(); } if (!$this->__LOCK_DATE_MODIFIED__) { $this->DateModified = time(); } switch ((int) $this->PrimaryEmail) { //ReadOnly case EPrimaryEmailType::Home: $this->ViewEmail = (string) $this->HomeEmail; break; case EPrimaryEmailType::Business: $this->ViewEmail = (string) $this->BusinessEmail; break; case EPrimaryEmailType::Other: $this->ViewEmail = (string) $this->OtherEmail; break; } return true; }
/** * Returns query-string for obtaining user by specified condition. * * @param string $sWhere Specified condition. * * @return string */ protected function _getUserByWhereQuery($sWhere) { $aMap = api_AContainer::DbReadKeys(CUser::getStaticMap()); $aMap = array_map(array($this, 'escapeColumn'), $aMap); $sSql = 'SELECT %s FROM %sawm_settings WHERE %s'; return sprintf($sSql, implode(', ', $aMap), $this->prefix(), $sWhere); }
/** * @param string $sWhere * @return string */ protected function getAccountByWhere($sWhere) { $aMap = api_AContainer::DbReadKeys(CTwofactorauth::getStaticMap()); $aMap = array_map(array($this, 'escapeColumn'), $aMap); $sSql = 'SELECT %s FROM %stwofa_accounts WHERE %s'; return sprintf($sSql, implode(', ', $aMap), $this->prefix(), $sWhere); }
/** * @param string $sWhere * @return string */ protected function getSocialByWhere($sWhere) { $aMap = api_AContainer::DbReadKeys(CSocial::GetStaticMap()); $aMap = array_map(array($this, 'escapeColumn'), $aMap); $sSql = 'SELECT %s FROM %sawm_social WHERE %s'; return sprintf($sSql, implode(', ', $aMap), $this->Prefix(), $sWhere); }
/** * @param CSubscription $oSubscription * * @return string */ public function updateSubscription($oSubscription) { $aResult = api_AContainer::DbUpdateArray($oSubscription, $this->oHelper); $sSql = 'UPDATE %sawm_fetchers SET %s WHERE %s = %d AND %s = %d'; return sprintf($sSql, $this->prefix(), implode(', ', $aResult), $this->escapeColumn('id_tenant'), $oSubscription->IdTenant, $this->escapeColumn('id_subscription'), $oSubscription->IdSubscription); }
public function __construct() { parent::__construct(get_class($this), 'IdSubscription'); $this->__USE_TRIM_IN_STRINGS__ = true; $this->SetDefaults(array('IdSubscription' => 0, 'IdTenant' => 0, 'Name' => '', 'Description' => '', 'Capa' => '', 'Limit' => 0)); }
/** * @param CTenant $oTenant * * @return string */ function UpdateTenant(CTenant $oTenant) { $aResult = api_AContainer::DbUpdateArray($oTenant, $this->oHelper); $sSql = 'UPDATE %sawm_tenants SET %s WHERE id_tenant = %d'; return sprintf($sSql, $this->Prefix(), implode(', ', $aResult), $oTenant->IdTenant); }
public function __construct() { parent::__construct(get_class($this), 'Id'); $this->__USE_TRIM_IN_STRINGS__ = true; $this->SetDefaults(array('Id' => 0, 'IdTenant' => 0, 'SocialAllow' => false, 'SocialName' => '', 'SocialId' => '', 'SocialSecret' => '', 'SocialApiKey' => null, 'SocialScopes' => '', 'SupportedScopes' => array(), 'TranslatedScopes' => array(), 'HasApiKey' => false)); }
/** * @param CTenantSocials $oSocial * * @return bool */ public function updateSocial(CTenantSocials $oSocial) { $aResult = api_AContainer::DbUpdateArray($oSocial, $this->oHelper); $sSql = 'UPDATE %sawm_tenant_socials SET %s WHERE id = %d'; return sprintf($sSql, $this->prefix(), implode(', ', $aResult), $oSocial->Id); }
/** * @param CGroup $oGroup * @return string */ public function UpdateGroup($oGroup) { $sSql = 'UPDATE %sawm_addr_groups SET %s WHERE id_user = %d AND id_group = %d'; return sprintf($sSql, $this->prefix(), implode(', ', api_AContainer::DbUpdateArray($oGroup, $this->oHelper)), $oGroup->IdUser, $oGroup->IdGroup); }
/** * @param CHelpdeskUser $oHelpdeskUser * @param CHelpdeskPost $oHelpdeskPost * @return string */ public function CreatePost(CHelpdeskUser $oHelpdeskUser, CHelpdeskPost $oHelpdeskPost) { $aResults = api_AContainer::DbInsertArrays($oHelpdeskPost, $this->oHelper); if (!empty($aResults[0]) && !empty($aResults[1])) { $sSql = 'INSERT INTO %sahd_posts ( %s ) VALUES ( %s )'; return sprintf($sSql, $this->Prefix(), implode(', ', $aResults[0]), implode(', ', $aResults[1])); } return ''; }
public function __construct() { parent::__construct(get_class($this), 'Id'); $this->__USE_TRIM_IN_STRINGS__ = true; $this->SetDefaults(array('Id' => 0, 'AccountId' => 0, 'DataValue' => ETwofaType::AUTH_TYPE_AUTHY, 'DataType' => ETwofaType::DATA_TYPE_AUTHY_ID)); }
/** * @param stdClass $oRow */ public function InitByDbRow($oRow) { parent::InitByDbRow($oRow); $this->InitBeforeChange(); $this->FlushObsolete(); }
public function InitBeforeChange() { parent::InitBeforeChange(); $bObsolete = null !== $this->GetObsoleteValue('StorageQuota'); $this->StorageQuota = 0 === $this->StorageQuota ? (int) CApi::GetConf('labs.unlim-quota-limit-size-in-kb', 104857600) : $this->StorageQuota; if (!$bObsolete) { $this->FlushObsolete('StorageQuota'); } }
/** * @param CAccount $oAccount * @param CFetcher $oFetcher * @return string */ public function updateFetcher($oAccount, $oFetcher) { $aResult = api_AContainer::DbUpdateArray($oFetcher, $this->oHelper); $sSql = 'UPDATE %sawm_fetchers SET %s WHERE %s = %d AND %s = %d'; return sprintf($sSql, $this->prefix(), implode(', ', $aResult), $this->escapeColumn('id_acct'), $oAccount->IdAccount, $this->escapeColumn('id_fetcher'), $oFetcher->IdFetcher); }