function reviewofs_report($pid, $encounter, $cols, $id) { $count = 0; $data = formFetch("form_reviewofs", $id); if ($data) { print "<table><tr>"; foreach ($data as $key => $value) { if ($key == "id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $value == "0000-00-00 00:00:00") { continue; } if ($value == "on") { $value = "yes"; } $key = ucwords(str_replace("_", " ", $key)); //modified by BM 07-2009 for internationalization if ($key == "Additional Notes") { print "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . text($value) . "</span></td>"; } else { print "<td><span class=bold>" . xl($key) . ": </span><span class=text>" . xl($value) . "</span></td>"; } $count++; if ($count == $cols) { $count = 0; print "</tr><tr>\n"; } } } print "</tr></table>"; }
public function apply() { $xtime = strtotime("-1 month"); $vo = M('member_apply')->field('apply_status')->where("uid={$this->uid}")->order("id DESC")->find(); $xcount = M('member_apply')->field('add_time')->where("uid={$this->uid} AND add_time>{$xtime}")->order("id DESC")->find(); if (is_array($vo) && $vo['apply_status'] == 0) { $xs = "是您的申请正在审核,请等待此次审核结束再提交新的申请"; ajaxmsg($xs, 0); } elseif (is_array($xcount)) { $timex = date("Y-m-d", $xcount['add_time']); $xs = "一个月内只能进行一次额度申请,您已在{$timex}申请过了,如急需额度,请直接联系客服"; ajaxmsg($xs, 0); } else { $apply['uid'] = $this->uid; $apply['apply_type'] = intval($_POST['apply_type']); $apply['apply_money'] = floatval($_POST['apply_money']); $apply['apply_info'] = text($_POST['apply_info']); $apply['add_time'] = time(); $apply['apply_status'] = 0; $apply['add_ip'] = get_client_ip(); $nid = M('member_apply')->add($apply); } if ($nid) { ajaxmsg('申请已提交,请等待审核'); } else { ajaxmsg('申请提交失败,请重试', 0); } }
public function savetip() { $duration = explode(",", text($_POST['loancycle'])); $data['uid'] = $this->uid; $data['account_money'] = floatval($_POST['miniamount']); $data['borrow_type'] = intval($_POST['borrowkind']); $data['interest_rate'] = intval($_POST['interestrates']); $data['duration_from'] = intval($duration[0]); $data['duration_to'] = intval($duration[1]); $c = M('borrow_tip')->field('id')->where("uid={$this->uid}")->find(); if (is_array($c)) { $data['id'] = $c['id']; $newid = M('borrow_tip')->save($data); if ($newid) { ajaxmsg("修改成功", 1); } else { ajaxmsg("修改失败,请重试", 0); } } else { $newid = M('borrow_tip')->add($data); if ($newid) { ajaxmsg("添加成功", 1); } else { ajaxmsg("添加失败,请重试", 0); } } }
public function savelong() { $x = M('members')->field("time_limit,user_leve")->find($this->uid); $x['time_limit'] > 0 && $x['user_leve'] == 1 ? $is_vip = 1 : ($is_vip = 0); intval($_POST['tendAmount']) == 0 && $is_vip == 1 ? $is_full = 1 : ($is_full = 0); $duration = explode(",", text($_POST['loancycle'])); $data['uid'] = $this->uid; $data['account_money'] = floatval($_POST['miniamount']); $data['borrow_type'] = intval($_POST['borrowtype']); $data['interest_rate'] = intval($_POST['interest']); $data['duration_from'] = intval($duration[0]); $data['end_time'] = strtotime($_POST['expireddate'] . " 00:00:00"); $data['duration_to'] = intval($duration[1]); $data['is_auto_full'] = $is_full; $data['invest_money'] = floatval($_POST['tendAmount']); $data['add_ip'] = get_client_ip(); $data['add_time'] = time(); $c = M('auto_borrow')->field('id')->where("uid={$this->uid} AND borrow_type={$data['borrow_type']}")->find(); if (is_array($c)) { $data['id'] = $c['id']; $newid = M('auto_borrow')->save($data); if ($newid) { ajaxmsg("修改成功", 1); } else { ajaxmsg("修改失败,请重试", 0); } } else { $newid = M('auto_borrow')->add($data); if ($newid) { ajaxmsg("添加成功", 1); } else { ajaxmsg("添加失败,请重试", 0); } } }
/** * @desc 文本自动回复 * @return string */ public function text() { $keyword = trim($this->_postObj->Content); switch ($keyword) { case '': echo text($this->_postObj, '你什么意思?'); break; case '你好!': echo text($this->_postObj, '你好呀!'); break; case 'hello': echo text($this->_postObj, 'Hi!!'); break; case 'Hi': echo text($this->_postObj, 'Oh!'); break; case '换行': echo text($this->_postObj, '这是第一行!' . "\n" . '我是第二行!'); break; case '多图文': $array = [['Title' => '多图文一', 'Description' => '第一个文本内容', 'PicUrl' => 'http://7xqoks.com1.z0.glb.clouddn.com/1455679468779.jpg', 'Url' => 'http://www.goto318.com'], ['Title' => '多图文二', 'Description' => '第二个文本内容', 'PicUrl' => 'http://7xqoks.com1.z0.glb.clouddn.com/10.jpg', 'Url' => 'http://www.goto318.com']]; echo images($this->_postObj, $array); default: echo text($this->_postObj, '/::)'); break; } }
public function getLinkContent() { require_once './ThinkPHP/Library/Vendor/Collection/phpQuery.php'; $link = op_t(I('post.url')); $content = get_content_by_url($link); $charset = preg_match("/<meta.+?charset=[^\\w]?([-\\w]+)/i", $content, $temp) ? strtolower($temp[1]) : "utf-8"; \phpQuery::$defaultCharset = $charset; \phpQuery::newDocument($content); $title = pq("meta[name='title']")->attr('content'); if (empty($title)) { $title = pq("title")->html(); } $title = iconv($charset, "UTF-8", $title); $keywords = pq("meta[name='keywords'],meta[name='Keywords']")->attr('content'); $description = pq("meta[name='description'],meta[name='Description']")->attr('content'); $url = parse_url($link); $img = pq("img")->eq(0)->attr('src'); if (is_bool(strpos($img, 'http://'))) { $img = 'http://' . $url['host'] . $img; } $title = text($title); $description = text($description); $keywords = text($keywords); $return['title'] = $title; $return['img'] = $img; $return['description'] = empty($description) ? $title : $description; $return['keywords'] = empty($keywords) ? $title : $keywords; exit(json_encode($return)); }
/** * 文件上传保存 * @author MaWei (http://www.phpyrb.com) * @date 2014-10-19 下午2:33:29 */ function upload() { $_FILES['file']['name']; $data = array(); dump($this->mid); $data['uid'] = $this->mid; $data['title'] = text($_REQUEST['title']); $data['cateid'] = intval($_REQUEST['cateid']); $data['type'] = intval($_REQUEST['sourctype']); $data['grade'] = intval($_REQUEST['grade']); $data['keyword'] = text($_REQUEST['keyword']); $data['discription'] = text($_REQUEST['discription']); $data['uptime'] = time(); $reid = add_updata($data, 'Sourc'); if ($reid) { $attach = array(); $file = fileUpload(); $attach['sourc_id'] = $reid; $attach['name'] = $file['name']; $attach['path'] = $file['path']; $attach['size'] = $file['size']; $attach['hash'] = $file['hash']; $reid = add_updata($attach, 'SourcAttach'); } dump($reid); }
public function parseExtra(&$extra = array()) { $extra['title'] = text($extra['title']); $extra['description'] = text($extra['description']); $extra['keywords'] = text($extra['keywords']); return $extra; }
function note_report($pid, $encounter, $cols, $id) { $count = 0; $data = formFetch("form_note", $id); if ($data) { print "<table><tr>"; foreach ($data as $key => $value) { if ($key == "id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $value == "0000-00-00 00:00:00") { continue; } if ($value == "on") { $value = "yes"; } $key = ucwords(str_replace("_", " ", $key)); print "<tr>\n"; print "<tr>\n"; if ($key == "Note Type") { print "<td><span class=bold>" . xlt($key) . ": </span><span class=text>" . xlt($value) . "</span></td>"; } else { print "<td><span class=bold>" . xlt($key) . ": </span><span class=text>" . text($value) . "</span></td>"; } $count++; if ($count == $cols) { $count = 0; print "</tr><tr>\n"; } } } print "</tr></table>"; }
/** * 会员添加修改数据库操作 * @author MaWei (http://www.phpyrb.com) * @date 2014-8-4 下午3:23:27 */ function addupdata() { $data = array(); $_REQUEST['id'] && ($data['id'] = intval($_REQUEST['id'])); $data['uname'] = text($_REQUEST['name']); $data['email'] = text($_REQUEST['email']); $_REQUEST['passwd'] && ($data['passwd'] = sha1_encrypt(text($_REQUEST['passwd']))); $data['home'] = text($_REQUEST['home']); $data['status'] = intval($_REQUEST['status']); $data['qq'] = intval($_REQUEST['qq']); $data['sex'] = intval($_REQUEST['sex']); if ($_FILES['file']['name']) { $avatar = uploads(array('path' => 'avatar', 'ImgWidth' => 150, 'ImgHeight' => 150), true); $data['avatar'] = $avatar['thumb']; } $data['lasttime'] = time(); empty($_REQUEST['uid']) && ($data['registertime'] = time()); $data['lastip'] = get_client_ip(); $reid = add_updata($data, 'Member'); if ($reid === false) { $this->error('保存失败!', U('Admin/Member/index')); } else { $this->success('保存成功!', U('Admin/Member/index')); } }
public function bindbank() { $bank_info = M('member_banks')->field("uid, bank_num")->where("uid=" . $this->uid)->find(); !$bank_info['uid'] && ($data['uid'] = $this->uid); $data['bank_num'] = text($_POST['account']); $data['bank_name'] = text($_POST['bankname']); $data['bank_address'] = text($_POST['bankaddress']); $data['bank_province'] = text($_POST['province']); $data['bank_city'] = text($_POST['cityName']); $data['add_ip'] = get_client_ip(); $data['add_time'] = time(); if ($bank_info['uid']) { /////////////////////新增银行卡修改锁定开关 开始 20130510 fans/////////////////////////// if (intval($this->glo['edit_bank']) != 1 && $bank_info['bank_num']) { ajaxmsg("为了您的帐户资金安全,银行卡已锁定,如需修改,请联系客服", 0); } /////////////////////新增银行卡修改锁定开关 结束 20130510 fans/////////////////////////// $old = text($_POST['oldaccount']); if ($bank_info['bank_num'] && $old != $bank_info['bank_num']) { ajaxmsg('原银卡号不对', 0); } $newid = M('member_banks')->where("uid=" . $this->uid)->save($data); } else { $newid = M('member_banks')->add($data); } if ($newid) { MTip('chk2', $this->uid); ajaxmsg(); } else { ajaxmsg('操作失败,请重试', 0); } }
function misc_billing_options_report($pid, $encounter, $cols, $id) { $count = 0; $data = formFetch("form_misc_billing_options", $id); if ($data) { print "<table><tr>"; foreach ($data as $key => $value) { if ($key == "id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $value == "0" || $value == "0000-00-00 00:00:00" || $value == "0000-00-00") { continue; } if ($value == "1") { $value = "yes"; } if ($key === 'box_14_date_qual' || $key === 'box_15_date_qual') { $value = text(qual_id_to_description($key, $value)); } if ($key === 'provider_id') { $trow = sqlQuery("SELECT id, lname, fname FROM users WHERE " . "id = ? ", array($value)); $value = $trow['fname'] . ' ' . $trow['lname']; } $key = ucwords(str_replace("_", " ", $key)); print "<td><span class=bold>{$key}: </span><span class=text>" . text($value) . "</span></td>"; $count++; if ($count == $cols) { $count = 0; print "</tr><tr>\n"; } } } print "</tr></table>"; }
public function doEdit() { $data['user_name'] = text($_POST['user_name']); $data['user_id'] = M('members')->getFieldByUser_name($data['user_name'], "id"); if (!$data['user_id']) { $this->error("找不到你要备注的会员"); } $data['remark'] = text($_POST['remark']); if (!$data['remark']) { $this->error("备注信息不可为空"); } $data['admin_id'] = $_SESSION['admin_id']; $data['admin_real_name'] = $_SESSION['admin_user_name']; $data['add_time'] = time(); $newid = M('member_remark')->add($data); if ($newid) { alogs("Remark", $newid, 1, '成功执行了备注信息的添加操作!'); //管理员操作日志 $this->success("添加成功"); } else { alogs("Remark", $newid, 0, '执行备注信息的添加操作失败!'); //管理员操作日志 $this->error("添加失败"); } }
function misc_billing_options_report($pid, $encounter, $cols, $id) { $count = 0; $data = formFetch("form_misc_billing_options", $id); if ($data) { print "<table><tr>"; foreach ($data as $key => $value) { if ($key == "id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $value == "0" || $value == "0000-00-00 00:00:00" || $value == "0000-00-00") { continue; } if ($value == "1") { $value = "yes"; } if ($key === 'box_14_date_qual' || $key === 'box_15_date_qual') { $value = text(qual_id_to_description($key, $value)); } $key = ucwords(str_replace("_", " ", $key)); print "<td><span class=bold>{$key}: </span><span class=text>{$value}</span></td>"; $count++; if ($count == $cols) { $count = 0; print "</tr><tr>\n"; } } } print "</tr></table>"; }
public function doAdd() { $udata['user_name'] = text($_POST['user_name']); $cs = M('members')->where($udata)->count('id'); if ($cs > 0) { $this->error("添加失败,此用户名已被占用,请重试"); exit; } if (empty($udata['user_name'])) { $this->error("用户名不能为空,请重试"); exit; } $udata['is_transfer'] = 1; $udata['reg_ip'] = get_client_ip(); $udata['user_leve'] = 1; $udata['time_limit'] = time() + 24 * 3600 * 365; $udata['user_pass'] = md5(time() . rand(10, 99)); $udata['reg_time'] = strtotime($_POST['reg_time'] . " " . date("H:i:s", time())); $newid = M('members')->add($udata); if ($newid) { $idata['uid'] = $newid; $idata['address'] = text($_POST['address']); $idata['info'] = text($_POST['info']); M('member_info')->add($idata); $this->success("添加成功"); } else { $this->error("添加失败,请重试"); } $this->display(); }
/** * Adapt text to be suitable as the contents of a table cell. * * @param string $s Input text. * @return string Output text. */ function myCellText($s) { if ($s === '') { return ' '; } return text($s); }
function customerFields($data, $badFields) { global $states; global $COUNTRIES; if (userLoggedIn() && array_key_exists("CID", $data) && $data["CID"] != "") { tableRow(array(tableData(prompt("<b>CID:</b>"), "right", "top"), tableData(prompt($data["CID"]), "left", "top"))); prepDatePicker(); tableRow(array(tableData(prompt("<b>Met Date:</b>"), "right", "top"), tableData(text($data, "metDate", "", "", "datepicker"), "left", "middle"))); } tableRow(array(tableData(prompt("<b>First name*:</b>", in_array("fname", $badFields)), "right"), tableData(text($data, "fname"), "left", "middle"), tableData(prompt("<b>Last name*:</b>", in_array("lname", $badFields)), "right"), tableData(text($data, "lname"), "left", "middle"))); tableRow(array(tableData(prompt("<b>Email*:</b>", in_array("email", $badFields)), "right"), tableData(text($data, "email"), "left", "middle"), tableData(prompt("<b>Phone Number:</b>", in_array("phoneNum", $badFields)), "right"), tableData(text($data, "phoneNum"), "left", "middle"))); tableRow(array(tableData(prompt("<b>Title:</b>", in_array("title", $badFields)), "right"), tableData(radioButton($data, "title", "Mr.", false, "Mr."), "center", "middle"), tableData(radioButton($data, "title", "Ms.", false, "Ms."), "center", "middle"), tableData(radioButton($data, "title", "Mrs.", false, "Mrs."), "center", "middle"), tableData(radioButton($data, "title", "Dr.", false, "Dr."), "center", "middle"))); if (!userLoggedIn()) { if ($data["charity"] == true) { tableRow(array(tableData(prompt("Tell us about your situtation, your team and why you need a ChapR. The more information the better!"), "middle", "top", 6))); } else { tableRow(array(tableData(prompt("Write anything else you would like us to know about you below: <br> team info (type, name, number), how you heard about us (where, from who?) etc."), "middle", "top", 6))); } } tableRow(array(tableData(prompt("<b>Comments:</b>", in_array("customerCNotes", $badFields), ""), "right", "top"), tableData(textArea($data, "customerCNotes", 3), "center", "", 5))); tableRow(array(tableData(prompt("<b>Street1*:</b>", in_array("street1", $badFields)), "right"), tableData(text($data, "street1"), "left", "middle", 3))); tableRow(array(tableData(prompt("<b>Street2:</b>", in_array("street2", $badFields)), "right"), tableData(text($data, "street2"), "left", "middle", 3))); $stateDirections = 'only applicable for domestic teams'; tableRow(array(tableData(prompt("<b>City*:</b>", in_array("city", $badFields)), "right"), tableData(text($data, "city"), "left", "middle"), tableData(prompt("<b>State*:</b>", in_array("state", $badFields), "", $stateDirections), "right"), tableData(dropDown($data, "state", $states, "--------Choose Your State-------"), "left", "middle"))); tableRow(array(tableData(prompt("<b>Zip*:</b>", in_array("zip", $badFields)), "right"), tableData(text($data, "zip"), "left", "middle"), tableData(prompt("<b>Country:</b>", in_array("country", $badFields)), "right"), tableData(dropDown($data, "country", $COUNTRIES), "left", "middle"))); if (userLoggedIn()) { tableRow(array(tableData(prompt("<b>Admin Comments:</b>", in_array("adminCNotes", $badFields), "", $commentDirections), "right", "top"), tableData(textArea($data, "adminCNotes", 3), "center", "", 5))); } tableRow(array(tableData(hiddenField("CID", $data["CID"])), tableData(hiddenField("OID", $data["OID"])))); }
public function doEdit() { $id = intval($_POST['id']); $sms_content = text($_POST['smsContent']); $smsReceiver = $_POST['smsReceiver']; if (empty($sms_content)) { $this->error("短信内容不能为空"); } $len = cnstrlen($sms_content); if ($len > 240) { $this->error("短信内容为不能超过240个汉字、字符、数字组成的字符串"); } if (empty($id)) { $ret = massSmsNotify($sms_content, $this->admin_id); if ($ret) { $this->success("添加成功"); } else { $this->error("添加失败"); } } else { $deal_flag = M('sms_content')->getFieldById($id, "deal_flag"); if ($deal_flag == 1) { $this->error("已被处理过的记录无法更改短信内容"); } M('sms_content')->where(array("id" => $id))->save(array("sms_content" => $sms_content)); $this->success("修改成功"); } }
public function doAddMul() { $mul_type = explode(",", $_POST['type_name']); $mul_nid = explode(",", $_POST['type_nid']); $Type = D("Aacategory"); foreach ($mul_type as $key => $v) { $data = array(); $data['type_name'] = $v; $data['type_nid'] = $mul_nid[$key]; $data['parent_id'] = intval($_POST['parent_id']); $data['type_set'] = intval($_POST['type_set']); $data['is_hiden'] = intval($_POST['is_hiden']); $data['type_url'] = text($_POST['type_url']); $data['area_id'] = session("admin_area_id"); $newid = $Type->add($data); } if ($newid) { alogs("Aacategory", $newid, 1, '栏目批量添加成功!'); //管理员操作日志 $this->success("栏目批量添加成功"); } else { alogs("Aacategory", $newid, 0, '栏目批量添加失败!'); //管理员操作日志 $this->error("添加失败"); } }
/** * 会员注册 * @author MaWei (http://www.phpyrb.com) * @date 2014-10-6 下午3:28:30 */ function register() { $data = array(); $data['uname'] = text($_REQUEST['name']); $data['passwd'] = text($_REQUEST['passwd']); $data['email'] = text($_REQUEST['email']); $data['status'] = 1; $data['sex'] = 3; $data['lasttime'] = $data['registertime'] = time(); $data['lastip'] = get_client_ip(); //检测用户名 if ($this->member->checkname($data['uname'])) { echo json_encode(array('status' => null, 'msg' => '用户名已存在')); exit; } //检测邮箱 if ($this->member->checkemail($data['email'])) { echo json_encode(array('status' => null, 'msg' => '邮箱已存在')); exit; } $data['passwd'] = $this->member->encrypt($data['passwd']); $reid = add_updata($data, 'Member'); if ($reid === false) { echo json_encode(array('status' => -1, 'msg' => '非常抱歉,由于网络原因!注册失败!')); } else { echo json_encode(array('status' => 1, 'msg' => '恭喜您!注册成功!')); } }
public function save() { if ($_SESSION['verify'] != md5($_POST['txt_check'])) { $this->error('验证码错误'); } $_POST = textPost($_POST); $model = M('feedback'); if (false === $model->create()) { $this->error($model->getError()); } unset($model->status); $model->msg = "借款金额:" . text($_POST['money']) . " " . $model->msg; $model->add_time = time(); $model->ip = get_client_ip(); //保存当前数据对象 if ($result = $model->add()) { //保存成功 //成功提示 $this->assign('jumpUrl', __APP__ . "/"); $this->success('反馈成功'); } else { //失败提示 $this->error('反馈失败,请重试'); } }
public function bindbank() { $oldaccount = M('member_banks')->getFieldByUid($this->uid, 'bank_num'); $data['uid'] = $this->uid; $data['bank_num'] = text($_POST['account']); $data['bank_name'] = text($_POST['bankname']); $data['bank_address'] = text($_POST['bankaddress']); $data['bank_province'] = text($_POST['province']); $data['bank_city'] = text($_POST['cityName']); $data['add_ip'] = get_client_ip(); $data['add_time'] = time(); //短信校验 $smscode = text($_POST['smscode']); if (!is_verify($this->uid, $smscode, 11, 10 * 60)) { ajaxmsg('短信验证码不对,请重新输入!', 0); } if ($oldaccount) { $old = text($_POST['oldaccount']); if ($old != $oldaccount) { ajaxmsg('原银卡号不对', 0); } $newid = M('member_banks')->save($data); } else { $newid = M('member_banks')->add($data); } if ($newid) { MTip('chk2', $this->uid); ajaxmsg(); } else { ajaxmsg('操作失败,请重试', 0); } }
public function doEdit() { $vd = M('member_data_info')->find(intval($_POST['id'])); if (!is_array($vd)) { $this->error("数据出错,该记录不存在"); } $integration = FS('Webconfig/integration'); $type = intval($_POST['type']); $vd['status'] = intval($_POST['status']) == 1 ? 1 : 2; $vd['deal_info'] = text($_POST['deal_info']); $vd['deal_credits'] = $vd['status'] == 1 ? $integration[$type]['fraction'] : 0; $vd['deal_user'] = $this->admin_id; $vd['deal_time'] = time(); $add_credits = $vd['deal_credits']; //保存当前数据对象 if ($result = M('member_data_info')->save($vd)) { //保存成功 if ($add_credits != 0) { memberCreditsLog($vd['uid'], 1, $add_credits, "审核" . $vd['id'] . "号资料(" . $vd[data_name] . "),信用积分增加" . $add_credits); } alogs("Memberdata", 0, 1, '成功执行了会员第' . $vd['id'] . '号资料(' . $vd[data_name] . ')的审核操作!'); //管理员操作日志 //成功提示 $this->assign('jumpUrl'); $this->success(L('修改成功')); } else { alogs("Memberdata", 0, 0, '执行会员第' . $vd['id'] . '号资料(' . $vd[data_name] . ')的审核操作失败!'); //管理员操作日志 //失败提示 $this->error(L('修改失败')); } }
function soap_report($pid, $encounter, $cols, $id) { $cols = 1; // force always 1 column $count = 0; $data = formFetch("form_soap", $id); if ($data) { print "<table><tr>"; foreach ($data as $key => $value) { if ($key == "id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $value == "0000-00-00 00:00:00") { continue; } if ($value == "on") { $value = "yes"; } $key = ucwords(str_replace("_", " ", $key)); //Updated by Sherwin 10/24/2016 print "<td><span class=bold>" . xlt($key) . ": </span><span class=text>" . nl2br(text($value)) . "</span></td>"; $count++; if ($count == $cols) { $count = 0; print "</tr><tr>\n"; } } } print "</tr></table>"; }
public function edit($id = 0, $lid = 0, $floor = 0, $lname = '', $address = '', $area = 0, $shi = 0, $ting = 0, $wei = 0, $totalprice = 0, $charge = 0, $description = '', $pics = '', $kanfang_charge = 0, $files = '') { $id = intval($id); if (IS_POST) { $data['lid'] = 0; //个人房源没有所属楼盘 $data['floor'] = intval($floor); $data['lname'] = text($lname); $data['address'] = text($address); $data['area'] = $area; $data['shi'] = intval($shi); $data['ting'] = intval($ting); $data['wei'] = intval($wei); $data['totalprice'] = intval($totalprice); $data['charge'] = intval($charge); $data['kanfang_charge'] = intval($kanfang_charge); $data['description'] = text($description); $data['type'] = 0; //标记为个人房源 $data['uid'] = $this->mid; $data['status'] = 1; $data['pics'] = $pics; $data['files'] = $files; //为了优化搜索,此处添加title冗余,并添加索引 $data['title'] = $data['lname'] . ' ' . $data['floor'] . '楼 ' . $data['area'] . '平 ' . $data['shi'] . '室 ' . $data['totalprice'] . '万'; if ($id) { $data['id'] = $id; //编辑一个房源 if (!($this->mid == $this->d_object->where(array('id' => $data['id']))->getField('uid')) && !is_administrator()) { $this->error('对不起,您的权限不足'); } $data['uptime'] = time(); if ($this->d_object->savePic($id, $data['pics']) || $this->d_object->save($data)) { $this->ajaxReturnHandle(1, '编辑房源成功', U('object/index')); } else { $this->ajaxReturnHandle(0, '编辑房源失败'); } } else { //新增一个房源 $data['createtime'] = time(); if ($id = $this->d_object->add($data)) { $this->d_object->savePic($id, $data['pics']); $this->ajaxReturnHandle(1, '新增房源成功', U('object/index')); } else { $this->ajaxReturnHandle(0, '新增房源失败'); } } } else { if ($id) { $data = $this->d_object->alias('a')->field('a.*,group_concat(b.pid) as pics')->join('__OBJECT_PIC__ b on a.id = b.oid')->find($id); $this->assign('data', $data); $this->display(); } else { $this->display(); } } }
function row_modify($table, $set, $where) { if (sqlQuery("SELECT * FROM {$table} WHERE {$where}")) { newEvent("deactivate", $_SESSION['authUser'], $_SESSION['authProvider'], 1, "{$table}: {$where}"); $query = "UPDATE {$table} SET {$set} WHERE {$where}"; echo text($query) . "<br>\n"; sqlStatement($query); } }
/** * Validates the database table input * @param array $fields * @param string $primary_key * @return boolean */ public function validate($fields = false, $primary_key = false) { $clean = parent::validate($fields, $primary_key); // verify username if ($clean->isEmpty('name')) { $this->addError('name', text('db:error:groupname')); } return !$this->error(); }
function care_plan_report($pid, $encounter, $cols, $id) { $count = 0; $sql = "SELECT * FROM `form_care_plan` WHERE id=? AND pid = ? AND encounter = ?"; $res = sqlStatement($sql, array($id, $_SESSION["pid"], $_SESSION["encounter"])); for ($iter = 0; $row = sqlFetchArray($res); $iter++) { $data[$iter] = $row; } if ($data) { ?> <table style='border-collapse:collapse;border-spacing:0;width: 100%;'> <tr> <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold><?php echo xlt('Code'); ?> </span></td> <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold><?php echo xlt('Code Text'); ?> </span></td> <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold><?php echo xlt('Description'); ?> </span></td> <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold><?php echo xlt('Date'); ?> </span></td> </tr> <?php foreach ($data as $key => $value) { ?> <tr> <td style='border:1px solid #ccc;padding:4px;'><span class=text><?php echo text($value['code']); ?> </span></td> <td style='border:1px solid #ccc;padding:4px;'><span class=text><?php echo text($value['codetext']); ?> </span></td> <td style='border:1px solid #ccc;padding:4px;'><span class=text><?php echo text($value['description']); ?> </span></td> <td style='border:1px solid #ccc;padding:4px;'><span class=text><?php echo text($value['date']); ?> </span></td> </tr> <?php } ?> </table> <?php } }
public function export() { import("ORG.Io.Excel"); $this->pre = C('DB_PREFIX'); $map = array(); if (!empty($_REQUEST['runame'])) { $ruid = M("members")->getFieldByUserName(text($_REQUEST['runame']), 'id'); $map['m.recommend_id'] = $ruid; } else { $map['m.recommend_id'] = array('neq', '0'); } if ($_REQUEST['uname']) { $map['m.user_name'] = array("like", urldecode($_REQUEST['uname']) . "%"); $search['uname'] = urldecode($_REQUEST['uname']); } if (!empty($_REQUEST['start_time']) && !empty($_REQUEST['end_time'])) { $timespan = strtotime(urldecode($_REQUEST['start_time'])) . "," . strtotime(urldecode($_REQUEST['end_time'])); $map['bi.add_time'] = array("between", $timespan); $search['start_time'] = urldecode($_REQUEST['start_time']); $search['end_time'] = urldecode($_REQUEST['end_time']); } elseif (!empty($_REQUEST['start_time'])) { $xtime = strtotime(urldecode($_REQUEST['start_time'])); $map['bi.add_time'] = array("gt", $xtime); $search['start_time'] = $xtime; } elseif (!empty($_REQUEST['end_time'])) { $xtime = strtotime(urldecode($_REQUEST['end_time'])); $map['bi.add_time'] = array("lt", $xtime); $search['end_time'] = $xtime; } if (session('admin_is_kf') == 1 && m . customer_id != 0) { $map['m.customer_id'] = session('admin_id'); } $field = ' sum(bi.investor_capital) investor_capital,count(bi.id) total,bi.investor_uid,m.recommend_id,m.id,m.user_name'; $list = M('borrow_investor bi')->join("{$this->pre}members m ON m.id = bi.investor_uid")->field($field)->where($map)->group('bi.investor_uid')->limit($Lsql)->select(); $tfield = ' sum(bi.investor_capital) investor_capital,count(bi.id) total,bi.investor_uid,m.recommend_id,m.id,m.user_name'; $tlist = M('transfer_borrow_investor bi')->join("{$this->pre}members m ON m.id = bi.investor_uid")->field($tfield)->where($map)->group('bi.investor_uid')->limit($Lsql)->find(); foreach ($list as $key => $v) { $list[$key]['investor_capital'] = $v['investor_capital'] + $tlist['investor_capital']; $list[$key]['total'] = $v['total'] + $tlist['total']; } $list = $this->_listFilter($list); $row = array(); $row[0] = array('序号', '推广人', '投资人', '投资总金额', '投资总笔数'); $i = 1; foreach ($list as $v) { $row[$i]['i'] = $i; $row[$i]['recommend_name'] = $v['recommend_name']; $row[$i]['user_name'] = $v['user_name']; $row[$i]['capital'] = $v['investor_capital']; $row[$i]['bishu'] = $v['total']; $i++; } $xls = new Excel_XML('UTF-8', false, 'datalist'); $xls->addArray($row); $xls->generateXML("datalistcard"); }
public function saveid() { $isimg = session('idcardimg'); $isimg2 = session('idcardimg2'); $data['real_name'] = text($_POST['real_name']); $data['idcard'] = text($_POST['idcard']); $data['up_time'] = time(); // /////////////////////// $data1['idcard'] = text($_POST['idcard']); $data1['real_name'] = text($_POST['real_name']); $data1['up_time'] = time(); $data1['uid'] = $this->uid; $data1['status'] = 0; // if (M('name_apply') -> field('idcard') -> where("idcard ={$data1['idcard']} and status=1") -> find()) { // ajaxmsg("此身份证号码已被占用", 0); // exit; // } $xuid = M('member_info')->getFieldByIdcard($data['idcard'], 'uid'); if ($xuid > 0 && $xuid != $this->uid) { ajaxmsg("此身份证号码已被人使用", 0); } $b = M('name_apply')->where("uid = {$this->uid}")->count('uid'); if ($b == 1) { M('name_apply')->where("uid ={$this->uid}")->save($data1); } else { M('name_apply')->add($data1); } // ////////////////////// // if($isimg!=1) ajaxmsg("请先上传身份证正面图片",0); // if($isimg2!=1) ajaxmsg("请先上传身份证反面图片",0); if (empty($data['real_name']) || empty($data['idcard'])) { ajaxmsg("请填写真实姓名和身份证号码", 0); } $c = M('member_info')->where("uid = {$this->uid}")->count('uid'); if ($c == 1) { $newid = M('member_info')->where("uid = {$this->uid}")->save($data); } else { $data['uid'] = $this->uid; $newid = M('member_info')->add($data); } session('idcardimg', NULL); session('idcardimg2', NULL); if ($newid) { $ms = M('members_status')->where("uid={$this->uid}")->setField('id_status', 3); if ($ms == 1) { ajaxmsg(); } else { $dt['uid'] = $this->uid; $dt['id_status'] = 3; M('members_status')->add($dt); } ajaxmsg(); } else { ajaxmsg("保存失败,请重试", 0); } }