rabin 7 lat temu
commit
d20b03edc2

+ 4 - 0
README.md

@@ -0,0 +1,4 @@
+几年前写的tt工具包..php版本(Tokyo Tyrant)...早废弃了..留着纪念吧
+
+启动:
+php service/start.php

+ 24 - 0
config/feature.php

@@ -0,0 +1,24 @@
+<?php
+#tt项目配置
+
+$config['global'] = array
+                    (
+                        'name' => 'feature',
+                        'state' => 1,
+                        'server' => '/usr/local/tt/bin/',
+                    );
+
+$config['db'] = array
+                    (
+                        0 => 'tags_data',
+                    );
+
+$config['tags_data'] = array
+                    (
+                        'type' => 'tct',
+                        'host' => '192.168.1.203',
+                        'port' => '2022',
+                        'thnum' => 32,
+                        'ulim' => '128m',
+                        'ext' => '#idx=cdate:dec#bnum=1000000#rcnum=1000000#dfunit=8',
+                    );

+ 340 - 0
core.php

@@ -0,0 +1,340 @@
+<?php
+/**
+ * tt管理工具
+ * 作者:于斌
+ */
+
+#tt守护进程核心
+define('TT_IN'                  ,  true);
+define('TT'                     ,  'tt');
+define('TT_PATH'                ,  dirname(__FILE__)    . DIRECTORY_SEPARATOR);
+define('TT_SERVICE_PATH'        ,  TT_PATH . 'service' . DIRECTORY_SEPARATOR);
+define('TT_DB_PATH'             ,  TT_PATH . 'db' . DIRECTORY_SEPARATOR);
+define('TT_BAK_PATH'            ,  TT_PATH . 'bak' . DIRECTORY_SEPARATOR);
+define('TT_MANAGE_PATH'         ,  TT_PATH . 'manage' . DIRECTORY_SEPARATOR);
+define('TT_CONFIG_PATH'         ,  TT_PATH . 'config' . DIRECTORY_SEPARATOR);
+define('TT_LOG_PATH'            ,  TT_PATH . 'log' . DIRECTORY_SEPARATOR);
+
+/**
+ * tt_config()
+ */
+function tt_config()
+{
+    return scandir(TT_CONFIG_PATH);
+}
+
+/**
+ * tt_echo()
+ */
+function tt_echo($string)
+{
+    static $str;
+    $str .= tt_log($string . "\n");
+    return $str;
+}
+
+/**
+ * tt_log()
+ */
+function tt_log($str)
+{
+    $time = time();
+    $file = tt_mkdir(TT_LOG_PATH . date('Y-m-d', $time) . '/') . date('Y-m-d_H', $time) . '.log';
+    $content = '';
+    if(is_file($file))
+    {
+        $content = file_get_contents($file);
+    }
+
+    $content .= date('Y-m-d_H:i:s', $time) . ':' . $str;
+    file_put_contents($file, $content);
+    return $str;
+}
+
+/**
+ * tt_system()
+ */
+function tt_system($command)
+{
+    system($command);
+}
+
+/**
+ * tt_create()
+ */
+function tt_create($config)
+{
+    if(isset($config['host']))
+    {
+        $command = $config['server'] . 'ttserver -host ' . $config['host'] . ' -port ' . $config['port'] .' -thnum ' . $config['thnum'] .' -dmn -pid ' . $config['path'] . $config['name'] . '.pid -log ' . $config['path'] . $config['name'] . '.log -le -ulog ' . $config['ulog'] . ' -ulim ' . $config['ulim'] . ' -rts ' . $config['path'] . $config['name'] . '.rts ';
+
+        if(isset($config['mhost']))
+        {
+            $command .= '-sid ' . $config['sid'] . ' -mhost ' . $config['mhost'] . ' -mport ' . $config['mport'] . ' ';
+        }
+
+        if($config['type'] == '*')
+        {
+            $command .= '*';
+        }
+        else
+        {
+            $command .= $config['path'] . $config['name'] . '.' . $config['type'] . $config['ext'];
+        }
+        $command = 'ulimit -SHn 51200;' . escapeshellcmd($command);
+        tt_system($command);
+    }
+}
+
+/**
+ * tt_mkdir()
+ */
+function tt_mkdir($dir)
+{
+    if(!is_dir($dir))
+    {
+        mkdir($dir, 0775);
+    }
+    return $dir;
+}
+
+/**
+ * tt_runtime()
+ */
+function tt_runtime()
+{
+    static $time;
+    if(!$time)
+    {
+        $time = microtime();
+    }
+    else
+    {
+        $new = microtime() - $time;
+        return $new;
+    }
+}
+
+/**
+ * tt_load()
+ */
+function tt_load($php, $func = 'start')
+{
+    if(strstr($php, '.php') && is_file(TT_CONFIG_PATH . $php))
+    {
+        include(TT_CONFIG_PATH . $php);
+        if($config['global']['state'] == 1)
+        {
+            $path = tt_mkdir(TT_DB_PATH . $config['global']['name'] . '/');
+
+            if(!is_file($path . 'create'))
+            {
+                tt_echo($config['global']['name'] . ':正在对相关服务进行指定操作');
+                if(isset($config['db']))
+                {
+                    foreach($config['db'] as $i => $j)
+                    {
+                        call_user_func('tt_' . $func, $config, $j);
+                    }
+                    tt_echo($config['global']['name'] . ':完成指定操作');
+                }
+                else
+                {
+                    tt_echo($config['global']['name'] . ':没有数据库需要启动');
+                }
+                file_put_contents($path . 'create', time());
+            }
+            else
+            {
+                if(is_string($func))
+                {
+                    unlink($path . 'create');
+                    tt_echo($config['global']['name'] . ':清理权限文件成功');
+                    tt_load($php, $func);
+                }
+                else
+                {
+                    tt_echo($config['global']['name'] . ':没有操作权限');
+                }
+            }
+        }
+        else
+        {
+            tt_echo($config['global']['name'] . ':服务已关闭');
+        }
+    }
+    elseif(!strstr($php, '.'))
+    {
+        tt_echo($php . ':文件不存在,创建失败');
+    }
+}
+
+/**
+ * tt_start()
+ */
+function tt_start($data, $name)
+{
+    $path = tt_mkdir(TT_DB_PATH . $data['global']['name'] . '/' . $name . '/');
+    if(isset($data[$name]) && !is_file($path . $name . '.pid'))
+    {
+        $data[$name]['name'] = $name;
+        $data[$name]['path'] = $path;
+        $data[$name]['ulog'] = tt_mkdir($path . 'ulog/');
+        $data[$name]['server'] = $data['global']['server'];
+        tt_create($data[$name]);
+
+        $file = $path . $name . '.' . $data[$name]['type'];
+        if(is_file($file) && !is_file($file . '.create'))
+        {
+            $command = 'cp ' . $file . ' ' . $file . '.create';
+            tt_system($command);
+        }
+        tt_echo($data['global']['name'] . ':' . $name . '数据库启动成功');
+    }
+    else
+    {
+        tt_echo($data['global']['name'] . ':' . $name . '数据库已启动。');
+    }
+}
+
+/**
+ * tt_del()
+ */
+function tt_del($data, $name)
+{
+    $file = tt_mkdir(TT_DB_PATH . $data['global']['name'] . '/' . $name . '/') . $name . '.' . $data[$name]['type'];
+    if(is_file($file) && is_file($file . '.create'))
+    {
+        $command = 'rm -rf ' . $file . ';cp ' . $file . '.create ' . $file;
+        tt_system($command);
+        tt_echo($data['global']['name'] . ':' . $name . '数据库清理成功');
+    }
+    elseif(is_file($file . '.create'))
+    {
+        $command = 'cp ' . $file . '.create ' . $file;
+        tt_system($command);
+        tt_echo($data['global']['name'] . ':' . $name . '数据库清理成功');
+    }
+    else
+    {
+        tt_echo($data['global']['name'] . ':' . $name . '数据库清理失败。');
+    }
+}
+
+/**
+ * tt_bak()
+ */
+function tt_bak($data, $name)
+{
+    $dir = tt_mkdir(TT_DB_PATH . $data['global']['name'] . '/' . $name . '/');
+    if(is_dir($dir))
+    {
+        //tt_bakdel($data, $name);
+        $bak = tt_mkdir(tt_mkdir(TT_BAK_PATH . $data['global']['name']) . '/' . $name . '/') . date('Y-m-d_H:i:s', time()) . '.tar.gz';
+        $pid = $dir . $name . '.pid';
+        $command = "tar --exclude $pid -zcvPf $bak $dir";
+        tt_system($command);
+        tt_echo($data['global']['name'] . ':' . $name . '数据库备份成功。');
+    }
+    else
+    {
+        tt_echo($data['global']['name'] . ':' . $name . '数据库目录不存在,无法备份。');
+    }
+}
+
+/**
+ * tt_bakdel()
+ */
+function tt_bakdel($data, $name)
+{
+    $dir = TT_BAK_PATH . $data['global']['name'] . '/' . $name . '/';
+    if(is_dir($dir))
+    {
+        $command = "rm -rf {$dir}*.tar.gz";
+        tt_system($command);
+        tt_echo($data['global']['name'] . ':' . $name . '备份删除成功。');
+    }
+    else
+    {
+        tt_echo($data['global']['name'] . ':' . $name . '备份目录不存在,无法删除。');
+    }
+}
+
+/**
+ * tt_bakroll()
+ */
+function tt_bakroll($data, $name)
+{
+    $dir = TT_BAK_PATH . $data['global']['name'] . '/' . $name . '/';
+    if(is_dir($dir))
+    {
+        $file = scandir($dir);
+        $num = count($file) - 1;
+        $bak = $dir . $file[$num];
+        $command = "tar -zxvf $bak";
+        tt_system($command);
+        tt_echo($data['global']['name'] . ':' . $name . '备份回滚成功。');
+    }
+    else
+    {
+        tt_echo($data['global']['name'] . ':' . $name . '备份目录不存在,无法回滚。');
+    }
+}
+
+/**
+ * tt_ulog()
+ */
+function tt_ulog($data, $name)
+{
+    $dir = TT_DB_PATH . $data['global']['name'] . '/' . $name . '/' . 'ulog/';
+    if(is_dir($dir))
+    {
+        $ulog = scandir($dir);
+
+        foreach($ulog as $i => $j)
+        {
+            $num[$i] = intval(str_replace('.ulog', '', $j));
+            $file[$i] = $dir . $j;
+            $next[$i] = $dir . str_pad(($num[$i]+1), 8, '0', STR_PAD_LEFT) . '.ulog';
+            if(is_file($next[$i]))
+            {
+                unlink($file[$i]);
+            }
+        }
+        tt_echo($data['global']['name'] . ':' . $name . 'ulog清理成功,只留下最新的日志。');
+    }
+    else
+    {
+        //tt_echo($data['global']['name'] . ':' . $name . 'ulog清理失败。');
+    }
+}
+
+
+/**
+ * tt_stop()
+ */
+function tt_stop($data, $name)
+{
+    $file = tt_mkdir(TT_DB_PATH . $data['global']['name'] . '/' . $name . '/') . $name . '.pid';
+    if(is_file($file))
+    {
+        $pid = file_get_contents($file);
+        @unlink($file);
+        $command = 'kill -15 ' . $pid;
+        tt_system($command);
+        tt_echo($data['global']['name'] . ':' . $name . '数据库关闭成功。');
+    }
+    else
+    {
+        tt_echo($data['global']['name'] . ':' . $name . '数据库已关闭。');
+    }
+}
+
+/**
+ * tt_restart()
+ */
+function tt_restart($data, $name)
+{
+    tt_stop($data, $name);
+    tt_start($data, $name);
+}

+ 10 - 0
daemon/bak.php

@@ -0,0 +1,10 @@
+<?php
+/**
+ * tt管理工具
+ * 作者:于斌
+ */
+#数据备份
+$config['lang'] = '数据备份';
+$config['no'] = 'yes';
+$config['oper'] = 'bak';
+include(str_replace('daemon', '', dirname(__FILE__)) . '/service/service.php');

+ 10 - 0
daemon/del.php

@@ -0,0 +1,10 @@
+<?php
+/**
+ * tt管理工具
+ * 作者:于斌
+ */
+#数据清理
+$config['lang'] = '数据清理';
+$config['no'] = 'yes';
+$config['oper'] = 'del';
+include(str_replace('daemon', '', dirname(__FILE__)) . '/service/service.php');

+ 10 - 0
daemon/restart.php

@@ -0,0 +1,10 @@
+<?php
+/**
+ * tt管理工具
+ * 作者:于斌
+ */
+#重启
+$config['lang'] = '重启';
+$config['no'] = 'yes';
+$config['oper'] = 'restart';
+include(str_replace('daemon', '', dirname(__FILE__)) . '/service/service.php');

+ 10 - 0
daemon/ulog.php

@@ -0,0 +1,10 @@
+<?php
+/**
+ * tt管理工具
+ * 作者:于斌
+ */
+#日志清理
+$config['lang'] = '日志清理';
+$config['no'] = 'yes';
+$config['oper'] = 'ulog';
+include(str_replace('daemon', '', dirname(__FILE__)) . '/service/service.php');

+ 1 - 0
db/feature/create

@@ -0,0 +1 @@
+1341302471

+ 14 - 0
db/feature/tags_data/tags_data.log

@@ -0,0 +1,14 @@
+2012-06-12T11:59:15+08:00	SYSTEM	--------- logging started [14535] --------
+2012-06-12T11:59:15+08:00	SYSTEM	process ID configuration: path=/home/www/yubin/tt/db/feature/tags_data/tags_data.pid pid=14535
+2012-06-12T11:59:15+08:00	SYSTEM	server configuration: host=192.168.1.203 port=2022
+2012-06-12T11:59:15+08:00	SYSTEM	maximum connection: 1048575
+2012-06-12T11:59:15+08:00	SYSTEM	opening the database: /home/www/yubin/tt/db/feature/tags_data/tags_data.tct#idx=cdate:dec#bnum=1000000#rcnum=1000000#dfunit=8
+2012-06-12T11:59:15+08:00	SYSTEM	service started: 14535
+2012-06-12T11:59:15+08:00	SYSTEM	listening started
+2012-07-03T16:01:11+08:00	SYSTEM	--------- logging started [2644] --------
+2012-07-03T16:01:11+08:00	SYSTEM	process ID configuration: path=/home/www/yubin/tt/db/feature/tags_data/tags_data.pid pid=2644
+2012-07-03T16:01:11+08:00	SYSTEM	server configuration: host=192.168.1.203 port=2022
+2012-07-03T16:01:11+08:00	SYSTEM	maximum connection: 1048575
+2012-07-03T16:01:11+08:00	SYSTEM	opening the database: /home/www/yubin/tt/db/feature/tags_data/tags_data.tct#idx=cdate:dec#bnum=1000000#rcnum=1000000#dfunit=8
+2012-07-03T16:01:11+08:00	SYSTEM	service started: 2644
+2012-07-03T16:01:11+08:00	SYSTEM	listening started

+ 1 - 0
db/feature/tags_data/tags_data.pid

@@ -0,0 +1 @@
+2644

BIN
db/feature/tags_data/tags_data.tct


BIN
db/feature/tags_data/tags_data.tct.create


BIN
db/feature/tags_data/tags_data.tct.idx.cdate.dec


+ 5 - 0
log/2012-06-12/2012-06-12_11.log

@@ -0,0 +1,5 @@
+2012-06-12_11:59:15:正在开启ttserver服务...
+2012-06-12_11:59:15:feature:正在对相关服务进行指定操作
+2012-06-12_11:59:15:feature:tags_data数据库启动成功
+2012-06-12_11:59:15:feature:完成指定操作
+2012-06-12_11:59:15:程序执行完毕

+ 12 - 0
log/2012-07-03/2012-07-03_16.log

@@ -0,0 +1,12 @@
+2012-07-03_16:00:56:正在关闭ttserver服务...
+2012-07-03_16:00:56:feature:清理权限文件成功
+2012-07-03_16:00:56:feature:正在对相关服务进行指定操作
+2012-07-03_16:00:56:feature:tags_data数据库关闭成功。
+2012-07-03_16:00:56:feature:完成指定操作
+2012-07-03_16:00:56:程序执行完毕
+2012-07-03_16:01:11:正在开启ttserver服务...
+2012-07-03_16:01:11:feature:清理权限文件成功
+2012-07-03_16:01:11:feature:正在对相关服务进行指定操作
+2012-07-03_16:01:11:feature:tags_data数据库启动成功
+2012-07-03_16:01:11:feature:完成指定操作
+2012-07-03_16:01:11:程序执行完毕

+ 53 - 0
manage/index.php

@@ -0,0 +1,53 @@
+<?php
+/**
+ * tt管理工具
+ * 作者:于斌
+ */
+#管理接口
+define('TT_HTTP'           ,  'http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], 'index.php')));
+include(str_replace('manage', '', dirname(__FILE__)) . '/core.php');
+
+$config['name']         = 'ttserver manage v1.0';
+$config['request']      = $_REQUEST;
+
+if(isset($config['request']['service']))
+{
+    include(TT_SERVICE_PATH . $config['request']['service'] . '.php');
+
+    $project = $config['request']['project'];
+
+    tt_echo("正在" . $config['lang'] . "ttserver服务...");
+
+    if($project)
+    {
+        tt_load($project.'.php', $config['oper']);
+    }
+    else
+    {
+        $data = tt_config();
+        foreach($data as $k => $v)
+        {
+            tt_load($v, $config['oper']);
+        }
+    }
+
+    echo tt_echo('程序执行完毕');
+}
+elseif(isset($config['request']['view']) && $config['request']['view'] != 'index')
+{
+    is_file($config['request']['view'] . '.php') && include($config['request']['view'] . '.php');
+    $data = $$config['request']['view'];
+    $config['request']['type'] && $config['request']['view'] .= '.'.$config['request']['type'];
+    tt_view($config['request']['view'], $data);
+}
+else
+{
+    tt_view('index', $config);
+}
+/**
+ * tt_view()
+ */
+function tt_view($html, $data)
+{
+    include(TT_MANAGE_PATH . 'view/'.$html.'.htm');
+}

+ 60 - 0
manage/manage.php

@@ -0,0 +1,60 @@
+<?php
+/**
+ * tt管理工具
+ * 作者:于斌
+ */
+#管理接口
+if($config['request']['type'] == 'new')
+{
+    
+}
+elseif($config['request']['type'] == 'newaction')
+{
+    if($config['request']['name'])
+    {
+        $file = TT_CONFIG_PATH . $config['request']['name'].'.php';
+        if(is_file($file))
+        {
+            echo '项目已存在';die;
+        }
+        file_put_contents($file, '<?php #'. date('Y-m-d H:i:s') . 'ttserver管理工具创建'."\n" );
+        echo '创建成功';die;
+    }
+    else
+    {
+        echo '项目名称不能为空';die;
+    }
+}
+elseif($config['request']['type'] == 'set')
+{
+    $file = TT_CONFIG_PATH . $config['request']['name'].'.php';
+    $manage['name'] = $config['request']['name'];
+    $manage['data'] = file_get_contents($file);
+}
+elseif($config['request']['type'] == 'edit')
+{
+    $file = TT_CONFIG_PATH . $config['request']['name'].'.php';
+    $data = str_replace('\\','', $config['request']['content']);
+    if(is_file($file))
+    {
+        $state = file_put_contents($file, $data);
+    }
+    else
+    {
+        $state = false;
+    }
+    echo '编辑成功';die;
+}
+elseif($config['request']['type'] == 'data')
+{
+    
+}
+else
+{
+    $path = TT_CONFIG_PATH;
+
+    if(is_dir($path))
+    {
+        $manage['path'] = scandir($path);
+    }
+}

+ 19 - 0
manage/server.php

@@ -0,0 +1,19 @@
+<?php
+/**
+ * tt管理工具
+ * 作者:于斌
+ */
+#管理接口
+$array = array
+        (
+            'start' => '开启',
+            'stop' => '关闭',
+            'bak' => '备份',
+            'bakdel' => '备份删除',
+            'bakroll' => '备份恢复',
+            'del' => '数据清理',
+            'ulog' => '日志清理',
+        );
+
+$server['name'] = $array[$config['request']['oper']];
+$server['oper'] = $config['request']['oper'];

+ 52 - 0
manage/view/index.htm

@@ -0,0 +1,52 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"  dir="ltr" lang="zh-CN">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta http-equiv="X-UA-Compatible" content="IE=7">
+<script src="<?=TT_HTTP?>/view/js/jquery-1.2.6.min.js"></script>
+<script src="<?=TT_HTTP?>/view/js/config.js"></script>
+<script src="<?=TT_HTTP?>/view/js/extend.js"></script>
+<script src="<?=TT_HTTP?>/view/js/manage.js"></script>
+<script>$_c_v('root', '<?=TT_HTTP?>');</script>
+<title>管理中心 &lsaquo; ttserver管理系统v1.0beta版  &#8212; 金鹰网</title>
+</head>
+
+<body>
+<style>
+#content
+{
+    margin-top:20px;
+}
+#nav li
+{
+    display: inline;
+    list-style-type: none;
+    padding: 5px 2px;
+    cursor:pointer;
+    color:blue;
+}
+</style>
+<div id="nav">
+    <ul>
+        <li onclick="manage.go('view=manage');">[项目配置]</a></li>
+        <li onclick="manage.go('view=server&oper=start');">[开启服务]</a></li>
+        <li onclick="manage.go('view=server&oper=stop');">[关闭服务]</a></li>
+        <li onclick="manage.go('view=server&oper=bak');">[备份数据]</a></li>
+        <li onclick="manage.go('view=server&oper=bakdel');">[删除备份]</a></li>
+        <li onclick="manage.go('view=server&oper=bakroll');">[数据恢复]</a></li>
+        <li onclick="manage.go('view=server&oper=del');">[数据清理]</a></li>
+        <li onclick="manage.go('view=server&oper=ulog');">[日志清理]</a></li>
+        <li style="display:none;" onclick="manage.go('view=log');">[系统日志]</a></li>
+    </ul>
+</div>
+
+<div id="content">
+    <ul>
+        <li>欢迎来到ttserver管理工具v1.0beta。</li>
+        <li>创作者:yubin</li>
+        <li>点击功能按钮进行操作</li>
+    </ul>
+</div>
+
+</body>
+</html>

+ 45 - 0
manage/view/js/config.js

@@ -0,0 +1,45 @@
+/**
+ * Produce for workbin-doing - PHP frame development system
+ * http://produce.suwi.cn/
+ *
+ * @copyright Copyright (c) 2009-2011 Workbin development team CHINA Inc. (http://www.workbin.com)
+ * @author smilewind(SuWi.bin)<dandeyu@sina.com>
+ * @version $Id: config.script.js 2010-4-27 11:35 smilewind $
+ */
+
+
+/***************************
+ * 使用说明:
+ * $_c_d 全局数组 | $_c_v(d,v) 设置全局数组的值 | $_c_g(d,v) 设置全局变量的值 | $_c_u(d,g) 取消全局数组或者全局变量的值 | $_c_r(a,b) 取url参数
+ * $_c_j(s) 加载js | $_c_c(s) 加载css | $_c_i(s) 加载图片 | $_c_f(s) 加载flash | $_c_e(e) 执行代码 | $_c_w(e) 执行弹出
+ ***************************/
+
+
+var $_c_d = [];
+var $_c_v = function(d,v){$_c_d[d]=v};
+var $_c_g = function(d,v){eval("window."+d+"='"+v+"'")};
+var $_c_u = function(d,g){g=='global'?eval("delete window."+d+""):delete $_c_d[d]};
+var $_c_r = function(a,b){if(!b) var b = location.href;var rs = new RegExp('[\&|\?]{1}'+a+'=([\\w]+)').exec(b);if(rs == null) return null;return rs[1];};
+var $_c_j = function(s){if(!$_c_d['root']){document.write('not root is defined!');$_c_v('root','no');return}document.write('<script type="text/javascript" language="javascript" src="' +$_c_d['root'] + s + '.script.f-js"></script>');};
+var $_c_c = function(s){if(!$_c_d['root']){document.write('not root is defined!');$_c_v('root','no');return}document.write('<LINK href="' + $_c_d['root'] + 'resource/css/' +s + '.css" type="text/css" rel="stylesheet">');};
+var $_c_i = function(s){if(!$_c_d['root']){document.write('not root is defined!');$_c_v('root','no');return}return $_c_d['root']+'resource/img/' +s;};
+var $_c_f = function(s){if(!$_c_d['root']){document.write('not root is defined!');$_c_v('root','no');return}return $_c_d['root']+'resource/swf/' +s;};
+var $_c_e = function(e){return $_c_d[e]?eval($_c_d[e]):eval(e)};
+var $_c_w = function(e){$_c_d[e]?$.alert($_c_d[e]):$.alert(e)};
+
+/************************************
+ * 最基本与最简单的自定义函数
+ ************************************/
+
+$_c_v('$','document.getElementById(arguments[1])');																					//快速获取id
+$_c_v('jq','$(arguments[1])');																										//jq获取id
+$_c_v('e','if(typeof(arguments[1]) == "string"){"\'"+escape(arguments[1])+"\'"}else{arguments[1]}');
+$_c_v('u','unescape(arguments[1])');																								//加密解密
+$_c_v('null','if(!arguments[1] || arguments[1] == "" || arguments[1] == "undefined"){true}else{false}');							//判断字符串是否为空
+$_c_v('len','arguments[1].length');																									//获取字符串长度
+$_c_v('os','if(navigator.userAgent.indexOf("MSIE")>0){1}else if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){2}else if(isSafari=navigator.userAgent.indexOf("Safari")>0){3}else if(isCamino=navigator.userAgent.indexOf("Camino")>0){4}else if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){4}else{0}');																	//获取浏览器版本
+$_c_v('int','if(isNaN(arguments[1] = parseInt(arguments[1]))){0}else{arguments[1]}');												//转换为int型
+$_c_v('go','location.href=arguments[1];');																							//跳转
+$_c_v('time','var time = "";if(arguments[1] >= 86400){time += parseInt(arguments[1]/86400)+"天";arguments[1] = arguments[1]%86400;}if(arguments[1] >= 3600){time += parseInt(arguments[1]/3600)+"时";arguments[1] = arguments[1]%3600;}if(arguments[1] >= 60){time += parseInt(arguments[1]/60)+"分";arguments[1] = arguments[1]%60;}if(arguments[1] < 60 && arguments[1] > 0){time += arguments[1]+"秒";}time');																			//时间转换
+$_c_v('debug','var str="";var o=arguments[1];for(k in o){if(typeof o[k]=="function"){str+=k+"= function \\n";}else{str += k+"="+o[k]+"\\n";}}alert(str);'); //debug
+$_c_v('load','var onload=window.onload;if(typeof window.onload != "function"){window.onload = arguments[1];}else{window.onload = function() {onload();arguments[1]();}}');

+ 943 - 0
manage/view/js/extend.js

@@ -0,0 +1,943 @@
+/************************************
+ * jq插件区
+ ************************************/
+
+(function($)
+{
+	
+	$.extend({
+		//$().loading()的简化版
+		loading:function (options)
+		{
+			$().loading(options);
+		},
+		//$().overlay()的简化版,现在可以$.overlay();这么用。
+		overlay:function (options)
+		{
+			$().overlay(options);
+		},
+        //时间戳
+        getTime:function ()
+        {
+            var time = new Date();
+            return time.getTime();
+        },
+		//$().loadsize();的简化版
+		loadsize : function () 
+		{
+			return $().loadsize();
+		},
+		esc : function (e)
+		{
+			// == 27
+			if (e.keyCode) 
+			{
+				$('.overlay,.msg,.box').fadeOut(300,function(){$('.overlay,.msg,.box').remove();$(document).unbind('keydown');});
+				return false;
+			}
+		},
+		//用$.tip() 代替$().tip();
+		tip : function(str, time, url)
+		{
+			$().tip(str, time, url);
+		},
+		//定时器
+		timing : function ()
+		{
+			var now = +new Date;
+			for(k in $.que) 
+			{
+				if(now > $.que[k]) 
+				{
+					$('.msg[serial='+k+'],.overlay[serial='+k+']').remove();
+				}
+			}
+			if($('.msg').length == 0) 
+			{
+				clearInterval(ti);	//都消失时停止定时器
+				ti = undefined;
+			}
+		},
+		//ajax访问网站
+		form : function(rel,func,pre)
+		{
+			var e = $(".postForm[rel="+rel+"]");
+			var url = e.attr('action');
+			if(!url)
+			{
+				$.alert('url undefined',pre);
+			}
+			if(e.attr('send') != 'ajax')
+			{
+				e.iframeSubmit({cb:$_c_e('e',func),submit:1});
+				return;
+			}
+			var data = {};
+			$(".postForm[rel="+rel+"] .post").each(function(i){if($(this).attr('id')){eval('data.'+$(this).attr('id')+'='+$_c_e('e',$(this).val()));return $(this).check({func:pre})}})
+			
+			if($_c_d['status'] == false)
+			{
+				$_c_v('status',true);
+				return;
+			}
+			$.query(url,data,func);
+		},
+		query : function(url,data,func)
+		{
+			$.post(url+'.ajax',data,func);
+		},
+		//html代码过滤
+		txt : function()
+		{
+			return $(this).html().replace(/<\/?[^>]*>/g,'').replace(/[ | ]*\n/g,'\n').replace(/\n[\s| | ]*\r/g,'\n');
+		},
+		serial : 0,	//做为覆盖层和提示层的编号,每次+1
+		que : {}	//定时器队列,如{1:1245778952,4:1245778958}
+	});
+
+	/**
+	 * 对复选框的操作.action可以是choose,cancel,reverse三种,对应全选,全取消,反选三种.默认全选.参数写错归于reverse
+	 * 例: $('input[type=checkbox]').checkbox();	//全选
+	 *	$('input[type=checkbox]').checkbox('reverse');	//反选
+	 */
+	$.fn.checkbox = function (action)
+	{
+		if(!action) action = 'choose';
+		this.each(function (i, e){
+			if(action=='choose') {
+				e.checked = true;
+			}else if(action=='cancel') {
+				e.checked = false;
+			}else{
+				e.checked = !e.checked;
+			}
+		});
+		return this;
+	},
+	
+	/**
+	 * 数据错误时进行提示
+	 * 例: $('input').status('数据错误',false);	//进行验证
+	 *
+	 */
+	$.fn.status = function (t,f)
+	{
+		$(this).focus();
+		$_c_v('status',false);
+		f ? $.alert(t,f) : $(this).tip({str:t,time:1000,place: [120,'middle']});
+		//$(this).val('');
+	},
+
+    /**
+     * 对iframe高度进行控制
+     * 例: 
+     */
+    $.fn.iframe = function ()
+    {
+        if(!$(this).attr('id')) return;
+        var frame = document.getElementById($(this).attr('id'));
+        var page = document.frames ? document.frames[$(this).attr('id')].document : frame.contentDocument;
+        if(frame != null && page != null)
+        {
+            frame.height = page.body.scrollHeight;
+        }
+    }
+	
+	/**
+	 * 对数据进行监控
+	 * 例: $('input').monit();
+	 *
+	 */
+	$.fn.monit = function (c)
+	{
+		if(!$(this).attr('monit')) return;
+
+	},
+
+	/**
+	 * 对数据进行验证
+	 * 例: $('input').check();	//进行验证 需要有以下属性 check="1,2" lang 
+	 *
+	 */
+	$.fn.check = function (c)
+	{
+		if(!$(this).attr('check')) return;
+
+		//设置参数的默认值
+		p = $.extend({
+			url: false,		//验证地址
+			func: false	//回调函数名称
+		}, c || {});
+
+
+		var d = $(this).attr('check').split(',');
+		if(d[0])
+		{
+			//不能为空
+			if($_c_e('null',$(this).val()))
+			{
+				$(this).status($(this).attr('lang')+'不能为空',p.func);
+				return false;
+			}
+		}
+		if(d[1])
+		{
+			//验证相等
+			if($(d[1]).val() != $(this).val())
+			{
+				$(this).status($(this).attr('lang')+'不匹配',p.func);
+				return false;
+			}
+		}
+		if(d[2])
+		{
+			//验证正则
+			var reg = '';
+			var txt = '';
+			switch(d[2])
+			{
+				case 'chi'://中文验证
+					reg = /^[\u4e00-\u9fa5]*$/g;
+					txt = '必须为中文';
+					break;
+				case 'acc'://账户验证
+					reg = /^[a-zA-Z0-9_]{3,16}$/;
+					txt = '只能是英文和数字,字符在3-16之间';
+					break;
+				case 'mail'://邮箱验证
+					reg = /^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
+					txt = '格式不对,参考格式:XXXX@XXX.XXX';
+					break;
+				case 'mobile'://手机验证
+					reg = /^1\d{10}$/;
+					txt = '号码输入有误';
+					break;
+				case 'number'://手机验证
+					reg = /^-?\\d+$/;
+					txt = '不是一个整数';
+					break;
+			}
+			if(!$(this).val().match(reg))
+			{
+				$(this).status($(this).attr('lang')+txt,p.func);
+				return false;
+			}
+		}
+		if(d[3])
+		{
+			if($_c_d['status_url'] == false && p.func)
+			{
+				$(this).status($(this).attr('lang')+'已存在',p.func);
+				$_c_u('status_url');
+				return false;
+			}
+			//验证数据库中是否存在.
+			var $status = $(this);
+			$.query(p.url,{val:$(this).val(),check:d[3]},function(t)
+			{
+				if(t == -1)
+				{
+					$status.tip({str:$status.attr('lang')+'已存在',time:1000,place: [120,'middle']});
+					$_c_v('status_url',false);
+					return false;
+				}
+				else
+				{
+					$_c_v('status_url',true);
+				}
+			});
+		}
+		return true;
+	},
+	/**
+	 * 禁止或者激活表单元素。
+	 * example: 
+	 * 1.禁止或激活整个表单:$('form').disable();	$('form').disable(false);
+	 * 2.禁止或激活某些元素 $('input').disable();
+	 */
+	$.fn.disable = function (action)
+	{
+		if(action == undefined) action = true;
+		var items = this;
+		if($(this).attr('tagName') == 'FORM')
+		{
+			items = this.find('input[type=text],input[type=radio],input[type=checkbox],textarea,select');
+		}
+		items.each(function (i,e)
+		{
+			e.disabled = action;
+		});
+		return this;
+	},
+	/**
+	 * 获取checkbox的值.mod可以是字符串'array'或'str',空参数或写错参数都归为str方式.
+	 * 例: var val = $('input[type=checkbox]').checkboxVal();
+	 */
+	$.fn.checkboxVal = function (mod)
+	{
+		if(!mod) mod = 'str';
+		var array = new Array(), str = '';
+		this.each(function (i, e)
+		{
+			if(mod=='array')
+			{
+				if(e.checked) array.push(e.value);
+			}
+			else
+			{
+				if(e.checked) str += e.value+',';
+			}
+		});
+		if(mod=='array') return array;
+		if(!str) return '';
+		return str.substring(0, str.length - 1);
+	},
+
+	/**
+	 * 生成验证数据保存的对象
+	 *
+	 */
+	$.fn.createCheck = function ()
+	{
+		$(this).prepend('<input type="hidden" name="'+$(this).attr('name')+'_check" value="'+$(this).attr('check')+'" style="display:none;"/>');
+	},
+
+	/**
+	 * iframe方式提交表单,当有图片上传时.如果有回调函数,PHP需要这样返回
+	 * if($_GET['cb']) {
+		exit("<script>top.{$_GET['cb']}('$data')</script>");
+	   }
+	 */
+	$.fn.iframeSubmit = function (ob)
+	{
+		//设置参数的默认值
+		p = $.extend({
+			debug: 0,		//设为1会显示iframe
+			url: 'javascript:;',	//上传地址
+			cb: null,		//回调函数名称,不能用匿名函数形式
+			submit: 0		//是否显式提交,如果不是写在表单的提交事件中则需设为1
+		}, ob || {});
+		if(p.url == 'javascript:;') p.url = this.attr('action');
+		if(p.cb) 
+		{
+			var temp = p.cb.toString().match(/function[\ ]*([\w]+)/);
+			$(this).prepend('<input type="hidden" name="function" value="'+temp[1]+'" style="display:none;"/>');
+		}
+		if(!p.debug)
+		{
+			if(!$('iframe[name=uploadIframe]').length)
+			{
+				$(this).prepend('<iframe name="uploadIframe" style="display:none;"></iframe>');
+			}
+			$(this).attr('target', 'uploadIframe');
+		}
+		$(this).get(0).encoding = 'multipart/form-data';
+		$(this).attr('action', p.url + '.ajax');
+		if(p.submit) $(this).submit();
+	}
+	//一.简化用法
+	//$.tip('2秒后自动消失');
+	//$.tip('0.5秒后消失',500);
+	//$.tip('不自动消失',0);	//按esc键消失,或者调用$.tip('close');
+	//$.tip('2秒后自动转到百度,如果按esc键马上就跳转','http://www.baidu.com');	//时间参数和网址参数顺序可对调,因此不需要写成$.tip('内容',2000,url);
+	//二.复杂用法.详细可设置请查看设置参数默认值部分,可任意混合设定
+	//$.tip({str:'红色文字',color: '#F00'});
+	//$.tip({str:'灰色背景',background: '#ccc'});
+	//$.tip({str:'透明度设定',opacity: .5});
+	//$.tip({str:'透明度和内间距设置',opacity: .5,padding:'6px 20px'});
+	//$.tip({str:'不显示覆盖阴影层',overlay:false});
+	//$.tip({str:'显示在上方的中间',place: ['center','top']});
+	//$.tip({str:'显示在左上方',place: ['left','top']});
+	//$.tip({str:'任意位置',place: [100,'top']});
+	//三.以上的所有用法都是针对全局显示的,其实都可以为某个元素局部显示,并且可为多个元素显示
+	//$('#blogDiv,#replyDiv,#photoDiv').tip('载入中,请稍候');	//其实这种效果使用loading更方便一些.
+	//$('#blogDiv,#replyDiv').tip('close');	//只关闭日志与评论部分的提示,photo部分仍然显示
+	//还有太多例子了,总之看着参数随意组合吧.
+	$.fn.tip = function(options,time,url)
+	{
+		//简化的用法,例如$('div').tip('信息');
+		if(typeof options != 'object' && options != 'close') 
+		{
+			var options = {str: options};
+			if(typeof time == 'number') options.time = time;
+			if(typeof time == 'string') options.url = time;
+			if(typeof url == 'number') options.time = url;
+			if(typeof url == 'string') options.url = url;
+		}
+		
+		
+		//设置参数的默认值
+		var p = $.extend({
+			str:'&nbsp;',					//内容
+			time:2000,						//延时自动消失,单位为毫秒,设为0不消失,按esc键时才消失
+			url:'',							//提示消失后转向的url
+			color: '#666',					//字体颜色
+			background: '#fff',				//背景
+			border: '2px dashed #bababa',	//边框
+			fontloadsize: '12px',				//字体大小
+			overlay: false,					//是否带覆盖层阴影
+			textAlign: 'left',				//对齐方式
+			zIndex: 1500,					//z轴
+			opacity: 0.2,					//背景透明度,如果overlay设为真
+			padding: '3px 40px',			//内间距
+			place:['center','middle']		// ['left','top']或[150,400]
+		}, options || {});
+		
+		var scope = this.attr('tagName') ? 1 : 0;
+		this.each(function (i, e)
+		{
+			var e = scope ? $(e) : $('body');
+			if(options=='close')
+			{
+				return $('.overlay[serial='+e.attr('serial')+'], .msg[serial='+e.attr('serial')+']').remove();
+			}
+			//取页面尺寸与偏移信息
+			var ps = scope ? e.loadsize() : $.loadsize();
+			
+			//给层编号
+			if(e.attr('serial')) 
+			{
+				var serial = e.attr('serial');
+			}
+			else
+			{
+				var serial = ++$.serial;
+				e.attr('serial', serial) ;
+			}
+			
+			var jq = $('.msg[serial='+serial+']');
+			//创建容器
+			if(!jq.length) 
+			{
+				var msg = '<div class="msg" serial="'+serial+'" style="position:absolute;display:none;"></div>';
+				$('body').append(msg);
+				jq = $('.msg[serial='+serial+']');
+			}
+			
+			//数字转成字符串
+			if(typeof p.str == 'number') p.str += '';
+		
+			var leng = p.str.replace(/[^\x00-\xff]/g, "**").length;	//字符串真实长度
+			if(leng > 40) jq.width(200);
+			jq.html(p.str);
+			
+			jq.css('padding',p.padding).css('z-index',p.zIndex).css('color',p.color).css('background',p.background)
+			.css('border',p.border).css('text-align',p.textAlign).css('font-loadsize',p.fontloadsize);
+			//创建覆盖层
+			if(p.overlay)
+			{
+				if(scope) e.overlay(p);
+				else $().overlay(p);
+			}
+				
+			//开始定位
+			var top = 0; var left = 0; var jqw = jq.outerWidth(); var jqh = jq.outerHeight();
+			if(p.place[0] == 'center') left = (ps.w - jqw)/2;
+			else if(p.place[0] == 'left') left = 10;
+			else if(p.place[0] == 'right') left = ps.w - jqw - 20;
+			else left = p.place[0];
+			
+			if(p.place[1] == 'middle') top = (ps.h - jqh)/2;
+			else if(p.place[1] == 'top') top = 5;
+			else if(p.place[1] == 'bottom') top = ps.h - jqh;
+			else top = p.place[1];
+			
+			//显示
+			jq.css('top',top+ps.y).css('left', left+ps.x).fadeIn('fast');
+			
+			
+			if(p.time != 0) 
+			{
+				//加入定时器队列
+				$.que[serial] = +new Date + p.time;
+				
+				if(typeof ti == 'undefined') 
+				{	//一定要判断,不能会有多个定时器同时转动
+					ti = setInterval($.timing, 100);
+				}
+			}
+			if(p.url && p.time > 0) setTimeout("location.href='"+p.url+"'", p.time);
+		});
+		
+		//按esc、回车、c键退出
+		$(document).keydown(function (e)
+		{
+			if(p.url) 
+			{
+				setTimeout("location.href='"+p.url+"'", 100);
+			}
+		});
+		$(this).focus();
+		return this;
+	}
+	/**
+	 * 弹出框,用于比较复杂的内容,特别是ajax载入表单,窗口
+	 * 例:$.box({url: '/blog/form/34', width: 580, show:function (){alert('载入成功'}});
+	 * 看着参数自由组合吧,不想写一大堆例子了
+	 * 这个框组合起来可以实现confirm,alert等特定应用,当然会有简化版$.confirm, $.alert出现
+	 */
+	$.box = function (options)
+	{
+		if(options == 'close') return $('.overlay, .box').fadeOut(300,function(){$('.overlay, .box').remove()});//非手工关闭方式暂不支持关闭回调
+		//参数默认值
+		var p = $.extend({
+			width: 600,
+			height: 0,					//设为0则自动调整高度,不出现滚动条
+			overlay: true,				//是否使用覆盖阴影
+			border:'#eeeeee',				//整体的边框颜色
+			background: '#fff',
+			title: '',					//如果为空,不显示标题栏
+			drag: true,					//是否可拖拽,需要drag插件,如果没有也不会报错
+			url: '',					//ajax载入内容
+			show:function(){},			//显示时执行的函数
+			close:function(){},			//关闭时执行的函数
+			str: '',					//显示的内容,与url参数不共存
+			closeBtn: true,				//是否需要右上角关闭图标
+			closeImg: 1,				//关闭图标图片
+			buttons: [],				//按钮组,每个按钮是{text:'确定',handler:fn}形式
+			buttonAlign: 'center',		//按钮置中(或left,right)
+			buttonClass: 'mine-right-model-button',		//按钮的class
+			style: '',					//主容器的css设置
+			titleStyle:'',				//标题栏css设置
+			titleImg:1					//标题栏背景设置
+		}, options || {});
+		
+		//创建覆盖层
+		if(p.overlay) $.overlay({opacity:0.2});
+		
+		//加入box
+		if($('.box').length) $('.box').remove();
+		$('body').append('<div class="box"></div>');
+		var box  = $('.box');
+		
+		//box的调整
+		box.css({position:'absolute',visibility:'hidden',overflow:'hidden',width:p.width,zIndex:99,fontloadsize:'12px',color:'#666',
+			background: p.background,border:'5px solid '+p.border+'',padding: '20px 6px 10px 6px',overflowY:p.overflow});
+		if(p.height) box.height(p.height);
+		box.find('select').css({display:'none'});
+		if(p.style) 
+		{
+			box.attr('style',box.attr('style') + ';' + p.style)
+		}
+		
+		
+		//加入关闭功能
+		$(document).unbind('keydown');
+		$(document).keydown(function (e)
+		{
+			if (e.keyCode == 27)
+			{
+				$('.overlay, .box').fadeOut(300,function(){$('.overlay, .box').remove()});
+				p.close.call();
+			}
+		});	
+		if(p.closeBtn) 
+		{
+			box.prepend('<a class="boxClose" href="javascript:;" title="点击或按esc键关闭"><img style="display:none;" src="'+$_c_i('close/'+p.closeImg)+'.gif"/></a>');
+			$('.boxClose').css({position:'absolute',left:p.width - 5,top:5,zIndex:100,color:'#F00'}).click(function ()
+			{
+				$('.overlay, .box').fadeOut(300,function(){$('.overlay, .box').remove()});
+				p.close.call();
+			}).find('img').css('border','none');
+			if (box[0].scrollHeight > box[0].offsetHeight) 
+			{	//如果有滚动条,图标位置左移一点
+				$('.boxClose').css('left', p.width-20);
+			}
+		}
+		
+		//加入标题栏
+		if(p.title) 
+		{
+			box.prepend('<div class="boxTitle">'+p.title+'</div>');
+			var title = box.find('.boxTitle');
+			var titlePos = {position:'absolute',left:0,top:0,height:16,width:box.innerWidth(),background:'#000',
+				borderTop:box.css('borderTop'),fontloadsize:'14px',color:'#fff',fontWeight:'bold',padding:4};
+			if(p.titleImg)
+			{
+				titlePos.backgroundImage = 'url('+$_c_i('back/title'+p.titleImg+'.jpg')+')';
+				titlePos.backgroundRepeat = 'repeat-x';
+				titlePos.backgroundPositionY = 'top';
+			}
+			title.css(titlePos);
+			box.css({borderTop:0,paddingTop:parseInt(box.css('paddingTop')) + 15});
+			//$('.boxClose').css('top',10 + $_c_e('int',title.css('borderTop')));
+			if(p.titleStyle)
+			{
+				title.attr('style',title.attr('style') + ';' + p.titleStyle)
+			}
+		}
+		
+		//加入按钮组
+		if(p.buttons.length) 
+		{
+			box.append('<div class="boxBtn" style="margin-top: 16px;text-align:'+p.buttonAlign+';"></div>');
+			
+		}
+		for(k in p.buttons) 
+		{
+			box.find('.boxBtn').append('<button style="margin:0 5px;float:none;display:inline;">'+p.buttons[k].text+'</button>')
+				.find('button:last').click(p.buttons[k].handler);
+		}
+		
+		if(p.buttonClass) box.find('.boxBtn button').addClass(p.buttonClass);
+		
+		//执行善后工作,自动置中. 显示box,ie6下select的处理
+		var epilogue = function ()
+		{
+			box.center();	//自动置中
+			box.css('visibility','visible');//先隐藏再显示,不然在IE中定位时窗口会从左边闪到中间,用透明度来隐藏比display好,不影响定位
+			box.find('select').show();
+			if(!box.drag || !p.drag) return ;
+			//拖拽效果
+			if(p.title) {
+				box.drag({h: '.boxTitle'});
+			}else{
+				box.drag();
+			}
+			$("#boxContent").css({'text-align':'center','margin-top':'10px'});
+		}
+		//显示内容
+		if(p.str) 
+		{
+			box.prepend('<div id="boxContent">'+p.str+'</div>');
+			epilogue();
+			p.show.call();
+		}
+		else if(p.url) 
+		{
+			//ajax载入内容,执行回调函数
+			$.get(p.url+'.ajax', function (data) {
+				box.prepend('<div id="boxContent">'+data+'</div>');
+				box.find('select').css('display','none');
+				setTimeout(epilogue, 0);
+				p.show.call();
+			})
+		}
+	}
+	/**
+	 * box插件的confirm版本
+	 * @param string str	提示文本
+	 * @param fn yes	按下yes的回调函数
+	 * @param fn no		按下no的回调函数,默认为关闭box
+	 * @example		$.confirm('确定删除?', function (){//删除操作});
+	 */
+	$.confirm = function (str, yes, no)
+	{
+		if(!yes) var yes = function (){$.box('close');};
+		if(!no) var no = function (){
+			$.box('close');
+		};
+		var options = 
+		{
+			str:str,
+			width: 250,
+			closeBtn: false,
+			show: function ()
+			{
+				$('.box .boxBtn button:last').focus()
+			},
+			buttons:
+			[
+				{
+					text:'确定', handler:function ()
+					{
+						yes.call();
+					}
+				},
+				{
+					text:'取消', handler:no
+				}
+			]
+		};
+		$.box(options);
+	}
+	/**
+	 * box插件的alert版本
+	 * @param string str	提示文本
+	 * @param fn yes	按下yes的回调函数
+	 * @example		$.alert('很遗憾的说,你的智商低于10');
+	 */
+	$.alert = function (str, yes)
+	{
+		if(!yes) var yes = function (){$.box('close');};
+		var options = 
+		{
+			str:str,
+			width: 250,
+			closeBtn: false,
+			show: function ()
+			{
+				$('.box .boxBtn button:first').focus();
+			},
+			buttons:
+			[
+				{
+					text:'确定', handler:function ()
+					{
+						yes.call();
+					}
+				}
+			]
+		};
+		$.box(options);
+	}
+
+	/**
+	 * box插件的msg版本
+	 * @param string str	信息文本
+	 * @param string title	信息标题
+	 * @param string text	信息按钮文本
+	 * @param string w		宽度
+	 * @param fn yes	按下yes的回调函数
+	 * @example		$.msg('很遗憾的说,你的智商低于10','标题');
+	 */
+	$.msg = function (str, title, text, yes, show, no, width, btn)
+	{
+		if(!yes) var yes = function (){$.box('close');};
+		if(!no) var no = function (){
+			$.box('close');
+		};
+		var options = 
+		{
+			width:width ? width : 400,
+			title:title ? title : '信息提示',
+			closeBtn: btn ? btn : true,
+			show: function ()
+			{
+				eval(show);
+				$('.box .boxBtn button:last').focus();
+			},
+			buttons:
+			[
+				{
+					text:text, handler:function ()
+					{
+						yes.call();
+					}
+				},
+				{
+					text:'取消', handler:no
+				}
+			]
+		};
+		if(str.indexOf('.url') == -1)
+		{
+			options.str = str;
+		}
+		else
+		{
+			options.url = str.replace('.url','');
+		}
+		$.box(options);
+	}
+	$.fn.extend({
+
+		/**
+		 * 显示一个覆盖层
+		 * 整个页面覆盖: $().overlay(); //可以用上面的$.overlay();代替
+		 * 某个元素覆盖: $('#main').overlay();
+		 */
+		overlay : function (options)
+		{
+			//设置默认值
+			var m = $.extend({
+				
+					z : 99,		//zindex 覆盖高度
+					o : 0.2,	//opacity 透明度
+					l : 1,		//loading 加载的图片
+					a : ''		//action 动作close or loading
+			}, options || {});
+			var s = this.attr('tagName') ? 1 : 0;		//范围是全局还是局部
+
+			this.each(function(i,e)
+			{
+				if(s)
+				{
+					e = $(e);//局部
+					if(e.next('.overlay').length) return;
+					var p = e.loadsize();
+				}
+				else
+				{
+					e = $('body');//全局
+					if($('body>.overlay[rel=0]').length) return;
+					var p = $.loadsize();
+				}
+				if(options == 'close' || m.a == 'close') 
+				{
+					return $('.overlay[serial='+e.attr('serial')+']').remove();
+				}
+				//给层编号
+				if(e.attr('serial')) 
+				{
+					if($('.overlay[serial='+e.attr('serial')+']').length) return;	//不重复添加覆盖层
+					var serial = e.attr('serial');
+				}
+				else
+				{
+					var serial = ++$.serial;
+					e.attr('serial', serial);
+				}
+
+				var o = '<div class="overlay" serial="'+serial+'" style="left:0;top:0;display:none;z-index:'+m.z+';position:absolute;text-align:left;"></div>';
+				$('body').append(o);
+				o = $('.overlay[serial='+serial+']');
+				o.css('left',p.x);o.css('top',p.y);
+				o.width(p.W).height(p.H).css('opacity',m.o).css('background','#000').fadeIn(300);
+
+				if(m.a == 'loading') 
+				{
+					o.html('<img class="loading" src="'+$_c_i('common/loading/'+m.l)+'.gif" alt="loading..."/>');
+					o.find('.loading').css('margin-top',p.h/2 - 8);
+					o.find('.loading').css('margin-left',p.w/2 - 8);
+				}
+			});
+			//按esc键退出
+			$(document).keydown($.esc);
+			return this;
+		},
+		loadsize : function ()
+		{
+			//局部元素
+			if(this.attr('tagName')) 
+			{
+				var pos = this.offset();
+				pos.x = pos.left;
+				pos.y = pos.top;
+				pos.w = pos.W = this.outerWidth();
+				pos.h = pos.H = this.outerHeight();
+				return pos;
+			}
+			//获取浏览器可见部分的定位宽高信息
+			var w = document.documentElement.clientWidth;
+			var h = document.documentElement.clientHeight;
+			var x = document.documentElement.scrollLeft;
+			var y = document.documentElement.scrollTop;
+			if(self.pageXOffset) //兼容chrome
+			{	
+				x=self.pageXOffset;
+				y=self.pageYOffset;
+			}
+			//整体正文宽高
+			var W = $(document).width();
+			var H = $(document).height();
+			$_c_v('w',W);
+			$_c_v('h',H);
+			return {w:w, h:h, W:W, H:H, x:x, y:y};
+		},
+		//$.loading();相当于$.overlay({str:'<img class="loading" src="/res/css/images/loading.gif" alt="loading..."/>'});简化了用法
+		loading : function (options)
+		{
+			if(options == 'close') options = {a:'close'};
+			else  options = {a:'loading'};
+			this.overlay(options);
+			return this;
+		},
+		//跟随滚动条滚动
+		follow : function (options)
+		{
+			var m = this;
+			$(window).load(function()
+			{
+				$(m).followElect(options);
+			})
+			.scroll(function()
+			{
+				$(m).followElect(options);
+			})
+			.resize(function()
+			{
+				$(m).followElect(options);
+			});
+			return m;
+		},
+		//跟随滚动条滚动 效果
+		followElect : function(options)
+		{
+			//设置默认值
+			var m = $.extend({
+					speed : "fast",
+					position : "bottom",
+					func : function(){},
+					type : 1
+			}, options || {});
+			if(m.type == 2)
+			{
+				$(this).slideUp(m.speed,function()
+				{
+					$(this).slideDown(m.speed);
+					$(this).css(m.position,(-parseInt($( document ).scrollTop())+1)+"px");
+					m.func.call();
+				});
+			}
+			else
+			{
+				$(this).css(m.position,(-parseInt($( document ).scrollTop())+1)+"px");
+				m.func.call();
+			}
+			return this;
+		},
+		//元素置中
+		center : function ()
+		{
+			//box定位
+			var p = $.loadsize();
+			this.css({left:(p.w-this.outerWidth())/2 + p.x,top:(p.h-this.outerHeight())/2 + p.y});
+		},
+		/**
+		 * 拖拽插件,无依赖,为box提供拖拽功能,如果缺少本插件box也不出错,只是无拖拽功能
+		 * 例: $('div').drag({h:'h2'});	//将div中的h2做为拖拽句柄
+		 */
+		drag : function (options)
+		{
+			var m = $.extend({
+
+				h: ''			//handler 可拖拽点,默认为本身
+			},options || {});
+
+			this.each(function (i, e)
+			{
+				e = $(e);
+				var mx,my,x,y,left,top;	//mx,my是鼠标点击位置。x,y是元素原始坐标,left,top是元素的css属性
+				var mt = $_c_e('int',e.css('margin-top'));
+				var ml = $_c_e('int',e.css('margin-left'));
+				e.css({position:'absolute'});
+				var handler = m.h ? e.find(m.h) : e;
+
+				handler.css('cursor','pointer');
+				handler.mousedown(function (ev)
+				{
+					ev = ev || window.event;
+					var of = e.offset();x
+					mx = of.left;	//元素左上角x坐标
+					my = of.top;
+					x = ev.pageX;	//鼠标x坐标
+					y = ev.pageY;
+					
+					//left = $_c_e('int',e.css('left'));
+					//top = $_c_e('int',e.css('top'));
+					var l = $_c_d['w'] ? $_c_d['w'] : $(document).width();
+					var t = $_c_d['h'] ? $_c_d['h'] : $(document).height();
+					var bw = l-$(this).width()-30;
+					var bh = t-$(this).height()-55;
+					
+					$(document).mousemove(function (ec)
+					{
+						ec = ec || window.event;
+						var pl = mx + ec.pageX - x - ml;
+						var pt = my + ec.pageY - y - mt;
+						pl = pl >= bw ? bw : pl <= 0 ? 0 : pl;
+						pt = pt >= bh ? bh : pt <= 0 ? 0 : pt;
+						e.css({left:pl, top:pt});
+					});
+				});
+				$(document).mouseup(function ()
+				{
+					$(document).unbind('mousemove');
+				});
+			});
+			return this;
+		}
+	})
+
+})(jQuery);

Plik diff jest za duży
+ 11 - 0
manage/view/js/jquery-1.2.6.min.js


+ 64 - 0
manage/view/js/manage.js

@@ -0,0 +1,64 @@
+/**
+ * add by suwibin
+ */
+
+var manage = window.manage ||
+{
+    go : function(view)
+    {
+        var date = new Date();
+        $("#content").html('loading...');
+        $.get($_c_d['root'] + '?' + view + '&time=' + date.getTime(),function(t)
+        {
+            $("#content").html(t);
+        });
+    },
+    create : function()
+    {
+        $.confirm('确定创建这个项目吗?',function(){manage.createAction()});
+    },
+    createAction : function()
+    {
+        var name = $("#name").val();
+        if(!name)
+        {
+            $.alert('项目名称不能为空');
+            return;
+        }
+        $.post($_c_d['root'] + '?view=manage&type=newaction',{name:name},function(t)
+        {
+            $.alert(t, function(){$.box('close');manage.go('view=manage')});
+        });
+    },
+    edit : function()
+    {
+        $("#show").hide();
+        $("#edit").show();
+        $("#show_show").hide();
+        $("#edit_show").show();
+    },
+    show : function()
+    {
+        $("#edit").hide();
+        $("#show").show();
+        $("#edit_show").hide();
+        $("#show_show").show();
+    },
+    editpost : function(name)
+    {
+        var content = $("#"+name).val();
+        $.post($_c_d['root'] + '?view=manage&type=edit',{name:name,content:content},function(t)
+        {
+            $.alert(t,function(){$.box('close');manage.go('view=manage&type=set&name='+name)});
+        });
+    },
+    oper : function(oper)
+    {
+        $.confirm('确定进行此项操作吗?',function(){manage.operAction(oper)});
+    },
+    operAction : function(oper)
+    {
+        var name = $("#name").val();
+        manage.go('service='+oper+'&project='+name);
+    }
+};

+ 272 - 0
manage/view/js/mine.js

@@ -0,0 +1,272 @@
+/**
+ * add by suwibin
+ */
+
+var mine = window.mine ||
+{
+    speed : 100,
+    init : function()
+    {
+        mine.ud('#mine-header-right-link', '.mine-header-right-link');
+        mine.menu();
+        mine.model();
+        mine.png('div');
+        $(".mine-main").fadeIn(200);
+    },
+    png : function(e)
+    {
+        if(window.XMLHttpRequest)
+        {
+            return false;
+        }
+        else
+        {
+            if(e) png.fix(e);
+            return true;
+        }
+    },
+    ud : function(e1, e2)
+    {
+        $(e1 + ', ' + e2).bind('mouseenter', function()
+        {
+            $(e2).removeClass('slideUp').addClass('slideDown');
+            setTimeout(function()
+            {
+                if($(e2).hasClass('slideDown'))
+                {
+                    $(e2).slideDown(mine.speed);
+                }
+            }, 200);
+        }).bind('mouseleave', function()
+        {
+            $(e2).removeClass('slideDown').addClass('slideUp');
+            setTimeout(function()
+            {
+                if($(e2).hasClass('slideUp'))
+                {
+                    $(e2).slideUp(mine.speed);
+                }
+            }, 300);
+        });
+    },
+    model : function()
+    {
+        var parent;
+        $(".mine-right-model-unline").each(function()
+        {
+            parent = $(this).parent().parent();
+            parent.css('width',parent.attr('width')+'px');
+            if($(this).attr('class').indexOf('yes') != -1)
+            {
+                $(this).parent().next().slideUp();
+            }
+            $(this).bind('mouseenter',function()
+            {
+                $(this).addClass("mine-right-model-hover");
+            }).bind('mouseleave',function()
+            {
+                $(this).removeClass("mine-right-model-hover");
+            }).bind("click", function()
+            {
+                if($(this).attr('class').indexOf('yes') == -1)
+                {
+                    $(this).parent().next().slideUp(mine.speed);
+                    $(this).addClass("mine-right-model-yes");
+                }
+                else
+                {
+                    $(this).parent().next().slideDown(mine.speed);
+                    $(this).removeClass("mine-right-model-yes");
+                }
+            });
+        })
+    },
+    menu : function()
+    {
+        var next = [];
+        var unline = [];
+        var current = [];
+        $(".mine-left-arrow-up").each(function(){$(this).get(0).onclick = function(){mine.smallMenu()};})
+
+        $(".mine-left-link li").each(function()
+        {
+            $(this).mouseover(function()
+            {
+                $(this).addClass("mine-left-link-hover");
+            }).mouseout(function()
+            {
+                $(this).removeClass("mine-left-link-hover");
+            })
+        });
+        
+        $(".mine-left .mine-left-li").each(function(t)
+        {
+            current[t] = $(this).attr('class').indexOf('mine-left-current');
+            next[t] =  $(this).next();
+            unline[t] = $(this).children(".mine-left-unline");
+            if(current[t] == -1)
+            {
+                $(".mine-left-menu").eq(t).addClass("mine-left-menu-"+(t+1));
+            }
+            else
+            {
+                $(".mine-left-menu").eq(t).addClass("mine-left-menu-"+(t+1)+"-hover");
+                if(next[t].html() && next[t].attr('class') == 'mine-left-li-next' && next[t].attr('class').indexOf('mine-left-li-next-no') == -1)
+                {
+                    unline[t].addClass("mine-left-unline-current");
+                    next[t].slideDown(mine.speed);
+                    next[t].children(".mine-left-link").addClass("mine-left-link-current");
+                    unline[t].addClass("mine-left-unline-yes");
+                }
+            }
+            $(this).bind('mouseenter',function()
+            {
+                if(current[t] == -1)
+                {
+                    $(".mine-left-menu-"+(t+1)).addClass("mine-left-menu-"+(t+1)+"-hover");
+                    $(this).children(".mine-left-div").find("a").addClass("mine-left-a-hover");
+                }
+                else
+                {
+                    $(this).css('border','1px solid #bababa');
+                }
+                if(next[t].html() && next[t].attr('class').indexOf('mine-left-li-next') != -1)
+                {
+                    unline[t].addClass("mine-left-unline-hover");
+
+                    if(current[t] == -1)
+                    {
+                        unline[t].addClass("mine-left-unline-hover");
+                    }
+                    else
+                    {
+                        unline[t].addClass("mine-left-unline-current");
+                    }
+                    if(unline[t].attr('class').indexOf('click') == -1)
+                    {
+                        unline[t].bind("click", function()
+                        {
+                            if($(this).attr('class').indexOf('yes') == -1)
+                            {
+                                next[t].slideDown(mine.speed,function(){$(this).show()});
+                                $(this).addClass("mine-left-unline-yes").addClass("mine-left-unline-hover");
+                            }
+                            else
+                            {
+                                next[t].slideUp(mine.speed,function(){$(this).hide()});
+                                $(this).removeClass("mine-left-unline-yes");
+                            }
+                        }).addClass("mine-left-unline-click");
+                    }
+                }
+                else
+                {
+                    unline[t].addClass("mine-left-unline-no");
+                }
+            }).bind('mouseleave',function()
+            {
+                if(current[t] == -1)
+                {
+                    $(".mine-left-menu-"+(t+1)).removeClass("mine-left-menu-"+(t+1)+"-hover");
+                    $(this).children(".mine-left-div").find("a").removeClass("mine-left-a-hover");
+                }
+                else
+                {
+                    $(this).css('border','1px solid #6D6D6D');
+                }
+                if(next[t].html() && next[t].attr('class').indexOf('mine-left-li-next') != -1 && unline[t].attr('class').indexOf('yes') == -1)
+                {
+                    unline[t].removeClass("mine-left-unline-hover").removeClass("mine-left-unline-current");
+                }
+            });
+        });
+    },
+    smallMenu : function()
+    {
+        $(".mine-left-current").css('border','1px solid #E3E3E3');
+        $(".mine-left-li").addClass("mine-left-li-short").removeClass("mine-left-li");
+        $(".mine-left-div").hide();
+        $(".mine-left-li-next").each(function()
+        {
+            if($(this).get(0).style.display != 'none')
+            {
+                $(this).addClass("mine-left-li-display").removeClass("mine-left-li-no");
+            }
+            else
+            {
+                $(this).addClass("mine-left-li-no").removeClass("mine-left-li-display");
+            }
+            $(this).hide();
+        })
+        $(".mine-left-unline").hide();
+        $(".mine-left-current").addClass("mine-left-current-short").removeClass("mine-left-current");
+        $(".mine-left-arrow-up").addClass("mine-left-arrow-down").removeClass("mine-left-arrow-up").each(function(){$(this).get(0).onclick = function(){mine.bigMenu()};})
+
+        var next = [];
+        var child,title;
+        $(".mine-left .mine-left-li-short").each(function(t)
+        {
+            next[t] =  $(this).next();
+
+            $(this).bind('mouseenter',function()
+            {
+                $(".mine-left-div").hide();
+                $(this).css('border','1px solid #E3E3E3');
+                if(next[t].html() && next[t].attr('class').indexOf('mine-left-li-next') != -1)
+                {
+                    child = $(this).children(".mine-left-div");
+                    child.find("a").removeClass("mine-left-a-hover");
+                    if(child.html().indexOf('mine-left-link') == -1)
+                    {
+                        title = '';
+                        if(next[t].html().indexOf("mine-left-link-current") != -1)
+                        {
+                            title = 'mine-left-div-title-current';
+                        }
+                        child.html('<div class="mine-left-div-title '+title+'"><div class="mine-left-div-title-a">' + child.html() + '</div></div>' + next[t].html()).addClass("mine-left-div-short");
+                    }
+                    child.show();
+                    child.children(".mine-left-link").find("li").each(function()
+                    {
+                        $(this).bind('mouseenter',function()
+                        {
+                            $(this).addClass("mine-left-link-hover");
+                        }).bind('mouseleave', function()
+                        {
+                            $(this).removeClass("mine-left-link-hover");
+                        })
+                    })
+                    child.bind('mouseleave', function(){$(this).hide()});
+                }
+
+            }).bind('mouseleave',function()
+            {
+                $(this).css('border','1px solid #E3E3E3');
+            });
+        });
+    },
+    bigMenu : function()
+    {
+        $(".mine-left-div").each(function()
+        {
+            $(this).html($(this).find('.mine-left-div-title-a').html());
+        }).removeClass("mine-left-div-short").unbind();
+
+        $(".mine-left-li-next").each(function()
+        {
+            if($(this).attr('class').indexOf("mine-left-li-display") != -1)
+            {
+                $(this).show();
+            }
+        })
+
+        $(".mine-left-li-short").addClass("mine-left-li").removeClass("mine-left-li-short").unbind();
+        $(".mine-left-div").show();
+        $(".mine-left-unline").show();
+        $(".mine-left-current-short").addClass("mine-left-current").removeClass("mine-left-current-short");
+        $(".mine-left-arrow-down").addClass("mine-left-arrow-up").removeClass("mine-left-arrow-down").each(function(){$(this).get(0).onclick = function(){mine.bigMenu()};})
+
+        mine.menu();
+    }
+}
+$(document).ready(mine.init);

Plik diff jest za duży
+ 0 - 0
manage/view/js/png.js


+ 9 - 0
manage/view/manage.htm

@@ -0,0 +1,9 @@
+【项目配置】[<a href="javascript:;" onclick="manage.go('view=manage&type=new')">新增</a>]
+<div>
+<ul>
+    <?php foreach($data['path'] as $k => $v):?><?php if(strstr($v, '.php')):?>
+    <?php $name = str_replace('.php','',$v)?>
+    <li><input type="checkbox" name="check_<?=$name?>" id="check_<?=$name?>" value="<?=$name?>"><?=$name?><span class="mine-right-model-red">[<a href="javascript:;" onclick="manage.go('view=manage&type=set&name=<?=$name?>')">源文件</a>]</span></li>
+    <?php endif;?><?php endforeach;?>
+</ul>
+</div>

+ 7 - 0
manage/view/manage.new.htm

@@ -0,0 +1,7 @@
+【项目配置】[<a href="javascript:;" onclick="manage.go('view=manage')">编辑</a>]
+<div>
+<ul>
+    <li>项目名称:<input type="text" class="mine-right-model-input" name="name" id="name"/>(英文)</li>
+    <li><input type="button" value="确定创建" class="mine-right-model-button" onclick="manage.create()"/></li>
+</ul>
+</div>

+ 8 - 0
manage/view/manage.set.htm

@@ -0,0 +1,8 @@
+【项目配置】[<a href="javascript:;" onclick="manage.go('view=manage')">编辑</a>][<a href="javascript:;" onclick="manage.go('view=manage&type=new')">新增</a>]
+<div>
+<ul>
+    <li><div id="show" ondblclick="manage.edit()"><?=highlight_string($data['data'], true)?></div><div style="display:none;" id="edit" ondblclick="manage.show()"><textarea type="text" name="<?=$data['name']?>" id="<?=$data['name']?>" style="width:600px;height:500px;"><?=$data['data']?></textarea></div></li>
+
+    <li id="edit_show" style="display:none;"><input type="button" value="确定修改" class="mine-right-model-button" onclick="manage.editpost('<?=$data['name']?>');"/></li>
+</ul>
+</div>

+ 7 - 0
manage/view/server.htm

@@ -0,0 +1,7 @@
+【服务管理】(<?=$data['name']?>服务)
+<div>
+<ul>
+    <li>项目名称:<input type="text" class="mine-right-model-input" name="name" id="name"/>(不输入项目名称,则<?=$data['name']?>所有项目的服务)</li>
+    <li><input type="button" value="确定<?=$data['name']?>" class="mine-right-model-button" onclick="manage.oper('<?=$data['oper']?>')"/></li>
+</ul>
+</div>

+ 9 - 0
service/bak.php

@@ -0,0 +1,9 @@
+<?php
+/**
+ * tt管理工具
+ * 作者:于斌
+ */
+#备份数据库
+$config['lang'] = '备份';
+$config['oper'] = 'bak';
+if(!$config['name']) include('service.php');

+ 9 - 0
service/bakdel.php

@@ -0,0 +1,9 @@
+<?php
+/**
+ * tt管理工具
+ * 作者:于斌
+ */
+#删除备份数据库
+$config['lang'] = '删除备份';
+$config['oper'] = 'bakdel';
+if(!$config['name']) include('service.php');

+ 9 - 0
service/bakroll.php

@@ -0,0 +1,9 @@
+<?php
+/**
+ * tt管理工具
+ * 作者:于斌
+ */
+#回滚备份数据库
+$config['lang'] = '回滚备份';
+$config['oper'] = 'bakroll';
+if(!$config['name']) include('service.php');

+ 9 - 0
service/del.php

@@ -0,0 +1,9 @@
+<?php
+/**
+ * tt管理工具
+ * 作者:于斌
+ */
+#备份数据库
+$config['lang'] = '清理';
+$config['oper'] = 'del';
+if(!$config['name']) include('service.php');

+ 9 - 0
service/restart.php

@@ -0,0 +1,9 @@
+<?php
+/**
+ * tt管理工具
+ * 作者:于斌
+ */
+#重启restart
+$config['lang'] = '重启';
+$config['oper'] = 'restart';
+if(!$config['name']) include('service.php');

+ 35 - 0
service/service.php

@@ -0,0 +1,35 @@
+<?php
+/**
+ * tt管理工具
+ * 作者:于斌
+ */
+#开启ttserver服务 只有开启功能,重启请使用restart
+if(!$config)
+{
+    echo '错误的入口';die;
+}
+
+if(!$config['no'])
+{
+    echo "请输入要" . $config['lang'] . "的ttserver服务,不输入则" . $config['lang'] . "所有服务\n在输入服务名称之后按回车键\n";
+    $stdin = fopen('php://stdin','r'); 
+    $project = trim(fgets($stdin,100));
+}
+
+include(str_replace('service', '', dirname(__FILE__)) . '/core.php');
+tt_echo("正在" . $config['lang'] . "ttserver服务...");
+
+if($project)
+{
+    tt_load($project.'.php', $config['oper']);
+}
+else
+{
+    $data = tt_config();
+    foreach($data as $k => $v)
+    {
+        tt_load($v, $config['oper']);
+    }
+}
+
+echo tt_echo('程序执行完毕');

+ 9 - 0
service/start.php

@@ -0,0 +1,9 @@
+<?php
+/**
+ * tt管理工具
+ * 作者:于斌
+ */
+#开启ttserver服务 只有开启功能,重启请使用restart
+$config['lang'] = '开启';
+$config['oper'] = 'start';
+if(!$config['name']) include('service.php');

+ 9 - 0
service/stop.php

@@ -0,0 +1,9 @@
+<?php
+/**
+ * tt管理工具
+ * 作者:于斌
+ */
+#关闭ttserver服务
+$config['lang'] = '关闭';
+$config['oper'] = 'stop';
+if(!$config['name']) include('service.php');

+ 9 - 0
service/ulog.php

@@ -0,0 +1,9 @@
+<?php
+/**
+ * tt管理工具
+ * 作者:于斌
+ */
+#清理ulog
+$config['lang'] = '清理ulog';
+$config['oper'] = 'ulog';
+if(!$config['name']) include('service.php');

BIN
setup/tokyocabinet-1.4.45.tar.gz


BIN
setup/tokyotyrant-1.1.40.tar.gz


BIN
setup/tt20118v2.tar.gz


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików