public function run($id = null, $page = 1, $size = 2) { $this->controller->pageTitle = "Profile"; if (Yii::app()->request->isAjaxRequest) { if (!$id) { $id = Yii::app()->user->id; } $post = new CPost(); $result = $post->getProfileList($id, $page, $size); echo CJSON::encode(array('code' => 200, 'mes' => 'success', 'data' => array('list' => $result['data']))); } else { if ($id) { $user = User::model()->with('companyid')->findByAttributes(array('id' => $id)); $company = Company::model()->findByAttributes(array('ownerId' => $user['id'])); $location = Hub::model()->findByAttributes(array('id' => $company['location'])); $post = new CPost(); $postlist = $post->getProfileList($id); } else { $id = Yii::app()->user->id; $user = User::model()->with('companyid')->findByAttributes(array('id' => $id)); $company = Company::model()->findByAttributes(array('ownerId' => $user['id'])); $location = Hub::model()->findByAttributes(array('id' => $company['location'])); $post = new CPost(); $postlist = $post->getProfileList($id); } $this->controller->render('profile', array('user' => $user, 'companylocation' => $location['location'], 'postlist' => $postlist['data'])); } }
public function run($id) { $this->controller->pageTitle = "Post"; $post = new CPost(); $result = $post->getpost($id); if ($result['code'] = 200) { $this->controller->render('postshow', array('data' => $result['data'])); } }
public function run($page = 1, $size = 2) { $this->controller->pageTitle = "naked HUB"; $post = new CPost(); $result = $post->getlist($page, $size); if (Yii::app()->request->isAjaxRequest) { echo CJSON::encode(array('code' => 200, 'mes' => success, 'data' => array('list' => $result['data']))); } else { if ($result['code'] == 200) { $this->controller->bodyCss = "newpostlist"; $this->controller->render('newlist', array('list' => $result['data'])); } } }
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()); } } }
public function run($id = null, $page = 1, $size = 2) { $this->controller->pageTitle = "Company"; if (Yii::app()->request->isAjaxRequest) { if (!$id) { $id = User::model()->findByAttributes(array('id' => Yii::app()->user->id))->company; } $post = new CPost(); $result = $post->getCompanyList($id, $page, $size); echo CJSON::encode(array('code' => 200, 'mes' => 'success', 'data' => array('list' => $result['data']))); } else { if ($id) { $company = Company::model()->findByAttributes(array('id' => $id)); $service = Service_company::model()->findAllByAttributes(array('companyId' => $id, 'status' => 1)); if ($service) { foreach ($service as $list) { $servicelist[] = Service::model()->findByAttributes(array('id' => $list['serviceId'])); } } $hub = Hub::model()->findByAttributes(array('id' => $company['location'])); $post = new CPost(); $postlist = $post->getCompanyList($id, $page, $size); //取出公司所有成员 $member = User::model()->findAllByAttributes(array('company' => $id)); } else { $user = User::model()->findByAttributes(array('id' => Yii::app()->user->id)); $company = Company::model()->findByAttributes(array('id' => $user['company'])); $service = Service_company::model()->findAllByAttributes(array('companyId' => $company['id'], 'status' => 1)); if ($service) { foreach ($service as $list) { $servicelist[] = Service::model()->findByAttributes(array('id' => $list['serviceId'])); } } $hub = Hub::model()->findByAttributes(array('id' => $company['location'])); $post = new CPost(); $postlist = $post->getCompanyList($company->id, $page, $size); $member = User::model()->findAllByAttributes(array('company' => $user['company'])); } // print_r($company);die; $this->controller->render('profile', array('company' => $company, 'service' => $servicelist, 'location' => $hub['location'], 'postlist' => $postlist['data'], 'member' => $member)); } }
public function DoPost() { if (isset($_POST['next_btn'])) { if (5 > strlen(trim(CPost::Get('txtPassword1', '')))) { CSession::Set('wm_install_pass_error', 'Minimum password length is 5 characters.'); } else { if (CPost::Get('txtPassword1', '') !== CPost::Get('txtPassword2', '')) { CSession::Set('wm_install_pass_error', 'The password and its confirmation don\'t match.'); } else { $this->oSettings->SetConf('Common/AdminPassword', md5(CPost::Get('txtPassword1', ''))); return $this->oSettings->SaveToXml(); } } } return false; }
protected function initUpdateDomainByPost(CDomain &$oDomain) { $oDomain->OverrideSettings = CPost::GetCheckBox('chOverrideSettings'); if (CPost::Has('txtIncomingMailHost') && CPost::Has('txtOutgoingMailHost') && CPost::Has('txtIncomingMailPort') && CPost::Has('txtOutgoingMailPort')) { $oDomain->IncomingMailServer = CPost::get('txtIncomingMailHost'); $oDomain->IncomingMailPort = CPost::get('txtIncomingMailPort'); $oDomain->IncomingMailUseSSL = CPost::GetCheckBox('chIncomingUseSSL'); $oDomain->OutgoingMailServer = CPost::get('txtOutgoingMailHost'); $oDomain->OutgoingMailPort = CPost::get('txtOutgoingMailPort'); $oDomain->OutgoingMailUseSSL = CPost::GetCheckBox('chOutgoingUseSSL'); } if (CPost::Has('radioAuthType')) { $oDomain->OutgoingMailAuth = EnumConvert::FromPost(CPost::get('radioAuthType'), 'ESMTPAuthType'); } if (CPost::Has('txtOutgoingMailLogin') && CPost::Has('txtOutgoingMailPassword')) { $oDomain->OutgoingMailLogin = CPost::get('txtOutgoingMailLogin'); if ((string) AP_DUMMYPASSWORD !== (string) CPost::get('txtOutgoingMailPassword')) { $oDomain->OutgoingMailPassword = CPost::get('txtOutgoingMailPassword', ''); } } if (CPost::Has('selIncomingMailProtocol')) { $oDomain->IncomingMailProtocol = EnumConvert::FromPost(CPost::get('selIncomingMailProtocol'), 'EMailProtocol'); } // if ($oDomain->OverrideSettings || $oDomain->IsDefaultDomain) // { // $oDomain->ExternalHostNameOfDAVServer = CPost::Get('txtExternalHostNameOfDAVServer', $oDomain->ExternalHostNameOfDAVServer); // $oDomain->ExternalHostNameOfLocalImap = CPost::Get('txtExternalHostNameOfLocalImap', $oDomain->ExternalHostNameOfLocalImap); // $oDomain->ExternalHostNameOfLocalSmtp = CPost::Get('txtExternalHostNameOfLocalSmtp', $oDomain->ExternalHostNameOfLocalSmtp); // } if ($oDomain->OverrideSettings) { // General $oDomain->Url = (string) CPost::get('txtWebDomain', $oDomain->Url); $oDomain->AllowUsersChangeEmailSettings = CPost::GetCheckBox('chAllowUsersAccessAccountsSettings'); $oDomain->AllowNewUsersRegister = !CPost::GetCheckBox('chAllowNewUsersRegister'); // Webmail $oDomain->AllowWebMail = CPost::GetCheckBox('chEnableWebmail'); $oDomain->MailsPerPage = CPost::get('selMessagesPerPage', $oDomain->MailsPerPage); $oDomain->AutoCheckMailInterval = CPost::get('selAutocheckMail', $oDomain->AutoCheckMailInterval); if (CPost::Has('radioLayout')) { $oDomain->Layout = EnumConvert::FromPost(CPost::get('radioLayout'), 'ELayout'); } // Address Book $oDomain->AllowContacts = CPost::GetCheckBox('chEnableAddressBook'); $oDomain->ContactsPerPage = CPost::get('selContactsPerPage', $oDomain->ContactsPerPage); } }
public function DoPost() { if (isset($_POST['test_btn'])) { $sMessage = ''; $sHost = CPost::Get('txtHost', ''); $bCheckSMTP = (bool) CPost::Get('chSMTP', false); $bCheckIMAP4 = (bool) CPost::Get('chIMAP4', false); $_SESSION['wm_install_server_test_host'] = $sHost; $_SESSION['wm_install_server_test_ch_smtp'] = $bCheckSMTP; $_SESSION['wm_install_server_test_ch_imap4'] = $bCheckIMAP4; if (!empty($sHost)) { if ($bCheckSMTP) { $iErrN = 0; $sErrorS = ''; $sRes = @fsockopen($sHost, 25, $iErrN, $sErrorS, 5); if (is_resource($sRes)) { @fclose($sRes); $sMessage .= '<div class="success">SMTP connection to port 25 successful, sending outgoing e-mail over SMTP should work.</div>'; } else { $sMessage .= '<div class="error">SMTP connection to port 25 failed: ' . $sErrorS . ' (Error code: ' . $iErrN . ')</div>'; } } if ($bCheckIMAP4) { $iErrN = 0; $sErrorS = ''; $sRes = @fsockopen($sHost, 143, $iErrN, $sErrorS, 5); if (is_resource($sRes)) { @fclose($sRes); $sMessage .= '<div class="success">IMAP connection to port 143 successful, checking and downloading incoming e-mail over IMAP should work.</div>'; } else { $sMessage .= '<div class="error">IMAP connection to port 143 failed: ' . $sErrorS . ' (Error code: ' . $iErrN . ')</div>'; } } } else { $sMessage .= '<div class="error">Host is empty</div>'; } if (!empty($sMessage)) { $_SESSION['wm_install_server_test_message'] = $sMessage; } } else { if (isset($_POST['next_btn'])) { return true; } } return false; }
protected function initDbSettings() { $this->oSettings->SetConf('Common/DBType', 'PostgreSQL' === CPost::get('chSqlType') ? EDbType::PostgreSQL : EDbType::MySQL); if (CPost::Has('txtSqlLogin')) { $this->oSettings->SetConf('Common/DBLogin', CPost::get('txtSqlLogin')); } if (CPost::Has('txtSqlPassword') && API_DUMMY !== (string) CPost::get('txtSqlPassword')) { $this->oSettings->SetConf('Common/DBPassword', CPost::get('txtSqlPassword')); } if (CPost::Has('txtSqlName')) { $this->oSettings->SetConf('Common/DBName', CPost::get('txtSqlName')); } if (CPost::Has('txtSqlSrc')) { $this->oSettings->SetConf('Common/DBHost', CPost::get('txtSqlSrc')); } if (CPost::Has('prefixString')) { $this->oSettings->SetConf('Common/DBPrefix', CPost::get('prefixString')); } $this->oSettings->SaveToXml(); }
protected function initUpdateDomainByPost(CDomain &$oDomain) { $oDomain->OverrideSettings = 0 < $oDomain->IdTenant ? true : CPost::GetCheckBox('chOverrideSettings'); if ($oDomain->OverrideSettings) { // Regional settings and domain branding (moved from "webmail" module) $oDomain->SiteName = CPost::Get('txtSiteName', $oDomain->SiteName); $oDomain->AllowUsersChangeInterfaceSettings = CPost::GetCheckBox('chAllowUsersAccessInterfaveSettings'); $sSelSkin = CPost::Get('selSkin', ''); if (!empty($sSelSkin)) { $aSkins = $this->oModule->GetSkinList(); if (is_array($aSkins) && in_array($sSelSkin, $aSkins)) { $oDomain->DefaultSkin = $sSelSkin; } } $sSelLanguage = CPost::Get('selLanguage', ''); if (!empty($sSelLanguage)) { $aLangs = $this->oModule->GetLangsList(); if (is_array($aLangs) && in_array($sSelLanguage, $aLangs)) { $oDomain->DefaultLanguage = $sSelLanguage; } } $sSelTimeZone = CPost::Get('selTimeZone', null); if (null !== $sSelTimeZone) { $aTimeZones = $this->oModule->GetTimeZoneList(); if (is_array($aTimeZones) && isset($aTimeZones[(int) $sSelTimeZone])) { $oDomain->DefaultTimeZone = $sSelTimeZone; } } if (CPost::Has('radioTimeFormat')) { $oDomain->DefaultTimeFormat = EnumConvert::FromPost(CPost::Get('radioTimeFormat'), 'ETimeFormat'); } if (CPost::Has('selDateformat')) { $oDomain->DefaultDateFormat = CPost::Get('selDateformat'); } } }
/** * @return void */ protected function initAuth() { $this->iAuthType = AP_SESS_AUTH_TYPE_NONE; if ((isset($_GET['login']) || isset($_POST['login'])) && (CPost::Has('AdmloginInput') || CGet::Has('AdmloginInput')) && CPost::Has('AdmpasswordInput')) { $sAdmloginInput = CPost::Get('AdmloginInput'); if (CGet::Has('AdmloginInput')) { $sAdmloginInput = CGet::Get('AdmloginInput'); } $sLoginSuffix = CPost::Get('LoginSuffix', ''); if (CGet::Has('LoginSuffix')) { $sLoginSuffix = CGet::Get('LoginSuffix', ''); } if ($this->CallModuleFunction('CCommonModule', 'AuthLogin', array($sAdmloginInput . $sLoginSuffix, CPost::Get('AdmpasswordInput')))) { CApi::Location(AP_INDEX_FILE . '?enter'); } else { CSession::Destroy(); CApi::Location(AP_INDEX_FILE . '?auth_error'); } exit; } else { if ($this->bSessionIsStarted) { $this->CallModuleFunction('CCommonModule', 'AuthCheckSet'); if ($this->IsTenantAuthType()) { $aTabs =& $this->GetTabs(); $aNewTabs = array(); foreach ($aTabs as $aTabValue) { if (in_array($aTabValue[0], array(CApi::I18N('ADMIN_PANEL/TABNAME_COMMON'), CApi::I18N('ADMIN_PANEL/TABNAME_DOMAINS'), CApi::I18N('ADMIN_PANEL/TABNAME_USERS')))) { $aNewTabs[] = $aTabValue; } } $aTabs = $aNewTabs; } } else { CSession::Destroy(); CApi::Location(AP_INDEX_FILE . '?sess_error'); exit; } } }
public function CommonSocial() { $oApiCapa = CApi::Manager('capability'); /* @var $oApiCapa CApiCapabilityManager */ if ($oApiCapa) { $oTenant = $this->oModule->GetTenantAdminObject(); if ($oTenant) { $aTenentSocials = array(); foreach ($oTenant->getSocials() 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'); $aScopes = CPost::get($sKey . '_chSocialScopes', array()); $oTenentSocial->SocialScopes = implode(' ', array_keys($aScopes)); $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; } } }
/** * @param string $sLogin * @param string $sPassword * @return bool */ public function AuthLogin($sLogin, $sPassword) { $oSettings = null; $oSettings =& CApi::GetSettings(); $sDemoLogin = CApi::GetConf('demo.adminpanel.login', ''); $sLogin = trim($sLogin); $sPassword = trim($sPassword); if (empty($sLogin) || empty($sPassword)) { return false; } if ($oSettings->GetConf('Common/AdminLogin') === $sLogin && $this->oWebmailApi->validateAdminPassword($sPassword)) { $this->setAdminAccessType(AP_SESS_AUTH_TYPE_SUPER_ADMIN); return true; } else { if (CApi::GetConf('demo.adminpanel.enable', false) && 0 < strlen($sDemoLogin) && $sDemoLogin === CPost::get('AdmloginInput')) { $this->setAdminAccessType(AP_SESS_AUTH_TYPE_SUPER_ADMIN_ONLYREAD); return true; } else { if ($this->oAdminPanel->PType() && $this->oAdminPanel->RType()) { $iTenantId = $this->oAdminPanel->CallModuleFunction('CProModule', 'GetTenantIdByLoginPassword', array($sLogin, $sPassword)); if (0 < $iTenantId) { $oTenant = $this->oAdminPanel->CallModuleFunction('CProModule', 'getTenantById', array($iTenantId)); if ($oTenant) { /* @var $oTenant CTenant */ if (0 < $oTenant->Expared && $oTenant->Expared < \time()) { $sDesc = '<div style="display: block; margin: 0px auto; font: 11pt Verdana,sans-serif; width: 340px; padding: 20px; color: #777;">'; $sDesc .= '<h2 style="color: #D35A5A; font-weight: normal; font-size: 16pt;">' . CAPi::I18N('ADMIN_PANEL/YOUR_SUBSCRIPTION_IS_EXPIRED') . '</h2>'; if (0 < strlen($oTenant->PayUrl)) { $sDesc .= '<p>' . CAPi::I18N('ADMIN_PANEL/TO_RENEW_FOLLOW_LINK') . ' <a target="_blank" href="' . ap_Utils::AttributeQuote($oTenant->PayUrl) . '">' . $oTenant->PayUrl . '</a></p>'; } $sDesc .= '</div>'; CSession::Set('SESSION_LOGIN_WARNING', $sDesc); return true; } $this->setAdminAccessType(AP_SESS_AUTH_TYPE_TENANT); $this->setTenantAccessId($iTenantId); return true; } } } } } return false; }
/** * @return void */ public function InitAjaxAction($sPostName, $sTab, &$sMessage, &$sError, &$sRef) { if ($this->oTableAjaxAction && $this->IsInTab($sTab)) { $sQueryAction = CPost::Get('QueryAction', ''); $sAjaxActionFunction = ucfirst($sTab) . ucfirst($sQueryAction) . (empty($sPostName) ? '' : '_' . $sPostName); if (method_exists($this->oTableAjaxAction, $sAjaxActionFunction)) { CApi::Log('call ' . get_class($this) . '->TableAjaxAction->' . $sAjaxActionFunction . '()'); $this->oTableAjaxAction->{$sAjaxActionFunction}(); if (!empty($this->oTableAjaxAction->LastError)) { $sError = $this->oTableAjaxAction->LastError; } else { if (!empty($this->oTableAjaxAction->LastMessage)) { $sMessage = $this->oTableAjaxAction->LastMessage; } } if (!empty($this->oTableAjaxAction->Ref)) { $sRef = $this->oTableAjaxAction->Ref; } if (!empty($sError)) { CApi::Log('function ' . $sAjaxActionFunction . '() return $sError = ' . $sError, ELogLevel::Error); } } } }
{ $_POST[$sKey] = $mValue; } /** * @param mixed $mValue * @return mixed */ private static function _stripSlashesValue($mValue) { if (!self::$bIsMagicQuotesOn) { return $mValue; } $sType = gettype($mValue); if ($sType === 'string') { return stripslashes($mValue); } else { if ($sType === 'array') { $aReturnValue = array(); $mValueKeys = array_keys($mValue); foreach ($mValueKeys as $sKey) { $aReturnValue[$sKey] = self::_stripSlashesValue($mValue[$sKey]); } return $aReturnValue; } else { return $mValue; } } } } CPost::$bIsMagicQuotesOn = (bool) ini_get('magic_quotes_gpc');
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; } } }