git-svn-id: http://xe-core.googlecode.com/svn/trunk@141 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-02-20 15:27:46 +00:00
parent ba268e8f1d
commit a35379d3a6
6 changed files with 28 additions and 114 deletions

View file

@ -1,5 +1,6 @@
RewriteEngine on
RewriteRule ^rss/([a-zA-Z0-9\_\-]*)$ ./index.php?mid=$1&act=dispRss
RewriteRule ^trackback/([0-9]*)$ ./index.php?document_srl=$1&act=procReceiveTrackback
RewriteRule ^([0-9]+)$ ./index.php?document_srl=$1
RewriteRule ^([a-zA-Z\_]+)$ ./index.php?mid=$1
RewriteEngine On
RewriteRule ^rss/([[:alnum:]]+)$ ./index.php?mid=$1&act=dispRss [L]
RewriteRule ^trackback/([[:digit:]]+)$ ./index.php?document_srl=$1&act=procReceiveTrackback [L]
RewriteRule ^admin ./index.php?module=admin [L]
RewriteRule ^([[:digit:]]+)$ ./index.php?document_srl=$1 [L]
RewriteRule ^([[:alnum:]]+)$ ./index.php?mid=$1 [L]

View file

@ -1,82 +0,0 @@
<?php
/**
* @file admin.php
* @author zero <zero@nzeo.com>
* @brief 관리자 페이지
*
* 추가되는 모듈의 관리를 위해 소스코드의 변경을 피하기 위해\n
* 관리자 페이지는 모듈의 admin action을 호출하여 구성을 한다.
**/
/**
* @brief 필요한 설정 파일들을 include
**/
require_once("./config/config.inc.php");
/**
* @brief Context 객체를 생성하여 초기화\n
* 모든 Request Argument/ 환경변수등을 세팅
**/
$oContext = &Context::getInstance();
$oContext->init();
/**
* @brief 설치가 안되어 있다면 index.php로 이동
* ModuleHandler를 이용하지 않기에 별도로 체크를 해주어야
**/
if(!Context::isInstalled()) {
header("location:./index.php");
exit();
}
/**
* @brief 관리자페이지에서 모듈의 선택은 sid로 한다.
**/
$sid = Context::get('sid');
if($sid) {
$oModule = module_manager::getAdminModuleObject($sid);
if(!$oModule) {
$sid = null;
Context::set('sid',$sid);
unset($oModule);
}
}
/**
* @brief 관리자(admin) 모듈 객체 생성
**/
$oAdmin = getModule('admin');
$oAdmin->moduleInit(null);
/**
* @brief 역시 ModuleHandler를 이용하지 않기에 직접 act 검사
**/
$act = Context::get('act');
if(!$sid&&!$oAdmin->isExistsAct($act)) $act = 'dispAdminIndex';
/**
* @brief 관리자 모듈의 실행 결과가 있으면 해당 실행결과를 출력
**/
if($oAdmin->proc($act)) {
$oModule = &$oAdmin;
/**
* @brief 관리자 모듈의 실행 결과가 없으면 호출된 다른 모듈의 관리자를 확인
**/
} else {
$oModule = module_manager::getAdminModuleObject($sid);
if($oModule) {
$oModule->moduleInit(null);
$oModule->proc();
// 관리자용 레이아웃으로 변경
$oModule->setLayoutPath($oAdmin->getLayoutPath());
$oModule->setLayoutTpl($oAdmin->getLayoutTpl());
}
}
/**
* @brief DisplayHandler 객체를 생성하여 모듈의 처리 결과를 출력
**/
$oDisplayHandler = new DisplayHandler();
$oDisplayHandler->printContent($oModule);
?>

View file

@ -53,8 +53,10 @@
}
// 모듈 정보에서 module 이름을 구해움
$module = $module_info->module;
$mid = $module_info->mid;
if($module_info) {
$module = $module_info->module;
$mid = $module_info->mid;
}
}
// 만약 모듈이 없다면 잘못된 모듈 호출에 대한 오류를 message 모듈을 통해 호출

View file

@ -11,42 +11,32 @@
* @brief 초기화
**/
function init() {
// 관리자 모듈 목록을 세팅
$oModuleModel = &getModel('module');
$module_list = $oModuleModel->getAdminModuleList();
Context::set('module_list', $module_list);
// template path 지정
$this->setTemplatePath($this->module_path.'tpl');
// 접속 사용자에 대한 체크
$oMemberModel = &getModel('member');
$logged_info = $oMemberModel->getLoggedInfo();
// 로그인 하지 않았다면 로그인 폼 출력
if(!$oMemberModel->isLogged()) return $this->act = 'dispLogin';
if(!$oMemberModel->isLogged()) return Context::set('act','dispLogin');
// 로그인되었는데 관리자(member->is_admin!=1)가 아니면 오류 표시
if($logged_info->is_admin != 'Y') {
Context::set('msg_code', 'msg_is_not_administrator');
return $this->act = 'dispError';
Context::set('act','dispError');
return;
}
// 관리자 모듈 목록을 세팅
$oModuleModel = &getModel('module');
$module_list = $oModuleModel->getModuleList();
Context::set('module_list', $module_list);
// 관리자용 레이아웃으로 변경
//$this->setLayoutPath($this->getLayoutPath());
//$this->setLayoutTpl($this->getLayoutTpl());
// 로그인/로그아웃 act의 경우는 패스~
if(in_array($this->act, array('procLogin', 'procLogout'))) return true;
// 접속 사용자에 대한 체크
$logged_info = $oMemberModel->getLoggedInfo();
// 로그인되었는데 관리자(member->is_admin!=1)가 아니면 오류 표시
if($logged_info->is_admin != 'Y') {
$this->setError(-1);
$this->setMessage('msg_is_not_administrator');
return false;
}
return true;
$this->setLayoutPath($this->getTemplatePath());
$this->setLayoutFile('layout.html');
}
/**

View file

@ -2,5 +2,8 @@
<module default_action="dispAdminIndex" management_action="">
<actions>
<action name="dispAdminIndex" type="view" grant="root" />
<actions>
<action name="dispLogin" type="view" grant="guest" />
<action name="dispLogout" type="view" grant="root" />
<action name="dispError" type="view" grant="guest" />
</actions>
</module>

View file

@ -32,7 +32,7 @@
<a href="{getUrl('act','dispLogin')}">[{$lang->cmd_login}]</a>
<!--@end-->
<!--@if($logged_info->is_admin=='Y')-->
<a href="./admin.php?sid=board&amp;act=dispModuleInfo&amp;module_srl={$module_srl}" target="_blank">[{$lang->cmd_management}]</a>
<a href="{getUrl('module','admin','sid',$module,'act','dispModuleInfo','module_srl',$module_srl,'mid','')}" target="_blank">[{$lang->cmd_management}]</a>
<!--@end-->
</div>