Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

Admin Class Reference

List of all members.

Detailed Description

Class to add/remove users, groups and towns.

The Admin cass provides basic functions to configure almost everything of the phpmap.

Use addUser() to add a new user, delUser() or even deletePlayers() to remove one or several users, retrieve a list of users including their rights with getUsers() and get all available groups with getGroups(). Remove towns with deleteTowns().

Check tracked actions with getLogList() and delete them with deleteLogs().

Additionally, get unused/unlinked SQL data with getDeadList(), and use optimizeDb() to execute a SQL optimize command.

Author:
Carsten Bormann <pressy@terta.kn-bremen.de>

Robert Vock <smir@andaloria.de>

Definition at line 35 of file lib/admin.php.

Public Member Functions

 Admin (&$oDB, &$oLog)
 constructor.
 addUser ($strName, $strPass, $intHomeX, $intHomeY, $intGroup)
 add a new user for phpmap
 editUser ($intUser, $strPlayer, $intHomeX, $intHomeY, $intGroup)
 edit a user of phpmap
 getUser ($intUser)
 get a user
 delUser ($intUser)
 delete a user of phpmap
 getUsers ($strOrder)
 get a list of users and their rights
 getGroups ($strOrder=name')
 gets a list of groups of phpmap
 getLogStat ($strOrder, $intStart=0, $intEnd=50)
 get user statistics out of log
 getLogList ($strOrder, $intStart=0, $intEnd=50)
 get action loglist
 deleteLogs ($aLogIds, $intTime=0)
 delete log entries
 getDeadList ()
 get a list of unused/unlinked sql data (towns, players and empty guilds)
 deletePlayers ($aPlayers)
 delete players
 optimizeDb ()
 optimize all sql tables to increase query speed
 countMapMerge ()
 counts records im MapData to be merge
 mergeMap ()
 merges duplicate records in MapData

Public Attributes

 $oDB
 DB object.
 $oLog
 Log object.


Constructor & Destructor Documentation

Admin::Admin &$  oDB,
&$  oLog
 

constructor.

set the objects

Parameters:
$oDB reference to database object
$oLog reference to logger object

Definition at line 46 of file lib/admin.php.

References $oDB, and $oLog.


Member Function Documentation

Admin::addUser strName,
strPass,
intHomeX,
intHomeY,
intGroup
 

add a new user for phpmap

Parameters:
$strName name of the new user, will be needed to login
$strPass unencrypted password of the new user
$intHomeX home coords of the new user
$intHomeY home coords of the new user
$intGroup user group
Todo:
check admin rights
Returns:
false or new userid

Definition at line 62 of file lib/admin.php.

References $aRow.

Admin::countMapMerge  ) 
 

counts records im MapData to be merge

Returns:
number of rows to merge

Definition at line 314 of file lib/admin.php.

Admin::deleteLogs aLogIds,
intTime = 0
 

delete log entries

Parameters:
$aLogIds array with ids of log entries to delete
$intTime Unixtimestamp to delete all log entries older than this
Returns:
int number of deleted logs

Definition at line 239 of file lib/admin.php.

Admin::deletePlayers aPlayers  ) 
 

delete players

Parameters:
$aPlayers integer array with ids of players
Returns:
int number of deleted players

Definition at line 282 of file lib/admin.php.

Admin::delUser intUser  ) 
 

delete a user of phpmap

Parameters:
$intUser id of this user
Returns:
bool (false if user does not exist or his admin rights are too high)
Todo:
check admin rights

Definition at line 128 of file lib/admin.php.

Admin::editUser intUser,
strPlayer,
intHomeX,
intHomeY,
intGroup
 

edit a user of phpmap

Parameters:
$intUser id of the user
$strPlayer 
$intHomeX home coords of the new user
$intHomeY home coords of the new user
$intGroup user group

Definition at line 86 of file lib/admin.php.

Admin::getDeadList  ) 
 

get a list of unused/unlinked sql data (towns, players and empty guilds)

Returns:
array with keys 'towns', 'players' and 'guilds' which are arrays

Definition at line 255 of file lib/admin.php.

References $aRow.

Admin::getGroups strOrder = name'  ) 
 

gets a list of groups of phpmap

Parameters:
$strOrder order the columns by this key
Returns:
array
Note:
if sort Order is usergroup_id, then the array index is the id

Definition at line 161 of file lib/admin.php.

References $aRow, $sqlResult, and $strOrder.

Admin::getLogList strOrder,
intStart = 0,
intEnd = 50
 

get action loglist

Parameters:
$strOrder order the columns by this key
$intStart starting row or -1 for all rows
$intEnd 
Returns:
array
Todo:
check admin rights

Definition at line 217 of file lib/admin.php.

References $aRow.

Admin::getLogStat strOrder,
intStart = 0,
intEnd = 50
 

get user statistics out of log

Parameters:
$strOrder order the columns by this key
$intStart starting row or -1 for all rows
$intEnd 
Returns:
array

Definition at line 186 of file lib/admin.php.

References $aRow.

Admin::getUser intUser  ) 
 

get a user

Parameters:
$intUser user_id
Returns:
array

Definition at line 108 of file lib/admin.php.

References $sqlResult.

Admin::getUsers strOrder  ) 
 

get a list of users and their rights

Parameters:
$strOrder order the columns by this key
Returns:
array
Todo:
check admin rights and add admin rights

Definition at line 144 of file lib/admin.php.

References $aRow, and $sqlResult.

Admin::mergeMap  ) 
 

merges duplicate records in MapData

Returns:
number of rows to merge

Definition at line 325 of file lib/admin.php.

References $aRow, and $intCount.

Admin::optimizeDb  ) 
 

optimize all sql tables to increase query speed

Returns:
mysql return arrays

Definition at line 299 of file lib/admin.php.

References $aRow.


Member Data Documentation

Admin::$oDB
 

DB object.

Definition at line 37 of file lib/admin.php.

Referenced by Admin().

Admin::$oLog
 

Log object.

Definition at line 38 of file lib/admin.php.

Referenced by Admin().


The documentation for this class was generated from the following file:
Generated on Sun May 8 19:29:46 2005 for PhpMap by  doxygen 1.4.2