사용자 도구


Dokuwiki

DokuWiki란 위키 사이트를 운영할 수 있는 도구이다. 간단히 위키피디아를 떠올리면 된다. 위키피디아의 경우 MediaWiki란 툴로 운영되고 있으나 MediaWiki는 개인 위키로 사용하기에는 설정해야할 시간이 오래 걸리고 무겁다고 한다. DokuWiki는 MySQL등의 데이터베이스를 이용하지 않고 파일을 이용하여 자료를 저장하기 때문에 자료의 백업, 복구가 간단하다.

설치

apt-get install 을 이용하면 설정 파일까지 자동으로 설치되나 버그가 있는듯하다. 설치 후 모든 파일 권한을 777로 주었는데도 dokuwiki 설정 시 the settings file can not be updated ~ 에러 메시지가 뜬다. 그러므로 다음 사이트를 참고하여 설치한다.

나의 경우 /var/www/wiki 폴더에 압축을 푼 뒤 권한 설정하고 myip/wiki/install.php 로 설치하였다.

사용자 관리

유저정보는 {dokuwiki 폴더}/conf/users.auth.php 에 저장되어 있다. 사용자 등록 가능 여부는 관리 > 환경 설정 > 인증 설정 > 도쿠위키 활동 비활성화 > 등록을 통해 할 수 있다.

플러그인

DokuWiki엔 1천개에 가까운 플러그인을 설치할 수 있다. 여기를 참고하자.

몇몇 유용한 플러그인 리스트는 아래를 참고하자.

Latex

여기에서 다운로드 받으면 된다. LaTeX, ImageMagick, Ghostscript가 시스템에 설치되어 있어야 사용 가능하다. 우분투에서는 다음 명령을 통해 설치할 수 있다.

$ apt-get install texlive-latex-base imagemagick ghostscript

comment

주석 작성을 하게 해주는 플러그인이다. 여기에서 다운로드 받을 수 있다.

dw2pdf

PDF 문서를 출력하기 위한 플러그인이다. 여기에서 다운로드 받을 수 있다.

템플릿

vector

DokuBook

모바일 스킨

  • Dokumobile1)을 다운로드 받아 설치한다.
  • Mobile_Detect.php2) 파일을 다운로드 받아 {dokuwiki 폴더}/conf/ 에 복사한다.
  • local.php 파일을 열어 “$conf['template']=”: 다음 줄에 다음 코드를 삽입한다.
include("Mobile_Detect.php");
$mdetect = new Mobile_Detect();
if ($mdetect->isMobile()) {$conf['template']='dokumobile';}

단 위키 설정을 바꿀 때마다 위 설정이 바뀌므로 그때마다 위의 작업을 해야한다.
KIEUNsWiki 란 곳에 다른 방법이 있기는 하나 어떻게 하는 것인지 잘 모르겠다.

보안

Dokuwiki는 자체 DB(텍스트 파일)를 사용하기 때문에 백업의 용이성도 있으나 data 폴더의 보안에 신경써줘야 한다. 만약 http://yourserver.com/data/pages/wiki/dokuwiki.txt 로 접속하였을 때 wiki:dokuwiki 문서의 내용이 보인다면 보안에 문제가 있는 것이다. Dokuwiki에서 접근제어 기능을 이용하여 접근을 막은 문서라 할지라도 문서 주소를 알면 wiki:dokuwiki처럼 내용을 볼 수 있기 때문이다. 그러므로 아래의 내용을 참고하여 아파치 설정을 변경해주어야 한다. (중요 위키 폴더에 .htaccess 파일이 있어야 한다)

나의 경우 AllowOverride None을 AllowOverride all로 바꾸어주어도 안되더라. 아파치 2.4 버전이어서 적용이 제대로 안되는 듯. 이 때에는 두 번째 방법을 적용한다.

<LocationMatch "/(data|conf|bin|inc)/">
    Order allow,deny
    Deny from all
    Satisfy All
</LocationMatch>

위키가 루트 폴더가 아니라면 아래와 같이 하면 된다.

        <Directory /var/www/dokuwiki>
            order deny,allow
            allow from all
        </Directory>
 
        <LocationMatch "^/dokuwiki/(data|conf|bin|inc)/">
            order allow,deny
            deny from all
            satisfy all
        </LocationMatch>

https 주소를 사용하는 경우 해당 conf 파일도 같은 방법으로 수정하면 된다. 아파치가 아닌 다른 웹서버는 위 링크 참고.

XE, 도쿠위키 연동

찾아보니 XE와 도쿠위키의 회원 정보를 연동하는 소스가 있다. 출처는 이곳. XE 1.7버전 용 소스도 이곳에 있더라.

zbxe.class.php
<?php
/**
 * ZBXE authentication backend
 * DokuWiki용 제로보드 XE 인증 모듈
 *
 * @license    Creative Commons 3.0 (원저작자 표시 조건 의무)
 * @author     Venister (Joongpil Cho) <venister@empal.com>
 */
class auth_zbxe extends auth_basic {
    var $url = array();
 
    function auth_zbxe() {
        global $conf;
 
        define('__ZBXE__', true);
 
        $config_file =  $conf['auth']['zbxe']['path']."files/config/db.config.php";
        require_once ($config_file);
 
        $this->url['path'] = $conf['auth']['zbxe']['path'];
        $this->url['db_prefix'] = $db_info->db_table_prefix;
        $this->url['host'] = $db_info->db_hostname;
        $this->url['user'] = $db_info->db_userid;
        $this->url['pass'] = $db_info->db_password;
        $this->url['database'] = $db_info->db_database;
 
        // 데이터베이스 연결
        $this->url['link'] = mysql_connect($this->url['host'], $this->url['user'], $this->url['pass']);
        if (!$this->url['link']) {
            msg('데이터베이스 서버에 연결할 수 없습니다: ' . mysql_error());
            $this->success = false;
            return;
        }
 
        if (!mysql_select_db($this->url['database'], $this->url['link'])) {
            msg('데이터베이스에 연결할 수 없습니다: ' . mysql_error());
            $this->success = false;
            return;
        }
        mysql_query("set names utf8");
 
        // PHP 4때문에 destructor를 명시적 선언
        register_shutdown_function("auth_zbxe_disconnect", $this);
    }
 
    // 패스워드 체크하는 함수
    function checkPass($user, $pass) {
        $query = "select count(*) from ".$this->url['db_prefix']."_member where user_id='$user' and password=MD5('$pass')";
        $result = mysql_query($query);
        if(!$result){
            msg('잘못된 쿼리: ' . mysql_error());
            return false;
        }
        $count = mysql_result($result, 0, 0);
        return ($count == 1 ? true: false);
    }
 
   // 유저 정보를 리턴
   //
   // name : 문자열, 유저이름
   // mail : 문자열, 메일주소
   // grps : 배열, 유저의 그룹 목록
    function getUserData($user) {
        global $conf;
 
        $query = "select user_name, email_address, member_srl from ".$this->url['db_prefix']."_member where user_id='$user'";
        $result = mysql_query($query);
        if(!$result) return null;
 
        if($data = mysql_fetch_array($result)){
            $info['name'] = $data[user_name];
            $info['mail'] = $data[email_address];
            $member_srl = $data[member_srl];
        }
 
        $group_table = $this->url['db_prefix']."_member_group";
        $group_member_table = $this->url['db_prefix']."_member_group_member";
 
        $query = "select g.title as title from ".$group_table." g, ".$group_member_table." gm where g.group_srl = gm.group_srl and gm.member_srl = '$member_srl'";
        $result = mysql_query($query);
 
        if (!$result){
            msg('쿼리 실패: ' . mysql_error());
            return false;
        }
 
        while($data = mysql_fetch_array($result)){
            if(strpos($conf['auth']['zbxe']['user'], $data[title]) !== FALSE){
                $info['grps'][] = 'user';
            }
            if(strpos($conf['auth']['zbxe']['admin'], $data[title]) !== FALSE){
                $info['grps'][] = 'admin';
            }
        }
 
        return $info;
    }
}
 
function auth_zbxe_disconnect($obj) {
    mysql_close($obj->url['link']);
}
 
?>

이 파일을 {dokuwiki 폴더}/inc/auth에 복사한다. 또한 {dokuwiki 폴더}/conf/local.php에 아래의 내용을 추가한다.

$conf['useacl'] = 1;
$conf['superuser'] = '@admin';  
$conf['authtype'] = 'zbxe';
$conf['auth']['zbxe']['path'] = "제로보드 설치 전체경로(반드시 /로 끝나야한다)";
$conf['auth']['zbxe']['user'] = "user그룹에 포함될 ZBXE의 그룹명. 여러개는 ;로 구분한다.";
$conf['auth']['zbxe']['admin'] = "admin그룹에 포함될 ZBXE의 그룹명. 여러개는 ;로 구분한다.";
$conf['openregister']= 0;
$conf['autopasswd'] = 1;
$conf['resendpasswd']= 0;

주의사항 : local.php는 ANSI로 인코딩되어 있다. 그러나 ANSI 인코딩에 그냥 한글로 된 그룹명을 쓰게 되면 절대 정상작동되지 않으므로 인코딩을 UTF-8(BOM코드가 없어야 한다)로 저장.

참고