Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[已解决] Tools 3.0UC正式发布(单文件)

[复制链接]
fanjade 发表于 2008-10-29 17:39:33 | 显示全部楼层
<?php

/*
        [UCenter] (C)2001-2008 Comsenz Inc.
        This is NOT a freeware, use is subject to license terms

        $Id: cache.php 12135 2008-01-14 03:47:01Z heyond $
*/

!defined('IN_UC') && exit('Access Denied');

class control extends adminbase {

        var $certfile = '';

        function control() {
                $this->adminbase();
                $this->check_priv();
                if(!$this->user['isfounder']) {
                        $this->message('no_permission_for_this_module');
                }
                $a = getgpc('a');
                $checked = array('setting'=>'', 'db'=>'', 'doctor'=>'');
                $checked[$a] = 'ed';
                $this->view->assign('checked', $checked);
                $this->view->assign('a', $a);
                $template = 'admin_tool_'.$a;
                $this->view->assign('template', $template);

                $do = getgpc('do');
       
               
                $this->view->assign('do', $do);

                $this->certfile = UC_ROOT.'./data/ucenter_app_cert.data';

                $actionfile = UC_ROOT.'./control/admin/tool/'.$a.'.php';
                require $actionfile;
                $classname = $a;
               
                $method = 'on'.$do;
       
                $class = new $classname($this);
               
               
                if(method_exists($class, $method)) {
                        $class->$method();
                        exit;
                } elseif(method_exists($class, '_call')) {
                        $class->_call();
                } else {
                        exit('Method '.$method.' does not exist!');
                }
        }

        function _get_apps() {
                $applist = array();
                //note 从证书获取应用列表信息
                if(file_exists($this->certfile)) {
                        $s = file_get_contents($this->certfile);
                        $applist = $this->_dump_decode($s);
                }
                //note 如果获取失败,则从数据库给出应用列表
                if(empty($applist)) {
                        $this->load('app');
                        $applisttmp = $_ENV['app']->get_apps();
                        foreach($applisttmp as $listkey=>$app) {
                                $appid = $app['appid'];
                                $applist[$appid] = $app;
                                if(!is_array($app['extra'])) {
                                        $applist[$appid]['extra'] = array();
                                }
                        }
                }
                return $applist;
        }

        function _dump_encode($arr, $life = 0) {
                $s = "# UCenter Applications Setting Dump\n".
                "# Version: UCenter ".UC_VERSION."\n".
                "# Time: ".$this->time."\n".
                "# Expires: ".($this->time + $life)."\n".
                "# From: ".UC_API."\n".
                "#\n".
                "# This file was BASE64 encoded\n".
                "#\n".
                "# UCenter Community: https://discuz.dismall.com\n".
                "# Please visit our website for latest news about UCenter\n".
                "# --------------------------------------------------------\n\n\n".
                wordwrap(base64_encode(serialize($arr)), 50, "\n", 1);
                return $s;
        }

        function _dump_decode($s) {
                preg_match("/# Expires: (.*?)\n/", $s, $m);
                if(empty($m[1]) && $m[1] < $this->time) {
                        return array();
                }
                $s = preg_replace("/(#.*\s+)*/", '', $s);
                $arr = daddslashes(unserialize(base64_decode($s)), 1);
                return $arr;
        }
        function _applist(){
               
                $tools_appid = getgpc('tool_appid','C');
                if(!$appid){//如果没有传递过来应用ID 则进入选择应用界面
                       
                        $applists = $this->_get_apps();
                        $thism = getgpc('m', 'G');
                        $thisa = getgpc('a', 'G');
                        $thisdo = getgpc('do', 'G');
                        $this->view->assign('applisttemp', 'admin_tool_applist');
                        $this->view->assign('applists',$applists);
               
                       
                }
        }
        function _tdb_connect($applists) {
                $dbhost= $applists['extra']['dbhost'];
                $dbuser = $applists['extra']['dbuser'];
                $dbpw = $applists['extra']['dbpw'];
                $dbname = $applists['extra']['dbname'];
                $tablepre = $applists['extra']['tablepre'];
                $dbcharset = $applists['extra']['dbcharset'];
                require_once UC_ROOT.'lib/db.class.php';
                $this->tdb = new db();
                $this->tdb->connect($dbhost, $dbuser, $dbpw, $dbname, $dbcharset, $dbconnect, $dbtablepre);
        }
       
       

}

?>



在那地方改修密码
回复

使用道具 举报

sangni 发表于 2008-10-29 20:17:38 | 显示全部楼层
我也正要这个工具,太好了,谢楼主
回复

使用道具 举报

jrsun 发表于 2008-10-30 13:28:03 | 显示全部楼层
好东西,支持...
回复

使用道具 举报

lulut 发表于 2008-10-30 13:35:43 | 显示全部楼层
支持..这是好东西,下载保存了
回复

使用道具 举报

ccdy 发表于 2008-12-9 21:00:57 | 显示全部楼层
本帖最后由 ccdy 于 2008-12-9 21:02 编辑

支持这样的工具!

回复

使用道具 举报

czz80086 发表于 2008-12-12 09:12:53 | 显示全部楼层
怎么设置他的密码啊!我不会啊!
回复

使用道具 举报

ferryman 发表于 2008-12-12 10:27:51 | 显示全部楼层
写得很好,支持
回复

使用道具 举报

hxweb 发表于 2008-12-12 15:04:48 | 显示全部楼层
楼主辛苦了
回复

使用道具 举报

dongweicq 发表于 2008-12-12 16:21:43 | 显示全部楼层
好东西,支持
回复

使用道具 举报

leitian 发表于 2008-12-12 23:42:39 | 显示全部楼层
能不能清除附件呢?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-4-24 05:41 , Processed in 0.100050 second(s), 15 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表