Example #1
0
 private function save_add()
 {
     $cid = Lua::post('cid');
     if (empty($cid)) {
         Lua::ajaxmessage('error', '请选择所属频道');
     }
     $modelname = Lua::post('modelname');
     if (empty($modelname)) {
         Lua::ajaxmessage('error', '模型名称');
     }
     $developer = Lua::post('developer');
     if (empty($developer)) {
         Lua::ajaxmessage('error', '开发者');
     }
     $contact = Lua::post('contact');
     if (empty($contact)) {
         Lua::ajaxmessage('error', '联系方式');
     }
     $intro = Lua::post('intro');
     if (empty($intro)) {
         Lua::ajaxmessage('error', '模型描述');
     }
     $prefix = Lua::post('prefix');
     if (empty($prefix)) {
         Lua::ajaxmessage('error', '模型前缀');
     }
     $sqlarr = array('contact' => $contact, 'createtime' => time(), 'developer' => $developer, 'intro' => $intro, 'modelname' => $modelname, 'status' => 1, 'prefix' => $prefix, 'mtype' => Lua::post('mtype'), 'cid' => $cid);
     $id = Lua::insert('lua_model', $sqlarr);
     Lua::write_log($this->user, '增加模型', "model_id={$id}<br />modelname={$modelname}", SYSNAME);
     Lua::ajaxmessage('success', '操作成功', './model.htm');
 }
Example #2
0
 private function save()
 {
     $name = Lua::post('name');
     if (empty($name)) {
         Lua::ajaxmessage('error', '栏目名称');
     }
     $model_id = Lua::post('model_id');
     if (empty($model_id)) {
         Lua::ajaxmessage('error', '请选择模型');
     }
     $filename = Lua::post('filename');
     if (empty($filename)) {
         Lua::ajaxmessage('error', '静态名称');
     }
     $sqlarr = array('add_perm' => Lua::post('add_perm'), 'name' => $name, 'seoinfo' => Lua::post('seoinfo'), 'seokey' => Lua::post('seokey'), 'title' => Lua::post('title'), 'vieworder' => Lua::post('vieworder'), 'filename' => $filename, 'model_id' => $model_id, 'systemname' => SYSNAME, 'upid' => Lua::post('upid'));
     $lastid = Lua::insert('lua_category', $sqlarr);
     $this->_cache();
     Lua::write_log($this->user, '添加栏目', "catid={$lastid}<br />title=" . $name, SYSNAME);
     Lua::ajaxmessage('success', '操作成功', './category.htm');
 }
Example #3
0
    private function _check($mkdir = 0)
    {
        $name = Lua::post('name');
        if (empty($name)) {
            Lua::ajaxmessage('error', '频道名称');
        }
        $path = Lua::post('path');
        if (empty($path)) {
            Lua::ajaxmessage('error', '系统目录');
        }
        $groupname = Lua::post('groupname');
        if (empty($groupname)) {
            Lua::ajaxmessage('error', '频道管理组');
        }
        if ($mkdir == 1) {
            // 创建子系统
            $__Path = LUA_ROOT . $path . '/';
            mkdir($__Path);
            mkdir($__Path . 'cache/', 0777);
            mkdir($__Path . 'class/', 0777);
            mkdir($__Path . 'config/');
            $__route = '<?php 

$route["*"]["/' . ADMIN_ROOT . '"] = array("__home", "index");
$route["*"]["/' . ADMIN_ROOT . '/info.htm"] = array("__home", "info");
$route["*"]["/404.htm"] = array("__login", "E404");
$route["*"]["/401.htm"] = array("__login", "E401");
$route["post"]["/' . ADMIN_ROOT . '/login.htm"] = array("__login", "index");
$route["*"]["/' . ADMIN_ROOT . '/logout.htm"] = array("__login", "logout");
$route["*"]["/' . ADMIN_ROOT . '/member.htm"] = array("__member", "index");
$route["*"]["/' . ADMIN_ROOT . '/category.htm"] = array("__category", "index");
$route["*"]["/' . ADMIN_ROOT . '/content.htm"] = array("__content", "index");
$route["*"]["/' . ADMIN_ROOT . '/file.htm"] = array("__file", "index");
$route["*"]["/' . ADMIN_ROOT . '/piece.htm"] = array("__piece", "index");
$route["*"]["/' . ADMIN_ROOT . '/tpl.htm"] = array("__tpl", "index");
$route["*"]["/' . ADMIN_ROOT . '/plugin.htm"] = array("__extend", "admin");

// 以上为后台路由地址,不可更改!

$route["*"]["/"] = array("home", "index");
';
            file_put_contents($__Path . 'config/route.php', $__route);
            mkdir($__Path . 'controller/');
            $__auth = '<?php

class auth extends DooController{

    public $dir = "";
    public $img = "";
    public $user = array();
    public $page;
    
    /*
     * 初始化
     */
    public function beforeRun($resource, $action) {
        $this->dir = SYSNAME."/moban/";
        $this->img = "/".SYSNAME."/static/";
        $this->user = array();
        $this->page = Lua::get_post("p") ? intval(Lua::get_post("p")) : 1;
    }
}
';
            file_put_contents($__Path . 'controller/auth.php', $__auth);
            $__home = '<?php
Doo::loadController("auth");

class home extends auth{

    public function index(){
        include Lua::display("index", $this->dir);
    }
}
';
            file_put_contents($__Path . 'controller/home.php', $__home);
            mkdir($__Path . 'files/', 0777);
            mkdir($__Path . 'moban/');
            file_put_contents($__Path . 'moban/index.htm', $name);
            mkdir($__Path . 'moban/cache/', 0777);
            mkdir($__Path . 'plugin/');
            mkdir($__Path . 'static/');
            mkdir($__Path . 'static/img/');
            copy(LUA_ROOT . ADMIN_ROOT . '/static/img/water.png', $__Path . 'static/img/water.png');
            copy(LUA_ROOT . ADMIN_ROOT . '/icon.png', $__Path . 'icon.png');
            $__htaccess = '
RewriteEngine On

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule .* /' . $path . '/index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
';
            file_put_contents($__Path . '.htaccess', $__htaccess);
            $__index = '<?php 
define("SYSNAME", "' . $path . '");
require_once "../@Doo/Lua.php";
';
            file_put_contents($__Path . 'index.php', $__index);
        }
        return array('domain' => Lua::post('domain'), 'groupname' => $groupname, 'name' => $name, 'path' => $path, 'ishtml' => intval(Lua::post('ishtml')));
    }
Example #4
0
 private function _table($id, $ajax = 0)
 {
     $db = Lua::get_one("select * from lua_model_table where model_id='{$id}' and upid='0'");
     if (empty($db)) {
         if ($ajax == 1) {
             Lua::ajaxmessage('error', '栏目没数据表');
         } else {
             Lua::admin_msg('提示信息', '栏目没数据表');
         }
     }
     return $db;
 }
Example #5
0
 private function save()
 {
     $name = Lua::post('name');
     $kindof = Lua::post('kindof');
     $tplfile = Lua::post('tplfile');
     if (empty($name)) {
         Lua::ajaxmessage('error', '模板名称');
     }
     if (empty($kindof)) {
         Lua::ajaxmessage('error', '模板类型');
     }
     if (empty($tplfile)) {
         Lua::ajaxmessage('error', '模板文件名');
     }
     if (file_exists($this->tpl_path . $tplfile)) {
         Lua::ajaxmessage('error', $tplfile . ' 已存在');
     }
     $query = array('systemname' => SYSNAME, 'name' => $name, 'kindof' => $kindof, 'dateline' => TIMESTAMP, 'lasttime' => TIMESTAMP, 'uid' => $this->user['uid'], 'username' => $this->user['username'], 'tplfile' => $tplfile);
     Lua::insert('lua_tpls', $query);
     Lua::ajaxmessage('success', '操作成功', $this->_url($kindof));
 }
Example #6
0
 private function save_add()
 {
     $username = Lua::post('username');
     if (empty($username)) {
         Lua::ajaxmessage('error', '用户名');
     }
     $password = Lua::post('password');
     if (empty($password)) {
         Lua::ajaxmessage('error', '登录密码');
     }
     if ($password != Lua::post('confirm_password')) {
         Lua::ajaxmessage('error', '二次密码不相同');
     }
     $count = Doo::db()->count("select count(*) from lua_member where username='******'");
     if ($count > 0) {
         Lua::ajaxmessage('error', '此用户名已被使用');
     }
     $sqlarr = array('email' => Lua::post('email'), 'lastip' => $this->clientIP(), 'lasttime' => time(), 'password' => md5($password), 'regip' => $this->clientIP(), 'regtime' => time(), 'status' => 1, 'username' => $username);
     $uid = Lua::insert('lua_member', $sqlarr);
     Lua::write_log($this->user, '增加注册会员', "uid={$uid}<br />username={$username}", SYSNAME);
     Lua::ajaxmessage('success', '操作成功', './member.htm');
 }
Example #7
0
 public function _do()
 {
     $sql = Lua::post('content');
     Doo::db()->query($sql);
     Lua::ajaxmessage('success', '成功执行', './plugin.htm?action=sql');
 }
Example #8
0
 private function save_any_edit()
 {
     $tableid = Lua::get('tableid');
     $db = $this->_table($tableid);
     $fields = $this->_fields($db['tablename']);
     $pri = $this->_pri($fields);
     $var = Lua::get($pri);
     $post = Lua::post('post');
     $lastid = Lua::insert($db['tablename'], $post, 1);
     Lua::write_log($this->user, '修改任意数据', "table=" . $db['tablename'] . "<br />id={$lastid}<br />title=" . $post['subject'], SYSNAME);
     Lua::ajaxmessage('success', '操作成功', "./piece.htm?action=any&tableid={$tableid}");
 }
Example #9
0
 private function save_edit()
 {
     $username = Lua::post('username');
     if (empty($username)) {
         Lua::ajaxmessage('error', '用户名');
     }
     $perm = Lua::post('perm');
     if (empty($perm)) {
         Lua::ajaxmessage('error', '用户组');
     }
     $channel = Lua::post('channel');
     if (empty($channel)) {
         Lua::ajaxmessage('error', '所属频道');
     }
     $sqlarr = array('username' => $username, 'perm' => $perm, 'channel' => $channel);
     $where = array('uid' => Lua::get('uid'));
     $password = Lua::post('password');
     if ($password) {
         $confirm_password = Lua::post('confirm_password');
         if ($password != $confirm_password) {
             Lua::ajaxmessage('error', '二次密码不相同');
         }
         $sqlarr['password'] = md5($password);
     }
     Lua::update('lua_admin', $sqlarr, $where);
     Lua::write_log($this->user, '修改管理员', "uid=" . Lua::get('uid') . "<br />title={$username}", SYSNAME);
     Lua::ajaxmessage('success', '操作成功', './admin.htm');
 }