DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:userhomepages

UserHomePages Plugin

Compatible with DokuWiki

No compatibility info given!

plugin Show list of user home pages of current web-server

Last updated on
2007-07-07
Provides
Syntax

The missing download url means that this extension cannot be installed via the Extension Manager. Please see Publishing a Plugin on dokuwiki.org. Recommended are public repository hosts like GitHub, GitLab or Bitbucket.

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with listing, users

Install

Just create lib/plugins/userhomepages/syntax.php file with following content inside your instance of DokuWiki:

<?php
/**
 * Plugin userhomepages: Inserts ordered list of links to user home pages of current web server
 * v1.0
 *
 * Usage: <userhomepages[:flasg(s)]>
 * 
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author     "Dmytro Sudak" <70707@banksoft.com.ua>
 */
 
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');
 
/**
 * All DokuWiki plugins to extend the parser/rendering mechanism
 * need to inherit from this class
 */
class syntax_plugin_userhomepages extends DokuWiki_Syntax_Plugin {
 
	function getInfo() {
		return array(
			'author' => 'Dmytro Sudak',
			'email'  => '70707@banksoft.com.ua',
			'date'   => '2007-07-07',
			'name'   => 'User Home Pages Listing Plugin',
			'desc'   => 'Insert List of User Home Pages',
			'url'    => 'http://www.dokuwiki.org/plugin:userhomepages');
	} // getInfo()
 
	function connectTo($aMode) {
		$this->Lexer->addSpecialPattern('<userhomepages.*?>', $aMode, 'plugin_userhomepages');
	} // connectTo()
 
	function getSort() {
		return 777;
	} // getSort()
 
	function getType() {
		return 'substition';
	} // getType()
 
	function getPType() {
		return 'block';
	} // getPType()
 
	function handle($match, $state, $pos, &$handler) {
		if ($state = DOKU_LEXER_SPECIAL) {
			if (eregi("<userhomepages([^>]*)>", $match, $out))
				return array($state, array($out[1]));
		}
		return array();
	} // handle()
 
	function render($aFormat, &$aRenderer, $aData) {
		if ('xhtml' != $aFormat) {
			return FALSE;
		} // if
		list($state, $match) = $aData;
		if (DOKU_LEXER_SPECIAL == $state) {
 
		    $passwd = file("/etc/passwd");
 
		    $aRenderer->doc .= "<ol>";
		    while (list($i,$line) = each($passwd))
		    {
			list($user,$x,$uid,$gid,$GECOS,$home,$shell) = explode(":",$line);
			if (!is_dir($home)) continue;
			$public = $home."/public_html";
			if (!file_exists($public)) continue;
			if (!is_dir($public)) continue;
			list($size,$rest) = explode("\t",`du -sH $home/public_html`);
			$aRenderer->doc .= "<li><a name=$user href=\"/~$user/\">".str_replace(" ","&nbsp;",$GECOS)."</a>&nbsp;($size)</li>";
		    }
		    $aRenderer->doc .= "</ol>";
		} // if
		return TRUE;
	} // render()
  //@}
} // class syntax_plugin_userhomepages
?>

FIXME For Unix/Linux systems only!

Usage

This plugin generate simple list of links to “homepages” (“~user/public_html/” on server as “http://server/~user/” by default) for registered Unix/Linux server users (but not DokuWiki-users!). Useful for old-style web-servers. Insert <userhomepages> to your DokuWiki-page.

Discussion

“Insert <userhomepages> to your DokuWiki-page.” Sorry, I didn't understood. Which page? -Laurent-

I don't get it either. How do I use this?


I followed the directions literally, and just inserted <userhomepages> into a DokuWiki page to see what it would do. It lists all of the entries in the server's \home directory. As far as I can tell, it has nothing to do with DokuWiki users. The plugin description should be expanded to say something along these lines, and the main DokuWiki plug-on page tag could be amended so that it doesn't give the impression of auto generating a home page for a newly registered user. -SHodges-

plugin/userhomepages.txt · Last modified: 2014-03-20 18:22 by Aleksandr

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki