WeakWiki


modules\logm\logm.module.php

WeakWiki (WeakWiki Log Manager (logm) module: logm.module.php) Copyright (C) 2010 Alexander Lang 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 3 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, see . Project Home: http://weakwiki.robnet.wmweb.at/ Contact: robbiblubber@robnet.wmweb.at



/********************************************************************************
WeakWiki (WeakWiki Log Manager (logm) module: logm.module.php)
Copyright (C) 2010 Alexander Lang

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 3 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, see .

Project Home: http://weakwiki.robnet.wmweb.at/
Contact:      robbiblubber@robnet.wmweb.at
********************************************************************************/



require_once('./lib/modules.library.php');

require_once(_lang('useradm'));
require_once(_lang('logm.module'));



/** This is class implements the log manager (logm) module.						*/
class LogManagerModule extends __Module
{
	/** Returns the module name.
		@return		Module name.												*/
	public function getName()
	{
		return "logm";
	}
	
	/** Returns the module version.
		@return		Module name.												*/
	public function getVersion()
	{
		return _VERSION;
	}
	
	/** Returns a description of the module.
		@return		Module description.											*/
	public function getDescription()
	{
		return "Log Manage Module";
	}
	
	/** Returns the module's parse mode.
		@return		Parse mode.													*/
	public function getParseMode()
	{
		return MOD_MODE_PARSE_LINKS;
	}
	
	/** Returns a detail page for the module.
		@return		Module detail page.											*/
	public function getDetails()
	{
		return "logm
WeakWiki User Log Manager Module Version " . $this->getVersion() . "
by Alexander Lang
Copyright (C) 2010 Alexander Lang

"; } /** Returns links to add to page menu. @return Main menu links. */ public function addToPageMenu() { if(isset($_GET['action'])) { if($_GET['action'] == "admin") { return "" . _L_LOGM_0000 . "  "; } } return ""; } /** Method is called when parsing links. @param $input Unparsed text. @return Parsed text. */ public function parseLink($input) { switch($input) { case "@m:logm/ops": return _WIKI_COMMAND . "?action=admin&page=logm&op=ops"; case "@m:logm/syslog": return _WIKI_COMMAND . "?action=admin&page=logm&op=syslog"; case "@m:logm/files": return _WIKI_COMMAND . "?action=admin&page=logm&op=files"; case "@m:logm/history": return _WIKI_COMMAND . "?action=admin&page=logm&op=history"; case "@m:logm/details": return _WIKI_COMMAND . "?action=admin&page=logm&op=details"; } return $input; } /** Adequately reacts to a module query. @return TRUE when module processes the query, otherwise FALSE. */ public function run() { if(isset($_GET['action']) && isset($_GET['page'])) { if(($_GET['action'] == "admin") && ($_GET['page'] == "logm")) { include('./modules/logm/logm.include.php'); return true; } } return false; } /** Parses file type @param $f File Name. @return File type. */ private function tof($f) { if($f == "current.log") { return "system log"; } if(substr($f, strlen($f) - 4) == ".log") { return "log file"; } if(substr($f, strlen($f) - 6) == ".hfile") { return "compressed page change log"; } if(substr($f, strlen($f) - 7) == ".htable") { return "compressed page history"; } if(substr($f, strlen($f) - 11) == ".hfile.keep") { return "compressed archived change log"; } if(substr($f, strlen($f) - 12) == ".htable.keep") { return "compressed archived history"; } if(substr($f, strlen($f) - 4) == ".log.gz") { return "compressed log file"; } if(substr($f, strlen($f) - 3) == ".gz") { return "compressed file"; } return "file"; } /** Reads files from history directory. @returns Array of file names. */ private function getFiles() { $rval = Array(); $d = opendir("./history"); while(true) { $i = readdir($d); if($i === false) break; if(($i != '.') && ($i != '..') && ($i != '.htaccess')) { array_push($rval, $i); } } sort($rval); return $rval; } } ?>

WeakWiki