skip menu and go to main content

body start

MoniWiki

  XE와 등록사용자를 연동하고 싶어요. 4 ]

10.06.24-13:13:53

315449

Submitted by hellohi

 

View1022

 

어떻게 해야 하는지 소스가 궁금해요.

Comments on this artfact

4 Comments

wkpark

제가 XE사용자가 아니라서 잘 모릅니다만, 인터넷 서치해보시면 어떤 분이 XE연동 클래스를 만들어 사용하고 계시는 것 같더군요.

또 모니위키 1.1.4부터는 사용자 클래스를 따로 추가할 수 있습니다. plugin/user/nforge.php같은 클래스를 참고해서 만들 수 있습니다.

10.06.24-13:39:26

hellohi

그런데 플러그인을 어떻게 발동하나요?

10.06.26-18:02:09

wkpark

사용자 class의 경우는 1.1.4부터 들어간 기능입니다. 예를 들어 plugin/user/xe.php같은 사용자 플러그인을 만드셨다면

config.php에서 $user_class = 'XE';와 같은 식으로 하면 될것이고,

plugin/user/xe.php에는

class User_xe extends WikiUser {
...

와 같은 식으로 만드셔야 할 것입니다.

10.07.01-13:46:38

hellohi

config에도 등록하고 클래스도 바꾸고 했는데 위키 들어가니
Fatal error: Call to undefined function user_get_object() in /home1/marin/public_html/wiki/plugin/user/xe.php on line 25
이런 오류문구가 나는데요...
xe와 사소한 '정의된 단어'불이치 문제인듯 한데. 잘 모르겠어요. 혹시 알려줄 수 있어요?


<?php
// Copyright 2009 Won-Kyu Park <wkpark at kldp.org>
// All rights reserved. Distributable under GPL see COPYING
// a sample plugin for the MoniWiki
//
// Author: Won-Kyu Park <wkpark@kldp.org>
// Author: xe Team 2008
// Since: 2009-04-18
// Name: xe Unix based User plugin
// Description: xe Unix user plugin
// URL: MoniWiki:xeUserPlugin
// Version: $Revision: 1.8 $
// License: GPL
//
// Usage: set $user_class = 'xe'; in the config.php
//
// $Id: xe.php,v 1.8 2009/09/17 11:24:44 wkpark Exp $

class User_xe extends WikiUser {
    function User_xe($id = '') {
        if ($id) {
            $this->setID($id);
            $u =& user_get_object_by_name($id);
        } else {
            $u =& user_get_object(user_getid());
            if ($u and is_object($u) and !$u->isError()) {
                global $DBInfo;
                $id = $u->getUnixName();
            }
            if (!empty($id)) {
                $this->setID($id);
                $udb=new UserDB($DBInfo);
                $tmp = $udb->getUser($id);
                // get timezone and make timezone offset
                $tz_offset = date('Z');
                $update = 0;
                if ($tz_offset != $tmp->info['tz_offset'])
                    $update = 1;

                if ((!empty($DBInfo->use_homepage_url) and empty($tmp->info['home'])) or $update or
                        empty($tmp->info['nick']) or $tmp->info['nick']!=$u->data_array['realname']) {
                    // register user
                    $tmp->info['tz_offset'] = $tz_offset;
                    $tmp->info['nick']=$u->data_array['realname'];
                    if (!empty($DBInfo->use_homepage_url))
                        $tmp->info['home']=util_make_url_u($u->getID(), true);
                    $udb->saveUser($tmp);
                }
            } else {
                $id = 'Anonymous';
                $this->setID('Anonymous');
            }
        }

        $this->css=isset($_COOKIE['MONI_CSS']) ? $_COOKIE['MONI_CSS']:'';
        $this->theme=isset($_COOKIE['MONI_THEME']) ? $_COOKIE['MONI_THEME']:'';
        $this->bookmark=isset($_COOKIE['MONI_BOOKMARK']) ? $_COOKIE['MONI_BOOKMARK']:'';
        $this->trail=isset($_COOKIE['MONI_TRAIL']) ? _stripslashes($_COOKIE['MONI_TRAIL']):'';
        $this->tz_offset=isset($_COOKIE['MONI_TZ']) ?_stripslashes($_COOKIE['MONI_TZ']):'';
        $this->nick=isset($_COOKIE['MONI_NICK']) ?_stripslashes($_COOKIE['MONI_NICK']):'';
        if ($this->tz_offset == '') $this->tz_offset = date('Z');

        if (!empty($id) and $id != 'Anonymous') {
            global $DBInfo;
            $udb = new UserDB($DBInfo);

            if (!$udb->_exists($id)) {
                $dummy=$udb->saveUser($this);
            }
        }
    }
}

// vim:et:sts=4:sw=4:

10.07.01-16:08:35