Ejemplo n.º 1
0
 function cut()
 {
     if (empty($_GET['id'])) {
         return "error: requirer miki_page id";
     }
     Swoole\Cookie::set('wiki_cut_id', $_GET['id'], 86400);
     return Swoole\JS::js_back("剪切成功,请到目标页面粘贴");
 }
Ejemplo n.º 2
0
 function index()
 {
     $_m = model('UserLogs');
     if (isset($_GET['del'])) {
         $_m->del((int) $_GET['del']);
         return Swoole\JS::js_back('删除成功!');
     }
     if (isset($_GET['act']) and $_GET['act'] == 'draft') {
         $gets['dir'] = 1;
     } else {
         $gets['dir'] = 0;
     }
     $gets['uid'] = $this->uid;
     $gets['page'] = empty($_GET['page']) ? 1 : (int) $_GET['page'];
     $gets['pagesize'] = 15;
     $pager = '';
     $list = $_m->gets($gets, $pager);
     $this->swoole->tpl->assign('list', $list);
     $pager = array('total' => $pager->total, 'render' => $pager->render());
     $this->swoole->tpl->assign('pager', $pager);
     $this->swoole->tpl->display();
 }
Ejemplo n.º 3
0
 /**
  * 添加好友
  */
 function friend()
 {
     if (!empty($_GET['add'])) {
         $fm = model('UserFriend');
         $get['frid'] = (int) $_GET['add'];
         $get['uid'] = $this->uid;
         $c = $fm->count($get);
         if ($c > 0) {
             return Swoole\JS::js_goto('你们已经是好友了!', '/person/myfriends/');
         } else {
             $fm->put($get);
             return Swoole\JS::js_goto('添加好友成功!', '/person/myfriends/');
         }
     }
 }
Ejemplo n.º 4
0
<?php

require '../config.php';
$php->tpl->template_dir = WEBPATH . '/admin/templates';
session();
//$php->db->debug = true;
$table = 'st_admin';
Swoole\Auth::$session_prefix = 'admin_';
Swoole\Auth::$login_url = '/admin/login.php?';
$auth = new Swoole\Auth($php->db, $table);
$refer = isset($_GET['refer']) ? $_GET['refer'] : WEBROOT . '/admin/index.php';
if ($auth->isLogin()) {
    header('location:' . $refer);
}
if (isset($_POST['username']) and $_POST['username'] != '') {
    $password = Swoole\Auth::mkpasswd($_POST['username'], $_POST['password']);
    if ($auth->login($_POST['username'], $password, isset($_POST['auto']) ? 1 : 0)) {
        $admin_id = $_SESSION['admin_user_id'];
        $_SESSION['admin_user'] = $php->db->query("select * from {$table} where id={$admin_id}")->fetch();
        header('location:' . $refer);
    } else {
        Swoole\JS::js_back('用户名或密码错误!');
        exit;
    }
} else {
    $php->tpl->display('admin_login.html');
}
if (isset($_GET['logout'])) {
    $auth->logout();
}
Ejemplo n.º 5
0
 function delete()
 {
     if (empty($_GET['id'])) {
         error(409);
     }
     $id = (int) $_GET['id'];
     if ($this->swoole->model->UserPhoto->del($id)) {
         return Swoole\JS::js_back('删除成功');
     }
 }
Ejemplo n.º 6
0
 function guestbook()
 {
     if ($_POST) {
         if (empty($_POST['realname'])) {
             Swoole\JS::js_back('姓名不能为空!');
             exit;
         }
         if (empty($_POST['mobile'])) {
             Swoole\JS::js_back('电话不能为空!');
             exit;
         }
         unset($_POST['x'], $_POST['y']);
         $_POST['product'] = implode(',', $_POST['product']);
         $_POST['source'] = implode(',', $_POST['source']);
         $php->model->Guestbook->put($_POST);
         Swoole\JS::js_goto('注册成功!', 'guestbook.php');
     }
     if (!empty($_GET['id'])) {
         $gb = $php->model->Guestbook->get($_GET['id'])->get();
         $php->tpl->assign('gb', $gb);
         $php->tpl->display('guestbook_detail.html');
     } else {
         require 'dict/forms.php';
         $pager = null;
         $gets['page'] = empty($_GET['page']) ? 1 : $_GET['page'];
         $gets['pagesize'] = 12;
         $gets['select'] = "id,username,title,addtime";
         $gets['where'][] = "reply!=''";
         $list = $php->model->Guestbook->gets($gets, $pager);
         $_forms['title'] = Swoole\Form::radio('title', $forms['title'], null, true, array('empty' => '请选择称谓'));
         $_forms['age'] = Swoole\Form::select('age', $forms['age'], null, true, array('empty' => '请选择年龄阶段'));
         $_forms['ctime'] = Swoole\Form::select('ctime', $forms['ctime'], null, true, array('empty' => '请选择方便沟通的时间'));
         $_forms['product'] = Swoole\Form::checkbox('product', $forms['product'], null, true);
         $_forms['source'] = Swoole\Form::checkbox('source', $forms['source'], null, true);
         $pager = array('total' => $pager->total, 'render' => $pager->render());
         $php->tpl->assign('pager', $pager);
         $php->tpl->assign('forms', $_forms);
         $php->tpl->assign("list", $list);
         $php->tpl->display('guestbook.html');
     }
 }