if (!empty($rid)) { $result = pdo_update('rule', $rule, array('id' => $rid)); } else { $result = pdo_insert('rule', $rule); $rid = pdo_insertid(); } if (!empty($rid)) { $sql = 'DELETE FROM ' . tablename('rule_keyword') . ' WHERE `rid`=:rid AND `uniacid`=:uniacid'; $pars = array(); $pars[':rid'] = $rid; $pars[':uniacid'] = $_W['uniacid']; pdo_query($sql, $pars); $rowtpl = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'module' => $rule['module'], 'status' => $rule['status'], 'displayorder' => $rule['displayorder']); foreach ($keywords as $kw) { $krow = $rowtpl; $krow['type'] = range_limit($kw['type'], 1, 4); $krow['content'] = $kw['content']; pdo_insert('rule_keyword', $krow); } $rowtpl['incontent'] = $_GPC['incontent']; $module->fieldsFormSubmit($rid); message('回复规则保存成功!', url('platform/reply/post', array('m' => $m, 'rid' => $rid))); } else { message('回复规则保存失败, 请联系网站管理员!'); } } template('platform/reply-post'); } if ($do == 'delete') { $rid = intval($_GPC['rid']); if (empty($rid)) {
public function doWebPost() { global $_W, $_GPC; $reid = intval($_GPC['id']); $hasData = false; if ($reid) { $sql = 'SELECT COUNT(*) FROM ' . tablename('research_rows') . ' WHERE `reid`=' . $reid; if (pdo_fetchcolumn($sql) > 0) { $hasData = true; } } if (checksubmit()) { $record = array(); $record['title'] = trim($_GPC['activity']); $record['weid'] = $_W['uniacid']; $record['description'] = trim($_GPC['description']); $record['content'] = trim($_GPC['content']); $record['information'] = trim($_GPC['information']); if (!empty($_GPC['thumb'])) { $record['thumb'] = $_GPC['thumb']; load()->func('file'); file_delete($_GPC['thumb-old']); } $record['status'] = intval($_GPC['status']); $record['inhome'] = intval($_GPC['inhome']); $record['pretotal'] = intval($_GPC['pretotal']); $record['alltotal'] = intval($_GPC['alltotal']); $record['starttime'] = strtotime($_GPC['starttime']); $record['endtime'] = strtotime($_GPC['endtime']); $record['noticeemail'] = trim($_GPC['noticeemail']); if (is_numeric($_GPC['mobile'])) { $record['mobile'] = trim($_GPC['mobile']); } if (empty($reid)) { $record['status'] = 1; $record['createtime'] = TIMESTAMP; pdo_insert('research', $record); $reid = pdo_insertid(); if (!$reid) { message('保存预约失败, 请稍后重试.'); } } else { if (pdo_update('research', $record, array('reid' => $reid)) === false) { message('保存预约失败, 请稍后重试.'); } } if (!$hasData) { $sql = 'DELETE FROM ' . tablename('research_fields') . ' WHERE `reid`=:reid'; $params = array(); $params[':reid'] = $reid; pdo_query($sql, $params); foreach ($_GPC['title'] as $k => $v) { $field = array(); $field['reid'] = $reid; $field['title'] = trim($v); $field['displayorder'] = range_limit($_GPC['displayorder'][$k], 0, 254); $field['type'] = $_GPC['type'][$k]; $field['essential'] = $_GPC['essentialvalue'][$k] == 'true' ? 1 : 0; $field['bind'] = $_GPC['bind'][$k]; $field['value'] = urldecode($_GPC['value'][$k]); $field['description'] = urldecode($_GPC['desc'][$k]); pdo_insert('research_fields', $field); } } message('保存预约成功.', 'refresh'); } $types = array(); $types['number'] = '数字(number)'; $types['text'] = '字串(text)'; $types['textarea'] = '文本(textarea)'; $types['radio'] = '单选(radio)'; $types['checkbox'] = '多选(checkbox)'; $types['select'] = '选择(select)'; $types['calendar'] = '日历(calendar)'; $types['email'] = '电子邮件(email)'; $types['image'] = '上传图片(image)'; $types['range'] = '日期范围(range)'; $types['reside'] = '居住地(reside)'; $fields = fans_fields(); if ($reid) { $sql = 'SELECT * FROM ' . tablename('research') . ' WHERE `weid`=:weid AND `reid`=:reid'; $params = array(); $params[':weid'] = $_W['uniacid']; $params[':reid'] = $reid; $activity = pdo_fetch($sql, $params); $activity['starttime'] && ($activity['starttime'] = date($activity['starttime'])); $activity['endtime'] && ($activity['endtime'] = date($activity['endtime'])); if ($activity) { $sql = 'SELECT * FROM ' . tablename('research_fields') . ' WHERE `reid`=:reid ORDER BY `refid`'; $params = array(); $params[':reid'] = $reid; $ds = pdo_fetchall($sql, $params); } } if (empty($activity['endtime'])) { $activity['endtime'] = date(time() + 86400); } include $this->template('post'); }