public function edit() { if ($this->isLogin()) { $id = getrequest('id'); if (!$this->ispost()) { if (!getrequest('id')) { import('ORG.Util.Page'); //导入分页类 $count = $this->model->where('status = 0')->count(); $Page = new Page($count, 5); $show = $Page->show(); $res = $this->model->where(array('status' => 0))->order('createtime')->limit($Page->firstRow . ',' . $Page->listRows)->select(); $data = $this->model->getNews($res); $this->assign('page', $show); $this->assign('data', $data); $this->display(); } else { $this->assign('id', $id); $result = $this->model->getById($id); $this->assign('result', $result); $this->display(); } } else { $data = array('author' => getRequest('author'), 'title' => getRequest('title'), 'info' => getRequest('info'), 'content' => getRequest('content')); //$this->model->create($data); $ret = $this->model->where(array('id' => $id))->data($data)->save(); $info = D('File')->upload('pic'); if ($info["status"] == 1001) { } else { if ($info["status"] != 0) { $this->error($info['msg']); } else { $this->model->where(array('id' => $id))->data(array('image' => $info['data']['fileid']))->save(); } } if ($ret) { $this->success('修改成功!', U('/Article/edit')); } else { $this->error('内容没有更改或保存数据库失败!'); } } } else { $this->error('请先登录', U('/Manager/login')); } }
public function single() { if ($this->isLogin()) { $this->checkPost(); $nickname = getrequest('nickname'); $User = D('User'); $uid = $User->where(array('nickname' => $nickname))->getField('id'); $res = $this->model->where(array('uid' => $uid))->select(); $len = count($res); if ($len) { $this->assign('len', $len); $this->assign('res', $res); $this->display(); } else { $this->error('没有查到该用户评论'); } } else { $this->error('请先登录', U('/Manager/login')); } }
<?php include 'bin/load_system.php'; $template->template = 'message/messages'; $template->additional_headerdata = '<link href="css/messages.css" rel="stylesheet" type="text/css">'; $template->additional_headerdata .= '<script src="js/messages.js"></script>'; noGuest(); // --- get REQUEST vars $EXTERNELVAL['i'] = getrequest('i', 'INT'); // --- get useres where i have an chat whith $chatPartner = $message->getUsersInMyChats(); // --- message to an new user if ($EXTERNELVAL['i'] > 0) { $foundInList = false; foreach ($chatPartner as $key => $value) { if ($value["id"] == $EXTERNELVAL['i']) { $foundInList = true; $chatPartner[$key]["selected"] = true; } } if (!$foundInList) { $aditionalUser = $message->getUserById($EXTERNELVAL['i']); $aditionalUser["selected"] = true; array_push($chatPartner, $aditionalUser); } } // --- show chatPartner where i have an chat with $HTMLout = ""; if (count($chatPartner) == 0) { $HTMLout = "Keine Nachrichten"; } else {
<?php echo $output[1]->DepartureText; ?> </div> </h4> </div> <div class='panel-body direction'> <h3 class="direction"> <?php echo $direction2; ?> </h3> <?php //Sets the URL $requrl = 'http://svc.metrotransit.org/nextrip' . $routeNum2 . $stationID . '?format=json'; //requests the URL $output = getrequest($requrl); ?> <h4 class="direction"> <div class='time panel-footer' onclick='location.href="https://www.google.com/maps?q=<?php echo $output[0]->VehicleLatitude; ?> ,<?php echo $output[0]->VehicleLongitude; ?> "'> <?php echo $output[0]->DepartureText; ?> </div> <div class='time panel-footer bottomfoot' onclick='location.href="https://www.google.com/maps?q=<?php echo $output[1]->VehicleLatitude;
<?php //Spider Program for Project BigLaw //20140418 Updated // Turn off all error reporting error_reporting(0); include_once 'simple_html_dom.php'; $type = getrequest('type', ''); //caselist:案件列表, casecontext:案件內容, caseprint:友善列印 $keyword = getrequest('keyword', ''); $page = getrequest('page', ''); $id = getrequest('id', ''); $jrecno = getrequest('jrecno', ''); $sdate = getrequest('sdate', ''); $edate = getrequest('edate', ''); $format = getrequest('format', ''); //plaintext:純文字, html:網頁 function getrequest($var, $default) { return isset($_REQUEST[$var]) ? $_REQUEST[$var] : $default; } //參數列表 //v_court //法院級別,S:最高院 H:高院 D:地院 A:最高行政 B:高等行政 P:公懲會 /* <OPTION value="TPC 司法院-刑事補償" selected>司法院-刑事補償</OPTION> <OPTION value="TPU 司法院-訴願決定">司法院-訴願決定</OPTION> <OPTION value="TPJ 司法院職務法庭">司法院職務法庭</OPTION> <OPTION value="TPS 最高法院">最高法院</OPTION> <OPTION value="TPA 最高行政法院">最高行政法院</OPTION> <OPTION value="TPP 公務員懲戒委員會">公務員懲戒委員會</OPTION>
<?php include 'bin/load_system.php'; // --- get REQUEST vars $EXTERNELVAL['email'] = getrequest('email', 'STR'); $EXTERNELVAL['guid'] = getrequest('i', 'STR'); $EXTERNELVAL['pw1'] = getrequest('pw1', 'STR'); $EXTERNELVAL['pw2'] = getrequest('pw2', 'STR'); // --- set template $template->template = 'reset_password/ask4mail'; // --- reset password / set guid if ($EXTERNELVAL['email'] != "") { $resetGuid = $user->setEmailResetCode($EXTERNELVAL['email']); if ($resetGuid != "") { if (sendMail($EXTERNELVAL['email'], "Passwort zurücksetzen", "reset_password", array("guid" => $resetGuid))) { $template->template = 'reset_password/mail_sendet'; } else { $template->message("E-Mail konnte nicht gesendet."); } } else { $template->message("Diese E-Mail wurde nicht gefunden."); } } // --- reset password / ask new Password if ($EXTERNELVAL['guid'] != "") { $template->template = 'reset_password/set_new_password'; $template->placeholder["guid"] = $EXTERNELVAL['guid']; } // --- reset password / set Password if ($EXTERNELVAL['pw1'] != "") { $userid = $user->getUserIdByEmailResetCode($EXTERNELVAL['guid']);
if ($EXTERNELVAL['newpw1'] != "" && $EXTERNELVAL['oldpw'] != "") { if ($EXTERNELVAL['newpw1'] == $EXTERNELVAL['newpw2']) { if ($user->changePassword($USER["id"], $EXTERNELVAL['oldpw'], $EXTERNELVAL['newpw1'])) { $template->message("Dein Passwort wurde geändert. Bitte melde Dich erneut an."); $template->template = 'login'; } } else { $template->message("Das Passwort und die Passwortbestätigung stimmen nicht überein. Bitte überprüfe Deine Eingaben."); } } break; case "vcard": $vcard = []; $vcard["name"] = getrequest('vcard_name', 'STR'); $vcard["phone"] = getrequest('vcard_phone', 'STR'); $vcard["street"] = getrequest('vcard_street', 'STR'); $vcard["zipcode"] = getrequest('vcard_zipcode', 'STR'); $vcard["city"] = getrequest('vcard_city', 'STR'); $vcard["public"] = getrequest('vcard_public', 'BOOL'); $user->setVCard($USER["id"], $vcard); $template->placeholder["vcard"] = $vcard; break; } if ($EXTERNELVAL['edit'] != "vcard") { $template->placeholder["vcard"] = $user->getVCard($USER["id"]); } if ($EXTERNELVAL['edit'] != "description") { $template->placeholder["profildescription"] = $user->getProfilDescription($USER["id"]); } $template->placeholder["vcard"]["public_checked"] = checked($template->placeholder["vcard"]["public"]); die($template->rollout());
<?php include 'bin/load_system.php'; // --- get REQUEST vars $EXTERNELVAL['username'] = getrequest('username', 'STR'); $EXTERNELVAL['password'] = getrequest('password', 'STR'); // --- set template $template->template = 'login'; //$template->additional_headerdata = '<script src="js/jssor.slider.mini.js"></script>'; //$template->placeholder['imageslider'] = $template->getSnippetHTML("partial/imageslider", array()); // --- try to login if ($EXTERNELVAL['username'] != "" && $EXTERNELVAL['password'] != "") { $result = $user->login($EXTERNELVAL['username'], $EXTERNELVAL['password']); if ($result->successful) { dietoindex(); } else { $template->messages = $result->messages; } } //---- sideBar // $template->placeholder["sidecontent"] = $template->getSnippetHTML("sidebar/login", Array()); die($template->rollout());
<?php include '../bin/load_system.php'; $EXTERNELVAL['to_user'] = getrequest('to_user', 'INT'); $EXTERNELVAL['message'] = getrequest('message', 'STR'); header('Content-Type: application/json'); $resultdata = array("succeeded" => false); if ($USER['id'] > 0 && $EXTERNELVAL['to_user'] > 0) { $newMassage = array('from_user_id' => $USER['id'], 'to_user_id' => $EXTERNELVAL['to_user'], 'create_date' => time(), 'message' => $EXTERNELVAL['message'], 'readed' => 0); if ($db->insert('user_messages', $newMassage)) { $resultdata = array("succeeded" => true); } } echo json_encode($resultdata);
<?php include_once 'common.php'; include_once 'v_court_list.php'; //請求參數列表 $sdate = getrequest('sdate', ''); //開始日 $edate = getrequest('edate', ''); //結束日 //v_court //請參見v_court_list.php //v_sys //審判別,A:行政 M:刑事 V:民事 P:公懲 S:訴願 for ($courtno = 0; $courtno < count($M_v_court_list); $courtno++) { $casecountquery = array('type' => 'casecount', 'v_court' => $M_v_court_list[$courtno], 'v_sys' => 'M', 'sdate' => $sdate, 'edate' => $edate); $casecountquery = http_build_query($casecountquery); //$casecountquery = urldecode($casecountquery); //確定案件數量 $ch = curl_init(); //curl_setopt($ch, CURLOPT_URL, 'http://www.meigic.tw:1888/BigLaw_Spider/spider.php'.'?'.$casecountquery); //curl_setopt($ch, CURLOPT_URL, 'http://www.meigic.tw:1888/BigLaw_Spider/spider.php?type=casecount&v_court=TPH%20%E8%87%BA%E7%81%A3%E9%AB%98%E7%AD%89%E6%B3%95%E9%99%A2&v_sys=M&sdate=20140401&edate=20140419'); $dir = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); $spiderurl = $dir . '/' . 'spider.php'; curl_setopt($ch, CURLOPT_URL, $spiderurl); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $casecountquery); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //return raw data curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded', 'Origin: http://jirs.judicial.gov.tw')); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'); $casecount = curl_exec($ch);
<?php include 'bin/load_system.php'; noGuest(); $EXTERNELVAL['from_user'] = getrequest('i', 'INT'); if ($EXTERNELVAL['from_user'] > 0) { include "profil_ext.php"; } else { include "profil_own.php"; } die($template->rollout());
<?php include "thislib.php"; getrequest(); # queries to convert : # # http://stackoverflow.com/questions/7122905/how-to-convert-such-sql-query-to-mongodb-query # http://www.mongodb.org/display/DOCS/SQL+to+Mongo+Mapping+Chart # other who automated # http://rickosborne.org/blog/2010/02/yes-virginia-thats-automated-sql-to-mongodb-mapreduce/ $title = "Convert sql to mongodb online"; $meta = <<<eof <meta name="Description" content="Online sql to mongodb converter"/> eof; $sql = array(); if ($r_sql) { # make as oneline $r_sql = stripslashes(trim($r_sql)); $oneline_sql = preg_replace('/\\r\\n?/', ' ', $r_sql); # remove ending ;'s $oneline_sql = preg_replace('/;+$/', '', $oneline_sql); preg_match('/^(\\w+) /i', $oneline_sql, $querytype); $sql['querytype'] = strtolower($querytype[1]); ### If select if ($sql['querytype'] == 'drop') { sqlerror("Drop not supported yet"); } else { if ($sql['querytype'] == "select") { $findcommand = "find"; preg_match('/select *?(.*?)from/i', $oneline_sql, $fields); preg_match('/select.*?from(.*?)($|where|group.*?by|order.*?by|limit|$)/i', $oneline_sql, $tables);