'wiki'에 해당하는 글 3건

Last User Login 은 사용자들이 마지막으로 로그인 한 시간을 테이블로 나타낸다.

소스 코드 생성

  • SpecialLastUserLogin.php
  • SpecialLastUserLogin_body.php
  • SpecialLastUserLogin.i18n.php
# vi extensions/SpecialLastUserLogin.php
<?php
/**
 * SpecialLastUserLogin MediaWiki extension
 *
 * @file
 * @ingroup Extensions
 * @version 1.2.0
 * @author Justin G. Cramer
 * @author Danila Ulyanov
 * @author Thomas Klein
 * @link
http://www.mediawiki.org/wiki/Extension:SpecialLastUserLoginEx Documentation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
http://www.gnu.org/copyleft/gpl.html
 */
 
if( !defined( 'MEDIAWIKI' ) ) {
 die();
}
 
// Extension credits that will show up on Special:Version
$wgExtensionCredits['specialpage'][] = array(
 'name' => 'LastUserLogin',
 'version' => '1.2.0',
 'author' => array('Justin G. Cramer', 'Danila Ulyanov', 'Thomas Klein'),
 'description' => 'Displays the last time a user logged in',
 'url' => 'http://www.mediawiki.org/wiki/Extension:SpecialLastUserLoginEx',
);
 
// New user right
$wgAvailableRights[] = 'lastlogin';
 
// Set up the new special page
$dir = dirname(__FILE__) . '/';
$wgAutoloadClasses['LastUserLogin'] = $dir . 'SpecialLastUserLogin_body.php';
$wgExtensionMessagesFiles['LastUserLogin'] = $dir . 'SpecialLastUserLogin.i18n.php';
$wgSpecialPages['LastUserLogin'] = 'LastUserLogin';
 
// Function that updates the database when a user logs in
$wgExtensionFunctions[] = 'wfUpdateUserTouched';
 
function wfUpdateUserTouched() {
 global $wgOut, $wgCookiePrefix; 
 
 if( isset( $_COOKIE ) && isset( $_COOKIE["{$wgCookiePrefix}UserID"] ) ) {
  $dbw = wfGetDB( DB_MASTER );
  $query = "UPDATE ".$dbw->tableName('user')." SET user_touched = '".$dbw->timestamp()."' WHERE user_id = ".intval($_COOKIE["{$wgCookiePrefix}UserID"]);
  $dbw->doQuery($query);
 }
}

 

# vi extensions/SpecialLastUserLogin_body.php
<?php
 
class LastUserLogin extends SpecialPage {
 
 /**
  * Constructor
  */
 public function __construct() {
  parent::__construct( 'LastUserLogin'/*class*/, 'lastlogin'/*restriction*/ );
 }
 
 /**
  * Show the special page
  *
  * @param $par Mixed: parameter passed to the page or null
  */
 public function execute( $par ) {
  global $wgUser, $wgOut, $wgLang;
  wfLoadExtensionMessages( 'LastUserLogin' );
 
  # If user is blocked, s/he doesn't need to access this page
  if ( $wgUser->isBlocked() ) {
   $wgOut->blockedPage();
   return;
  }
 
  # Show a message if the database is in read-only mode
  if ( wfReadOnly() ) {
   $wgOut->readOnlyPage();
   return;
  }
 
  # If the user doesn't have the required 'lastlogin' permission, display an error
  if( !$wgUser->isAllowed( 'lastlogin' ) ) {
   $wgOut->permissionRequired( 'lastlogin' );
   return;
  }
 
  $this->setHeaders();
  $skin = $wgUser->getSkin();
 
  $wgOut->setPageTitle( wfMsg( 'lastuserlogin' ) );
 
  $dbr = wfGetDB( DB_SLAVE );
  $style = 'style="border:1px solid #000;text-align:left;"';
  $fields = array(
   'user_name' => 'lastuserlogin_userid',
   'user_real_name' => 'lastuserlogin_username',
   'user_email' => 'lastuserlogin_useremail',
   'user_touched' => 'lastuserlogin_lastlogin'
  );
 
  // Get order by and check it
  if( isset( $_REQUEST['order_by'] ) ){
   if( isset( $fields[$_REQUEST['order_by']] ) ){
    $orderby = $_REQUEST['order_by'];
   } else {
    $orderby = 'user_name';
   }
  } else {
   $orderby = 'user_name';
  }   
 
  // Get order type and check it
  if( isset( $_REQUEST['order_type'] ) ){
   if( $_REQUEST['order_type'] == 'DESC' ){
    $ordertype = $_REQUEST['order_type'];
   } else {
    $ordertype = 'ASC';
   }
  } else {
   $ordertype = 'ASC';
  }   
 
  $query = "SELECT user_name, user_real_name, user_email, user_touched FROM ".$dbr->tableName('user')." ORDER BY ".$orderby." ".$ordertype;
  $ordertype = $ordertype == 'ASC' ? 'DESC' : 'ASC';
 
  if( $result = $dbr->doQuery($query) ) {
   $out = '<table width="100%" cellpadding="3" '.$style.'><tr>';
 
   foreach( $fields as $key => $value ){
    $out .= '<th '.$style.'><a href="?order_by='.$key.'&order_type='.$ordertype.'">'.wfMsg( $value ).'</a></th>';
   }
 
   $out .= "<th $style>".wfMsg( 'lastuserlogin_daysago' )."</th>";
   $out .= '</tr>';
 
   while( $row = $dbr->fetchRow($result) ) {
    $out .= '<tr>';
     foreach( $fields as $key => $value ){
 
      if( $key == 'user_touched' ) {
       $style = 'style="border:1px solid #000"';
       $out .= "<td $style>".$wgLang->timeanddate( wfTimestamp( TS_MW, $row[$key] ), true ).
         '</td><td style="border: 1px solid #000; text-align:right;">'.
         $wgLang->formatNum( round( ( mktime() - wfTimestamp( TS_UNIX, $row[$key] ) ) /3600/24, 2 ), 2 )."</td>";
      } else {
       if( $key == 'user_name' ) {
        $userPage = Title::makeTitle( NS_USER, htmlspecialchars( $row[$key] ) );
        $name = $skin->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) );
        $out .= '<td '.$style.'>'.$name.'</a></td>';
       } else {
        $out .= '<td '.$style.'>'.htmlspecialchars($row[$key]).'&nbsp;</td>';
       }
      }
     }
    $out .= '</tr>';
   }
  }
 
 $out .= '</table>';
 $wgOut->addHTML( $out );
 
 }
}

 

# vi extensions/SpecialLastUserLogin.i18n.php
<?php
/**
 * Internationalization file for LastUserLogin extension.
 *
 * @file
 * @ingroup Extensions
 */

 
$messages = array();
 
/** English
 * @author Justin G. Cramer
 * @author Danila Ulyanov
 * @author Thomas Klein
 */
$messages['en'] = array(
    'lastuserlogin' => 'Last user login',
    'lastuserlogin_userid' => 'Username',
    'lastuserlogin_username' => 'Real name',
    'lastuserlogin_useremail' => 'User email',
    'lastuserlogin_lastlogin' => 'Last login',
    'lastuserlogin_daysago' => 'Days ago',
);
 
/** German (Deutsch) */
$messages['de'] = array(
    'lastuserlogin' => 'Letzte Anmeldungen',
    'lastuserlogin_userid' => 'Benutzername',
    'lastuserlogin_username' => 'Echter Name',
    'lastuserlogin_useremail' => 'E-Mail-Adresse',
    'lastuserlogin_lastlogin' => 'Letzte Anmeldung',
    'lastuserlogin_daysago' => 'Tage',
);
 
/** French (Français) */
$messages['fr'] = array(
    'lastuserlogin_userid' => 'Nom d’utilisateur',
    'lastuserlogin_username' => 'Nom réel',
);
 
/** Latin (Latina) */
$messages['la'] = array(
    'lastuserlogin_userid' => 'Nomen usoris',
    'lastuserlogin_username' => 'Nomen tuum verum',
);
 
/** Dutch (Nederlands) */
$messages['nl'] = array(
    'lastuserlogin' => 'Laatste aanmeldingen van gebruikers',
    'lastuserlogin_userid' => 'Gebruikersnaam',
    'lastuserlogin_username' => 'Echte naam',
    'lastuserlogin_useremail' => 'E-mail',
    'lastuserlogin_lastlogin' => 'Laatste aanmelding',
    'lastuserlogin_daysago' => 'Aantal dagen geleden',
);
 
/* Lithuanian (Lietuvių) */
$messages['lt'] = array(
    'lastuserlogin' => 'Paskutinis naudotojo prisijungimas',
    'lastuserlogin_userid' => 'Naudotojo vardas',
    'lastuserlogin_username' => 'Tikras vardas',
    'lastuserlogin_useremail' => 'Naudotojo el. paštas',
    'lastuserlogin_lastlogin' => 'Paskutinis prisijungimas',
    'lastuserlogin_daysago' => 'Dienų prieš',
);
 
/* Polish (Polski) */
$messages['pl'] = array(
    'lastuserlogin' => 'Ostatnie zalogowania użytkownika',
    'lastuserlogin_userid' => 'Login',
    'lastuserlogin_username' => 'Prawdziwa nazwa',
    'lastuserlogin_useremail' => 'Adres e-mail',
    'lastuserlogin_lastlogin' => 'Ostatnie zalogowanie',
    'lastuserlogin_daysago' => 'dni temu',
);
 
/* Russian (Russian) */
$messages['ru'] = array(
    'lastuserlogin' => 'Недавние посещения пользователей',
    'lastuserlogin_userid' => 'Имя пользователя',
    'lastuserlogin_username' => 'Настоящее имя',
    'lastuserlogin_useremail' => 'Электронная почта',
    'lastuserlogin_lastlogin' => 'Недавнее посещение',
    'lastuserlogin_daysago' => 'Дней назад',
);
 
/* Japanese (日本語) */
$messages['ja'] = array(
    'lastuserlogin' => '利用者の最終ログイン',
    'lastuserlogin_userid' => '利用者名',
    'lastuserlogin_username' => '本名',
    'lastuserlogin_useremail' => 'メールアドレス',
    'lastuserlogin_lastlogin' => '最終ログイン',
    'lastuserlogin_daysago' => '経過日数',  
);


설정 변경


* 기본 설정 파일에 Last User Login 파일 인크루드 행 추가

# vi LocalSettings.php
require_once( "$IP/extensions/SpecialLastUserLogin.php" );


* 추가하고 싶은 권한 설정

# vi includes/DefaultSettings.php
$wgGroupPermissions['sysop']['lastlogin'] = true;


 


WRITTEN BY
손가락귀신
정신 못차리면, 벌 받는다.

,

위키 설정

Daily/Prog 2009. 12. 15. 22:04
꾸며나갈 생각하니 막막하다. 이 휑한 대문... ㅜㅡ
최소한의 설정 변경.
  • 왼쪽 상단 로고 삽입
  • 이미지 파일 업로드 설정
  • 모든 파일 업로드 설정
  • 하단 저작권 부분 삭제
  • 회사 자료들어가는 부분이니, 대문을 제외하고는 접근 차단

* 상세 설정 참고 -> http://www.mediawiki.org/wiki/Manual:Configuration_settings

1. 왼쪽 상단 로고 삽입 (경로 설정)
# vi LocalSettings.php
# logo image path
$wgLogo = "/images/a/ab/Main_tglobal_01.gif";

2. 이미지 파일 업로드 설정 및 파일 저장될 디렉토리 권한 설정
# vi LocalSettings.php
# enable image upload
$wgEnableUploads = true;

# chmod 707 images/

3. 모든 타입 파일 업로드 설정
# vi LocalSettings.php
# Enable all file extensions.
$wgStrictFileExtensions = false;
$wgCheckFileExtensions = false;
$wgVerifyMimeType = false;

4. 하단 정책, 소개, 면책조항 주석처리
# vi includes/SkinTemplate.php
//$tpl->set( 'disclaimer', $this->disclaimerLink() );
//$tpl->set( 'privacy', $this->privacyLink() );
//$tpl->set( 'about', $this->aboutLink() );

5. 익명 접근시 대문을 제외하고 접근 차단
# vi includes/DefaultSettings.php
// anonymous users allow pages
$wgWhitelistRead = array ( "대문" );

// Implicit group for all visitors
$wgGroupPermissions['*']['createaccount']    = false;
$wgGroupPermissions['*']['read']             = false;
$wgGroupPermissions['*']['edit']             = false;
$wgGroupPermissions['*']['createpage']       = false;
$wgGroupPermissions['*']['createtalk']       = false;
$wgGroupPermissions['*']['writeapi']         = false;



WRITTEN BY
손가락귀신
정신 못차리면, 벌 받는다.

,

미디어위키

Daily/Prog 2009. 12. 15. 09:42
위키 같은 프로그램이 하나 정도는 필요할 거 같고.. 과연 사람들이 문법을 좋아라 할지 의문이고..
그 종류도 너무 많아서 도대체 어떤걸 설치해야 그나마 이 님들이 그나마 활용을 잘 할 수 있을지..
한참을 고민하다가 그냥 미디어위키 엔진을 설치한다...


mediawiki 설치

참고 : http://www.mediawiki.org/wiki/MediaWiki

1. 다운로드 및 압축풀기
# 더블유get http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.1.tar.gz
# tar zxvf mediawiki-1.15.1.tar.gz


2. 디렉토리 권한 설정
웹 주소로 접속 후 설정 계속 -> http://wiki.mydomain.com/
wiki 설치 디렉토리 안에 config 디렉토리 쓰기 권한 지정
# chmod a+w config


3. 설치 전 시스템 사양
PHP 5.2.8 installed
Found database drivers for: MySQL SQLite
PHP server API is apache2handler; ok, using pretty URLs (index.php/Page_Title)
Have XML / Latin1-UTF-8 conversion support.
Warning: A value for session.save_path has not been set in PHP.ini. If the default value causes problems with saving session data, set it to a valid path which is read/write/execute for the user your web server is running under.
PHP's memory_limit is 128M.
Couldn't find Turck MMCache, eAccelerator, APC or XCache; cannot use these for object caching.
Found GNU diff3: /usr/bin/diff3.
Found GD graphics library built-in, image thumbnailing will be enabled if you enable uploads.
Installation directory: /home/wiki/www
Script URI path: Installing MediaWiki with php file extensions
Environment checked. You can install MediaWiki.

* 설정이 덜 되거나 추가 설치할 것들이 있다면 하나씩 해결

Warning: A value for session.save_path has not been set in PHP.ini. If the default value causes problems with saving session data, set it to a valid path which is read/write/execute for the user your web server is running under.
# vi /usr/local/Zend/etc/php.ini
session.save_path = "/tmp"
# /etc/init.d/httpd restart

Couldn't find Turck MMCache, eAccelerator, APC or XCache; cannot use these for object caching.
>>> eAccelerator 설치
 - eAccelerator 설치/작동을 확인했음에도 불구하고 저 로그는 계속 나타난다 ㅡㅡ;


4. 사양 체크 후 아래 양식 추가 작성
 - 관리자 계정 / DB 설정 등...


5. 설정이 끝난 후 설치 기록 확인
Please include all of the lines below when reporting installation problems.
PHP 5.3.1 installed
Found database drivers for: MySQL SQLite
PHP server API is apache2handler; ok, using pretty URLs (index.php/Page_Title)
Have XML / Latin1-UTF-8 conversion support.
Session save path (/tmp) appears to be valid.
PHP's memory_limit is 128M.
Couldn't find Turck MMCache, eAccelerator, APC or XCache; cannot use these for object caching.
Found GNU diff3: /usr/bin/diff3.
Found GD graphics library built-in, image thumbnailing will be enabled if you enable uploads.
Installation directory: /home/www/wiki
Script URI path: /wiki
Installing MediaWiki with php file extensions
Environment checked. You can install MediaWiki.
Generating configuration file...

Database type: MySQL
Loading class: DatabaseMysql
Attempting to connect to database server as root...success.
Connected to mysql 5.0.77; enabling MySQL 4.1/5.0 charset mode
Database wiki exists
Creating tables... done.
Initializing statistics...
Granting user permissions to ggamzzak on wiki...success.
Created sysop account WikiSysop.
Creating LocalSettings.php...

--------------------------------------------------------------------------------

Installation successful! Move the config/LocalSettings.php file to the parent directory, then follow this link to your wiki.
You should change file permissions for LocalSettings.php as required to prevent other users on the server reading passwords and altering configuration data.


6. 파일 권한 복구
마지막으로 config/LocalSettings.php 파일 권한을 바꾸고 상위 디렉토리로 이동
# chmod 644 LocalSettings.php
# mv LocalSettings.php ../


7. 위키 접속
http://wiki.mydomain.com/

사용자 삽입 이미지

WRITTEN BY
손가락귀신
정신 못차리면, 벌 받는다.

,