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


PHP Default_Model_Users::addOrUpdateSettingsData方法代码示例

本文整理汇总了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;
        }
    }
开发者ID:rajbrt,项目名称:sentrifugo,代码行数:85,代码来源:DashboardController.php


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