Author: Jonathan Kelley
Keywords: Palace Server; Palace Client; Palace Community; Communities.com; The Palace; ThePalace, PalNFO
Date: 2005-03-22

PalNFO v0.8.35 README

Preface
Copyright © 2004-2006 Paul Taylor

PalNFO 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, or (at your option) any later version.

The PalNFO plugin and plugin source 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 be able to get a copy of the GNU General Public License at:

- http://www.gnu.org/copyleft/gpl.html

But, if this site does not work, you can obtain a copy by writing a letter to:

- The Free Software Foundation
  59 Temple Place - Suite 330
  Boston, MA 02111-1307, USA.

What is PalNFO?
PalNFO is a FREE Palace Server plugin that dumps (or logs) current statistics and information about the Palace Server in to a formatted file that can be saved in to various formats (xml, rss xml, rss atom, html, ini etc.) This information can then be put on the internet and included in the homepage of the palace server website providing information such as the users who are currently logged in, server population count, certain preferences and much much more!

Change Log

- Version Legend:
  - [+] - ADDED
  - [-] - DROPED
  - [*] - FIXED
  - [^] - CHANGED
  - [?] - BETA
- Version 0.8.35:
  - [*] Wouldn't compile with GNU's C Compiler 2.9x before, now she will! - All variables in GCC 2.9x must be declared at the top of a { block }.
- Version 0.7.25:
  - [+] escaping into normal string output, off by default.
    [Requested by: KalZen ( Brainhouse Labs Forums ) aka Saint of the Palace Community Forums]
- Version 0.6.23:
  - [+] Reg/PUID Hashes added to output (USE WITH CAUTION).
    [Requested by: KalZen ( Brainhouse Labs Forums ) aka Saint of the Palace Community Forums]
    [^] `strcmp( STR, VAR, )s` replaced with `strncmp( STR, VAR, sizeof( STR ) - 1 )s`.
    [?] Threading in PalNFO might cause crashing. Palace wasn't designed to multi-thread... Threading means the CPU does something at the same time for each Thread. More Threads going at once, the more a CPU can accomplish at one time, up to a point where it's reached it's limit of course. Palace doesn't have locks on Room/User information. If the main thread ( the server itself ), deletes a Room/User from the listing while another thread is about to Read/Write, or is currently Reading/Writing from that Room/User, chances are it'll crash - it got confused!
- Version 0.5.21:
  - [^] WriteTemplate function optimized.
    [Goal: decreasing parse, find/replace pattern time to faster output server data.]
    [+] `if ( ! strstr( bfr, Flags[ j ].ptn ) ) continue;`
- Version 0.4.18:
  - [+] headershell and footershell added.
    [^] CreateTemplate function optimized.
    [^] WriteTemplate function optimized.
- Version 0.3.11:
  - [+] enable/disable on/off switch values added.
    [^] getIndexbyName optimized.
    [^] threading attributes initialization optimized.
- Version 0.2.9:
  - [+] string output escaping in (server|user|room)-shells.
    [Requested by: Bonn (aka ShariVegas) of the Palace Community Forums]
  - [*] potential shell exploit (CRITICAL UPDATE).
    [Report credited to: Bonn (aka ShariVegas) of the Palace Community Forums]
- Version 0.1.4:
  - [*] memory leak in POSIX Threads (pthreads) - pthreads should be spawned as detached.
    [Report credited to: Remad aka Subcommander]
- Version 0.0.1:
  - [?] Official Release!

Table of Contents
00.0 | INPUT Template Variables
01.0 | OUTPUT Template Variables
02.0 | Flags
03.0 | Flags with Switches
04.0 | Shell Output
0A.0 | Plugin Installation

00.0 INPUT Template Variables
NOTE: Any string based variable in general, can be disabled via variable=null Input variables are where the server grabs the template files from. Thats why we call them input variables, its where the server gets its file input. These variables are defined in the [Template] section of the .ini file. A list of these variables and a description about them can be found below. templateheader: Information to include before any of the NFO starts. (Such as a HTML head/body tag.) serverheader: Information to include before server NFO. (Such as a header.) servernfo: Server NFO. serverfooter: Information to include after server NFO. (Such as a footer.) usersheader: Information to include before users NFO. (Such as a header.) usersnfo: Users NFO. usersfooter: Information to include after users NFO. (Such as a footer.) roomsheader: Information to include before rooms NFO. (Such as a header.) roomsnfo: Rooms NFO. roomsfooter: Information to include after rooms NFO. (Such as a footer.) templatefooter: Information to include after any of the NFO starts. (Such as a HTML head/body tag.) These INI variables can be set to either a /home/user/path/to/file, or you can directly type in text! Take this limited example: `templateheader=# $pname ( $pver ) - $pcopy [$phome]\n# Last Updated: $pdate ( $ptime )\n\n serverheader=[Server]\n servernfo=server=$sname,$erid,$nusers,$nhusers,$nguests,$nhguests,$nrooms,$nhrooms\n serverfooter=psdata/footer.xml usersheader=[Users]\n usersnfo=user$inc=$uid,$uname,$urid,$urname,$uos,$urank,$ulogontime,$ulacttime,$ugag,$upin,$uhide,$uesp,$upri,$upgag\n usersfooter=psdata/footer.xml roomsheader=[Rooms]\n roomsnfo=room$inc=$rid,$rname,$roommaxocc,$rart,$nrusers,$rownuid\n roomsfooter=psdata/footer.xml templatefooter=null`

01.0 OUTPUT Template Variables
NOTE: Any string based variable in general, can be disabled via variable=null NOTE: These INI variables can only be set to /home/user/path/to/file. Output template variables are the path to what the actual statistics are written (or dumped) to, containing the real statistics ready for use on the internet or PHP/MySQL. palacetemplate: Variable that outputs all of the information to a file. Usage Example: `palacetemplate=psdata/palnfo_output.xml` servertemplate: Variable that outputs just the server information headers, nfo, and footer. Usage Example: `palacetemplate=psdata/server_output.xml` usertemplate: Variable that outputs just the user information headers, nfo, and footer. Usage Example: `palacetemplate=psdata/user_output.xml` roomtemplate: Variable that outputs just the room information headers, nfo, and footer. Usage Example: `palacetemplate=psdata/user_output.xml`

02.0 Flags
Flags are a little more interesting! These are what you want to be replaced in your INPUT templates! For example, if you have plugincopyright set to $pcopy, or @pcopy, then that's what textual pattern will be replaced within the INPUT templates. General: incrementor This value is a number that updates for every user, and every room. updatefreq Contains the value of how often the file updates. pluginhome Contains the value of the plugin home directory. pluginname A text value of the of the plugin name. pluginversion A text value of the current plugin version. plugincopyright A text value of the plugins copyright information. timestamp The current UNIX timestamp.. datetime The current date and time. Server: servernbrusers How many users are on the server. servernbrguestusers How many guests are on the server. servernbrhiddenusers How many users are hidden on the server. servernbrhiddenguestusers How many guest users are hidden on the server. servernbrrooms How many rooms are on the server. servernbrhiddenrooms How many rooms on the server that are hidden. servernbrmemberrooms How many total member rooms are on the server. servernbrhiddenmemberrooms How many of the total member rooms are hidden. serverentranceroomid The enterance ROOMID. serverurl The current server URL. serveravatars The avatar directory URL. servermedia The media URL. servername The current servername. servermaxocc The servers maximum occupancy. serverroommaxocc The servers maximum room occupancy. serveruptimetimestamp The servers current uptime in UNIX timestamp format. serveruptimedatetime The servers current uptime in datetime format. User: userid The userid of the current user. userroomid The current users roomid. username The current users username. userroomname The current users roomname. useros The operating system of the current user. userrank The rank of the current user. userlogontimestamp The UNIX timestamp that the user logged on. userlogondatetime The date & time that the current user logged on. userlastactivetimestamp The timestamp of when the user was last active. userlastactivedatetime The date & time the user was last active. Room: roomid The roomid of the current room. roomname The name of the current room. roommaxocc The max occupancy of the current room. roomartist The artist of the current room. roomusercount How many users are in the current room. roomowneruserid If the current room is a member room, the ID of the user who owns it.

03.0 Flags with Switches
Flags are even crazier! They work like normal flags, but with some added arguments. If you want it to say something when that value is switched 'off' or 'on', you can! These conditional outputs can hold up to 1 kB of space, enough for a HTML <IMG> tag! Think of it as variable=flag_pattern,off_condition,on_condition Server: guest Guests enabled on the server. cyborgs Cyborgs enabled on the server. painting Painting enabled on the server. customprops Custom user props enabled on the server. spoofing @X,Y - Spoofing enabled on the server. memberrooms Creation of member rooms enabled on the server. User: usergag User gagged, yes/no? userpin User pinned, yes/no? userhidden User hidden, yes/no? userrejectesp User Rejecting-ESP, yes/no? userrejectpri User Rejecting-Whispers, yes/no? userpropgag User propgagged, yes/no? Room: roomprivate Room private, yes/no? roompaint Room painting allowed, yes/no? roomclosed Room closed, yes/no? roomcyborg Room cyborgs allowed, yes/no? roomhidden Room hidden, yes/no? roommember Room is member room, yes/no? roomguests Room allows guests, yes/no? roomwizonly Room is WizOnly, yes/no? roomdropzone Room is DropZone, yes/no? roomlooseprops Room allows LooseProps, yes/no?

04.0 Shell Output
Last but certainly not least! There's Shell output commands, incase you want to directly upload server information to an MySQL database, you could use 'mysql' from the command line! Or the command line PHP command! Or POST it to a website script with 'wget' (a command line utility). One Shell command line for each necessary block (server/user/room - user/room are called each time per user or per room) Example: `*shell=wget --post-data='$surl $sname' 'http://sub.domain.com/~user/script.php' *shell=php -r 'echo "The Server's Name is: $sname\n";' *shell=php script.php $surl $sname` Shell Variables: headershell Executed before other templates are activated! servershell usershell roomshell footershell Executed after all other templates are completed! Unique switch: escapeshell Escapes all string output from plugin: `echo=>\x65\x63\x68\x6f`

0A.0 Plugin Installation
Assuming the server is installed in the standard directory called "palace", perform the following steps: If necessary, create a `"plugins"` directory in the `palace/bin` directory. Put the `palnfo.so` file in the `palace/bin/plugins` directory. Put the `palnfo.ini` in the `/palace/palace/psdata/` directory. Create or modify the `palace/palace/psdata/plugin.conf` file which describes the active server plugins. Include a line for the PalNFO Server Plugin: `../bin/plugins/palnfo.so psdata/palnfo.ini` If you already have plugins on your server, you don't need to do the following step. Edit server/bin/start-palace replace: `$root/bin/pserver -f $root/$instance/psdata/pserver.conf` with: `$root/bin/pserver -f $root/$instance/psdata/pserver.conf -s $root/$instance/psdata/plugin.conf` NOTE: Make sure that this is just a single line in the file! This is particularly an issue when using an editor such as pico or nano.