本文整理汇总了PHP中Default_Model_Users::addOrUpdateSettingsData方法的典型用法代码示例。如果您正苦于以下问题:PHP Default_Model_Users::addOrUpdateSettingsData方法的具体用法?PHP Default_Model_Users::addOrUpdateSettingsData怎么用?PHP Default_Model_Users::addOrUpdateSettingsData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Default_Model_Users
的用法示例。
在下文中一共展示了Default_Model_Users::addOrUpdateSettingsData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_email_settings
public function save_email_settings($form)
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
$loginuserGroup = $auth->getStorage()->read()->group_id;
$loginuserName = $auth->getStorage()->read()->userfullname;
}
$msgarray = array();
$errorflag = 'true';
if (extension_loaded('openssl')) {
$errorflag = 'true';
} else {
$msgarray['tls'] = 'Openssl is not configured';
$errorflag = 'false';
}
if ($form->isValid($this->_request->getPost()) && $errorflag == 'true') {
$id = $this->_request->getParam('id');
$username = $this->_request->getParam('username');
$password = $this->_request->getParam('password');
$server_name = $this->_request->getParam('server_name');
$tls = $this->_request->getParam('tls');
$auth = $this->_request->getParam('auth');
$port = $this->_request->getParam('port');
$usersModel = new Default_Model_Users();
$options = array();
if ($auth == 1) {
$auth = 'crammd5';
} else {
if ($auth == 2) {
$auth = 'login';
} else {
if ($auth == 3) {
$auth = 'plain';
} else {
$auth = 'crammd5';
}
}
}
$options['username'] = $username;
$options['password'] = $password;
$options['server_name'] = $server_name;
$options['tls'] = $tls;
$options['auth'] = $auth;
$options['port'] = $port;
$options['subject'] = 'Test Mail Checking';
$options['header'] = 'Test Mail';
$options['fromEmail'] = DONOTREPLYEMAIL;
$options['fromName'] = DONOTREPLYNAME;
$options['toEmail'] = SUPERADMIN_EMAIL;
$options['toName'] = $loginuserName;
$options['message'] = '<div>
<div>Hi ' . ucfirst($loginuserName) . ',</div><br/>
<div>This is a test email to check the new mail settings provided for ' . APPLICATION_NAME . '.</div></div>';
$result = sapp_Mail::_checkMail($options);
if ($result == 'success') {
$data = array('username' => $username, 'password' => $password, 'server_name' => $server_name, 'auth' => $auth, 'tls' => $tls, 'port' => $port, 'modifieddate' => gmdate("Y-m-d H:i:s"));
if ($id != '') {
$where = array('id=?' => $id);
} else {
$data['createddate'] = gmdate("Y-m-d H:i:s");
$where = '';
}
$Id = $usersModel->addOrUpdateSettingsData($data, $where);
sapp_Global::writeEMailSettingsconstants($tls, $auth, $port, $username, $password, $server_name);
if ($Id == 'update') {
$this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Mail Settings updated successfully."));
} else {
$this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Mail Settings added successfully."));
}
} else {
$this->_helper->getHelper("FlashMessenger")->addMessage(array("error" => "Invalid parameters."));
}
$this->_redirect('dashboard/emailsettings');
} else {
$messages = $form->getMessages();
foreach ($messages as $key => $val) {
foreach ($val as $key2 => $val2) {
$msgarray[$key] = $val2;
break;
}
}
return $msgarray;
}
}