示例#1
0
<?php

use Engine\X;
use Engine\Gvar;
X::map('csrf', function () {
    echo "~~~~~~~~~~csrf~~~~~~~~~~~~~~";
});
//关闭csrf
X::setEnv('csrf', false);
//初始化session
X::register('session', function () {
    $session = new libraries\session();
    $session->start();
    return $session;
});
if (!X::session()->get('company_id') && X::getEnv('action') != 'signin' && X::getEnv('controller') != 'audit/index') {
    X::redirect('/audit/signin');
}
//
Gvar::set(['company_id' => X::session()->get('company_id'), 'company_name' => X::session()->get('company_name'), 'account' => X::session()->get('account')], 'audit');
示例#2
0
<?php

namespace controllers;

use Engine\X;
use Engine\Gvar;
use Engine\Route;
/**
* 首页
*/
Route::get('index', function () {
    $get = X::request()->get(['p' => 1]);
    list($count, $log) = X::module('post')->allByBanLog(Gvar::audit('company_id'), $get->p);
    X::render('audit/post', ['log' => $log, '__page_html' => defaultPageHtml($count, $get->p, '?')]);
});
示例#3
0
<?php

require "./X.php";
use Engine\X;
use Engine\Gvar;
use Engine\Mysql;
require '__init__.php';
/********************************************/
/********************************************/
// Bottle::map('notFound', function(){
// 	echo("~~~~~~~~~~~~notFound~~~~~~~~~~~~");
// });
X::map('exception', function () {
    echo "~~~~~~~~~~error~~~~~~~~~~~~~~";
});
X::init(['online' => false, 'baseUrl' => dirname(__FILE__) . DIRECTORY_SEPARATOR, 'templateFuncFile' => 'function/template.php']);
//连接数据库
X::register('db', function () {
    return new Mysql(X::getConfigVar('database'));
});
Gvar::set(['ip' => ip()], 'global');
//csrf_token
X::start(['audit']);
示例#4
0
<?php

namespace controllers;

use Engine\X;
use Engine\Gvar;
use Engine\Route;
/**
* 添加脏词
*/
Route::get('add', function () {
    X::render('audit/dirtyword_add');
});
Route::post('add', function () {
    $post = X::request()->post(['dirtyword' => '']);
    //添加脏词
    X::module('dirtyword')->add(['words' => $post->dirtyword, 'company_id' => Gvar::audit('company_id')]);
    X::redirect("/audit/dirtyword/add");
});
Route::get('delete', function () {
    $get = X::request()->get(['id' => '']);
    //添加脏词
    X::module('dirtyword')->del($get->id);
    echo "success";
});
示例#5
0
<?php

namespace controllers;

use Engine\X;
use Engine\Gvar;
use Engine\Route;
/**
* 首页
*/
Route::get('index', function () {
    $dirtyword = X::module('dirtyword')->byCompany(Gvar::audit('company_id'));
    X::render('audit/index', ['dirtyword' => $dirtyword]);
});
/**
* 查找
*/
Route::get('search', function () {
    $get = X::request()->get(['search' => '']);
    $dw = X::module('dirtyword')->search($get->search);
    X::render('audit/index', ['dirtyword' => $dw]);
});
/**
* 登录
*/
Route::get('signin', function () {
    X::render('audit/login');
});
Route::post('signin', function () {
    $post = X::request()->post(['account' => '', 'password' => '']);
    if (!$post->account || !$post->password) {