/** * 保存成员信息 */ function actionSave() { __TRY(); $this->_modelMembers->saveMember($_POST); $ex = __CATCH(); if (__IS_EXCEPTION($ex)) { return $this->_editMember($_POST, $ex->getMessage()); } js_alert(_T('ui_m_member_success'), '', $this->_url('index')); }
/** * 写入指定 id 的 session 数据 * * @param string $sessid * @param string $data * * @return boolean */ function sessionWrite($sessid, $data) { $sessid = $this->dbo->qstr($sessid); $sql = "SELECT COUNT(*) FROM {$this->tableName} WHERE {$this->fieldId} = {$sessid}"; $data = $this->dbo->qstr($data); $activity = time(); $fields = (array) $this->_beforeWrite($sessid); if ((int) $this->dbo->getOne($sql) > 0) { $sql = "UPDATE {$this->tableName} SET {$this->fieldData} = {$data}, {$this->fieldActivity} = {$activity}"; if (!empty($fields)) { $arr = array(); foreach ($fields as $field => $value) { $arr[] = $this->dbo->qfield($field) . ' = ' . $this->dbo->qstr($value); } $sql .= ', ' . implode(', ', $arr); } $sql .= " WHERE {$this->fieldId} = {$sessid}"; } else { $extraFields = ''; $extraValues = ''; if (!empty($fields)) { foreach ($fields as $field => $value) { $extraFields .= ', ' . $this->dbo->qfield($field); $extraValues .= ', ' . $this->dbo->qstr($value); } } $sql = "INSERT INTO {$this->tableName} ({$this->fieldId}, {$this->fieldData}, {$this->fieldActivity}{$extraFields}) VALUES ({$sessid}, {$data}, {$activity}{$extraValues})"; } __TRY(); $this->dbo->execute($sql); $ex = __CATCH(); return !__IS_EXCEPTION($ex); }
/** * 保存帖子 */ function actionSave() { $post = array('post_id' => $_POST['post_id'], 'title' => $_POST['title'], 'body' => strip_tags($_POST['body'])); __TRY(); $this->_modelPosts->savePost($post); $ex = __CATCH(); if (__IS_EXCEPTION($ex)) { return $this->_editComment($post, $ex->getMessage()); } js_alert(_T('ui_c_success_post'), '', $this->_url('index')); }
/** * 处理图片上传 */ function _uploadPicture($memberid, $imgfile, $pictureType) { $uploader =& FLEA::getSingleton('FLEA_Helper_FileUploader'); /* @var $uploader FLEA_Helper_FileUploader */ // 检查上传文件是否存在 if (!$uploader->isFileExist($imgfile)) { $errorMessage = _T('ui_p_upload_failed'); return; } // 检查文件扩展名是否是允许上传的类型 $file =& $uploader->getFile($imgfile); if (!$file->check(FLEA::getAppInf('imageFileExts'))) { $errorMessage = _T('ui_p_invalid_filetype'); return; } $member = $this->getMember($memberid, false); if (!$member) { FLEA::loadClass('Exception_DataNotFound'); __THROW(new Exception_DataNotFound($memberid)); return false; } // 上传图像 if ($pictureType == 'headimage') { $this->_uploadThumb($member, $file); } else { $this->_uploadPhoto($member, $file); } $ex = __CATCH(); if (__IS_EXCEPTION($ex)) { $errorMessage = $ex->getMessage(); return; } }
/** * 保存帖子 */ function actionSave() { __TRY(); $this->_modelProjects->saveProject($_POST); $ex = __CATCH(); if (__IS_EXCEPTION($ex)) { return $this->_editProject($post, $ex->getMessage()); } js_alert(_T('ui_c_success_post'), '', $this->_url('index')); }