function search() { $widget['date'] = true; $this->assign("widget", $widget); $map = $this->_search(); if (method_exists($this, '_search_filter')) { $this->_search_filter($map); } if (empty($_POST["be_start_date"]) && empty($_POST["en_start_date"])) { $start_date = toDate(mktime(0, 0, 0, date("m"), 1, date("Y")), 'Y-m-d'); $end_date = toDate(mktime(0, 0, 0, date("m") + 1, 0, date("Y")), 'Y-m-d'); $map['start_date'] = array(array("egt", $start_date), array("elt", $end_date)); } else { $start_date = $_POST["be_start_date"]; $end_date = $_POST["en_start_date"]; } $this->assign('start_date', $start_date); $this->assign('end_date', $end_date); $model = D("Schedule"); if (!empty($model)) { $this->_list($model, $map); } $this->assign('type_data', $this->type_data); $this->display(); return; }
public function doJoin() { $dao = D("Members"); if ($account = $dao->create()) { $id = $dao->add(); $this->account = $account; $sendto = array($account['email']); if (GetValue('is_welcome_email') == 1) { $welcome = GetValue(is_welcome_email); if ($welcome) { $welcome = str_replace(array('{name}', '{email}', '{time}', '{url}', '{sitename}', '{adminemail}'), array($account['lastname'] . " " . $account['firstname'], $account['email'], toDate($list['createdate']), GetValue('siteurl'), GetValue('sitename'), GetValue('email')), $welcome); sendmail($sendto, 'Welcome to ' . GetValue('sitename'), GetValue('welcome_email_content')); } } $info = $dao->where("id='{$id}'")->find(); setloginstatus($info); if ($this->isAjax()) { $this->success('do join success'); } elseif (isset($_SESSION['back'])) { redirect($_SESSION['back']); } else { $this->redirect('MemberIndex/index'); } } else { $this->error($dao->getError()); } }
public function index() { if (IS_POST) { if (empty($_POST['catid'])) { $this->error("请选择数据来源"); } $map['catid'] = array('in', $_POST['catid']); $map['status'] = array('eq', 1); $article = M('Article'); $articlelist = $article->where($map)->order('create_time desc')->select(); $download = M('Download'); $downloadlist = $download->where($map)->order('create_time desc')->select(); $photo = M('Photo'); $photolist = $photo->where($map)->order('create_time desc')->select(); if (isset($_POST['sitemaptype'])) { $type = $_POST['sitemaptype']; } $sitemapstr = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; switch ($type) { case 0: $sitemapstr .= "<urlset>\r\n"; break; case 1: $sitemapstr .= "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\r\n"; break; } foreach ($articlelist as $value) { $sitemapstr .= "<url>\r\n"; $sitemapstr .= "<loc>Article/show?id=" . $value['id'] . "</loc>\r\n"; $sitemapstr .= "<lastmod>" . toDate(NOW_TIME, 'Y-m-d') . "</lastmod>\r\n"; $sitemapstr .= "<changefreq>" . $_POST['changefreq'] . "</changefreq>\r\n"; $sitemapstr .= "<priority>" . $_POST['priority'] . "</priority>\r\n"; $sitemapstr .= "</url>\r\n\r\n"; } foreach ($downloadlist as $value) { $sitemapstr .= "<url>\r\n"; $sitemapstr .= "<loc>Download/show?id=" . $value['id'] . "</loc>\r\n"; $sitemapstr .= "<lastmod>" . toDate(NOW_TIME, 'Y-m-d') . "</lastmod>\r\n"; $sitemapstr .= "<changefreq>" . $_POST['changefreq'] . "</changefreq>\r\n"; $sitemapstr .= "<priority>" . $_POST['priority'] . "</priority>\r\n"; $sitemapstr .= "</url>\r\n\r\n"; } foreach ($photolist as $value) { $sitemapstr .= "<url>\r\n"; $sitemapstr .= "<loc>Photo/show?id=" . $value['id'] . "</loc>\r\n"; $sitemapstr .= "<lastmod>" . toDate(NOW_TIME, 'Y-m-d') . "</lastmod>\r\n"; $sitemapstr .= "<changefreq>" . $_POST['changefreq'] . "</changefreq>\r\n"; $sitemapstr .= "<priority>" . $_POST['priority'] . "</priority>\r\n"; $sitemapstr .= "</url>\r\n\r\n"; } $sitemapstr .= "</urlset>"; file_put_contents("../sitemap.xml", $sitemapstr); $this->success("sitemap在线生成完成"); } else { $cate = new CategoryModel(); $this->list = $cate->getMyCategory(); //加载栏目 $this->display(); } }
public function article() { $Blogs = D('Article'); $blog = $Blogs->where(array('status' => 1))->getField('id,title,description,create_time,uid'); $RssConf = array('channelTitle' => 'zswin社交类博客', 'channelLink' => 'http://zswin.cn', 'channelDescrīption' => 'zswin开源博客', 'copyright' => 'zswin'); $RSS = new Rss($RssConf); foreach ($blog as $k => $v) { $RSS->AddItem($v['title'], CSU('/artc/' . $v['id'], 'Index/artc', array('id' => $v['id'])), $v['description'], toDate($v['create_time']), $v['id'], get_username($v['uid'])); } $RSS->SaveToFile("./rss.xml"); echo $RSS->Show(); }
public function addUpdateLogSubmit() { $m = M('Updatelog'); $data['content'] = $_POST['content']; $data['copyright'] = $_POST['copyright']; $data['createTime'] = toDate(time()); $data['uid'] = session('uid'); $result = $m->add($data); if ($result) { writeOperationLog(APP_NAME, MODULE_NAME, ACTION_NAME, '添加更新日志'); $this->ajaxReturn($data, '添加升级日志成功!', true); } else { $this->ajaxReturn($data, '添加升级日志失败!', false); } }
public function addArticleSubmit() { $data['title'] = $_POST['title']; $data['column'] = $_POST['cid']; $data['source'] = $_POST['source']; $data['content'] = $_POST['content']; $data['createTime'] = toDate(time()); $m = M('article'); $result = $m->add($data); if ($result) { $this->ajaxReturn('成功', '文章发布成功!', true); } else { $this->ajaxReturn('失败', '文章发布失败!', false); } }
public function downloadxls() { $where = 1; $name = "全部订单:" . time(); if ($_REQUEST["time1"] || $_REQUEST["time2"]) { $time1 = get_safe_replace($_REQUEST["time1"]); $time2 = get_safe_replace($_REQUEST["time2"]); /*strtotime($time2)-($day*86400);*/ if ($time1 == $time2) { $time1 = strtotime($time1) - 86400; } else { $time1 = strtotime($time1); } /*相同日期则选择一天*/ $where .= " and add_time > '" . $time1 . "' and add_time < '" . strtotime($time2) . "'"; $name = "时间段" . toDate($time1, "Y/m/d") . "-" . toDate(strtotime($time2), "Y/m/d"); } $order = M(MODULE_NAME)->where($where)->getfield('id,sn,add_time,consignee,mobile,order_amount,province,city,area,address'); // $data = array(); foreach ($order as $key => $vv) { $oid .= $key == 0 ? $vv['id'] : ',' . $vv['id']; } if (empty($oid)) { $this->success('数据为空!'); exit; } $od['order_id'] = array('in', $oid); $order_data = M("order_data")->where($od)->select(); $area = M('area')->getfield('id,name'); foreach ($order_data as $key => $v) { $data[$key][1] = $order[$v['order_id']]['sn'] . "号"; $data[$key][2] = toDate($order[$v['order_id']]["add_time"], "Y/m/d H:i:s"); $data[$key][3] = $v['product_name']; $data[$key][4] = $v['type_name']; $data[$key][5] = $order[$v['order_id']]["pay_status"] == 2 ? '已支付' : '未支付'; $data[$key][6] = $order[$v['order_id']]["order_amount"] . "元"; $data[$key][7] = $order[$v['order_id']]["consignee"]; $data[$key][8] = $order[$v['order_id']]["mobile"]; $data[$key][9] = $area[$order[$v['order_id']]["province"]]; $data[$key][10] = $area[$order[$v['order_id']]["city"]]; $data[$key][11] = $area[$order[$v['order_id']]["area"]]; $data[$key][12] = $order[$v['order_id']]["address"]; } $title = array(1 => "订单编号", 2 => "订单时间", 3 => "订购产品", 4 => "订购类型", 5 => "支付状态", 6 => "订单价格", 7 => "姓名", 8 => "手机", 9 => "省份", 10 => "城市", 11 => "区域", 12 => "地址"); $this->exportexcel($data, $title, $name); }
public function downloadxls() { $where = 1; $name = "全部订单:" . time(); if ($_REQUEST["time1"] || $_REQUEST["time2"]) { $time1 = get_safe_replace($_REQUEST["time1"]); $time2 = get_safe_replace($_REQUEST["time2"]); /*strtotime($time2)-($day*86400);*/ if ($time1 == $time2) { $time1 = strtotime($time1) - 86400; } else { $time1 = strtotime($time1); } /*相同日期则选择一天*/ $where .= " and createtime > '" . $time1 . "' and createtime < '" . strtotime($time2) . "'"; $name = "预约试驾" . toDate($time1, "Y/m/d") . "-" . toDate(strtotime($time2), "Y/m/d"); } $area = M('area')->getfield('id,name'); $bill = M(MODULE_NAME)->where($where)->select(); foreach ($bill as $key => $vo) { $pro = M("product")->where('id=' . $vo['car_name'])->cache(true)->find(); $data[$key][1] = $vo['id']; $data[$key][2] = $pro['title']; $data[$key][3] = toDate($vo['datetime'], "Y/m/d"); $data[$key][4] = $vo['username']; $data[$key][5] = $vo['sex'] == 1 ? "先生" : '女士'; if ($vo['sex'] == 0) { $data[$key][5] = '未知'; } $data[$key][6] = '手机' . $vo['mobile']; $data[$key][7] = $area[$vo['province']]; $data[$key][8] = $area[$vo['city']]; $data[$key][9] = $area[$vo['area']]; $shopname = M("shop")->where('shopcode=\'' . $vo['shop_name'] . '\'')->getfield('sname'); if (!$shopname) { $shopname = "客户未选择"; } $data[$key][10] = $shopname; } $title = array(1 => "预约号", 2 => "预约车型", 3 => "预约时间", 4 => "预约人", 5 => "性别", 6 => "电话", 7 => "省份", 8 => "城市", 9 => "区域", 10 => "经销商"); $order = A('Admin/Order'); $order->exportexcel($data, $title, $name); }
public function checkLogin() { // 用户权限检查 if (session('verify') != md5($_POST['verify'])) { $this->ajaxReturn('验证失败', "验证码错误,请重试!", false); } $map['uid'] = $this->_post('uid'); $map['pwd'] = md5($this->_post('pwd')); $map["status"] = array('eq', 1); $db = M('user'); $authInfo = $db->where($map)->select(); if (1 < count($authInfo)) { $this->ajaxReturn('错误', '登录信息重复', false); } elseif (1 == count($authInfo)) { if ($authInfo[0]['uid'] == 'admin') { //session('USER_AUTH_KEY',true); } session('id', (int) $authInfo[0]['id']); //用户id,强制转换成int,其实本来就是int,但从数据库读出来就成字符型了,权限要用int类型判断,字符型的数字则没有权限 session('name', $authInfo[0]['name']); //别名 session('uid', $authInfo[0]['uid']); //登录名 session('lastIp', $authInfo[0]['lastIp']); session('lastTime', $authInfo[0]['lastTime']); session('count', $authInfo[0]['count']); session('tishiyu', $authInfo[0]['tishiyu']); session('language', $authInfo[0]['tishiyu']); // 保存登录信息 $User = M('User'); $data = array(); $data['id'] = $authInfo[0]['id']; $data['lastTime'] = toDate(time()); $data['count'] = array('exp', 'count+1'); $data['lastIp'] = get_client_ip(); $User->save($data); $this->ajaxReturn('成功', "登录成功!", true); } elseif (1 > count($authInfo)) { $this->ajaxReturn('登录失败', "登录失败,请联系管理员处理!", false); } }
/** * @函数 filter * @功能 过滤订单信息 */ private function filter($list) { foreach ($list as $key => $value) { //$order_list[todate_time] = date("Y-m-d",$order_list[todate_time]); $list[$key][order_time] = toDate($list[$key][order_time]); //设置显示的创建时间 /*$list[$key]['createtime']=date("Y-m-d H:i:s",$value['createtime']); //设置显示的最后修改时间 if(!$value['lastmodifytime']){ $list[$key]['lastmodifytime']="无"; }else{ $list[$key]['lastmodifytime']=date("Y-m-d H:i:s",$value['lastmodifytime']); } //文章标题过长时裁剪 if(strlen($list[$key]['subject'])>80){ $list[$key]['subject']=$this->cutString($list[$key]['subject'],0,20).'...'; }*/ } }
public function wxpayok() { $paysn = $_REQUEST["out_trade_no"]; $transaction_id = $_REQUEST["transaction_id"]; if (!empty($transaction_id) && !empty($paysn)) { $order = M("order")->field("id,userid,title,mcount,add_time,username,wxmsg")->where("paysn='" . $paysn . "'")->find(); if (empty($order)) { $type = "piao"; $order = M("piaoorder")->where("paysn='" . $paysn . "'")->find(); } else { $type = ""; } if ($order["id"] > 0) { M($type . "order")->where("paysn='" . $paysn . "'")->setfield("transaction_id", $transaction_id); M($type . "order")->where("paysn='" . $paysn . "'")->setfield("status", 1); } if ($order['userid'] > 0) { $u = M("user")->field("wxpas,id")->where("id=" . $order['userid'])->find(); } if ($u["wxpas"] && $order['wxmsg'] < 2) { import("@.ORG.Weixin"); $wechatObj = new Wechat(); $data = "{\r\n\t\t\t\t\t\t \"touser\":\"" . $u['wxpas'] . "\",\r\n\t\t\t\t\t\t \"template_id\":\"SCFdz1m9pGOO6U-LXp6qv8CUJakT3_Zk-74tjdnK0ok\",\r\n\t\t\t\t\t\t \"url\":\"http://www.gzsrex.com" . U('Home/Order/look', array('oid' => $order["id"])) . "\",\r\n\t\t\t\t\t\t \"topcolor\":\"#003cff\",\r\n\t\t\t\t\t\t \"data\":{\r\n\t\t\t\t\t\t\t\t \"first\": {\r\n\t\t\t\t\t\t\t\t\t \"value\":\"恭喜你购买成功!\"\r\n\t\t\t\t\t\t\t\t },\r\n\t\t\t\t\t\t\t\t \"keyword1\":{\r\n\t\t\t\t\t\t\t\t\t \"value\":\"" . $order['username'] . "\",\r\n\t\t\t\t\t\t\t\t\t \"color\":\"#FF6600\"\r\n\t\t\t\t\t\t\t\t },\r\n\t\t\t\t\t\t\t\t \"keyword2\": {\r\n\t\t\t\t\t\t\t\t\t \"value\":\"" . $order["title"] . "\",\r\n\t\t\t\t\t\t\t\t\t \"color\":\"#FF6600\"\r\n\t\t\t\t\t\t\t\t },\r\n\t\t\t\t\t\t\t\t \"keyword3\": {\r\n\t\t\t\t\t\t\t\t\t \"value\":\"" . $order['mcount'] . "人\",\r\n\t\t\t\t\t\t\t\t\t \"color\":\"#FF0600\"\r\n\t\t\t\t\t\t\t\t },\r\n\t\t\t\t\t\t\t\t \"keyword4\": {\r\n\t\t\t\t\t\t\t\t\t \"value\":\"" . toDate($order['add_time'], "y-m-d H:i:s") . "添加\",\r\n\t\t\t\t\t\t\t\t\t \"color\":\"#FF6600\"\r\n\t\t\t\t\t\t\t\t },\r\n\t\t\t\t\t\t\t\t \"remark\":{\r\n\t\t\t\t\t\t\t\t\t \"value\":\"价格:" . $order['amount'] . "\",\r\n\t\t\t\t\t\t\t\t\t \"color\":\"#FF6600\"\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t }"; /* {first.DATA}} 客户名:{{keyword1.DATA}} 产品名称:{{keyword2.DATA}} 人数:{{keyword3.DATA}} 时间:{{keyword4.DATA}} {{remark.DATA}}*/ M($type . "order")->where("paysn='" . $paysn . "'")->setInc("wxmsg"); //增加通知次数 echo $wechatObj->tplmsg($data); } else { echo "订单不存在!"; } } }
public function index() { $user_id = get_user_id(); $map = $this->_search(); if (method_exists($this, '_filter')) { $this->_filter($map); } $model = D("PayView"); if (empty($_POST['start_date']) & empty($_POST['end_date'])) { $start_date = toDate(mktime(0, 0, 0, date("m"), 1, date("Y")), 'Y-m-d'); $end_date = toDate(mktime(0, 0, 0, date("m") + 1, 0, date("Y")), 'Y-m-d'); $this->_set_search("start_date", $start_date); $this->_set_search("end_date", $end_date); $map['create_time'] = array(array('gt', date_to_int($start_date)), array('lt', date_to_int($end_date))); } $this->assign('start_date', $start_date); $this->assign('end_date', $end_date); if (!empty($model)) { $this->_list($model, $map); } $this->display(); return; }
public function index() { $map = $this->_search("PoView", true); if (method_exists($this, '_filter')) { $this->_filter($map); } if (empty($_POST['start_date']) & empty($_POST['end_date'])) { $start_date = toDate(mktime(0, 0, 0, date("m"), 1, date("Y")), 'Y-m-d'); $end_date = toDate(mktime(0, 0, 0, date("m") + 1, 0, date("Y")), 'Y-m-d'); $map['po_date'] = array(array('egt', $start_date), array('elt', $end_date)); } else { $start_date = $_POST['start_date']; $end_date = $_POST['end_date']; } $this->assign('start_date', $start_date); $this->assign('end_date', $end_date); $sql = D("PoView")->buildSql(); $model = new Model(); $list = $model->table($sql . "a")->where($map)->order('supplier,po_no')->select(); $this->assign("list", $list); $this->display(); return; }
public function excel() { Vendor('Excel.php-excel'); $map['id'] = array('in', $_REQUEST['id']); $orders = $this->dao->where($map)->select(); $xls = array(); $xls[0][0] = "编号"; $xls[0][1] = "金额"; $xls[0][2] = "运输方式"; $xls[0][3] = "运费"; $xls[0][4] = "手续费"; $xls[0][5] = "保险金"; $xls[0][6] = "付款方式"; $xls[0][7] = "购买时间"; $xls[0][8] = "附加留言"; $xls[0][9] = "IP地址"; $xls[0][10] = "邮箱"; $xls[0][11] = "姓"; $xls[0][12] = "名"; $xls[0][13] = "地址"; $xls[0][14] = "电话"; $xls[0][15] = "邮编"; $xls[0][16] = "城市"; $xls[0][17] = "省份"; $xls[0][18] = "国家"; $xls[0][19] = "订单状态"; $xls[0][20] = "快递方式"; $xls[0][21] = "重量"; $i = 1; foreach ($orders as $o) { $xls[$i][0] = $o['sn']; $xls[$i][1] = $o['orders_total']; $xls[$i][2] = $o['shipping_method']; $xls[$i][3] = $o['shippingmoney']; $xls[$i][4] = $o['paymoney']; $xls[$i][5] = $o['insurance']; $xls[$i][6] = $o['payment_module_code']; $xls[$i][7] = toDate($o['dateline']); $xls[$i][8] = $o['BuyNote']; $xls[$i][9] = $o['ip_address'] . "(" . get_ip_area($o['ip_address']) . ")"; $xls[$i][10] = $o['delivery_email']; $xls[$i][11] = $o['delivery_firstname']; $xls[$i][12] = $o['delivery_lastname']; $xls[$i][13] = $o['delivery_address']; $xls[$i][14] = $o['delivery_telephone']; $xls[$i][15] = $o['delivery_zip']; $xls[$i][16] = $o['delivery_city']; $xls[$i][17] = $o['delivery_state']; $xls[$i][18] = $o['delivery_country']; $xls[$i][19] = L('orders_status_' . $o['orders_status']); $xls[$i][20] = $o['shipping_method']; $xls[$i][21] = $o['total_weight']; $i++; } $xls_obj = new Excel_XML('UTF-8', false, 'SOP订单列表'); $xls_obj->addArray($xls); $xls_obj->generateXML("SOP"); }
private function _folder_export($model, $map) { $list = $model->where($map)->select(); //导入thinkphp第三方类库 Vendor('Excel.PHPExcel'); //$inputFileName = "Public/templete/contact.xlsx"; //$objPHPExcel = PHPExcel_IOFactory::load($inputFileName); $objPHPExcel = new PHPExcel(); $objPHPExcel->getProperties()->setCreator("小微OA")->setLastModifiedBy("小微OA")->setTitle("Office 2007 XLSX Test Document")->setSubject("Office 2007 XLSX Test Document")->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")->setKeywords("office 2007 openxml php")->setCategory("Test result file"); // Add some data $i = 1; //dump($list); //编号,类型,标题,登录时间,部门,登录人,状态,审批,协商,抄送,审批情况,自定义字段 $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$i}", "编号")->setCellValue("B{$i}", "类型")->setCellValue("C{$i}", "标题")->setCellValue("D{$i}", "登录时间")->setCellValue("E{$i}", "部门")->setCellValue("F{$i}", "登录人")->setCellValue("G{$i}", "状态")->setCellValue("H{$i}", "审批")->setCellValue("I{$i}", "协商")->setCellValue("J{$i}", "抄送")->setCellValue("J{$i}", "审批情况"); foreach ($list as $val) { $i++; //dump($val); $id = $val['id']; $doc_no = $val["doc_no"]; //编号 $name = $val["name"]; //标题 $confirm_name = strip_tags($val["confirm_name"]); //审批 $consult_name = strip_tags($val["consult_name"]); //协商 $refer_name = strip_tags($val["refer_name"]); //协商 $type_name = $val["type_name"]; //流程类型 $user_name = $val["user_name"]; //登记人 $dept_name = $val["dept_name"]; //不美分 $create_time = $val["create_time"]; $create_time = toDate($val["create_time"], 'Y-m-d H:i:s'); //创建时间 $step = show_step_type($val["step"]); // //编号,类型,标题,登录时间,部门,登录人,状态,审批,协商,抄送,审批情况,自定义字段 $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$i}", $doc_no)->setCellValue("B{$i}", $type_name)->setCellValue("C{$i}", $name)->setCellValue("D{$i}", $create_time)->setCellValue("E{$i}", $dept_name)->setCellValue("F{$i}", $user_name)->setCellValue("G{$i}", $step)->setCellValue("H{$i}", $confirm_name)->setCellValue("I{$i}", $consult_name); $model_flow_field = D("FlowField"); $field_list = $model_flow_field->get_data_list($id); // dump($field_list); $k = 0; if (!empty($field_list)) { foreach ($field_list as $field) { $k++; $field_data = $field['name'] . ":" . $field['val']; $location = get_cell_location("J", $i, $k); $objPHPExcel->setActiveSheetIndex(0)->setCellValue($location, $field_data); } } } // Rename worksheet $objPHPExcel->getActiveSheet()->setTitle('流程统计'); // Set active sheet index to the first sheet, so Excel opens this as the first sheet $objPHPExcel->setActiveSheetIndex(0); $file_name = "流程统计.xlsx"; // Redirect output to a client’s web browser (Excel2007) header("Content-Type: application/force-download"); header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); header("Content-Disposition:attachment;filename =" . str_ireplace('+', '%20', URLEncode($file_name))); header('Cache-Control: max-age=0'); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); //readfile($filename); $objWriter->save('php://output'); exit; }
?> </td> <td><?php echo get_username($vo['to_uid']); ?> </td> <td><?php echo $vo['title']; ?> </td> <td><?php echo $vo['content']; ?> </td> <td><?php echo toDate($vo['create_time']); ?> </td> <td><?php echo $vo['typetext']; ?> </td> <td class="text-center"><input type="checkbox" name="ids" class="j-icheck" value="<?php echo $vo['id']; ?> "></td> <td>
echo $vo['rowurl']; ?> " target="_blank"><?php echo msubstr($vo['rowtitle'], 0, 6); ?> </a></td> <td><?php echo get_username($vo['uid']); ?> </td> <td><?php echo $vo['mod']; ?> </td> <td><?php echo toDate($vo['create_time'], 'Y-m-d H:i'); ?> </td> <td><?php echo $vo['ding']; ?> </td> <td><?php echo $vo['cai']; ?> </td> <td><?php echo getStatus($vo['status']); ?> </td>
public function backup() { $tableid = intval($_GET['tableid']); $this->startfrom = intval($_GET['startfrom']); $sizelimit = intval($_REQUEST['sizelimit']); $volume = intval($_GET['volume']) + 1; $dataList = $this->db->query("SHOW TABLE STATUS LIKE '" . C('DB_PREFIX') . "%'"); foreach ($dataList as $row) { $table_info[$row['Name']] = $row; } $tables = S('backuptables'); if (empty($_POST['tables']) && empty($tables)) { foreach ($dataList as $row) { $tables[] = $row['Name']; } } else { $tables = array(); if (!$tableid) { $tables = $_POST['tables']; S('backuptables', $tables); } else { $tables = S('backuptables'); } if (!is_array($tables) || empty($tables)) { $this->success(L('do_empty')); } } unset($dataList); $sql = ''; if (!$tableid) { $sql .= "-- Yourphp SQL Backup\n-- Time:" . toDate(time()) . "\n-- http://www.yourphp.cn \n\n"; foreach ($tables as $key => $table) { $sql .= "--\n-- Yourphp Table `{$table}`\n-- \n"; $sql .= "DROP TABLE IF EXISTS `{$table}`;\n"; $info = $this->db->query("SHOW CREATE TABLE {$table}"); $sql .= str_replace(array('USING BTREE', 'ROW_FORMAT=DYNAMIC'), '', $info[0]['Create Table']) . ";\n"; } } for (; $this->complete && $tableid < count($tables) && strlen($sql) + 500 < $sizelimit * 1000; $tableid++) { if ($table_info[$tables[$tableid]]['Rows'] > 0) { $sql .= $this->dumptablesql($tables[$tableid], $this->startfrom, strlen($sql), $table_info[$tables[$tableid]]['Auto_increment']); if ($this->complete) { $this->startfrom = 0; } } } !$this->complete && $tableid--; $filename = htmlspecialchars(strip_tags($_GET['filename'])); $filename = !$filename ? 'Yp_' . rand_string(10) . '_' . date('YmdH') : $filename; $filename_valume = sprintf($filename . "-%s" . '.sql', $volume); if (trim($sql)) { $putfile = $this->datadir . $filename_valume; $r = file_put_contents($putfile, trim($sql)); } if ($tableid < count($tables) || $r) { $this->assign('waitSecond', 0); $urlarray = array('tableid' => $tableid, 'startfrom' => $this->startfrom, 'sizelimit' => $sizelimit, 'volume' => $volume, 'filename' => $filename); $message = $filename_valume . ' File Create Ok!'; $forward = U("Database/backup", $urlarray); $this->assign('jumpUrl', $forward); $this->success($message); } else { S('backuptables', null); $this->assign('jumpUrl', U(MODULE_NAME . '/recover')); $this->success(L('do_ok')); } }
private function _add_to_schedule($task_id) { $info = M("Task")->where("id={$task_id}")->find(); $data['name'] = $info['name']; $data['content'] = $info['content']; $data['start_time'] = toDate(time()); $data['end_time'] = $info['expected_time']; $data['user_id'] = get_user_id(); $data['user_name'] = get_user_name(); $data['priority'] = 3; $list = M('Schedule')->add($data); }
$con .= ($con ? "," : "") . "'" . toDate($adds[$row[0]]) . "'"; } elseif ($row[1] == "float" || $row[1] == "numeric") { $con .= ($con ? "," : "") . "cast('" . str_replace(",", ".", $adds[$row[0]]) . "' as float)"; } else { $con .= ($con ? "," : "") . "'" . stripslashes(utf8_decode($adds[$row[0]])) . "'"; } } elseif (isset($_POST[$row[0]])) { $conc .= ($conc ? "," : "") . $row[0]; if ($row[1] == "smalldatetime" || $row[1] == "datetime") { if (trim($_POST[$row[0]]) == "") { $con .= ($con ? "," : "") . "NULL"; } else { $con .= ($con ? "," : "") . "'" . toDate($_POST[$row[0]]) . "'"; } } elseif ($row[1] == "datetime") { $con .= ($con ? "," : "") . "'" . toDate($_POST[$row[0]]) . "'"; } elseif ($row[1] == "float" || $row[1] == "numeric") { $con .= ($con ? "," : "") . "cast('" . str_replace(",", ".", $_POST[$row[0]]) . "' as float)"; } elseif ($row[1] == "varchar") { $con .= ($con ? "," : "") . "'" . $_POST[$row[0]] . "'"; } else { $con .= ($con ? "," : "") . "'" . stripslashes(utf8_decode($_POST[$row[0]])) . "'"; } } } //putxt("insert into tb".$datato." (".$conc.") values (".$con.")"); //if((trim($conc)!=""&&trim($conc)!="USUARIO")){ if (trim($conc) != "") { $result = $mysqli->query("insert into tb" . $datato . " (" . $conc . ") values (" . $con . ")"); //$sql=mssql_query("insert into tb".$datato." (".$conc.") values (".$con.")"); for ($i = 0; $i <= 2; $i++) {
public function clear() { $where = ''; $parameter = array(); $begin_time = trim($_REQUEST['begin_time']); $end_time = trim($_REQUEST['end_time']); $status = trim($_REQUEST['status']); if (!empty($begin_time)) { $this->assign("begin_time", $begin_time); $parameter['begin_time'] = $begin_time; $begin_time = strZTime($begin_time); if ($begin_time > 0) { $begin_time1 = toDate($begin_time); $where .= " AND created >= '{$begin_time1}'"; } } else { $begin_time = 0; } if (!empty($end_time) && strZTime($end_time) > $begin_time) { $this->assign("end_time", $end_time); $parameter['end_time'] = $end_time; $end_time = strZTime($end_time); if ($end_time > 0) { $end_time1 = toDate($end_time); $where .= " AND created <= '{$end_time1}'"; } } if (!empty($status)) { $this->assign("status", $status); $parameter['status'] = $status; $where .= " AND status = '{$status}'"; } if (!empty($where)) { $where = 'WHERE' . $where; $where = str_replace('WHERE AND', 'WHERE', $where); } $model = M(); $sql = 'DELETE FROM ' . C("DB_PREFIX") . 'apns_messages ' . $where; M()->query($sql); $this->redirect('MApns/index'); }
public function editColumnSubmit() { $data['text'] = $_POST['text']; $data['url'] = $_POST['url']; $data['status'] = $_POST['status']; $data['sort'] = $_POST['sort']; $data['id'] = $_POST['id']; $data['updateTime'] = toDate(time()); $m = M('column'); $result = $m->save($data); if ($result) { $this->ajaxReturn('成功', '更新栏目成功!', true); } else { $this->ajaxReturn('失败', '更新栏目失败!', false); } }
public function downloadxls() { // $list=$this->_list(MODULE_NAME); $where = 1; $name = "全部订单:" . time(); if (intval($_REQUEST["uid"])) { $where['userid'] = intval($_REQUEST["uid"]); $name = "用户" . intval($_REQUEST["uid"]); } if ($_REQUEST["username"]) { $where['username'] = $_REQUEST["username"]; $name = "用户-" . $_REQUEST["username"]; } if (intval($_REQUEST["mid"])) { $where["mid"] = intval($_REQUEST["mid"]); } if ($_REQUEST["mx"]) { $where["mx"] = get_safe_replace($_REQUEST["mx"]); $name = get_safe_replace($_REQUEST["mx"]) . intval($_REQUEST["uid"]); } if ($_REQUEST["mb"]) { $where["mobile"] = get_safe_replace($_REQUEST["mb"]); $name = "手机" . get_safe_replace($_REQUEST["mb"]); } if ($_REQUEST["time1"] || $_REQUEST["time2"]) { $time1 = get_safe_replace($_REQUEST["time1"]); $time2 = get_safe_replace($_REQUEST["time2"]); /*strtotime($time2)-($day*86400);*/ if ($time1 == $time2) { $time1 = strtotime($time1) - 86400; } else { $time1 = strtotime($time1); } /*相同日期则选择一天*/ $where["createtime"] = array('between', array($time1, strtotime($time2))); $name = "时间段" . $time1; } $udata = M(MODULE_NAME)->where($where)->select(); $data = array(); foreach ($udata as $key => $v) { $data[$key][1] = $key; $data[$key][2] = $v["username"]; $data[$key][3] = $v["creditno"]; $data[$key][4] = $v["mobile"]; $data[$key][5] = str_cut($v["title"], 20, ""); $data[$key][6] = $v["mcount"]; $data[$key][7] = $v["amount"]; $data[$key][8] = $v["godate"]; $data[$key][9] = toDate($v["add_time"], "Y/m/d H:i:s"); } $title = array(1 => "订单编号", 2 => "姓名", 3 => "身份证", 4 => "手机", 5 => "线路", 6 => "数量", 7 => "总价格", 8 => "出发时间", 9 => "添加时间"); $this->exportexcel($data, $title, $name); }
/** *发表话题 *@date 2010-6-4 *@time 下午04:36:18 */ function add_post() { //搜索群组 if (!$this->_is_login()) { $this->ajaxReturn('login', "Login please.", '0'); } $dao = D("Post"); $vo = $dao->create(); if ($vo) { if (empty($vo['message'])) { $this->ajaxReturn('0', 'You must fill in the field of "Content".', '0'); } $vo['title'] = $vo['title'] ? $vo['title'] : ""; $vo['aid'] = $vo['aid'] ? $vo['aid'] : "0"; $vo['qid'] = $vo['qid'] ? $vo['qid'] : "0"; $vo['l'] = $vo['l'] ? $vo['l'] : "1"; $vo['topid'] = $vo['topid'] ? $vo['topid'] : "0"; $vo['requery'] = $vo['requery'] ? $vo['requery'] : "0"; $vo['qidstr'] = $vo['qidstr'] ? $vo['qidstr'] : "0"; $vo['message'] = nl2br(remove_xss($vo['message'])); $vo['is_show'] = 1; if ($vo['topid'] != '0' && $vo['qid'] == '0') { //主题的回复 $top = $dao->where("topid={$vo['topid']}")->field('id,l,topid')->order("l DESC")->find(); $vo['l'] = $top['l'] + 1; } elseif ($vo['topid'] == '0' && $vo['qid'] == '0') { //主题 $vo['l'] = '0'; } elseif ($vo['topid'] != '0' && $vo['qid'] != '0') { //主题回复的回复 $top = $dao->where("qid={$vo['qid']}")->field('id,l,topid')->order("l DESC")->find(); $vo['l'] = $top['l'] + 1; } //dump($vo); $pid = $dao->add($vo); if ($pid) { if ($vo['topid'] != '0') { $this->posts_lasttime($vo['topid']); } $data = $dao->where("id={$pid}")->find(); $data['dateline'] = toDate($data['dateline'], 'Y-m-d'); $data['lasttime'] = toDate($data['lasttime'], 'Y-m-d'); if ($data['l'] == '0') { $this->edit_thread($data['gid']); } else { $this->edit_thread($data['gid'], 2); } $this->ajaxReturn($data, "You’ve sent successfully.", '1'); } else { $this->ajaxReturn('0', "You’ve sent successfully.", '0'); } } else { $this->ajaxReturn('0', 'Replied successfully!', '0'); } }
/** * Transforms a DateTime object to HTTP's most common date format. * * We're serializing it as the RFC 1123 date, which, for HTTP must be * specified as GMT. * * @deprecated Use toDate * @param \DateTime $dateTime * @return string */ static function toHTTPDate(\DateTime $dateTime) { return toDate($dateTime); }
if (isGET('comments')) { $out['title'] = $lang['comments']; $out['type'] = 'comments'; $items = listEntry('comments'); rsort($items); $items = array_slice($items, 0, 100); if ($items) { foreach ($items as $item) { $itemData = readEntry('comments', $item); $parentData = readEntry('posts', $itemData['post']); $title = clean($itemData['commenter'] . $lang['commented'] . $parentData['title']); $url = $out['baseURL'] . 'view.php?post=' . $itemData['post'] . '/pages/' . pageOf($item, $parentData['comments']) . '#' . $item; $out['content'] .= getFeedEntry($title, $url, toDate($item, 'c'), content($itemData['content'])); } } } else { $out['title'] = $lang['posts']; $out['type'] = 'posts'; $items = listEntry('posts'); rsort($items); $items = array_slice($items, 0, 100); if ($items) { foreach ($items as $item) { $itemData = readEntry('posts', $item); $title = clean($itemData['title']); $url = $out['baseURL'] . 'view.php?post=' . $item; $out['content'] .= getFeedEntry($title, $url, toDate($item, 'c'), $itemData['content'], $itemData['tags']); } } } require 'templates/feed.php';
function upload() { import("ORG.Net.UploadFile"); $upload = new UploadFile(); //检查客户端上传文件参数设置 if (isset($_POST['_uploadFileSize']) && is_numeric($_POST['_uploadFileSize'])) { //设置上传文件大小 $upload->maxSize = $_POST['_uploadFileSize']; } else { $upload->maxSize = C('FILE_UPLOAD_MAXSIZE'); } /*if (! empty ( $_POST ['_uploadFileType'] )) { //设置上传文件类型 $upload->allowExts = explode ( ',', strtolower ( $_POST ['_uploadFileType'] ) ); } else { $upload->allowExts = explode ( ',', C ( 'FILE_UPLOAD_ALLOWEXTS' ) ); }*/ $upload->allowExts = explode(',', C('FILE_UPLOAD_ALLOWEXTS')); if (!empty($_POST['_uploadSavePath'])) { //设置附件上传目录 $upload->savePath = $_POST['_uploadSavePath']; } else { $upload->savePath = "./Public/Uploads/" . MODULE_NAME . "/"; } //是否自动命名 if (GetSettValue('uploadsaveRule') == 1) { if (isset($_POST['_uploadSaveRule'])) { //设置附件命名规则 $upload->saveRule = $_POST['_uploadSaveRule']; } else { $upload->saveRule = 'uniqid'; } } if (MODULE_NAME == 'Products') { //创建目录 $upload->savePath = $upload->savePath . toDate(time(), 'Ymd') . "/"; if (!file_exists("{$upload->savePath}")) { mk_dir($upload->savePath); } //设置需要生成缩略图,仅对图像文件有效 $upload->thumb = true; //设置需要生成缩略图的文件后缀 //$upload->thumbSuffix = "_thumb"; //设置缩略图最大宽度 $upload->thumbMaxWidth = GetSettValue('ImgThumbW'); //设置缩略图最大高度 $upload->thumbMaxHeight = GetSettValue('ImgThumbH'); } $upload->uploadReplace = true; if (!$upload->upload()) { $error = $upload->getErrorMsg(); $this->ajaxReturn('', $error, 0); } else { $uploadSuccess = true; $uploadList = $upload->getUploadFileInfo(); //是否打上水印 $imgwater = GetSettValue('ImgWater'); $ImageWaterAlpha = GetSettValue('ImageWaterAlpha'); if (empty($ImageWaterAlpha)) { $ImageWaterAlpha = 80; } import("ORG.Util.Image"); foreach ($uploadList as $key => $file) { $savename['savename'] = $upload->savePath . $file['savename']; if ($imgwater == 1) { if (GetSettValue('is_only_proimg_water') == 1 && MODULE_NAME == 'Products') { Image::water($savename['savename'], GetSettValue('ImgWaterPath'), GetSettValue('ImgWaterPos'), '', $ImageWaterAlpha); } elseif (GetSettValue('is_only_proimg_water') == 0) { Image::water($savename['savename'], GetSettValue('ImgWaterPath'), GetSettValue('ImgWaterPos'), '', $ImageWaterAlpha); } } $savename['name'] = $file['name']; } $this->ajaxReturn($savename, '上传成功!', 1); } }
private function dirFileInfo($dir) { if (!is_dir($dir)) { return false; } $dirhandle = opendir($dir); $list = array(); while (($file = readdir($dirhandle)) !== false) { if ($file != "." && $file != ".." && is_dir($dir . $file) && file_exists($dir . $file . '/tables.php')) { include $dir . $file . '/tables.php'; $list[] = array('filename' => $table_data['file_dir'], 'filetime' => $table_data['time'], 'filedate' => toDate($table_data['time'])); } } @closedir($dirhandle); usort($list, fileSort); return $list; }
public function pwdChangeSubmit() { $oldPwd = $_POST['oldPwd']; $newPwd = $_POST['newPwd']; $rePwd = $_POST['rePwd']; if (empty($oldPwd) or empty($newPwd) or empty($rePwd)) { $this->ajaxReturn(null, '表单信息填写不完整,请重试!', false); } else { if ($newPwd == $rePwd) { $m = M('User'); $result = $m->field('pwd')->find(session(C('USER_AUTH_KEY'))); if (md5($oldPwd) == $result['pwd']) { $data['id'] = session(C('USER_AUTH_KEY')); $data['pwd'] = md5($newPwd); $data['update_time'] = toDate(time()); $r = $m->save($data); if ($r) { writeOperationLog(APP_NAME, MODULE_NAME, ACTION_NAME, '密码修改'); $this->ajaxReturn($result, '密码更新成功!', true); } else { $this->ajaxReturn($result, '密码更新失败!', false); } } else { $this->ajaxReturn($result, '原始密码错误,请重试!', false); } } else { $this->ajaxReturn(null, '两次密码不一致,请重试!', false); } } }
<?php $out = array(); require 'header.php'; if (check('text')) { $text = clean($_POST['text']); $foundPosts = array(); foreach (listEntry('posts') as $post) { $postEntry = readEntry('posts', $post); if (stripos($postEntry['title'], $text) !== false || stripos($postEntry['content'], $text) !== false) { $foundPosts[$post] = $postEntry['title']; } } $out['title'] = $lang['search']; $out['content'] .= '<ul>'; if ($foundPosts) { foreach ($foundPosts as $post => $title) { $out['content'] .= '<li><a href="./view.php?post=' . $post . '">' . $title . '</a>' . managePost($post) . ' — ' . toDate($post) . '</li>'; } } $out['content'] .= '</ul>'; } else { home(); } require 'templates/page.php';