<?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);
}
}
?>
在那地方改修密码 |