public function addResponse() { $db = new ResponseModel(); import("ORG.Util.Input"); $rs['w_id'] = $_POST['w_id']; $rs['r_text'] = Input::forShow($_POST['r_text']); $rs['r_time'] = date('Y-m-d H:i:s'); $rs['r_ip'] = $_SESSION['user_ip']; if (empty($_SESSION['userName'])) { $rs['flag'] = 0; } else { $rs['flag'] = 1; } if (strlen($rs['r_text']) > 300) { //判断提交的内容是否超过100个汉字 $s = floor((strlen($rs['r_text']) - 300) / 3); $_SESSION['r_text'] = $rs['r_text']; $this->gError("你的评论超出了" . $s . "个汉字,", "__URL__/viewWorlds?id=" . $rs['w_id']); } elseif ($db->add($rs)) { //判断是否添加成功 $this->gSuccess("你的评论“" . $rs['r_text'] . "“发表成功!", "__URL__/viewWorlds?id=" . $rs['w_id']); } else { $this->gError("呃,服务器开小差了~~~稍后再试,", "__URL__/viewWorlds?id=" . $rs['w_id']); } }
protected function _initialize() { parent::_initialize(); $this->Config = D("Config"); import('Form'); if (false == IS_POST) { $config = $this->Config->select(); foreach ($config as $key => $r) { $config[$r['varname']] = Input::forShow($r['value']); } $this->assign('Site', $config); } }
public function save() { //引入input类,过滤用户输入 import("ORG.Util.Input"); $db = new LinksModel(); //接收处理传递到的数据 $data = array('worlds' => str_replace('\\', '', str_replace(""", '', Input::forShow($_POST['linkWorlds']))), 'www_url' => $_POST['wwwUrl'], 'wap_url' => $_POST['wapUrl'], 'email' => $_POST['email'], 'date' => date("Y-m-d H:i:s"), 'sort' => 1 + $db->max('sort'), 'pass_flag' => 1); //错误判读 if ($data['worlds'] == '' or $data['www_url'] == '' or $data['email'] == '') { $this->ajaxReturn(0, '请将表单填写完整后提交,如果你禁用了javascript,请开启!', 0); } elseif (!$db->add($data)) { $this->ajaxReturn(0, '(⊙o⊙)…服务器开小差了。', 0); } else { $this->ajaxReturn(1, '添加成功!审核通过后会将此链接显示在首页.', 1); } }
/** * 附件参数 */ public function attach() { if (IS_POST) { $this->dosite(); } else { $config = $this->Config->select(); foreach ($config as $key => $r) { if ($r['groupid'] == 1) { $this->user_config[$r['varname']] = Input::forShow($r['value']); } if ($r['groupid'] == 2) { $this->site_config[$r['varname']] = Input::forShow($r['value']); } } $this->assign('Site', $this->site_config); $this->display(); } }