Exemplo n.º 1
0
 function rss()
 {
     if (!empty($_GET['id'])) {
         $uid = (int) $_GET['id'];
         $user = App\Func::getUser($uid);
         $_mblog = createModel('MicroBlog');
         $_blog = createModel('UserLogs');
         $gets['uid'] = $uid;
         $gets['select'] = 'id,content,addtime';
         $gets['limit'] = 10;
         $mblogs = $_mblog->gets($gets);
         foreach ($mblogs as &$v) {
             $v['title'] = strip_tags(App\Func::mblog_link($v['id'], $v['content'], 30, true));
             $v['content'] = nl2br($v['content']);
             $v['url'] = WEBROOT . '/mblog/detail/' . $v['id'];
         }
         $gets['uid'] = $uid;
         $gets['select'] = 'id,title,content,addtime';
         $gets['limit'] = 10;
         $gets['dir'] = 0;
         $blogs = $_blog->gets($gets);
         $list = array_merge($mblogs, $blogs);
         usort($list, 'Func::time_sort');
         foreach ($list as &$v) {
             $v['addtime'] = date('r', strtotime($v['addtime']));
             if (empty($v['url'])) {
                 $v['url'] = WEBROOT . '/blog/detail/' . $v['id'];
             }
         }
         $this->swoole->tpl->ref('user', $user);
         $this->swoole->tpl->ref('list', $list);
         $this->swoole->tpl->display('blog_rss.xml');
     }
 }
Exemplo n.º 2
0
 function detail()
 {
     if (!isset($_GET['id'])) {
         exit;
     }
     $id = (int) $_GET['id'];
     $model = model('MicroBlog');
     $_u = model('UserInfo');
     $_c = model('UserComment');
     $comments = $_c->getByAid('mblog', $id);
     $mblog = $model->get($id)->get();
     $this->userinfo($mblog['uid']);
     $mblog['addtime'] = date('n月j日 H:i', strtotime($mblog['addtime']));
     $this->swoole->tpl->assign('mblog', $mblog);
     $title = strip_tags(App\Func::mblog_link(0, $mblog['content'], 32, true));
     $this->swoole->tpl->assign('title', $title);
     $this->swoole->tpl->assign('comments', $comments);
     $this->swoole->tpl->display();
 }
Exemplo n.º 3
0
 /**
  * 忘记密码
  * @return unknown_type
  */
 function forgot()
 {
     if ($_POST) {
         $gets['realname'] = $_POST['realname'];
         $gets['username'] = $_POST['email'];
         $gets['mobile'] = $_POST['mobile'];
         $gets['select'] = 'id';
         $ul = $this->model->UserInfo->gets($gets);
         if (count($ul) != 0) {
             $password = App\Func::randomkeys(6);
             $this->model->UserInfo->set($ul[0]['id'], array('password' => Auth::mkpasswd($gets['username'], $password)));
             App\Func::success('找回成功!', '您的新密码是 <span style="color:#fe7e00;">' . $password . '</a>');
         }
     } else {
         $this->swoole->tpl->display();
     }
 }