public function viewWorlds() { $map['id'] = $_GET['id']; if (empty($map)) { $this->gError("非法操作!", "index"); } $db = new WorldsModel(); $rs = $db->where($map)->relation(true)->find(); $this->assign('rs', $rs); $data = array('last_time' => ''); $db->where($map)->save($rs); $this->display("WapAdmin:viewWorlds"); }
public function add() { import("ORG.Util.Input"); $db = new WorldsResponsesModel(); $data['text'] = Input::deleteHtmlTags($_POST['text']); $data['w_id'] = $_POST['w_id']; $data['ip'] = $_SESSION['user_ip']; $data['name'] = $_SESSION['sina_me']['name']; $data['url'] = 'http://t.sina.com/' . $_SESSION['sina_me']['domain']; //将回复同步到新浪微博 $myname = $_SESSION['sina_me']['name']; $the_id = $data['w_id']; $sql = "SELECT * FROM `ty_worlds_responses` WHERE ( `w_id` = '{$the_id}' ) AND ( `name` != '' ) AND(`name`<>'{$myname}') \r\r\n\t\t\t group by name"; $result = $db->query($sql); foreach ($result as $item) { $name .= ' @' . $item['name'] . ' '; } if ($id = $db->add($data)) { $url = "http://t-y.me/index.php/Worlds/view/id/" . $data['w_id']; if ($name != '') { $msg = $this->sina_update($name . ' :TY在t-y.me回复了你!点击查看' . $url . ' ' . date("Y-m-d H:i:s")); } echo $data['text'] . " -<a href='" . $data['url'] . "'>" . $data['name'] . "</a>" . '(' . $name . $msg . ')'; } else { echo "<span style='color:red;'>Error</span>"; echo '(⊙o⊙)…杯具,服务器出现错误!'; } unset($data); $db = new WorldsModel(); $data['last_time'] = date("Y-m-d H:i:s"); $map['id'] = $_POST['w_id']; $db->where($map)->save($data); }
public function viewWorlds() { $w_id = $_GET['id']; if ($w_id == '') { $this->gError("非法操作!"); } $db = new WorldsModel(); $rs = $db->where("w_id={$w_id}")->relation(true)->select(); $this->assign('rs', $rs); $this->assign('w_id', $w_id); $this->display("WapAdmin:viewWorlds"); }
public function index() { import("ORG.Util.Page"); $now = date("Y-m-d"); $db = new WorldsModel(); $count['new'] = $db->where("substring(time,1,10)='{$now}'")->count(); //今日更新条数 $page = new Page($db->count(), 5); $rs = $db->relation(true)->order('id desc')->limit($page->firstRow . ',' . $page->listRows)->select(); $this->assign('count', $count); $this->assign('rs', $rs); $this->assign('page_nav', $page->show()); $this->display(); }
public function index() { import("ORG.Util.Page"); $now = date("Y-m-d"); $db = new WorldsModel(); $count['total'] = $db->count(); //总条数 $count['new'] = $db->where("substring(time,1,10)='{$now}'")->count(); //今日更新条数 $page = new page($count['total'], 10); $page->setConfig('header', '条微博'); $world = $db->relation(true)->order('id desc')->limit($page->firstRow . ',' . $page->listRows)->select(); $this->assign('count', $count); $this->assign('world', $world); $this->assign('page_nav', $page->show()); $this->display(); //dump($); }
public function addResponse() { import("ORG.Util.Input"); $db = new WorldsResponsesModel(); $data['text'] = Input::deleteHtmlTags($_POST['text']); $data['w_id'] = $_POST['w_id']; $data['ip'] = $_SESSION['user_ip']; $data['name'] = $_SESSION['sina']['name']; $data['url'] = 'http://t.sina.com/' . $_SESSION['sina']['id']; if ($id = $db->add($data)) { //echo $db->getLastSql();exit; $str1 = $data['text'] . "[IP:" . $_SESSION['user_ip'] . "]"; $str2 = $data['text'] . " -<a href='" . $data['url'] . "'>" . $data['name'] . "</a>"; echo $_SESSION['sina']['id'] != '' ? $str2 : $str1; } else { echo "<span style='color:red;'>Error</span>"; echo '(⊙o⊙)…杯具,服务器出现错误!'; } unset($data); $db = new WorldsModel(); $data['last_time'] = date("Y-m-d H:i:s"); $map['id'] = $_POST['w_id']; $db->where($map)->save($data); }
public function ediWorlds() { $map['id'] = $_SESSION['w_id']; $db = new WorldsModel(); $db->create(); if ($db->where($map)->save($data)) { $this->redirect("Index/index"); } else { $this->assign('jumpUrl', '__App__/Index'); $this->error('发表微博失败,请重试一次'); } //$db->getLastSql() }
public function addResponse() { import('ORG.Util.Input'); $db = new WorldsResponsesModel(); $data['text'] = Input::deleteHtmlTags($_POST['text']); $data['w_id'] = $_POST['w_id']; $data['ip'] = $_SESSION['user_ip']; if ($db->add($data)) { unset($data); $db = new WorldsModel(); $data['last_time'] = date("Y-m-d H:i:s"); $map['id'] = $_POST['w_id']; $db->where($map)->save($data); $this->gSuccess("你的评论“" . $_POST['text'] . "“发表成功!", "viewWorlds?id=" . $_POST['w_id']); } else { $this->gError("呃," . $db->getError(), "viewWorlds?id=" . $_POST['w_id']); } }