Virtual War Developer Guide $Date: 2005/09/02 17:25:49 $

 



1. Changes in VWar 1.5.0

In version 1.5.0 we made many changes in the code structure of VWar.
Here a little overview:
  • $db is now $vwardb
  • $template is now $vwartpl
  • All data which are transmitted by POST are now stored in $GPC
  • Templates will be no longer cached at the beginning of functions_common.php
  • _lib.php is now splitted in several files (functions_common.php, functions_font.php, functions_admin.php)
  • All files for inclusion are now in includes
We changed the database and template variable to avoid errors with other scripts like Nuke.

functions_front.php includes all function which are used in front files like war.php.
The same applies to functions_admin.php, but the functions are used in the ACP.
The functions which are in functions_common.php are used in both areas.
  • ATTENTION:
    functions_common.php also created all needed objects (like $vwardb) and the $GPC array.

2. Dynamic ACP Menu

The whole ACP Menu is now dynamic. Please use the following information to program your hack installation
so that the menu will be added automatically.

acpmenugroups
  • groupname - a short name for this group (e. g. war)
  • grouptitle - a full name for this group (e. g. War Admin)
  • condition - contains all needed rights for this group (separated with a semicolon)
  • conditiontype - AND or OR: need all or one right(s)
  • displayorder - display order is from lowest to highest value
acpmenuitems
  • groupid - id of the parent group
  • itemtype - LINE or BREAK: Line is a normal link and Break a separator
  • itemtitle - name of the link
  • destination - destination of the link
  • condition - contains all needed rights for this item (separated with a semicolon)
  • conditiontype - AND or OR: need all or one right(s)
  • displayorder - display order is from lowest to highest value
Look at 6. Useful Stuff how to get an automatical increased display order for a new group.

3. Custom Language

You can now add the required language data from your hack automatically to the
language files from VWar. The required information are stored in a language file (not the language files from VWar!).
A file extension like "lang" is recommended.

Syntax:

<languagecode="(identification string for this hack)">(name for administrative purposes)</languagecode>
<default>(default language)</default>

<language="(name of the language for which are the data below *)">
     <data name="(identification code for this string)">(string)</data>
</language>

*) Must be one of the available language files (e. g. english.inc.php = english)

The value auf default must be a language which is available in your language file.
This language will be used for language files of VWar for which are no data available.

Example:

<languagecode="gb">Guestbook</languagecode>
<default>english</default>

<language="english">
     <data name="GB_NAME">Guestbook</data>
</language>
<language="german">
     <data name="GB_NAME">Gästebuch</data>
</language>


It is also possible to create an update file for an update of your hacks.
You only need to add one information.

<type>update</type>

A good position for this is under default.
For adding new variables just add the data to your language file.
To delete a variable let the value empty.

Example:

<data name="GB_OLD"></data>

If you now run addLanguageVars the function automatically knows that this is an update.

For adding those language files via an installation file include functions_install.php and functions_customize.php first.
Then run the function addLanguageVars(string $file).

ATTENTION: Write all languages (not your own data) and tags in small letters.

4. QuickJump

The structure of the QuickJump table in the database:
  • title - the name which will be displayed
  • redirectto - destination of this QuickJump
  • displayorder - display order is from lowest to highest value
  • activated - set this QuickJump active or inactive
Look at 6. Useful Stuff how to get an automatical increased display order for a new QuickJump.
functions_customize.php also includes a function (addQuickJump) to add a QuickJump.

5. Installation

As already said include functions_install.php in your installation file.
This file contains several functions and code for the $GPC array.
Also include functions_customize.php for QuickJump and Language functions.

6. Useful Stuff

Automatical increased display order (replace tablename with the name of the pertinent table):

$result = $vwardb->query_first("
   SELECT displayorder
   FROM vwar".$n."_(tablename)
   ORDER BY displayorder DESC LIMIT 0,1");
$displayorder = $result["displayorder"] + 1;


ID of the last INSERT command:

$insertid = $vwardb->insert_id();

7. Logging

To add the logging functionality of VWar to your hack use the following code:

$vwarlog->add(area, note, type, importance);
  • area - The area (short) in which the action is performed. The scripts writes automatically every first letter of word in upper case.
  • note - A description about the performed action.
  • type - Constant: LAC_ADD, LAC_UPDATE, LAC_DELETE, LAC_CUSTOM
  • importance - Constant: LIP_LOW, LIP_NORMAL, LIP_HIGH

top ]