summaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2012-10-28 08:46:41 +0100
committerDominique Martinet <asmadeus@codewreck.org>2015-11-08 14:27:51 +0100
commitd79af709c1f99c84a1b3cb983fb2af7b4e49015f (patch)
tree9d1ba4a5eebfe1944cdc07a57b3eff35f631fd03 /admin
parent83192fc53278172f26da789271bc7ad1b2082c10 (diff)
initial commit
Diffstat (limited to 'admin')
-rw-r--r--admin/DAoC.php130
-rw-r--r--admin/Everquest.php99
-rw-r--r--admin/Everquest2-german.sql131
-rw-r--r--admin/Everquest2.php141
-rw-r--r--admin/WoW-english.php92
-rw-r--r--admin/WoW-german.php64
-rw-r--r--admin/WoW.php92
-rw-r--r--admin/addadj.php330
-rw-r--r--admin/addevent.php338
-rw-r--r--admin/addiadj.php424
-rw-r--r--admin/additem.php677
-rw-r--r--admin/addnews.php320
-rw-r--r--admin/addraid.php1303
-rw-r--r--admin/addturnin.php252
-rw-r--r--admin/backup.php288
-rw-r--r--admin/config.php512
-rw-r--r--admin/fix_negative.php93
-rw-r--r--admin/index.php680
-rw-r--r--admin/listadj.php130
-rw-r--r--admin/listevents.php71
-rw-r--r--admin/listitems.php90
-rw-r--r--admin/listnews.php74
-rw-r--r--admin/listraids.php78
-rw-r--r--admin/logs.php246
-rw-r--r--admin/lua.php634
-rw-r--r--admin/lua_config.php295
-rw-r--r--admin/manage_members.php151
-rw-r--r--admin/manage_users.php865
-rw-r--r--admin/mm/index.html0
-rw-r--r--admin/mm/mm_addmember.php559
-rw-r--r--admin/mm/mm_addmember.php.NEW.gzbin0 -> 3893 bytes
-rw-r--r--admin/mm/mm_listmembers.php129
-rw-r--r--admin/mm/mm_ranks.php150
-rw-r--r--admin/mm/mm_transfer.php249
-rw-r--r--admin/mysql_info.php131
-rw-r--r--admin/parse_Everquest.php587
-rw-r--r--admin/parse_Everquest2-german.php515
-rw-r--r--admin/parse_Everquest2.php546
-rw-r--r--admin/parse_Everquest2German.php515
-rw-r--r--admin/parse_Vanguard-SoH.php449
-rw-r--r--admin/parse_WoW.php484
-rw-r--r--admin/parse_log.php467
-rw-r--r--admin/plugins.php103
-rw-r--r--admin/soap/addraid.php39
-rw-r--r--admin/soap/addraidattendee.php52
-rw-r--r--admin/soap/delraidattendee.php52
-rw-r--r--admin/soap/dkpsoap.php665
-rw-r--r--admin/soap/doloot.php39
-rw-r--r--admin/soap/findevent.php39
-rw-r--r--admin/soap/getlastraid.php32
-rw-r--r--admin/soap/getrp.php39
-rw-r--r--admin/styles.php561
-rw-r--r--admin/vps-net-120x60-01.pngbin0 -> 12430 bytes
53 files changed, 15002 insertions, 0 deletions
diff --git a/admin/DAoC.php b/admin/DAoC.php
new file mode 100644
index 0000000..d8ba544
--- /dev/null
+++ b/admin/DAoC.php
@@ -0,0 +1,130 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * DAoC.php
+ * Began: Fri May 13 2005
+ *
+ * $Id: DAoC.php 6 2006-05-08 17:11:35Z tsigo $
+ *
+ ******************************/
+
+if ( !defined('EQDKP_INC') )
+{
+ die('Hacking attempt');
+}
+
+class Manage_Game extends EQdkp_Admin
+{
+
+ function do_it()
+ {
+
+ global $db, $eqdkp, $user;
+ global $SID, $dbname, $table_prefix;
+
+
+ parent::eqdkp_admin();
+
+
+$queries = array(
+
+"DELETE FROM ". $table_prefix ."classes;",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (0, 'Unknown', 'Unknown');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (1, 'Animist', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (2, 'Armsman', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (3, 'Bainshee', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (4, 'Bard', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (5, 'Berserker', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (6, 'Blademaster', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (7, 'Bonedancer', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (8, 'Cabalist', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (9, 'Champion', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (10, 'Cleric', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (11, 'Druid', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (12, 'Eldritch', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (13, 'Enchanter', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (14, 'Friar', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (15, 'Healer', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (16, 'Heretic', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (17, 'Hero', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (18, 'Hunter', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (19, 'Infiltrator', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (20, 'Mentalist', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (21, 'Mercenary', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (22, 'Minstrel', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (23, 'Necromancer', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (24, 'Nightshade', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (25, 'Paladin', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (26, 'Ranger', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (27, 'Reaver', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (28, 'Runemaster', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (29, 'Savage', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (30, 'Scout', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (31, 'Shadowblade', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (32, 'Shaman', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (33, 'Skald', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (34, 'Sorcerer', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (35, 'Spiritmaster', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (36, 'Thane', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (37, 'Theurgist', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (38, 'Valewalker', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (39, 'Valkyrie', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (40, 'Vampiir', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (41, 'Warden', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (42, 'Warlock', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (43, 'Warrior', 'Plate');",
+"INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (44, 'Wizard', 'Plate');",
+
+"DELETE FROM ". $table_prefix ."races;",
+
+"INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (0, 'Unknown');",
+"INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (1, 'Valonian');",
+"INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (2, 'Briton');",
+"INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (3, 'Half Ogre');",
+"INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (4, 'Highlander');",
+"INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (5, 'Inconnu');",
+"INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (6, 'Saracen');",
+"INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (7, 'Celt');",
+"INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (8, 'Elf');",
+"INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (9, 'Firbolg');",
+"INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (10, 'Lurikeen');",
+"INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (11, 'Shar');",
+"INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (12, 'Sylvan');",
+"INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (13, 'Dwarf');",
+"INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (14, 'Frostalf');",
+"INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (15, 'Kobold');",
+"INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (16, 'Norse');",
+"INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (17, 'Troll');",
+"INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (18, 'Valkyn');",
+
+"DELETE FROM ". $table_prefix ."factions;",
+
+"INSERT INTO ". $table_prefix ."factions (faction_id, faction_name) VALUES (1, 'Albion');",
+"INSERT INTO ". $table_prefix ."factions (faction_id, faction_name) VALUES (2, 'Hibernia');",
+"INSERT INTO ". $table_prefix ."factions (faction_id, faction_name) VALUES (3, 'Midgard');",
+
+);
+
+
+ foreach ( $queries as $sql )
+ {
+ $db->query($sql);
+ }
+
+
+ $redir = "admin/config.php";
+ redirect($redir);
+
+ }
+
+}
+
+$manage = new Manage_Game;
+$manage->do_it();
+
+
+?>
+
diff --git a/admin/Everquest.php b/admin/Everquest.php
new file mode 100644
index 0000000..3d0665d
--- /dev/null
+++ b/admin/Everquest.php
@@ -0,0 +1,99 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * Everquest.php
+ * Began: Fri May 13 2005
+ *
+ * $Id: Everquest.php 6 2006-05-08 17:11:35Z tsigo $
+ *
+ ******************************/
+
+if ( !defined('EQDKP_INC') )
+{
+ die('Hacking attempt');
+}
+
+
+
+class Manage_Game extends EQdkp_Admin
+{
+
+ function do_it()
+ {
+
+ global $db, $eqdkp, $user;
+ global $SID, $dbname, $table_prefix;
+
+ parent::eqdkp_admin();
+
+ $queries = array(
+
+ "DELETE FROM ". $table_prefix ."classes;",
+ "ALTER TABLE " . $table_prefix . "members MODIFY member_level tinyint(2) NOT NULL default '70';",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (0, 'Unknown', 'Plate');",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (1, 'Warrior', 'Plate');",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (2, 'Rogue', 'Chain');",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (3, 'Monk', 'Leather');",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (4, 'Ranger', 'Chain');",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (5, 'Paladin', 'Plate');",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (6, 'Shadow Knight', 'Plate');",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (7, 'Bard', 'Plate');",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (8, 'Beastlord', 'Leather');",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (9, 'Cleric', 'Plate');",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (10, 'Druid', 'Leather');",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (11, 'Shaman', 'Chain');",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (12, 'Enchanter', 'Silk');",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (13, 'Wizard', 'Silk');",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (14, 'Necromancer', 'Silk');",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (15, 'Magician', 'Silk');",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type) VALUES (16, 'Berserker', 'Leather');",
+
+ "DELETE FROM ". $table_prefix ."races;",
+
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (0, 'Unknown');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (1, 'Gnome');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (2, 'Human');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (3, 'Barbarian');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (4, 'Dwarf');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (5, 'High Elf');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (6, 'Dark Elf');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (7, 'Wood Elf');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (8, 'Half Elf');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (9, 'Vah Shir');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (10, 'Troll');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (11, 'Ogre');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (12, 'Frog');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (13, 'Iksar');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (14, 'Erudite');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (15, 'Halfling');",
+
+ "DELETE FROM ". $table_prefix ."factions;",
+
+ "INSERT INTO ". $table_prefix ."factions (faction_id, faction_name) VALUES (1, 'Good');",
+ "INSERT INTO ". $table_prefix ."factions (faction_id, faction_name) VALUES (2, 'Evil');",
+
+
+ );
+
+
+ foreach ( $queries as $sql )
+ {
+ $db->query($sql);
+ }
+
+ $redir = "admin/config.php";
+ redirect($redir);
+
+ }
+
+}
+
+
+$manage = new Manage_Game;
+$manage->do_it();
+
+
+?>
diff --git a/admin/Everquest2-german.sql b/admin/Everquest2-german.sql
new file mode 100644
index 0000000..f0679e7
--- /dev/null
+++ b/admin/Everquest2-german.sql
@@ -0,0 +1,131 @@
+-- phpMyAdmin SQL Dump
+-- version 2.6.0-beta3
+-- http://www.phpmyadmin.net
+--
+-- Host: localhost
+-- Erstellungszeit: 28. Juli 2005 um 01:28
+-- Server Version: 4.0.18
+-- PHP-Version: 4.3.4
+--
+-- Datenbank: `db0`
+--
+-- Use this for EQdkp 1.3.0 if you are German and using EQ2.
+-- The nice WoW folks actually made a install script like
+-- the others, but for this one you'll need to manually
+-- change your database
+--
+
+-- --------------------------------------------------------
+
+--
+-- Tabellenstruktur für Tabelle `eqdkp_classes`
+--
+
+DROP TABLE IF EXISTS `eqdkp_classes`;
+CREATE TABLE IF NOT EXISTS `eqdkp_classes` (
+ `c_index` smallint(3) unsigned NOT NULL auto_increment,
+ `class_id` smallint(3) unsigned NOT NULL default '0',
+ `class_name` varchar(50) NOT NULL default '',
+ `class_min_level` smallint(3) NOT NULL default '0',
+ `class_max_level` smallint(3) NOT NULL default '999',
+ `class_armor_type` varchar(50) NOT NULL default '',
+ `class_hide` enum('0','1') NOT NULL default '0',
+ PRIMARY KEY (`c_index`)
+) TYPE=MyISAM;
+
+--
+-- Daten für Tabelle `eqdkp_classes`
+--
+
+INSERT INTO `eqdkp_classes` (`c_index`, `class_id`, `class_name`, `class_min_level`, `class_max_level`, `class_armor_type`, `class_hide`) VALUES (18, 0, 'Unknown', 1, 99, 'Heavy', '0'),
+(19, 1, 'Kämpfer', 1, 9, 'Heavy', '0'),
+(20, 2, 'Kundschafter', 1, 9, 'Medium', '0'),
+(21, 3, 'Magier', 1, 9, 'VeryLight', '0'),
+(22, 4, 'Priester', 1, 9, 'Heavy', '0'),
+(23, 5, 'Krieger', 10, 19, 'Heavy', '0'),
+(24, 6, 'Kreuzritter', 10, 19, 'Heavy', '0'),
+(25, 7, 'Schläger', 10, 19, 'Light', '0'),
+(26, 8, 'Raufbold', 20, 99, 'Light', '0'),
+(27, 9, 'Mönch', 20, 99, 'Light', '0'),
+(28, 10, 'Berserker', 20, 99, 'Heavy', '0'),
+(29, 11, 'Wächter', 20, 99, 'Heavy', '0'),
+(30, 12, 'Paladin', 20, 99, 'Heavy', '0'),
+(31, 13, 'Schattenritter', 20, 99, 'Heavy', '0'),
+(32, 14, 'Thaumaturge', 10, 19, 'VeryLight', '0'),
+(33, 15, 'Hexer', 10, 19, 'VeryLight', '0'),
+(34, 16, 'Beschwörer', 10, 19, 'VeryLight', '0'),
+(35, 17, 'Illusionist', 20, 99, 'VeryLight', '0'),
+(36, 18, 'Erzwinger', 20, 99, 'VeryLight', '0'),
+(37, 19, 'Zauberer', 20, 99, 'VeryLight', '0'),
+(38, 20, 'Hexenmeister', 20, 99, 'VeryLight', '0'),
+(39, 21, 'Nekromant', 20, 99, 'VeryLight', '0'),
+(40, 22, 'Elementalist', 20, 99, 'VeryLight', '0'),
+(41, 23, 'Kleriker', 10, 19, 'Heavy', '0'),
+(42, 24, 'Druide', 10, 19, 'Light', '0'),
+(43, 25, 'Schamane', 10, 19, 'Medium', '0'),
+(44, 26, 'Templer', 20, 99, 'Heavy', '0'),
+(45, 27, 'Inquisitor', 20, 99, 'Heavy', '0'),
+(46, 28, 'Wärter', 20, 99, 'Light', '0'),
+(47, 29, 'Furie', 20, 99, 'Light', '0'),
+(48, 30, 'Schänder', 20, 99, 'Medium', '0'),
+(49, 31, 'Mystiker', 20, 99, 'Medium', '0'),
+(50, 32, 'Dieb', 10, 19, 'Medium', '0'),
+(51, 33, 'Barde', 10, 19, 'Medium', '0'),
+(52, 34, 'Raubtier', 10, 19, 'Medium', '0'),
+(53, 35, 'Abenteurer', 20, 99, 'Medium', '0'),
+(54, 36, 'Brigand', 20, 99, 'Medium', '0'),
+(55, 37, 'Klagesänger', 20, 99, 'Medium', '0'),
+(56, 38, 'Troubadour', 20, 99, 'Medium', '0'),
+(57, 39, 'Assassine', 20, 99, 'Medium', '0'),
+(58, 40, 'Waldläufer', 20, 99, 'Medium', '0'),
+(59, 41, 'Craftsmen', 1, 99, 'Heavy', '0'),
+(60, 42, 'Scholar', 1, 99, 'Heavy', '0'),
+(61, 43, 'Outfitter', 1, 99, 'Heavy', '0'),
+(62, 44, 'Provisioner', 1, 99, 'Heavy', '0'),
+(63, 45, 'Woodworker', 1, 99, 'Heavy', '0'),
+(64, 46, 'Carpenter', 1, 99, 'Heavy', '0'),
+(65, 47, 'Armorer', 1, 99, 'Heavy', '0'),
+(66, 48, 'Weaponsmith', 1, 99, 'Heavy', '0'),
+(67, 49, 'Tailor', 1, 99, 'Heavy', '0'),
+(68, 50, 'Jeweler', 1, 99, 'Heavy', '0'),
+(69, 51, 'Sage', 1, 99, 'Heavy', '0'),
+(70, 52, 'Alchemist', 1, 99, 'Heavy', '0');
+
+-- --------------------------------------------------------
+
+--
+-- Tabellenstruktur für Tabelle `eqdkp_races`
+--
+
+DROP TABLE IF EXISTS `eqdkp_races`;
+CREATE TABLE IF NOT EXISTS `eqdkp_races` (
+ `race_id` smallint(3) unsigned NOT NULL default '0',
+ `race_name` varchar(50) NOT NULL default '',
+ `race_faction_id` smallint(3) NOT NULL default '0',
+ `race_hide` enum('0','1') NOT NULL default '0',
+ PRIMARY KEY (`race_id`),
+ UNIQUE KEY `race_id` (`race_id`)
+) TYPE=MyISAM;
+
+--
+-- Daten für Tabelle `eqdkp2_races`
+--
+
+INSERT INTO `eqdkp_races` (`race_id`, `race_name`, `race_faction_id`, `race_hide`) VALUES (0, 'Unknown', 0, '0'),
+(1, 'Gnom', 0, '0'),
+(2, 'Mensch', 0, '0'),
+(3, 'Barbar', 0, '0'),
+(4, 'Zwerg', 0, '0'),
+(5, 'Hochelf', 0, '0'),
+(6, 'Dunkelelf', 0, '0'),
+(7, 'Waldelf', 0, '0'),
+(8, 'Halbelf', 0, '0'),
+(9, 'Kerraner', 0, '0'),
+(10, 'Troll', 0, '0'),
+(11, 'Oger', 0, '0'),
+(12, 'Froschlog', 0, '0'),
+(13, 'Erudit', 0, '0'),
+(14, 'Iksar', 0, '0'),
+(15, 'Ratonga', 0, '0'),
+(16, 'Halbling', 0, '0');
+
diff --git a/admin/Everquest2.php b/admin/Everquest2.php
new file mode 100644
index 0000000..8755cde
--- /dev/null
+++ b/admin/Everquest2.php
@@ -0,0 +1,141 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * Everquest2.php
+ * Began: Fri May 13 2005
+ *
+ * $Id: Everquest2.php 6 2006-05-08 17:11:35Z tsigo $
+ *
+ ******************************/
+
+if ( !defined('EQDKP_INC') )
+{
+ die('Hacking attempt');
+}
+
+class Manage_Game extends EQdkp_Admin
+{
+
+ function do_it()
+ {
+
+ global $db, $eqdkp, $user;
+ global $SID, $dbname, $table_prefix;
+
+
+ parent::eqdkp_admin();
+
+ $queries = array(
+ "UPDATE " . $table_prefix . "members SET member_level = 50 WHERE member_level > 50;",
+ "ALTER TABLE " . $table_prefix . "members MODIFY member_level tinyint(2) NOT NULL default '50';",
+ "DELETE FROM ". $table_prefix ."classes;",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (0, 'Unknown', 'Heavy',1,99);",
+
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (1, 'Fighter', 'Heavy',1,9);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (2, 'Scout', 'Medium',1,9);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (3, 'Mage', 'VeryLight',1,9);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (4, 'Priest', 'Heavy',1,9);",
+
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (5, 'Warrior', 'Heavy',10,19);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (6, 'Crusader', 'Heavy',10,19);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (7, 'Brawler', 'Light',10,19);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (8, 'Bruiser', 'Light',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (9, 'Monk', 'Light',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (10, 'Berserker', 'Heavy',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (11, 'Guardian', 'Heavy',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (12, 'Paladin', 'Heavy',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (13, 'Shadowknight', 'Heavy',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (14, 'Enchanter', 'VeryLight',10,19);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (15, 'Sorcerer', 'VeryLight',10,19);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (16, 'Summoner', 'VeryLight',10,19);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (17, 'Illusionist', 'VeryLight',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (18, 'Coercer', 'VeryLight',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (19, 'Wizard', 'VeryLight',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (20, 'Warlock', 'VeryLight',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (21, 'Necromancer', 'VeryLight',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (22, 'Conjuror', 'VeryLight',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (23, 'Cleric', 'Heavy',10,19);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (24, 'Druid', 'Light',10,19);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (25, 'Shaman', 'Medium',10,19);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (26, 'Templar', 'Heavy',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (27, 'Inquisitor', 'Heavy',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (28, 'Warden', 'Light',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (29, 'Fury', 'Light',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (30, 'Defiler', 'Medium',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (31, 'Mystic', 'Medium',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (32, 'Rogue', 'Medium',10,19);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (33, 'Bard', 'Medium',10,19);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (34, 'Predator', 'Medium',10,19);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (35, 'Swashbuckler', 'Medium',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (36, 'Brigand', 'Medium',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (37, 'Dirge', 'Medium',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (38, 'Troubador', 'Medium',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (39, 'Assassin', 'Medium',20,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (40, 'Ranger', 'Medium',20,99);",
+
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (41, 'Craftsmen', 'Heavy',1,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (42, 'Scholar', 'Heavy',1,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (43, 'Outfitter', 'Heavy',1,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (44, 'Provisioner', 'Heavy',1,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (45, 'Woodworker', 'Heavy',1,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (46, 'Carpenter', 'Heavy',1,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (47, 'Armorer', 'Heavy',1,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (48, 'Weaponsmith', 'Heavy',1,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (49, 'Tailor', 'Heavy',1,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (50, 'Jeweler', 'Heavy',1,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (51, 'Sage', 'Heavy',1,99);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (52, 'Alchemist', 'Heavy',1,99);",
+
+
+ "DELETE FROM ". $table_prefix ."races;",
+
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (0, 'Unknown');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (1, 'Gnome');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (2, 'Human');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (3, 'Barbarian');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (4, 'Dwarf');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (5, 'High Elf');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (6, 'Dark Elf');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (7, 'Wood Elf');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (8, 'Half Elf');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (9, 'Kerra');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (10, 'Troll');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (11, 'Ogre');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (12, 'Frog');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (13, 'Erudite');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (14, 'Iksar');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (15, 'Ratonga');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (16, 'Halfling');",
+
+ "DELETE FROM ". $table_prefix ."factions;",
+
+ "INSERT INTO ". $table_prefix ."factions (faction_id, faction_name) VALUES (1, 'Good');",
+ "INSERT INTO ". $table_prefix ."factions (faction_id, faction_name) VALUES (2, 'Evil');",
+ "INSERT INTO ". $table_prefix ."factions (faction_id, faction_name) VALUES (3, 'Neutral');",
+
+
+
+ );
+
+
+ foreach ( $queries as $sql )
+ {
+ $db->query($sql);
+ }
+
+
+ $redir = "admin/config.php";
+ redirect($redir);
+
+ }
+
+}
+
+$manage = new Manage_Game;
+$manage->do_it();
+
+
+?>
diff --git a/admin/WoW-english.php b/admin/WoW-english.php
new file mode 100644
index 0000000..436b35f
--- /dev/null
+++ b/admin/WoW-english.php
@@ -0,0 +1,92 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * WoW.php
+ * Began: Fri May 13 2005
+ *
+ * $Id: WoW-english.php 8 2006-05-08 17:15:20Z tsigo $
+ *
+ ******************************/
+
+if ( !defined('EQDKP_INC') )
+{
+ die('Hacking attempt');
+}
+
+class Manage_Game extends EQdkp_Admin
+{
+
+ function do_it()
+ {
+
+
+ global $db, $eqdkp, $user;
+ global $SID, $dbname, $table_prefix;
+
+
+ parent::eqdkp_admin();
+
+ $queries = array(
+
+ "DELETE FROM ". $table_prefix ."classes;",
+
+ "UPDATE " . $table_prefix . "members SET member_level = 60 WHERE member_level >60;",
+
+ "ALTER TABLE " . $table_prefix . "members MODIFY member_level tinyint(2) NOT NULL default '60';",
+
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (0, 'Unknown', 'Plate',0,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (1, 'Warrior', 'Mail',0,39);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (2, 'Rogue', 'Leather',0,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (3, 'Hunter', 'Leather',0,39);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (4, 'Hunter', 'Mail',40,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (5, 'Paladin', 'Mail',0,39);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (6, 'Priest', 'Silk',0,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (7, 'Druid', 'Leather',0,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (8, 'Shaman', 'Leather',0,39);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (9, 'Shaman', 'Mail',40,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (10, 'Warlock', 'Silk',0,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (11, 'Mage', 'Silk',0,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (12, 'Warrior', 'Plate',40,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (13, 'Paladin', 'Plate',40,60);",
+
+ "DELETE FROM ". $table_prefix ."races;",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (0, 'Unknown');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (1, 'Gnome');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (2, 'Human');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (3, 'Dwarf');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (4, 'Night Elf');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (5, 'Troll');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (6, 'Undead');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (7, 'Orc');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (8, 'Tauren');",
+
+ "DELETE FROM ". $table_prefix ."factions;",
+ "INSERT INTO ". $table_prefix ."factions (faction_id, faction_name) VALUES (1, 'Alliance');",
+ "INSERT INTO ". $table_prefix ."factions (faction_id, faction_name) VALUES (2, 'Horde');",
+
+ "UPDATE ". $table_prefix ."config SET config_value = 'WoW' WHERE config_name = 'default_game';",
+
+ );
+
+
+ foreach ( $queries as $sql )
+ {
+ $db->query($sql);
+ }
+
+
+ $redir = "admin/config.php";
+ redirect($redir);
+
+ }
+
+}
+
+$manage = new Manage_Game;
+$manage->do_it();
+
+
+?>
diff --git a/admin/WoW-german.php b/admin/WoW-german.php
new file mode 100644
index 0000000..1e87ec2
--- /dev/null
+++ b/admin/WoW-german.php
@@ -0,0 +1,64 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * WoW.php
+ * Began: Fri May 13 2005
+ *
+ * $Id: WoW-german.php 6 2006-05-08 17:11:35Z tsigo $
+ *
+ ******************************/
+if ( !defined('EQDKP_INC') )
+{
+ die('Hacking attempt');
+}
+class Manage_Game extends EQdkp_Admin
+{
+ function do_it()
+ {
+ global $db, $eqdkp, $user;
+ global $SID, $dbname, $table_prefix;
+ parent::eqdkp_admin();
+ $queries = array(
+ "DELETE FROM ". $table_prefix ."classes;",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (0, 'Unknown', 'Platte',0,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (1, 'Krieger', 'Platte',0,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (2, 'Schurke', 'Leder',0,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (3, 'Jäger', 'Leder',0,39);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (4, 'Jäger', 'Schwere Rüstung',40,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (5, 'Paladin', 'Platte',0,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (6, 'Priester', 'Stoff',0,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (7, 'Druide', 'Stoff',0,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (8, 'Schamane', 'Leder',0,39);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (9, 'Schamane', 'Schwere Rüstung',40,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (10, 'Hexenmeister', 'Stoff',0,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (11, 'Magier', 'Stoff',0,60);",
+ "DELETE FROM ". $table_prefix ."races;",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (0, 'Unknown');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (1, 'Gnom');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (2, 'Mensch');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (3, 'Zwerg');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (4, 'Nachtelf');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (5, 'Troll');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (6, 'Untoter');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (7, 'Ork');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (8, 'Taure');",
+ "DELETE FROM ". $table_prefix ."factions;",
+ "INSERT INTO ". $table_prefix ."factions (faction_id, faction_name) VALUES (1, 'Allianz');",
+ "INSERT INTO ". $table_prefix ."factions (faction_id, faction_name) VALUES (2, 'Horde');",
+ "UPDATE ". $table_prefix ."config SET (config_value = 'WoW') WHERE (config_name = 'default_game');",
+ );
+ foreach ( $queries as $sql )
+ {
+ $db->query($sql);
+ }
+ $redir = "admin/config.php";
+ redirect($redir);
+ }
+}
+$manage = new Manage_Game;
+$manage->do_it();
+
+?>
diff --git a/admin/WoW.php b/admin/WoW.php
new file mode 100644
index 0000000..afb34f9
--- /dev/null
+++ b/admin/WoW.php
@@ -0,0 +1,92 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * WoW.php
+ * Began: Fri May 13 2005
+ *
+ * $Id: WoW.php 8 2006-05-08 17:15:20Z tsigo $
+ *
+ ******************************/
+
+if ( !defined('EQDKP_INC') )
+{
+ die('Hacking attempt');
+}
+
+class Manage_Game extends EQdkp_Admin
+{
+
+ function do_it()
+ {
+
+
+ global $db, $eqdkp, $user;
+ global $SID, $dbname, $table_prefix;
+
+
+ parent::eqdkp_admin();
+
+ $queries = array(
+
+ "DELETE FROM ". $table_prefix ."classes;",
+
+ "UPDATE " . $table_prefix . "members SET member_level = 60 WHERE member_level > 60;",
+
+ "ALTER TABLE " . $table_prefix . "members MODIFY member_level tinyint(2) NOT NULL default '60';",
+
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (0, 'Unknown', 'Plate',0,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (1, 'Warrior', 'Mail',0,39);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (2, 'Rogue', 'Leather',0,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (3, 'Hunter', 'Leather',0,39);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (4, 'Hunter', 'Mail',40,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (5, 'Paladin', 'Mail',0,39);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (6, 'Priest', 'Cloth',0,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (7, 'Druid', 'Leather',0,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (8, 'Shaman', 'Leather',0,39);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (9, 'Shaman', 'Mail',40,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (10, 'Warlock', 'Cloth',0,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (11, 'Mage', 'Cloth',0,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (12, 'Warrior', 'Plate',40,60);",
+ "INSERT INTO ". $table_prefix ."classes (class_id, class_name, class_armor_type, class_min_level, class_max_level) VALUES (13, 'Paladin', 'Plate',40,60);",
+
+ "DELETE FROM ". $table_prefix ."races;",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (0, 'Unknown');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (1, 'Gnome');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (2, 'Human');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (3, 'Dwarf');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (4, 'Night Elf');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (5, 'Troll');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (6, 'Undead');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (7, 'Orc');",
+ "INSERT INTO ". $table_prefix ."races (race_id, race_name) VALUES (8, 'Tauren');",
+
+ "DELETE FROM ". $table_prefix ."factions;",
+ "INSERT INTO ". $table_prefix ."factions (faction_id, faction_name) VALUES (1, 'Alliance');",
+ "INSERT INTO ". $table_prefix ."factions (faction_id, faction_name) VALUES (2, 'Horde');",
+
+ "UPDATE ". $table_prefix ."config SET config_value = 'WoW' WHERE config_name = 'default_game';",
+
+ );
+
+
+ foreach ( $queries as $sql )
+ {
+ $db->query($sql);
+ }
+
+
+ $redir = "admin/config.php";
+ redirect($redir);
+
+ }
+
+}
+
+$manage = new Manage_Game;
+$manage->do_it();
+
+
+?>
diff --git a/admin/addadj.php b/admin/addadj.php
new file mode 100644
index 0000000..81c0561
--- /dev/null
+++ b/admin/addadj.php
@@ -0,0 +1,330 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * addadj.php
+ * Began: Sat January 4 2003
+ *
+ * $Id: addadj.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class Add_GroupAdj extends EQdkp_Admin
+{
+ var $adjustment = array(); // Holds adjustment data if URI_ADJUSTMENT is set @var adjustment
+ var $old_adjustment = array(); // Holds adjustment data from before POST @var old_adjustment
+
+ function add_groupadj()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path;
+
+ parent::eqdkp_admin();
+
+ $this->adjustment = array(
+ 'adjustment_value' => post_or_db('adjustment_value')
+ );
+
+ // Vars used to confirm deletion
+ $this->set_vars(array(
+ 'confirm_text' => $user->lang['confirm_delete_adj'],
+ 'uri_parameter' => URI_ADJUSTMENT)
+ );
+
+ $this->assoc_buttons(array(
+ 'add' => array(
+ 'name' => 'add',
+ 'process' => 'process_add',
+ 'check' => 'a_groupadj_add'),
+ 'update' => array(
+ 'name' => 'update',
+ 'process' => 'process_update',
+ 'check' => 'a_groupadj_upd'),
+ 'delete' => array(
+ 'name' => 'delete',
+ 'process' => 'process_delete',
+ 'check' => 'a_groupadj_del'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_groupadj_'))
+ );
+
+ // Build the adjustment aray
+ // -----------------------------------------------------
+ if ( $this->url_id )
+ {
+ $sql = 'SELECT adjustment_value, member_name
+ FROM ' . ADJUSTMENTS_TABLE . "
+ WHERE adjustment_id='".$this->url_id."'";
+ $result = $db->query($sql);
+ if ( !$row = $db->fetch_record($result) )
+ {
+ message_die($user->lang['error_invalid_adjustment']);
+ }
+ $db->free_result($result);
+
+ // If member name is set, it's an individual adjustment - put them back on that script
+ if ( isset($row['member_name']) )
+ {
+ redirect('addiadj.php' . $SID . '&' . URI_ADJUSTMENT . '='.$this->url_id);
+ }
+
+ $this->adjustment = array(
+ 'adjustment_value' => post_or_db('adjustment_value', $row)
+ );
+ }
+ }
+
+ function error_check()
+ {
+ global $user;
+
+ if ( sizeof($_POST) > 0 )
+ {
+ $this->fv->is_number('adjustment_value', $user->lang['fv_number_adjustment']);
+ $this->fv->is_filled('adjustment_value', $user->lang['fv_required_adjustment']);
+ }
+
+ return $this->fv->is_error();
+ }
+
+ // ---------------------------------------------------------
+ // Process Add
+ // ---------------------------------------------------------
+ function process_add()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path, $SID;
+
+ //
+ // Change member's adjustment column
+ //
+ $sql = 'UPDATE ' . MEMBERS_TABLE . '
+ SET member_adjustment = member_adjustment + ' . $db->escape($_POST['adjustment_value']);
+ $db->query($sql);
+
+ //
+ // Insert adjustment
+ //
+ $query = $db->build_query('INSERT', array(
+ 'adjustment_value' => $_POST['adjustment_value'],
+ 'adjustment_date' => $this->time,
+ 'adjustment_added_by' => $this->admin_user)
+ );
+ $db->query('INSERT INTO ' . ADJUSTMENTS_TABLE . $query);
+ $this_adjustment_id = $db->insert_id();
+
+ //
+ // Logging
+ //
+ $log_action = array(
+ 'header' => '{L_ACTION_GROUPADJ_ADDED}',
+ 'id' => $this_adjustment_id,
+ '{L_ADJUSTMENT}' => $_POST['adjustment_value'],
+ '{L_ADDED_BY}' => $this->admin_user);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success message
+ //
+ $success_message = sprintf($user->lang['admin_add_adj_success'], $eqdkp->config['dkp_name'], $_POST['adjustment_value']);
+ $link_list = array(
+ $user->lang['list_groupadj'] => 'listadj.php' . $SID,
+ $user->lang['list_members'] => $eqdkp_root_path . 'listmembers.php' . $SID);
+ $this->admin_die($success_message, $link_list);
+ }
+
+ // ---------------------------------------------------------
+ // Process Update
+ // ---------------------------------------------------------
+ function process_update()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path, $SID;
+
+ //
+ // Get the old data
+ //
+ $this->get_old_data();
+
+ //
+ // Remove the old adjustment from members that received it
+ // If their first raid was before/on the adjustment date, then they
+ // would have received a group adjustment
+ //
+ $sql = 'UPDATE ' . MEMBERS_TABLE . '
+ SET member_adjustment = member_adjustment - ' . $this->old_adjustment['adjustment_value'] . '
+ WHERE member_firstraid <= ' . $this->old_adjustment['adjustment_date'];
+ $db->query($sql);
+
+ //
+ // Add the new adjustment
+ //
+ $sql = 'UPDATE ' . MEMBERS_TABLE . '
+ SET member_adjustment = member_adjustment + ' . $db->escape($_POST['adjustment_value']);
+ $db->query($sql);
+
+ //
+ // Update the adjustment table
+ //
+ $query = $db->build_query('UPDATE', array(
+ 'adjustment_value' => $_POST['adjustment_value'],
+ 'adjustment_updated_by' => $this->admin_user)
+ );
+ $sql = 'UPDATE ' . ADJUSTMENTS_TABLE . ' SET ' . $query . " WHERE adjustment_id='" . $this->url_id . "'";
+ $db->query($sql);
+
+ //
+ // Logging
+ //
+ $log_action = array(
+ 'header' => '{L_ACTION_GROUPADJ_UPDATED}',
+ 'id' => $this->url_id,
+ '{L_ADJUSTMENT_BEFORE}' => $this->old_adjustment['adjustment_value'],
+ '{L_ADJUSTMENT_AFTER}' => $this->find_difference($this->old_adjustment['adjustment_value'], $_POST['adjustment_value']),
+ '{L_UPDATED_BY}' => $this->admin_user);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success message
+ //
+ $success_message = sprintf($user->lang['admin_update_adj_success'], $eqdkp->config['dkp_name'], $_POST['adjustment_value']);
+ $link_list = array(
+ $user->lang['list_groupadj'] => 'listadj.php' . $SID,
+ $user->lang['list_members'] => $eqdkp_root_path . 'listmembers.php' . $SID);
+ $this->admin_die($success_message, $link_list);
+ }
+
+ // ---------------------------------------------------------
+ // Process Delete (confirmed)
+ // ---------------------------------------------------------
+ function process_confirm()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path, $SID;
+
+ //
+ // Get the old data
+ //
+ $this->get_old_data();
+
+ //
+ // Remove the old adjustment from members that received it
+ // If their first raid was before/on the adjustment date, then they
+ // would have received a group adjustment
+ //
+ $sql = 'UPDATE ' . MEMBERS_TABLE . '
+ SET member_adjustment = member_adjustment - ' . $this->old_adjustment['adjustment_value'] . '
+ WHERE member_firstraid <= ' . $this->old_adjustment['adjustment_date'];
+ $db->query($sql);
+
+ //
+ // Remove the adjustment from members
+ //
+ $sql = 'DELETE FROM ' . ADJUSTMENTS_TABLE . "
+ WHERE adjustment_id = '" . $this->url_id . "'";
+ $db->query($sql);
+
+ //
+ // Logging
+ //
+ $log_action = array(
+ 'header' => '{L_ACTION_GROUPADJ_DELETED}',
+ 'id' => $this->url_id,
+ '{L_ADJUSTMENT}' => $this->old_adjustment['adjustment_value']);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success message
+ //
+ $success_message = sprintf($user->lang['admin_delete_adj_success'], $eqdkp->config['dkp_name'], $this->old_adjustment['adjustment_value']);
+ $link_list = array(
+ $user->lang['list_groupadj'] => 'listadj.php' . $SID,
+ $user->lang['list_members'] => $eqdkp_root_path . 'listmembers.php' . $SID);
+ $this->admin_die($success_message, $link_list);
+ }
+
+ // ---------------------------------------------------------
+ // Process helper methods
+ // ---------------------------------------------------------
+ function get_old_data()
+ {
+ global $db;
+
+ $sql = 'SELECT adjustment_value, adjustment_date
+ FROM ' . ADJUSTMENTS_TABLE . "
+ WHERE adjustment_id='" . $this->url_id . "'";
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $this->old_adjustment = array(
+ 'adjustment_value' => addslashes($row['adjustment_value']),
+ 'adjustment_date' => addslashes($row['adjustment_date'])
+ );
+ }
+ $db->free_result($result);
+ }
+
+ // ---------------------------------------------------------
+ // Display form
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path, $SID;
+
+ $tpl->assign_vars(array(
+ // Form vars
+ 'F_ADD_ADJUSTMENT' => 'addadj.php' . $SID,
+ 'ADJUSTMENT_ID' => $this->url_id,
+
+ // Form values
+ 'ADJUSTMENT' => $this->adjustment['adjustment_value'],
+
+ // Language
+ 'L_ADD_ADJ_TITLE' => $user->lang['addadj_title'],
+ 'L_ADJUSTMENT_VALUE' => $user->lang['adjustment_value'],
+ 'L_ADJUSTMENT_VALUE_NOTE' => '(' . strtolower($user->lang['adjustment_value_note']) . ')',
+ 'L_ADD_ADJUSTMENT' => $user->lang['add_adjustment'],
+ 'L_RESET' => $user->lang['reset'],
+ 'L_UPDATE_ADJUSTMENT' => $user->lang['update_adjustment'],
+ 'L_DELETE_ADJUSTMENT' => $user->lang['delete_adjustment'],
+
+ // Form validation
+ 'FV_ADJUSTMENT' => $this->fv->generate_error('adjustment_value'),
+
+ // Javascript messages
+ 'MSG_VALUE_EMPTY' => $user->lang['fv_required_adjustment'],
+
+ // Buttons
+ 'S_ADD' => ( !$this->url_id ) ? true : false)
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['addadj_title'],
+ 'template_file' => 'admin/addadj.html',
+ 'display' => true)
+ );
+ }
+}
+
+$add_groupadj = new Add_GroupAdj;
+$add_groupadj->process();
+?>
diff --git a/admin/addevent.php b/admin/addevent.php
new file mode 100644
index 0000000..b69c1d8
--- /dev/null
+++ b/admin/addevent.php
@@ -0,0 +1,338 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * addevent.php
+ * Began: Mon December 30 2002
+ *
+ * $Id: addevent.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class Add_Event extends EQdkp_Admin
+{
+ var $event = array(); // Holds event data if URI_EVENT Is set @var event
+ var $old_event = array(); // Holds event data from before POST @var old_event
+
+ function add_event()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path;
+
+ parent::eqdkp_admin();
+
+ $this->event = array(
+ 'event_name' => post_or_db('event_name'),
+ 'event_value' => post_or_db('event_value')
+ );
+
+ // Vars used to confirm deletion
+ $this->set_vars(array(
+ 'confirm_text' => $user->lang['confirm_delete_event'],
+ 'uri_parameter' => URI_EVENT)
+ );
+
+ $this->assoc_buttons(array(
+ 'add' => array(
+ 'name' => 'add',
+ 'process' => 'process_add',
+ 'check' => 'a_event_add'),
+ 'update' => array(
+ 'name' => 'update',
+ 'process' => 'process_update',
+ 'check' => 'a_event_upd'),
+ 'delete' => array(
+ 'name' => 'delete',
+ 'process' => 'process_delete',
+ 'check' => 'a_event_del'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_event_'))
+ );
+
+ $cur_hash = hash_filename("addevent.php");
+ //print"HASH::$cur_hash::<br>";
+
+
+ // Build the event array
+ // ---------------------------------------------------------
+ if ( $this->url_id )
+ {
+ $sql = 'SELECT event_name, event_value
+ FROM ' . EVENTS_TABLE . "
+ WHERE event_id = '" . $this->url_id . "'";
+ $result = $db->query($sql);
+ if ( !$row = $db->fetch_record($result) )
+ {
+ message_die($user->lang['error_invalid_event_provided']);
+ }
+ $db->free_result($result);
+
+ $this->event = array(
+ 'event_name' => post_or_db('event_name', $row),
+ 'event_value' => post_or_db('event_value', $row)
+ );
+ }
+ }
+
+ function error_check()
+ {
+ global $user;
+
+ $this->fv->is_number('event_value', $user->lang['fv_number_value']);
+
+ $this->fv->is_filled(array(
+ 'event_name' => $user->lang['fv_required_name'],
+ 'event_value' => $user->lang['fv_required_value'])
+ );
+
+ return $this->fv->is_error();
+ }
+
+ // ---------------------------------------------------------
+ // Process Add
+ // ---------------------------------------------------------
+ function process_add()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path, $SID;
+
+ //
+ // Insert event
+ // New for 1.3 - stripslashes out of event names.
+ //
+
+ $clean_event_name = str_replace("'","", $_POST['event_name']);
+ $clean_event_name = str_replace("`","", $clean_event_name);
+
+ $query = $db->build_query('INSERT', array(
+ 'event_name' => ($clean_event_name),
+ 'event_value' => $_POST['event_value'],
+ 'event_added_by' => $this->admin_user)
+ );
+ $db->query('INSERT INTO ' . EVENTS_TABLE . $query);
+ $this_event_id = $db->insert_id();
+
+ //
+ // Call plugin update hooks
+ //
+ $pm->do_hooks('/admin/addevent.php?action=add');
+
+
+ //
+ // Logging
+ //
+ $log_action = array(
+ 'header' => '{L_ACTION_EVENT_ADDED}',
+ 'id' => $this_event_id,
+ '{L_NAME}' => ($clean_event_name),
+ '{L_VALUE}' => $_POST['event_value'],
+ '{L_ADDED_BY}' => $this->admin_user);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success message
+ //
+ $success_message = sprintf($user->lang['admin_add_event_success'], $_POST['event_value'], $clean_event_name);
+ $link_list = array(
+ $user->lang['list_events'] => 'listevents.php' . $SID,
+ $user->lang['add_event'] => 'addevent.php' . $SID,
+ $user->lang['add_raid'] => 'addraid.php' . $SID);
+ $this->admin_die($success_message, $link_list);
+ }
+
+ // ---------------------------------------------------------
+ // Process Update
+ // ---------------------------------------------------------
+ function process_update()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path, $SID;
+
+ //
+ // Get the old data
+ //
+ $this->get_old_data();
+ $clean_event_name = stripslashes($_POST['event_name']);
+
+ //
+ // Update any raids with the old name
+ //
+ if ( $this->old_event['event_name'] != $clean_event_name )
+ {
+ $sql = 'UPDATE ' . RAIDS_TABLE . "
+ SET raid_name='" . $clean_event_name . "'
+ WHERE raid_name='" . $this->old_event['event_name'] . "'";
+ $db->query($sql);
+ }
+
+ //
+ // Update the event
+ //
+ $query = $db->build_query('UPDATE', array(
+ 'event_name' => $clean_event_name,
+ 'event_value' => $_POST['event_value'])
+ );
+ $sql = 'UPDATE ' . EVENTS_TABLE . ' SET ' . $query . " WHERE event_id='" . $this->url_id . "'";
+ $db->query($sql);
+
+ //
+ // Call plugin update hooks
+ //
+ $pm->do_hooks('/admin/addevent.php?action=update');
+
+ //
+ // Logging
+ //
+ $log_action = array(
+ 'header' => '{L_ACTION_EVENT_UPDATED}',
+ 'id' => $this->url_id,
+ '{L_NAME_BEFORE}' => $this->old_event['event_name'],
+ '{L_VALUE_BEFORE}' => $this->old_event['event_value'],
+ '{L_NAME_AFTER}' => $this->find_difference($this->old_event['event_name'], $clean_event_name),
+ '{L_VALUE_AFTER}' => $this->find_difference($this->old_event['event_value'], $_POST['event_value']),
+ '{L_UPDATED_BY}' => $this->admin_user);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success message
+ //
+ $success_message = sprintf($user->lang['admin_update_event_success'], $_POST['event_value'], $clean_event_name);
+ $link_list = array(
+ $user->lang['list_events'] => 'listevents.php' . $SID,
+ $user->lang['add_event'] => 'addevent.php' . $SID,
+ $user->lang['add_raid'] => 'addraid.php' . $SID);
+ $this->admin_die($success_message, $link_list);
+ }
+
+ // ---------------------------------------------------------
+ // Process Delete (confirmed)
+ // ---------------------------------------------------------
+ function process_confirm()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path, $SID;
+
+ //
+ // Get the old data
+ //
+ $this->get_old_data();
+
+ //
+ // Delete the event
+ //
+ $sql = 'DELETE FROM ' . EVENTS_TABLE . "
+ WHERE event_id = '" . $this->url_id . "'";
+ $db->query($sql);
+
+ //
+ // Logging
+ //
+
+ $clean_event_name = str_replace("'","", $this->old_event['event_name']);
+
+ $log_action = array(
+ 'header' => '{L_ACTION_EVENT_DELETED}',
+ 'id' => $this->url_id,
+ '{L_NAME}' => $clean_event_name,
+ '{L_VALUE}' => $this->old_event['event_value']);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success message
+ //
+ $success_message = sprintf($user->lang['admin_delete_event_success'], $this->old_event['event_value'], $this->old_event['event_name']);
+ $link_list = array(
+ $user->lang['list_events'] => 'listevents.php' . $SID,
+ $user->lang['add_event'] => 'addevent.php' . $SID,
+ $user->lang['add_raid'] => 'addraid.php' . $SID);
+ $this->admin_die($success_message, $link_list);
+ }
+
+ // ---------------------------------------------------------
+ // Process helper methods
+ // ---------------------------------------------------------
+ function get_old_data()
+ {
+ global $db;
+
+ $sql = 'SELECT event_name, event_value
+ FROM ' . EVENTS_TABLE . "
+ WHERE event_id='" . $this->url_id . "'";
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $this->old_event = array(
+ 'event_name' => str_replace("'","",$row['event_name']),
+ 'event_value' => addslashes($row['event_value'])
+ );
+ }
+ $db->free_result($result);
+ }
+
+ // ---------------------------------------------------------
+ // Display form
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path, $SID;
+
+ $tpl->assign_vars(array(
+ // Form vars
+ 'F_ADD_EVENT' => 'addevent.php' . $SID,
+ 'EVENT_ID' => $this->url_id,
+
+ // Form values
+ 'EVENT_NAME' => stripslashes($this->event['event_name']),
+ 'EVENT_VALUE' => stripslashes($this->event['event_value']),
+
+ // Language
+ 'L_ADD_EVENT_TITLE' => $user->lang['addevent_title'],
+ 'L_NAME' => $user->lang['name'],
+ 'L_DKP_VALUE' => sprintf($user->lang['dkp_value'], $eqdkp->config['dkp_name']),
+ 'L_ADD_EVENT' => $user->lang['add_event'],
+ 'L_RESET' => $user->lang['reset'],
+ 'L_UPDATE_EVENT' => $user->lang['update_event'],
+ 'L_DELETE_EVENT' => $user->lang['delete_event'],
+
+ // Form validation
+ 'FV_NAME' => $this->fv->generate_error('event_name'),
+ 'FV_VALUE' => $this->fv->generate_error('event_value'),
+
+ // Javascript messages
+ 'MSG_NAME_EMPTY' => $user->lang['fv_required_name'],
+ 'MSG_VALUE_EMPTY' => $user->lang['fv_required_value'],
+
+ // Buttons
+ 'S_ADD' => ( !$this->url_id ) ? true : false)
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['addevent_title'],
+ 'template_file' => 'admin/addevent.html',
+ 'display' => true)
+ );
+ }
+}
+
+$add_event = new Add_Event;
+$add_event->process();
+?>
diff --git a/admin/addiadj.php b/admin/addiadj.php
new file mode 100644
index 0000000..eb9d800
--- /dev/null
+++ b/admin/addiadj.php
@@ -0,0 +1,424 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * addiadj.php
+ * Began: Sun January 5 2003
+ *
+ * $Id: addiadj.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class Add_IndivAdj extends EQdkp_Admin
+{
+ var $adjustment = array(); // Holds adjustment data if URI_ADJUSTMENT is set @var adjustment
+ var $old_adjustment = array(); // Holds adjustment data from before POST @var old_adjustment
+
+ function add_indivadj()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path, $SID;
+
+ parent::eqdkp_admin();
+
+ $this->adjustment = array(
+ 'adjustment_value' => post_or_db('adjustment_value'),
+ 'adjustment_reason' => post_or_db('adjustment_reason'),
+ 'member_names' => post_or_db('member_names')
+ );
+
+ // Vars used to confirm deletion
+ $this->set_vars(array(
+ 'confirm_text' => $user->lang['confirm_delete_iadj'],
+ 'uri_parameter' => URI_ADJUSTMENT)
+ );
+
+ $this->assoc_buttons(array(
+ 'add' => array(
+ 'name' => 'add',
+ 'process' => 'process_add',
+ 'check' => 'a_indivadj_add'),
+ 'update' => array(
+ 'name' => 'update',
+ 'process' => 'process_update',
+ 'check' => 'a_indivadj_upd'),
+ 'delete' => array(
+ 'name' => 'delete',
+ 'process' => 'process_delete',
+ 'check' => 'a_indivadj_del'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_indivadj_'))
+ );
+
+ $cur_hash = hash_filename("addiadj.php");
+ //print"HASH::$cur_hash::<br>";
+
+
+ // Build the adjustment aray
+ // -----------------------------------------------------
+ if ( $this->url_id )
+ {
+ $sql = 'SELECT adjustment_value, adjustment_date, adjustment_reason, member_name, adjustment_group_key
+ FROM ' . ADJUSTMENTS_TABLE . "
+ WHERE adjustment_id='" . $this->url_id . "'";
+ $result = $db->query($sql);
+ if ( !$row = $db->fetch_record($result) )
+ {
+ message_die($user->lang['error_invalid_adjustment']);
+ }
+ $db->free_result($result);
+
+ // If member name isn't set, it's a group adjustment - put them back on that script
+ if ( !isset($row['member_name']) )
+ {
+ redirect('addadj.php' . $SID . '&' . URI_ADJUSTMENT . '='.$adjustment_id);
+ }
+
+ $this->time = $row['adjustment_date'];
+ $this->adjustment = array(
+ 'adjustment_value' => post_or_db('adjustment_value', $row),
+ 'adjustment_reason' => post_or_db('adjustment_reason', $row)
+ );
+
+ $members = array();
+ $sql = 'SELECT member_name
+ FROM ' . ADJUSTMENTS_TABLE . "
+ WHERE adjustment_group_key='".$row['adjustment_group_key']."'";
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $members[] = $row['member_name'];
+ }
+ $db->free_result($result);
+
+ $this->adjustment['member_names'] = ( !empty($_POST['member_names']) ) ? $_POST['member_names'] : $members;
+ unset($row, $members, $sql);
+ }
+ }
+
+ function error_check()
+ {
+ global $user;
+
+ if ( (!isset($_POST['member_names'])) || (!is_array($_POST['member_names'])) )
+ {
+ $this->fv->errors['member_names'] = $user->lang['fv_required_members'];
+ }
+
+ $this->fv->is_number('adjustment_value', $user->lang['fv_number_adjustment']);
+ $this->fv->is_filled('adjustment_value', $user->lang['fv_required_adjustment']);
+ $this->fv->is_within_range('mo', 1, 12, $user->lang['fv_range_month']);
+ $this->fv->is_within_range('d', 1, 31, $user->lang['fv_range_day']);
+ $this->fv->is_within_range('y', 1998, 2090, $user->lang['fv_range_year']);
+
+ $this->time = mktime(0, 0, 0, $_POST['mo'], $_POST['d'], $_POST['y']);
+
+ return $this->fv->is_error();
+ }
+
+ // ---------------------------------------------------------
+ // Process Add
+ // ---------------------------------------------------------
+ function process_add()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path, $SID;
+
+ //
+ // Generate our group key
+ //
+ $group_key = $this->gen_group_key($this->time, stripslashes($_POST['adjustment_reason']), $_POST['adjustment_value']);
+
+ //
+ // Add adjustment to selected members
+ //
+ foreach ( $_POST['member_names'] as $member_name )
+ {
+ $this->add_new_adjustment($member_name, $group_key);
+ }
+
+ //
+ // Logging
+ //
+ $log_action = array(
+ 'header' => '{L_ACTION_INDIVADJ_ADDED}',
+ '{L_ADJUSTMENT}' => $_POST['adjustment_value'],
+ '{L_REASON}' => stripslashes($_POST['adjustment_reason']),
+ '{L_MEMBERS}' => implode(', ', $_POST['member_names']),
+ '{L_ADDED_BY}' => $this->admin_user);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success message
+ //
+ $success_message = sprintf($user->lang['admin_add_iadj_success'], $eqdkp->config['dkp_name'], $_POST['adjustment_value'], implode(', ', $_POST['member_names']));
+ $link_list = array(
+ $user->lang['list_indivadj'] => 'listadj.php' . $SID . '&amp;' . URI_PAGE . '=individual',
+ $user->lang['list_members'] => $eqdkp_root_path . 'listmembers.php' . $SID);
+ $this->admin_die($success_message, $link_list);
+ }
+
+ // ---------------------------------------------------------
+ // Process Update
+ // ---------------------------------------------------------
+ function process_update()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path, $SID;
+
+ //
+ // Remove the old adjustment from members that received it
+ // and then remove the adjustment itself
+ //
+ $this->remove_old_adjustment();
+
+ //
+ // Generate a new group key
+ //
+ $group_key = $this->gen_group_key($this->time, stripslashes($_POST['adjustment_reason']), $_POST['adjustment_value']);
+
+ //
+ // Add the new adjustment to selected members
+ //
+ foreach ( $_POST['member_names'] as $member_name )
+ {
+ $this->add_new_adjustment($member_name, $group_key);
+ }
+
+ //
+ // Logging
+ //
+ $log_action = array(
+ 'header' => '{L_ACTION_INDIVADJ_UPDATED}',
+ 'id' => $this->url_id,
+ '{L_ADJUSTMENT_BEFORE}' => $this->old_adjustment['adjustment_value'],
+ '{L_REASON_BEFORE}' => $this->old_adjustment['adjustment_reason'],
+ '{L_MEMBERS_BEFORE}' => implode(', ', $this->old_adjustment['member_names']),
+ '{L_ADJUSTMENT_AFTER}' => $this->find_difference($this->old_adjustment['adjustment_value'], $_POST['adjustment_value']),
+ '{L_REASON_AFTER}' => $this->find_difference($this->old_adjustment['adjustment_reason'], $_POST['adjustment_reason']),
+ '{L_MEMBERS_AFTER}' => implode(', ', $this->find_difference($this->old_adjustment['member_names'], $_POST['member_names'])),
+ '{L_UPDATED_BY}' => $this->admin_user);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success message
+ //
+ $success_message = sprintf($user->lang['admin_update_iadj_success'], $eqdkp->config['dkp_name'], $_POST['adjustment_value'], implode(', ', $_POST['member_names']));
+ $link_list = array(
+ $user->lang['list_indivadj'] => 'listadj.php' . $SID . '&amp;' . URI_PAGE . '=individual',
+ $user->lang['list_members'] => $eqdkp_root_path . 'listmembers.php' . $SID);
+ $this->admin_die($success_message, $link_list);
+ }
+
+ // ---------------------------------------------------------
+ // Process Delete (confirmed)
+ // ---------------------------------------------------------
+ function process_confirm()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path, $SID;
+
+ //
+ // Remove the old adjustment from members that received it
+ // and then remove the adjustment itself
+ //
+ $this->remove_old_adjustment();
+
+ //
+ // Logging
+ //
+ $log_action = array(
+ 'header' => '{L_ACTION_INDIVADJ_DELETED}',
+ 'id' => $this->url_id,
+ '{L_ADJUSTMENT}' => $this->old_adjustment['adjustment_value'],
+ '{L_REASON}' => $this->old_adjustment['adjustment_reason'],
+ '{L_MEMBERS}' => implode(', ', $this->old_adjustment['member_names']));
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success messages
+ //
+ $success_message = sprintf($user->lang['admin_delete_iadj_success'], $eqdkp->config['dkp_name'], $this->old_adjustment['adjustment_value'], implode(', ', $this->old_adjustment['member_names']));
+ $link_list = array(
+ $user->lang['list_indivadj'] => 'listadj.php' . $SID . '&amp;' . URI_PAGE . '=individual',
+ $user->lang['list_members'] => $eqdkp_root_path . 'listmembers.php' . $SID);
+ $this->admin_die($success_message, $link_list);
+ }
+
+ // ---------------------------------------------------------
+ // Process helper methods
+ // ---------------------------------------------------------
+ function remove_old_adjustment()
+ {
+ global $db;
+
+ $adjustment_ids = array();
+ $old_members = array();
+
+ $sql = 'SELECT a2.*
+ FROM (' . ADJUSTMENTS_TABLE . ' a1
+ LEFT JOIN ' . ADJUSTMENTS_TABLE . " a2
+ ON a1.adjustment_group_key = a2.adjustment_group_key)
+ WHERE a1.adjustment_id='" . $this->url_id . "'";
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $adjustment_ids[] = $row['adjustment_id'];
+
+ $old_members[] = addslashes($row['member_name']);
+ $this->old_adjustment = array(
+ 'adjustment_value' => addslashes($row['adjustment_value']),
+ 'adjustment_date' => addslashes($row['adjustment_date']),
+ 'member_names' => $old_members,
+ 'adjustment_reason' => addslashes($row['adjustment_reason'])
+ );
+ }
+
+ //
+ // Remove the adjustment value from adjustments table
+ //
+ $sql = 'DELETE FROM ' . ADJUSTMENTS_TABLE . '
+ WHERE adjustment_id IN (' . implode(', ', $adjustment_ids) . ')';
+ $db->query($sql);
+
+ //
+ // Remove the adjustment value from members
+ //
+ $sql = 'UPDATE ' . MEMBERS_TABLE . '
+ SET member_adjustment = member_adjustment - ' . stripslashes($this->old_adjustment['adjustment_value']) . '
+ WHERE member_name IN (\'' . implode("', '", $this->old_adjustment['member_names']) . '\')';
+ $db->query($sql);
+ }
+
+ function add_new_adjustment($member_name, $group_key)
+ {
+ global $db;
+
+ //
+ // Add the adjustment to the member
+ //
+ $sql = 'UPDATE ' . MEMBERS_TABLE . '
+ SET member_adjustment = member_adjustment + ' . $db->escape($_POST['adjustment_value']) . "
+ WHERE member_name='" . $member_name . "'";
+ $db->query($sql);
+ unset($sql);
+
+ //
+ // Add the adjustment to the database
+ //
+ $query = $db->build_query('INSERT', array(
+ 'adjustment_value' => $_POST['adjustment_value'],
+ 'adjustment_date' => $this->time,
+ 'member_name' => $member_name,
+ 'adjustment_reason' => $_POST['adjustment_reason'],
+ 'adjustment_group_key' => $group_key,
+ 'adjustment_added_by' => $this->admin_user)
+ );
+ $db->query('INSERT INTO ' . ADJUSTMENTS_TABLE . $query);
+ }
+
+ // ---------------------------------------------------------
+ // Display form
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path, $SID;
+
+ //
+ // Build member drop-down
+ //
+ $sql = 'SELECT member_name
+ FROM ' . MEMBERS_TABLE . '
+ ORDER BY member_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ if ( $this->url_id )
+ {
+ $selected = ( @in_array($row['member_name'], $this->adjustment['member_names']) ) ? ' selected="selected"' : '';
+ }
+ else
+ {
+ $selected = ( @in_array($row['member_name'], $_POST['member_names']) ) ? ' selected="selected"' : '';
+ }
+
+ $tpl->assign_block_vars('members_row', array(
+ 'VALUE' => $row['member_name'],
+ 'SELECTED' => $selected,
+ 'OPTION' => $row['member_name'])
+ );
+ }
+ $db->free_result($result);
+
+ $tpl->assign_vars(array(
+ // Form vars
+ 'F_ADD_ADJUSTMENT' => 'addiadj.php' . $SID,
+ 'ADJUSTMENT_ID' => $this->url_id,
+
+ // Form values
+ 'ADJUSTMENT_VALUE' => $this->adjustment['adjustment_value'],
+ 'ADJUSTMENT_REASON' => stripslashes(htmlspecialchars($this->adjustment['adjustment_reason'])),
+ 'MO' => date('m', stripslashes($this->time)),
+ 'D' => date('d', stripslashes($this->time)),
+ 'Y' => date('Y', stripslashes($this->time)),
+ 'H' => date('h', stripslashes($this->time)),
+ 'MI' => date('i', stripslashes($this->time)),
+ 'S' => date('s', stripslashes($this->time)),
+
+ // Language
+ 'L_ADD_IADJ_TITLE' => $user->lang['addiadj_title'],
+ 'L_MEMBERS' => $user->lang['members'],
+ 'L_HOLD_CTRL_NOTE' => '(' . $user->lang['hold_ctrl_note'] . ')<br />',
+ 'L_REASON' => $user->lang['reason'],
+ 'L_VALUE' => $user->lang['value'],
+ 'L_ADJUSTMENT_VALUE_NOTE' => strtolower($user->lang['adjustment_value_note']),
+ 'L_DATE' => $user->lang['date'],
+ 'L_ADD_ADJUSTMENT' => $user->lang['add_adjustment'],
+ 'L_RESET' => $user->lang['reset'],
+ 'L_UPDATE_ADJUSTMENT' => $user->lang['update_adjustment'],
+ 'L_DELETE_ADJUSTMENT' => $user->lang['delete_adjustment'],
+
+ // Form validation
+ 'FV_MEMBERS' => $this->fv->generate_error('member_names'),
+ 'FV_ADJUSTMENT' => $this->fv->generate_error('adjustment_value'),
+ 'FV_MO' => $this->fv->generate_error('mo'),
+ 'FV_D' => $this->fv->generate_error('d'),
+ 'FV_Y' => $this->fv->generate_error('y'),
+
+ // Javascript messages
+ 'MSG_VALUE_EMPTY' => $user->lang['fv_required_adjustment'],
+
+ // Buttons
+ 'S_ADD' => ( !$this->url_id ) ? true : false)
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['addiadj_title'],
+ 'template_file' => 'admin/addiadj.html',
+ 'display' => true)
+ );
+ }
+}
+
+$add_indivadj = new Add_IndivAdj;
+$add_indivadj->process();
+?>
diff --git a/admin/additem.php b/admin/additem.php
new file mode 100644
index 0000000..afae707
--- /dev/null
+++ b/admin/additem.php
@@ -0,0 +1,677 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * additem.php
+ * Began: Fri December 27 2002
+ *
+ * $Id: additem.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class Add_Item extends EQdkp_Admin
+{
+ var $item = array(); // Holds item data if URI_ITEM is set @var item
+ var $old_item = array(); // Holds item data from before POST @var old_item
+
+ function add_item()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path, $SID;
+
+ parent::eqdkp_admin();
+
+ $this->item = array(
+ 'select_item_name' => post_or_db('select_item_name'),
+ 'item_name' => post_or_db('item_name'),
+ 'item_buyers' => post_or_db('item_buyers'),
+ 'raid_id' => post_or_db('raid_id'),
+ 'item_value' => post_or_db('item_value')
+ );
+
+ // Vars used to confirm deletion
+ $this->set_vars(array(
+ 'confirm_text' => $user->lang['confirm_delete_item'],
+ 'uri_parameter' => URI_ITEM)
+ );
+
+ $this->assoc_buttons(array(
+ 'add' => array(
+ 'name' => 'add',
+ 'process' => 'process_add',
+ 'check' => 'a_item_add'),
+ 'update' => array(
+ 'name' => 'update',
+ 'process' => 'process_update',
+ 'check' => 'a_item_upd'),
+ 'delete' => array(
+ 'name' => 'delete',
+ 'process' => 'process_delete',
+ 'check' => 'a_item_del'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_item_'))
+ );
+
+ // Build the item array
+ // ---------------------------------------------------------
+ if ( $this->url_id )
+ {
+ $sql = 'SELECT item_name, item_buyer, raid_id, item_value, item_date, item_group_key
+ FROM ' . ITEMS_TABLE . "
+ WHERE item_id='" . $this->url_id . "'";
+ $result = $db->query($sql);
+ if ( !$row = $db->fetch_record($result) )
+ {
+ message_die($user->lang['error_invalid_item_provided']);
+ }
+ $db->free_result($result);
+
+ $this->time = $row['item_date'];
+ $this->item = array(
+ 'select_item_name' => post_or_db('select_item_name'),
+ 'item_name' => post_or_db('item_name', $row),
+ 'raid_id' => post_or_db('raid_id', $row),
+ 'item_value' => post_or_db('item_value', $row)
+ );
+
+ $buyers = array();
+ $sql = 'SELECT item_buyer
+ FROM ' . ITEMS_TABLE . "
+ WHERE item_group_key='" . $row['item_group_key'] . "'";
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $buyers[] = $row['item_buyer'];
+ }
+ $this->item['item_buyers'] = ( !empty($_POST['item_buyers']) ) ? $_POST['item_buyers'] : $buyers;
+ unset($buyers);
+ }
+ }
+
+ function error_check()
+ {
+ global $user;
+
+ if ( (!isset($_POST['item_buyers'])) || (!is_array($_POST['item_buyers'])) )
+ {
+ $this->fv->errors['item_buyers'] = $user->lang['fv_required_buyers'];
+ }
+ $this->fv->is_number('item_value', $user->lang['fv_number_value']);
+ $this->fv->is_filled(array(
+ 'raid_id' => $user->lang['fv_required_raidid'],
+ 'item_value' => $user->lang['fv_required_value'])
+ );
+
+ if ( !empty($_POST['item_name']) )
+ {
+ $this->item['item_name'] = $_POST['item_name'];
+ }
+ elseif ( !empty($_POST['select_item_name']) )
+ {
+ $this->item['item_name'] = $_POST['select_item_name'];
+ }
+ else
+ {
+ $this->fv->errors['item_name'] = $user->lang['fv_required_item_name'];
+ }
+
+ return $this->fv->is_error();
+ }
+
+ // ---------------------------------------------------------
+ // Process Add
+ // ---------------------------------------------------------
+ function process_add()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path, $SID;
+
+ // Get item name from the appropriate field
+ $this->item['item_name'] = ( !empty($_POST['item_name']) ) ? $_POST['item_name'] : $_POST['select_item_name'];
+
+ // Find out the item's date based on the raid it's associated with
+ $this->time = $db->query_first('SELECT raid_date FROM ' . RAIDS_TABLE . " WHERE raid_id='" . $_POST['raid_id'] . "'");
+
+ //
+ // Generate our group key
+ //
+ $group_key = $this->gen_group_key($this->item['item_name'], $this->time, $_POST['raid_id']);
+
+ //
+ // Add item to selected members
+ //
+ $this->add_new_item($group_key);
+
+ //
+ // Logging
+ //
+ $item_buyers = implode(', ', $_POST['item_buyers']);
+ $log_action = array(
+ 'header' => '{L_ACTION_ITEM_ADDED}',
+ '{L_NAME}' => $this->item['item_name'],
+ '{L_BUYERS}' => $item_buyers,
+ '{L_RAID_ID}' => $_POST['raid_id'],
+ '{L_VALUE}' => $_POST['item_value'],
+ '{L_ADDED_BY}' => $this->admin_user);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success message
+ //
+ $success_message = sprintf($user->lang['admin_add_item_success'], $this->item['item_name'], $item_buyers, $_POST['item_value']);
+ $link_list = array(
+ $user->lang['add_item'] => 'additem.php' . $SID,
+ $user->lang['list_items'] => 'listitems.php' . $SID);
+ $this->admin_die($success_message, $link_list);
+ }
+
+ // ---------------------------------------------------------
+ // Process Update
+ // ---------------------------------------------------------
+ function process_update()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path, $SID;
+
+ //
+ // Remove the old item
+ //
+ $this->remove_old_item();
+
+ // Get item name from the appropriate field
+ $this->item['item_name'] = ( !empty($_POST['item_name']) ) ? $_POST['item_name'] : $_POST['select_item_name'];
+
+ // Find out the item's date based on the raid it's associated with
+ $this->time = $db->query_first('SELECT raid_date FROM ' . RAIDS_TABLE . " WHERE raid_id='" . $_POST['raid_id'] . "'");
+
+ //
+ // Generate our group key
+ //
+ $group_key = $this->gen_group_key($this->item['item_name'], $this->time, $_POST['raid_id']);
+
+ //
+ // Add item to selected members
+ //
+ $this->add_new_item($group_key);
+
+ //
+ // Logging
+ //
+ $item_buyers = implode(', ', $_POST['item_buyers']);
+ $log_action = array(
+ 'header' => '{L_ACTION_ITEM_UPDATED}',
+ '{L_NAME_BEFORE}' => $this->old_item['item_name'],
+ '{L_BUYERS_BEFORE}' => implode(', ', $this->old_item['item_buyers']),
+ '{L_RAID_ID_BEFORE}' => $this->old_item['raid_id'],
+ '{L_VALUE_BEFORE}' => $this->old_item['item_value'],
+ '{L_NAME_AFTER}' => $this->find_difference($this->old_item['item_name'], $this->item['item_name']),
+ '{L_BUYERS_AFTER}' => implode(', ', $this->find_difference($this->old_item['item_buyers'], $_POST['item_buyers'])),
+ '{L_RAID_ID_AFTER}' => $this->find_difference($this->old_item['raid_id'], $_POST['raid_id']),
+ '{L_VALUE_AFTER}' => $this->find_difference($this->old_item['item_value'], $_POST['item_value']),
+ '{L_UPDATED_BY}' => $this->admin_user);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success message
+ //
+ $success_message = sprintf($user->lang['admin_update_item_success'], $this->old_item['item_name'], implode(', ', $this->old_item['item_buyers']), $this->old_item['item_value']);
+ $link_list = array(
+ $user->lang['add_item'] => 'additem.php' . $SID,
+ $user->lang['list_items'] => 'listitems.php' . $SID);
+ $this->admin_die($success_message, $link_list);
+ }
+
+ // ---------------------------------------------------------
+ // Process Delete (confirmed)
+ // ---------------------------------------------------------
+ function process_confirm()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path, $SID;
+
+ //
+ // Remove the old item
+ //
+ $this->remove_old_item();
+
+ //
+ // Logging
+ //
+ $item_buyers = implode(', ', $this->old_item['item_buyers']);
+ $log_action = array(
+ 'header' => '{L_ACTION_ITEM_DELETED}',
+ '{L_NAME}' => $this->old_item['item_name'],
+ '{L_BUYERS}' => $item_buyers,
+ '{L_RAID_ID}' => $this->old_item['raid_id'],
+ '{L_VALUE}' => $this->old_item['item_value']);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success message
+ //
+ $success_message = sprintf($user->lang['admin_delete_item_success'], $this->old_item['item_name'], $item_buyers, $this->old_item['item_value']);
+ $link_list = array(
+ $user->lang['add_item'] => 'additem.php' . $SID,
+ $user->lang['list_items'] => 'listitems.php' . $SID);
+ $this->admin_die($success_message, $link_list);
+ }
+
+ // ---------------------------------------------------------
+ // Process helper methods
+ // ---------------------------------------------------------
+ function remove_old_item()
+ {
+ global $db;
+
+ $item_ids = array();
+ $old_buyers = array();
+
+ //
+ // Build the item_ids, old_buyers and old_item arrays
+ //
+ $sql = 'SELECT i2.*
+ FROM (' . ITEMS_TABLE . ' i1
+ LEFT JOIN ' . ITEMS_TABLE . " i2
+ ON i1.item_group_key = i2.item_group_key)
+ WHERE i1.item_id='" . $this->url_id . "'";
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $item_ids[] = $row['item_id'];
+
+ $old_buyers[] = addslashes($row['item_buyer']);
+ $this->old_item = array(
+ 'item_name' => addslashes($row['item_name']),
+ 'item_buyers' => $old_buyers,
+ 'raid_id' => addslashes($row['raid_id']),
+ 'item_date' => addslashes($row['item_date']),
+ 'item_value' => addslashes($row['item_value'])
+ );
+ }
+
+ //
+ // Remove the item purchase from the items table
+ //
+ $sql = 'DELETE FROM ' . ITEMS_TABLE . '
+ WHERE item_id IN (' . implode(', ', $item_ids) . ')';
+ $db->query($sql);
+
+ //
+ // Remove the purchase value from members
+ //
+ $sql = 'UPDATE ' . MEMBERS_TABLE . '
+ SET member_spent = member_spent - ' . stripslashes($this->old_item['item_value']) . '
+ WHERE member_name IN (\'' . implode("', '", $this->old_item['item_buyers']) . '\')';
+ $db->query($sql);
+ }
+
+ function add_new_item($group_key)
+ {
+ global $db;
+
+ $query = array();
+
+ foreach ( $_POST['item_buyers'] as $member_name )
+ {
+ $query[] = $db->build_query('INSERT', array(
+ 'item_name' => stripslashes($this->item['item_name']),
+ 'item_buyer' => $member_name,
+ 'raid_id' => $_POST['raid_id'],
+ 'item_value' => $_POST['item_value'],
+ 'item_date' => $this->time,
+ 'item_group_key' => $group_key,
+ 'item_added_by' => $this->admin_user)
+ );
+ }
+
+ //
+ // Add charge to members
+ //
+ $sql = 'UPDATE ' . MEMBERS_TABLE . '
+ SET member_spent = member_spent + ' . $_POST['item_value'] . '
+ WHERE member_name IN (\'' . implode("', '", $_POST['item_buyers']) . '\')';
+ $db->query($sql);
+
+ //
+ // Add purchase(s) to items table
+ //
+ // Remove the field names from our built queries
+ foreach ( $query as $key => $sql )
+ {
+ $query[$key] = preg_replace('#^.+\) VALUES (\(.+\))#', '\1', $sql);
+ }
+
+ $sql = 'INSERT INTO ' . ITEMS_TABLE . '
+ (item_name, item_buyer, raid_id, item_value, item_date, item_group_key, item_added_by)
+ VALUES ' . implode(', ', $query);
+ $db->query($sql);
+ }
+
+ // ---------------------------------------------------------
+ // Display form
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $eqdkp_root_path, $SID;
+
+ //
+ // Build member and buyer drop-downs
+ //
+ $buyer_source = ( $this->url_id ) ? $this->item['item_buyers'] : (( isset($_POST['item_buyers']) ) ? $_POST['item_buyers'] : '');
+
+ $sql = 'SELECT member_name
+ FROM ' . MEMBERS_TABLE . '
+ ORDER BY member_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $tpl->assign_block_vars('members_row', array(
+ 'VALUE' => $row['member_name'],
+ 'OPTION' => $row['member_name'])
+ );
+
+ if ( @in_array($row['member_name'], $buyer_source) )
+ {
+ $tpl->assign_block_vars('buyers_row', array(
+ 'VALUE' => $row['member_name'],
+ 'OPTION' => $row['member_name'])
+ );
+ }
+ }
+ $db->free_result($result);
+
+ //
+ // Build raid drop-down
+ //
+ // Show all raids?
+ $show_all = ( (!empty($_GET['show'])) && ($_GET['show'] == 'all') ) ? true : false;
+
+ // Make two_weeks two weeks before the date the item was purchased
+ $two_weeks = mktime(0, 0, 0, date('m', $this->time), date('d', $this->time)-14, date('y', $this->time));
+
+ $sql_where_clause = ( $show_all ) ? '' : ' WHERE (raid_date >= ' . $two_weeks . ')';
+ $sql = 'SELECT raid_id, raid_name, raid_date
+ FROM ' . RAIDS_TABLE .
+ $sql_where_clause . '
+ ORDER BY raid_date DESC';
+ $result = $db->query($sql);
+ $raid_id = ( isset($_GET['raid_id']) ) ? $_GET['raid_id'] : '0'; // 'Add items from this raid' link
+ while ( $row = $db->fetch_record($result) )
+ {
+ $tpl->assign_block_vars('raids_row', array(
+ 'VALUE' => $row['raid_id'],
+ 'SELECTED' => ( ($raid_id == $row['raid_id']) || ($this->item['raid_id'] == $row['raid_id']) ) ? ' selected="selected"' : '',
+ 'OPTION' => date($user->style['date_notime_short'], $row['raid_date']) . ' - ' . stripslashes($row['raid_name']))
+ );
+ }
+ $db->free_result($result);
+
+ //
+ // Build item drop-down
+ //
+ $max_value = $db->query_first('SELECT max(item_value) FROM ' . ITEMS_TABLE);
+ $float = @explode('.', $max_value);
+ $floatlen = @strlen($float[0]);
+ $format = '%0' . $floatlen . '.2f';
+
+ $previous_item = '';
+ $sql = 'SELECT item_value, item_name
+ FROM ' . ITEMS_TABLE . '
+ ORDER BY item_name, item_date DESC';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $item_select_name = stripslashes(trim($row['item_name']));
+ $item_name = stripslashes(trim($this->item['item_name']));
+ $item_value = $row['item_value'];
+
+ if ( $previous_item != $item_select_name )
+ {
+ $tpl->assign_block_vars('items_row', array(
+ 'VALUE' => $item_select_name,
+ 'SELECTED' => ( ($item_select_name == $item_name) || ($item_select_name == $this->item['select_item_name']) ) ? ' selected="selected"' : '',
+ // 'OPTION' => '(' . sprintf($format, $row['item_value']) . ') - ' . $item_select_name)
+ 'OPTION' => $item_select_name . ' - ( ' . sprintf($format, $row['item_value']) . ' )' )
+
+ );
+
+ $previous_item = $item_select_name;
+ }
+ }
+ $db->free_result($result);
+
+ $tpl->assign_vars(array(
+ // Form vars
+ 'F_ADD_ITEM' => 'additem.php' . $SID,
+ 'ITEM_ID' => $this->url_id,
+ 'U_ADD_RAID' => 'addraid.php'.$SID,
+ 'S_MULTIPLE_BUYERS' => ( !$this->url_id ) ? true : false,
+
+ // Form values
+ 'ITEM_NAME' => stripslashes($this->item['item_name']),
+ 'ITEM_VALUE' => $this->item['item_value'],
+
+ // Language
+ 'L_ADD_ITEM_TITLE' => $user->lang['additem_title'],
+ 'L_BUYERS' => $user->lang['buyers'],
+ 'L_HOLD_CTRL_NOTE' => '('.$user->lang['hold_ctrl_note'].')<br />',
+ 'L_SEARCH_MEMBERS' => $user->lang['search_members'],
+ 'L_RAID' => $user->lang['raid'],
+ 'L_ADD_RAID' => strtolower($user->lang['add_raid']),
+ 'L_NOTE' => $user->lang['note'],
+ 'L_ADDITEM_RAIDID_NOTE' => ( !$show_all ) ? sprintf($user->lang['additem_raidid_note'], '<a href="additem.php'.$SID.'&amp;show=all'.(( $this->url_id ) ? '&amp;' . URI_ITEM . '=' . $this->url_id : '').'">')
+ : $user->lang['additem_raidid_showall_note'],
+ 'L_ITEM' => $user->lang['item'],
+ 'L_SEARCH' => strtolower($user->lang['search']),
+ 'L_SEARCH_EXISTING' => $user->lang['search_existing'],
+ 'L_SELECT_EXISTING' => $user->lang['select_existing'],
+ 'L_OR' => strtolower($user->lang['or']),
+ 'L_ENTER_NEW' => $user->lang['enter_new'],
+ 'L_VALUE' => $user->lang['value'],
+ 'L_ADD_ITEM' => $user->lang['add_item'],
+ 'L_RESET' => $user->lang['reset'],
+ 'L_UPDATE_ITEM' => $user->lang['update_item'],
+ 'L_DELETE_ITEM' => $user->lang['delete_item'],
+
+ // Form validation
+ 'FV_ITEM_BUYERS' => $this->fv->generate_error('item_buyers'),
+ 'FV_RAID_ID' => $this->fv->generate_error('raid_id'),
+ 'FV_ITEM_NAME' => $this->fv->generate_error('item_name'),
+ 'FV_ITEM_VALUE' => $this->fv->generate_error('item_value'),
+
+ // Javascript messages
+ 'MSG_NAME_EMPTY' => $user->lang['fv_required_item_name'],
+ 'MSG_RAID_ID_EMPTY' => $user->lang['fv_required_raidid'],
+ 'MSG_VALUE_EMPTY' => $user->lang['fv_required_value'],
+ 'ITEM_VALUE_LENGTH' => ($floatlen + 3), // The first three digits plus '.00';
+
+ // Buttons
+ 'S_ADD' => ( !$this->url_id ) ? true : false)
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['additem_title'],
+ 'template_file' => 'admin/additem.html',
+ 'display' => true)
+ );
+ }
+}
+
+class Item_Search extends EQdkp_Admin
+{
+ function item_search()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ $this->assoc_buttons(array(
+ 'search' => array(
+ 'name' => 'search',
+ 'process' => 'process_search',
+ 'check' => 'a_item_'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_item_'))
+ );
+ }
+
+ function error_check()
+ {
+ $this->fv->is_filled('query');
+ if ( strlen($_POST['query']) < 2 )
+ {
+ $this->fv->errors['query'] = '';
+ }
+
+ return $this->fv->is_error();
+ }
+
+ // ---------------------------------------------------------
+ // Process item search
+ // ---------------------------------------------------------
+ function process_search()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $items_array = array();
+ if ( !empty($_POST['query']) )
+ {
+ $eqdkp_items = array();
+ $eqdkp_item_stats = array();
+
+ //
+ // Get item names from our standard items table
+ //
+ $sql = 'SELECT item_name
+ FROM ' . ITEMS_TABLE . "
+ WHERE item_name LIKE '%" . $_POST['query'] . "%'
+ ORDER BY item_name";
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $eqdkp_items[] = $row['item_name'];
+ }
+ $db->free_result($result);
+
+ //
+ // Get item names from our stats table if the stats plugin is installed
+ //
+
+ // #######################################
+ // Alteration sumbitted by Tam
+ // #######################################
+ if ( $pm->check(PLUGIN_INSTALLED, 'stats') )
+ {
+ $sql = 'SELECT name
+ FROM ' . ITEM_STATS_TABLE . "
+ WHERE name LIKE '%" . $_POST['query'] . "%'
+ ORDER BY name";
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ // Add the item if we don't have it already
+ if ( !in_array($row['item_name'], $eqdkp_items) )
+ {
+ $eqdkp_item_stats[] = $row['name'];
+ }
+ }
+ $db->free_result($result);
+ }
+ //#######################################
+
+ //
+ // Build the drop-down
+ //
+ $items_array = array_merge($eqdkp_items, $eqdkp_item_stats);
+ $items_array = array_unique($items_array);
+ sort($items_array);
+ reset($items_array);
+
+ foreach ( $items_array as $item_name )
+ {
+ $tpl->assign_block_vars('items_row', array(
+ 'VALUE' => stripslashes($item_name),
+ 'OPTION' => stripslashes($item_name))
+ );
+ }
+ }
+
+ $tpl->assign_vars(array(
+ 'S_STEP1' => false,
+
+ 'L_RESULTS' => sprintf($user->lang['results'], sizeof($items_array), stripslashes($_POST['query'])),
+ 'L_SELECT' => $user->lang['select'])
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['additem_title'],
+ 'gen_simple_header' => true,
+ 'template_file' => 'admin/additem_search.html',
+ 'display' => true)
+ );
+ }
+
+ // ---------------------------------------------------------
+ // Display item search
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $tpl->assign_vars(array(
+ 'F_SEARCH_ITEM' => 'additem.php' . $SID . '&amp;mode=search',
+ 'S_STEP1' => true,
+ 'ONLOAD' => ' onload="javascript:document.post.query.focus()"',
+
+ 'L_ITEM_SEARCH' => $user->lang['item_search'],
+ 'L_SEARCH' => $user->lang['search'],
+ 'L_CLOSE_WINDOW' => $user->lang['close_window'])
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['additem_title'],
+ 'gen_simple_header' => true,
+ 'template_file' => 'admin/additem_search.html',
+ 'display' => true)
+ );
+ }
+}
+
+$mode = ( isset($_GET['mode']) ) ? $_GET['mode'] : 'additem';
+switch ( $mode )
+{
+ case 'additem':
+ $add_item = new Add_Item;
+ $add_item->process();
+ break;
+
+ case 'search':
+ $item_search = new Item_Search;
+ $item_search->process();
+ break;
+}
+?>
diff --git a/admin/addnews.php b/admin/addnews.php
new file mode 100644
index 0000000..c39195f
--- /dev/null
+++ b/admin/addnews.php
@@ -0,0 +1,320 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * addnews.php
+ * Began: Wed December 25 2002
+ *
+ * $Id: addnews.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class Add_News extends EQdkp_Admin
+{
+ var $news = array(); // Holds news data if URI_NEWS is set @var news
+ var $old_news = array(); // Holds news data from before POST @var old_news
+
+ function add_news()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ $this->news = array(
+ 'news_headline' => post_or_db('news_headline'),
+ 'news_message' => post_or_db('news_message')
+ );
+
+ // Vars used to confirm deletion
+ $this->set_vars(array(
+ 'confirm_text' => $user->lang['confirm_delete_news'],
+ 'uri_parameter' => URI_NEWS)
+ );
+
+ $this->assoc_buttons(array(
+ 'add' => array(
+ 'name' => 'add',
+ 'process' => 'process_add',
+ 'check' => 'a_news_add'),
+ 'update' => array(
+ 'name' => 'update',
+ 'process' => 'process_update',
+ 'check' => 'a_news_upd'),
+ 'delete' => array(
+ 'name' => 'delete',
+ 'process' => 'process_delete',
+ 'check' => 'a_news_del'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_news_'))
+ );
+
+ // Build the news array
+ // ---------------------------------------------------------
+ if ( $this->url_id )
+ {
+ $sql = 'SELECT news_headline, news_message
+ FROM ' . NEWS_TABLE . "
+ WHERE news_id='" . $this->url_id . "'";
+ $result = $db->query($sql);
+ if ( !$row = $db->fetch_record($result) )
+ {
+ message_die($user->lang['error_invalid_news_provided']);
+ }
+ $db->free_result($result);
+
+ $this->time = time();
+ $this->news = array(
+ 'news_headline' => post_or_db('news_headline', $row),
+ 'news_message' => post_or_db('news_message', $row)
+ );
+ }
+ }
+
+ function error_check()
+ {
+ global $user;
+
+ $this->fv->is_filled(array(
+ 'news_headline' => $user->lang['fv_required_headline'],
+ 'news_message' => $user->lang['fv_required_message'])
+ );
+
+ return $this->fv->is_error();
+ }
+
+ // ---------------------------------------------------------
+ // Process Add
+ // ---------------------------------------------------------
+ function process_add()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ //
+ // Insert the news
+ //
+ $query = $db->build_query('INSERT', array(
+ 'news_headline' => stripslashes($_POST['news_headline']),
+ 'news_message' => stripslashes($_POST['news_message']),
+ 'news_date' => $this->time,
+ 'user_id' => $user->data['user_id'])
+ );
+ $db->query('INSERT INTO ' . NEWS_TABLE . $query);
+ $this_news_id = $db->insert_id();
+
+ //
+ // Logging
+ //
+ $log_action = array(
+ 'header' => '{L_ACTION_NEWS_ADDED}',
+ 'id' => $this_news_id,
+ '{L_HEADLINE}' => $_POST['news_headline'],
+ '{L_MESSAGE_BODY}' => nl2br($_POST['news_message']),
+ '{L_ADDED_BY}' => $this->admin_user);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success message
+ //
+ $success_message = $user->lang['admin_add_news_success'];
+ $link_list = array(
+ $user->lang['add_news'] => 'addnews.php' . $SID,
+ $user->lang['list_news'] => 'listnews.php' . $SID);
+ $this->admin_die($success_message, $link_list);
+ }
+
+ // ---------------------------------------------------------
+ // Process Update
+ // ---------------------------------------------------------
+ function process_update()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ //
+ // Get the old data
+ //
+ $this->get_old_data();
+
+ //
+ // Update the news table
+ //
+ if ( isset($_POST['update_date']) )
+ {
+ $query = $db->build_query('UPDATE', array(
+ 'news_headline' => stripslashes($_POST['news_headline']),
+ 'news_message' => stripslashes($_POST['news_message']),
+ 'news_date' => $this->time)
+ );
+ }
+ else
+ {
+ $query = $db->build_query('UPDATE', array(
+ 'news_headline' => stripslashes($_POST['news_headline']),
+ 'news_message' => stripslashes($_POST['news_message']))
+ );
+ }
+ $db->query('UPDATE ' . NEWS_TABLE . ' SET ' . $query . " WHERE news_id='" . $this->url_id . "'");
+
+ //
+ // Logging
+ //
+ $log_action = array(
+ 'header' => '{L_ACTION_NEWS_UPDATED}',
+ 'id' => $this->url_id,
+ '{L_HEADLINE_BEFORE}' => $this->old_news['news_headline'],
+ '{L_MESSAGE_BEFORE}' => nl2br($this->old_news['news_message']),
+ '{L_HEADLINE_AFTER}' => $this->find_difference($this->old_news['news_headline'], $_POST['news_headline']),
+ '{L_MESSAGE_AFTER}' => nl2br($_POST['news_message']),
+ '{L_UPDATED_BY}' => $this->admin_user);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success message
+ //
+ $success_message = $user->lang['admin_update_news_success'];
+ $link_list = array(
+ $user->lang['add_news'] => 'addnews.php' . $SID,
+ $user->lang['list_news'] => 'listnews.php' . $SID);
+ $this->admin_die($success_message, $link_list);
+ }
+
+ // ---------------------------------------------------------
+ // Process Delete (confirmed)
+ // ---------------------------------------------------------
+ function process_confirm()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ //
+ // Get the old data
+ //
+ $this->get_old_data();
+
+ //
+ // Remove the news entry
+ //
+ $sql = 'DELETE FROM ' . NEWS_TABLE . "
+ WHERE news_id='" . $this->url_id . "'";
+ $db->query($sql);
+
+ //
+ // Logging
+ //
+ $log_action = array(
+ 'header' => '{L_ACTION_NEWS_DELETED}',
+ 'id' => $this->url_id,
+ '{L_HEADLINE}' => $this->old_news['news_headline'],
+ '{L_MESSAGE_BODY}' => nl2br($this->old_news['news_message']));
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success message
+ //
+ $success_message = $user->lang['admin_delete_news_success'];
+ $link_list = array(
+ $user->lang['add_news'] => 'addnews.php' . $SID,
+ $user->lang['list_news'] => 'listnews.php' . $SID);
+ $this->admin_die($success_message, $link_list);
+ }
+
+ // ---------------------------------------------------------
+ // Process helper methods
+ // ---------------------------------------------------------
+ function get_old_data()
+ {
+ global $db;
+
+ $sql = 'SELECT news_headline, news_message
+ FROM ' . NEWS_TABLE . "
+ WHERE news_id='" . $this->url_id . "'";
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $this->old_news = array(
+ 'news_headline' => addslashes($row['news_headline']),
+ 'news_message' => addslashes($row['news_message'])
+ );
+ }
+ $db->free_result($result);
+ }
+
+ // ---------------------------------------------------------
+ // Display form
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $tpl->assign_vars(array(
+ // Form vars
+ 'F_ADD_NEWS' => 'addnews.php' . $SID,
+ 'NEWS_ID' => $this->url_id,
+ 'S_UPDATE' => ( $this->url_id ) ? true : false,
+
+ // Form values
+ 'HEADLINE' => stripslashes(htmlspecialchars($this->news['news_headline'])),
+ 'MESSAGE' => stripmultslashes($this->news['news_message']),
+
+ // Language (General)
+ 'L_HEADLINE' => $user->lang['headline'],
+ 'L_MESSAGE_BODY' => $user->lang['message_body'],
+ 'L_ADD_NEWS' => $user->lang['add_news'],
+ 'L_RESET' => $user->lang['reset'],
+ 'L_UPDATE_NEWS' => $user->lang['update_news'],
+ 'L_DELETE_NEWS' => $user->lang['delete_news'],
+ 'L_UPDATE_DATE_TO' => sprintf($user->lang['update_date_to'], date('m/d/y h:ia T', time())),
+
+ // Language (Help messages)
+ 'L_B_HELP' => $user->lang['b_help'],
+ 'L_I_HELP' => $user->lang['i_help'],
+ 'L_U_HELP' => $user->lang['u_help'],
+ 'L_Q_HELP' => $user->lang['q_help'],
+ 'L_C_HELP' => $user->lang['c_help'],
+ 'L_P_HELP' => $user->lang['p_help'],
+ 'L_W_HELP' => $user->lang['w_help'],
+
+ // Form validation
+ 'FV_HEADLINE' => $this->fv->generate_error('news_headline'),
+ 'FV_MESSAGE' => $this->fv->generate_error('news_message'),
+
+ // Javascript messages
+ 'MSG_HEADLINE_EMPTY' => $user->lang['fv_required_headline'],
+ 'MSG_MESSAGE_EMPTY' => $user->lang['fv_required_message'],
+
+ // Buttons
+ 'S_ADD' => ( !$this->url_id ) ? true : false)
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['addnews_title'],
+ 'template_file' => 'admin/addnews.html',
+ 'display' => true)
+ );
+ }
+}
+
+$add_news = new Add_News;
+$add_news->process();
+?>
diff --git a/admin/addraid.php b/admin/addraid.php
new file mode 100644
index 0000000..46f4a06
--- /dev/null
+++ b/admin/addraid.php
@@ -0,0 +1,1303 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * addraid.php
+ * Began: Mon December 23 2002
+ *
+ * $Id: addraid.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class Add_Raid extends EQdkp_Admin
+{
+ var $raid = array(); // Holds raid data if URI_RAID is set @var raid
+ var $old_raid = array(); // Holds raid data from before POST @var old_raid
+
+ function add_raid()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ $this->raid = array(
+ 'raid_date' => ( !$this->url_id ) ? $this->time : '',
+ 'raid_attendees' => post_or_db('raid_attendees'),
+ 'raid_name' => post_or_db('raid_name'),
+ 'raid_note' => post_or_db('raid_note'),
+ 'raid_value' => post_or_db('raid_value')
+ );
+
+ // Vars used to confirm deletion
+ $this->set_vars(array(
+ 'confirm_text' => $user->lang['confirm_delete_raid'],
+ 'uri_parameter' => URI_RAID)
+ );
+
+ $this->assoc_buttons(array(
+ 'add' => array(
+ 'name' => 'add',
+ 'process' => 'process_add',
+ 'check' => 'a_raid_add'),
+ 'update' => array(
+ 'name' => 'update',
+ 'process' => 'process_update',
+ 'check' => 'a_raid_upd'),
+ 'delete' => array(
+ 'name' => 'delete',
+ 'process' => 'process_delete',
+ 'check' => 'a_raid_del'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_raid_'))
+ );
+
+ // Build the raid array
+ // ---------------------------------------------------------
+ if ( $this->url_id )
+ {
+ $sql = 'SELECT raid_id, raid_name, raid_date, raid_note, raid_value
+ FROM ' . RAIDS_TABLE . "
+ WHERE raid_id='" . $this->url_id . "'";
+ $result = $db->query($sql);
+ if ( !$row = $db->fetch_record($result) )
+ {
+ message_die($user->lang['error_invalid_raid_provided']);
+ }
+ $db->free_result($result);
+
+ $this->time = $row['raid_date'];
+ $this->raid = array(
+ 'raid_name' => post_or_db('raid_name', $row),
+ 'raid_note' => post_or_db('raid_note', $row),
+ 'raid_value' => post_or_db('raid_value', $row)
+ );
+
+ $attendees = array();
+ $sql = 'SELECT member_name
+ FROM ' . RAID_ATTENDEES_TABLE . "
+ WHERE raid_id='" . $this->url_id . "'
+ ORDER BY member_name";
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $attendees[] = $row['member_name'];
+ }
+ $this->raid['raid_attendees'] = ( !empty($_POST['raid_attendees']) ) ? $_POST['raid_attendees'] : implode(',', $attendees);
+ unset($attendees);
+ }
+ }
+
+ function error_check()
+ {
+ global $user;
+
+ setlocale(LC_ALL, 'de_DE');
+ $this->fv->is_alpha('raid_attendees', $user->lang['fv_alpha_attendees']);
+ $this->fv->is_filled('raid_attendees', $user->lang['fv_required_attendees']);
+
+ $this->fv->is_within_range('mo', 1, 12, $user->lang['fv_range_month']);
+ $this->fv->is_within_range('d', 1, 31, $user->lang['fv_range_day']);
+ $this->fv->is_within_range('y', 1998, 2090, $user->lang['fv_range_year']); // How ambitious
+ $this->fv->is_within_range('h', 0, 23, $user->lang['fv_range_hour']);
+ $this->fv->is_within_range('mi', 0, 59, $user->lang['fv_range_minute']);
+ $this->fv->is_within_range('s', 0, 59, $user->lang['fv_range_second']);
+
+ if ( !empty($_POST['raid_value']) )
+ {
+ $this->fv->is_number('raid_value', $user->lang['fv_number_value']);
+ }
+
+ if ( (@empty($_POST['raid_name'])) || (@sizeof($_POST['raid_name']) == 0) )
+ {
+ $this->fv->errors['raid_name'] = $user->lang['fv_required_event_name'];
+ }
+
+ $this->time = mktime($_POST['h'], $_POST['mi'], $_POST['s'], $_POST['mo'], $_POST['d'], $_POST['y']);
+
+ return $this->fv->is_error();
+ }
+
+ // ---------------------------------------------------------
+ // Process Add
+ // ---------------------------------------------------------
+ function process_add()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $success_message = '';
+
+ //
+ // Raid loop for multiple events
+ //
+ foreach ( $_POST['raid_name'] as $raid_name )
+ {
+ //
+ // Get the raid value
+ //
+ $raid_value = $this->get_raid_value($raid_name);
+
+ //
+ // Insert the raid
+ //
+ $query = $db->build_query('INSERT', array(
+ 'raid_name' => stripslashes($raid_name),
+ 'raid_date' => $this->time,
+ 'raid_note' => stripslashes($_POST['raid_note']),
+ 'raid_value' => $raid_value,
+ 'raid_added_by' => $this->admin_user)
+ );
+ $db->query('INSERT INTO ' . RAIDS_TABLE . $query);
+ $this_raid_id = $db->insert_id();
+
+ //
+ // Attendee handling
+ //
+ // Make sure that each member's name is properly capitalized
+ $raid_attendees = strtolower(preg_replace('/[[:space:]]/i', ' ', $_POST['raid_attendees']));
+ $raid_attendees = ucwords($raid_attendees);
+
+ // Make the array unique and sort it by name
+ $members_array = explode(' ', $raid_attendees);
+ $members_array = array_unique($members_array);
+ sort($members_array);
+ reset($members_array);
+
+ //
+ // Handle members
+ //
+ $this->handle_members($members_array, $raid_value, 'process_add');
+
+ //
+ // Insert the attendees
+ //
+ // Get rid of the 'blank' member bug
+ $raid_attendees = implode(',', $members_array);
+ $raid_attendees = preg_replace('/^\,(.+)/', '\1', $raid_attendees);
+ $members_array = explode(',', $raid_attendees);
+ $this->add_attendees($members_array, $this_raid_id);
+
+ //
+ // Call plugin add hooks
+ //
+ $pm->do_hooks('/admin/addraid.php?action=add');
+
+ //
+ // Logging
+ //
+ $log_action = array(
+ 'header' => '{L_ACTION_RAID_ADDED}',
+ 'id' => $this_raid_id,
+ '{L_EVENT}' => $raid_name,
+ '{L_ATTENDEES}' => implode(', ', $members_array),
+ '{L_NOTE}' => $_POST['raid_note'],
+ '{L_VALUE}' => $raid_value,
+ '{L_ADDED_BY}' => $this->admin_user);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Append success message
+ //
+ $success_message .= sprintf($user->lang['admin_add_raid_success'], $_POST['mo'], $_POST['d'], $_POST['y'], $raid_name) . '<br />';
+
+ unset($raid_value, $raid_name);
+ } // Raid loop
+
+ //
+ // Update player status if needed
+ //
+ if ( $eqdkp->config['hide_inactive'] == 1 )
+ {
+ $success_message .= '<br /><br />' . $user->lang['admin_raid_success_hideinactive'];
+ $success_message .= ' ' . (( $this->update_player_status() ) ? strtolower($user->lang['done']) : strtolower($user->lang['error']));
+ }
+
+ //
+ // Success message
+ //
+ $link_list = array(
+ $user->lang['add_items_from_raid'] => 'additem.php' . $SID . '&amp;raid_id=' . $this_raid_id,
+ $user->lang['add_raid'] => 'addraid.php' . $SID,
+ $user->lang['list_raids'] => 'listraids.php' . $SID);
+ $this->admin_die($success_message, $link_list);
+
+ }
+
+ // ---------------------------------------------------------
+ // Process Update
+ // ---------------------------------------------------------
+ function process_update()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ //
+ // Get the old data
+ //
+ $this->get_old_data();
+
+ //
+ // Remove the attendees from the old raid
+ //
+ $db->query('DELETE FROM ' . RAID_ATTENDEES_TABLE . " WHERE raid_id='" . $this->url_id . "'");
+
+ //
+ // Get the raid value
+ //
+ $raid_value = $this->get_raid_value($_POST['raid_name']);
+
+ //
+ // Remove the value of the old raid from the attendees' earned
+ //
+ $sql = 'UPDATE ' . MEMBERS_TABLE . "
+ SET member_earned = member_earned - " . $this->old_raid['raid_value'] . ",
+ member_raidcount = member_raidcount - 1
+ WHERE member_name IN ('" . str_replace(',', "', '", $this->old_raid['raid_attendees']) . '\')';
+ $db->query($sql);
+
+ //
+ // Update the raid
+ //
+ $query = $db->build_query('UPDATE', array(
+ 'raid_date' => $this->time,
+ 'raid_note' => stripslashes($_POST['raid_note']),
+ 'raid_value' => $raid_value,
+ 'raid_name' => stripslashes($_POST['raid_name']),
+ 'raid_updated_by' => $this->admin_user)
+ );
+ $db->query('UPDATE ' . RAIDS_TABLE . ' SET ' . $query . " WHERE raid_id='" . $this->url_id . "'");
+
+ //
+ // Add the new, updated raid to attendees' earned
+ //
+ $raid_attendees = strtolower(preg_replace('/[[:space:]]/i', ' ', $_POST['raid_attendees']));
+ $raid_attendees = ucwords($raid_attendees);
+
+ $n_members_array = explode(' ', $raid_attendees);
+ $n_members_array = array_unique($n_members_array);
+ sort($n_members_array);
+ reset($n_members_array);
+
+ //
+ // Handle members
+ //
+ $this->handle_members($n_members_array, $raid_value, 'process_update');
+
+ //
+ // Insert the attendees
+ //
+ // Get rid of the 'blank' member bug
+ $raid_attendees = implode(',', $n_members_array);
+ $raid_attendees = preg_replace('/^\,(.+)/', '\1', $raid_attendees);
+ $n_members_array = explode(',', $raid_attendees);
+ $this->add_attendees($n_members_array, $this->url_id);
+
+ //
+ // Update firstraid / lastraid [ #749201 ]
+ //
+ $update_firstraid = array(); // Members who need their firstraid updated
+ $update_lastraid = array(); // Members who need their lastraid updated
+
+ $sql = 'SELECT member_name, member_firstraid, member_lastraid, member_raidcount
+ FROM ' . MEMBERS_TABLE . "
+ WHERE member_name IN ('" . str_replace(',', "', '", $this->old_raid['raid_attendees']) . '\')';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ // If the raid's date changed...
+ if ( $this->time != $this->old_raid['raid_date'] )
+ {
+ // If the raid's old date is their firstraid, update their firstraid
+ if ( $row['member_firstraid'] == $this->old_raid['raid_date'] )
+ {
+ $update_firstraid[] = $row['member_name'];
+ }
+
+ // If the raid's old date is their lastraid, update their lastraid
+ if ( $row['member_lastraid'] == $this->old_raid['raid_date'] )
+ {
+ $update_lastraid[] = $row['member_name'];
+ }
+ }
+ }
+ $db->free_result($result);
+
+ // Find members who were deleted from this raid and revert their first/last
+ $old_attendees = explode(',', $this->old_raid['raid_attendees']);
+ foreach ( $old_attendees as $member_name )
+ {
+ if ( !in_array($member_name, $n_members_array) )
+ {
+ $update_firstraid[] = $member_name;
+ $update_lastraid[] = $member_name;
+ }
+ }
+ $update_firstraid = array_unique($update_firstraid);
+ $update_lastraid = array_unique($update_lastraid);
+
+ sort($update_firstraid);
+ sort($update_lastraid);
+
+ reset($update_firstraid);
+ reset($update_lastraid);
+
+ $queries = array();
+ // Update selected firstraids if needed
+ if ( sizeof($update_firstraid) > 0 )
+ {
+ $sql = 'SELECT MIN(r.raid_date) AS member_firstraid, ra.member_name
+ FROM ' . RAIDS_TABLE . ' r, ' . RAID_ATTENDEES_TABLE . " ra
+ WHERE ra.raid_id = r.raid_id
+ AND ra.member_name IN ('" . implode("', '", $update_firstraid) . '\')
+ AND r.raid_date > 0
+ GROUP BY ra.member_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $queries[] = 'UPDATE ' . MEMBERS_TABLE . "
+ SET member_firstraid = '" . $row['member_firstraid'] . "'
+ WHERE member_name = '" . $row['member_name'] . "'";
+ }
+ $db->free_result($result);
+ }
+ // Updated selected lastraids if needed
+ if ( sizeof($update_lastraid) > 0 )
+ {
+ $sql = 'SELECT MAX(r.raid_date) AS member_lastraid, ra.member_name
+ FROM ' . RAIDS_TABLE . ' r, ' . RAID_ATTENDEES_TABLE . " ra
+ WHERE ra.raid_id = r.raid_id
+ AND ra.member_name IN ('" . implode("', '", $update_lastraid) . '\')
+ AND r.raid_date > 0
+ GROUP BY ra.member_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $queries[] = 'UPDATE ' . MEMBERS_TABLE . "
+ SET member_lastraid = '" . $row['member_lastraid'] . "'
+ WHERE member_name = '" . $row['member_name'] . "'";
+ }
+ $db->free_result($result);
+ }
+ foreach ( $queries as $sql )
+ {
+ $db->query($sql);
+ }
+ unset($queries, $sql);
+
+ //
+ // Call plugin update hooks
+ //
+ $pm->do_hooks('/admin/addraid.php?action=update');
+
+ //
+ // Logging
+ //
+ $old_attendees_array = explode(',', $this->old_raid['raid_attendees']);
+ $new_attendees_array = $n_members_array;
+
+ $log_action = array(
+ 'header' => '{L_ACTION_RAID_UPDATED}',
+ 'id' => $this->url_id,
+ '{L_EVENT_BEFORE}' => $this->old_raid['raid_name'],
+ '{L_ATTENDEES_BEFORE}' => implode(', ', $this->find_difference($new_attendees_array, $old_attendees_array)),
+ '{L_NOTE_BEFORE}' => $this->old_raid['raid_note'],
+ '{L_VALUE_BEFORE}' => $this->old_raid['raid_value'],
+ '{L_EVENT_AFTER}' => $this->find_difference($this->old_raid['raid_name'], $_POST['raid_name']),
+ '{L_ATTENDEES_AFTER}' => implode(', ', $this->find_difference($old_attendees_array, $new_attendees_array)),
+ '{L_NOTE_AFTER}' => $this->find_difference($this->old_raid['raid_note'], $_POST['raid_note']),
+ '{L_VALUE_AFTER}' => $this->find_difference($this->old_raid['raid_value'], $raid_value),
+ '{L_UPDATED_BY}' => $this->admin_user);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success message
+ //
+ $success_message = sprintf($user->lang['admin_update_raid_success'], $_POST['mo'], $_POST['d'], $_POST['y'], $_POST['raid_name']);
+
+ // Update player status if needed
+ if ( $eqdkp->config['hide_inactive'] == 1 )
+ {
+ $success_message .= '<br /><br />' . $user->lang['admin_raid_success_hideinactive'];
+ $success_message .= ' ' . (( $this->update_player_status() ) ? strtolower($user->lang['done']) : strtolower($user->lang['error']));
+ }
+
+ $link_list = array(
+ $user->lang['add_items_from_raid'] => 'additem.php' . $SID . '&amp;raid_id=' . $this->url_id,
+ $user->lang['add_raid'] => 'addraid.php' . $SID,
+ $user->lang['list_raids'] => 'listraids.php' . $SID);
+ $this->admin_die($success_message, $link_list);
+
+ }
+
+ // ---------------------------------------------------------
+ // Process Delete (confirmed)
+ // ---------------------------------------------------------
+ function process_confirm()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ //
+ // Get the old data
+ //
+ $this->get_old_data();
+
+ //
+ // Take the value away from the attendees
+ //
+ $sql = 'UPDATE ' . MEMBERS_TABLE . "
+ SET member_earned = member_earned - " . $this->old_raid['raid_value'] . ",
+ member_raidcount = member_raidcount - 1
+ WHERE member_name IN ('" . str_replace(',', "', '", $this->old_raid['raid_attendees']) . '\')';
+ $db->query($sql);
+
+ //
+ // Remove cost of items from this raid from buyers
+ //
+ $sql = 'SELECT item_id, item_buyer, item_value
+ FROM ' . ITEMS_TABLE . "
+ WHERE raid_id='" . $this->url_id . "'";
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $item_value = ( !empty($row['item_value']) ) ? $row['item_value'] : '0.00';
+ $sql = 'UPDATE ' . MEMBERS_TABLE . "
+ SET member_spent = member_spent - " . $item_value . "
+ WHERE member_name='" . $row['item_buyer'] . "'";
+ $db->query($sql);
+ }
+ $db->free_result($result);
+
+ //
+ // Delete associated items
+ //
+ $db->query('DELETE FROM ' . ITEMS_TABLE . " WHERE raid_id='" . $this->url_id . "'");
+
+ //
+ // Delete attendees
+ //
+ $db->query('DELETE FROM ' . RAID_ATTENDEES_TABLE . " WHERE raid_id='" . $this->url_id . "'");
+
+ //
+ // Remove the raid itself
+ //
+ $db->query('DELETE FROM ' . RAIDS_TABLE . " WHERE raid_id='" . $this->url_id . "'");
+
+ //
+ // Update firstraid / lastraid [ #749201 ]
+ //
+ $update_firstraid = array(); // Members who need their firstraid updated
+ $update_lastraid = array(); // Members who need their lastraid updated
+ $zero_firstlast = array(); // Members who only attended one raid: this one - reset their first/last raid
+
+ $sql = 'SELECT member_name, member_firstraid, member_lastraid, member_raidcount
+ FROM ' . MEMBERS_TABLE . "
+ WHERE member_name IN ('" . str_replace(',', "', '", $this->old_raid['raid_attendees']) . '\')';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ // We already updated their raidcount to reflect this deleted raid; so if it's 0, this was their only raid
+ if ( $row['member_raidcount'] == '0' )
+ {
+ $zero_firstlast[] = $row['member_name'];
+ }
+ else
+ {
+ // If the raid's old date is their firstraid, update their firstraid
+ if ( $row['member_firstraid'] == $this->old_raid['raid_date'] )
+ {
+ $update_firstraid[] = $row['member_name'];
+ }
+
+ // If the raid's old date is their lastraid, update their lastraid
+ if ( $row['member_lastraid'] == $this->old_raid['raid_date'] )
+ {
+ $update_lastraid[] = $row['member_name'];
+ }
+ }
+ }
+ $db->free_result($result);
+
+ // Zero the first/last raids if this was their only raid
+ if ( sizeof($zero_firstlast) > 0 )
+ {
+ $sql = 'UPDATE ' . MEMBERS_TABLE . "
+ SET member_firstraid = 0,
+ member_lastraid = 0
+ WHERE member_name IN ('" . implode("', '", $zero_firstlast) . '\')';
+ $db->query($sql);
+ }
+
+ $queries = array();
+ // Update selected firstraids if needed
+ if ( sizeof($update_firstraid) > 0 )
+ {
+ $sql = 'SELECT MIN(r.raid_date) AS member_firstraid, ra.member_name
+ FROM ' . RAIDS_TABLE . ' r, ' . RAID_ATTENDEES_TABLE . " ra
+ WHERE ra.raid_id = r.raid_id
+ AND ra.member_name IN ('" . implode("', '", $update_firstraid) . '\')
+ AND r.raid_date > 0
+ GROUP BY ra.member_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $queries[] = 'UPDATE ' . MEMBERS_TABLE . "
+ SET member_firstraid = '" . $row['member_firstraid'] . "'
+ WHERE member_name = '" . $row['member_name'] . "'";
+ }
+ $db->free_result($result);
+ }
+ // Updated selected lastraids if needed
+ if ( sizeof($update_lastraid) > 0 )
+ {
+ $sql = 'SELECT MAX(r.raid_date) AS member_lastraid, ra.member_name
+ FROM ' . RAIDS_TABLE . ' r, ' . RAID_ATTENDEES_TABLE . " ra
+ WHERE ra.raid_id = r.raid_id
+ AND ra.member_name IN ('" . implode("', '", $update_lastraid) . '\')
+ AND r.raid_date > 0
+ GROUP BY ra.member_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $queries[] = 'UPDATE ' . MEMBERS_TABLE . "
+ SET member_lastraid = '" . $row['member_lastraid'] . "'
+ WHERE member_name = '" . $row['member_name'] . "'";
+ }
+ $db->free_result($result);
+ }
+ foreach ( $queries as $sql )
+ {
+ $db->query($sql);
+ }
+ unset($queries, $sql);
+
+ //
+ // Call plugin delete hooks
+ //
+ $pm->do_hooks('/admin/addraid.php?action=delete');
+
+ //
+ // Logging
+ //
+ $log_action = array(
+ 'header' => '{L_ACTION_RAID_DELETED}',
+ 'id' => $this->url_id,
+ '{L_EVENT}' => $this->old_raid['raid_name'],
+ '{L_ATTENDEES}' => str_replace(',', ', ', $this->old_raid['raid_attendees']),
+ '{L_NOTE}' => $this->old_raid['raid_note'],
+ '{L_VALUE}' => $this->old_raid['raid_value']);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success message
+ //
+ $success_message = $user->lang['admin_delete_raid_success'];
+
+ // Update player status if needed
+ if ( $eqdkp->config['hide_inactive'] == 1 )
+ {
+ $success_message .= '<br /><br />' . $user->lang['admin_raid_success_hideinactive'];
+ $success_message .= ' ' . (( $this->update_player_status() ) ? strtolower($user->lang['done']) : strtolower($user->lang['error']));
+ }
+
+ $link_list = array(
+ $user->lang['add_raid'] => 'addraid.php' . $SID,
+ $user->lang['list_raids'] => 'listraids.php' . $SID);
+ $this->admin_die($success_message, $link_list);
+ }
+
+ // ---------------------------------------------------------
+ // Process helper methods
+ // ---------------------------------------------------------
+ /**
+ * Populate the old_raid array
+ */
+ function get_old_data()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $sql = 'SELECT raid_name, raid_value, raid_note, raid_date
+ FROM ' . RAIDS_TABLE . "
+ WHERE raid_id='" . $this->url_id . "'";
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $this->old_raid = array(
+ 'raid_name' => addslashes($row['raid_name']),
+ 'raid_value' => addslashes($row['raid_value']),
+ 'raid_note' => addslashes($row['raid_note']),
+ 'raid_date' => addslashes($row['raid_date'])
+ );
+ }
+ $db->free_result($result);
+
+ $sql = 'SELECT r.member_name
+ FROM ' . RAID_ATTENDEES_TABLE . " r, " . MEMBERS_TABLE . " m
+ WHERE m.member_name = r.member_name AND raid_id='" . $this->url_id . "'
+ ORDER BY member_name";
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $attendees[] = $row['member_name'];
+ }
+ $this->old_raid['raid_attendees'] = @implode(',', $attendees);
+ unset($attendees);
+ }
+
+ /**
+ * Determine this raid's value
+ *
+ * @param $raid_name
+ * @return string Raid value
+ */
+ function get_raid_value($raid_name)
+ {
+ global $db;
+
+ // Check if they entered a one-time value; Get the preset value of the raid(s) if not
+ if ( empty($_POST['raid_value']) )
+ {
+ $raid_value = $db->query_first('SELECT event_value FROM ' . EVENTS_TABLE . " WHERE event_name='" . addslashes($raid_name) . "'");
+
+ if (!isset($raid_value)) {
+ $raid_value = 0;
+ }
+
+ }
+ else
+ {
+ $raid_value = $_POST['raid_value'];
+ }
+
+ // Still no post value?
+ if ( empty($raid_value) )
+ {
+ $raid_value = '0.00';
+ }
+
+ return $raid_value;
+ }
+
+ /**
+ * Get member level/race/class from database or SESSION data
+ *
+ * @param $member_name
+ * @return Array
+ */
+ function get_member_info($member_name)
+ {
+ global $db, $eqdkp;
+
+ if ($_SESSION[$member_name]['class'] == "") {
+ unset($_SESSION[$member_name]['class']);
+ }
+
+ if ($_SESSION[$member_name]['level'] == "") {
+ unset($_SESSION[$member_name]['level']);
+ }
+
+ if ($_SESSION[$member_name]['race'] == "") {
+ unset($_SESSION[$member_name]['race']);
+ }
+
+ if ( isset($_SESSION[$member_name]['level']) && isset($_SESSION[$member_name]['class']) ) {
+
+ $sql = "SELECT race_name FROM " . RACE_TABLE . " WHERE race_name = '" . $_SESSION[$member_name]['race'] . "'";
+ $race_name = $db->query_first($sql);
+
+ if (!isset($race_name)) {
+ $race_name = "Unknown";
+ }
+
+ $retval = array(
+ 'name' => $_SESSION[$member_name],
+ 'level' => ( isset($_SESSION[$member_name]['level']) ) ? $_SESSION[$member_name]['level'] : false,
+ 'race' => $race_name,
+ 'class' => ( isset($_SESSION[$member_name]['class']) ) ? $_SESSION[$member_name]['class'] : false);
+
+ unset($_SESSION[$member_name]);
+
+
+ } else {
+
+
+ $sql = "SELECT member_name, member_race_id, member_class_id, member_level FROM " . MEMBERS_TABLE . "
+ WHERE member_name = '" . $member_name . "'";
+ $result = $db->query($sql);
+ $info = $db->fetch_record($result);
+
+ if (!isset($info['member_level'])) {
+ $member_level = "1";
+ }
+
+ $sql = "SELECT race_name FROM " . RACE_TABLE . " WHERE race_id = '" . $info['member_race_id'] . "'";
+ $race_name = $db->query_first($sql);
+
+ if (!isset($race_name)) {
+ $race_name = "Unknown";
+ }
+
+ $sql = "SELECT class_name FROM " . CLASS_TABLE . " WHERE class_id = '" . $info['member_class_id'] . "'";
+ $class_name = $db->query_first($sql);
+
+ if (!isset($class_name)) {
+ $class_name = "Unknown";
+ }
+
+ $retval = array(
+ 'name' => $member_name,
+ 'race' => $race_name,
+ 'level' => $member_level,
+ 'class' => $class_name);
+ }
+
+ return $retval;
+ }
+
+ /**
+ * Insert members into raid attendees table
+ *
+ * @param $members_array Array of members
+ * @param $raid_id
+ */
+ function add_attendees(&$members_array, $raid_id)
+ {
+ global $db;
+
+ $query = array();
+ foreach ( $members_array as $member_name )
+ {
+ $query[] = "($raid_id, '" . $member_name . "')";
+ }
+
+ $sql = 'INSERT INTO ' . RAID_ATTENDEES_TABLE . ' (raid_id, member_name)
+ VALUES ' . implode(', ', $query);
+ $db->query($sql);
+ }
+
+ /**
+ * Update existing members / add new members
+ *
+ * @param $members_array
+ * @param $raid_value
+ * @param $time_check
+ */
+ function handle_members(&$members_array, $raid_value, $process)
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ // Grab our array of name => class/level/race
+ session_start();
+
+ //
+ // Handle existing members
+ //
+ $update_sql_members = array();
+ $updated_members = array();
+ $raid_attendees = array();
+
+ $sql = 'SELECT m.member_name, m.member_firstraid, m.member_lastraid, m.member_level, r.race_name AS member_race,
+ c.class_name AS member_class, m.member_raidcount
+ FROM ' . MEMBERS_TABLE .' m, '. CLASS_TABLE .' c, '.RACE_TABLE.' r
+ WHERE r.race_id = m.member_race_id
+ AND c.class_id = m.member_class_id';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $member_name = trim(str_replace(' ', '', $row['member_name']));
+
+ // Make sure the member is in the attendees list before proceeding
+ if ( (!in_array($member_name, $members_array)) || (empty($member_name)) )
+ {
+ continue;
+ }
+
+ $raid_attendees[] = $member_name;
+
+ // raidcount and/or firstraid is 0 - they exist but we need to set their firstraid to this date [ #705206 ]
+ if ( ($row['member_raidcount'] == '0') || ($row['member_firstraid'] == '0') )
+ {
+ $sql = 'UPDATE ' . MEMBERS_TABLE . '
+ SET member_earned = member_earned + ' . $raid_value . ",
+ member_firstraid = '" . $this->time . "',
+ member_lastraid = '" . $this->time . "',
+ member_raidcount = member_raidcount + 1
+ WHERE member_name = '" . $member_name . "'";
+ $db->query($sql);
+
+ $updated_members[] = $member_name;
+ continue;
+ }
+ else
+ {
+ $updated_members[] = $member_name;
+ }
+
+ // Check for race/class/level data for this member
+ $member_data = $this->get_member_info($member_name);
+
+ if ( (!(isset($member_data['race']) )) || $member_data['race'] == 'Unknown' )
+ {
+ $member_data['race'] = $row['member_race'];
+ }
+
+ if ( (!(isset($member_data['class']) )) || $member_data['class'] == 'Unknown' )
+ {
+ $member_data['class'] = $row['member_class'];
+ }
+
+ $member_level = ( is_numeric($member_data['level']) ) ? trim($member_data['level']) : 'member_level';
+ $member_race = ( is_string($member_data['race']) ) ? trim($member_data['race']) : 'member_race';
+ $member_class = ( is_string($member_data['class']) ) ? trim($member_data['class']) : 'member_class';
+ unset($member_data);
+
+ // Update this member's race/class/level if they changed
+ $time_check = ( $process == 'process_add' ) ? ($this->time > $row['member_lastraid']) : ($this->time <= $row['member_lastraid']);
+ $level_check = ( ($member_level != $row['member_level']) && ($member_level != 'member_level') ) ? true : false;
+ $race_check = ( ($member_race != $row['member_race']) && ($member_race != 'member_race') ) ? true : false;
+ $class_check = ( ($member_class != $row['member_class']) && ($member_class != 'member_class') ) ? true : false;
+
+ if ( ($time_check) && ($level_check || $race_check || $class_check) )
+ {
+ // For comparison, quotes need to be added after the if statement above
+ $member_level = ( $member_level != 'member_level' ) ? '\'' . $member_level . '\'' : $member_level;
+ $member_race = ( $member_race != 'member_race' ) ? '\'' . $member_race . '\'' : $member_race;
+ $member_class = ( $member_class != 'member_class' ) ? '\'' . $member_class . '\'' : $member_class;
+
+
+ // Process the update
+ $sql = 'UPDATE ' . MEMBERS_TABLE . ' m, ' . CLASS_TABLE . ' c, ' . RACE_TABLE . ' r
+ SET m.member_earned = m.member_earned + ' . $raid_value . ',';
+
+ // Do not update their lastraid if it's greater than this raid's date [ #749201 ]
+ if ( $row['member_lastraid'] < $this->time )
+ {
+ $sql .= "m.member_lastraid = '" . $this->time . "',";
+ }
+
+ $sql .= ' m.member_raidcount = m.member_raidcount + 1,
+ m.member_level = ' . $member_level . ',
+ m.member_race_id = r.race_id,
+ m.member_class_id = c.class_id
+ WHERE r.race_name = '.$member_race.'
+ AND c.class_name = '.$member_class.'
+ AND m.member_name = "' . $member_name . '"';
+ $db->query($sql);
+ }
+ // If they didn't, their update is lumped into $update_sql (below)
+ else
+ {
+ $update_sql_members[] = $member_name;
+ }
+ }
+ $db->free_result($result);
+ session_destroy();
+
+ // Run the lump update if we need to
+ if ( sizeof($update_sql_members) > 0 )
+ {
+ $sql = 'UPDATE ' . MEMBERS_TABLE . '
+ SET member_raidcount = member_raidcount + 1,
+ member_earned = member_earned + ' . $raid_value . "
+ WHERE member_name IN ('" . implode("', '", $update_sql_members) . '\')';
+ $db->query($sql);
+ }
+
+ //
+ // Update firstraid / lastraid [ #749201 ]
+ //
+ $this->update_member_firstraid($raid_attendees, $this->time);
+ $this->update_member_lastraid($raid_attendees, $this->time);
+
+ //
+ // Handle new members
+ //
+ $new_members = array_diff($members_array, $updated_members);
+ foreach ( $new_members as $member_name )
+ {
+ $member_name = trim($member_name);
+ if ( $member_name != '' )
+ {
+ $member_data2 = $this->get_member_info($member_name);
+
+ $class = $member_data2['class'];
+ $race = $member_data2['race'];
+
+ if ( ! ( isset($class) ) || ($class == "") ) {
+ $class = "Unknown";
+ }
+
+
+ $class_id_number = $db->query_first('SELECT class_id FROM ' . CLASS_TABLE . ' WHERE class_name = "'.$class.'"');
+ $race_id_number = $db->query_first('SELECT race_id FROM ' . RACE_TABLE . ' WHERE race_name = "'.$race.'"');
+
+ if (!isset($race_id_number)) {
+ $race_id_number = 0;
+ }
+
+ if (!isset($class_id_number)) {
+ $class_id_number = 0;
+ }
+
+ $query = $db->build_query('INSERT', array(
+ 'member_name' => $member_name,
+ 'member_earned' => $raid_value,
+ 'member_status' => '1',
+ 'member_firstraid' => $this->time,
+ 'member_lastraid' => $this->time,
+ 'member_raidcount' => '1',
+ 'member_level' => $member_data2['level'],
+ 'member_race_id' => $race_id_number,
+ 'member_class_id' => $class_id_number,
+ 'member_rank_id' => '0')
+ );
+ $db->query('INSERT INTO ' . MEMBERS_TABLE . $query);
+ }
+ }
+
+ // For any member who has a 0 raidcount, reset their first/last raid to 0
+ $sql = 'UPDATE ' . MEMBERS_TABLE . "
+ SET member_firstraid = '0', member_lastraid='0'
+ WHERE member_raidcount='0'";
+ $db->query($sql);
+ }
+
+ /**
+ * Update members' firstraid
+ *
+ * @param array $members_array
+ * @param string $time_check Time to check
+ */
+ function update_member_firstraid(&$members_array, $time_check)
+ {
+ global $db;
+
+ if ( sizeof($members_array) > 0 )
+ {
+ $sql = 'UPDATE ' . MEMBERS_TABLE . "
+ SET member_firstraid = '" . $time_check . "'
+ WHERE member_name IN ('" . implode("', '", $members_array) . '\')
+ AND member_firstraid > ' . $time_check;
+ $db->query($sql);
+ }
+ }
+
+ /**
+ * Update members' lastraid
+ *
+ * @param array $members_array
+ * @param string $time_check Time to check
+ */
+ function update_member_lastraid(&$members_array, $time_check)
+ {
+ global $db;
+
+ if ( sizeof($members_array) > 0 )
+ {
+ $sql = 'UPDATE ' . MEMBERS_TABLE . "
+ SET member_lastraid = '" . $time_check . "'
+ WHERE member_name IN ('" . implode("', '", $members_array) . '\')
+ AND member_lastraid < ' . $time_check;
+ $db->query($sql);
+ }
+ }
+
+
+
+
+ /**
+ * Update active/inactive player status
+ *
+ * @return bool
+ */
+ function update_player_status()
+ {
+ global $db, $eqdkp, $user;
+
+ $inactive_time = mktime(0, 0, 0, date('m'), date('d')-$eqdkp->config['inactive_period'], date('Y'));
+
+ $active_members = array();
+ $inactive_members = array();
+
+ // Don't go through this whole thing of active/inactive adjustments if we don't need to.
+ if ( ($eqdkp->config['active_point_adj'] != '0.00') || ($eqdkp->config['inactive_point_adj'] != '0.00') )
+ {
+ $time = time();
+ $sql = 'SELECT member_name, member_status, member_lastraid
+ FROM ' . MEMBERS_TABLE;
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ unset($adj_value);
+ unset($adj_reason);
+
+ // Active -> Inactive
+ if ( ($eqdkp->config['inactive_point_adj'] != '0.00') && ($row['member_status'] == '1') && ($row['member_lastraid'] < $inactive_time) )
+ {
+ $adj_value = $eqdkp->config['inactive_point_adj'];
+ $adj_reason = 'Inactive adjustment';
+
+ $inactive_members[] = $row['member_name'];
+ }
+ // Inactive -> Active
+ elseif ( ($eqdkp->config['active_point_adj'] != '0.00') && ($row['member_status'] == '0') && ($row['member_lastraid'] >= $inactive_time) )
+ {
+ $adj_value = $eqdkp->config['active_point_adj'];
+ $adj_reason = 'Active adjustment';
+
+ $active_members[] = $row['member_name'];
+ }
+
+ //
+ // Insert individual adjustment
+ //
+ if ( (isset($adj_value)) && (isset($adj_reason)) )
+ {
+ $group_key = $this->gen_group_key($time, $adj_reason, $adj_value);
+
+ $query = $db->build_query('INSERT', array(
+ 'adjustment_value' => $adj_value,
+ 'adjustment_date' => $time,
+ 'member_name' => $row['member_name'],
+ 'adjustment_reason' => $adj_reason,
+ 'adjustment_group_key' => $group_key,
+ 'adjustment_added_by' => $user->data['username'])
+ );
+ $db->query('INSERT INTO ' . ADJUSTMENTS_TABLE . $query);
+ }
+ }
+
+ // Update inactive members' adjustment
+ if ( sizeof($inactive_members) > 0 )
+ {
+ $adj_value = $eqdkp->config['inactive_point_adj'];
+ $adj_reason = 'Inactive adjustment';
+
+ $sql = 'UPDATE ' . MEMBERS_TABLE . "
+ SET member_status='0', member_adjustment = member_adjustment + " . $eqdkp->config['inactive_point_adj'] . "
+ WHERE member_name IN ('" . implode("', '", $inactive_members) . '\')';
+
+ $log_action = array(
+ 'header' => '{L_ACTION_INDIVADJ_ADDED}',
+ '{L_ADJUSTMENT}' => $eqdkp->config['inactive_point_adj'],
+ '{L_MEMBERS}' => implode(', ', $inactive_members),
+ '{L_REASON}' => 'Inactive adjustment',
+ '{L_ADDED_BY}' => $user->data['username']);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+ }
+
+ // Update active members' adjustment
+ if ( sizeof($active_members) > 0 )
+ {
+ $sql = 'UPDATE ' . MEMBERS_TABLE . "
+ SET member_status='1', member_adjustment = member_adjustment + " . $eqdkp->config['active_point_adj'] . "
+ WHERE member_name IN ('" . implode("', '", $active_members) . '\')';
+ $db->query($sql);
+
+ $log_action = array(
+ 'header' => '{L_ACTION_INDIVADJ_ADDED}',
+ '{L_ADJUSTMENT}' => $eqdkp->config['active_point_adj'],
+ '{L_MEMBERS}' => implode(', ', $active_members),
+ '{L_REASON}' => 'Active adjustment',
+ '{L_ADDED_BY}' => $user->data['username']);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+ }
+ }
+ else
+ {
+ // Active -> Inactive
+ $db->query('UPDATE ' . MEMBERS_TABLE . " SET member_status='0' WHERE (member_lastraid < " . $inactive_time . ") AND (member_status='1')");
+
+ // Inactive -> Active
+ $db->query('UPDATE ' . MEMBERS_TABLE . " SET member_status='1' WHERE (member_lastraid >= " . $inactive_time . ") AND (member_status='0')");
+ }
+
+
+ // If your class_id doesn't match your level, update your class ID to the one that has
+ // the same class_name, but the correct min and max level.
+ $sql = "SELECT m.member_name, m.member_level, c.class_name, c.class_id, c.class_min_level, c.class_max_level
+ FROM " . MEMBERS_TABLE ." m, " . CLASS_TABLE . " c
+ WHERE m.member_class_id = c.class_id";
+ $result = $db->query($sql);
+
+ while ( $row = $db->fetch_record($result) ) {
+
+ if ( isset($row['member_level']) && ($row['member_level'] > $row['class_max_level'] || $row['member_level'] < $row['class_min_level'])) {
+
+ $sql = "SELECT class_id
+ FROM " . CLASS_TABLE . "
+ WHERE class_name = '" . $row['class_name'] ."'
+ AND class_min_level < '" . $row['member_level'] ."'
+ AND class_max_level >= '" . $row['member_level'] ."'";
+ $new_class_id = $db->query_first($sql);
+
+ if (!isset($new_class_id)) {
+ $new_class_id = 0;
+ }
+
+ $sql = "UPDATE " . MEMBERS_TABLE . "
+ SET member_class_id = '" . $new_class_id . "'
+ WHERE member_name = '" . $row['member_name'] . "'";
+ $db->query($sql);
+
+ }
+ }
+
+
+ return true;
+ }
+
+ // ---------------------------------------------------------
+ // Display form
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ //
+ // Find the value of the event, or use the one-time value from the form
+ //
+ $raid_name = ( is_array($this->raid['raid_name']) ) ? (( isset($this->raid['raid_name'][0]) ) ? $this->raid['raid_name'][0] : '' ) : $this->raid['raid_name'];
+ $preset_value = $db->query_first('SELECT event_value FROM ' . EVENTS_TABLE . " WHERE event_name='" . addslashes($raid_name) . "'");
+ $raid_value = ( $this->raid['raid_value'] == 0 ) ? '' : $this->raid['raid_value'];
+ $raid_value = ( $this->raid['raid_value'] == $preset_value ) ? '' : $this->raid['raid_value'];
+
+ //
+ // Build member drop-down
+ //
+ $sql = 'SELECT member_name
+ FROM ' . MEMBERS_TABLE . '
+ ORDER BY member_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $tpl->assign_block_vars('members_row', array(
+ 'VALUE' => $row['member_name'],
+ 'OPTION' => $row['member_name'])
+ );
+ }
+ $db->free_result($result);
+
+ //
+ // Build event drop-down
+ //
+ $max_value = $db->query_first('SELECT max(event_value) FROM ' . EVENTS_TABLE);
+
+ if (!isset($max_value)) {
+ $max_value = 0;
+ }
+
+ $float = @explode('.', $max_value);
+ $format = '%0' . @strlen($float[0]) . '.2f';
+
+ $sql = 'SELECT event_id, event_name, event_value
+ FROM ' . EVENTS_TABLE . '
+ ORDER BY event_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $select_check = ( is_array($this->raid['raid_name']) ) ? in_array(stripslashes($row['event_name']), $this->raid['raid_name']) : stripslashes($row['event_name']) == $this->raid['raid_name'];
+
+ $tpl->assign_block_vars('events_row', array(
+ 'VALUE' => stripslashes($row['event_name']),
+ 'SELECTED' => ( $select_check ) ? ' selected="selected"' : '',
+ 'OPTION' => '(' . sprintf($format, $row['event_value']) . ') - ' . stripslashes($row['event_name']))
+ );
+ }
+ $db->free_result($result);
+
+ $tpl->assign_vars(array(
+ // Form vars
+ 'F_ADD_RAID' => 'addraid.php' . $SID,
+ 'RAID_ID' => $this->url_id,
+ 'U_ADD_EVENT' => 'addevent.php'.$SID,
+ 'S_EVENT_MULTIPLE' => ( !$this->url_id ) ? true : false,
+
+ // Form values
+ 'RAID_ATTENDEES' => str_replace(',', "\n", $this->raid['raid_attendees']),
+ 'RAID_VALUE' => stripslashes($raid_value),
+ 'RAID_NOTE' => stripslashes(htmlspecialchars($this->raid['raid_note'])),
+ 'MO' => date('m', $this->time),
+ 'D' => date('d', $this->time),
+ 'Y' => date('Y', $this->time),
+ 'H' => date('H', $this->time),
+ 'MI' => date('i', $this->time),
+ 'S' => date('s', $this->time),
+
+ // Language
+ 'L_ADD_RAID_TITLE' => $user->lang['addraid_title'],
+ 'L_ATTENDEES' => $user->lang['attendees'],
+ 'L_PARSE_LOG' => $user->lang['parse_log'],
+ 'L_SEARCH_MEMBERS' => $user->lang['search_members'],
+ 'L_EVENT' => $user->lang['event'],
+ 'L_ADD_EVENT' => strtolower($user->lang['add_event']),
+ 'L_VALUE' => $user->lang['value'],
+ 'L_ADDRAID_VALUE_NOTE' => $user->lang['addraid_value_note'],
+ 'L_DATE' => $user->lang['date'],
+ 'L_TIME' => $user->lang['time'],
+ 'L_ADDRAID_DATETIME_NOTE' => $user->lang['addraid_datetime_note'],
+ 'L_NOTE' => $user->lang['note'],
+ 'L_ADD_RAID' => $user->lang['add_raid'],
+ 'L_RESET' => $user->lang['reset'],
+ 'L_UPDATE_RAID' => $user->lang['update_raid'],
+ 'L_DELETE_RAID' => $user->lang['delete_raid'],
+
+ // Form validation
+ 'FV_ATTENDEES' => $this->fv->generate_error('raid_attendees'),
+ 'FV_EVENT_NAME' => $this->fv->generate_error('raid_name'),
+ 'FV_VALUE' => $this->fv->generate_error('raid_value'),
+ 'FV_MO' => $this->fv->generate_error('mo'),
+ 'FV_D' => $this->fv->generate_error('d'),
+ 'FV_Y' => $this->fv->generate_error('y'),
+ 'FV_H' => $this->fv->generate_error('h'),
+ 'FV_MI' => $this->fv->generate_error('mi'),
+ 'FV_S' => $this->fv->generate_error('s'),
+
+ // Javascript messages
+ 'MSG_ATTENDEES_EMPTY' => $user->lang['fv_required_attendees'],
+ 'MSG_NAME_EMPTY' => $user->lang['fv_required_event_name'],
+ 'MSG_GAME_NAME' => $eqdkp->config['default_game'],
+
+ // Buttons
+ 'S_ADD' => ( !$this->url_id ) ? true : false)
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['addraid_title'],
+ 'template_file' => 'admin/addraid.html',
+ 'display' => true)
+ );
+ }
+}
+
+$add_raid = new Add_Raid;
+$add_raid->process();
+?>
diff --git a/admin/addturnin.php b/admin/addturnin.php
new file mode 100644
index 0000000..5f4088f
--- /dev/null
+++ b/admin/addturnin.php
@@ -0,0 +1,252 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * addturnin.php
+ * Began: Sat January 4 2003
+ *
+ * $Id: addturnin.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class Add_Turnin extends EQdkp_Admin
+{
+ var $turnin = array(); // Holds turnin data @var turnin
+
+ function add_turnin()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ $this->turnin = array(
+ 'from' => post_or_db('turnin_from'),
+ 'to' => post_or_db('turnin_to')
+ );
+
+ $this->assoc_buttons(array(
+ 'add' => array(
+ 'name' => 'add',
+ 'process' => 'process_add',
+ 'check' => 'a_turnin_add'),
+ 'proceed' => array(
+ 'name' => 'proceed',
+ 'process' => 'display_step2',
+ 'check' => 'a_turnin_add'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_raid_'))
+ );
+ }
+
+ function error_check()
+ {
+ global $user;
+
+ if ( isset($_POST['turnin_from']) )
+ {
+ if ( ($_POST['turnin_from'] == $_POST['turnin_to']) || (empty($_POST['turnin_from'])) || (empty($_POST['turnin_to'])) )
+ {
+ $this->fv->errors['turnin_from'] = $user->lang['fv_difference_turnin'];
+ $this->fv->errors['turnin_to'] = $user->lang['fv_difference_turnin'];
+ }
+
+ $this->turnin = array(
+ 'from' => post_or_db('turnin_from'),
+ 'to' => post_or_db('turnin_to')
+ );
+ }
+
+ return $this->fv->is_error();
+ }
+
+ // ---------------------------------------------------------
+ // Process Add
+ // ---------------------------------------------------------
+ function process_add()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ //
+ // Get item information
+ //
+ $sql = 'SELECT item_value, item_name
+ FROM ' . ITEMS_TABLE . "
+ WHERE item_id='" . $_POST['item_id'] . "'";
+ $result = $db->query($sql);
+ $row = $db->fetch_record($result);
+
+ $item_value = ( !empty($row['item_value']) ) ? $row['item_value'] : '0.00';
+
+ //
+ // Remove price from the 'From' member
+ //
+ $sql = 'UPDATE ' . MEMBERS_TABLE . '
+ SET member_spent = member_spent - ' . $item_value . "
+ WHERE member_name='" . $_POST['from'] . "'";
+ $db->query($sql);
+
+ //
+ // Add the price to the 'To' member
+ //
+ $sql = 'UPDATE ' . MEMBERS_TABLE . '
+ SET member_spent = member_spent + ' . $item_value . "
+ WHERE member_name='" . $_POST['to'] . "'";
+ $db->query($sql);
+
+ //
+ // Change the buyer
+ //
+ $sql = 'UPDATE ' . ITEMS_TABLE . "
+ SET item_buyer='" . $_POST['to'] . "'
+ WHERE item_id='" . $_POST['item_id'] . "'";
+ $db->query($sql);
+
+ //
+ // Logging
+ //
+ $log_action = array(
+ 'header' => '{L_ACTION_TURNIN_ADDED}',
+ '{L_ITEM}' => addslashes($row['item_name']),
+ '{L_VALUE}' => $item_value,
+ '{L_FROM}' => $_POST['from'],
+ '{L_TO}' => $_POST['to'],
+ '{L_ADDED_BY}' => $this->admin_user);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ $success_message = sprintf($user->lang['admin_add_turnin_success'], $row['item_name'], $_POST['from'], $_POST['to']);
+ $this->admin_die($success_message);
+ }
+
+ // ---------------------------------------------------------
+ // Process Step 2
+ // ---------------------------------------------------------
+ function display_step2()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $max_value = $db->query_first('SELECT max(item_value) FROM ' . ITEMS_TABLE . " WHERE item_buyer='" . $_POST['turnin_from'] . "'");
+ $float = @explode('.', $max_value);
+ $format = '%0'.@strlen($float[0]).'.2f';
+
+ $sql = 'SELECT item_id, item_name, item_value
+ FROM ' . ITEMS_TABLE . "
+ WHERE item_buyer='" . $_POST['turnin_from'] . "'
+ ORDER BY item_name";
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $tpl->assign_block_vars('items_row', array(
+ 'VALUE' => $row['item_id'],
+ 'OPTION' => '(' . sprintf($format, $row['item_value']) . ') - ' . stripslashes($row['item_name']))
+ );
+ }
+
+ $tpl->assign_vars(array(
+ // Form vars
+ 'F_ADD_TURNIN' => 'addturnin.php' . $SID,
+ 'S_STEP1' => false,
+
+ // Form values
+ 'FROM' => $this->turnin['from'],
+ 'TO' => $this->turnin['to'],
+ 'TURNIN_FROM' => $this->turnin['from'],
+ 'TURNIN_TO' => $this->turnin['to'],
+
+ // Language
+ 'L_ADD_TURNIN_TITLE' => sprintf($user->lang['addturnin_title'], '2'),
+ 'L_FROM' => $user->lang['from'],
+ 'L_TO' => $user->lang['to'],
+ 'L_ADD_TURNIN' => $user->lang['add_turnin'],
+ 'L_ITEM' => $user->lang['item'],
+
+ // Form validation
+ 'FV_TURNIN_FROM' => $this->fv->generate_error('turnin_from'),
+ 'FV_TURNIN_TO' => $this->fv->generate_error('turnin_to'),
+
+ // Javascript messages
+ 'MSG_FROM_TO_SAME' => $user->lang['fv_difference_turnin'])
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.sprintf($user->lang['addturnin_title'], '2'),
+ 'template_file' => 'admin/addturnin.html',
+ 'display' => true)
+ );
+ }
+
+ // ---------------------------------------------------------
+ // Display form
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $sql = 'SELECT member_name
+ FROM ' . MEMBERS_TABLE . '
+ ORDER BY member_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $tpl->assign_block_vars('turnin_from_row', array(
+ 'VALUE' => $row['member_name'],
+ 'SELECTED' => ( $this->turnin['from'] == $row['member_name'] ) ? ' selected="selected"' : '',
+ 'OPTION' => $row['member_name'])
+ );
+
+ $tpl->assign_block_vars('turnin_to_row', array(
+ 'VALUE' => $row['member_name'],
+ 'SELECTED' => ( $this->turnin['to'] == $row['member_name'] ) ? ' selected="selected"' : '',
+ 'OPTION' => $row['member_name'])
+ );
+ }
+
+ $tpl->assign_vars(array(
+ // Form vars
+ 'F_ADD_TURNIN' => 'addturnin.php' . $SID,
+ 'S_STEP1' => true,
+
+ // Form values
+ 'FROM' => $this->turnin['from'],
+ 'TO' => $this->turnin['to'],
+
+ // Language
+ 'L_ADD_TURNIN_TITLE' => sprintf($user->lang['addturnin_title'], '1'),
+ 'L_FROM' => $user->lang['from'],
+ 'L_TO' => $user->lang['to'],
+ 'L_PROCEED' => $user->lang['proceed'],
+
+ // Form validation
+ 'FV_TURNIN_FROM' => $this->fv->generate_error('turnin_from'),
+ 'FV_TURNIN_TO' => $this->fv->generate_error('turnin_to'),
+
+ // Javascript messages
+ 'MSG_FROM_TO_SAME' => $user->lang['fv_difference_turnin'])
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.sprintf($user->lang['addturnin_title'], '1'),
+ 'template_file' => 'admin/addturnin.html',
+ 'display' => true)
+ );
+ }
+}
+
+$add_turnin = new Add_Turnin;
+$add_turnin->process();
+?> \ No newline at end of file
diff --git a/admin/backup.php b/admin/backup.php
new file mode 100644
index 0000000..2a656c6
--- /dev/null
+++ b/admin/backup.php
@@ -0,0 +1,288 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * manage_members.php
+ * Began: Sun January 5 2003
+ *
+ * $Id: manage_members.php 4 2006-05-08 17:01:47Z tsigo $
+ *
+ ******************************/
+
+// Notice: Since 'Manage Members' function as a whole handles a lot of form and
+// processing code, this script will serve only as a framework for other processing
+// scripts (found in the mm directory)
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class Backup extends EQdkp_Admin
+{
+ function backup()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ $this->assoc_buttons(array(
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_menu',
+ 'check' => 'a_backup'),
+ 'backup' => array(
+ 'name' => 'backup',
+ 'process' => 'do_backup',
+ 'check' => 'a_backup'))
+ );
+ }
+
+ function error_check()
+ {
+ return $this->fv->is_error();
+ }
+
+ // ---------------------------------------------------------
+ // Display menu
+ // ---------------------------------------------------------
+ function display_menu()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+ $tpl->assign_vars(array(
+ 'F_BACKUP' => 'backup.php' . $SID,
+ 'L_BACKUP_TITLE' => $user->lang['backup_title'],
+ 'L_CREATE_TABLE' => $user->lang['create_table'],
+ 'L_SKIP_NONESSENTIAL' => $user->lang['skip_nonessential'],
+ 'L_GZIP_CONTENT' => $user->lang['gzip_content'],
+ 'L_BACKUP_DATABASE' => $user->lang['backup_database'],
+ 'L_YES' => $user->lang['yes'],
+ 'L_NO' => $user->lang['no'])
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['backup'],
+ 'template_file' => 'admin/backup.html',
+ 'display' => true)
+ );
+ }
+
+ // ---------------------------------------------------------
+ // Main Backup Script
+ // ---------------------------------------------------------
+ function do_backup()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm, $dbhost;
+ global $SID;
+
+ $tables = array(
+ ADJUSTMENTS_TABLE,
+ AUTH_OPTIONS_TABLE,
+ AUTH_USERS_TABLE,
+ CONFIG_TABLE,
+ EVENTS_TABLE,
+ ITEMS_TABLE,
+ LOGS_TABLE,
+ MEMBERS_TABLE,
+ MEMBER_RANKS_TABLE,
+ MEMBER_USER_TABLE,
+ NEWS_TABLE,
+ PLUGINS_TABLE,
+ RAIDS_TABLE,
+ SESSIONS_TABLE,
+ STYLES_CONFIG_TABLE,
+ STYLES_TABLE,
+ USERS_TABLE,
+ CLASS_TABLE,
+ RACE_TABLE,
+ FACTION_TABLE
+ );
+
+ $do_gzip = false;
+
+ if($phpver >= "4.0")
+ {
+ if( extension_loaded("zlib") && $_POST['gzip'] == 'Y')
+ {
+ $do_gzip = true;
+ }
+ }
+
+ if( $do_gzip )
+ {
+ die('gzip');
+ @ob_start();
+ @ob_implicit_flush(0);
+ header("Content-Type: text/x-delimtext; name=\"eqdkpbackup.sql.gz\"");
+ header("Content-disposition: attachment; filename=eqdkpbackup.sql.gz");
+ }
+ else
+ {
+ header("Content-Type: text/x-delimtext; name=\"eqdkpbackup.sql\"");
+ header("Content-disposition: attachment; filename=eqdkpbackup.sql");
+ }
+
+ //Lets echo out our header
+ echo "-- EQDKP SQL Dump\n-- version ".EQDKP_VERSION."\n-- http://www.eqdkp.com\n-- \n-- Host: ".$dbhost."\n-- Generation Time: ".date('M d, Y \a\t g:iA')."\n\n-- --------------------------------------------------------\n\n";
+
+ foreach ( $tables as $table )
+ {
+ $table_sql_string = "";
+ $data_sql_string = "";
+
+ if ( $_POST['create_table'] == 'Y' )
+ {
+ echo "\n-- \n-- Table structure for table `".$table."`\n-- \n\n";
+ echo $this->_create_table_sql_string($table) . "\n";
+ }
+ echo "\n-- \n-- Dumping data for table `".$table."`\n-- \n\n";
+ if ( $table != SESSIONS_TABLE ) echo $this->_create_data_sql_string($table) . "\n";
+ }
+
+ @header("Pragma: no-cache");
+
+ if( $do_gzip )
+ {
+ $size = ob_get_length();
+ $crc = crc32(ob_get_contents());
+ $contents = gzcompress(ob_get_contents());
+ ob_end_clean();
+ echo '\x1f\x8b\x08\x00\x00\x00\x00\x00'
+ .substr($contents, 0, strlen($contents) - 4)
+ .$this->_gzip_four_chars($crc)
+ .$this->_gzip_four_chars($size);
+ }
+ }
+
+ function _create_table_sql_string($tablename)
+ {
+ global $db;
+ // Start the SQL string for this table
+ // EQDKP_CHANGE: We always drop tables by default. You may not like this.
+ // This is what we need for our app, so don't expect this to work for everything.
+ $sql_string = "DROP TABLE IF EXISTS $tablename;\n";
+ $sql_string .= "CREATE TABLE $tablename";
+
+ // Get the field info and output to a string in the correct MySQL syntax
+ $result = $db->query("DESCRIBE $tablename");
+ while ($field_info = $db->fetch_record($result))
+ {
+ $field_name = $field_info[0];
+ $field_type = $field_info[1];
+ $field_not_null = ($field_info[2] == "YES") ? "" : " NOT NULL";
+ $field_default = ($field_info[4] == NULL) ? "" : sprintf(" default '%s'", $field_info[4]);;
+ $field_auto_increment = ($field_info[5] == NULL) ? "" : sprintf(" %s", $field_info[5]);
+
+ $field_string = sprintf("%s,\n `%s` %s%s%s%s", $field_string, $field_name, $field_type, $field_not_null, $field_auto_increment, $field_default);
+ }
+ // Get the index info and output to a string in the correct MySQL syntax
+ $result = $db->query("SHOW INDEX FROM $tablename");
+ while ($index_info = $db->fetch_record($result))
+ {
+
+ $index_name = $index_info[2];
+ $index_unique = $index_info[1];
+ $index_field_name = $index_info[4];
+ $index_type = $index_info[10];
+
+ if ($index_name == "PRIMARY") $index_name = "PRIMARY KEY";
+
+ if ($index_unique == "1" && $index_type != "FULLTEXT") $index_name = sprintf("KEY %s", $index_name);
+
+ if ($index_unique == "0" && $index_name != "PRIMARY KEY") $index_name = sprintf("UNIQUE KEY %s", $index_name);
+
+ if ($index_type == "FULLTEXT") $index_name = sprintf("FULLTEXT KEY %s", $index_name);
+
+ $index_string = sprintf("%s,\n %s (`%s`)", $index_string, $index_name, $index_field_name);
+ }
+ // Get the table type and output it to a string in the correct MySQL syntax
+ $result = $db->query("SHOW TABLE STATUS");
+ while ($status_info = $db->fetch_record($result))
+ {
+ for ($i = 0; $i < count($status_info); $i++)
+ {
+ // add a semicolon to the end of the line so this tools output will be usable
+ if ($status_info[0] == $tablename) $table_type = sprintf("TYPE=%s ;", $status_info[1]);
+ }
+ }
+
+ // Remove the first 2 characters (", ") from the field string
+ $field_string = "\n" . substr($field_string, 2);
+
+ // Append the index string to the field string
+ $field_string = sprintf("%s%s", $field_string, $index_string);
+
+ // Put the field string in parantheses
+ $field_string = sprintf("(%s\n)", $field_string);
+
+ // Finalise the MySQL create table string
+ $sql_string = sprintf("%s %s %s", $sql_string, $field_string, $table_type);
+
+ return $sql_string;
+ }
+
+ function _create_data_sql_string($tablename)
+ {
+ global $db;
+
+ // Initialise the field string
+ $field_string = "";
+
+ // Get field names from MySQL and output to a string in the correct MySQL syntax
+ $result = $db->query("SELECT * FROM $tablename");
+
+ for ($i = 0; $i < @mysql_num_fields($result); $i++) {
+ $meta = @mysql_fetch_field($result, $i);
+
+ $field_string = sprintf("%s, %s", $field_string, $meta->name);
+ }
+
+ // Remove the first 2 characters (", ") from the field string
+ $field_string = substr($field_string, 2);
+
+ // Put the field string in parantheses
+ $field_string = sprintf("(%s)", $field_string);
+
+ // Get table data from MySQL and output to a string in the correct MySQL syntax
+ while ($row = $db->fetch_record($result)) {
+ // Initialise the data string
+ $data_string = "";
+
+ // Loop through the records and append data to the string after escaping
+ for ($i = 0; $i < mysql_num_fields($result); $i++) {
+ $data_string = sprintf("%s, '%s'", $data_string, mysql_escape_string($row[$i]));
+ }
+
+ // Remove the first 2 characters (", ") from the data string
+ $data_string = substr($data_string, 2);
+
+ // Put the data string in parantheses and prepend "VALUES "
+ $data_string = sprintf("VALUES (%s)", $data_string);
+
+ // Finalise the MySQL insert into string for this record
+ // add a semicolon to the end of the line so this tools output will be usable
+ $sql_string = sprintf("%sINSERT INTO %s %s %s ;\n", $sql_string, $tablename, $field_string, $data_string);
+ }
+
+ return $sql_string;
+ }
+
+ function _gzip_four_chars($val)
+ {
+ for ($i = 0; $i < 4; $i ++)
+ {
+ $return .= chr($val % 256);
+ $val = floor($val / 256);
+ }
+
+ return $return;
+ }
+}
+
+$backup = new Backup;
+$backup->process();
+?> \ No newline at end of file
diff --git a/admin/config.php b/admin/config.php
new file mode 100644
index 0000000..c9121b4
--- /dev/null
+++ b/admin/config.php
@@ -0,0 +1,512 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * config.php
+ * Began: Sat December 28 2002
+ *
+ * $Id: config.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class EQdkp_Config extends EQdkp_Admin
+{
+ function eqdkp_config()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ $this->assoc_buttons(array(
+ 'submit' => array(
+ 'name' => 'submit',
+ 'process' => 'process_submit',
+ 'check' => 'a_config_man'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_config_man'))
+ );
+ }
+
+ function error_check()
+ {
+ global $user;
+
+ $this->fv->is_number(array(
+ 'default_alimit' => $user->lang['fv_number'],
+ 'default_elimit' => $user->lang['fv_number'],
+ 'default_ilimit' => $user->lang['fv_number'],
+ 'default_nlimit' => $user->lang['fv_number'],
+ 'default_rlimit' => $user->lang['fv_number'],
+ 'active_point_adj' => $user->lang['fv_number'],
+ 'inactive_point_adj' => $user->lang['fv_number'])
+ );
+
+ $this->fv->is_within_range('default_alimit', 1, 1000);
+ $this->fv->is_within_range('default_elimit', 1, 1000);
+ $this->fv->is_within_range('default_ilimit', 1, 1000);
+ $this->fv->is_within_range('default_nlimit', 1, 1000);
+ $this->fv->is_within_range('default_rlimit', 1, 1000);
+
+ return $this->fv->is_error();
+ }
+
+ // ---------------------------------------------------------
+ // Process submit
+ // ---------------------------------------------------------
+ function process_submit()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ // Remove < > from guildtags if we need to
+ $_POST['parsetags'] = preg_replace('#<(.+)>([[:space:]])?#', "\\1", $_POST['parsetags']);
+ $_POST = htmlspecialchars_array($_POST);
+
+ $current_game = $eqdkp->config['default_game'];
+
+
+ // Update each config setting
+ $eqdkp->config_set(array(
+ 'guildtag' => $_POST['guildtag'],
+ 'parsetags' => $_POST['parsetags'],
+ 'server_name' => $_POST['server_name'],
+ 'server_port' => intval($_POST['server_port']),
+ 'server_path' => $_POST['server_path'],
+ 'main_title' => $_POST['main_title'],
+ 'sub_title' => $_POST['sub_title'],
+ 'dkp_name' => $_POST['dkp_name'],
+ 'default_game' => $_POST['default_game'],
+ 'default_locale' => $_POST['default_locale'],
+ 'account_activation' => ( isset($_POST['account_activation']) ) ? $_POST['account_activation'] : '0',
+ 'default_alimit' => intval($_POST['default_alimit']),
+ 'default_elimit' => intval($_POST['default_elimit']),
+ 'default_ilimit' => intval($_POST['default_ilimit']),
+ 'default_nlimit' => intval($_POST['default_nlimit']),
+ 'default_rlimit' => intval($_POST['default_rlimit']),
+ 'default_lang' => $_POST['default_lang'],
+ 'default_style' => intval($_POST['default_style']),
+ 'hide_inactive' => ( isset($_POST['hide_inactive']) ) ? $_POST['hide_inactive'] : '0',
+ 'inactive_period' => intval($_POST['inactive_period']),
+ 'active_point_adj' => $_POST['active_point_adj'],
+ 'inactive_point_adj' => $_POST['inactive_point_adj'],
+ 'enable_gzip' => ( isset($_POST['enable_gzip']) ) ? $_POST['enable_gzip'] : '0',
+ 'cookie_domain' => $_POST['cookie_domain'],
+ 'cookie_name' => $_POST['cookie_name'],
+ 'cookie_path' => $_POST['cookie_path'],
+ 'session_length' => intval($_POST['session_length']),
+ 'admin_email' => $_POST['admin_email'],
+ 'start_page' => $_POST['start_page'])
+ );
+
+ // New for 1.3 - game selection
+ if (( $_POST['default_game'] != $current_game ))
+ {
+
+ include($eqdkp->root_path . 'games/' . $_POST['default_game'] . '.php');
+
+ $game_extension = new Manage_Game;
+ $game_extension->process();
+
+ }
+
+ // end 1.3 game selection change
+
+ // Permissions
+ $sql = 'SELECT auth_id, auth_value
+ FROM ' . AUTH_OPTIONS_TABLE . '
+ ORDER BY auth_id';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $this->update_auth_default($row['auth_value'], ( isset($_POST[$row['auth_value']]) ) ? 'Y' : 'N');
+ }
+
+ header('Location: config.php' . $SID);
+ }
+
+ // ---------------------------------------------------------
+ // Process helper methods
+ // ---------------------------------------------------------
+ function update_auth_default($auth_value, $auth_default='N')
+ {
+ global $db;
+
+ if ( empty($auth_value) )
+ {
+ return false;
+ }
+
+ $sql = 'UPDATE ' . AUTH_OPTIONS_TABLE . "
+ SET auth_default='" . strip_tags(htmlspecialchars($auth_default)) . "'
+ WHERE auth_value='" . $auth_value . "'";
+ if ( !($result = $db->query($sql)) )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ // ---------------------------------------------------------
+ // Display form
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID, $auth_defaults;
+
+ $cur_hash = hash_filename("config.php");
+ //print"HASH::$cur_hash::<br>";
+
+ //
+ // Find default auth settings
+ //
+ $sql = 'SELECT auth_id, auth_default
+ FROM ' . AUTH_OPTIONS_TABLE . '
+ ORDER BY auth_id';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $auth_defaults[$row['auth_id']] = $row['auth_default'];
+ }
+ $db->free_result($result);
+
+ //
+ // Build the config permissions
+ //
+ $config_permissions = array(
+ // Events
+ $user->lang['events'] => array(
+ array('CBNAME' => 'a_event_add', 'CBCHECKED' => A_EVENT_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>'),
+ array('CBNAME' => 'a_event_upd', 'CBCHECKED' => A_EVENT_UPD, 'TEXT' => '<b>' . $user->lang['update'] . '</b>'),
+ array('CBNAME' => 'a_event_del', 'CBCHECKED' => A_EVENT_DEL, 'TEXT' => '<b>' . $user->lang['delete'] . '</b>'),
+ array('CBNAME' => 'u_event_list', 'CBCHECKED' => U_EVENT_LIST, 'TEXT' => $user->lang['list']),
+ array('CBNAME' => 'u_event_view', 'CBCHECKED' => U_EVENT_VIEW, 'TEXT' => $user->lang['view'])
+ ),
+ // Group adjustments
+ $user->lang['group_adjustments'] => array(
+ array('CBNAME' => 'a_groupadj_add', 'CBCHECKED' => A_GROUPADJ_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>'),
+ array('CBNAME' => 'a_groupadj_upd', 'CBCHECKED' => A_GROUPADJ_UPD, 'TEXT' => '<b>' . $user->lang['update'] . '</b>'),
+ array('CBNAME' => 'a_groupadj_del', 'CBCHECKED' => A_GROUPADJ_DEL, 'TEXT' => '<b>' . $user->lang['delete'] . '</b>')
+ ),
+ // Individual adjustments
+ $user->lang['individual_adjustments'] => array(
+ array('CBNAME' => 'a_indivadj_add', 'CBCHECKED' => A_INDIVADJ_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>'),
+ array('CBNAME' => 'a_indivadj_upd', 'CBCHECKED' => A_INDIVADJ_UPD, 'TEXT' => '<b>' . $user->lang['update'] . '</b>'),
+ array('CBNAME' => 'a_indivadj_del', 'CBCHECKED' => A_INDIVADJ_DEL, 'TEXT' => '<b>' . $user->lang['delete'] . '</b>')
+ ),
+ // Items
+ $user->lang['items'] => array(
+ array('CBNAME' => 'a_item_add', 'CBCHECKED' => A_ITEM_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>'),
+ array('CBNAME' => 'a_item_upd', 'CBCHECKED' => A_ITEM_UPD, 'TEXT' => '<b>' . $user->lang['update'] . '</b>'),
+ array('CBNAME' => 'a_item_del', 'CBCHECKED' => A_ITEM_DEL, 'TEXT' => '<b>' . $user->lang['delete'] . '</b>'),
+ array('CBNAME' => 'u_item_list', 'CBCHECKED' => U_ITEM_LIST, 'TEXT' => $user->lang['list']),
+ array('CBNAME' => 'u_item_view', 'CBCHECKED' => U_ITEM_VIEW, 'TEXT' => $user->lang['view'])
+ ),
+ // News
+ $user->lang['news'] => array(
+ array('CBNAME' => 'a_news_add', 'CBCHECKED' => A_NEWS_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>'),
+ array('CBNAME' => 'a_news_upd', 'CBCHECKED' => A_NEWS_UPD, 'TEXT' => '<b>' . $user->lang['update'] . '</b>'),
+ array('CBNAME' => 'a_news_del', 'CBCHECKED' => A_NEWS_DEL, 'TEXT' => '<b>' . $user->lang['delete'] . '</b>')
+ ),
+ // Raids
+ $user->lang['raids'] => array(
+ array('CBNAME' => 'a_raid_add', 'CBCHECKED' => A_RAID_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>'),
+ array('CBNAME' => 'a_raid_upd', 'CBCHECKED' => A_RAID_UPD, 'TEXT' => '<b>' . $user->lang['update'] . '</b>'),
+ array('CBNAME' => 'a_raid_del', 'CBCHECKED' => A_RAID_DEL, 'TEXT' => '<b>' . $user->lang['delete'] . '</b>'),
+ array('CBNAME' => 'u_raid_list', 'CBCHECKED' => U_RAID_LIST, 'TEXT' => $user->lang['list']),
+ array('CBNAME' => 'u_raid_view', 'CBCHECKED' => U_RAID_VIEW, 'TEXT' => $user->lang['view'])
+ ),
+ // Turn-ins
+ $user->lang['turn_ins'] => array(
+ array('CBNAME' => 'a_turnin_add', 'CBCHECKED' => A_TURNIN_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>')
+ ),
+ // Members
+ $user->lang['members'] => array(
+ array('CBNAME' => 'a_members_man', 'CBCHECKED' => A_MEMBERS_MAN, 'TEXT' => '<b>' . $user->lang['manage'] . '</b>'),
+ array('CBNAME' => 'u_member_list', 'CBCHECKED' => U_MEMBER_LIST, 'TEXT' => $user->lang['list']),
+ array('CBNAME' => 'u_member_view', 'CBCHECKED' => U_MEMBER_VIEW, 'TEXT' => $user->lang['view'])
+ ),
+ // Manage
+ $user->lang['manage'] => array(
+ array('CBNAME' => 'a_config_man', 'CBCHECKED' => A_CONFIG_MAN, 'TEXT' => '<b>' . $user->lang['configuration'] . '</b>'),
+ array('CBNAME' => 'a_plugins_man', 'CBCHECKED' => A_PLUGINS_MAN, 'TEXT' => '<b>' . $user->lang['plugins'] . '</b>'),
+ array('CBNAME' => 'a_styles_man', 'CBCHECKED' => A_STYLES_MAN, 'TEXT' => '<b>' . $user->lang['styles'] . '</b>'),
+ array('CBNAME' => 'a_users_man', 'CBCHECKED' => A_USERS_MAN, 'TEXT' => '<b>' . $user->lang['users'] . '</b>')
+ ),
+ // Logs
+ $user->lang['logs'] => array(
+ array('CBNAME' => 'a_logs_view', 'CBCHECKED' => A_LOGS_VIEW, 'TEXT' => '<b>' . $user->lang['view'] . '</b>')
+ ),
+ // Backup Database
+ $user->lang['backup'] => array(
+ array('CBNAME' => 'a_backup', 'CBCHECKED' => A_BACKUP, 'TEXT' => '<b>' . $user->lang['backup_database'] . '</b>')
+ )
+ );
+
+ // Add plugin checkboxes to our array
+ $pm->generate_permission_boxes($config_permissions);
+
+ foreach ( $config_permissions as $group => $checks )
+ {
+ $tpl->assign_block_vars('permissions_row', array(
+ 'GROUP' => $group)
+ );
+
+ foreach ( $checks as $data )
+ {
+ $tpl->assign_block_vars('permissions_row.check_group', array(
+ 'CBNAME' => $data['CBNAME'],
+ 'CBCHECKED' => ( $auth_defaults[$data['CBCHECKED']] == 'Y' ) ? ' checked="checked"' : '',
+ 'TEXT' => $data['TEXT'])
+ );
+ }
+ }
+ unset($config_permissions);
+
+ $tpl->assign_vars(array(
+ // Form vars
+ 'F_CONFIG' => 'config.php' . $SID,
+
+ // Form values
+ 'GUILDTAG' => $eqdkp->config['guildtag'],
+ 'PARSETAGS' => $eqdkp->config['parsetags'],
+ 'SERVER_NAME' => $eqdkp->config['server_name'],
+ 'SERVER_PORT' => $eqdkp->config['server_port'],
+ 'SERVER_PATH' => $eqdkp->config['server_path'],
+ 'MAIN_TITLE' => $eqdkp->config['main_title'],
+ 'SUB_TITLE' => $eqdkp->config['sub_title'],
+ 'DKP_NAME' => $eqdkp->config['dkp_name'],
+ 'ACTIVATION_NONE_CHECKED' => ( $eqdkp->config['account_activation'] == USER_ACTIVATION_NONE ) ? ' checked="checked"' : '',
+ 'ACTIVATION_USER_CHECKED' => ( $eqdkp->config['account_activation'] == USER_ACTIVATION_SELF ) ? ' checked="checked"' : '',
+ 'ACTIVATION_ADMIN_CHECKED' => ( $eqdkp->config['account_activation'] == USER_ACTIVATION_ADMIN ) ? ' checked="checked"' : '',
+ 'DEFAULT_ALIMIT' => $eqdkp->config['default_alimit'],
+ 'DEFAULT_ELIMIT' => $eqdkp->config['default_elimit'],
+ 'DEFAULT_ILIMIT' => $eqdkp->config['default_ilimit'],
+ 'DEFAULT_NLIMIT' => $eqdkp->config['default_nlimit'],
+ 'DEFAULT_RLIMIT' => $eqdkp->config['default_rlimit'],
+ 'HIDE_INACTIVE_YES_CHECKED' => ( $eqdkp->config['hide_inactive'] == '1' ) ? ' checked="checked"' : '',
+ 'HIDE_INACTIVE_NO_CHECKED' => ( $eqdkp->config['hide_inactive'] == '0' ) ? ' checked="checked"' : '',
+ 'INACTIVE_PERIOD' => $eqdkp->config['inactive_period'],
+ 'ACTIVE_POINT_ADJ' => $eqdkp->config['active_point_adj'],
+ 'INACTIVE_POINT_ADJ' => $eqdkp->config['inactive_point_adj'],
+ 'GZIP_YES_CHECKED' => ( $eqdkp->config['enable_gzip'] == '1' ) ? ' checked="checked"' : '',
+ 'GZIP_NO_CHECKED' => ( $eqdkp->config['enable_gzip'] == '0' ) ? ' checked="checked"' : '',
+ 'COOKIE_DOMAIN' => $eqdkp->config['cookie_domain'],
+ 'COOKIE_NAME' => $eqdkp->config['cookie_name'],
+ 'COOKIE_PATH' => $eqdkp->config['cookie_path'],
+ 'SESSION_LENGTH' => $eqdkp->config['session_length'],
+ 'ADMIN_EMAIL' => $eqdkp->config['admin_email'],
+ 'DEFAULT_GAME' => $eqdkp->config['default_game'],
+
+
+ // Language (General Settings)
+ 'L_GENERAL_SETTINGS' => $user->lang['general_settings'],
+ 'L_GUILDTAG' => $user->lang['guildtag'],
+ 'L_GUILDTAG_NOTE' => $user->lang['guildtag_note'],
+ 'L_PARSETAGS' => $user->lang['parsetags'],
+ 'L_PARSETAGS_NOTE' => $user->lang['parsetags_note'],
+ 'L_DOMAIN_NAME' => $user->lang['domain_name'],
+ 'L_SERVER_PORT' => $user->lang['server_port'],
+ 'L_SERVER_PORT_NOTE' => $user->lang['server_port_note'],
+ 'L_SCRIPT_PATH' => $user->lang['script_path'],
+ 'L_SCRIPT_PATH_NOTE' => $user->lang['script_path_note'],
+ 'L_SITE_NAME' => $user->lang['site_name'],
+ 'L_SITE_DESCRIPTION' => $user->lang['site_description'],
+ 'L_POINT_NAME' => $user->lang['point_name'],
+ 'L_POINT_NAME_NOTE' => $user->lang['point_name_note'],
+ 'L_ENABLE_ACCOUNT_ACTIVATION' => $user->lang['enable_account_activation'],
+ 'L_NONE' => $user->lang['none'],
+ 'L_USER' => $user->lang['user'],
+ 'L_ADMIN' => $user->lang['admin'],
+ 'L_ADJUSTMENTS_PER_PAGE' => $user->lang['adjustments_per_page'],
+ 'L_EVENTS_PER_PAGE' => $user->lang['events_per_page'],
+ 'L_ITEMS_PER_PAGE' => $user->lang['items_per_page'],
+ 'L_NEWS_PER_PAGE' => $user->lang['news_per_page'],
+ 'L_RAIDS_PER_PAGE' => $user->lang['raids_per_page'],
+ 'L_DEFAULT_LANGUAGE' => $user->lang['default_language'],
+ 'L_DEFAULT_GAME' => $user->lang['default_game'],
+ 'L_DEFAULT_GAME_WARN' => $user->lang['default_game_warn'],
+ 'L_DEFAULT_STYLE' => $user->lang['default_style'],
+ 'L_DEFAULT_PAGE' => $user->lang['default_page'],
+ 'L_DEFAULT_LOCALE' => $user->lang['default_locale'],
+ 'L_PREVIEW' => $user->lang['preview'],
+ 'L_HIDE_INACTIVE' => $user->lang['hide_inactive'],
+ 'L_HIDE_INACTIVE_NOTE' => $user->lang['hide_inactive_note'],
+ 'L_INACTIVE_PERIOD' => $user->lang['inactive_period'],
+ 'L_INACTIVE_PERIOD_NOTE' => $user->lang['inactive_period_note'],
+ 'L_ACTIVE_POINT_ADJ' => $user->lang['active_point_adj'],
+ 'L_ACTIVE_POINT_ADJ_NOTE' => $user->lang['active_point_adj_note'],
+ 'L_INACTIVE_POINT_ADJ' => $user->lang['inactive_point_adj'],
+ 'L_INACTIVE_POINT_ADJ_NOTE' => $user->lang['inactive_point_adj_note'],
+ 'L_ENABLE_GZIP' => $user->lang['enable_gzip'],
+
+ // Language (Default Permissions)
+ 'L_DEFAULT_PERMISSIONS' => $user->lang['default_permissions'],
+ 'L_DEFAULT_PERMISSIONS_NOTE' => $user->lang['default_permissions_note'],
+
+ // Language (Cookie Settings)
+ 'L_COOKIE_SETTINGS' => $user->lang['cookie_settings'],
+ 'L_COOKIE_DOMAIN' => $user->lang['cookie_domain'],
+ 'L_COOKIE_NAME' => $user->lang['cookie_name'],
+ 'L_COOKIE_PATH' => $user->lang['cookie_path'],
+ 'L_SESSION_LENGTH' => $user->lang['session_length'],
+
+ // Language (E-mail Settings)
+ 'L_EMAIL_SETTINGS' => $user->lang['email_settings'],
+ 'L_ADMIN_EMAIL' => $user->lang['admin_email'],
+
+ // Language
+ 'L_YES' => $user->lang['yes'],
+ 'L_NO' => $user->lang['no'],
+ 'L_SUBMIT' => $user->lang['submit'],
+ 'L_RESET' => $user->lang['reset'])
+ );
+
+ //
+ // Build language drop-down
+ //
+ if ( $dir = @opendir($eqdkp->root_path . 'language/') )
+ {
+ while ( $file = @readdir($dir) )
+ {
+ if ( (!is_file($eqdkp->root_path . 'language/' . $file)) && (!is_link($eqdkp->root_path . 'language/' . $file)) && ($file != '.') && ($file != '..') && ($file != 'CVS') && ($file != '.svn') )
+ {
+ $tpl->assign_block_vars('lang_row', array(
+ 'VALUE' => $file,
+ 'SELECTED' => ( $eqdkp->config['default_lang'] == $file ) ? ' selected="selected"' : '',
+ 'OPTION' => ucfirst($file))
+ );
+ }
+ }
+ }
+
+ //
+ // Build style drop-down
+ //
+ $sql = 'SELECT style_id, style_name
+ FROM ' . STYLES_TABLE . '
+ ORDER BY style_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $tpl->assign_block_vars('style_row', array(
+ 'VALUE' => $row['style_id'],
+ 'SELECTED' => ( $eqdkp->config['default_style'] == $row['style_id'] ) ? ' selected="selected"' : '',
+ 'OPTION' => $row['style_name'])
+ );
+ }
+ $db->free_result($result);
+
+
+ //
+ // Build game option drop-down
+ // New for 1.3
+ // Total hack job - I moved the class, race, and faction
+ // info to the db, but I'm hardcoding what games I support
+ // for the "button push" - what a tard I am :-)
+ // To add a new game option, just copy the 4 lines below,
+ // add them to the botton, increase the value of VALUE by 1,
+ // and be sure to set OPTION to the EXACT SAME THING you put
+ // in the == check in the SELECTED line and there must be
+ // no spaces in the name, since the value below gets changed
+ // to name.php and ran when you change it: for example,
+ // if you change to WoW, this program will redirect you to
+ // WoW.php and use that file to populate the database.
+ //
+ // Cheesy, but extensible and effective.
+ //
+
+ $tpl->assign_block_vars('game_row', array(
+ 'VALUE' => "Everquest",
+ 'SELECTED' => ( $eqdkp->config['default_game'] == "Everquest" ) ? ' selected="selected"' : '',
+ 'OPTION' => "Everquest") );
+
+ $tpl->assign_block_vars('game_row', array(
+ 'VALUE' => "Everquest2",
+ 'SELECTED' => ( $eqdkp->config['default_game'] == "Everquest2" ) ? ' selected="selected"' : '',
+ 'OPTION' => "Everquest2") );
+
+ $tpl->assign_block_vars('game_row', array(
+ 'VALUE' => "WoW",
+ 'SELECTED' => ( $eqdkp->config['default_game'] == "WoW" ) ? ' selected="selected"' : '',
+ 'OPTION' => "WoW") );
+
+ $tpl->assign_block_vars('game_row', array(
+ 'VALUE' => "DAoC",
+ 'SELECTED' => ( $eqdkp->config['default_game'] == "DAoC" ) ? ' selected="selected"' : '',
+ 'OPTION' => "DAoC") );
+
+ $tpl->assign_block_vars('game_row', array(
+ 'VALUE' => "Vanguard-SoH",
+ 'SELECTED' => ( $eqdkp->config['default_game'] == "Vanguard-SoH" ) ? ' selected="selected"' : '',
+ 'OPTION' => "Vanguard-SoH") );
+
+ // Default locale drop-down
+ // new for 1.3
+ // Dont forget to change the install script -- maybe query the system for all supported
+ // locales? that would break the "pretty" name of the locale (english, french, etc)
+ // but would provide greater support
+
+ $tpl->assign_block_vars('locale_row', array(
+ 'VALUE' => 'en_US',
+ 'SELECTED' => ( $eqdkp->config['default_locale'] == "en_US" ) ? ' selected="selected"' : '',
+ 'OPTION' => 'English'
+ ));
+
+ $tpl->assign_block_vars('locale_row', array(
+ 'VALUE' => 'de_DE',
+ 'SELECTED' => ( $eqdkp->config['default_locale'] == "de_DE" ) ? ' selected="selected"' : '',
+ 'OPTION' => 'German'
+ ));
+
+ $tpl->assign_block_vars('locale_row', array(
+ 'VALUE' => 'fr_FR',
+ 'SELECTED' => ( $eqdkp->config['default_locale'] == "fr_FR" ) ? ' selected="selected"' : '',
+ 'OPTION' => 'French'
+ ));
+
+
+ //
+ // Build start page drop-down
+ //
+ $menus = $eqdkp->gen_menus();
+ $pages = array_merge($menus['menu1'], $menus['menu2']);
+ unset($menus);
+
+ foreach ( $pages as $page )
+ {
+ $link = preg_replace('#\?' . URI_SESSION . '\=([0-9A-Za-z]{1,32})?#', '', $page['link']);
+ $link = preg_replace('#\.php&amp;#', '.php?', $link);
+
+ $text = ( isset($user->data['username']) ) ? str_replace($user->data['username'], $user->lang['username'], $page['text']) : $page['text'];
+
+ $tpl->assign_block_vars('page_row', array(
+ 'VALUE' => $link,
+ 'SELECTED' => ( $eqdkp->config['start_page'] == $link ) ? ' selected="selected"' : '',
+ 'OPTION' => $text)
+ );
+ unset($link, $text);
+ }
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['config_title'],
+ 'template_file' => 'admin/config.html',
+ 'display' => true)
+ );
+ }
+}
+
+$eqdkp_config = new EQdkp_Config;
+$eqdkp_config->process();
+?>
diff --git a/admin/fix_negative.php b/admin/fix_negative.php
new file mode 100644
index 0000000..9b3a3c7
--- /dev/null
+++ b/admin/fix_negative.php
@@ -0,0 +1,93 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2005
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * fix_negative.php
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+$eqdkp_root_path = './';
+include_once($eqdkp_root_path . 'common.php');
+
+$sql = "SELECT m.member_name, m.member_raidcount, count(ra.raid_id) AS cnt, sum(r.raid_value), m.member_earned
+ FROM " . RAIDS_TABLE . " r, " . RAID_ATTENDEES_TABLE . " ra, " . MEMBERS_TABLE . " m
+ WHERE ra.raid_id = r.raid_id
+ AND ra.member_name = m.member_name
+ GROUP BY m.member_name
+ HAVING m.member_raidcount <> cnt";
+
+if ( !($members_result = $db->query($sql)) )
+{
+ message_die('Could not obtain requested information', '', __FILE__, __LINE__, $sql);
+}
+
+while ( $row = $db->fetch_record($members_result) )
+{
+
+ print "Member: " . $row['member_name'] . " has " . $row['cnt'] . "
+ recorded raids in the raid_attendees table, but is only
+ accounted for in " . $row['member_raidcount'] . " raids
+ in him member table entry.<BR>";
+
+ $sql = "UPDATE ". MEMBERS_TABLE ." SET member_raidcount = ".$row['cnt']." WHERE member_name = '".$row['member_name']."'";
+ print $sql . "<BR><BR>";
+ $db->query($sql);
+}
+
+$sql = "DROP TABLE IF EXISTS tempqw_fixearned";
+
+if (!($return_code = $db->query($sql)))
+{
+ message_die('Could not run tha big command ', '', __FILE__, __LINE__, $sql);
+}
+
+$sql = "CREATE TABLE tempqw_fixearned (
+member_name varchar(30) NOT NULL UNIQUE,
+member_earned float(11,2) NOT NULL default '0.00',
+member_raidcount smallint(5) NOT NULL DEFAULT 0,
+PRIMARY KEY (member_name)
+)TYPE=InnoDB";
+
+if (!($return_code = $db->query($sql)))
+{
+ message_die('Could not run tha big command ', '', __FILE__, __LINE__, $sql);
+}
+
+
+$sql = "INSERT INTO tempqw_fixearned
+SELECT m.member_name, sum(r.raid_value), count(ra.raid_id)
+FROM " . MEMBERS_TABLE . " m, " . RAIDS_TABLE . " r, " . RAID_ATTENDEES_TABLE . " ra
+WHERE ra.raid_id = r.raid_id AND ra.member_name = m.member_name
+GROUP BY ra.member_name";
+
+if (!($return_code = $db->query($sql)))
+{
+ message_die('Could not run tha big command ', '', __FILE__, __LINE__, $sql);
+}
+
+
+$sql = "UPDATE " . MEMBERS_TABLE . " m, tempqw_fixearned f
+SET m.member_earned = f.member_earned
+WHERE m.member_name = f.member_name";
+
+if (!($return_code = $db->query($sql)))
+{
+ message_die('Could not run tha big command ', '', __FILE__, __LINE__, $sql);
+}
+
+
+$sql = "UPDATE " . MEMBERS_TABLE . " m, tempqw_fixearned f
+SET m.member_raidcount = f.member_raidcount
+WHERE m.member_name = f.member_name";
+
+if (!($return_code = $db->query($sql)))
+{
+ message_die('Could not run tha big command ', '', __FILE__, __LINE__, $sql);
+}
+
+
+
+?>
diff --git a/admin/index.php b/admin/index.php
new file mode 100644
index 0000000..0f84580
--- /dev/null
+++ b/admin/index.php
@@ -0,0 +1,680 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * index.php
+ * Began: Tue December 24 2002
+ *
+ * $Id: index.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+// IN_ADMIN not yet defined, display the main admin page
+if ( !defined('IN_ADMIN') )
+{
+ // ---------------------------------------------------------
+ // Function definitions
+ // ---------------------------------------------------------
+ /**
+ * 'Pretty-up' the Location field of the Who's Online list
+ * If we recognize the script they're on, return a more friendly
+ * location (like most modern forums do), otherwise just return the path
+ *
+ * @param string $page Page URL
+ * @return string
+ */
+ function resolve_eqdkp_page($page)
+ {
+ global $db, $eqdkp, $user, $SID;
+
+ $matches = explode('&', $page);
+
+ if ( !empty($matches[0]) )
+ {
+ // See if we recognize the page/script we're on
+ switch ( $matches[0] )
+ {
+ // ---------------------------------------------------------
+ // Admin
+ // ---------------------------------------------------------
+ case 'addadj':
+ $page = $user->lang['adding_groupadj'];
+ if ( (!empty($matches[1])) && (preg_match('/^' . URI_ADJUSTMENT . '=([0-9]{1,})/', $matches[1], $adjustment_id)) )
+ {
+ $page = $user->lang['editing_groupadj'] . ': ';
+ $page .= '<a href="addadj.php' . $SID . '&amp;' . URI_ADJUSTMENT . '=' . $adjustment_id[1] . '">' . $adjustment_id[1] . '</a>';
+ }
+ break;
+ // ---------------------------------------------------------
+ case 'addiadj':
+ $page = $user->lang['adding_indivadj'];
+ if ( (!empty($matches[1])) && (preg_match('/^' . URI_ADJUSTMENT . '=([0-9]{1,})/', $matches[1], $adjustment_id)) )
+ {
+ $page = $user->lang['editing_indivadj'] . ': ';
+ $page .= '<a href="addiadj.php' . $SID . '&amp;' . URI_ADJUSTMENT . '=' . $adjustment_id[1] . '">' . $adjustment_id[1] . '</a>';
+ }
+ break;
+ // ---------------------------------------------------------
+ case 'additem':
+ $page = $user->lang['adding_item'];
+ if ( (!empty($matches[1])) && (preg_match('/^' . URI_ITEM . '=([0-9]{1,})/', $matches[1], $item_id)) )
+ {
+ $item_name = get_item_name($item_id[1]);
+ $page = $user->lang['editing_item'] . ': ';
+ $page .= '<a href="additem.php' . $SID . '&amp;' . URI_ITEM . '=' . $item_id[1] . '">' . $item_name . '</a>';
+ }
+ break;
+ // ---------------------------------------------------------
+ case 'addnews':
+ $page = $user->lang['adding_news'];
+ if ( (!empty($matches[1])) && (preg_match('/^' . URI_NEWS . '=([0-9]{1,})/', $matches[1], $news_id)) )
+ {
+ $news_name = get_news_name($news_id[1]);
+ $page = $user->lang['editing_item'] . ': ';
+ $page .= '<a href="addnews.php' . $SID . '&amp;' . URI_NEWS . '=' . $news_id[1] . '">' . $news_name . '</a>';
+ }
+ break;
+ // ---------------------------------------------------------
+ case 'addraid':
+ $page = $user->lang['adding_raid'];
+
+ if ( (!empty($matches[1])) && (preg_match('/^' . URI_RAID . '=([0-9]{1,})/', $matches[1], $raid_id)) )
+ {
+ $raid_name = get_raid_name($raid_id[1]);
+ $page = $user->lang['editing_raid'] . ': ';
+ $page .= '<a href="addraid.php' . $SID . '&amp;' . URI_RAID . '=' . $raid_id[1] . '">' . $raid_name . '</a>';
+ }
+ break;
+ // ---------------------------------------------------------
+ case 'addturnin':
+ $page = $user->lang['adding_turnin'];
+ break;
+ // ---------------------------------------------------------
+ case 'config':
+ $page = $user->lang['managing_config'];
+ break;
+ // ---------------------------------------------------------
+ case 'index':
+ $page = $user->lang['viewing_admin_index'];
+ break;
+ // ---------------------------------------------------------
+ case 'logs':
+ $page = $user->lang['viewing_logs'];
+ break;
+ // ---------------------------------------------------------
+ case 'manage_members':
+ $page = $user->lang['managing_members'];
+ break;
+ // ---------------------------------------------------------
+ case 'manage_users':
+ $page = $user->lang['managing_users'];
+ break;
+ // ---------------------------------------------------------
+ case 'mysql_info':
+ $page = $user->lang['viewing_mysql_info'];
+ break;
+ // ---------------------------------------------------------
+ case 'plugins':
+ $page = $user->lang['managing_plugins'];
+ break;
+ // ---------------------------------------------------------
+ case 'styles':
+ $page = $user->lang['managing_styles'];
+ break;
+
+ // ---------------------------------------------------------
+ // Listing
+ // ---------------------------------------------------------
+ case 'listadj':
+ if ( (empty($matches[1])) || ($matches[1] == 'group') )
+ {
+ $page = $user->lang['listing_groupadj'];
+ }
+ else
+ {
+ $page = $user->lang['listing_indivadj'];
+ }
+ break;
+ // ---------------------------------------------------------
+ case 'listevents':
+ $page = $user->lang['listing_events'];
+ break;
+ // ---------------------------------------------------------
+ case 'listitems':
+ if ( (empty($matches[1])) || ($matches[1] == 'values') )
+ {
+ $page = $user->lang['listing_itemvals'];
+ }
+ else
+ {
+ $page = $user->lang['listing_itemhist'];
+ }
+ break;
+ // ---------------------------------------------------------
+ case 'listmembers':
+ $page = $user->lang['listing_members'];
+ break;
+ // ---------------------------------------------------------
+ case 'listraids':
+ $page = $user->lang['listing_raids'];
+ break;
+
+ // ---------------------------------------------------------
+ // Misc
+ // ---------------------------------------------------------
+ case 'parse_log':
+ $page = $user->lang['parsing_log'];
+ break;
+
+ case 'stats':
+ $page = $user->lang['viewing_stats'];
+ break;
+
+ case 'summary':
+ $page = $user->lang['viewing_summary'];
+ break;
+
+ // ---------------------------------------------------------
+ // Viewing
+ // ---------------------------------------------------------
+ case 'viewevent':
+ $page = $user->lang['viewing_event'] . ': ';
+ if ( !empty($matches[1]) )
+ {
+ preg_match('/^' . URI_EVENT . '=([0-9]{1,})/', $matches[1], $event_id);
+ $event_name = get_event_name($event_id[1]);
+ $page .= '<a href="../viewevent.php' . $SID . '&amp;' . URI_EVENT . '=' . $event_id[1] . '" target="_top">' . $event_name . '</a>';
+ }
+ break;
+ // ---------------------------------------------------------
+ case 'viewitem':
+ $page = $user->lang['viewing_item'] . ': ';
+ if ( !empty($matches[1]) )
+ {
+ preg_match('/^' . URI_ITEM . '=([0-9]{1,})/', $matches[1], $item_id);
+ $item_name = get_item_name($item_id[1]);
+ $page .= '<a href="../viewitem.php' . $SID . '&amp;' . URI_ITEM . '=' . $item_id[1] . '" target="_top">' . $item_name . '</a>';
+ }
+ break;
+ // ---------------------------------------------------------
+ case 'viewnews':
+ $page = $user->lang['viewing_news'];
+ break;
+ // ---------------------------------------------------------
+ case 'viewmember':
+ $page = $user->lang['viewing_member'] . ': ';
+ if ( !empty($matches[1]) )
+ {
+ preg_match('/^' . URI_NAME . '=([A-Za-z]{1,})/', $matches[1], $member_name);
+ $page .= '<a href="../viewmember.php' . $SID . '&amp;' . URI_NAME . '=' . $member_name[1] . '" target="_top">' . $member_name[1] . '</a>';
+ }
+ break;
+ // ---------------------------------------------------------
+ case 'viewraid':
+ $page = $user->lang['viewing_raid'] . ': ';
+ if ( !empty($matches[1]) )
+ {
+ preg_match('/^' . URI_RAID . '=([0-9]{1,})/', $matches[1], $raid_id);
+ $raid_name = get_raid_name($raid_id[1]);
+ $page .= '<a href="../viewraid.php' . $SID . '&amp;' . URI_RAID . '=' . $raid_id[1] . '" target="_top">' . $raid_name . '</a>';
+ }
+ break;
+ }
+ }
+
+ return $page;
+ }
+
+ function get_event_name($event_id)
+ {
+ global $db;
+
+ $event_id = intval($event_id);
+
+ $sql = 'SELECT event_name FROM ' . EVENTS_TABLE . " WHERE event_id='" . $event_id . "'";
+ $event_name = $db->query_first($sql);
+
+ return ( !empty($event_name) ) ? $event_name : 'Unknown';
+ }
+
+ function get_item_name($item_id)
+ {
+ global $db;
+
+ $item_id = intval($item_id);
+
+ $sql = 'SELECT item_name FROM ' . ITEMS_TABLE . " WHERE item_id='" . $item_id . "'";
+ $item_name = $db->query_first($sql);
+
+ return ( !empty($item_name) ) ? $item_name : 'Unknown';
+ }
+
+ function get_news_name($news_id)
+ {
+ global $db;
+
+ $news_id = intval($news_id);
+
+ $sql = 'SELECT news_headline FROM ' . NEWS_TABLE . " WHERE news_id='" . $news_id . "'";
+ $news_name = $db->query_first($sql);
+
+ return ( !empty($news_name) ) ? $news_name : 'Unknown';
+ }
+
+ function get_raid_name($raid_id)
+ {
+ global $db;
+
+ $raid_id = intval($raid_id);
+
+ $sql = 'SELECT raid_name FROM ' . RAIDS_TABLE . " WHERE raid_id='" . $raid_id . "'";
+ $raid_name = $db->query_first($sql);
+
+ return ( !empty($raid_name) ) ? $raid_name : 'Unknown';
+ }
+
+ function get_eqdkp_version()
+ {
+ // Try and get the latest EQdkp version from EQdkp.com
+ $sh = @fsockopen('eqdkp.com', 80, $errno, $error, 5);
+ if ( !$sh )
+ {
+ return EQDKP_VERSION;
+ }
+ else
+ {
+ @fputs($sh, "GET /version.php HTTP/1.1\r\nHost: eqdkp.com\r\nConnection: close\r\n\r\n");
+ while ( !feof($sh) )
+ {
+ $content = @fgets($sh, 512);
+ if ( preg_match('/<version>(.*)<\/version>/', $content, $version) )
+ {
+ return $version[1];
+ }
+ }
+ }
+ @fclose($sh);
+
+ return EQDKP_VERSION;
+ }
+
+ // ---------------------------------------------------------
+ // Display the main admin page
+ // ---------------------------------------------------------
+
+ define('EQDKP_INC', true);
+ define('IN_ADMIN', true);
+ $eqdkp_root_path = './../';
+ include_once($eqdkp_root_path . 'common.php');
+
+ $user->check_auth('a_');
+
+ $days = ((time() - $eqdkp->config['eqdkp_start']) / 86400);
+
+ $total_members_inactive = $db->query_first('SELECT count(*) FROM ' . MEMBERS_TABLE . " where member_status='0'");
+ $total_members_active = $db->query_first('SELECT count(*) FROM ' . MEMBERS_TABLE . " where member_status='1'");
+ $total_members = $total_members_active . ' / ' . $total_members_inactive;
+
+ $total_raids = $db->query_first('SELECT count(*) FROM ' . RAIDS_TABLE);
+ $raids_per_day = sprintf("%.2f", ($total_raids / $days));
+
+ $total_items = $db->query_first('SELECT count(*) FROM ' . ITEMS_TABLE);
+ $items_per_day = sprintf("%.2f", ($total_items / $days));
+
+ $total_logs = $db->query_first('SELECT count(*) FROM ' . LOGS_TABLE);
+
+ if ( $raids_per_day > $total_raids )
+ {
+ $raids_per_day = $total_raids;
+ }
+ if ( $items_per_day > $total_items )
+ {
+ $items_per_day = $total_items;
+ }
+
+ // DB Size - MySQL Only
+ if ( DBTYPE == 'mysql' )
+ {
+ $result = $db->query('SELECT VERSION() AS mysql_version');
+
+ if ( $row = $db->fetch_record($result) )
+ {
+ $version = $row['mysql_version'];
+
+ if ( preg_match('/^(3\.23|4\.)/', $version) )
+ {
+ $db_name = ( preg_match('/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)/', $version) ) ? "`$dbname`" : $dbname;
+
+ $sql = 'SHOW TABLE STATUS
+ FROM ' . $db_name;
+ $result = $db->query($sql);
+
+ $dbsize = 0;
+ while ( $row = $db->fetch_record($result) )
+ {
+ if ( $row['Type'] != 'MRG_MyISAM' )
+ {
+ if ( $table_prefix != '' )
+ {
+ if ( strstr($row['Name'], $table_prefix) )
+ {
+ $dbsize += $row['Data_length'] + $row['Index_length'];
+ }
+ }
+ else
+ {
+ $dbsize += $row['Data_length'] + $row['Index_length'];
+ }
+ }
+ }
+ }
+ else
+ {
+ $dbsize = $user->lang['not_available'];
+ }
+ }
+ else
+ {
+ $dbsize = $user->lang['not_available'];
+ }
+ }
+ else
+ {
+ $dbsize = $user->lang['not_available'];
+ }
+
+ if ( is_int($dbsize) )
+ {
+ $dbsize = ( $dbsize >= 1048576 ) ? sprintf('%.2f MB', ($dbsize / 1048576)) : (($dbsize >= 1024) ? sprintf('%.2f KB', ($dbsize / 1024)) : sprintf('%.2f Bytes', $dbsize));
+ }
+
+ //
+ // Who's Online
+ //
+ $sql = 'SELECT s.*, u.username
+ FROM ( ' . SESSIONS_TABLE . ' s
+ LEFT JOIN ' . USERS_TABLE . ' u
+ ON u.user_id = s.session_user_id )
+ GROUP BY u.username, s.session_ip
+ ORDER BY u.username, s.session_current DESC';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $session_page = resolve_eqdkp_page($row['session_page']);
+
+ $tpl->assign_block_vars('online_row', array(
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'USERNAME' => ( !empty($row['username']) ) ? $row['username'] : $user->lang['anonymous'],
+ 'LOGIN' => date($user->style['date_time'], $row['session_start']),
+ 'LAST_UPDATE' => date($user->style['date_time'], $row['session_current']),
+ 'LOCATION' => $session_page,
+ 'IP_ADDRESS' => $row['session_ip'])
+ );
+ }
+ $online_count = $db->num_rows($result);
+
+ // Log Actions
+ $s_logs = false;
+ if ( $user->check_auth('a_logs_view', false) )
+ {
+ if ( $total_logs > 0 )
+ {
+ $sql = 'SELECT l.*, u.username
+ FROM ' . LOGS_TABLE . ' l, ' . USERS_TABLE . ' u
+ WHERE u.user_id=l.admin_id
+ ORDER BY l.log_date DESC
+ LIMIT 10';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ eval($row['log_action']);
+
+ switch ( $row['log_type'] )
+ {
+ case '{L_ACTION_EVENT_ADDED}':
+ $logline = sprintf($user->lang['vlog_event_added'], $row['username'], $log_action['{L_NAME}'], $log_action['{L_VALUE}']);
+ break;
+ case '{L_ACTION_EVENT_UPDATED}':
+ $logline = sprintf($user->lang['vlog_event_updated'], $row['username'], $log_action['{L_NAME_BEFORE}']);
+ break;
+ case '{L_ACTION_EVENT_DELETED}':
+ $logline = sprintf($user->lang['vlog_event_deleted'], $row['username'], $log_action['{L_NAME}']);
+ break;
+ case '{L_ACTION_GROUPADJ_ADDED}':
+ $logline = sprintf($user->lang['vlog_groupadj_added'], $row['username'], $log_action['{L_ADJUSTMENT}']);
+ break;
+ case '{L_ACTION_GROUPADJ_UPDATED}':
+ $logline = sprintf($user->lang['vlog_groupadj_updated'], $row['username'], $log_action['{L_ADJUSTMENT_BEFORE}']);
+ break;
+ case '{L_ACTION_GROUPADJ_DELETED}':
+ $logline = sprintf($user->lang['vlog_groupadj_deleted'], $row['username'], $log_action['{L_ADJUSTMENT}']);
+ break;
+ case '{L_ACTION_HISTORY_TRANSFER}':
+ $logline = sprintf($user->lang['vlog_history_transfer'], $row['username'], $log_action['{L_FROM}'], $log_action['{L_TO}']);
+ break;
+ case '{L_ACTION_INDIVADJ_ADDED}':
+ $logline = sprintf($user->lang['vlog_indivadj_added'], $row['username'], $log_action['{L_ADJUSTMENT}'], count(explode(', ', $log_action['{L_MEMBERS}'])));
+ break;
+ case '{L_ACTION_INDIVADJ_UPDATED}':
+ $logline = sprintf($user->lang['vlog_indivadj_updated'], $row['username'], $log_action['{L_ADJUSTMENT_BEFORE}'], $log_action['{L_MEMBERS_BEFORE}']);
+ break;
+ case '{L_ACTION_INDIVADJ_DELETED}':
+ $logline = sprintf($user->lang['vlog_indivadj_deleted'], $row['username'], $log_action['{L_ADJUSTMENT}'], $log_action['{L_MEMBERS}']);
+ break;
+ case '{L_ACTION_ITEM_ADDED}':
+ $logline = sprintf($user->lang['vlog_item_added'], $row['username'], $log_action['{L_NAME}'], count(explode(', ', $log_action['{L_BUYERS}'])), $log_action['{L_VALUE}']);
+ break;
+ case '{L_ACTION_ITEM_UPDATED}':
+ $logline = sprintf($user->lang['vlog_item_updated'], $row['username'], $log_action['{L_NAME_BEFORE}'], count(explode(', ', $log_action['{L_BUYERS_BEFORE}'])));
+ break;
+ case '{L_ACTION_ITEM_DELETED}':
+ $logline = sprintf($user->lang['vlog_item_deleted'], $row['username'], $log_action['{L_NAME}'], count(explode(', ', $log_action['{L_BUYERS}'])));
+ break;
+ case '{L_ACTION_MEMBER_ADDED}':
+ $logline = sprintf($user->lang['vlog_member_added'], $row['username'], $log_action['{L_NAME}']);
+ break;
+ case '{L_ACTION_MEMBER_UPDATED}':
+ $logline = sprintf($user->lang['vlog_member_updated'], $row['username'], $log_action['{L_NAME_BEFORE}']);
+ break;
+ case '{L_ACTION_MEMBER_DELETED}':
+ $logline = sprintf($user->lang['vlog_member_deleted'], $row['username'], $log_action['{L_NAME}']);
+ break;
+ case '{L_ACTION_NEWS_ADDED}':
+ $logline = sprintf($user->lang['vlog_news_added'], $row['username'], $log_action['{L_HEADLINE}']);
+ break;
+ case '{L_ACTION_NEWS_UPDATED}':
+ $logline = sprintf($user->lang['vlog_news_updated'], $row['username'], $log_action['{L_HEADLINE_BEFORE}']);
+ break;
+ case '{L_ACTION_NEWS_DELETED}':
+ $logline = sprintf($user->lang['vlog_news_deleted'], $row['username'], $log_action['{L_HEADLINE}']);
+ break;
+ case '{L_ACTION_RAID_ADDED}':
+ $logline = sprintf($user->lang['vlog_raid_added'], $row['username'], $log_action['{L_EVENT}']);
+ break;
+ case '{L_ACTION_RAID_UPDATED}':
+ $logline = sprintf($user->lang['vlog_raid_updated'], $row['username'], $log_action['{L_EVENT_BEFORE}']);
+ break;
+ case '{L_ACTION_RAID_DELETED}':
+ $logline = sprintf($user->lang['vlog_raid_deleted'], $row['username'], $log_action['{L_EVENT}']);
+ break;
+ case '{L_ACTION_TURNIN_ADDED}':
+ $logline = sprintf($user->lang['vlog_turnin_added'], $row['username'], $log_action['{L_FROM}'], $log_action['{L_TO}'], $log_action['{L_ITEM}']);
+ break;
+ }
+ unset($log_action);
+
+ // Show the log if we have a valid line for it
+ if ( isset($logline) )
+ {
+ $tpl->assign_block_vars('actions_row', array(
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'U_VIEW_LOG' => 'logs.php?' . URI_LOG . '='.$row['log_id'],
+ 'ACTION' => stripslashes($logline))
+ );
+ }
+ unset($logline);
+ }
+ $db->free_result($result);
+
+ $s_logs = true;
+ }
+ }
+
+ $eqdkp_com_version = EQDKP_VERSION;
+
+ $tpl->assign_vars(array(
+ 'S_NEW_VERSION' => ( $eqdkp_com_version != EQDKP_VERSION ) ? true : false,
+ 'S_LOGS' => $s_logs,
+
+ 'L_VERSION_UPDATE' => $user->lang['version_update'],
+ 'L_NEW_VERSION_NOTICE' => sprintf($user->lang['new_version_notice'], $eqdkp_com_version),
+ 'L_STATISTICS' => $user->lang['statistics'],
+ 'L_NUMBER_OF_MEMBERS' => $user->lang['number_of_members'],
+ 'L_NUMBER_OF_RAIDS' => $user->lang['number_of_raids'],
+ 'L_NUMBER_OF_ITEMS' => $user->lang['number_of_items'],
+ 'L_DATABASE_SIZE' => $user->lang['database_size'],
+ 'L_NUMBER_OF_LOGS' => $user->lang['number_of_logs'],
+ 'L_RAIDS_PER_DAY' => $user->lang['raids_per_day'],
+ 'L_ITEMS_PER_DAY' => $user->lang['items_per_day'],
+ 'L_EQDKP_STARTED' => $user->lang['eqdkp_started'],
+
+ 'NUMBER_OF_MEMBERS' => $total_members,
+ 'NUMBER_OF_RAIDS' => $total_raids,
+ 'NUMBER_OF_ITEMS' => $total_items,
+ 'DATABASE_SIZE' => $dbsize,
+ 'NUMBER_OF_LOGS' => $total_logs,
+ 'RAIDS_PER_DAY' => $raids_per_day,
+ 'ITEMS_PER_DAY' => $items_per_day,
+ 'EQDKP_STARTED' => date($user->style['date_time'], $eqdkp->config['eqdkp_start']),
+
+ 'L_WHO_ONLINE' => $user->lang['who_online'],
+ 'L_USERNAME' => $user->lang['username'],
+ 'L_LOGIN' => $user->lang['login'],
+ 'L_LAST_UPDATE' => $user->lang['last_update'],
+ 'L_LOCATION' => $user->lang['location'],
+ 'L_IP_ADDRESS' => $user->lang['ip_address'],
+
+ 'L_NEW_ACTIONS' => $user->lang['new_actions'],
+
+ 'ONLINE_FOOTCOUNT' => sprintf($user->lang['online_footcount'], $online_count))
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => $user->lang['admin_index_title'],
+ 'template_file' => 'admin/admin_index.html',
+ 'display' => true)
+ );
+}
+// IN_ADMIN already defined, just output the menu
+else
+{
+ // Build a dynamic admin menu
+ // Credit to draelon for the idea and original implementation
+ // 0 = header
+ // 1 - n = array(link, text, auth_check)
+ $admin_menu = array(
+ 'events' => array(
+ 0 => $user->lang['events'],
+ 1 => array('link' => 'admin/addevent.php' . $SID, 'text' => $user->lang['add'], 'check' => 'a_event_add'),
+ 2 => array('link' => 'admin/listevents.php' . $SID, 'text' => $user->lang['list'], 'check' => 'a_event_')
+ ),
+ 'groupadj' => array(
+ 0 => $user->lang['group_adjustments'],
+ 1 => array('link' => 'admin/addadj.php' . $SID, 'text' => $user->lang['add'], 'check' => 'a_groupadj_add'),
+ 2 => array('link' => 'admin/listadj.php' . $SID, 'text' => $user->lang['list'], 'check' => 'a_groupadj_')
+ ),
+ 'indivadj' => array(
+ 0 => $user->lang['individual_adjustments'],
+ 1 => array('link' => 'admin/addiadj.php' . $SID, 'text' => $user->lang['add'], 'check' => 'a_indivadj_add'),
+ 2 => array('link' => 'admin/listadj.php' . $SID . '&amp;' . URI_PAGE . '=individual', 'text' => $user->lang['list'], 'check' => 'a_indivadj_')
+ ),
+ 'items' => array(
+ 0 => $user->lang['items'],
+ 1 => array('link' => 'admin/additem.php' . $SID, 'text' => $user->lang['add'], 'check' => 'a_item_add'),
+ 2 => array('link' => 'admin/listitems.php' . $SID, 'text' => $user->lang['list'], 'check' => 'a_item_')
+ ),
+ 'mysql' => array(
+ 0 => $user->lang['mysql'],
+ 1 => array('link' => 'admin/mysql_info.php' . $SID, 'text' => $user->lang['mysql_info'], 'check' => ''),
+ 2 => array('link' => 'admin/backup.php' . $SID, 'text' => $user->lang['backup'], 'check' => 'a_backup')
+ ),
+ 'news' => array(
+ 0 => $user->lang['news'],
+ 1 => array('link' => 'admin/addnews.php' . $SID, 'text' => $user->lang['add'], 'check' => 'a_news_add'),
+ 2 => array('link' => 'admin/listnews.php' . $SID, 'text' => $user->lang['list'], 'check' => 'a_news_')
+ ),
+ 'raids' => array(
+ 0 => $user->lang['raids'],
+ 1 => array('link' => 'admin/addraid.php' . $SID, 'text' => $user->lang['add'], 'check' => 'a_raid_add'),
+ 2 => array('link' => 'admin/listraids.php' . $SID, 'text' => $user->lang['list'], 'check' => 'a_raid_'),
+ ),
+ 'turnin' => array(
+ 0 => $user->lang['turn_ins'],
+ 1 => array('link' => 'admin/addturnin.php' . $SID, 'text' => $user->lang['add'], 'check' => 'a_turnin_add')
+ ),
+ 'general' => array(
+ 0 => $user->lang['general_admin'],
+ 1 => array('link' => 'admin/config.php' . $SID, 'text' => $user->lang['configuration'], 'check' => 'a_config_man'),
+ 2 => array('link' => 'admin/manage_members.php' . $SID, 'text' => $user->lang['manage_members'], 'check' => 'a_members_man'),
+ 3 => array('link' => 'admin/plugins.php' . $SID, 'text' => $user->lang['manage_plugins'], 'check' => 'a_plugins_man'),
+ 4 => array('link' => 'admin/manage_users.php' . $SID, 'text' => $user->lang['manage_users'], 'check' => 'a_users_man'),
+ 5 => array('link' => 'admin/logs.php' . $SID, 'text' => $user->lang['view_logs'], 'check' => 'a_logs_view')
+ ),
+ 'styles' => array(
+ 0 => $user->lang['styles'],
+ 1 => array('link' => 'admin/styles.php' . $SID . '&amp;mode=create', 'text' => $user->lang['create'], 'check' => 'a_styles_man'),
+ 2 => array('link' => 'admin/styles.php' . $SID, 'text' => $user->lang['manage'], 'check' => 'a_styles_man')
+ )
+ );
+
+ // Now get plugin hooks for the menu
+ $admin_menu = (is_array($pm->get_menus('admin_menu'))) ? array_merge($admin_menu, $pm->get_menus('admin_menu')) : $admin_menu;
+
+ // Sort the array by the keys to make it alphabetical by header (essentially)
+ // Note: I considered using the header as the key itself, but this could
+ // possibly break PHP if non-standard characters were used when another language
+ // was in use.
+ ksort($admin_menu);
+ reset($admin_menu);
+
+ foreach ( $admin_menu as $k => $v )
+ {
+ // Restart next loop if the element isn't an array we can use
+ if ( !is_array($v) )
+ {
+ continue;
+ }
+
+ // Set the header with the first element
+ $tpl->assign_block_vars('header_row', array(
+ 'HEADER' => $v[0])
+ );
+
+ foreach ( $v as $k2 => $row )
+ {
+ // Ignore the first element (header)
+ if ( $k2 == 0 )
+ {
+ continue;
+ }
+
+ // Show the link if they have permission to use it
+ if ( ($row['check'] == '') || ($user->check_auth($row['check'], false)) )
+ {
+ $tpl->assign_block_vars('header_row.menu_row', array(
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'LINK' => '<a href="' . $eqdkp_root_path . $row['link'] . '">' . $row['text'] . '</a>')
+ );
+ }
+ }
+ }
+
+ $tpl->assign_vars(array(
+ 'L_ADMINISTRATION' => $user->lang['administration'],
+ 'L_ADMIN_INDEX' => $user->lang['admin_index'],
+ 'L_EQDKP_INDEX' => $user->lang['eqdkp_index'])
+ );
+}
+?>
diff --git a/admin/listadj.php b/admin/listadj.php
new file mode 100644
index 0000000..d1e4618
--- /dev/null
+++ b/admin/listadj.php
@@ -0,0 +1,130 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * listadj.php
+ * Began: Fri December 27 2002
+ *
+ * $Id: listadj.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+$sort_order = array(
+ 0 => array('adjustment_date desc', 'adjustment_date'),
+ 1 => array('member_name', 'member_name desc'),
+ 2 => array('adjustment_reason', 'adjustment_reason desc'),
+ 3 => array('adjustment_value desc', 'adjustment_value'),
+ 4 => array('adjustment_added_by', 'adjustment_added_by desc')
+);
+
+$current_order = switch_order($sort_order);
+
+//
+// Group Adjustments
+//
+if ( (!isset($_GET[URI_PAGE])) || ($_GET[URI_PAGE] == 'group') )
+{
+ $user->check_auth('a_groupadj_');
+
+ $u_list_adjustments = 'listadj.php'.$SID.'&amp;';
+
+ $page_title = sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['listadj_title'];
+
+ $total_adjustments = $db->query_first('SELECT count(*) FROM ' . ADJUSTMENTS_TABLE . ' WHERE member_name IS NULL');
+ $start = ( isset($_GET['start']) ) ? $_GET['start'] : 0;
+
+ $s_group_adj = true;
+
+ $sql = 'SELECT adjustment_id, adjustment_value, adjustment_date, adjustment_added_by
+ FROM ' . ADJUSTMENTS_TABLE . '
+ WHERE member_name IS NULL
+ ORDER BY '.$current_order['sql'].'
+ LIMIT '.$start.','.$user->data['user_alimit'];
+
+ $listadj_footcount = sprintf($user->lang['listadj_footcount'], $total_adjustments, $user->data['user_alimit']);
+ $pagination = generate_pagination('listadj.php'.$SID.'&amp;o='.$current_order['uri']['current'],
+ $total_adjustments, $user->data['user_alimit'], $start);
+}
+
+//
+// Individual Adjustments
+//
+elseif ( $_GET[URI_PAGE] == 'individual' )
+{
+ $user->check_auth('a_indivadj_');
+
+ $u_list_adjustments = 'listadj.php'.$SID.'&amp;' . URI_PAGE . '=individual&amp;';
+
+ $page_title = sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['listiadj_title'];
+
+ $total_adjustments = $db->query_first('SELECT count(*) FROM ' . ADJUSTMENTS_TABLE . ' WHERE member_name IS NOT NULL');
+ $start = ( isset($_GET['start']) ) ? $_GET['start'] : 0;
+
+ $s_group_adj = false;
+
+ $sql = 'SELECT adjustment_id, adjustment_value, member_name, adjustment_reason, adjustment_date, adjustment_added_by
+ FROM ' . ADJUSTMENTS_TABLE . '
+ WHERE member_name IS NOT NULL
+ ORDER BY '.$current_order['sql'].'
+ LIMIT '.$start.','.$user->data['user_alimit'];
+
+ $listadj_footcount = sprintf($user->lang['listiadj_footcount'], $total_adjustments, $user->data['user_alimit']);
+ $pagination = generate_pagination('listadj.php'.$SID.'&amp;' . URI_PAGE . '=individual&amp;o='.$current_order['uri']['current'],
+ $total_adjustments, $user->data['user_alimit'], $start);
+}
+
+if ( !($adj_result = $db->query($sql)) )
+{
+ message_die('Could not obtain adjustment information', '', __FILE__, __LINE__, $sql);
+}
+
+while ( $adj = $db->fetch_record($adj_result) )
+{
+ $tpl->assign_block_vars('adjustments_row', array(
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'U_ADD_ADJUSTMENT' => (( $s_group_adj ) ? 'addadj.php' : 'addiadj.php') . $SID.'&amp;' . URI_ADJUSTMENT . '='.$adj['adjustment_id'],
+ 'DATE' => date($user->style['date_notime_short'], $adj['adjustment_date']),
+ 'U_VIEW_MEMBER' => ( isset($adj['member_name']) ) ? $eqdkp_root_path.'viewmember.php'.$SID.'&amp;' . URI_NAME . '='.$adj['member_name'] : '',
+ 'MEMBER' => ( isset($adj['member_name']) ) ? $adj['member_name'] : '',
+ 'REASON' => ( isset($adj['adjustment_reason']) ) ? stripslashes($adj['adjustment_reason']) : '',
+ 'ADJUSTMENT' => $adj['adjustment_value'],
+ 'C_ADJUSTMENT' => color_item($adj['adjustment_value']),
+ 'ADDED_BY' => ( isset($adj['adjustment_added_by']) ) ? $adj['adjustment_added_by'] : '')
+ );
+}
+$db->free_result($adj_result);
+
+$tpl->assign_vars(array(
+ 'L_DATE' => $user->lang['date'],
+ 'L_MEMBER' => $user->lang['member'],
+ 'L_REASON' => $user->lang['reason'],
+ 'L_ADJUSTMENT' => $user->lang['adjustment'],
+ 'L_ADDED_BY' => $user->lang['added_by'],
+
+ 'O_DATE' => $current_order['uri'][0],
+ 'O_MEMBER' => $current_order['uri'][1],
+ 'O_REASON' => $current_order['uri'][2],
+ 'O_ADJUSTMENT' => $current_order['uri'][3],
+ 'O_ADDED_BY' => $current_order['uri'][4],
+
+ 'U_LIST_ADJUSTMENTS' => $u_list_adjustments,
+
+ 'START' => $start,
+ 'S_GROUP_ADJ' => $s_group_adj,
+ 'LISTADJ_FOOTCOUNT' => $listadj_footcount,
+ 'ADJUSTMENT_PAGINATION' => $pagination)
+);
+
+$eqdkp->set_vars(array(
+ 'page_title' => $page_title,
+ 'template_file' => 'admin/listadj.html',
+ 'display' => true)
+);
+?> \ No newline at end of file
diff --git a/admin/listevents.php b/admin/listevents.php
new file mode 100644
index 0000000..139081e
--- /dev/null
+++ b/admin/listevents.php
@@ -0,0 +1,71 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * listevents.php
+ * Began: Fri December 27 2002
+ *
+ * $Id: listevents.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+$user->check_auth('a_event_');
+
+$sort_order = array(
+ 0 => array('event_name', 'event_name desc'),
+ 1 => array('event_value desc', 'event_value')
+);
+
+$current_order = switch_order($sort_order);
+
+$total_events = $db->query_first('SELECT count(*) FROM ' . EVENTS_TABLE);
+
+$start = ( isset($_GET['start']) ) ? $_GET['start'] : 0;
+
+$sql = 'SELECT event_id, event_name, event_value
+ FROM ' . EVENTS_TABLE . '
+ ORDER BY '.$current_order['sql']. '
+ LIMIT '.$start.','.$user->data['user_elimit'];
+
+if ( !($events_result = $db->query($sql)) )
+{
+ message_die('Could not obtain event information', '', __FILE__, __LINE__, $sql);
+}
+while ( $event = $db->fetch_record($events_result) )
+{
+ $tpl->assign_block_vars('events_row', array(
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'U_VIEW_EVENT' => 'addevent.php'.$SID . '&amp;' . URI_EVENT . '='.$event['event_id'],
+ 'NAME' => stripslashes($event['event_name']),
+ 'VALUE' => $event['event_value'])
+ );
+}
+$db->free_result($events_result);
+
+$tpl->assign_vars(array(
+ 'L_NAME' => $user->lang['name'],
+ 'L_VALUE' => $user->lang['value'],
+
+ 'O_NAME' => $current_order['uri'][0],
+ 'O_VALUE' => $current_order['uri'][1],
+
+ 'U_LIST_EVENTS' => 'listevents.php'.$SID.'&amp;',
+
+ 'START' => $start,
+ 'LISTEVENTS_FOOTCOUNT' => sprintf($user->lang['listevents_footcount'], $total_events, $user->data['user_elimit']),
+ 'EVENT_PAGINATION' => generate_pagination('listevents.php'.$SID.'&amp;o='.$current_order['uri']['current'], $total_events, $user->data['user_elimit'], $start))
+);
+
+$eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['listevents_title'],
+ 'template_file' => 'listevents.html',
+ 'display' => true)
+);
+?> \ No newline at end of file
diff --git a/admin/listitems.php b/admin/listitems.php
new file mode 100644
index 0000000..8acf0b5
--- /dev/null
+++ b/admin/listitems.php
@@ -0,0 +1,90 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * listitems.php
+ * Began: Fri December 27 2002
+ *
+ * $Id: listitems.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+$user->check_auth('a_item_');
+
+$sort_order = array(
+ 0 => array('item_date desc', 'item_date'),
+ 1 => array('item_buyer', 'item_buyer desc'),
+ 2 => array('item_name', 'item_name desc'),
+ 3 => array('raid_name', 'raid_name desc'),
+ 4 => array('item_value desc', 'item_value')
+);
+
+$current_order = switch_order($sort_order);
+
+$total_items = $db->query_first('SELECT count(*) FROM ' . ITEMS_TABLE);
+$start = ( isset($_GET['start']) ) ? $_GET['start'] : 0;
+
+$sql = 'SELECT i.item_id, i.item_name, i.item_buyer, i.item_date, i.raid_id, i.item_value, r.raid_name
+ FROM ' . ITEMS_TABLE . ' i, ' . RAIDS_TABLE . ' r
+ WHERE r.raid_id=i.raid_id
+ ORDER BY '.$current_order['sql']. '
+ LIMIT '.$start.','.$user->data['user_ilimit'];
+
+$listitems_footcount = sprintf($user->lang['listpurchased_footcount'], $total_items, $user->data['user_ilimit']);
+$pagination = generate_pagination('listitems.php'.$SID.'&amp;o='.$current_order['uri']['current'], $total_items, $user->data['user_ilimit'], $start);
+
+if ( !($items_result = $db->query($sql)) )
+{
+ message_die('Could not obtain item information', 'Database error', __FILE__, __LINE__, $sql);
+}
+
+while ( $item = $db->fetch_record($items_result) )
+{
+ $tpl->assign_block_vars('items_row', array(
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'DATE' => ( !empty($item['item_date']) ) ? date($user->style['date_notime_short'], $item['item_date']) : '&nbsp;',
+ 'BUYER' => ( !empty($item['item_buyer']) ) ? $item['item_buyer'] : '&lt;<i>Not Found</i>&gt;',
+ 'U_VIEW_BUYER' => ( !empty($item['item_buyer']) ) ? '../viewmember.php'.$SID.'&amp;' . URI_NAME . '='.$item['item_buyer'] : '',
+ 'NAME' => stripslashes($item['item_name']),
+ 'U_VIEW_ITEM' => 'additem.php'.$SID.'&amp;' . URI_ITEM . '='.$item['item_id'],
+ 'RAID' => ( !empty($item['raid_name']) ) ? stripslashes($item['raid_name']) : '&lt;<i>Not Found</i>&gt;',
+ 'U_VIEW_RAID' => ( !empty($item['raid_name']) ) ? 'addraid.php'.$SID.'&amp;' . URI_RAID . '='.$item['raid_id'] : '',
+ 'VALUE' => $item['item_value'])
+ );
+}
+$db->free_result($items_result);
+
+$tpl->assign_vars(array(
+ 'L_DATE' => $user->lang['date'],
+ 'L_BUYER' => $user->lang['buyer'],
+ 'L_ITEM' => $user->lang['item'],
+ 'L_RAID' => $user->lang['raid'],
+ 'L_VALUE' => $user->lang['value'],
+
+ 'O_DATE' => $current_order['uri'][0],
+ 'O_BUYER' => $current_order['uri'][1],
+ 'O_NAME' => $current_order['uri'][2],
+ 'O_RAID' => $current_order['uri'][3],
+ 'O_VALUE' => $current_order['uri'][4],
+
+ 'U_LIST_ITEMS' => 'listitems.php'.$SID.'&amp;',
+
+ 'START' => $start,
+ 'S_HISTORY' => true,
+ 'LISTITEMS_FOOTCOUNT' => $listitems_footcount,
+ 'ITEM_PAGINATION' => $pagination)
+);
+
+$eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['listpurchased_title'],
+ 'template_file' => 'listitems.html',
+ 'display' => true)
+);
+?> \ No newline at end of file
diff --git a/admin/listnews.php b/admin/listnews.php
new file mode 100644
index 0000000..311ae95
--- /dev/null
+++ b/admin/listnews.php
@@ -0,0 +1,74 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * listnews.php
+ * Began: Fri December 27 2002
+ *
+ * $Id: listnews.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+$user->check_auth('a_news_');
+
+$sort_order = array(
+ 0 => array('news_date desc', 'news_date'),
+ 1 => array('news_headline', 'news_headline desc'),
+ 2 => array('username', 'username desc')
+);
+
+$current_order = switch_order($sort_order);
+
+$total_news = $db->query_first('SELECT count(*) FROM ' . NEWS_TABLE);
+$start = ( isset($_GET['start']) ) ? $_GET['start'] : 0;
+
+$sql = 'SELECT n.news_id, n.news_date, n.news_headline, n.news_message, u.username
+ FROM ' . NEWS_TABLE . ' n, ' . USERS_TABLE . ' u
+ WHERE (n.user_id = u.user_id)
+ ORDER BY '.$current_order['sql'].'
+ LIMIT '.$start.',50';
+
+if ( !($result = $db->query($sql)) )
+{
+ message_die('Could not obtain news information', '', __FILE__, __LINE__, $sql);
+}
+while ( $news = $db->fetch_record($result) )
+{
+ $tpl->assign_block_vars('news_row', array(
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'DATE' => date($user->style['date_time'], $news['news_date']),
+ 'USERNAME' => $news['username'],
+ 'U_VIEW_NEWS' => 'addnews.php'.$SID.'&amp;' . URI_NEWS . '='.$news['news_id'],
+ 'HEADLINE' => stripslashes($news['news_headline']))
+ );
+}
+
+$tpl->assign_vars(array(
+ 'L_DATE' => $user->lang['date'],
+ 'L_USERNAME' => $user->lang['username'],
+ 'L_HEADLINE' => $user->lang['headline'],
+
+ 'O_DATE' => $current_order['uri'][0],
+ 'O_USERNAME' => $current_order['uri'][2],
+ 'O_HEADLINE' => $current_order['uri'][1],
+
+ 'U_LIST_NEWS' => 'listnews.php'.$SID,
+
+ 'START' => $start,
+ 'LISTNEWS_FOOTCOUNT' => sprintf($user->lang['listnews_footcount'], $total_news, 50),
+ 'NEWS_PAGINATION' => generate_pagination('listnews.php'.$SID.'&amp;o='.$current_order['uri']['current'], $total_news, 50, $start))
+);
+
+$eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['listnews_title'],
+ 'template_file' => 'admin/listnews.html',
+ 'display' => true)
+);
+?> \ No newline at end of file
diff --git a/admin/listraids.php b/admin/listraids.php
new file mode 100644
index 0000000..6eee6dc
--- /dev/null
+++ b/admin/listraids.php
@@ -0,0 +1,78 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * listraids.php
+ * Began: Tue December 24 2002
+ *
+ * $Id: listraids.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+$user->check_auth('a_raid_');
+
+$sort_order = array(
+ 0 => array('raid_date desc', 'raid_date'),
+ 1 => array('raid_name', 'raid_name desc'),
+ 2 => array('raid_note', 'raid_note desc'),
+ 3 => array('raid_value desc', 'raid_value')
+);
+
+$current_order = switch_order($sort_order);
+
+$total_raids = $db->query_first('SELECT count(*) FROM ' . RAIDS_TABLE);
+
+$start = ( isset($_GET['start']) ) ? $_GET['start'] : 0;
+
+$sql = 'SELECT raid_id, raid_name, raid_date, raid_note, raid_value
+ FROM ' . RAIDS_TABLE . '
+ ORDER BY '.$current_order['sql']. '
+ LIMIT '.$start.','.$user->data['user_rlimit'];
+
+if ( !($raids_result = $db->query($sql)) )
+{
+ message_die('Could not obtain raid information', '', __FILE__, __LINE__, $sql);
+}
+while ( $row = $db->fetch_record($raids_result) )
+{
+ $tpl->assign_block_vars('raids_row', array(
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'DATE' => ( !empty($row['raid_date']) ) ? date($user->style['date_notime_short'], $row['raid_date']) : '&nbsp;',
+ 'U_VIEW_RAID' => 'addraid.php'.$SID.'&amp;' . URI_RAID . '='.$row['raid_id'],
+ 'NAME' => stripslashes($row['raid_name']),
+ 'NOTE' => ( !empty($row['raid_note']) ) ? stripslashes($row['raid_note']) : '&nbsp;',
+ 'VALUE' => $row['raid_value'])
+ );
+}
+
+$tpl->assign_vars(array(
+ 'L_DATE' => $user->lang['date'],
+ 'L_NAME' => $user->lang['name'],
+ 'L_NOTE' => $user->lang['note'],
+ 'L_VALUE' => $user->lang['value'],
+
+ 'O_DATE' => $current_order['uri'][0],
+ 'O_NAME' => $current_order['uri'][1],
+ 'O_NOTE' => $current_order['uri'][2],
+ 'O_VALUE' => $current_order['uri'][3],
+
+ 'U_LIST_RAIDS' => 'listraids.php'.$SID.'&amp;',
+
+ 'START' => $start,
+ 'LISTRAIDS_FOOTCOUNT' => sprintf($user->lang['listraids_footcount'], $total_raids, $user->data['user_rlimit']),
+ 'RAID_PAGINATION' => generate_pagination('listraids.php'.$SID.'&amp;o='.$current_order['uri']['current'], $total_raids, $user->data['user_rlimit'], $start))
+);
+
+$eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['listraids_title'],
+ 'template_file' => 'listraids.html',
+ 'display' => true)
+);
+?> \ No newline at end of file
diff --git a/admin/logs.php b/admin/logs.php
new file mode 100644
index 0000000..09f9e1b
--- /dev/null
+++ b/admin/logs.php
@@ -0,0 +1,246 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * logs.php
+ * Began: Tues December 24 2002
+ *
+ * $Id: logs.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+$sort_order = array(
+ 0 => array('log_date desc', 'log_date'),
+ 1 => array('log_type', 'log_type desc'),
+ 2 => array('username', 'username dsec'),
+ 3 => array('log_ipaddress', 'log_ipaddress desc'),
+ 4 => array('log_result', 'log_result desc')
+);
+
+$current_order = switch_order($sort_order);
+
+// Obtain var settings
+$log_id = ( !empty($_GET[URI_LOG]) ) ? intval($_REQUEST[URI_LOG]) : false;
+$search = ( !empty($_GET['search']) ) ? true : false;
+
+if ( $log_id )
+{
+ $action = 'view';
+}
+else
+{
+ $action = 'list';
+}
+
+$user->check_auth('a_logs_view');
+
+//
+// Processing
+//
+$valid_action_types = array(
+ '{L_ACTION_EVENT_ADDED}' => $user->lang['action_event_added'],
+ '{L_ACTION_EVENT_UPDATED}' => $user->lang['action_event_updated'],
+ '{L_ACTION_EVENT_DELETED}' => $user->lang['action_event_deleted'],
+ '{L_ACTION_GROUPADJ_ADDED}' => $user->lang['action_groupadj_added'],
+ '{L_ACTION_GROUPADJ_UPDATED}' => $user->lang['action_groupadj_updated'],
+ '{L_ACTION_GROUPADJ_DELETED}' => $user->lang['action_groupadj_deleted'],
+ '{L_ACTION_INDIVADJ_ADDED}' => $user->lang['action_indivadj_added'],
+ '{L_ACTION_INDIVADJ_UPDATED}' => $user->lang['action_indivadj_updated'],
+ '{L_ACTION_INDIVADJ_DELETED}' => $user->lang['action_indivadj_deleted'],
+ '{L_ACTION_ITEM_ADDED}' => $user->lang['action_item_added'],
+ '{L_ACTION_ITEM_UPDATED}' => $user->lang['action_item_updated'],
+ '{L_ACTION_ITEM_DELETED}' => $user->lang['action_item_deleted'],
+ '{L_ACTION_MEMBER_ADDED}' => $user->lang['action_member_added'],
+ '{L_ACTION_MEMBER_UPDATED}' => $user->lang['action_member_updated'],
+ '{L_ACTION_MEMBER_DELETED}' => $user->lang['action_member_deleted'],
+ '{L_ACTION_NEWS_ADDED}' => $user->lang['action_news_added'],
+ '{L_ACTION_NEWS_UPDATED}' => $user->lang['action_news_updated'],
+ '{L_ACTION_NEWS_DELETED}' => $user->lang['action_news_deleted'],
+ '{L_ACTION_RAID_ADDED}' => $user->lang['action_raid_added'],
+ '{L_ACTION_RAID_UPDATED}' => $user->lang['action_raid_updated'],
+ '{L_ACTION_RAID_DELETED}' => $user->lang['action_raid_deleted'],
+ '{L_ACTION_TURNIN_ADDED}' => $user->lang['action_turnin_added']);
+
+$valid_action_types = array_merge($valid_action_types, $pm->get_log_actions());
+
+switch ( $action )
+{
+ case 'view':
+ // Get log info
+ $sql = 'SELECT l.*, u.username FROM (' . LOGS_TABLE . ' l
+ LEFT JOIN ' . USERS_TABLE . " u
+ ON u.user_id=l.admin_id )
+ WHERE log_id='".$log_id."'";
+ $result = $db->query($sql);
+ $log = $db->fetch_record($result);
+ $db->free_result($result);
+
+ eval($log['log_action']);
+
+ if ( !empty($log_action['header']) )
+ {
+ $log_header = lang_replace($log_action['header']);
+ }
+
+ $eqdkp->switch_row_class();
+
+ foreach ( $log_action as $k => $v )
+ {
+ if ( $k != 'header' )
+ {
+ $k = lang_replace($k);
+ $v = lang_replace($v);
+
+ $tpl->assign_block_vars('log_row', array(
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'KEY' => stripslashes($k).':',
+ 'VALUE' => stripslashes($v))
+ );
+ }
+ }
+
+ $tpl->assign_vars(array(
+ 'S_LIST' => false,
+
+ 'L_LOG_VIEWER' => $user->lang['viewlogs_title'],
+ 'L_DATE' => $user->lang['date'],
+ 'L_USERNAME' => $user->lang['username'],
+ 'L_IP_ADDRESS' => $user->lang['ip_address'],
+ 'L_SESSION_ID' => $user->lang['session_id'],
+
+ 'LOG_DATE' => ( !empty($log['log_date']) ) ? date($user->style['date_time'], $log['log_date']) : '&nbsp;',
+ 'LOG_USERNAME' => ( !empty($log['username']) ) ? $log['username'] : '&nbsp;',
+ 'LOG_IP_ADDRESS' => $log['log_ipaddress'],
+ 'LOG_SESSION_ID' => $log['log_sid'],
+ 'LOG_ACTION' => ( !empty($log_header) ) ? $log_header : '&nbsp;')
+ );
+
+ break;
+ case 'list':
+ $sql = 'SELECT l.*, u.username FROM (' . LOGS_TABLE . ' l
+ LEFT JOIN ' . USERS_TABLE . ' u
+ ON u.user_id=l.admin_id )';
+
+ $addon_sql = '';
+ $search_term = '';
+
+ // If they're looking for something specific, we have to
+ // figure out what that is
+ if ( $search )
+ {
+ $search_term = urldecode($_GET['search']);
+
+ // Check if it's an action
+ if ( in_array($search_term, $valid_action_types) )
+ {
+ foreach ( $valid_action_types as $k => $v )
+ {
+ if ( $v == $search_term )
+ {
+ $addon_sql = " WHERE l.log_type='".$k."'";
+ }
+ }
+ }
+ // Check it's an IP
+ elseif ( preg_match("/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/", $search_term) )
+ {
+ $addon_sql = " WHERE l.log_ipaddress='".$search_term."'";
+ }
+ // Still going? It's a username
+ else
+ {
+ $addon_sql = " WHERE u.username='".$search_term."'";
+ }
+ }
+
+ $total_sql = 'SELECT count(*)
+ FROM ( ' . LOGS_TABLE . ' l
+ LEFT JOIN ' . USERS_TABLE . ' u
+ ON u.user_id=l.admin_id )';
+ $total_logs = $db->query_first($total_sql . $addon_sql);
+
+ $start = ( isset($_GET['start']) ) ? $_GET['start'] : 0;
+
+ $result = $db->query($sql . $addon_sql . ' ORDER BY ' . $current_order['sql'] . ' LIMIT '.$start.',100');
+ while ( $log = $db->fetch_record($result) )
+ {
+ $log['log_type'] = lang_replace($log['log_type']);
+ $log['log_result'] = lang_replace($log['log_result']);
+
+ $tpl->assign_block_vars('logs_row', array(
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'DATE' => ( !empty($log['log_date']) ) ? date($user->style['date_time'], $log['log_date']) : '&nbsp;',
+ 'TYPE' => ( !empty($log['log_type']) ) ? $log['log_type'] : '&nbsp;',
+ 'U_VIEW_LOG' => 'logs.php?' . URI_LOG . '='.$log['log_id'],
+ 'USER' => $log['username'],
+ 'IP' => $log['log_ipaddress'],
+ 'RESULT' => $log['log_result'],
+ 'C_RESULT' => ( $log['log_result'] == $user->lang['success'] ) ? 'positive' : 'negative',
+ 'ENCODED_TYPE' => urlencode($log['log_type']),
+ 'ENCODED_USER' => urlencode($log['username']),
+ 'ENCODED_IP' => urlencode($log['log_ipaddress']))
+ );
+ }
+
+ $tpl->assign_vars(array(
+ 'S_LIST' => true,
+
+ 'L_DATE' => $user->lang['date'],
+ 'L_TYPE' => $user->lang['type'],
+ 'L_VIEW_ACTION' => $user->lang['view_action'],
+ 'L_USER' => $user->lang['user'],
+ 'L_IP_ADDRESS' => $user->lang['ip_address'],
+ 'L_RESULT' => $user->lang['result'],
+ 'L_VIEW' => $user->lang['view'],
+
+ 'O_DATE' => $current_order['uri'][0],
+ 'O_TYPE' => $current_order['uri'][1],
+ 'O_USER' => $current_order['uri'][2],
+ 'O_IP' => $current_order['uri'][3],
+ 'O_RESULT' => $current_order['uri'][4],
+
+ 'U_LOGS' => 'logs.php'.$SID.'&amp;search='.$search_term.'&amp;start='.$start.'&amp;',
+ 'U_LOGS_SEARCH' => 'logs.php'.$SID.'&amp;',
+
+ 'CURRENT_ORDER' => $current_order['uri']['current'],
+ 'START' => $start,
+ 'VIEWLOGS_FOOTCOUNT' => sprintf($user->lang['viewlogs_footcount'], $total_logs, 100),
+ 'VIEWLOGS_PAGINATION' => generate_pagination('logs.php'.$SID.'&amp;search='.$search_term.'&amp;o='.$current_order['uri']['current'],
+ $total_logs, '100', $start))
+ );
+ break;
+}
+
+$eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['viewlogs_title'],
+ 'template_file' => 'admin/logs.html',
+ 'display' => true)
+);
+
+/**
+* Returns the language value of a variable in the format "{L_<LANG_KEY>}"
+* Allows use of template-style variables outside of templates
+*
+* @param $variable Variable to replace language keys for
+* @return string Translated variable
+*/
+function lang_replace($variable)
+{
+ global $user;
+
+ preg_match("/\{L_(.+)\}/", $variable, $to_replace);
+ if ( (isset($to_replace[1])) && (isset($user->lang[strtolower($to_replace[1])])) )
+ {
+ $variable = str_replace('{L_'.$to_replace[1].'}', $user->lang[strtolower($to_replace[1])], $variable);
+ }
+
+ return $variable;
+}
+?> \ No newline at end of file
diff --git a/admin/lua.php b/admin/lua.php
new file mode 100644
index 0000000..4f42859
--- /dev/null
+++ b/admin/lua.php
@@ -0,0 +1,634 @@
+<?php
+ /******************************
+ * EQdkp
+ * Copyright 2005
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * lua.php
+ * Began: Mon Sept 19 2005
+ *
+ * $Id: lua.php 8 2006-05-08 17:15:20Z tsigo $
+ *
+ ******************************/
+
+ // EQdkp required files/vars
+ define('EQDKP_INC', true);
+ define('IN_ADMIN', true);
+ $eqdkp_root_path = './../';
+
+ include_once($eqdkp_root_path . 'common.php');
+ include_once($eqdkp_root_path . 'admin/lua_config.php');
+
+ $lua_set_OnlySimulate = false;
+ $user->check_auth('u_lua_import');
+
+ if(!function_exists("html_entity_decode")) {
+
+ function html_entity_decode($string)
+ {
+ $string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
+ $string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string);
+ $trans_tbl = get_html_translation_table(HTML_ENTITIES);
+ $trans_tbl = array_flip($trans_tbl);
+ return strtr($string, $trans_tbl);
+ }
+ }
+
+class LUA_Import extends EQdkp_Admin {
+
+ function lua_import()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+ parent::eqdkp_admin();
+ $this->assoc_buttons(Array(
+ 'parse' => Array('name' => 'parse',
+ 'process' => 'process_parse',
+ 'check' => 'u_lua_import'),
+ 'form' => Array('name' => '',
+ 'process' => 'display_form',
+ 'check' => 'u_lua_import'),
+ 'insert' => Array('name' => 'insertraids',
+ 'process' => 'insert_log',
+ 'check' => 'u_lua_import'), ));
+ }
+
+ function xml2Array($xml)
+ {
+ $xml = trim($xml);
+ $xml = '<?
+ xml version = "1 . 0" encoding = "ISO - 8859 - 1"?>
+
+'.$xml;
+ $xp = xml_parser_create();
+ xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
+ xml_parser_set_option($xp, XML_OPTION_SKIP_WHITE, false);
+ xml_parser_set_option($xp, XML_OPTION_TARGET_ENCODING, "ISO-8859-1");
+ xml_parse_into_struct($xp,trim($xml),$vals,$index);
+ xml_parser_free($xp);
+ $_data = NULL;
+ $temp = $depth = array();
+ $dc = array();
+
+ foreach($vals as $value)
+ {
+ $p = join('::', $depth);
+ $key = $value['tag'];
+ switch ($value['type'])
+ {
+ case 'open':
+ array_push($depth, $key);
+ array_push($depth, (int)$dc[$p]++);
+ break;
+ case 'complete':
+ array_pop($depth);
+ array_push($depth, $key);
+ $p = join('::',$depth);
+ $temp[$p] = $value['value'];
+ array_pop($depth);
+ array_push($depth, (int)$dc[$p]);
+ break;
+ case 'close':
+ array_pop($depth);
+ array_pop($depth);
+ break;
+ }
+ }
+
+ foreach($temp as $key=>$value)
+ {
+ $levels = explode('::',$key);
+ $num_levels = count($levels);
+ if ($num_levels==1)
+ {
+ $_data[$levels[0]] = $value;
+ }
+ else
+ {
+ $pointer = &$_data;
+ for ($i = 0; $i < $num_levels; $i++)
+ {
+ if (!isset($pointer[$levels[$i]]))
+ {
+ $pointer[$levels[$i]] = array();
+ }
+ $pointer = &$pointer[$levels[$i]];
+ }
+ $pointer = $value;
+ }
+
+ }
+ return ($_data);
+ }
+
+function process_parse()
+{
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+ global $lua_set_MinItemQuality, $lua_set_IgnoredLooter, $lua_set_ConvertNames;
+ global $lua_set_LootNoteEventTriggerCheck, $lua_set_PlayerAliases, $lua_set_AddLootDkpValuesCheckbox;
+ global $lua_set_ignoritems, $lua_set_ownraids, $itemidtoname;
+
+ $_POST['log'] = trim(str_replace("&", "and", html_entity_decode($_POST['log'])));
+
+ if(!preg_match("/<RaidInfo><key>.*?<\/key>.*?<Join>.*?<\/Join><Leave>.*?<\/Leave><Loot>.*?<\/Loot><\/RaidInfo>/s", $_POST['log']))
+ {
+ message_die($user->lang['lua_step1_invalidstring_msg'], $user->lang['lua_step1_invalidstring_titel']);
+ }
+
+ $allraids = array();
+ $allevents = array();
+ $allraidattendees = array();
+ $itemidtoname = array();
+
+ $adata = $this->xml2array($_POST['log']);
+ $globalevent = $this->GetRaidEventFromString($adata['RaidInfo']['note']);
+ $globalraidnote = $this->GetRaidNoteFromString($adata['RaidInfo']['note']);
+
+ if(!isset($lua_set_ignoritems)) { $lua_set_ignoritems = array(); }
+
+ if($allforeachdata = @array_shift($adata['RaidInfo'][0]['Join'])) foreach($allforeachdata as $playerdata)
+ {
+ $playerdata['time'] = $this->ConvertTimestringToTimestamp($playerdata['time']);
+
+ if(!empty($lua_set_PlayerAliases[$playerdata['player']]))
+ {
+ $playerdata['player'] = $lua_set_PlayerAliases[$playerdata['player']];
+ }
+
+ if($lua_set_ConvertNames)
+ {
+ $playerdata['player'] = $this->StripSpecialChars($playerdata['player']);
+ }
+
+ if(!isset($allattendees[$playerdata['player']]))
+ {
+ $allattendees[$playerdata['player']] = array("firstjoin" => 0, "lastjoin" => 0, "lastleave" => 0, "race" => 0, "class" => 0, "level" => 0);
+ }
+
+ if($playerdata['time'] < $allattendees[$playerdata['player']]['firstjoin'] || empty($allattendees[$playerdata['player']]['firstjoin']))
+ {
+ $allattendees[$playerdata['player']]['firstjoin'] = $playerdata['time'];
+ }
+
+ if($playerdata['time'] > $allattendees[$playerdata['player']]['lastjoin'] || empty($allattendees[$playerdata['player']]['lastjoin']))
+ {
+ $allattendees[$playerdata['player']]['lastjoin'] = $playerdata['time'];
+ }
+
+ if(!empty($playerdata['race']) && empty($allattendees[$playerdata['player']]['race']))
+ {
+ $allattendees[$playerdata['player']]['race'] = $this->GetRaceIdByRaceName($playerdata['race']);
+ }
+
+ if(!empty($playerdata['class']) && empty($allattendees[$playerdata['player']]['class']))
+ {
+ $allattendees[$playerdata['player']]['class'] = $this->GetClassIdByClassNameLevel($playerdata['class'], $playerdata['level']);
+ }
+
+ if(!empty($playerdata['level']) && $allattendees[$playerdata['player']]['level'] < $playerdata['level'])
+ {
+ $allattendees[$playerdata['player']]['level'] = $playerdata['level'];
+ }
+
+ }
+
+ if($allforeachdata = @array_shift($adata['RaidInfo'][0]['Leave'])) foreach($allforeachdata as $playerdata)
+ {
+ $playerdata['time'] = $this->ConvertTimestringToTimestamp($playerdata['time']);
+ if(!empty($lua_set_PlayerAliases[$playerdata['player']]))
+ {
+ $playerdata['player'] = $lua_set_PlayerAliases[$playerdata['player']];
+ }
+
+ if($lua_set_ConvertNames)
+ {
+ $playerdata['player'] = $this->StripSpecialChars($playerdata['player']);
+ }
+
+ if($playerdata['time'] > $allattendees[$playerdata['player']]['lastjoin'])
+ {
+ $allattendees[$playerdata['player']]['lastleave'] = $playerdata['time'];
+ }
+ }
+
+ $i = 0;
+ $allforeachdata = @array_shift($adata['RaidInfo'][0]['Loot']);
+
+ if(!empty($allforeachdata)) foreach($allforeachdata as $lootdata)
+ {
+ if(!empty($lua_set_PlayerAliases[$playerdata['Player']]))
+ {
+ $playerdata['Player'] = $lua_set_PlayerAliases[$playerdata['Player']];
+ }
+
+ if($lua_set_ConvertNames)
+ {
+ $lootdata['Player'] = $this->StripSpecialChars($lootdata['Player']);
+ }
+
+ $itemid = $this->GetMainItemId($lootdata['ItemID']);
+ $itemidtoname[$itemid] = str_replace("\\'", "'", $lootdata['ItemName']);
+ $allloot[$i]['itemid'] = $itemid;
+ $allloot[$i]['name'] = $this->GetItemName($itemid);
+ $allloot[$i]['quality'] = $this->GetItemQualityByColor($lootdata['Color']);
+ $allloot[$i]['looter'] = $lootdata['Player'];
+ $allloot[$i]['time'] = $this->ConvertTimestringToTimestamp($lootdata['Time']);
+ $lootraidnote = $this->GetRaidNoteFromString($lootdata['Note']);
+ $lootraidevent = $this->GetRaidEventFromString($lootdata['Note']);
+
+ if(!empty($lootraidnote) && $lootraidnote != "Unknown")
+ {
+ $alllootraidnote = $lootraidnote;
+ } else {
+ $alllootraidnote = $globalraidnote;
+ }
+
+ if(!empty($lootraidevent) && $lootraidevent != "Unknown Event" && $lua_set_LootNoteEventTriggerCheck)
+ {
+ $alllootraidevent = $lootraidevent;
+ } else {
+ $alllootraidevent = $globalevent;
+ }
+
+ if(!in_array($alllootraidevent, $allevents))
+ {
+ $allevents[] = $alllootraidevent;
+ }
+
+ if(in_array($alllootraidnote, $lua_set_ownraids))
+ {
+ $alllootraidnote = $alllootraidnote."-".$this->GenerateUniqId()."-";
+ }
+
+ $allloot[$i]['raidnote'] = $alllootraidnote;
+ $allloot[$i]['raidevent'] = $alllootraidevent;
+
+ if(!isset($allraids[$alllootraidnote]))
+ {
+ $allraids[$alllootraidnote] = array();
+ }
+
+ if(!isset($allraids[$alllootraidevent][$alllootraidnote]))
+ {
+ $allraids[$alllootraidevent][$alllootraidnote] = $allloot[$i]['time'];
+ }
+
+ if(!empty($lootdata['Note']))
+ {
+ preg_match("/([\d\.]+) DKP/", $lootdata['Note'], $dkpinfo);
+ if(!empty($dkpinfo[1]))
+ {
+ $allloot[$i]['dkp'] = $dkpinfo[1];
+ }
+ }
+
+ foreach($allattendees as $player => $times)
+ {
+ if($allloot[$i]['time'] > $times['firstjoin'] && ($times['lastleave'] > $allloot[$i]['time'] || empty($times['lastleave'])))
+ {
+ $allloot[$i]['attendees'][] = $player;
+ $allraidattendees[$alllootraidevent][$alllootraidnote][] = $player;
+ }
+ }
+ $allraidattendees[$alllootraidevent][$alllootraidnote] = array_unique($allraidattendees[$alllootraidevent][$alllootraidnote]);
+ sort($allraidattendees[$alllootraidevent][$alllootraidnote]);
+ $i++;
+ }
+
+ if(empty($allforeachdata))
+ {
+ if(!in_array($globalevent, $allevents))
+ {
+ $allevents[] = $globalevent;
+ }
+
+ if(!isset($allraids[$globalraidnote]))
+ {
+ $allraids[$globalraidnote] = array();
+ }
+
+ foreach($allattendees as $player => $times)
+ {
+ $allraidattendees[$globalevent][$globalraidnote][] = $player;
+ }
+
+ $allraidattendees[$globalevent][$globalraidnote] = array_unique($allraidattendees[$globalevent][$globalraidnote]);
+ sort($allraidattendees[$globalevent][$globalraidnote]);
+
+ if(!isset($allraids[$globalevent][$globalraidnote]))
+ {
+ $allraids[$globalevent][$globalraidnote] = $this->ConvertTimestringToTimestamp($adata['RaidInfo']['key']);
+ }
+ }
+ #print_r($allraidattendees);
+ #print_r($allattendees);
+ #print_r($allevents);
+ #print_r($allraids);
+ #print_r($allloot);
+
+ $tpl->assign_vars(array(
+ 'S_STEP1' => false,
+ 'L_FOUND_RAIDS' => $user->lang['lua_step2_foundraids'],
+ 'L_RAIDS_DROPS_DETAILS' => $user->lang['lua_step2_raidsdropsdetails'],
+ 'L_RAIDS_INSERT' => $user->lang['lua_step2_insertraids'],
+ 'L_DKP_VALUE_TIP' => $user->lang['lua_step2_dkpvaluetip'],
+ 'S_ADDLOOTDKPVALUES' => (($lua_set_AddLootDkpValuesCheckbox) ? true : false),
+ )
+ );
+ foreach($allattendees as $playername => $playerdata)
+ {
+ $tpl->assign_block_vars('allplayers_row', array(
+ 'ALLPLAYERNAME' => $playername,
+ 'ALLPLAYERRACE' => $playerdata['race'],
+ 'ALLPLAYERCLASS' => $playerdata['class'],
+ 'ALLPLAYERLEVEL' => $playerdata['level'],
+ ));
+ }
+
+ foreach($allevents as $hevent)
+ {
+ $tpl->assign_block_vars('events_row', array(
+ 'HEVENT' => $hevent,
+ 'STRIPPEDHEVENT' => $this->StripUniqIdFromString($hevent),
+ ));
+
+ foreach($allraids[$hevent] as $hraidnote => $hraidtime)
+ {
+ $eventvalue = $db->query("SELECT `event_value` FROM ".EVENTS_TABLE." WHERE event_name = '".mysql_escape_string($hevent)."' LIMIT 1");
+ $eventvalue = $db->fetch_record($eventvalue);
+ $eventvalue = $eventvalue['event_value'];
+ if($eventvalue <= 0)
+ {
+ $eventvalue = "";
+ }
+ $STRIPPEDHRAIDNOTE = $this->StripUniqIdFromString($hraidnote);
+ $tpl->assign_block_vars('events_row.raids_row', array(
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'HRAIDNOTE' => $hraidnote,
+ 'HRAIDTIME' => $hraidtime,
+ 'HRAIDTIME_MO' => date("m", $hraidtime),
+ 'HRAIDTIME_D' => date("d", $hraidtime),
+ 'HRAIDTIME_Y' => date("Y", $hraidtime),
+ 'HRAIDTIME_H' => date("H", $hraidtime),
+ 'HRAIDTIME_MI' => date("i", $hraidtime),
+ 'HRAIDTIME_S' => date("s", $hraidtime),
+ 'STRIPPEDHRAIDNOTE' => (($STRIPPEDHRAIDNOTE == "Unknown") ? "" : $STRIPPEDHRAIDNOTE),
+ 'RAIDDKPVALUE' => $eventvalue,
+ 'ATTENDEES' => @implode("\n", $allraidattendees[$hevent][$hraidnote]),
+ 'ATTENDEESCOUNT' => @count($allraidattendees[$hevent][$hraidnote]),
+ ));
+
+ $i = 0;
+ $hraidattendees = array();
+
+ if(!isset($allloot))
+ {
+ $allloot = array();
+ }
+
+ foreach($allloot as $hlootid => $hlootdata)
+ {
+ if($hlootdata['raidnote'] == $hraidnote && $hlootdata['raidevent'] == $hevent)
+ {
+ if($hlootdata['quality'] >= $lua_set_MinItemQuality && !in_array($hlootdata['itemid'], $lua_set_ignoritems) && strtolower($hlootdata['looter']) != strtolower($lua_set_IgnoredLooter))
+ {
+ $tpl->assign_block_vars('events_row.raids_row.loot_row', array(
+ 'HNR' => $i,
+ 'HNAME' => $hlootdata['name'],
+ 'HID' => $hlootdata['itemid'],
+ 'HLOOTER' => $hlootdata['looter'],
+ 'HDKP' => ((!empty($hlootdata['dkp'])) ? $hlootdata['dkp'] : $this->GetDkpValue($hlootdata['name'])),
+ 'STRIPPEDHRAIDNOTE' => $this->StripUniqIdFromString($hraidnote),
+ ));
+ }
+ }
+ $i++;
+ }
+ }
+ }
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['lua_step2_pagetitel'],
+ 'template_file' => 'admin/lua.html',
+ 'display' => true,
+ )
+ );
+}
+
+function insert_log()
+{
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+ global $lua_set_MinItemQuality, $lua_set_OnlySimulate, $lua_set_NewMemberDefaultRank, $lua_set_ignoritems, $lua_set_ownraids;
+ $a = 0;
+ foreach($_POST['events'] as $ievent)
+ {
+ $inewevent = $_POST['newevents'][$ievent];
+ foreach($_POST['raids'][$ievent] as $iraid => $iraidtime)
+ {
+ $inewraidtime = mktime($_POST['raidtimes'][$ievent][$iraid]['h'], $_POST['raidtimes'][$ievent][$iraid]['mi'], $_POST['raidtimes'][$ievent][$iraid]['s'], $_POST['raidtimes'][$ievent][$iraid]['mo'], $_POST['raidtimes'][$ievent][$iraid]['d'], $_POST['raidtimes'][$ievent][$iraid]['y']);
+ $inewraidnote = $_POST['newraidnotes'][$ievent][$iraid];
+ $inewraidattendees = trim($_POST['newraidattendees'][$ievent][$iraid]);
+ $iallraids[$a]['event'] = $inewevent;
+ $iallraids[$a]['raidnote'] = $inewraidnote;
+ $iallraids[$a]['time'] = $inewraidtime;
+ $iallraids[$a]['dkp'] = 0;
+ $iallraids[$a]['attendees'] = explode("\n", $inewraidattendees);
+ if(empty($inewraidattendees))
+ {
+ $iallraids[$a]['donotadd'] = true;
+ }
+ else
+ {
+ $iallraids[$a]['donotadd'] = false;
+ }
+ $iallraids[$a]['loots'] = array();
+ $i = 0;
+ if(!isset($_POST['loots'][$ievent][$iraid])) { $_POST['loots'][$ievent][$iraid] = array(); }
+ foreach($_POST['loots'][$ievent][$iraid] as $ilootdata)
+ {
+ if(!empty($ilootdata['dkp']) || $ilootdata['dkp'] == "0")
+ {
+ $iallraids[$a]['loots'][$i]['name'] = str_replace("\\'", "'", $ilootdata['name']);
+ $iallraids[$a]['loots'][$i]['id'] = $ilootdata['id'];
+ $iallraids[$a]['loots'][$i]['looter'] = $ilootdata['looter'];
+ $iallraids[$a]['loots'][$i]['dkp'] = $ilootdata['dkp'];
+ $iallraids[$a]['dkp'] += $ilootdata['dkp'];
+ }
+ $i++;
+ }
+ $iallraids[$a]['dkp'] = round($iallraids[$a]['dkp'] / count($iallraids[$a]['attendees']), 2);
+ if($_POST['addlootdkpvalues'][$ievent][$iraid] == 1)
+ {
+ $iallraids[$a]['dkp'] += $_POST['raiddkpvalues'][$ievent][$iraid];
+ }
+ else
+ {
+ $iallraids[$a]['dkp'] = $_POST['raiddkpvalues'][$ievent][$iraid];
+ }
+ foreach($iallraids[$a]['attendees'] as $attendeeid => $attendeename)
+ {
+ $attendeename = trim($attendeename);
+ if(!empty($attendeename))
+ {
+ $iallraids[$a]['attendees'][$attendeeid] = $attendeename;
+ }
+ else
+ {
+ unset($iallraids[$a]['attendees'][$attendeeid]);
+ }
+ }
+ $a++;
+ }
+ }
+ $text == "";
+ foreach($iallraids as $iraid)
+ {
+ if(!$iraid['donotadd'])
+ {
+ $newraidid = $db->query("SELECT MAX(`raid_id`) as id FROM ".RAIDS_TABLE.";");
+ $newraidid = $db->fetch_record($newraidid);
+ $newraidid = $newraidid['id'] + 1;
+ $alreadyexistscheck = $db->query("SELECT `raid_name`, `raid_date`, `raid_note`, `raid_value` FROM ".RAIDS_TABLE." WHERE raid_name = '".mysql_escape_string($iraid['event'])."' AND raid_date >= '".mysql_escape_string($iraid['time']-1800)."' AND raid_date <= '".mysql_escape_string($iraid['time']+1800)."' AND raid_note = '".mysql_escape_string($iraid['raidnote'])."' LIMIT 1");
+ if($db->num_rows($alreadyexistscheck) == 1 && !$lua_set_OnlySimulate)
+ {
+ $text .= sprintf($user->lang['lua_step3_alreadyexist'], $iraid['raidnote'], $iraid['event'], $iraid['dkp'])."<br>\n";
+ }
+ elseif(!empty($iraid['event']))
+ {
+ if(!$lua_set_OnlySimulate) $db->query("INSERT INTO ".RAIDS_TABLE." (`raid_id`, `raid_name`, `raid_date`, `raid_note`, `raid_value`, `raid_added_by`) VALUES ('".mysql_escape_string($newraidid)."', '".mysql_escape_string($iraid['event'])."', '".mysql_escape_string($iraid['time'])."', '".mysql_escape_string($iraid['raidnote'])."', '".mysql_escape_string($iraid['dkp'])."', 'RaidTracker (by ".mysql_escape_string($user->data['username']).")');");
+ $text .= sprintf($user->lang['lua_step3_raidadded'], $iraid['raidnote'], $iraid['event'], $iraid['dkp']);
+ $log_action = array(
+ 'header' => '{L_ACTION_RAID_ADDED}',
+ 'id' => $newraidid,
+ '{L_EVENT}' => $iraid['event'],
+ '{L_ATTENDEES}' => trim(implode(', ', $iraid['attendees']), ', '),
+ '{L_NOTE}' => $iraid['raidnote'],
+ '{L_VALUE}' => $iraid['dkp'],
+ '{L_ADDED_BY}' => 'RaidTracker (by '.$user->data['username'].')',
+ );
+ if(!$lua_set_OnlySimulate)
+ {
+ $this->log_insert(array('log_type' => $log_action['header'], 'log_action' => $log_action));
+ }
+
+ foreach($iraid['attendees'] as $iattendee)
+ {
+ $memberexistscheck = $db->query("SELECT `member_name` FROM ".MEMBERS_TABLE." WHERE member_name = '".mysql_escape_string($iattendee)."';");
+ if($db->num_rows($memberexistscheck) == 0)
+ {
+ $iattendeerace = $this->GetRaceNameByRaceId($_POST['allplayers'][$iattendee]['race']);
+ $iattendeeclass = $this->GetClassNameByClassId($_POST['allplayers'][$iattendee]['class']);
+ $iattendeelevel = ((!empty($_POST['allplayers'][$iattendee]['level'])) ? $_POST['allplayers'][$iattendee]['level'] : "Unknown" ) ;
+ $iattendeerank = $this->GetRankIdByRankName($lua_set_NewMemberDefaultRank) ;
+
+ if(!$lua_set_OnlySimulate)
+ {
+ $db->query("INSERT INTO ".MEMBERS_TABLE."
+ (`member_name`, `member_status`, `member_firstraid`, `member_level`, `member_rank_id`, `member_class_id`, `member_race_id`)
+ VALUES ('".mysql_escape_string($iattendee)."', '1', '".mysql_escape_string($iraid['time'])."',
+ '".mysql_escape_string($_POST['allplayers'][$iattendee]['level'])."',
+ '".mysql_escape_string($iattendeerank)."', '".mysql_escape_string($_POST['allplayers'][$iattendee]['class'])."',
+ '".mysql_escape_string($_POST['allplayers'][$iattendee]['race'])."');");
+ }
+
+ $text .= sprintf($user->lang['lua_step3_memberadded'], $iattendee, $iattendeerace, $iattendeeclass, $iattendeelevel, $this->GetRankNameByRankId($iattendeerank));
+ $log_action = array(
+ 'header' => '{L_ACTION_MEMBER_ADDED}',
+ '{L_NAME}' => $iattendee,
+ '{L_EARNED}' => 0,
+ '{L_SPENT}' => 0,
+ '{L_ADJUSTMENT}' => 0,
+ '{L_LEVEL}' => $iattendeelevel,
+ '{L_RACE}' => $iattendeerace,
+ '{L_CLASS}' => $iattendeeclass,
+ '{L_ADDED_BY}' => 'RaidTracker (by '.$user->data['username'].')',
+ );
+ if(!$lua_set_OnlySimulate) $this->log_insert(array('log_type' => $log_action['header'],'log_action' => $log_action));
+ }
+ if(!$lua_set_OnlySimulate)
+ {
+ $db->query("INSERT INTO ".RAID_ATTENDEES_TABLE." (`raid_id`, `member_name`)
+ VALUES ('".mysql_escape_string($newraidid)."', '".mysql_escape_string($iattendee)."');");
+ }
+
+ if(!$lua_set_OnlySimulate)
+ {
+ $db->query("UPDATE ".MEMBERS_TABLE."
+ SET member_earned = member_earned + ".mysql_escape_string($iraid['dkp']).",
+ member_status = '1', member_lastraid = '".mysql_escape_string($iraid['time'])."',
+ member_raidcount = member_raidcount + 1
+ WHERE member_name = '".mysql_escape_string($iattendee)."';");
+ }
+
+ $text .= sprintf($user->lang['lua_step3_attendeesadded'], count($iraid['attendees']));
+ foreach($iraid['loots'] as $iloot)
+ {
+ if(!$lua_set_OnlySimulate)
+ {
+ $db->query("INSERT INTO ".ITEMS_TABLE."
+ (`item_name`, `item_buyer`, `raid_id`, `item_value`, `item_date`, `item_added_by`, `item_group_key`)
+ VALUES ('".mysql_escape_string($iloot['name'])."', '".mysql_escape_string($iloot['looter'])."',
+ '".mysql_escape_string($newraidid)."', '".mysql_escape_string($iloot['dkp'])."',
+ '".mysql_escape_string($iraid['time'])."', 'RaidTracker (by ".mysql_escape_string($user->data['username']).")',
+ '".mysql_escape_string($this->gen_group_key($iloot['name'], $iraid['time'], $newraidid))."');");
+ }
+
+ if(!$lua_set_OnlySimulate)
+ {
+ $db->query("UPDATE ".MEMBERS_TABLE."
+ SET member_spent = member_spent + ".mysql_escape_string($iloot['dkp'])."
+ WHERE member_name = '".mysql_escape_string($iloot['looter'])."';");
+ }
+
+ $text .= sprintf($user->lang['lua_step3_lootadded'], $iloot['name'], $iloot['dkp'], $iloot['looter']);
+ $log_action = array(
+ 'header' => '{L_ACTION_ITEM_ADDED}',
+ '{L_NAME}' => $iloot['name'],
+ '{L_BUYERS}' => $iloot['looter'],
+ '{L_RAID_ID}' => $newraidid,
+ '{L_VALUE}' => $iloot['dkp'],
+ '{L_ADDED_BY}' => 'RaidTracker (by '.$user->data['username'].')',
+ );
+ if(!$lua_set_OnlySimulate) $this->log_insert(array('log_type' => $log_action['header'],'log_action' => $log_action));
+ }
+ $text .= "<br>\n";
+ }
+ }
+ }
+ message_die($text, $user->lang['lua_step3_titel']);
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['lua_step3_pagetitel'],
+ 'template_file' => 'admin/lua.html',
+ 'display' => true,
+ )
+ );
+}
+
+function display_form()
+{
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $tpl->assign_vars(array(
+ 'F_PARSE_LOG' => 'index.php' . $SID,
+ 'S_STEP1' => true,
+ 'L_PASTE_LOG' => $user->lang['lua_step1_th'],
+ 'L_PARSE_LOG' => $user->lang['lua_step1_button_parselog'],
+ )
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['lua_step1_pagetitel'],
+ 'template_file' => 'admin/lua.html',
+ 'display' => true,
+ )
+ );
+}
+}
+
+$LUA_Import = new LUA_Import;
+$LUA_Import->process();
+?>
diff --git a/admin/lua_config.php b/admin/lua_config.php
new file mode 100644
index 0000000..a3e8584
--- /dev/null
+++ b/admin/lua_config.php
@@ -0,0 +1,295 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2005
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * lua_config.php
+ * Began: Mon Sept 19 2005
+ *
+ * $Id: lua_config.php 8 2006-05-08 17:15:20Z tsigo $
+ ******************************/
+
+// Sets the minimum Item Quality of Items to get parsed (4 = Epic, 3 = Rare, 2 = uncommon)
+$lua_set_MinItemQuality = 4;
+
+// Set a "Looter" which should be ignored
+$lua_set_IgnoredLooter = "disenchanted";
+
+// Here you can set the default status of the "Add Item value/attendees" Checkbox
+$lua_set_AddLootDkpValuesCheckbox = true;
+
+// Setting it to true will convert e.g. "Âvâtâr" to "Avatar".
+$lua_set_ConvertNames = false;
+
+// Will Check for Event Triggers in the Loot Notes
+// (e.g. if you have events called "MC (Lucifron), MC (Magmadar), ..." and only want to log one raid.
+$lua_set_LootNoteEventTriggerCheck = false;
+
+// Here you can set the default Rank of new Members (e.g. Member).
+$lua_set_NewMemberDefaultRank = "";
+
+// Here you can set a list of item IDs which should be ignored
+// Mature Blue Dragon Sinew (From Azuregos)
+#$lua_set_ignoritems[] = 18704;
+
+// Here You can Set all the Raid notes which should be handled as a own raid everytime
+// e.g. Random Drops are normaly added to an own Raid (Not all Random Drops to one Raid)
+$lua_set_ownraids[] = "Random Drop";
+
+// Here you can set the triggers for the eqDKP Event
+// (CT_RaidRracker Raid note will be parsed (Loot Notes only when $lua_set_LootNoteEventTriggerCheck is set))
+$lua_set_EventTriggers["Molten Core"] = "Molten Core";
+$lua_set_EventTriggers["MC"] = "Molten Core";
+$lua_set_EventTriggers["Azuregos"] = "Azuregos";
+$lua_set_EventTriggers["Kazzak"] = "Kazzak";
+$lua_set_EventTriggers["Onyxia"] = "Onyxia";
+$lua_set_EventTriggers["Blackwing Lair"] = "Blackwing Lair";
+$lua_set_EventTriggers["Blackwinglair"] = "Blackwing Lair";
+$lua_set_EventTriggers["BWL"] = "Blackwing Lair";
+
+// Here you can set the triggers for the eqDKP Raid Note
+// (CT_RaidRracker Raid note and the Loots Notes will be parsed (Loot Notes will override the Raid Note))
+$lua_set_RaidNoteTriggers["Azuregos"] = "Azuregos";
+$lua_set_RaidNoteTriggers["Kazzak"] = "Kazzak";
+$lua_set_RaidNoteTriggers["Onyxia"] = "Onyxia";
+$lua_set_RaidNoteTriggers["Lucifron"] = "Lucifron";
+$lua_set_RaidNoteTriggers["Magmadar"] = "Magmadar";
+$lua_set_RaidNoteTriggers["Gehennas"] = "Gehennas";
+$lua_set_RaidNoteTriggers["Garr"] = "Garr";
+$lua_set_RaidNoteTriggers["Geddon"] = "Baron Geddon";
+$lua_set_RaidNoteTriggers["Shazzrah"] = "Shazzrah";
+$lua_set_RaidNoteTriggers["Sulfuron"] = "Sulfuron";
+$lua_set_RaidNoteTriggers["Golemagg"] = "Golemagg";
+$lua_set_RaidNoteTriggers["Majordomo"] = "Majordomo";
+$lua_set_RaidNoteTriggers["Ragnaros"] = "Ragnaros";
+$lua_set_RaidNoteTriggers["Razorgore"] = "Razorgore";
+$lua_set_RaidNoteTriggers["Vaelastrasz"] = "Vaelastrasz";
+$lua_set_RaidNoteTriggers["Broodlord"] = "Broodlord";
+$lua_set_RaidNoteTriggers["Firemaw"] = "Firemaw";
+$lua_set_RaidNoteTriggers["Ebonroc"] = "Ebonroc";
+$lua_set_RaidNoteTriggers["Flamegor"] = "Flamegor";
+$lua_set_RaidNoteTriggers["Chromaggus"] = "Chromaggus";
+$lua_set_RaidNoteTriggers["Nefarius"] = "Lord Nefarius";
+$lua_set_RaidNoteTriggers["Random"] = "Random Drop";
+
+// Here you can set Player aliases, if one of the players is in the attende List it will be replaced
+// (e.g. if a Twink of the Mainchar helps out, but the Mainchar should get the DKP Points)
+
+#$lua_set_PlayerAliases["Twink1ofMainChar1"] = "MainChar1";
+#$lua_set_PlayerAliases["Twink2ofMainChar1"] = "MainChar1";
+
+ function GetRaidNoteFromString($string) {
+ global $lua_set_RaidNoteTriggers;
+ foreach($lua_set_RaidNoteTriggers as $trigger => $value) {
+ if($this->in_string($trigger, $string, true)) {
+ return $value;
+ }
+ }
+ return "Unknown";
+ }
+
+ function GetRaidEventFromString($string) {
+ global $lua_set_EventTriggers;
+ foreach($lua_set_EventTriggers as $trigger => $value) {
+ if($this->in_string($trigger, $string, true)) {
+ return $value;
+ }
+ }
+ return "Unknown Event";
+ }
+
+ function GetItemName($itemid) {
+ global $gitemlist, $itemidtoname;
+ if(empty($gitemlist) && file_exists("itemlist.xml")) {
+ $itemlisthandle = fopen("itemlist.xml", "r");
+ while(!feof($itemlisthandle)) {
+ $itemlistbuffer = fgets($itemlisthandle, 1024);
+ preg_match_all("/<wowitem name=\"(.+?)\" id=\"(\d+)\" \/>/s", $itemlistbuffer, $itemlista, PREG_SET_ORDER);
+ foreach($itemlista as $itemlistdata) {
+ $gitemlist[$itemlistdata[2]] = $itemlistdata[1];
+ }
+ }
+ fclose($itemlisthandle);
+ }
+ if(function_exists("GetItemName"))// Just ignore this, it's my part to get the itemname from my database
+ { $altitemname = @GetItemName($itemid, $lang = "en");
+ }
+ if(!empty($altitemname)) {
+ return $altitemname;
+ } elseif(!empty($gitemlist[$itemid])) {
+ return $gitemlist[$itemid];
+ } elseif(!empty($itemidtoname[$itemid])) {
+ return $itemidtoname[$itemid];
+ } else {
+ return false;
+ }
+ }
+
+ function ConvertTimestringToTimestamp($timestring) {
+ $parts = preg_split('/[\/ :]/', $timestring);
+ return mktime($parts[3], $parts[4], $parts[5], $parts[0], $parts[1], $parts[2]);
+ }
+
+ function in_string($needle, $haystack, $insensitive = false) {
+ if($insensitive) {
+ $haystack = strtolower($haystack);
+ $needle = strtolower($needle);
+ }
+ return(false !== strpos($haystack, $needle)) ? true : false;
+ }
+
+ function GetMainItemId($itemid)
+ {
+ $itemid = trim($itemid, "item:");
+ $itemid = preg_split("/:/", $itemid);
+ return $itemid[0];
+ }
+
+ function GetItemQualityByColor($color)
+ {
+ $color = strtolower($color);
+ if($color == "ffa335ee") { return 4; }
+ elseif($color == "ff0070dd") { return 3; }
+ elseif($color == "ff1eff00") { return 2; }
+ elseif($color == "ffffffff") { return 1; }
+ elseif($color == "ff9d9d9d") { return 0; }
+ else { return -1; }
+ }
+
+ function GetDkpValue($item)
+ {
+ global $db;
+ $value = $db->query("SELECT MIN(`item_value`) as minval FROM ".ITEMS_TABLE." WHERE `item_name` = '".mysql_escape_string($item)."';");
+ $value = $db->fetch_record($value);
+ return $value['minval'];
+ }
+
+ function GetClassIdByClassNameLevel($classname, $level)
+ {
+ global $db;
+ $value = $db->query("SELECT `class_id` FROM ".CLASS_TABLE." WHERE `class_name` = '".mysql_escape_string($classname)."' AND `class_min_level` <= '".mysql_escape_string($level)."' AND `class_max_level` >= '".mysql_escape_string($level)."' ORDER by class_min_level DESC;");
+ if($db->num_rows($value) >= 1)
+ {
+ $value = $db->fetch_record($value);
+ return $value['class_id'];
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+
+ function GetRaceIdByRaceName($racename)
+ {
+ global $db;
+ if($racename == "Scourge")
+ {
+ $racename = "Undead";
+ }
+ elseif($racename == "NightElf")
+ {
+ $racename = "Night Elf";
+ }
+ $value = $db->query("SELECT `race_id` FROM ".RACE_TABLE." WHERE `race_name` = '".mysql_escape_string($racename)."';");
+ if($db->num_rows($value) >= 1)
+ {
+ $value = $db->fetch_record($value);
+ return $value['race_id'];
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ function GetRankIdByRankName($rankname)
+ {
+ global $db;
+ $value = $db->query("SELECT `rank_id` FROM ".MEMBER_RANKS_TABLE." WHERE `rank_name` = '".mysql_escape_string($rankname)."';");
+ if($db->num_rows($value) >= 1)
+ {
+ $value = $db->fetch_record($value);
+ return $value['rank_id'];
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+
+
+
+ function GetClassNameByClassId($classid)
+ {
+ global $db;
+ $value = $db->query("SELECT `class_name` FROM ".CLASS_TABLE." WHERE `class_id` = '".mysql_escape_string($classid)."';");
+ if($db->num_rows($value) >= 1)
+ {
+ $value = $db->fetch_record($value);
+ return $value['class_name'];
+ }
+ else
+ {
+ return "Unknown";
+ }
+ }
+
+ function GetRaceNameByRaceId($raceid)
+ {
+ global $db;
+ $value = $db->query("SELECT `race_name` FROM ".RACE_TABLE." WHERE `race_id` = '".mysql_escape_string($raceid)."';");
+ if($db->num_rows($value) >= 1)
+ {
+ $value = $db->fetch_record($value);
+ return $value['race_name'];
+ }
+ else
+ {
+ return "Unknown";
+ }
+ }
+
+ function GetRankNameByRankId($rankid)
+ {
+ global $db;
+ $value = $db->query("SELECT `rank_name` FROM ".MEMBER_RANKS_TABLE." WHERE `rank_id` = '".mysql_escape_string($rankid)."';");
+ if($db->num_rows($value) >= 1)
+ {
+ $value = $db->fetch_record($value);
+ if(!empty($value['rank_name']))
+ {
+ return $value['rank_name'];
+ }
+ else
+ {
+ return "None";
+ }
+ }
+ else
+ {
+ return "None";
+ }
+ }
+
+
+ function GenerateUniqId()
+ {
+ return md5(uniqid(rand(), true));
+ }
+
+ function StripUniqIdFromString($string)
+ {
+ return preg_replace("/(.*?)-[a-z0-9]{32}-(.*?)/", "\\1\\2", $string);
+ }
+
+ function StripSpecialChars($string)
+ {
+ $string = strtr($string, "\xA1\xAA\xBA\xBF\xC0\xC1\xC2\xC3\xC5\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD8\xD9\xDA\xDB\xDD\xE0\xE1\xE2\xE3\xE5\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF8\xF9\xFA\xFB\xFD\xFF", "!ao?AAAAACEEEEIIIIDNOOOOOUUUYaaaaaceeeeiiiidnooooouuuyy");
+ $string = strtr($string, array("\xC4"=>"Ae", "\xC6"=>"AE", "\xD6"=>"Oe", "\xDC"=>"Ue", "\xDE"=>"TH", "\xDF"=>"ss", "\xE4"=>"ae", "\xE6"=>"ae", "\xF6"=>"oe", "\xFC"=>"ue", "\xFE"=>"th"));
+ return($string);
+ }
+
+?>
diff --git a/admin/manage_members.php b/admin/manage_members.php
new file mode 100644
index 0000000..71a6829
--- /dev/null
+++ b/admin/manage_members.php
@@ -0,0 +1,151 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * manage_members.php
+ * Began: Sun January 5 2003
+ *
+ * $Id: manage_members.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+// Notice: Since 'Manage Members' function as a whole handles a lot of form and
+// processing code, this script will serve only as a framework for other processing
+// scripts (found in the mm directory)
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class Manage_Members extends EQdkp_Admin
+{
+ function manage_members()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ $this->assoc_buttons(array(
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_menu',
+ 'check' => 'a_members_man'))
+ );
+
+ $this->assoc_params(array(
+ 'transfer' => array(
+ 'name' => 'mode',
+ 'value' => 'transfer',
+ 'process' => 'mm_transfer',
+ 'check' => 'a_members_man'),
+ 'addmember' => array(
+ 'name' => 'mode',
+ 'value' => 'addmember',
+ 'process' => 'mm_addmember',
+ 'check' => 'a_members_man'),
+ 'list' => array(
+ 'name' => 'mode',
+ 'value' => 'list',
+ 'process' => 'mm_listmembers',
+ 'check' => 'a_members_man'),
+ 'ranks' => array(
+ 'name' => 'mode',
+ 'value' => 'ranks',
+ 'process' => 'mm_ranks',
+ 'check' => 'a_members_man'))
+ );
+ }
+
+ function error_check()
+ {
+ return $this->fv->is_error();
+ }
+
+ // ---------------------------------------------------------
+ // Display menu
+ // ---------------------------------------------------------
+ function display_menu()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $tpl->assign_vars(array(
+ 'L_MANAGE_MEMBERS' => $user->lang['manage_members'],
+ 'L_ADD_MEMBER' => $user->lang['add_member'],
+ 'L_LIST_EDIT_DEL_MEMBERS' => $user->lang['list_edit_del_member'],
+ 'L_EDIT_RANKS' => $user->lang['edit_ranks'],
+ 'L_TRANSFER_HISTORY' => $user->lang['transfer_history'],
+
+ 'U_ADD_MEMBER' => 'manage_members.php' . $SID . '&amp;mode=addmember',
+ 'U_LIST_MEMBERS' => 'manage_members.php' . $SID . '&amp;mode=list',
+ 'U_EDIT_RANKS' => 'manage_members.php' . $SID . '&amp;mode=ranks',
+ 'U_TRANSFER_HISTORY' => 'manage_members.php' . $SID . '&amp;mode=transfer')
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['manage_members_title'],
+ 'template_file' => 'admin/mm_menu.html',
+ 'display' => true)
+ );
+ }
+
+ // ---------------------------------------------------------
+ // Transfer history
+ // ---------------------------------------------------------
+ function mm_transfer()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ include('mm/mm_transfer.php');
+ $mm_extension = new MM_Transfer;
+ $mm_extension->process();
+ }
+
+ // ---------------------------------------------------------
+ // Add member
+ // ---------------------------------------------------------
+ function mm_addmember()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ include('mm/mm_addmember.php');
+ $mm_extension = new MM_Addmember;
+ $mm_extension->process();
+ }
+
+ // ---------------------------------------------------------
+ // List members
+ // ---------------------------------------------------------
+ function mm_listmembers()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ include('mm/mm_listmembers.php');
+ $mm_extension = new MM_Listmembers;
+ $mm_extension->process();
+ }
+
+ // ---------------------------------------------------------
+ // Ranks
+ // ---------------------------------------------------------
+ function mm_ranks()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ include('mm/mm_ranks.php');
+ $mm_extension = new MM_Ranks;
+ $mm_extension->process();
+ }
+}
+
+$manage_members = new Manage_Members;
+$manage_members->process();
+?> \ No newline at end of file
diff --git a/admin/manage_users.php b/admin/manage_users.php
new file mode 100644
index 0000000..8546fb6
--- /dev/null
+++ b/admin/manage_users.php
@@ -0,0 +1,865 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * manage_users.php
+ * Began: Sun December 29 2002
+ *
+ * $Id: manage_users.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class Manage_Users extends EQdkp_Admin
+{
+ var $change_username = false; // Was the username changed? @var change_username
+ var $change_password = false; // Was the password changed? @var change_password
+ var $user_data = array(); // Holds user data if URI_NAME is set @var user_data
+
+ function manage_users()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ // Vars used to confirm deletion
+ $confirm_text = $user->lang['confirm_delete_users'];
+ $usernames = array();
+ if ( isset($_POST['delete']) )
+ {
+ if ( isset($_POST['user_id']) )
+ {
+ foreach ( $_POST['user_id'] as $user_id )
+ {
+ $username = $db->query_first('SELECT username FROM ' . USERS_TABLE . " WHERE user_id='" . $user_id . "'");
+ $usernames[] = $username;
+ }
+
+ $names = implode(', ', $usernames);
+
+ $confirm_text .= '<br /><br />' . $names;
+ }
+ else
+ {
+ message_die('No users were selected for deletion.');
+ }
+ }
+
+ $this->set_vars(array(
+ 'confirm_text' => $confirm_text,
+ 'uri_parameter' => 'username',
+ 'url_id' => ( sizeof($usernames) > 0 ) ? $names : (( isset($_GET['username']) ) ? $_GET['username'] : ''),
+ 'script_name' => 'manage_users.php' . $SID)
+ );
+
+ $this->assoc_buttons(array(
+ 'submit' => array(
+ 'name' => 'submit',
+ 'process' => 'process_submit',
+ 'check' => 'a_users_man'),
+ 'update' => array(
+ 'name' => 'update',
+ 'process' => 'process_update',
+ 'check' => 'a_users_man'),
+ 'delete' => array(
+ 'name' => 'delete',
+ 'process' => 'process_delete',
+ 'check' => 'a_users_man'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_list',
+ 'check' => 'a_users_man'))
+ );
+
+ $this->assoc_params(array(
+ 'name' => array(
+ 'name' => URI_NAME,
+ 'process' => 'display_form',
+ 'check' => 'a_users_man'))
+ );
+ }
+
+ function error_check()
+ {
+ global $db, $user;
+
+ // Singular Update
+ if ( isset($_POST['submit']) )
+ {
+ // See if the user exists
+ $sql = 'SELECT au.*, u.*
+ FROM ' . USERS_TABLE . ' u
+ LEFT JOIN ' . AUTH_USERS_TABLE . " au
+ ON (u.user_id = au.user_id)
+ WHERE u.username='" . $_POST[URI_NAME] . "'";
+ $result = $db->query($sql);
+ if ( !$this->user_data = $db->fetch_record($result) )
+ {
+ message_die($user->lang['error_user_not_found']);
+ }
+ $db->free_result($result);
+
+ // Error-check the form
+ $this->change_username = false;
+ if ( $_POST['username'] != $_POST[URI_NAME] )
+ {
+ // They changed the username, see if it's already registered
+ $sql = 'SELECT user_id
+ FROM ' . USERS_TABLE . "
+ WHERE username='".$_POST['username']."'";
+ if ( $db->num_rows($db->query($sql)) > 0 )
+ {
+ $this->fv->errors['username'] = $user->lang['fv_already_registered_username'];
+ }
+ $this->change_username = true;
+ }
+ $this->change_password = false;
+ if ( (!empty($_POST['new_user_password1'])) || (!empty($_POST['new_user_password2'])) )
+ {
+ $this->fv->matching_passwords('new_user_password1', 'new_user_password2', $user->lang['fv_match_password']);
+ $this->change_password = true;
+ }
+ $this->fv->is_number(array(
+ 'user_alimit' => $user->lang['fv_number'],
+ 'user_elimit' => $user->lang['fv_number'],
+ 'user_ilimit' => $user->lang['fv_number'],
+ 'user_nlimit' => $user->lang['fv_number'],
+ 'user_rlimit' => $user->lang['fv_number'])
+ );
+
+ // Make sure any members associated with this account aren't associated with another account
+ if ( (isset($_POST['member_id'])) && (is_array($_POST['member_id'])) )
+ {
+ // Build array of member_id => member_name
+ $member_names = array();
+ $sql = 'SELECT member_id, member_name
+ FROM ' . MEMBERS_TABLE . '
+ ORDER BY member_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $member_names[ $row['member_id'] ] = $row['member_name'];
+ }
+ $db->free_result($result);
+
+ $sql = 'SELECT member_id
+ FROM ' . MEMBER_USER_TABLE . '
+ WHERE member_id IN (' . implode(', ', $_POST['member_id']) . ')
+ AND user_id != ' . $this->user_data['user_id'];
+ $result = $db->query($sql);
+
+ $fv_member_id = '';
+ while ( $row = $db->fetch_record($result) )
+ {
+ // This member's associated with another account
+ $fv_member_id .= sprintf($user->lang['fv_member_associated'], $member_names[ $row['member_id'] ]) . '<br />';
+ }
+ $db->free_result($result);
+
+ if ( $fv_member_id != '' )
+ {
+ $this->fv->errors['member_id'] = $fv_member_id;
+ }
+ }
+ }
+ // Mass Update
+ elseif ( isset($_POST['update']) )
+ {
+ }
+ // Mass Delete
+ elseif ( isset($_POST['delete']) )
+ {
+ }
+ elseif ( isset($_GET[URI_NAME]) )
+ {
+ // See if the user exists
+ $sql = 'SELECT au.*, u.*
+ FROM ' . USERS_TABLE . ' u
+ LEFT JOIN ' . AUTH_USERS_TABLE . " au
+ ON (u.user_id = au.user_id)
+ WHERE u.username='" . $_GET[URI_NAME] . "'";
+ $result = $db->query($sql);
+ if ( !$this->user_data = $db->fetch_record($result) )
+ {
+ message_die($user->lang['error_user_not_found']);
+ }
+ $db->free_result($result);
+ }
+
+ return $this->fv->is_error();
+ }
+
+ // ---------------------------------------------------------
+ // Process Submit
+ // ---------------------------------------------------------
+ function process_submit()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID, $user_id;
+
+ $user_id = $this->user_data['user_id'];
+
+ //
+ // Build the query
+ //
+ // User settings
+ $sql = 'UPDATE ' . USERS_TABLE . "
+ SET";
+ if ( $this->change_username )
+ {
+ $sql .= " username='".$_POST['username']."', ";
+ }
+ if ( $this->change_password )
+ {
+ $sql .= " user_password='".md5($_POST['new_user_password1'])."', ";
+ }
+ $sql .= " user_email='".$_POST['user_email']."', ";
+
+ $sql .= " user_alimit='".$_POST['user_alimit']."', user_elimit='".$_POST['user_elimit']."', user_ilimit='".$_POST['user_ilimit']."',
+ user_nlimit='".$_POST['user_nlimit']."', user_rlimit='".$_POST['user_rlimit']."', ";
+
+ $sql .= " user_lang='".$_POST['user_lang']."', user_style='".$_POST['user_style']."',
+ user_active='".$_POST['user_active']."'";
+
+ $sql .= " WHERE user_id='".$this->user_data['user_id']."'";
+
+ if ( !($result = $db->query($sql)) )
+ {
+ message_die('Could not update user information', '', __FILE__, __LINE__, $sql);
+ }
+
+ // Permissions
+ $sql = 'SELECT auth_id, auth_value
+ FROM ' . AUTH_OPTIONS_TABLE . '
+ ORDER BY auth_id';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $r_auth_id = $row['auth_id'];
+ $r_auth_value = $row['auth_value'];
+
+ $chk_auth_value = ( $user->check_auth($r_auth_value, false, $user_id) ) ? 'Y' : 'N';
+ $db_auth_value = ( isset($_POST[$r_auth_value]) ) ? 'Y' : 'N';
+
+ if ( $chk_auth_value != $db_auth_value )
+ {
+ $this->update_auth_users($r_auth_id, $db_auth_value);
+ }
+ }
+ $db->free_result($result);
+
+ // Users -> Members associations
+ $sql = 'DELETE FROM ' . MEMBER_USER_TABLE . '
+ WHERE user_id = ' . $this->user_data['user_id'];
+ $db->query($sql);
+
+ if ( (isset($_POST['member_id'])) && (is_array($_POST['member_id'])) )
+ {
+ $sql = 'INSERT INTO ' . MEMBER_USER_TABLE . '
+ (member_id, user_id)
+ VALUES ';
+
+ $query = array();
+ foreach ( $_POST['member_id'] as $member_id )
+ {
+ $query[] = '(' . $member_id . ', ' . $this->user_data['user_id'] . ')';
+ }
+
+ $sql .= implode(', ', $query);
+ $db->query($sql);
+ }
+
+ // See if any plugins need to update the DB
+ $pm->do_hooks('/admin/manage_users.php?action=update');
+
+ $this->admin_die($user->lang['update_settings_success']);
+ }
+
+ // ---------------------------------------------------------
+ // Process Mass Update
+ // ---------------------------------------------------------
+ function process_update()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ if ( isset($_POST['user_id']) )
+ {
+ $user_ids = $_POST['user_id'];
+
+ // Delete existing permissions for these users
+ $sql = 'DELETE FROM ' . AUTH_USERS_TABLE . '
+ WHERE user_id IN (' . implode(', ', $user_ids) . ')';
+ $db->query($sql);
+
+ // Permissions
+ $sql = 'SELECT auth_id, auth_value
+ FROM ' . AUTH_OPTIONS_TABLE . '
+ ORDER BY auth_id';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $permissions[ $row['auth_id'] ] = $row['auth_value'];
+ }
+ $db->free_result($result);
+
+ foreach ( $user_ids as $user_id )
+ {
+ $query = array();
+ $sql = 'INSERT INTO ' . AUTH_USERS_TABLE . '
+ (user_id, auth_id, auth_setting)
+ VALUES ';
+ foreach ( $permissions as $auth_id => $auth_value )
+ {
+ $query[] = "('" . $user_id . "', '" . $auth_id . "', " . (( isset($_POST[$auth_value]) ) ? "'Y'" : "'N'") . ')';
+ }
+ $db->query($sql . implode(', ', $query));
+ }
+
+ $this->admin_die($user->lang['admin_set_perms_success']);
+ }
+ else
+ {
+ message_die('No users were selected for updating.');
+ }
+ }
+
+ // ---------------------------------------------------------
+ // Process (Mass) Delete
+ // ---------------------------------------------------------
+ function process_confirm()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ if ( isset($_POST['username']) )
+ {
+ $usernames = explode(', ', $_POST['username']);
+
+ // Find user IDs
+ $user_ids = array();
+ $sql = 'SELECT user_id, username
+ FROM ' . USERS_TABLE . "
+ WHERE username IN ('" . implode("', '", $usernames) . "')";
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $user_ids[ $row['username'] ] = $row['user_id'];
+ }
+ $db->free_result($result);
+
+ // Delete from auth_user
+ $sql = 'DELETE FROM ' . AUTH_USERS_TABLE . '
+ WHERE user_id IN (' . implode(', ', $user_ids) . ')';
+ $db->query($sql);
+
+ // Delete from users
+ $sql = 'DELETE FROM ' . USERS_TABLE . '
+ WHERE user_id IN (' . implode(', ', $user_ids) . ')';
+ $db->query($sql);
+
+ // Delete from member users
+ $sql = 'DELETE FROM ' . MEMBER_USER_TABLE . '
+ WHERE user_id IN (' . implode(', ', $user_ids) . ')';
+ $db->query($sql);
+
+ // Success message
+ $success_message = '';
+ foreach ( $usernames as $username )
+ {
+ $success_message .= sprintf($user->lang['admin_delete_user_success'], $username) . '<br />';
+ }
+
+ $link_list = array(
+ $user->lang['manage_users'] => 'manage_users.php' . $SID);
+
+ $this->admin_die($success_message, $link_list);
+ }
+ else
+ {
+ message_die('No users were selected for deleting.');
+ }
+ }
+
+ // ---------------------------------------------------------
+ // Process helper methods
+ // ---------------------------------------------------------
+ function update_auth_users($auth_id, $auth_setting = 'N', $check_query_type = true)
+ {
+ global $db, $user_id;
+
+ $upd_ins = ( $check_query_type ) ? $this->switch_upd_ins($auth_id, $user_id) : 'upd';
+
+ if ( (empty($auth_id)) || (empty($user_id)) )
+ {
+ return false;
+ }
+
+ if ( $upd_ins == 'upd' )
+ {
+ $sql = 'UPDATE ' . AUTH_USERS_TABLE . "
+ SET auth_setting='".$auth_setting."'
+ WHERE auth_id='".$auth_id."'
+ AND user_id='".$user_id."'";
+ }
+ else
+ {
+ $sql = 'INSERT INTO ' . AUTH_USERS_TABLE . "
+ (user_id, auth_id, auth_setting)
+ VALUES ('".$user_id."','".$auth_id."','".$auth_setting."')";
+ }
+
+ if ( !($result = $db->query($sql)) )
+ {
+ return false;
+ }
+ return true;
+ }
+
+ function switch_upd_ins($auth_id, $user_id)
+ {
+ global $db;
+
+ $sql = 'SELECT o.auth_value
+ FROM ' . AUTH_OPTIONS_TABLE . ' o, ' . AUTH_USERS_TABLE . " u
+ WHERE (u.auth_id = o.auth_id)
+ AND (u.user_id='".$user_id."')
+ AND u.auth_id='".$auth_id."'";
+ if ( $db->num_rows($db->query($sql)) > 0 )
+ {
+ return 'upd';
+ }
+ return 'ins';
+ }
+
+ // ---------------------------------------------------------
+ // Display
+ // ---------------------------------------------------------
+ function display_list()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $sort_order = array(
+ 0 => array('u.username', 'u.username desc'),
+ 1 => array('u.user_email', 'u.user_email desc'),
+ 2 => array('u.user_lastvisit desc', 'u.user_lastvisit'),
+ 3 => array('u.user_active desc', 'u.user_active'),
+ 4 => array('s.session_id desc', 's.session_id')
+ );
+
+ $current_order = switch_order($sort_order);
+
+ $total_users = $db->query_first('SELECT count(*) FROM ' . USERS_TABLE);
+ $start = ( isset($_GET['start']) ) ? $_GET['start'] : 0;
+
+ $sql = 'SELECT u.user_id, u.username, u.user_email, u.user_lastvisit, u.user_active, s.session_id
+ FROM (' . USERS_TABLE . ' u
+ LEFT JOIN ' . SESSIONS_TABLE . ' s
+ ON u.user_id = s.session_user_id)
+ GROUP BY u.username
+ ORDER BY ' . $current_order['sql'] . '
+ LIMIT ' . $start . ',100';
+ if ( !($result = $db->query($sql)) )
+ {
+ message_die('Could not obtain user information', '', __FILE__, __LINE__, $sql);
+ }
+ while ( $row = $db->fetch_record($result) )
+ {
+ $user_online = ( !empty($row['session_id']) ) ? $user->lang['yes'] : $user->lang['no'];
+ $user_active = ( $row['user_active'] == '1' ) ? $user->lang['yes'] : $user->lang['no'];
+
+ $tpl->assign_block_vars('users_row', array(
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'U_MANAGE_USER' => 'manage_users.php'.$SID.'&amp;' . URI_NAME . '='.$row['username'],
+ 'USER_ID' => $row['user_id'],
+ 'NAME_STYLE' => ( $user->check_auth('a_', false, $row['user_id']) ) ? 'font-weight: bold' : 'font-weight: none',
+ 'USERNAME' => $row['username'],
+ 'U_MAIL_USER' => ( !empty($row['user_email']) ) ? 'mailto:'.$row['user_email'] : '',
+ 'EMAIL' => ( !empty($row['user_email']) ) ? $row['user_email'] : '&nbsp;',
+ 'LAST_VISIT' => date($user->style['date_time'], $row['user_lastvisit']),
+ 'ACTIVE' => $user_active,
+ 'ONLINE' => $user_online)
+ );
+ }
+ $db->free_result($result);
+
+ //
+ // Build the user permissions
+ //
+ $user_permissions = array(
+ // Events
+ $user->lang['events'] => array(
+ array('CBNAME' => 'a_event_add', 'CBCHECKED' => A_EVENT_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>'),
+ array('CBNAME' => 'a_event_upd', 'CBCHECKED' => A_EVENT_UPD, 'TEXT' => '<b>' . $user->lang['update'] . '</b>'),
+ array('CBNAME' => 'a_event_del', 'CBCHECKED' => A_EVENT_DEL, 'TEXT' => '<b>' . $user->lang['delete'] . '</b>'),
+ array('CBNAME' => 'u_event_list', 'CBCHECKED' => U_EVENT_LIST, 'TEXT' => $user->lang['list']),
+ array('CBNAME' => 'u_event_view', 'CBCHECKED' => U_EVENT_VIEW, 'TEXT' => $user->lang['view'])
+ ),
+ // Group adjustments
+ $user->lang['group_adjustments'] => array(
+ array('CBNAME' => 'a_groupadj_add', 'CBCHECKED' => A_GROUPADJ_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>'),
+ array('CBNAME' => 'a_groupadj_upd', 'CBCHECKED' => A_GROUPADJ_UPD, 'TEXT' => '<b>' . $user->lang['update'] . '</b>'),
+ array('CBNAME' => 'a_groupadj_del', 'CBCHECKED' => A_GROUPADJ_DEL, 'TEXT' => '<b>' . $user->lang['delete'] . '</b>')
+ ),
+ // Individual adjustments
+ $user->lang['individual_adjustments'] => array(
+ array('CBNAME' => 'a_indivadj_add', 'CBCHECKED' => A_INDIVADJ_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>'),
+ array('CBNAME' => 'a_indivadj_upd', 'CBCHECKED' => A_INDIVADJ_UPD, 'TEXT' => '<b>' . $user->lang['update'] . '</b>'),
+ array('CBNAME' => 'a_indivadj_del', 'CBCHECKED' => A_INDIVADJ_DEL, 'TEXT' => '<b>' . $user->lang['delete'] . '</b>')
+ ),
+ // Items
+ $user->lang['items'] => array(
+ array('CBNAME' => 'a_item_add', 'CBCHECKED' => A_ITEM_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>'),
+ array('CBNAME' => 'a_item_upd', 'CBCHECKED' => A_ITEM_UPD, 'TEXT' => '<b>' . $user->lang['update'] . '</b>'),
+ array('CBNAME' => 'a_item_del', 'CBCHECKED' => A_ITEM_DEL, 'TEXT' => '<b>' . $user->lang['delete'] . '</b>'),
+ array('CBNAME' => 'u_item_list', 'CBCHECKED' => U_ITEM_LIST, 'TEXT' => $user->lang['list']),
+ array('CBNAME' => 'u_item_view', 'CBCHECKED' => U_ITEM_VIEW, 'TEXT' => $user->lang['view'])
+ ),
+ // News
+ $user->lang['news'] => array(
+ array('CBNAME' => 'a_news_add', 'CBCHECKED' => A_NEWS_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>'),
+ array('CBNAME' => 'a_news_upd', 'CBCHECKED' => A_NEWS_UPD, 'TEXT' => '<b>' . $user->lang['update'] . '</b>'),
+ array('CBNAME' => 'a_news_del', 'CBCHECKED' => A_NEWS_DEL, 'TEXT' => '<b>' . $user->lang['delete'] . '</b>')
+ ),
+ // Raids
+ $user->lang['raids'] => array(
+ array('CBNAME' => 'a_raid_add', 'CBCHECKED' => A_RAID_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>'),
+ array('CBNAME' => 'a_raid_upd', 'CBCHECKED' => A_RAID_UPD, 'TEXT' => '<b>' . $user->lang['update'] . '</b>'),
+ array('CBNAME' => 'a_raid_del', 'CBCHECKED' => A_RAID_DEL, 'TEXT' => '<b>' . $user->lang['delete'] . '</b>'),
+ array('CBNAME' => 'u_raid_list', 'CBCHECKED' => U_RAID_LIST, 'TEXT' => $user->lang['list']),
+ array('CBNAME' => 'u_raid_view', 'CBCHECKED' => U_RAID_VIEW, 'TEXT' => $user->lang['view'])
+ ),
+ // Turn-ins
+ $user->lang['turn_ins'] => array(
+ array('CBNAME' => 'a_turnin_add', 'CBCHECKED' => A_TURNIN_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>')
+ ),
+ // Members
+ $user->lang['members'] => array(
+ array('CBNAME' => 'a_members_man', 'CBCHECKED' => A_MEMBERS_MAN, 'TEXT' => '<b>' . $user->lang['manage'] . '</b>'),
+ array('CBNAME' => 'u_member_list', 'CBCHECKED' => U_MEMBER_LIST, 'TEXT' => $user->lang['list']),
+ array('CBNAME' => 'u_member_view', 'CBCHECKED' => U_MEMBER_VIEW, 'TEXT' => $user->lang['view'])
+ ),
+ // Manage
+ $user->lang['manage'] => array(
+ array('CBNAME' => 'a_config_man', 'CBCHECKED' => A_CONFIG_MAN, 'TEXT' => '<b>' . $user->lang['configuration'] . '</b>'),
+ array('CBNAME' => 'a_plugins_man', 'CBCHECKED' => A_PLUGINS_MAN, 'TEXT' => '<b>' . $user->lang['plugins'] . '</b>'),
+ array('CBNAME' => 'a_styles_man', 'CBCHECKED' => A_STYLES_MAN, 'TEXT' => '<b>' . $user->lang['styles'] . '</b>'),
+ array('CBNAME' => 'a_users_man', 'CBCHECKED' => A_USERS_MAN, 'TEXT' => '<b>' . $user->lang['users'] . '</b>')
+ ),
+ // Logs
+ $user->lang['logs'] => array(
+ array('CBNAME' => 'a_logs_view', 'CBCHECKED' => A_LOGS_VIEW, 'TEXT' => '<b>' . $user->lang['view'] . '</b>')
+ ),
+ // Backup Database
+ $user->lang['backup'] => array(
+ array('CBNAME' => 'a_backup', 'CBCHECKED' => A_BACKUP, 'TEXT' => '<b>' . $user->lang['backup_database'] . '</b>')
+ )
+ );
+
+ // Add plugin checkboxes to our array
+ $pm->generate_permission_boxes($user_permissions);
+
+ // Find out our auth defaults
+ $auth_defaults = array();
+ $sql = 'SELECT auth_id, auth_value, auth_default
+ FROM ' . AUTH_OPTIONS_TABLE . '
+ ORDER BY auth_id';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $auth_defaults[ $row['auth_id'] ] = array(
+ 'auth_id' => $row['auth_id'],
+ 'auth_value' => $row['auth_value'],
+ 'auth_default' => $row['auth_default']);
+ }
+ $db->free_result($result);
+
+ foreach ( $user_permissions as $group => $checks )
+ {
+ $tpl->assign_block_vars('permissions_row', array(
+ 'GROUP' => $group)
+ );
+
+ foreach ( $checks as $data )
+ {
+ $auth_setting = ( isset($auth_defaults[ $data['CBCHECKED'] ]) ) ? $auth_defaults[ $data['CBCHECKED'] ] : null;
+ $tpl->assign_block_vars('permissions_row.check_group', array(
+ 'CBNAME' => $data['CBNAME'],
+ 'CBCHECKED' => ( (!is_null($auth_setting)) && ($auth_setting['auth_default'] == 'Y') ) ? ' checked="checked"' : '',
+ 'TEXT' => $data['TEXT'])
+ );
+ }
+ }
+ unset($user_permissions);
+
+ $tpl->assign_vars(array(
+ // Language
+ 'L_MANAGE_USERS' => $user->lang['manage_users'],
+ 'L_USERNAME' => $user->lang['username'],
+ 'L_EMAIL' => $user->lang['email_address'],
+ 'L_LAST_VISIT' => $user->lang['last_visit'],
+ 'L_ACTIVE' => $user->lang['active'],
+ 'L_ONLINE' => $user->lang['online'],
+ 'L_MASS_UPDATE' => $user->lang['mass_update'],
+ 'L_MASS_UPDATE_NOTE' => $user->lang['mass_update_note'],
+ 'L_ACCOUNT_ENABLED' => $user->lang['account_enabled'],
+ 'L_YES' => $user->lang['yes'],
+ 'L_NO' => $user->lang['no'],
+ 'L_MASS_DELETE' => $user->lang['mass_delete'],
+
+ // Sorting
+ 'O_USERNAME' => $current_order['uri'][0],
+ 'O_EMAIL' => $current_order['uri'][1],
+ 'O_LAST_VISIT' => $current_order['uri'][2],
+ 'O_ACTIVE' => $current_order['uri'][3],
+ 'O_ONLINE' => $current_order['uri'][4],
+
+ // Page vars
+ 'U_MANAGE_USERS' => 'manage_users.php' . $SID . '&amp;',
+ 'F_MASS_UPDATE' => 'manage_users.php' . $SID,
+ 'START' => $start,
+ 'LISTUSERS_FOOTCOUNT' => sprintf($user->lang['listusers_footcount'], $total_users, 100),
+ 'USER_PAGINATION' => generate_pagination('manage_users.php'.$SID.'&amp;o='.$current_order['uri']['current'], $total_users, 100, $start))
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['manage_users_title'],
+ 'template_file' => 'admin/listusers.html',
+ 'display' => true)
+ );
+ }
+
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $user_id = $this->user_data['user_id'];
+
+ //
+ // Build the user permissions
+ //
+ $user_permissions = array(
+ // Events
+ $user->lang['events'] => array(
+ array('CBNAME' => 'a_event_add', 'CBCHECKED' => A_EVENT_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>'),
+ array('CBNAME' => 'a_event_upd', 'CBCHECKED' => A_EVENT_UPD, 'TEXT' => '<b>' . $user->lang['update'] . '</b>'),
+ array('CBNAME' => 'a_event_del', 'CBCHECKED' => A_EVENT_DEL, 'TEXT' => '<b>' . $user->lang['delete'] . '</b>'),
+ array('CBNAME' => 'u_event_list', 'CBCHECKED' => U_EVENT_LIST, 'TEXT' => $user->lang['list']),
+ array('CBNAME' => 'u_event_view', 'CBCHECKED' => U_EVENT_VIEW, 'TEXT' => $user->lang['view'])
+ ),
+ // Group adjustments
+ $user->lang['group_adjustments'] => array(
+ array('CBNAME' => 'a_groupadj_add', 'CBCHECKED' => A_GROUPADJ_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>'),
+ array('CBNAME' => 'a_groupadj_upd', 'CBCHECKED' => A_GROUPADJ_UPD, 'TEXT' => '<b>' . $user->lang['update'] . '</b>'),
+ array('CBNAME' => 'a_groupadj_del', 'CBCHECKED' => A_GROUPADJ_DEL, 'TEXT' => '<b>' . $user->lang['delete'] . '</b>')
+ ),
+ // Individual adjustments
+ $user->lang['individual_adjustments'] => array(
+ array('CBNAME' => 'a_indivadj_add', 'CBCHECKED' => A_INDIVADJ_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>'),
+ array('CBNAME' => 'a_indivadj_upd', 'CBCHECKED' => A_INDIVADJ_UPD, 'TEXT' => '<b>' . $user->lang['update'] . '</b>'),
+ array('CBNAME' => 'a_indivadj_del', 'CBCHECKED' => A_INDIVADJ_DEL, 'TEXT' => '<b>' . $user->lang['delete'] . '</b>')
+ ),
+ // Items
+ $user->lang['items'] => array(
+ array('CBNAME' => 'a_item_add', 'CBCHECKED' => A_ITEM_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>'),
+ array('CBNAME' => 'a_item_upd', 'CBCHECKED' => A_ITEM_UPD, 'TEXT' => '<b>' . $user->lang['update'] . '</b>'),
+ array('CBNAME' => 'a_item_del', 'CBCHECKED' => A_ITEM_DEL, 'TEXT' => '<b>' . $user->lang['delete'] . '</b>'),
+ array('CBNAME' => 'u_item_list', 'CBCHECKED' => U_ITEM_LIST, 'TEXT' => $user->lang['list']),
+ array('CBNAME' => 'u_item_view', 'CBCHECKED' => U_ITEM_VIEW, 'TEXT' => $user->lang['view'])
+ ),
+ // News
+ $user->lang['news'] => array(
+ array('CBNAME' => 'a_news_add', 'CBCHECKED' => A_NEWS_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>'),
+ array('CBNAME' => 'a_news_upd', 'CBCHECKED' => A_NEWS_UPD, 'TEXT' => '<b>' . $user->lang['update'] . '</b>'),
+ array('CBNAME' => 'a_news_del', 'CBCHECKED' => A_NEWS_DEL, 'TEXT' => '<b>' . $user->lang['delete'] . '</b>')
+ ),
+ // Raids
+ $user->lang['raids'] => array(
+ array('CBNAME' => 'a_raid_add', 'CBCHECKED' => A_RAID_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>'),
+ array('CBNAME' => 'a_raid_upd', 'CBCHECKED' => A_RAID_UPD, 'TEXT' => '<b>' . $user->lang['update'] . '</b>'),
+ array('CBNAME' => 'a_raid_del', 'CBCHECKED' => A_RAID_DEL, 'TEXT' => '<b>' . $user->lang['delete'] . '</b>'),
+ array('CBNAME' => 'u_raid_list', 'CBCHECKED' => U_RAID_LIST, 'TEXT' => $user->lang['list']),
+ array('CBNAME' => 'u_raid_view', 'CBCHECKED' => U_RAID_VIEW, 'TEXT' => $user->lang['view'])
+ ),
+ // Turn-ins
+ $user->lang['turn_ins'] => array(
+ array('CBNAME' => 'a_turnin_add', 'CBCHECKED' => A_TURNIN_ADD, 'TEXT' => '<b>' . $user->lang['add'] . '</b>')
+ ),
+ // Members
+ $user->lang['members'] => array(
+ array('CBNAME' => 'a_members_man', 'CBCHECKED' => A_MEMBERS_MAN, 'TEXT' => '<b>' . $user->lang['manage'] . '</b>'),
+ array('CBNAME' => 'u_member_list', 'CBCHECKED' => U_MEMBER_LIST, 'TEXT' => $user->lang['list']),
+ array('CBNAME' => 'u_member_view', 'CBCHECKED' => U_MEMBER_VIEW, 'TEXT' => $user->lang['view'])
+ ),
+ // Manage
+ $user->lang['manage'] => array(
+ array('CBNAME' => 'a_config_man', 'CBCHECKED' => A_CONFIG_MAN, 'TEXT' => '<b>' . $user->lang['configuration'] . '</b>'),
+ array('CBNAME' => 'a_plugins_man', 'CBCHECKED' => A_PLUGINS_MAN, 'TEXT' => '<b>' . $user->lang['plugins'] . '</b>'),
+ array('CBNAME' => 'a_styles_man', 'CBCHECKED' => A_STYLES_MAN, 'TEXT' => '<b>' . $user->lang['styles'] . '</b>'),
+ array('CBNAME' => 'a_users_man', 'CBCHECKED' => A_USERS_MAN, 'TEXT' => '<b>' . $user->lang['users'] . '</b>')
+ ),
+ // Logs
+ $user->lang['logs'] => array(
+ array('CBNAME' => 'a_logs_view', 'CBCHECKED' => A_LOGS_VIEW, 'TEXT' => '<b>' . $user->lang['view'] . '</b>')
+ ),
+ // Backup Database
+ $user->lang['backup'] => array(
+ array('CBNAME' => 'a_backup', 'CBCHECKED' => A_BACKUP, 'TEXT' => '<b>' . $user->lang['backup_database'] . '</b>')
+ )
+ );
+
+ // Add plugin checkboxes to our array
+ $pm->generate_permission_boxes($user_permissions);
+
+ foreach ( $user_permissions as $group => $checks )
+ {
+ $tpl->assign_block_vars('permissions_row', array(
+ 'GROUP' => $group)
+ );
+
+ foreach ( $checks as $data )
+ {
+ $tpl->assign_block_vars('permissions_row.check_group', array(
+ 'CBNAME' => $data['CBNAME'],
+ 'CBCHECKED' => ( $user->check_auth($data['CBNAME'], false, $user_id) ) ? ' checked="checked"' : '',
+ 'TEXT' => $data['TEXT'])
+ );
+ }
+ }
+ unset($user_permissions);
+
+ // Build member drop-down
+ $sql = 'SELECT m.member_id, m.member_name, mu.user_id
+ FROM ' . MEMBERS_TABLE . ' m
+ LEFT JOIN ' . MEMBER_USER_TABLE . ' mu
+ ON m.member_id = mu.member_id
+ GROUP BY m.member_name
+ ORDER BY m.member_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $tpl->assign_block_vars('member_row', array(
+ 'VALUE' => $row['member_id'],
+ 'SELECTED' => ( (isset($row['user_id'])) && ($row['user_id'] == $this->user_data['user_id']) ) ? ' selected="selected"' : '',
+ 'OPTION' => $row['member_name'])
+ );
+ }
+ $db->free_result($result);
+
+ $tpl->assign_vars(array(
+ // Form vars
+ 'F_SETTINGS' => 'manage_users.php' . $SID,
+ 'S_CURRENT_PASSWORD' => false,
+ 'S_NEW_PASSWORD' => true,
+ 'S_SETTING_ADMIN' => true,
+ 'S_MU_TABLE' => true,
+
+ // Form values
+ 'NAME' => stripslashes($_REQUEST[URI_NAME]),
+ 'USER_ID' => $this->user_data['user_id'],
+ 'USERNAME' => $this->user_data['username'],
+ 'USER_EMAIL' => $this->user_data['user_email'],
+ 'USER_ALIMIT' => $this->user_data['user_alimit'],
+ 'USER_ELIMIT' => $this->user_data['user_elimit'],
+ 'USER_ILIMIT' => $this->user_data['user_ilimit'],
+ 'USER_NLIMIT' => $this->user_data['user_nlimit'],
+ 'USER_RLIMIT' => $this->user_data['user_rlimit'],
+ 'USER_ACTIVE_YES_CHECKED' => ( $this->user_data['user_active'] == '1' ) ? ' checked="checked"' : '',
+ 'USER_ACTIVE_NO_CHECKED' => ( $this->user_data['user_active'] == '0' ) ? ' checked="checked"' : '',
+
+ // Language
+ 'L_REGISTRATION_INFORMATION' => $user->lang['registration_information'],
+ 'L_REQUIRED_FIELD_NOTE' => $user->lang['required_field_note'],
+ 'L_USERNAME' => $user->lang['username'],
+ 'L_EMAIL_ADDRESS' => $user->lang['email_address'],
+ 'L_NEW_PASSWORD' => $user->lang['new_password'],
+ 'L_NEW_PASSWORD_NOTE' => $user->lang['new_password_note'],
+ 'L_CONFIRM_PASSWORD' => $user->lang['confirm_password'],
+ 'L_CONFIRM_PASSWORD_NOTE' => $user->lang['confirm_password_note'],
+ 'L_PREFERENCES' => $user->lang['preferences'],
+ 'L_ADJUSTMENTS_PER_PAGE' => $user->lang['adjustments_per_page'],
+ 'L_EVENTS_PER_PAGE' => $user->lang['events_per_page'],
+ 'L_ITEMS_PER_PAGE' => $user->lang['items_per_page'],
+ 'L_NEWS_PER_PAGE' => $user->lang['news_per_page'],
+ 'L_RAIDS_PER_PAGE' => $user->lang['raids_per_page'],
+ 'L_LANGUAGE' => $user->lang['language'],
+ 'L_STYLE' => $user->lang['style'],
+ 'L_PREVIEW' => $user->lang['preview'],
+ 'L_PERMISSIONS' => $user->lang['permissions'],
+ 'L_S_ADMIN_NOTE' => $user->lang['s_admin_note'],
+ 'L_ACCOUNT_ENABLED' => $user->lang['account_enabled'],
+ 'L_YES' => $user->lang['yes'],
+ 'L_NO' => $user->lang['no'],
+ 'L_ASSOCIATED_MEMBERS' => $user->lang['associated_members'],
+ 'L_MEMBERS' => $user->lang['members'],
+ 'L_SUBMIT' => $user->lang['submit'],
+ 'L_RESET' => $user->lang['reset'],
+
+ // Form validation
+ 'FV_USERNAME' => $this->fv->generate_error('username'),
+ 'FV_NEW_PASSWORD' => $this->fv->generate_error('new_user_password1'),
+ 'FV_USER_ALIMIT' => $this->fv->generate_error('user_alimit'),
+ 'FV_USER_ELIMIT' => $this->fv->generate_error('user_elimit'),
+ 'FV_USER_ILIMIT' => $this->fv->generate_error('user_ilimit'),
+ 'FV_USER_NLIMIT' => $this->fv->generate_error('user_nlimit'),
+ 'FV_USER_RLIMIT' => $this->fv->generate_error('user_rlimit'),
+ 'FV_MEMBER_ID' => $this->fv->generate_error('member_id'))
+ );
+
+ $pm->do_hooks('/admin/manage_users.php?action=settings');
+
+ //
+ // Build the language drop-down
+ //
+ if ( $dir = @opendir($eqdkp->root_path . 'language/') )
+ {
+ while ( $file = @readdir($dir) )
+ {
+ if ( (!is_file($eqdkp->root_path . 'language/' . $file)) && (!is_link($eqdkp->root_path . 'language/' . $file)) && ($file != '.') && ($file != '..') && ($file != 'CVS') )
+ {
+ $tpl->assign_block_vars('lang_row', array(
+ 'VALUE' => $file,
+ 'SELECTED' => ( $this->user_data['user_lang'] == $file ) ? ' selected="selected"' : '',
+ 'OPTION' => ucfirst($file))
+ );
+ }
+ }
+ }
+
+ //
+ // Build the style drop-down
+ //
+ $sql = 'SELECT style_id, style_name
+ FROM ' . STYLES_TABLE . '
+ ORDER BY style_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $tpl->assign_block_vars('style_row', array(
+ 'VALUE' => $row['style_id'],
+ 'SELECTED' => ( $this->user_data['user_style'] == $row['style_id'] ) ? ' selected="selected"' : '',
+ 'OPTION' => $row['style_name'])
+ );
+ }
+ $db->free_result($result);
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': Manage Users',
+ 'template_file' => 'settings.html',
+ 'display' => true)
+ );
+ }
+}
+
+$manage_users = new Manage_users;
+$manage_users->process();
+?>
diff --git a/admin/mm/index.html b/admin/mm/index.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/admin/mm/index.html
diff --git a/admin/mm/mm_addmember.php b/admin/mm/mm_addmember.php
new file mode 100644
index 0000000..90dbaa1
--- /dev/null
+++ b/admin/mm/mm_addmember.php
@@ -0,0 +1,559 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * mm_addmember.php
+ * Began: Thu January 30 2003
+ *
+ * $Id: mm_addmember.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+// This script handles adding, updating or deleting a member.
+// NOTE: This script will also process deleting multiple members through the
+// mm_listmembers interface
+
+if ( !defined('EQDKP_INC') )
+{
+ die('Hacking attempt');
+}
+
+class MM_Addmember extends EQdkp_Admin
+{
+ var $member = array(); // Holds member data if URI_NAME is set @var member
+ var $old_member = array(); // Holds member data from before POST @var old_member
+
+ function mm_addmember()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ $defaults = array(
+ 'member_earned' => '0.00',
+ 'member_spent' => '0.00',
+ 'member_adjustment' => '0.00');
+
+ $this->member = array(
+ 'member_id' => 0,
+ 'member_name' => post_or_db('member_name'),
+ 'member_earned' => post_or_db('member_earned', $defaults),
+ 'member_spent' => post_or_db('member_spent', $defaults),
+ 'member_adjustment' => post_or_db('member_adjustment', $defaults),
+ 'member_current' => '0.00',
+ 'member_race_id' => post_or_db('member_race_id'),
+ 'member_class_id' => post_or_db('member_class_id'),
+ 'member_level' => post_or_db('member_level'),
+ 'member_rank_id' => post_or_db('member_rank_id')
+ );
+
+ // Vars used to confirm deletion
+ $confirm_text = $user->lang['confirm_delete_members'];
+ $member_names = array();
+ if ( isset($_POST['delete']) )
+ {
+ if ( isset($_POST['compare_ids']) )
+ {
+ foreach ( $_POST['compare_ids'] as $id )
+ {
+ $member_name = $db->query_first('SELECT member_name FROM ' . MEMBERS_TABLE . " WHERE member_id='" . $id . "'");
+ $member_names[] = $member_name;
+ }
+
+ $names = implode(', ', $member_names);
+
+ $confirm_text .= '<br /><br />' . $names;
+ }
+ else
+ {
+ message_die('No members were selected for deletion.');
+ }
+ }
+
+ $this->set_vars(array(
+ 'confirm_text' => $confirm_text,
+ 'uri_parameter' => URI_NAME,
+ 'url_id' => ( sizeof($member_names) > 0 ) ? $names : (( isset($_GET[URI_NAME]) ) ? $_GET[URI_NAME] : ''),
+ 'script_name' => 'manage_members.php' . $SID . '&amp;mode=addmember')
+ );
+
+ $this->assoc_buttons(array(
+ 'add' => array(
+ 'name' => 'add',
+ 'process' => 'process_add',
+ 'check' => 'a_members_man'),
+ 'update' => array(
+ 'name' => 'update',
+ 'process' => 'process_update',
+ 'check' => 'a_members_man'),
+ 'delete' => array(
+ 'name' => 'delete',
+ 'process' => 'process_delete',
+ 'check' => 'a_members_man'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_members_man'))
+ );
+
+ // Build the member array
+ // ---------------------------------------------------------
+ if ( !empty($this->url_id) )
+ {
+ $sql = 'SELECT m.*, (m.member_earned - m.member_spent + m.member_adjustment) AS member_current,
+ c.class_name AS member_class, r.race_name AS member_race
+ FROM ' . MEMBERS_TABLE . ' m, ' . CLASS_TABLE . ' c, ' . RACE_TABLE . " r
+ WHERE r.race_id = m.member_race_id
+ AND c.class_id = m.member_class_id
+ AND member_name='" . $this->url_id . "'";
+ $result = $db->query($sql);
+ $row = $db->fetch_record($result);
+ $db->free_result($result);
+
+ $this->member = array(
+ 'member_id' => $row['member_id'],
+ 'member_name' => post_or_db('member_name', $row),
+ 'member_earned' => post_or_db('member_earned', $row),
+ 'member_spent' => post_or_db('member_spent', $row),
+ 'member_adjustment' => post_or_db('member_adjustment', $row),
+ 'member_current' => $row['member_current'],
+ 'member_race_id' => post_or_db('member_race_id', $row),
+ 'member_race' => $row['member_race'],
+ 'member_class_id' => post_or_db('member_class_id', $row),
+ 'member_class' => $row['member_class'],
+ 'member_level' => post_or_db('member_level', $row),
+ 'member_rank_id' => post_or_db('member_rank_id', $row)
+ );
+ }
+ }
+
+ function error_check()
+ {
+ global $user, $SID;
+
+ if ( (isset($_POST['add'])) || (isset($_POST['update'])) )
+ {
+ $this->fv->is_filled('member_name', $user->lang['fv_required_name']);
+ $this->fv->is_number(array(
+ 'member_earned' => $user->lang['fv_number'],
+ 'member_spent' => $user->lang['fv_number'],
+ 'member_adjustment' => $user->lang['fv_number'])
+ );
+ }
+
+ return $this->fv->is_error();
+ }
+
+ // ---------------------------------------------------------
+ // Process Add
+ // ---------------------------------------------------------
+ function process_add()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ //
+ // Insert the member
+ //
+
+ // Make sure that each member's name is properly capitalized
+ $member_name = strtolower(preg_replace('/[[:space:]]/i', ' ', $_POST['member_name']));
+ $member_name = ucwords($member_name);
+
+ // Check for existing member name
+ $sql = "SELECT member_id FROM " . MEMBERS_TABLE ." WHERE member_name = '".$member_name."'";
+ $member_id = $db->query_first($sql);
+
+
+ // Error out if member name exists
+ if ( isset($member_id) && $member_id > 0 ) {
+
+ $failure_message = "Failed to add $member_name; member exists as ID $member_id";
+ $link_list = array(
+ $user->lang['add_member'] => 'manage_members.php' . $SID . '&amp;mode=addmember',
+ $user->lang['list_edit_del_member'] => 'manage_members.php' . $SID . '&amp;mode=list');
+
+ message_die($failure_message, $link_list);
+
+ }
+
+
+ $query = $db->build_query('INSERT', array(
+ 'member_name' => $member_name,
+ 'member_earned' => $_POST['member_earned'],
+ 'member_spent' => $_POST['member_spent'],
+ 'member_adjustment' => $_POST['member_adjustment'],
+ 'member_firstraid' => 0,
+ 'member_lastraid' => 0,
+ 'member_raidcount' => 0,
+ 'member_level' => $_POST['member_level'],
+ 'member_race_id' => $_POST['member_race_id'],
+ 'member_class_id' => $_POST['member_class_id'],
+ 'member_rank_id' => $_POST['member_rank_id'])
+ );
+ $db->query('INSERT INTO ' . MEMBERS_TABLE . $query);
+
+ //
+ // Logging
+ //
+ $log_action = array(
+ 'header' => '{L_ACTION_MEMBER_ADDED}',
+ '{L_NAME}' => $member_name,
+ '{L_EARNED}' => $_POST['member_earned'],
+ '{L_SPENT}' => $_POST['member_spent'],
+ '{L_ADJUSTMENT}' => $_POST['member_adjustment'],
+ '{L_LEVEL}' => $_POST['member_level'],
+ '{L_RACE}' => $_POST['member_race_id'],
+ '{L_CLASS}' => $_POST['member_class_id'],
+ '{L_ADDED_BY}' => $this->admin_user);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success message
+ //
+ $success_message = sprintf($user->lang['admin_add_member_success'], $member_name);
+ $link_list = array(
+ $user->lang['add_member'] => 'manage_members.php' . $SID . '&amp;mode=addmember',
+ $user->lang['list_edit_del_member'] => 'manage_members.php' . $SID . '&amp;mode=list');
+ $this->admin_die($success_message, $link_list);
+ }
+
+ // ---------------------------------------------------------
+ // Process Update
+ // ---------------------------------------------------------
+ function process_update()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ //
+ // Get old member data
+ //
+ $this->get_old_data($_POST[URI_NAME]);
+ $member_id = $this->old_member['member_id'];
+ $old_member_name = $this->old_member['member_name'];
+
+ // Make sure that each member's name is properly capitalized
+ $member_name = strtolower(preg_replace('/[[:space:]]/i', ' ', $_POST['member_name']));
+ $member_name = ucwords($member_name);
+
+ //
+ // Update the member
+ //
+ $query = $db->build_query('UPDATE', array(
+ 'member_name' => $member_name,
+ 'member_earned' => $_POST['member_earned'],
+ 'member_spent' => $_POST['member_spent'],
+ 'member_adjustment' => $_POST['member_adjustment'],
+ 'member_level' => $_POST['member_level'],
+ 'member_race_id' => $_POST['member_race_id'],
+ 'member_class_id' => $_POST['member_class_id'],
+ 'member_rank_id' => $_POST['member_rank_id'])
+ );
+ $db->query('UPDATE ' . MEMBERS_TABLE . ' SET ' . $query . " WHERE member_name='" . $old_member_name . "'");
+
+ if ( !($member_name == $old_member_name) ) {
+
+ $sql = "UPDATE " . RAID_ATTENDEES_TABLE . " SET member_name = '" . $member_name ."' WHERE member_name = '". $old_member_name . "'";
+ $db->query_first($sql);
+
+ $sql = "UPDATE " . ITEMS_TABLE . " SET item_buyer = '" . $member_name ."' WHERE item_buyer = '". $old_member_name . "'";
+ $db->query_first($sql);
+
+ $sql = "UPDATE " . ADJUSTMENT_TABLE . " SET member_name = '" . $member_name ."' WHERE member_name = '". $old_member_name . "'";
+ $db->query_first($sql);
+
+ }
+
+
+ //
+ // Logging
+ //
+ $log_action = array(
+ 'header' => '{L_ACTION_MEMBER_UPDATED}',
+ '{L_NAME_BEFORE}' => $this->old_member['member_name'],
+ '{L_EARNED_BEFORE}' => $this->old_member['member_earned'],
+ '{L_SPENT_BEFORE}' => $this->old_member['member_spent'],
+ '{L_ADJUSTMENT_BEFORE}' => $this->old_member['member_adjustment'],
+ '{L_LEVEL_BEFORE}' => $this->old_member['member_level'],
+ '{L_RACE_BEFORE}' => $this->old_member['member_race_id'],
+ '{L_CLASS_BEFORE}' => $this->old_member['member_class_id'],
+ '{L_NAME_AFTER}' => $this->find_difference($this->old_member['member_name'], $member_name),
+ '{L_EARNED_AFTER}' => $this->find_difference($this->old_member['member_earned'], $_POST['member_earned']),
+ '{L_SPENT_AFTER}' => $this->find_difference($this->old_member['member_spent'], $_POST['member_spent']),
+ '{L_ADJUSTMENT_AFTER}' => $this->find_difference($this->old_member['member_adjustment'], $_POST['member_adjustment']),
+ '{L_LEVEL_AFTER}' => $this->find_difference($this->old_member['member_level'], $_POST['member_level']),
+ '{L_RACE_AFTER}' => $this->find_difference($this->old_member['member_race_id'], $_POST['member_race_id']),
+ '{L_CLASS_AFTER}' => $this->find_difference($this->old_member['member_class_id'], $_POST['member_class_id']),
+ '{L_UPDATED_BY}' => $this->admin_user);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success message
+ //
+ $success_message = sprintf($user->lang['admin_update_member_success'], $this->old_member['member_name']);
+ $this->admin_die($success_message);
+ }
+
+ // ---------------------------------------------------------
+ // Process Delete (confirmed)
+ // ---------------------------------------------------------
+ function process_confirm()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $success_message = '';
+ $members = explode(', ', $_POST[URI_NAME]);
+ foreach ( $members as $member_name )
+ {
+ if ( empty($member_name) )
+ {
+ continue;
+ }
+
+ //
+ // Get old member data
+ //
+ $this->get_old_data($member_name);
+
+ //
+ // Delete attendance
+ //
+ $sql = 'DELETE FROM ' . RAID_ATTENDEES_TABLE . "
+ WHERE member_name='" . $member_name . "'";
+ $db->query($sql);
+
+ //
+ // Delete items
+ //
+ $sql = 'DELETE FROM ' . ITEMS_TABLE . "
+ WHERE item_buyer='" . $member_name . "'";
+ $db->query($sql);
+
+ //
+ // Delete adjustments
+ //
+ $sql = 'DELETE FROM ' . ADJUSTMENTS_TABLE . "
+ WHERE member_name='" . $member_name . "'";
+ $db->query($sql);
+
+ //
+ // Delete member
+ //
+ $sql = 'DELETE FROM ' . MEMBERS_TABLE . "
+ WHERE member_name='" . $member_name . "'";
+ $db->query($sql);
+
+ //
+ // Logging
+ //
+ $log_action = array(
+ 'header' => '{L_ACTION_MEMBER_DELETED}',
+ '{L_NAME}' => $this->old_member['member_name'],
+ '{L_EARNED}' => $this->old_member['member_earned'],
+ '{L_SPENT}' => $this->old_member['member_spent'],
+ '{L_ADJUSTMENT}' => $this->old_member['member_adjustment'],
+ '{L_LEVEL}' => $this->old_member['member_level'],
+ '{L_RACE}' => $this->old_member['member_race_id'],
+ '{L_CLASS}' => $this->old_member['member_class_id']);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Append success message
+ //
+ $success_message .= sprintf($user->lang['admin_delete_members_success'], $member_name) . '<br />';
+ }
+
+ //
+ // Success message
+ //
+ $this->admin_die($success_message);
+ }
+
+ // ---------------------------------------------------------
+ // Process helper methods
+ // ---------------------------------------------------------
+ function get_old_data($member_name)
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $sql = 'SELECT *
+ FROM ' . MEMBERS_TABLE . "
+ WHERE member_name='" . $member_name . "'";
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $this->old_member = array(
+ 'member_name' => addslashes($row['member_name']),
+ 'member_id' => $row['member_id'],
+ 'member_earned' => $row['member_earned'],
+ 'member_spent' => $row['member_spent'],
+ 'member_adjustment' => $row['member_adjustment'],
+ 'member_level' => $row['member_level'],
+ 'member_race_id' => $row['member_race_id'],
+ 'member_class_id' => $row['member_class_id']);
+ }
+ $db->free_result($result);
+ }
+
+ // ---------------------------------------------------------
+ // Display form
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ // New for 1.3 - get class and race information from the database
+ // This section populates $eq_classes for the form. They are not
+ // populated in a multidimensional array anymore.
+
+ $eq_classes = array();
+
+ $sql = 'SELECT class_id, class_name, class_min_level, class_max_level FROM ' . CLASS_TABLE .' GROUP BY class_id';
+ $result = $db->query($sql);
+
+ while ( $row = $db->fetch_record($result) )
+ {
+
+ if ( $row['class_min_level'] == '0' ) {
+ $option = ( !empty($row['class_name']) ) ? stripslashes($row['class_name'])." Level (".$row['class_min_level']." - ".$row['class_max_level'].")" : '(None)';
+ } else {
+ $option = ( !empty($row['class_name']) ) ? stripslashes($row['class_name'])." Level ".$row['class_min_level']."+" : '(None)';
+ }
+
+ $tpl->assign_block_vars('class_row', array(
+ 'VALUE' => $row['class_id'],
+ 'SELECTED' => ( $this->member['member_class_id'] == $row['class_id'] ) ? ' selected="selected"' : '',
+ 'OPTION' => $option )
+ );
+
+ $eq_classes[] = $row[0];
+ }
+
+ $db->free_result($result);
+
+ // New for 1.3 - get race information from the database
+
+ $eq_races = array();
+
+ $sql = 'SELECT race_id, race_name FROM ' . RACE_TABLE .' GROUP BY race_name';
+ $result = $db->query($sql);
+
+ while ( $row = $db->fetch_record($result) )
+ {
+ $tpl->assign_block_vars('race_row', array(
+ 'VALUE' => $row['race_id'],
+ 'SELECTED' => ( $this->member['member_race_id'] == $row['race_id'] ) ? ' selected="selected"' : '',
+ 'OPTION' => ( !empty($row['race_name']) ) ? stripslashes($row['race_name']) : '(None)')
+ );
+
+ $eq_races[] = $row[0];
+ }
+
+ $db->free_result($result);
+
+ // end 1.3 changes
+
+ if ( !empty($this->member['member_name']) )
+ {
+ // Get their correct earned/spent
+ $correct_earned = $db->query_first('SELECT sum(r.raid_value)
+ FROM ' . RAIDS_TABLE . ' r, ' . RAID_ATTENDEES_TABLE . " ra
+ WHERE ra.raid_id = r.raid_id
+ AND ra.member_name='" . addslashes($this->member['member_name']) . "'");
+
+ $correct_spent = $db->query_first('SELECT sum(item_value)
+ FROM ' . ITEMS_TABLE . "
+ WHERE item_buyer='" . addslashes($this->member['member_name']) . "'");
+ }
+
+ //
+ // Build rank drop-down
+ //
+ $sql = 'SELECT rank_id, rank_name
+ FROM ' . MEMBER_RANKS_TABLE . '
+ ORDER BY rank_id';
+ $result = $db->query($sql);
+
+ while ( $row = $db->fetch_record($result) )
+ {
+ $tpl->assign_block_vars('rank_row', array(
+ 'VALUE' => $row['rank_id'],
+ 'SELECTED' => ( $this->member['member_rank_id'] == $row['rank_id'] ) ? ' selected="selected"' : '',
+ 'OPTION' => ( !empty($row['rank_name']) ) ? stripslashes($row['rank_name']) : '(None)')
+ );
+ }
+ $db->free_result($result);
+
+ $tpl->assign_vars(array(
+ // Form vars
+ 'F_ADD_MEMBER' => 'manage_members.php' . $SID . '&amp;mode=addmember',
+
+ // Form values
+ 'MEMBER_NAME' => $this->member['member_name'],
+ 'V_MEMBER_NAME' => ( isset($_POST['add']) ) ? '' : $this->member['member_name'],
+ 'MEMBER_ID' => $this->member['member_id'],
+ 'MEMBER_EARNED' => $this->member['member_earned'],
+ 'MEMBER_SPENT' => $this->member['member_spent'],
+ 'MEMBER_ADJUSTMENT' => $this->member['member_adjustment'],
+ 'MEMBER_CURRENT' => ( !empty($this->member['member_current']) ) ? $this->member['member_current'] : '0.00',
+ 'MEMBER_LEVEL' => $this->member['member_level'],
+ 'CORRECT_MEMBER_EARNED' => ( !empty($correct_earned) ) ? $correct_earned : '0.00',
+ 'CORRECT_MEMBER_SPENT' => ( !empty($correct_spent) ) ? $correct_spent : '0.00',
+ 'C_MEMBER_CURRENT' => color_item($this->member['member_current']),
+
+ // Language
+ 'L_ADD_MEMBER_TITLE' => $user->lang['addmember_title'],
+ 'L_NAME' => $user->lang['name'],
+ 'L_RACE' => $user->lang['race'],
+ 'L_CLASS' => $user->lang['class'],
+ 'L_LEVEL' => $user->lang['level'],
+ 'L_EARNED' => $user->lang['earned'],
+ 'L_SPENT' => $user->lang['spent'],
+ 'L_ADJUSTMENT' => $user->lang['adjustment'],
+ 'L_CURRENT' => $user->lang['current'],
+ 'L_SHOULD_BE' => $user->lang['should_be'],
+ 'L_MEMBER_RANK' => $user->lang['member_rank'],
+ 'L_ADD_MEMBER' => $user->lang['add_member'],
+ 'L_RESET' => $user->lang['reset'],
+ 'L_UPDATE_MEMBER' => $user->lang['update_member'],
+ 'L_DELETE_MEMBER' => $user->lang['delete_member'],
+
+ // Form validation
+ 'FV_MEMBER_NAME' => $this->fv->generate_error('member_name'),
+ 'FV_MEMBER_LEVEL' => $this->fv->generate_error('member_level'),
+ 'FV_MEMBER_EARNED' => $this->fv->generate_error('member_earned'),
+ 'FV_MEMBER_SPENT' => $this->fv->generate_error('member_spent'),
+ 'FV_MEMBER_ADJUSTMENT' => $this->fv->generate_error('member_adjustment'),
+ 'FV_MEMBER_CURRENT' => $this->fv->generate_error('member_current'),
+
+ // Javascript messages
+ 'MSG_NAME_EMPTY' => $user->lang['fv_required_name'],
+
+ // Buttons
+ 'S_ADD' => ( !empty($this->url_id) ) ? false : true)
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['manage_members_title'],
+ 'template_file' => 'admin/mm_addmember.html',
+ 'display' => true)
+ );
+ }
+}
+?>
diff --git a/admin/mm/mm_addmember.php.NEW.gz b/admin/mm/mm_addmember.php.NEW.gz
new file mode 100644
index 0000000..17295ed
--- /dev/null
+++ b/admin/mm/mm_addmember.php.NEW.gz
Binary files differ
diff --git a/admin/mm/mm_listmembers.php b/admin/mm/mm_listmembers.php
new file mode 100644
index 0000000..a2b59bf
--- /dev/null
+++ b/admin/mm/mm_listmembers.php
@@ -0,0 +1,129 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * mm_listmembers.php
+ * Began: Thu January 30 2003
+ *
+ * $Id: mm_listmembers.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+// Shows a list of members, basically just an admin-themed version of
+// /listmembers.php
+
+if ( !defined('EQDKP_INC') )
+{
+ die('Hacking attempt');
+}
+
+$sort_order = array(
+ 0 => array('member_name', 'member_name desc'),
+ 1 => array('member_earned desc', 'member_earned'),
+ 2 => array('member_spent desc', 'member_spent'),
+ 3 => array('member_adjustment desc', 'member_adjustment'),
+ 4 => array('member_current desc', 'member_current'),
+ 5 => array('member_lastraid desc', 'member_lastraid'),
+ 6 => array('member_level desc', 'member_level'),
+ 7 => array('member_class', 'member_class desc'),
+ 8 => array('rank_name', 'rank_name desc'),
+ 9 => array('class_armor_type', 'class_armor_type desc')
+
+);
+
+$current_order = switch_order($sort_order);
+
+$member_count = 0;
+$previous_data = '';
+
+// Figure out what data we're comparing from member to member
+// in order to rank them
+$sort_index = explode('.', $current_order['uri']['current']);
+$previous_source = preg_replace('/( (asc|desc))?/i', '', $sort_order[$sort_index[0]][$sort_index[1]]);
+
+$show_all = ( (!empty($_GET['show'])) && ($_GET['show'] == 'all') ) ? true : false;
+
+$sql = 'SELECT m.*, (m.member_earned-m.member_spent+m.member_adjustment) AS member_current,
+ c.class_name AS member_class,
+ r.rank_name, r.rank_prefix, r.rank_suffix,
+ c.class_armor_type AS armor_type
+ FROM ' . MEMBERS_TABLE . ' m, ' . MEMBER_RANKS_TABLE . ' r, ' .CLASS_TABLE. ' c
+ WHERE (m.member_rank_id = r.rank_id)
+ AND (m.member_class_id = c.class_id)
+ ORDER BY ' . $current_order['sql'];
+if ( !($members_result = $db->query($sql)) )
+{
+ message_die('Could not obtain member information', '', __FILE__, __LINE__, $sql);
+}
+while ( $row = $db->fetch_record($members_result) )
+{
+ $member_count++;
+ $tpl->assign_block_vars('members_row', array(
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'ID' => $row['member_id'],
+ 'COUNT' => ($row[$previous_source] == $previous_data) ? '&nbsp;' : $member_count,
+ 'NAME' => $row['rank_prefix'] . $row['member_name'] . $row['rank_suffix'],
+ 'RANK' => stripslashes($row['rank_name']),
+ 'LEVEL' => ( $row['member_level'] > 0 ) ? $row['member_level'] : '&nbsp;',
+ 'ARMOR' => ( !empty($row['armor_type']) ) ? $row['armor_type'] : '&nbsp;',
+ 'CLASS' => ( $row['member_class'] != 'NULL' ) ? $row['member_class'] : '&nbsp;',
+ 'EARNED' => $row['member_earned'],
+ 'SPENT' => $row['member_spent'],
+ 'ADJUSTMENT' => $row['member_adjustment'],
+ 'CURRENT' => $row['member_current'],
+ 'LASTRAID' => ( !empty($row['member_lastraid']) ) ? date($user->style['date_notime_short'], $row['member_lastraid']) : '&nbsp;',
+ 'C_ADJUSTMENT' => color_item($row['member_adjustment']),
+ 'C_CURRENT' => color_item($row['member_current']),
+ 'C_LASTRAID' => 'neutral',
+ 'U_VIEW_MEMBER' => 'manage_members.php'.$SID . '&amp;mode=addmember&amp;' . URI_NAME . '='.$row['member_name'])
+ );
+
+ // So that we can compare this member to the next member,
+ // set the value of the previous data to the source
+ $previous_data = $row[$previous_source];
+}
+$footcount_text = sprintf($user->lang['listmembers_footcount'], $db->num_rows($members_result));
+
+$tpl->assign_vars(array(
+ 'F_MEMBERS' => 'manage_members.php' . $SID . '&amp;mode=addmember',
+
+ 'L_NAME' => $user->lang['name'],
+ 'L_RANK' => $user->lang['rank'],
+ 'L_LEVEL' => $user->lang['level'],
+ 'L_CLASS' => $user->lang['class'],
+ 'L_EARNED' => $user->lang['earned'],
+ 'L_SPENT' => $user->lang['spent'],
+ 'L_ARMOR' => $user->lang['armor'],
+ 'L_ADJUSTMENT' => $user->lang['adjustment'],
+ 'L_CURRENT' => $user->lang['current'],
+ 'L_LASTRAID' => $user->lang['lastraid'],
+ 'BUTTON_NAME' => 'delete',
+ 'BUTTON_VALUE' => $user->lang['delete_selected_members'],
+
+ 'O_NAME' => $current_order['uri'][0],
+ 'O_RANK' => $current_order['uri'][8],
+ 'O_LEVEL' => $current_order['uri'][6],
+ 'O_CLASS' => $current_order['uri'][7],
+ 'O_ARMOR' => $current_order['uri'][9],
+ 'O_EARNED' => $current_order['uri'][1],
+ 'O_SPENT' => $current_order['uri'][2],
+ 'O_ADJUSTMENT' => $current_order['uri'][3],
+ 'O_CURRENT' => $current_order['uri'][4],
+ 'O_LASTRAID' => $current_order['uri'][5],
+
+ 'U_LIST_MEMBERS' => 'manage_members.php'.$SID.'&amp;mode=list&amp;',
+
+ 'S_COMPARE' => false,
+ 'S_NOTMM' => false,
+
+ 'LISTMEMBERS_FOOTCOUNT' => $footcount_text)
+);
+
+$eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['listmembers_title'],
+ 'template_file' => 'listmembers.html',
+ 'display' => true)
+);
+?>
diff --git a/admin/mm/mm_ranks.php b/admin/mm/mm_ranks.php
new file mode 100644
index 0000000..082e784
--- /dev/null
+++ b/admin/mm/mm_ranks.php
@@ -0,0 +1,150 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * mm_ranks.php
+ * Began: Fri February 14 2003
+ *
+ * $Id: mm_ranks.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+// This script handles editing membership ranks
+if ( !defined('EQDKP_INC') )
+{
+ die('Hacking attempt');
+}
+
+class MM_Ranks extends EQdkp_Admin
+{
+ function mm_ranks()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ $this->assoc_buttons(array(
+ 'submit' => array(
+ 'name' => 'submit',
+ 'process' => 'process_submit',
+ 'check' => 'a_members_man'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_members_man'))
+ );
+ }
+
+ function error_check()
+ {
+ return $this->fv->is_error();
+ }
+
+ // ---------------------------------------------------------
+ // Process submit
+ // ---------------------------------------------------------
+ function process_submit()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ foreach ( $_POST['ranks'] as $rank_id => $rank_name )
+ {
+ $sql = 'DELETE FROM ' . MEMBER_RANKS_TABLE . "
+ WHERE rank_id='" . $rank_id . "'";
+ $db->query($sql);
+
+ // If the rank's been removed, NULL the member_rank for users that have it
+ if ( $rank_name == '' )
+ {
+ $sql = 'UPDATE ' . MEMBERS_TABLE . "
+ SET member_rank_id = NULL
+ WHERE member_rank_id='" . $rank_id . "'";
+ $db->query($sql);
+ }
+ // Otherwise re-add the rank to the table
+ else
+ {
+ $rank_prefix = ( isset($_POST['prefix'][$rank_id]) ) ? $_POST['prefix'][$rank_id] : '';
+ $rank_suffix = ( isset($_POST['suffix'][$rank_id]) ) ? $_POST['suffix'][$rank_id] : '';
+
+ $rank_prefix = undo_sanitize_tags(stripslashes($rank_prefix));
+ $rank_suffix = undo_sanitize_tags(stripslashes($rank_suffix));
+
+ $query = $db->build_query('INSERT', array(
+ 'rank_id' => $rank_id,
+ 'rank_name' => $rank_name,
+ 'rank_hide' => ( isset($_POST['hide'][$rank_id]) ) ? '1' : '0',
+ 'rank_prefix' => $rank_prefix,
+ 'rank_suffix' => $rank_suffix)
+ );
+ $db->query('INSERT INTO ' . MEMBER_RANKS_TABLE . $query);
+ }
+ }
+
+ header('Location: manage_members.php' . $SID . '&mode=ranks');
+ }
+
+ // ---------------------------------------------------------
+ // Display form
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ //
+ // Populate the fields
+ //
+ $max_id = 0;
+ $sql = 'SELECT rank_id, rank_name, rank_hide, rank_prefix, rank_suffix
+ FROM ' . MEMBER_RANKS_TABLE . '
+ WHERE rank_id > 0
+ ORDER BY rank_id';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $prefix = htmlspecialchars($row['rank_prefix']);
+ $suffix = htmlspecialchars($row['rank_suffix']);
+
+ $tpl->assign_block_vars('ranks_row', array(
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'RANK_ID' => $row['rank_id'],
+ 'RANK_NAME' => stripslashes($row['rank_name']),
+ 'RANK_PREFIX' => stripslashes($prefix),
+ 'RANK_SUFFIX' => stripslashes($suffix),
+ 'HIDE_CHECKED' => ( $row['rank_hide'] == '1' ) ? 'checked="checked"' : '')
+ );
+ $max_id = ( $max_id < $row['rank_id'] ) ? $row['rank_id'] : $max_id;
+ }
+ $db->free_result($result);
+
+ $tpl->assign_vars(array(
+ // Form vars
+ 'F_EDIT_RANKS' => 'manage_members.php' . $SID . '&amp;mode=ranks',
+
+ // Form values
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'RANK_ID' => ($max_id * 2),
+
+ // Language
+ 'L_EDIT_RANKS_TITLE' => $user->lang['edit_ranks'],
+ 'L_TITLE' => $user->lang['title'],
+ 'L_HIDE' => $user->lang['hide'],
+ 'L_LIST_PREFIX' => $user->lang['list_prefix'],
+ 'L_LIST_SUFFIX' => $user->lang['list_suffix'],
+ 'L_EDIT_RANKS' => $user->lang['edit_ranks'],
+ 'L_RESET' => $user->lang['reset'])
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['manage_members_title'],
+ 'template_file' => 'admin/mm_ranks.html',
+ 'display' => true)
+ );
+ }
+}
+?> \ No newline at end of file
diff --git a/admin/mm/mm_transfer.php b/admin/mm/mm_transfer.php
new file mode 100644
index 0000000..9342fc1
--- /dev/null
+++ b/admin/mm/mm_transfer.php
@@ -0,0 +1,249 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * mm_transfer.php
+ * Began: Thu January 30 2003
+ *
+ * $Id: mm_transfer.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+// This script handles processing of a member history transfer
+// Also displays the form to do so
+
+if ( !defined('EQDKP_INC') )
+{
+ die('Hacking attempt');
+}
+
+class MM_Transfer extends EQdkp_Admin
+{
+ var $transfer = array();
+
+ function mm_transfer()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ $this->transfer = array(
+ 'from' => post_or_db('turnin_from'),
+ 'to' => post_or_db('turnin_to')
+ );
+
+ $this->assoc_buttons(array(
+ 'transfer' => array(
+ 'name' => 'transfer',
+ 'process' => 'process_transfer',
+ 'check' => 'a_members_man'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_members_man'))
+ );
+ }
+
+ function error_check()
+ {
+ global $user;
+
+ if ( (!isset($_POST['transfer_from'])) || (!isset($_POST['transfer_to'])) || ($_POST['transfer_from'] == '') || ($_POST['transfer_to'] == '') )
+ {
+ $this->fv->errors['transfer'] = '';
+ }
+ if ( $_POST['transfer_from'] == $_POST['transfer_to'] )
+ {
+ $this->fv->errors['transfer'] = $user->lang['fv_difference_transfer'];
+ }
+
+ $this->transfer = array(
+ 'from' => post_or_db('transfer_from'),
+ 'to' => post_or_db('transfer_to')
+ );
+
+ return $this->fv->is_error();
+ }
+
+ // ---------------------------------------------------------
+ // Process transfer
+ // ---------------------------------------------------------
+ function process_transfer()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ // Dev note: At some point, I'd like to make this more configurable
+ // ie, They can select what (raid, item, adjustment) they want to transfer
+ // and maybe even select specific raids/items/adjustments - not now though
+
+ $member_from = $_POST['transfer_from'];
+ $member_to = $_POST['transfer_to'];
+
+ // Transfer raids
+ $raidcount_addon = 0; // So we know their new raidcount
+ $sql = 'SELECT raid_id, member_name
+ FROM ' . RAID_ATTENDEES_TABLE . "
+ WHERE member_name='".$member_from."'";
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ // Check if the TO attended the same raid
+ $sql = 'SELECT member_name
+ FROM ' . RAID_ATTENDEES_TABLE . "
+ WHERE raid_id='".$row['raid_id']."'
+ AND member_name='".$member_to."'";
+
+ // If they didn't, replace the FROM with the TWO
+ if ( $db->num_rows($db->query($sql)) == 0 )
+ {
+ $sql = 'UPDATE ' . RAID_ATTENDEES_TABLE . "
+ SET member_name='".$member_to."'
+ WHERE raid_id='".$row['raid_id']."'
+ AND member_name='".$member_from."'";
+ $db->query($sql);
+ $raidcount_addon++;
+ }
+ }
+
+ // Find their new earned
+ $sql = 'SELECT sum(r.raid_value)
+ FROM ' . RAIDS_TABLE . ' r, ' . RAID_ATTENDEES_TABLE . " ra
+ WHERE (ra.raid_id = r.raid_id) AND (ra.member_name='".$member_to."')";
+ $earned = $db->query_first($sql);
+
+ // Transfer Items
+ $sql = 'UPDATE ' . ITEMS_TABLE . "
+ SET item_buyer='".$member_to."'
+ WHERE item_buyer='".$member_from."'";
+ $db->query($sql);
+
+ // Find their new spent
+ $sql = 'SELECT sum(item_value)
+ FROM ' . ITEMS_TABLE . "
+ WHERE item_buyer='".$member_to."'";
+ $spent = $db->query_first($sql);
+
+ // Transfer adjustments
+ $sql = 'UPDATE ' . ADJUSTMENTS_TABLE . "
+ SET member_name='".$member_to."'
+ WHERE member_name='".$member_from."'";
+ $db->query($sql);
+
+ // Find the new total adjustment
+ // We're doing this two ways
+ // 1: Individual adjustments get lumped into the total no matter what
+ // 2: Group adjustments are added if their first raid was (they were added)
+ // on or before the adjustment date
+ $sql = 'SELECT sum(adjustment_value)
+ FROM ' . ADJUSTMENTS_TABLE . "
+ WHERE member_name='".$member_to."'";
+ $total_iadj = $db->query_first($sql);
+
+ $sql = 'SELECT sum(a.adjustment_value)
+ FROM ( ' . ADJUSTMENTS_TABLE . ' a
+ LEFT JOIN ' . MEMBERS_TABLE . " m
+ ON m.member_firstraid <= a.adjustment_date )
+ WHERE m.member_name='".$member_to."'
+ AND a.member_name IS NULL";
+ $total_gadj = $db->query_first($sql);
+
+ $adjustment = ($total_gadj + $total_iadj);
+ $adjustment = ( !empty($adjustment) ) ? $adjustment : '0.00';
+
+ // Update the member_to
+ $sql = 'UPDATE ' . MEMBERS_TABLE . "
+ SET member_earned='".$earned."',
+ member_spent='".$spent."',
+ member_adjustment='".$adjustment."',
+ member_raidcount = member_raidcount+".$raidcount_addon."
+ WHERE member_name='".$member_to."'";
+ $db->query($sql);
+
+ // Delete the member_from
+ $sql = 'DELETE FROM ' . MEMBERS_TABLE . "
+ WHERE member_name='".$member_from."'";
+ $db->query($sql);
+
+ // Delete any remaining raids that the FROM attended
+ $sql = 'DELETE FROM ' . RAID_ATTENDEES_TABLE . "
+ WHERE member_name='".$member_from."'";
+ $db->query($sql);
+
+ //
+ // Logging
+ //
+ $log_action = array(
+ 'header' => '{L_ACTION_HISTORY_TRANSFER}',
+ '{L_FROM}' => $member_from,
+ '{L_TO}' => $member_to);
+ $this->log_insert(array(
+ 'log_type' => $log_action['header'],
+ 'log_action' => $log_action)
+ );
+
+ //
+ // Success message
+ //
+ $success_message = sprintf($user->lang['admin_transfer_history_success'], $member_from, $member_to);
+ $this->admin_die($success_message);
+ }
+
+ // ---------------------------------------------------------
+ // Display form
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ //
+ // Generate to/from drop-downs
+ //
+ $sql = 'SELECT member_name
+ FROM ' . MEMBERS_TABLE . '
+ ORDER BY member_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $tpl->assign_block_vars('transfer_from_row', array(
+ 'VALUE' => $row['member_name'],
+ 'SELECTED' => ( $this->transfer['from'] == $row['member_name'] ) ? ' selected="selected"' : '',
+ 'OPTION' => $row['member_name'])
+ );
+
+ $tpl->assign_block_vars('transfer_to_row', array(
+ 'VALUE' => $row['member_name'],
+ 'SELECTED' => ( $this->transfer['to'] == $row['member_name'] ) ? ' selected="selected"' : '',
+ 'OPTION' => $row['member_name'])
+ );
+ }
+
+ $tpl->assign_vars(array(
+ // Form vars
+ 'F_TRANSFER' => 'manage_members.php' . $SID . '&amp;mode=transfer',
+
+ // Language
+ 'L_TRANSFER_MEMBER_HISTORY' => $user->lang['transfer_member_history'],
+ 'L_TRANSFER_MEMBER_HISTORY_DESCRIPTION' => $user->lang['transfer_member_history_description'],
+ 'L_FROM' => $user->lang['from'],
+ 'L_TO' => $user->lang['to'],
+ 'L_SELECT_1_OF_X_MEMBERS' => sprintf($user->lang['select_1ofx_members'], $db->num_rows($result)),
+ 'L_TRANSFER_HISTORY' => $user->lang['transfer_history'],
+
+ // Form validation
+ 'FV_TRANSFER' => $this->fv->generate_error('transfer'))
+ );
+ $db->free_result($result);
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['manage_members_title'],
+ 'template_file' => 'admin/mm_transfer.html',
+ 'display' => true)
+ );
+ }
+}
+?> \ No newline at end of file
diff --git a/admin/mysql_info.php b/admin/mysql_info.php
new file mode 100644
index 0000000..7993cc0
--- /dev/null
+++ b/admin/mysql_info.php
@@ -0,0 +1,131 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * mysql_info.php
+ * Began: Sat April 5 2003
+ *
+ * $Id: mysql_info.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class MySQL_Info extends EQdkp_Admin
+{
+ var $mysql_version = '';
+ var $table_size = 0;
+ var $index_size = 0;
+ var $num_tables = 0;
+
+ function mysql_info()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ $this->assoc_buttons(array(
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_'))
+ );
+
+ $result = $db->query('SELECT VERSION() AS mysql_version');
+ if ( $row = $db->fetch_record($result) )
+ {
+ $this->mysql_version = $row['mysql_version'];
+ }
+ }
+
+ // ---------------------------------------------------------
+ // Display form
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID, $dbname, $table_prefix;
+
+ if ( preg_match('/^(3\.23|4\.)/', $this->mysql_version) )
+ {
+ $db_name = ( preg_match('/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)/', $this->mysql_version) ) ? "`$dbname`" : $dbname;
+
+ // Get table status
+ $sql = 'SHOW TABLE STATUS
+ FROM ' . $db_name;
+ $result = $db->query($sql);
+
+ $dbsize = 0;
+ while ( $row = $db->fetch_record($result) )
+ {
+ if ( $row['Type'] != 'MRG_MyISAM' )
+ {
+ if ( $table_prefix != '' )
+ {
+ // Current row is an EQdkp table, get info for it
+ if ( strstr($row['Name'], $table_prefix) )
+ {
+ $tpl->assign_block_vars('table_row', array(
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'TABLE_NAME' => $row['Name'],
+ 'ROWS' => number_format($row['Rows'], ','),
+ 'TABLE_SIZE' => $this->db_size($row['Data_length']),
+ 'INDEX_SIZE' => $this->db_size($row['Index_length']))
+ );
+
+ $this->num_tables++;
+ $this->table_size += $row['Data_length'];
+ $this->index_size += $row['Index_length'];
+ } // name match
+ } // table_prefix != ''
+ } // type != MRG_MyISAM
+ } // while
+
+ $tpl->assign_vars(array(
+ 'NUM_TABLES' => sprintf($user->lang['num_tables'], $this->num_tables),
+ 'TOTAL_TABLE_SIZE' => $this->db_size($this->table_size),
+ 'TOTAL_INDEX_SIZE' => $this->db_size($this->index_size),
+ 'TOTAL_SIZE' => $this->db_size($this->table_size + $this->index_size),
+
+ 'L_EQDKP_TABLES' => $user->lang['eqdkp_tables'],
+ 'L_TABLE_NAME' => $user->lang['table_name'],
+ 'L_ROWS' => $user->lang['rows'],
+ 'L_TABLE_SIZE' => $user->lang['table_size'],
+ 'L_INDEX_SIZE' => $user->lang['index_size'],
+ 'L_TOTALS' => $user->lang['totals'])
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => 'MySQL Info',
+ 'template_file' => 'admin/mysql_info.html',
+ 'display' => true)
+ );
+ } // version match
+ }
+
+ function db_size($size)
+ {
+ if ( $size >= 1048576 )
+ {
+ return sprintf('%.2f MB', ($size / 1048576));
+ }
+ elseif ( $size >= 1024 )
+ {
+ return sprintf('%.2f KB', ($size / 1024));
+ }
+ else
+ {
+ return sprintf('%.2f B', $size);
+ }
+ }
+}
+
+$info = new MySQL_Info;
+$info->process();
+?> \ No newline at end of file
diff --git a/admin/parse_Everquest.php b/admin/parse_Everquest.php
new file mode 100644
index 0000000..5d9e1ac
--- /dev/null
+++ b/admin/parse_Everquest.php
@@ -0,0 +1,587 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * parse_Everquest.php
+ * Began: Sat March 05 2005
+ *
+ * $Id: parse_Everquest.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class Parse_Log extends EQdkp_Admin
+{
+ function parse_log()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ $this->assoc_buttons(array(
+ 'parse' => array(
+ 'name' => 'parse',
+ 'process' => 'process_parse',
+ 'check' => 'a_raid_'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_raid_'))
+ );
+ }
+
+ // ---------------------------------------------------------
+ // Process Parse
+ // ---------------------------------------------------------
+ function process_parse()
+ {
+
+
+ /* New EQ format for /who
+
+[Fri Apr 29 20:45:08 2005] Logging to 'eqlog.txt' is now *ON*.
+[Fri Apr 29 20:45:09 2005] Players on EverQuest:
+[Fri Apr 29 20:45:09 2005] ---------------------------
+[Fri Apr 29 20:45:09 2005] [63 Warlock (Necromancer)] Volac (Dark Elf) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [66 Maestro (Bard)] Willowwhisper (Wood Elf) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [ANONYMOUS] Premus <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [65 Storm Warden (Druid)] Whispering (Wood Elf) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [65 Prophet (Shaman)] Cuzak (Troll) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [64 Virtuoso (Bard)] Case (Half Elf) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [ANONYMOUS] Aspenelder <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [67 Forest Stalker (Ranger)] Hatteras (Wood Elf) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [67 Archon (Cleric)] Kelee (High Elf) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [66 Storm Warden (Druid)] Branson (Wood Elf) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [66 Overlord (Warrior)] Damilex (Human) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [66 Lord Protector (Paladin)] Hafgun (Human) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [54 Primalist (Beastlord)] Sistakitty (Vah Shir) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [66 Arch Convoker (Magician)] Torgen (High Elf) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [63 Phantasmist (Enchanter)] Merlinycus (Erudite) <Aurora Spirits>
+[Fri Apr 29 20:45:09 2005] [66 Forest Stalker (Ranger)] Xlifex (Wood Elf) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [ANONYMOUS] Misser <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [70 Scourge Knight (Shadow Knight)] Grosbras (Ogre) <Shadows of Doom>
+[Fri Apr 29 20:45:09 2005] [70 Herald (Bard)] Anjagi (Fire Elemental) <Guild>
+
+
+*/
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $usable_date = "/([a-zA-Z]{3}) ([a-zA-Z]{3}) ([0-9]{2}) ([0-9]{2})\:([0-9]{2})\:([0-9]{2}) ([0-9]{4})/";
+
+ $channel_members = '';
+ $line = '';
+ $valid_date_found = false;
+
+ $log_file = explode("\n", $_POST['log']);
+ $log_file = str_replace('&lt;', '<', str_replace('&gt;', '>', $log_file));
+ $log_file = str_replace('Shadow Knight', 'Shadow_Knight', $log_file);
+ $line_count = sizeof($log_file);
+
+ // Go through each line and
+ // - Check for/get a valid member in the /who
+ // - Check if there's a valid date we can use
+ // - Check for/get valid members from /list <channel>
+
+ $log_date = array();
+ session_start(); // Hold our array of name => class/level/race
+ for ( $i = 0; $i < $line_count; $i++ )
+ {
+ $line = '';
+ if ( (isset($_POST['findall'])) || (strpos($log_file[$i], '<')) )
+ {
+ $member_name = $this->line_parse($log_file[$i]);
+
+ // Make sure that each member's name is properly capitalized
+ $mname = strtolower(preg_replace('/[[:space:]]/i', ' ', $member_name));
+ $member_name = ucwords($mname);
+
+ if ( trim($member_name) != '')
+ {
+ $member_names[] = $member_name;
+ }
+ }
+
+ // Check if there's a usable date/time in this string
+ if ( preg_match( $usable_date , $log_file[$i], $pre_log_date) )
+ {
+ if ( isset($pre_log_date[0]) )
+ {
+ $log_date = $pre_log_date;
+ }
+ $valid_date_found = true;
+ }
+
+ // Check if the log contains channel information we can use
+ if (preg_match("/Channel (.+)\(([0-9]{1,5})\) members\:/", $log_file[$i], $num_members))
+ {
+ $first_chan_line = ($i+1);
+ $channel_lines = (($num_members[2] % 10) == 0) ? $num_members[2] / 10 : floor($num_members[2] / 10) + 1;
+ $last_chan_line = ($i + $channel_lines + 1);
+ for ( $j = $first_chan_line; $j < $last_chan_line; $j++ )
+ {
+ $line = preg_replace("/\[[A-Za-z]{3} [A-Za-z]{3} [0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2} [0-9]{4}\]/", '', $log_file[$j]);
+ $line = preg_replace("/[^A-Za-z\,[:space:]]/", '', $line);
+ if ($j != $channel_lines)
+ {
+ $line = str_replace("\n", ', ', $line);
+ }
+ $channel_members .= $line;
+ }
+ }
+
+ if (isset ($log_file[$i]) ) {
+ $line_to_read = str_replace("\t", ' ', $log_file[$i]);
+ }
+
+ if (preg_match("/^[0-9]{1,2} (.+) ([0-9]{1,2}) ([a-z A-Z]+)/", $line_to_read, $raid_line))
+ {
+ $memberName = $raid_line[1];
+ $memberLevel = $raid_line[2];
+ $memberClass = $raid_line[3];
+ $line = preg_replace("/ Group Leader/", '', $memberClass);
+ $line = preg_replace("/ Raid Leader/", '', $line);
+ $memberClass = $line;
+
+ if ( $memberClass == 'Shadow' ) {
+ $memberClass = 'Shadow Knight';
+ }
+
+ if ( !($this->original_class($memberClass) == "")) {
+ $memberClass = $this->original_class($memberClass);
+ }
+
+ $_SESSION[$memberName] = array(
+ 'name' => $memberName,
+ 'race' => 'Unknown',
+ 'level' => $memberLevel,
+ 'class' => $memberClass,
+ );
+
+ // add member's name to the array
+ $member_names[] = $memberName;
+
+
+ }
+
+
+ } // for ... log_file
+
+
+ // If there were channel members, join the two arrays
+ if ( !empty($channel_members) )
+ {
+ $channel_members = explode(', ', $channel_members);
+ $member_names = array_merge($member_names, $channel_members);
+ }
+
+ if ( $valid_date_found )
+ {
+ $date['mo'] = $log_date[2];
+ $date['d'] = $log_date[3];
+ $date['y'] = $log_date[7];
+ $date['h'] = $log_date[4];
+ $date['mi'] = $log_date[5];
+ $date['s'] = $log_date[6];
+ }
+ else
+ {
+ $date['mo'] = date('M');
+ $date['d'] = date('d');
+ $date['y'] = date('Y');
+ $date['h'] = date('h');
+ $date['mi'] = date('i');
+ $date['s'] = date('s');
+ }
+
+ // Process the member_names array: replaces spaces, make it unique, sort it and reset it
+ if ( (isset($member_names)) && (is_array($member_names)) )
+ {
+ $name_count = sizeof($member_names);
+ }
+ else
+ {
+ $name_count = 0;
+ $member_names = array();
+ }
+
+ for ( $i = 0; $i < $name_count; $i++ )
+ {
+ $member_names[$i] = str_replace(' ', '', $member_names[$i]);
+ }
+ $member_names = array_unique($member_names);
+ sort($member_names);
+ reset($member_names);
+
+ $tpl->assign_vars(array(
+ 'S_STEP1' => false,
+ 'L_FOUND_MEMBERS' => sprintf($user->lang['found_members'], $line_count, sizeof($member_names)),
+ 'L_LOG_DATE_TIME' => $user->lang['log_date_time'],
+ 'L_LOG_ADD_DATA' => $user->lang['log_add_data'],
+
+ 'FOUND_MEMBERS' => implode("\n", $member_names),
+ 'MO' => $this->M_to_n($date['mo']),
+ 'D' => $date['d'],
+ 'Y' => $date['y'],
+ 'H' => $date['h'],
+ 'MI' => $date['mi'],
+ 'S' => $date['s'])
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['parselog_title'],
+ 'gen_simple_header' => true,
+ 'template_file' => 'admin/parse_Everquest.html',
+ 'display' => true)
+ );
+ }
+
+ // ---------------------------------------------------------
+ // Process helper methods
+ // ---------------------------------------------------------
+ function line_parse($log_line)
+ {
+ global $db, $eqdkp, $user;
+ static $member_ranks = array();
+
+ $log_line = stripslashes($log_line);
+
+ // Build a clean array of guildtags we might be looking for
+ $parsetags = explode("\n", $eqdkp->config['parsetags']);
+ foreach ( $parsetags as $k => $v )
+ {
+ $parsetags[$k] = trim(stripslashes($v));
+ }
+
+ // Cache the member name / member rank info
+ if ( @sizeof($member_ranks) == 0 )
+ {
+ $sql = 'SELECT r.rank_name, m.member_name
+ FROM ' . MEMBER_RANKS_TABLE . ' r, ' . MEMBERS_TABLE . ' m
+ WHERE (r.rank_id = m.member_rank_id)
+ ORDER BY m.member_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $member_ranks[ $row['member_name'] ] = 'r_' . str_replace(' ', '_', trim($row['rank_name']));
+ }
+ $db->free_result($result);
+ }
+
+ $name_check = false;
+ $role_check = true;
+ $rank_check = true;
+
+ /* New EQ /who format
+[Fri Apr 29 20:45:08 2005] Logging to 'eqlog.txt' is now *ON*.
+[Fri Apr 29 20:45:09 2005] Players on EverQuest:
+[Fri Apr 29 20:45:09 2005] ---------------------------
+[Fri Apr 29 20:45:09 2005] [63 Warlock (Necromancer)] Volac (Dark Elf) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [66 Maestro (Bard)] Willowwhisper (Wood Elf) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [ANONYMOUS] Premus <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [65 Storm Warden (Druid)] Whispering (Wood Elf) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [65 Prophet (Shaman)] Cuzak (Troll) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [64 Virtuoso (Bard)] Case (Half Elf) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [ANONYMOUS] Aspenelder <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [67 Forest Stalker (Ranger)] Hatteras (Wood Elf) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [67 Archon (Cleric)] Kelee (High Elf) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [66 Storm Warden (Druid)] Branson (Wood Elf) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [66 Overlord (Warrior)] Damilex (Human) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [66 Lord Protector (Paladin)] Hafgun (Human) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [54 Primalist (Beastlord)] Sistakitty (Vah Shir) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [66 Arch Convoker (Magician)] Torgen (High Elf) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [63 Phantasmist (Enchanter)] Merlinycus (Erudite) <Aurora Spirits>
+[Fri Apr 29 20:45:09 2005] [66 Forest Stalker (Ranger)] Xlifex (Wood Elf) <Storm Rider Rebellion>
+[Fri Apr 29 20:45:09 2005] [ANONYMOUS] Misser <Storm Rider Rebellion>
+ */
+
+ // Date
+ $pattern = "/\[[a-zA-Z]{3} [a-zA-Z]{3} [0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2} [0-9]{4}\]";
+ // AFK
+ $pattern .= ".*(AFK )?";
+ // Level / Class (if findall or findrole is set, we can check for ANONYMOUS people, too)
+ // $pattern .= ( (isset($_POST['findall'])) || (isset($_POST['findrole'])) ) ? "\[(ANONYMOUS|([0-9]{1,2})(.+))\]" : "\[([0-9]{1,2})(.+)\]";
+ $pattern .= ( (isset($_POST['findall'])) || (isset($_POST['findrole'])) ) ? "\[(ANONYMOUS|([0-9]{1,2})(.+) (.+))\]" : "\[([0-9]{1,2})(.+) (.+)\]";
+ // Name
+ $pattern .= " ([A-Za-z]{1,})";
+ // Race
+ $pattern .= "( \(.*\))?";
+ // Guild (ignored if we're finding EVERYONE in the log, regardless of tag)
+ if ( !isset($_POST['findall']) )
+ {
+ $guildtag_sep = '';
+ $pattern .= ".*\<(";
+ foreach ( $parsetags as $guildtag )
+ {
+ if ( isset($_POST[str_replace(' ', '_', $guildtag)]) )
+ {
+ $pattern .= $guildtag_sep . $guildtag;
+ $guildtag_sep = '|';
+ }
+ }
+ $pattern .= ")\>";
+ }
+ $pattern .= '/';
+
+ if ( preg_match($pattern, $log_line, $log_parsed) )
+ {
+ // 0 = full string
+ // 1 = AFK?
+ // 2 = ANONYMOUS | 'XX Class (archtype)'
+ // 3 = Level
+ // 4 = Class
+ // 5 = (Archtype)
+ // 6 = Name
+ // 7 = (Race)
+
+ $log_parsed[5] = str_replace('_', ' ', $log_parsed[5]);
+ $name = trim($log_parsed[6]);
+ $level = trim($log_parsed[3]);
+ $class = trim($log_parsed[4]);
+ $race = ( isset($log_parsed[7]) ) ? trim(str_replace(')', '', str_replace('(', '', $log_parsed[7]))) : '';
+ $archtype = ( isset($log_parsed[5]) ) ? trim(str_replace(')', '', str_replace('(', '', $log_parsed[5]))) : '';
+
+ if ( $archtype == 'Shadow' ) {
+ $archtype = 'Shadow Knight';
+ }
+
+ if ( isset($log_parsed[2]) && ($log_parsed[2] == 'ANONYMOUS')) {
+
+ $class = "Unknown";
+ $archtype = "Unknown";
+ $race = "Unknown";
+ $level = '1';
+
+ $log_parsed[2] = 'Unknown' ;
+
+ }
+
+
+ if ( !isset($_POST['findrole']) )
+ {
+ if ( (isset($log_parsed[2])) && ($log_parsed[2] == 'ANONYMOUS') )
+ {
+ $role_check = false;
+ }
+ }
+
+ if ( (isset($log_parsed[6])) && ($log_parsed[6] != '') )
+ {
+ $name_check = true;
+ }
+
+ // Check if we're including this member's rank
+ if ( isset($member_ranks[$name]) )
+ {
+ // If POST[r_<rank_name>] isn't set, we're ignoring this member
+ if ( !isset($_POST[ $member_ranks[$name] ]) )
+ {
+ $rank_check = false;
+ }
+ }
+
+ if ( ($name_check) && ($role_check) && ($rank_check) )
+ {
+ $_SESSION[$name] = array(
+ 'name' => $name,
+ 'level' => $level,
+ 'class' => $archtype,
+ 'race' => $race);
+
+ return $log_parsed[6];
+ }
+ }
+ return false;
+ }
+
+ function M_to_n($m)
+ {
+ switch($m)
+ {
+ case 'Jan':
+ return '01';
+ break;
+ case 'Feb':
+ return '02';
+ break;
+ case 'Mar':
+ return '03';
+ break;
+ case 'Apr':
+ return '04';
+ break;
+ case 'May':
+ return '05';
+ break;
+ case 'Jun':
+ return '06';
+ break;
+ case 'Jul':
+ return '07';
+ break;
+ case 'Aug':
+ return '08';
+ break;
+ case 'Sep':
+ return '09';
+ break;
+ case 'Oct':
+ return '10';
+ break;
+ case 'Nov':
+ return '11';
+ break;
+ case 'Dec':
+ return '12';
+ break;
+ }
+ }
+
+ function original_class($class)
+ {
+ $classes = array(
+ 'Bard' => array('Bard','Minstrel','Troubadour','Virtuoso','Maestro'),
+ 'Beastlord' => array('Beastlord','Primalist','Animist','Savage Lord','Feral Lord'),
+ 'Berserker' => array('Berserker','Brawler','Vehement','Rager','Fury'),
+ 'Cleric' => array('Cleric','Vicar','Templar','High Priest','Archon'),
+ 'Druid' => array('Druid','Wanderer','Preserver','Hierophant','Storm Warden'),
+ 'Enchanter' => array('Enchanter','Illusionist','Beguiler','Phantasmist','Coercer'),
+ 'Magician' => array('Magician','Elementalist','Conjurer','Arch Mage','Arch Convoker'),
+ 'Monk' => array('Monk','Disciple','Master','Grandmaster','Transcendent'),
+ 'Necromancer' => array('Necromancer','Heretic','Defiler','Warlock','Arch Lich'),
+ 'Paladin' => array('Paladin','Cavalier','Knight','Crusader','Lord Protector'),
+ 'Ranger' => array('Ranger','Pathfinder','Outrider','Warder','Hunter','Forest Stalker'),
+ 'Rogue' => array('Rogue','Rake','Blackguard','Assassin','Deceiver'),
+ 'Shadow Knight' => array('Scourge Knight','Shadow Knight','Reaver','Revenant','Grave Lord','Dread Lord'),
+ 'Shaman' => array('Shaman','Mystic','Luminary','Oracle','Prophet'),
+ 'Warrior' => array('Warrior','Champion','Myrmidon','Warlord','Overlord'),
+ 'Wizard' => array('Wizard','Channeler','Evoker','Sorcerer','Arcanist')
+ );
+
+ foreach ( $classes as $k => $v)
+ {
+ if ( in_array($class, $v) )
+ {
+ return $k;
+ }
+ }
+
+ return false;
+ }
+
+ // ---------------------------------------------------------
+ // Display form
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $log_columns = ( preg_match("/Mozilla\/4\.[1-9]{1}.+/", $_SERVER['HTTP_USER_AGENT']) ) ? '50' : '90';
+
+ // Options to parse
+ $options = array(
+ 0 => array(
+ 'CBNAME' => 'findall',
+ 'CBVALUE' => '1',
+ 'CBCHECKED' => '',
+ 'OPTION' => $user->lang['log_find_all']),
+ 1 => array(
+ 'CBNAME' => 'findrole',
+ 'CBVALUE' => '1',
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => 'Include Roleplay')
+ );
+
+ // Guildtags to parse
+ if ( !empty($eqdkp->config['parsetags']) )
+ {
+ $parsetags = explode("\n", $eqdkp->config['parsetags']);
+ foreach ( $parsetags as $index => $guildtag )
+ {
+ $tagoptions[] = array(
+ 'CBNAME' => str_replace(' ', '_', trim($guildtag)),
+ 'CBVALUE' => '1',
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => '&lt;' . trim($guildtag) . '&gt;');
+ }
+ $options = array_merge($options, $tagoptions);
+ }
+
+ foreach ( $options as $row )
+ {
+ $tpl->assign_block_vars('options_row', $row);
+ }
+
+ // Member tags to parse
+ // Find out how many members have each rank
+ $rank_counts = array();
+ $sql = 'SELECT member_rank_id, count(member_rank_id) as count
+ FROM ' . MEMBERS_TABLE . '
+ GROUP BY member_rank_id';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $rank_counts[ $row['member_rank_id'] ] = $row['count'];
+ }
+ $db->free_result($result);
+
+ $ranks = array();
+ $sql = 'SELECT rank_id, rank_name, rank_prefix, rank_suffix
+ FROM ' . MEMBER_RANKS_TABLE . '
+ ORDER BY rank_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ // Make sure there's not a guildtag with the same name as the rank
+ if ( !in_array($row['rank_name'], $options) )
+ {
+ $rank_count = ( isset($rank_counts[ $row['rank_id'] ]) ) ? $rank_counts[ $row['rank_id'] ] : 0;
+ $format = ( $rank_count == 1 ) ? $user->lang['x_members_s'] : $user->lang['x_members_p'];
+
+ $ranks[] = array(
+ 'CBNAME' => 'r_' . str_replace(' ', '_', trim($row['rank_name'])),
+ 'CBVALUE' => intval($row['rank_id']),
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => $user->lang['rank'] . ': ' . (( empty($row['rank_name']) ) ? '(None)' : $row['rank_prefix'] . $row['rank_name'] . $row['rank_suffix'])
+ . ' <span class="small">(' . sprintf($format, $rank_count) . ')</span>');
+ }
+ }
+ $db->free_result($result);
+
+ foreach ( $ranks as $row )
+ {
+ $tpl->assign_block_vars('ranks_row', $row);
+ }
+
+ $tpl->assign_vars(array(
+ 'F_PARSE_LOG' => 'parse_Everquest.php' . $SID,
+
+ 'S_STEP1' => true,
+ 'L_PASTE_LOG' => $user->lang['paste_log'],
+ 'L_OPTIONS' => $user->lang['options'],
+ 'L_PARSE_LOG' => $user->lang['parse_log'],
+ 'L_CLOSE_WINDOW' => $user->lang['close_window'],
+
+ 'LOG_COLS' => $log_columns)
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['parselog_title'],
+ 'gen_simple_header' => true,
+ 'template_file' => 'admin/parse_Everquest.html',
+ 'display' => true)
+ );
+ }
+}
+
+$parse_log = new Parse_Log;
+$parse_log->process();
+?>
diff --git a/admin/parse_Everquest2-german.php b/admin/parse_Everquest2-german.php
new file mode 100644
index 0000000..3b554f7
--- /dev/null
+++ b/admin/parse_Everquest2-german.php
@@ -0,0 +1,515 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * parse_Everquest2.php
+ * Began: Tue December 24 2002
+ *
+ * $Id: parse_Everquest2-german.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class Parse_Log extends EQdkp_Admin
+{
+ function parse_log()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ $this->assoc_buttons(array(
+ 'parse' => array(
+ 'name' => 'parse',
+ 'process' => 'process_parse',
+ 'check' => 'a_raid_'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_raid_'))
+ );
+ }
+
+ // ---------------------------------------------------------
+ // Process Parse
+ // ---------------------------------------------------------
+ function process_parse()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $channel_members = '';
+ $line = '';
+ $valid_date_found = false;
+
+ $log_file = explode("\n", $_POST['log']);
+ $log_file = str_replace('&lt;', '<', str_replace('&gt;', '>', $log_file));
+ $line_count = sizeof($log_file);
+
+ // Go through each line and
+ // - Check for/get a valid member in the /who
+ // - Check if there's a valid date we can use
+ // - Check for/get valid members from /list <channel>
+ $log_date = array();
+ session_start(); // Hold our array of name => class/level/race
+ for ( $i = 0; $i < $line_count; $i++ )
+ {
+ $line = '';
+ if ( (isset($_POST['findall'])) || (strpos($log_file[$i], '<')) )
+ {
+ $member_name = $this->line_parse($log_file[$i]);
+
+ // Make sure that each member's name is properly capitalized
+ $mname = strtolower(preg_replace('/[[:space:]]/i', ' ', $member_name));
+ $member_name = ucwords($mname);
+
+ if ( trim($member_name) != '')
+ {
+ $member_names[] = $member_name;
+ }
+ }
+
+ } // for ... log_file
+
+ // If there were channel members, join the two arrays
+ if ( !empty($channel_members) )
+ {
+ $channel_members = explode(', ', $channel_members);
+ $member_names = array_merge($member_names, $channel_members);
+ }
+
+ $date['mo'] = date('M');
+ $date['d'] = date('d');
+ $date['y'] = date('Y');
+ $date['h'] = date('h');
+ $date['mi'] = date('i');
+ $date['s'] = date('s');
+
+ // Process the member_names array: replaces spaces, make it unique, sort it and reset it
+ if ( (isset($member_names)) && (is_array($member_names)) )
+ {
+ $name_count = sizeof($member_names);
+ }
+ else
+ {
+ $name_count = 0;
+ $member_names = array();
+ }
+
+ for ( $i = 0; $i < $name_count; $i++ )
+ {
+ $member_names[$i] = str_replace(' ', '', $member_names[$i]);
+ }
+ $member_names = array_unique($member_names);
+ sort($member_names);
+ reset($member_names);
+
+ $tpl->assign_vars(array(
+ 'S_STEP1' => false,
+ 'L_FOUND_MEMBERS' => sprintf($user->lang['found_members'], $line_count, sizeof($member_names)),
+ 'L_LOG_DATE_TIME' => $user->lang['log_date_time'],
+ 'L_LOG_ADD_DATA' => $user->lang['log_add_data'],
+
+ 'FOUND_MEMBERS' => implode("\n", $member_names),
+ 'MO' => $this->M_to_n($date['mo']),
+ 'D' => $date['d'],
+ 'Y' => $date['y'],
+ 'H' => $date['h'],
+ 'MI' => $date['mi'],
+ 'S' => $date['s'])
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['parselog_title'],
+ 'gen_simple_header' => true,
+ 'template_file' => 'admin/parse_Everquest2.html',
+ 'display' => true)
+ );
+ }
+
+ // ---------------------------------------------------------
+ // Process helper methods
+ // ---------------------------------------------------------
+ function line_parse($log_line)
+ {
+ global $db, $eqdkp, $user;
+ static $member_ranks = array();
+
+ //$log_line = stripslashes($log_line);
+
+ // First off, we don't care about afk or lfg, so remove them
+ $log_line = str_replace(' (AFK)', '', $log_line);
+ $log_line = str_replace(' (LFG)', '', $log_line);
+
+ // Build a clean array of guildtags we might be looking for
+ $parsetags = explode("\n", $eqdkp->config['parsetags']);
+ foreach ( $parsetags as $k => $v )
+ {
+ $parsetags[$k] = trim(stripslashes($v));
+ }
+
+ // Cache the member name / member rank info
+ if ( @sizeof($member_ranks) == 0 )
+ {
+ $sql = 'SELECT r.rank_name, m.member_name
+ FROM ' . MEMBER_RANKS_TABLE . ' r, ' . MEMBERS_TABLE . ' m
+ WHERE (r.rank_id = m.member_rank_id)
+ ORDER BY m.member_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $member_ranks[ $row['member_name'] ] = 'r_' . str_replace(' ', '_', trim($row['rank_name']));
+ }
+ $db->free_result($result);
+ }
+
+ $name_check = false;
+ $role_check = true;
+ $rank_check = true;
+
+/* Sample EQ2 log file format :: the three patterns to match are:
+
+#1 guilded normal
+#2 non-guilded normal
+#3 role (guilded; unguilded matches like /anon)
+#4 anon (guilded or not)
+
+ (neither anon or role shows zone FYI)
+
+
+(1121902422)[Wed Jul 20 19:33:42 2005] [43 Guardian] Goosage (Barbarian) <The Knights of Dawn Fire> Zone: The Feerrott
+(1121902422)[Wed Jul 20 19:33:42 2005] [47 Paladin] Maskie (Barbarian) Zone: The Feerrott
+(1121907805)[Wed Jul 20 21:03:25 2005] [Anonymous] Mildew (Gnome) <The Knights of Dawn Fire>
+(1121907951)[Wed Jul 20 21:05:51 2005] [Anonymous] Greywind (Human)
+
+
+German log file looks like this :
+(1122498819)[Wed Jul 27 23:13:39 2005] [50 Inquisitor] Chryorn (Dunkelelf) <Feral Fires>ZONE: Shattered Stillness: Epic
+(1122498819)[Wed Jul 27 23:13:39 2005] [50 Brigand] Xandros (Dunkelelf) <Feral Fires>ZONE: Shattered Stillness: Epic
+(1122498819)[Wed Jul 27 23:13:39 2005] [50 Wächter] Achilless (Barbar) <Feral Fires>ZONE: Shattered Stillness: Epic
+
+*/
+
+ // Date
+ $pattern = "/^\([0-9]{10}\)\[[a-zA-Z]{3} [a-zA-Z]{3} [0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2} [0-9]{4}\](.*)";
+ $pattern1 = "/^\([0-9]{10}\)\[[a-zA-Z]{3} [a-zA-Z]{3} [0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2} [0-9]{4}\](.*)";
+ $pattern2 = "/^\([0-9]{10}\)\[[a-zA-Z]{3} [a-zA-Z]{3} [0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2} [0-9]{4}\](.*)";
+ $pattern3 = "/^\([0-9]{10}\)\[[a-zA-Z]{3} [a-zA-Z]{3} [0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2} [0-9]{4}\](.*)";
+
+ // Level / Class
+ $pattern .= "\[([0-9]{1,2}) (.+)\]";
+ $pattern1 .= "\[([0-9]{1,2}) (.+)\]";
+ $pattern2 .= "\[Anonymous\]";
+ $pattern3 .= "\[Anonymous\]";
+
+ // Name
+ $pattern .= " ([A-Za-z]{1,})";
+ $pattern1 .= " ([A-Za-z]{1,})";
+ $pattern2 .= " ([A-Za-z]{1,})";
+ $pattern3 .= " ([A-Za-z]{1,})";
+
+ // Race
+ $pattern .= " \((.*)\)";
+ $pattern1 .= " \((.*)\)";
+ $pattern2 .= " \((.*)\)";
+ $pattern3 .= " \((.*)\)";
+
+ // Guild Tag
+ $pattern .= " \<(.*)\>";
+ $pattern2 .= " \<(.*)\>";
+
+ // Zone:
+ $pattern .= "ZONE: (.*)";
+ $pattern1 .= "ZONE: (.*)";
+
+ // End pattern regexp
+ $pattern .= '/';
+ $pattern1 .= '/';
+ $pattern2 .= '/';
+ $pattern3 .= '/';
+
+
+ // unset a line match type identifier
+ unset($type_line);
+
+ // match things the hard way..one type of line at a time
+ // crappy way to do it, but VERY easy to read and alter
+
+ // Normal
+ if ( preg_match($pattern, $log_line, $log_parsed) ) {
+ $name = trim($log_parsed[4]);
+ $race = trim($log_parsed[5]);
+ $class = trim($log_parsed[3]);
+ $level = trim($log_parsed[2]);
+ $guildtag = trim($log_parsed[6]);
+ $zone = trim($log_parsed[7]);
+ $type_line = 1;
+ }
+
+ // Unguilded
+ if ( preg_match($pattern1, $log_line, $log_parsed) ) {
+ $name = trim($log_parsed[4]);
+ $race = trim($log_parsed[5]);
+ $class = trim($log_parsed[3]);
+ $level = trim($log_parsed[2]);
+ $guildtag = "";
+ $zone = trim($log_parsed[6]);
+ if (!isset($type_line) ){ $type_line = 2;}
+ }
+
+ // Roleplaying
+ if ( preg_match($pattern2, $log_line, $log_parsed) ) {
+ $name = trim($log_parsed[2]);
+ $race = trim($log_parsed[3]);
+ $class = "Unknown";
+ $level = "50";
+ $guildtag = trim($log_parsed[4]);
+ $zone = "";
+ if (!isset($type_line) ){ $type_line = 3;}
+ }
+
+ // Anon
+ if ( preg_match($pattern3, $log_line, $log_parsed) ) {
+ $name = trim($log_parsed[2]);
+ $race = trim($log_parsed[3]);
+ $class = "Unknown";
+ $level = "50";
+ $guildtag = "";
+ $zone = "";
+ if (!isset($type_line) ){ $type_line = 4;}
+ }
+
+
+ // Jeezus this is a pain in the ass, ain't it?
+
+ /* Sample EQ2 log file format :: the three patterns to match are (one more time)
+
+(1121902422)[Wed Jul 20 19:33:42 2005] [43 Guardian] Goosage (Barbarian) <The Knights of Dawn Fire> Zone: The Feerrott
+(1121902422)[Wed Jul 20 19:33:42 2005] [47 Paladin] Maskie (Barbarian) Zone: The Feerrott
+(1121907805)[Wed Jul 20 21:03:25 2005] [Anonymous] Mildew (Gnome) <The Knights of Dawn Fire>
+(1121907951)[Wed Jul 20 21:05:51 2005] [Anonymous] Greywind (Human)
+
+After using the above 4, we now test with the same members in different states of anon/role/guilded
+
+(1121902422)[Wed Jul 20 19:33:42 2005] [Anonymous] Goosage (Barbarian)
+(1121902422)[Wed Jul 20 19:33:42 2005] [Anonymous] Maskie (Barbarian) <The Knights of Dawn Fire
+(1121907805)[Wed Jul 20 21:03:25 2005] [47 Cleric] Mildew (Gnome) <The Knights of Dawn Fire> Zone: The Feerrott
+(1121907951)[Wed Jul 20 21:05:51 2005] [49 Monk] Greywind (Human) Zone: The Feerrott
+
+ */
+
+
+ if ($type_line == 1) {
+ print"Name: $name , Race: $race , Class: $class , Guild: $guildtag , Level: $level , Zone: $zone<br>";
+ }
+
+ if ($type_line == 2) {
+ print"Name: $name , Race: $race , Class: $class , Level: $level , Zone: $zone<br>";
+ }
+
+ if ($type_line == 3) {
+ print"Name: $name , Race: $race , Class_Guess: $class , Level_Guess: $level , Guild: $guildtag<br>";
+ }
+
+ if ($type_line == 4) {
+ print"Name: $name , Race: $race , Class_Guess: $class , Level_Guess: $level<br>";
+ }
+
+
+ // Looking for roleplaying folks? Is this valid for EQ2?
+ if ( !isset($_POST['findrole']) )
+ {
+ if ( (isset($class)) && ($class == 'Unknown') )
+ {
+ $role_check = false;
+ }
+ }
+
+ if ( (isset($name)) && ($name != '') )
+ {
+ $name_check = true;
+ }
+
+ // Check if we're including this member's rank
+ if ( isset($member_ranks[$name]) )
+ {
+ // If POST[r_<rank_name>] isn't set, we're ignoring this member
+ if ( !isset($_POST[ $member_ranks[$name] ]) )
+ {
+ $rank_check = false;
+ }
+ }
+
+ if ( ($name_check) && ($role_check) && ($rank_check) )
+ {
+ $_SESSION[$name] = array(
+ 'tag' => $guildtag,
+ 'name' => $name,
+ 'level' => $level,
+ 'class' => $class,
+ 'race' => $race);
+
+ return $name;
+ }
+ return false;
+ }
+
+ function M_to_n($m)
+ {
+ switch($m)
+ {
+ case 'Jan':
+ return '01';
+ break;
+ case 'Feb':
+ return '02';
+ break;
+ case 'Mar':
+ return '03';
+ break;
+ case 'Apr':
+ return '04';
+ break;
+ case 'May':
+ return '05';
+ break;
+ case 'Jun':
+ return '06';
+ break;
+ case 'Jul':
+ return '07';
+ break;
+ case 'Aug':
+ return '08';
+ break;
+ case 'Sep':
+ return '09';
+ break;
+ case 'Oct':
+ return '10';
+ break;
+ case 'Nov':
+ return '11';
+ break;
+ case 'Dec':
+ return '12';
+ break;
+ }
+ }
+
+ // ---------------------------------------------------------
+ // Display form
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $log_columns = ( preg_match("/Mozilla\/4\.[1-9]{1}.+/", $_SERVER['HTTP_USER_AGENT']) ) ? '50' : '90';
+
+ // Options to parse
+ $options = array(
+ 0 => array(
+ 'CBNAME' => 'findall',
+ 'CBVALUE' => '1',
+ 'CBCHECKED' => '',
+ 'OPTION' => $user->lang['log_find_all']),
+ 1 => array(
+ 'CBNAME' => 'findrole',
+ 'CBVALUE' => '1',
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => 'Include Roleplay')
+ );
+
+ // Guildtags to parse
+ if ( !empty($eqdkp->config['parsetags']) )
+ {
+ $parsetags = explode("\n", $eqdkp->config['parsetags']);
+ foreach ( $parsetags as $index => $guildtag )
+ {
+ $tagoptions[] = array(
+ 'CBNAME' => str_replace(' ', '_', trim($guildtag)),
+ 'CBVALUE' => '1',
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => '&lt;' . trim($guildtag) . '&gt;');
+ }
+ $options = array_merge($options, $tagoptions);
+ }
+
+ foreach ( $options as $row )
+ {
+ $tpl->assign_block_vars('options_row', $row);
+ }
+
+ // Member tags to parse
+ // Find out how many members have each rank
+ $rank_counts = array();
+ $sql = 'SELECT member_rank_id, count(member_rank_id) as count
+ FROM ' . MEMBERS_TABLE . '
+ GROUP BY member_rank_id';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $rank_counts[ $row['member_rank_id'] ] = $row['count'];
+ }
+ $db->free_result($result);
+
+ $ranks = array();
+ $sql = 'SELECT rank_id, rank_name, rank_prefix, rank_suffix
+ FROM ' . MEMBER_RANKS_TABLE . '
+ ORDER BY rank_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ // Make sure there's not a guildtag with the same name as the rank
+ if ( !in_array($row['rank_name'], $options) )
+ {
+ $rank_count = ( isset($rank_counts[ $row['rank_id'] ]) ) ? $rank_counts[ $row['rank_id'] ] : 0;
+ $format = ( $rank_count == 1 ) ? $user->lang['x_members_s'] : $user->lang['x_members_p'];
+
+ $ranks[] = array(
+ 'CBNAME' => 'r_' . str_replace(' ', '_', trim($row['rank_name'])),
+ 'CBVALUE' => intval($row['rank_id']),
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => $user->lang['rank'] . ': ' . (( empty($row['rank_name']) ) ? '(None)' : $row['rank_prefix'] . $row['rank_name'] . $row['rank_suffix'])
+ . ' <span class="small">(' . sprintf($format, $rank_count) . ')</span>');
+ }
+ }
+ $db->free_result($result);
+
+ foreach ( $ranks as $row )
+ {
+ $tpl->assign_block_vars('ranks_row', $row);
+ }
+
+ $tpl->assign_vars(array(
+ 'F_PARSE_LOG' => 'parse_Everquest2.php' . $SID,
+
+ 'S_STEP1' => true,
+ 'L_PASTE_LOG' => $user->lang['paste_log'],
+ 'L_OPTIONS' => $user->lang['options'],
+ 'L_PARSE_LOG' => $user->lang['parse_log'],
+ 'L_CLOSE_WINDOW' => $user->lang['close_window'],
+
+ 'LOG_COLS' => $log_columns)
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['parselog_title'],
+ 'gen_simple_header' => true,
+ 'template_file' => 'admin/parse_Everquest2.html',
+ 'display' => true)
+ );
+ }
+}
+
+$parse_log = new Parse_Log;
+$parse_log->process();
+?>
diff --git a/admin/parse_Everquest2.php b/admin/parse_Everquest2.php
new file mode 100644
index 0000000..180f015
--- /dev/null
+++ b/admin/parse_Everquest2.php
@@ -0,0 +1,546 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * parse_Everquest2.php
+ * Began: Tue December 24 2002
+ *
+ * $Id: parse_Everquest2.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class Parse_Log extends EQdkp_Admin
+{
+ function parse_log()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ $this->assoc_buttons(array(
+ 'parse' => array(
+ 'name' => 'parse',
+ 'process' => 'process_parse',
+ 'check' => 'a_raid_'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_raid_'))
+ );
+ }
+
+ // ---------------------------------------------------------
+ // Process Parse
+ // ---------------------------------------------------------
+/*
+
+New log file format for EQ2
+
+(1129582778)[Mon Oct 17 22:59:38 2005] ------------------------------------------
+(1129582778)[Mon Oct 17 22:59:38 2005] [55 Shadowknight] Pentagon (Barbarian) <Nomadi> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [Anonymous] Fortunah (Erudite) <Nomadi>
+(1129582778)[Mon Oct 17 22:59:38 2005] [54 Defiler] Vanhorstmann (Dark Elf) <Nomadi> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [55 Shadowknight] Vashim (Human) <Nomadi> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [52 Templar] Syris (Dark Elf) <Progeny> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [52 Templar] Gattone (Kerra) <Nomadi> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [54 Guardian] Zappod (Troll) <Nomadi> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [50 Templar] Muayat (Dwarf) <Diablos de Hispannia> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [52 Wizard] Engel (Wood Elf) <Nomadi> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [55 Berserker] Lonlaiel (Human) <Nomadi> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [54 Paladin] Manfred (Human) <Diablos de Hispannia> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [54 Coercer] Makxx (Erudite) <Nomadi> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [53 Inquisitor] Sybelius (Barbarian) <Nomadi> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [54 Conjuror] Butano (Erudite) <Diablos de Hispannia> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [54 Fury] Zentha (Dark Elf) <Nomadi> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [57 Ranger] Asca (Wood Elf) <Forged Souls> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [54 Assassin] Zamira (Kerra) <Nomadi> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [54 Fury] Alectox (Human) <Nomadi> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [57 Assassin] Killien (Iksar) <Nomadi> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [60 Templar] Akarus (Dwarf) <Nomadi> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [57 Monk] Jarr (Barbarian) <Forged Souls> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [49 Guardian] Vittt (Barbarian) <Nomadi> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [49 Brigand] Darkhathor (Human) <Nomadi> Zone: The Isle of Refuge: Darathar's Flight
+(1129582778)[Mon Oct 17 22:59:38 2005] [54 Defiler] Malvagio (Kerra) <Nomadi> Zone: The Isle of Refuge: Darathar's Flight
+
+*/
+ function process_parse()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $channel_members = '';
+ $line = '';
+ $valid_date_found = false;
+
+ $log_file = explode("\n", $_POST['log']);
+ $log_file = str_replace('&lt;', '<', str_replace('&gt;', '>', $log_file));
+ $line_count = sizeof($log_file);
+
+ // Go through each line and
+ // - Check for/get a valid member in the /who
+ // - Check if there's a valid date we can use
+ // - Check for/get valid members from /list <channel>
+ $log_date = array();
+ session_start(); // Hold our array of name => class/level/race
+ for ( $i = 0; $i < $line_count; $i++ )
+ {
+ $line = '';
+ if ( (isset($_POST['findall'])) || (strpos($log_file[$i], '<')) )
+ {
+ $member_name = $this->line_parse($log_file[$i]);
+
+ // Make sure that each member's name is properly capitalized
+ $mname = strtolower(preg_replace('/[[:space:]]/i', ' ', $member_name));
+ $member_name = ucwords($mname);
+
+ if ( trim($member_name) != '')
+ {
+ $member_names[] = $member_name;
+ }
+ }
+
+ } // for ... log_file
+
+ // If there were channel members, join the two arrays
+ if ( !empty($channel_members) )
+ {
+ $channel_members = explode(', ', $channel_members);
+ $member_names = array_merge($member_names, $channel_members);
+ }
+
+ $date['mo'] = date('M');
+ $date['d'] = date('d');
+ $date['y'] = date('Y');
+ $date['h'] = date('h');
+ $date['mi'] = date('i');
+ $date['s'] = date('s');
+
+ // Process the member_names array: replaces spaces, make it unique, sort it and reset it
+ if ( (isset($member_names)) && (is_array($member_names)) )
+ {
+ $name_count = sizeof($member_names);
+ }
+ else
+ {
+ $name_count = 0;
+ $member_names = array();
+ }
+
+ for ( $i = 0; $i < $name_count; $i++ )
+ {
+ $member_names[$i] = str_replace(' ', '', $member_names[$i]);
+ }
+ $member_names = array_unique($member_names);
+ sort($member_names);
+ reset($member_names);
+
+ $tpl->assign_vars(array(
+ 'S_STEP1' => false,
+ 'L_FOUND_MEMBERS' => sprintf($user->lang['found_members'], $line_count, sizeof($member_names)),
+ 'L_LOG_DATE_TIME' => $user->lang['log_date_time'],
+ 'L_LOG_ADD_DATA' => $user->lang['log_add_data'],
+
+ 'FOUND_MEMBERS' => implode("\n", $member_names),
+ 'MO' => $this->M_to_n($date['mo']),
+ 'D' => $date['d'],
+ 'Y' => $date['y'],
+ 'H' => $date['h'],
+ 'MI' => $date['mi'],
+ 'S' => $date['s'])
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['parselog_title'],
+ 'gen_simple_header' => true,
+ 'template_file' => 'admin/parse_Everquest2.html',
+ 'display' => true)
+ );
+ }
+
+ // ---------------------------------------------------------
+ // Process helper methods
+ // ---------------------------------------------------------
+ function line_parse($log_line)
+ {
+ global $db, $eqdkp, $user;
+ static $member_ranks = array();
+
+ //$log_line = stripslashes($log_line);
+
+ // First off, we don't care about afk or lfg, so remove them
+ $log_line = str_replace(' (AFK)', '', $log_line);
+ $log_line = str_replace(' (LFG)', '', $log_line);
+
+ // Build a clean array of guildtags we might be looking for
+ $parsetags = explode("\n", $eqdkp->config['parsetags']);
+ foreach ( $parsetags as $k => $v )
+ {
+ $parsetags[$k] = trim(stripslashes($v));
+ }
+
+ // Cache the member name / member rank info
+ if ( @sizeof($member_ranks) == 0 )
+ {
+ $sql = 'SELECT r.rank_name, m.member_name
+ FROM ' . MEMBER_RANKS_TABLE . ' r, ' . MEMBERS_TABLE . ' m
+ WHERE (r.rank_id = m.member_rank_id)
+ ORDER BY m.member_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $member_ranks[ $row['member_name'] ] = 'r_' . str_replace(' ', '_', trim($row['rank_name']));
+ }
+ $db->free_result($result);
+ }
+
+ $name_check = false;
+ $role_check = true;
+ $rank_check = true;
+
+/* Sample EQ2 log file format :: the three patterns to match are:
+
+#1 guilded normal
+#2 non-guilded normal
+#3 role (guilded; unguilded matches like /anon)
+#4 anon (guilded or not)
+
+ (neither anon or role shows zone FYI)
+
+
+(1121902422)[Wed Jul 20 19:33:42 2005] [43 Guardian] Goosage (Barbarian) <The Knights of Dawn Fire> Zone: The Feerrott
+(1121902422)[Wed Jul 20 19:33:42 2005] [47 Paladin] Maskie (Barbarian) Zone: The Feerrott
+(1121907805)[Wed Jul 20 21:03:25 2005] [Anonymous] Mildew (Gnome) <The Knights of Dawn Fire>
+(1121907951)[Wed Jul 20 21:05:51 2005] [Anonymous] Greywind (Human)
+
+
+German log file look slike this:
+(1122498819)[Wed Jul 27 23:13:39 2005] [50 Inquisitor] Chryorn (Dunkelelf) <Feral Fires>ZONE: Shattered Stillness: Epic
+(1122498819)[Wed Jul 27 23:13:39 2005] [50 Brigand] Xandros (Dunkelelf) <Feral Fires>ZONE: Shattered Stillness: Epic
+(1122498819)[Wed Jul 27 23:13:39 2005] [50 Wächter] Achilless (Barbar) <Feral Fires>ZONE: Shattered Stillness: Epic
+
+*/
+
+ // Date
+ $pattern = "/^\([0-9]{10}\)\[[a-zA-Z]{3} [a-zA-Z]{3} [0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2} [0-9]{4}\](.*)";
+ $pattern1 = "/^\([0-9]{10}\)\[[a-zA-Z]{3} [a-zA-Z]{3} [0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2} [0-9]{4}\](.*)";
+ $pattern2 = "/^\([0-9]{10}\)\[[a-zA-Z]{3} [a-zA-Z]{3} [0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2} [0-9]{4}\](.*)";
+ $pattern3 = "/^\([0-9]{10}\)\[[a-zA-Z]{3} [a-zA-Z]{3} [0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2} [0-9]{4}\](.*)";
+
+ // Level / Class
+ $pattern .= "\[([0-9]{1,2}) (.+)\]";
+ $pattern1 .= "\[([0-9]{1,2}) (.+)\]";
+ $pattern2 .= "\[Anonymous\]";
+ $pattern3 .= "\[Anonymous\]";
+
+ // Name
+ $pattern .= " ([A-Za-z]{1,})";
+ $pattern1 .= " ([A-Za-z]{1,})";
+ $pattern2 .= " ([A-Za-z]{1,})";
+ $pattern3 .= " ([A-Za-z]{1,})";
+
+ // Race
+ $pattern .= " \((.*)\)";
+ $pattern1 .= " \((.*)\)";
+ $pattern2 .= " \((.*)\)";
+ $pattern3 .= " \((.*)\)";
+
+ // Guild Tag
+ $pattern .= " \<(.*)\>";
+ $pattern2 .= " \<(.*)\>";
+
+ // Zone:
+ $pattern .= " Zone:(.*)";
+ $pattern1 .= " Zone:(.*)";
+
+ // End pattern regexp
+ $pattern .= '/';
+ $pattern1 .= '/';
+ $pattern2 .= '/';
+ $pattern3 .= '/';
+
+
+ // unset a line match type identifier
+ unset($type_line);
+
+ // match things the hard way..one type of line at a time
+ // crappy way to do it, but VERY easy to read and alter
+
+ // Normal
+ if ( preg_match($pattern, $log_line, $log_parsed) ) {
+ $name = trim($log_parsed[4]);
+ $race = trim($log_parsed[5]);
+ $class = trim($log_parsed[3]);
+ $level = trim($log_parsed[2]);
+ $guildtag = trim($log_parsed[6]);
+ $zone = trim($log_parsed[7]);
+ $type_line = 1;
+ }
+
+ // Unguilded
+ if ( preg_match($pattern1, $log_line, $log_parsed) ) {
+ $name = trim($log_parsed[4]);
+ $race = trim($log_parsed[5]);
+ $class = trim($log_parsed[3]);
+ $level = trim($log_parsed[2]);
+ $guildtag = "";
+ $zone = trim($log_parsed[6]);
+ if (!isset($type_line) ){ $type_line = 2;}
+ }
+
+ // Roleplaying
+ if ( preg_match($pattern2, $log_line, $log_parsed) ) {
+ $name = trim($log_parsed[2]);
+ $race = trim($log_parsed[3]);
+ $class = "Unknown";
+ $level = "50";
+ $guildtag = trim($log_parsed[4]);
+ $zone = "";
+ if (!isset($type_line) ){ $type_line = 3;}
+ }
+
+ // Anon
+ if ( preg_match($pattern3, $log_line, $log_parsed) ) {
+ $name = trim($log_parsed[2]);
+ $race = trim($log_parsed[3]);
+ $class = "Unknown";
+ $level = "50";
+ $guildtag = "";
+ $zone = "";
+ if (!isset($type_line) ){ $type_line = 4;}
+ }
+
+
+ // Jeezus this is a pain in the ass, ain't it?
+
+ /* Sample EQ2 log file format :: the three patterns to match are (one more time)
+
+(1121902422)[Wed Jul 20 19:33:42 2005] [43 Guardian] Goosage (Barbarian) <The Knights of Dawn Fire> Zone: The Feerrott
+(1121902422)[Wed Jul 20 19:33:42 2005] [47 Paladin] Maskie (Barbarian) Zone: The Feerrott
+(1121907805)[Wed Jul 20 21:03:25 2005] [Anonymous] Mildew (Gnome) <The Knights of Dawn Fire>
+(1121907951)[Wed Jul 20 21:05:51 2005] [Anonymous] Greywind (Human)
+
+After using the above 4, we now test with the same members in different states of anon/role/guilded
+
+(1121902422)[Wed Jul 20 19:33:42 2005] [Anonymous] Goosage (Barbarian)
+(1121902422)[Wed Jul 20 19:33:42 2005] [Anonymous] Maskie (Barbarian) <The Knights of Dawn Fire
+(1121907805)[Wed Jul 20 21:03:25 2005] [47 Cleric] Mildew (Gnome) <The Knights of Dawn Fire> Zone: The Feerrott
+(1121907951)[Wed Jul 20 21:05:51 2005] [49 Monk] Greywind (Human) Zone: The Feerrott
+
+ */
+
+
+ if ($type_line == 1) {
+ print"Name: $name , Race: $race , Class: $class , Guild: $guildtag , Level: $level , Zone: $zone<br>";
+ }
+
+ if ($type_line == 2) {
+ print"Name: $name , Race: $race , Class: $class , Level: $level , Zone: $zone<br>";
+ }
+
+ if ($type_line == 3) {
+ print"Name: $name , Race: $race , Class_Guess: $class , Level_Guess: $level , Guild: $guildtag<br>";
+ }
+
+ if ($type_line == 4) {
+ print"Name: $name , Race: $race , Class_Guess: $class , Level_Guess: $level<br>";
+ }
+
+
+ // Looking for roleplaying folks? Is this valid for EQ2?
+ if ( !isset($_POST['findrole']) )
+ {
+ if ( (isset($class)) && ($class == 'Unknown') )
+ {
+ $role_check = false;
+ }
+ }
+
+ if ( (isset($name)) && ($name != '') )
+ {
+ $name_check = true;
+ }
+
+ // Check if we're including this member's rank
+ if ( isset($member_ranks[$name]) )
+ {
+ // If POST[r_<rank_name>] isn't set, we're ignoring this member
+ if ( !isset($_POST[ $member_ranks[$name] ]) )
+ {
+ $rank_check = false;
+ }
+ }
+
+ if ( ($name_check) && ($role_check) && ($rank_check) )
+ {
+ $_SESSION[$name] = array(
+ 'tag' => $guildtag,
+ 'name' => $name,
+ 'level' => $level,
+ 'class' => $class,
+ 'race' => $race);
+
+ return $name;
+ }
+ return false;
+ }
+
+ function M_to_n($m)
+ {
+ switch($m)
+ {
+ case 'Jan':
+ return '01';
+ break;
+ case 'Feb':
+ return '02';
+ break;
+ case 'Mar':
+ return '03';
+ break;
+ case 'Apr':
+ return '04';
+ break;
+ case 'May':
+ return '05';
+ break;
+ case 'Jun':
+ return '06';
+ break;
+ case 'Jul':
+ return '07';
+ break;
+ case 'Aug':
+ return '08';
+ break;
+ case 'Sep':
+ return '09';
+ break;
+ case 'Oct':
+ return '10';
+ break;
+ case 'Nov':
+ return '11';
+ break;
+ case 'Dec':
+ return '12';
+ break;
+ }
+ }
+
+ // ---------------------------------------------------------
+ // Display form
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $log_columns = ( preg_match("/Mozilla\/4\.[1-9]{1}.+/", $_SERVER['HTTP_USER_AGENT']) ) ? '50' : '90';
+
+ // Options to parse
+ $options = array(
+ 0 => array(
+ 'CBNAME' => 'findall',
+ 'CBVALUE' => '1',
+ 'CBCHECKED' => '',
+ 'OPTION' => $user->lang['log_find_all']),
+ 1 => array(
+ 'CBNAME' => 'findrole',
+ 'CBVALUE' => '1',
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => 'Include Roleplay')
+ );
+
+ // Guildtags to parse
+ if ( !empty($eqdkp->config['parsetags']) )
+ {
+ $parsetags = explode("\n", $eqdkp->config['parsetags']);
+ foreach ( $parsetags as $index => $guildtag )
+ {
+ $tagoptions[] = array(
+ 'CBNAME' => str_replace(' ', '_', trim($guildtag)),
+ 'CBVALUE' => '1',
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => '&lt;' . trim($guildtag) . '&gt;');
+ }
+ $options = array_merge($options, $tagoptions);
+ }
+
+ foreach ( $options as $row )
+ {
+ $tpl->assign_block_vars('options_row', $row);
+ }
+
+ // Member tags to parse
+ // Find out how many members have each rank
+ $rank_counts = array();
+ $sql = 'SELECT member_rank_id, count(member_rank_id) as count
+ FROM ' . MEMBERS_TABLE . '
+ GROUP BY member_rank_id';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $rank_counts[ $row['member_rank_id'] ] = $row['count'];
+ }
+ $db->free_result($result);
+
+ $ranks = array();
+ $sql = 'SELECT rank_id, rank_name, rank_prefix, rank_suffix
+ FROM ' . MEMBER_RANKS_TABLE . '
+ ORDER BY rank_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ // Make sure there's not a guildtag with the same name as the rank
+ if ( !in_array($row['rank_name'], $options) )
+ {
+ $rank_count = ( isset($rank_counts[ $row['rank_id'] ]) ) ? $rank_counts[ $row['rank_id'] ] : 0;
+ $format = ( $rank_count == 1 ) ? $user->lang['x_members_s'] : $user->lang['x_members_p'];
+
+ $ranks[] = array(
+ 'CBNAME' => 'r_' . str_replace(' ', '_', trim($row['rank_name'])),
+ 'CBVALUE' => intval($row['rank_id']),
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => $user->lang['rank'] . ': ' . (( empty($row['rank_name']) ) ? '(None)' : $row['rank_prefix'] . $row['rank_name'] . $row['rank_suffix'])
+ . ' <span class="small">(' . sprintf($format, $rank_count) . ')</span>');
+ }
+ }
+ $db->free_result($result);
+
+ foreach ( $ranks as $row )
+ {
+ $tpl->assign_block_vars('ranks_row', $row);
+ }
+
+ $tpl->assign_vars(array(
+ 'F_PARSE_LOG' => 'parse_Everquest2.php' . $SID,
+
+ 'S_STEP1' => true,
+ 'L_PASTE_LOG' => $user->lang['paste_log'],
+ 'L_OPTIONS' => $user->lang['options'],
+ 'L_PARSE_LOG' => $user->lang['parse_log'],
+ 'L_CLOSE_WINDOW' => $user->lang['close_window'],
+
+ 'LOG_COLS' => $log_columns)
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['parselog_title'],
+ 'gen_simple_header' => true,
+ 'template_file' => 'admin/parse_Everquest2.html',
+ 'display' => true)
+ );
+ }
+}
+
+$parse_log = new Parse_Log;
+$parse_log->process();
+?>
diff --git a/admin/parse_Everquest2German.php b/admin/parse_Everquest2German.php
new file mode 100644
index 0000000..1e6e087
--- /dev/null
+++ b/admin/parse_Everquest2German.php
@@ -0,0 +1,515 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * parse_Everquest2.php
+ * Began: Tue December 24 2002
+ *
+ * $Id: parse_Everquest2German.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class Parse_Log extends EQdkp_Admin
+{
+ function parse_log()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ $this->assoc_buttons(array(
+ 'parse' => array(
+ 'name' => 'parse',
+ 'process' => 'process_parse',
+ 'check' => 'a_raid_'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_raid_'))
+ );
+ }
+
+ // ---------------------------------------------------------
+ // Process Parse
+ // ---------------------------------------------------------
+ function process_parse()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $channel_members = '';
+ $line = '';
+ $valid_date_found = false;
+
+ $log_file = explode("\n", $_POST['log']);
+ $log_file = str_replace('&lt;', '<', str_replace('&gt;', '>', $log_file));
+ $line_count = sizeof($log_file);
+
+ // Go through each line and
+ // - Check for/get a valid member in the /who
+ // - Check if there's a valid date we can use
+ // - Check for/get valid members from /list <channel>
+ $log_date = array();
+ session_start(); // Hold our array of name => class/level/race
+ for ( $i = 0; $i < $line_count; $i++ )
+ {
+ $line = '';
+ if ( (isset($_POST['findall'])) || (strpos($log_file[$i], '<')) )
+ {
+ $member_name = $this->line_parse($log_file[$i]);
+
+ // Make sure that each member's name is properly capitalized
+ $mname = strtolower(preg_replace('/[[:space:]]/i', ' ', $member_name));
+ $member_name = ucwords($mname);
+
+ if ( trim($member_name) != '')
+ {
+ $member_names[] = $member_name;
+ }
+ }
+
+ } // for ... log_file
+
+ // If there were channel members, join the two arrays
+ if ( !empty($channel_members) )
+ {
+ $channel_members = explode(', ', $channel_members);
+ $member_names = array_merge($member_names, $channel_members);
+ }
+
+ $date['mo'] = date('M');
+ $date['d'] = date('d');
+ $date['y'] = date('Y');
+ $date['h'] = date('h');
+ $date['mi'] = date('i');
+ $date['s'] = date('s');
+
+ // Process the member_names array: replaces spaces, make it unique, sort it and reset it
+ if ( (isset($member_names)) && (is_array($member_names)) )
+ {
+ $name_count = sizeof($member_names);
+ }
+ else
+ {
+ $name_count = 0;
+ $member_names = array();
+ }
+
+ for ( $i = 0; $i < $name_count; $i++ )
+ {
+ $member_names[$i] = str_replace(' ', '', $member_names[$i]);
+ }
+ $member_names = array_unique($member_names);
+ sort($member_names);
+ reset($member_names);
+
+ $tpl->assign_vars(array(
+ 'S_STEP1' => false,
+ 'L_FOUND_MEMBERS' => sprintf($user->lang['found_members'], $line_count, sizeof($member_names)),
+ 'L_LOG_DATE_TIME' => $user->lang['log_date_time'],
+ 'L_LOG_ADD_DATA' => $user->lang['log_add_data'],
+
+ 'FOUND_MEMBERS' => implode("\n", $member_names),
+ 'MO' => $this->M_to_n($date['mo']),
+ 'D' => $date['d'],
+ 'Y' => $date['y'],
+ 'H' => $date['h'],
+ 'MI' => $date['mi'],
+ 'S' => $date['s'])
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['parselog_title'],
+ 'gen_simple_header' => true,
+ 'template_file' => 'admin/parse_Everquest2.html',
+ 'display' => true)
+ );
+ }
+
+ // ---------------------------------------------------------
+ // Process helper methods
+ // ---------------------------------------------------------
+ function line_parse($log_line)
+ {
+ global $db, $eqdkp, $user;
+ static $member_ranks = array();
+
+ //$log_line = stripslashes($log_line);
+
+ // First off, we don't care about afk or lfg, so remove them
+ $log_line = str_replace(' (AFK)', '', $log_line);
+ $log_line = str_replace(' (LFG)', '', $log_line);
+
+ // Build a clean array of guildtags we might be looking for
+ $parsetags = explode("\n", $eqdkp->config['parsetags']);
+ foreach ( $parsetags as $k => $v )
+ {
+ $parsetags[$k] = trim(stripslashes($v));
+ }
+
+ // Cache the member name / member rank info
+ if ( @sizeof($member_ranks) == 0 )
+ {
+ $sql = 'SELECT r.rank_name, m.member_name
+ FROM ' . MEMBER_RANKS_TABLE . ' r, ' . MEMBERS_TABLE . ' m
+ WHERE (r.rank_id = m.member_rank_id)
+ ORDER BY m.member_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $member_ranks[ $row['member_name'] ] = 'r_' . str_replace(' ', '_', trim($row['rank_name']));
+ }
+ $db->free_result($result);
+ }
+
+ $name_check = false;
+ $role_check = true;
+ $rank_check = true;
+
+/* Sample EQ2 log file format :: the three patterns to match are:
+
+#1 guilded normal
+#2 non-guilded normal
+#3 role (guilded; unguilded matches like /anon)
+#4 anon (guilded or not)
+
+ (neither anon or role shows zone FYI)
+
+
+(1121902422)[Wed Jul 20 19:33:42 2005] [43 Guardian] Goosage (Barbarian) <The Knights of Dawn Fire> Zone: The Feerrott
+(1121902422)[Wed Jul 20 19:33:42 2005] [47 Paladin] Maskie (Barbarian) Zone: The Feerrott
+(1121907805)[Wed Jul 20 21:03:25 2005] [Anonymous] Mildew (Gnome) <The Knights of Dawn Fire>
+(1121907951)[Wed Jul 20 21:05:51 2005] [Anonymous] Greywind (Human)
+
+
+German log file looks like this :
+(1122498819)[Wed Jul 27 23:13:39 2005] [50 Inquisitor] Chryorn (Dunkelelf) <Feral Fires>ZONE: Shattered Stillness: Epic
+(1122498819)[Wed Jul 27 23:13:39 2005] [50 Brigand] Xandros (Dunkelelf) <Feral Fires>ZONE: Shattered Stillness: Epic
+(1122498819)[Wed Jul 27 23:13:39 2005] [50 Wächter] Achilless (Barbar) <Feral Fires>ZONE: Shattered Stillness: Epic
+
+*/
+
+ // Date
+ $pattern = "/^\([0-9]{10}\)\[[a-zA-Z]{3} [a-zA-Z]{3} [0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2} [0-9]{4}\](.*)";
+ $pattern1 = "/^\([0-9]{10}\)\[[a-zA-Z]{3} [a-zA-Z]{3} [0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2} [0-9]{4}\](.*)";
+ $pattern2 = "/^\([0-9]{10}\)\[[a-zA-Z]{3} [a-zA-Z]{3} [0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2} [0-9]{4}\](.*)";
+ $pattern3 = "/^\([0-9]{10}\)\[[a-zA-Z]{3} [a-zA-Z]{3} [0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2} [0-9]{4}\](.*)";
+
+ // Level / Class
+ $pattern .= "\[([0-9]{1,2}) (.+)\]";
+ $pattern1 .= "\[([0-9]{1,2}) (.+)\]";
+ $pattern2 .= "\[Anonymous\]";
+ $pattern3 .= "\[Anonymous\]";
+
+ // Name
+ $pattern .= " ([A-Za-z]{1,})";
+ $pattern1 .= " ([A-Za-z]{1,})";
+ $pattern2 .= " ([A-Za-z]{1,})";
+ $pattern3 .= " ([A-Za-z]{1,})";
+
+ // Race
+ $pattern .= " \((.*)\)";
+ $pattern1 .= " \((.*)\)";
+ $pattern2 .= " \((.*)\)";
+ $pattern3 .= " \((.*)\)";
+
+ // Guild Tag
+ $pattern .= " \<(.*)\>";
+ $pattern2 .= " \<(.*)\>";
+
+ // Zone:
+ $pattern .= "ZONE: (.*)";
+ $pattern1 .= "ZONE: (.*)";
+
+ // End pattern regexp
+ $pattern .= '/';
+ $pattern1 .= '/';
+ $pattern2 .= '/';
+ $pattern3 .= '/';
+
+
+ // unset a line match type identifier
+ unset($type_line);
+
+ // match things the hard way..one type of line at a time
+ // crappy way to do it, but VERY easy to read and alter
+
+ // Normal
+ if ( preg_match($pattern, $log_line, $log_parsed) ) {
+ $name = trim($log_parsed[4]);
+ $race = trim($log_parsed[5]);
+ $class = trim($log_parsed[3]);
+ $level = trim($log_parsed[2]);
+ $guildtag = trim($log_parsed[6]);
+ $zone = trim($log_parsed[7]);
+ $type_line = 1;
+ }
+
+ // Unguilded
+ if ( preg_match($pattern1, $log_line, $log_parsed) ) {
+ $name = trim($log_parsed[4]);
+ $race = trim($log_parsed[5]);
+ $class = trim($log_parsed[3]);
+ $level = trim($log_parsed[2]);
+ $guildtag = "";
+ $zone = trim($log_parsed[6]);
+ if (!isset($type_line) ){ $type_line = 2;}
+ }
+
+ // Roleplaying
+ if ( preg_match($pattern2, $log_line, $log_parsed) ) {
+ $name = trim($log_parsed[2]);
+ $race = trim($log_parsed[3]);
+ $class = "Unknown";
+ $level = "50";
+ $guildtag = trim($log_parsed[4]);
+ $zone = "";
+ if (!isset($type_line) ){ $type_line = 3;}
+ }
+
+ // Anon
+ if ( preg_match($pattern3, $log_line, $log_parsed) ) {
+ $name = trim($log_parsed[2]);
+ $race = trim($log_parsed[3]);
+ $class = "Unknown";
+ $level = "50";
+ $guildtag = "";
+ $zone = "";
+ if (!isset($type_line) ){ $type_line = 4;}
+ }
+
+
+ // Jeezus this is a pain in the ass, ain't it?
+
+ /* Sample EQ2 log file format :: the three patterns to match are (one more time)
+
+(1121902422)[Wed Jul 20 19:33:42 2005] [43 Guardian] Goosage (Barbarian) <The Knights of Dawn Fire> Zone: The Feerrott
+(1121902422)[Wed Jul 20 19:33:42 2005] [47 Paladin] Maskie (Barbarian) Zone: The Feerrott
+(1121907805)[Wed Jul 20 21:03:25 2005] [Anonymous] Mildew (Gnome) <The Knights of Dawn Fire>
+(1121907951)[Wed Jul 20 21:05:51 2005] [Anonymous] Greywind (Human)
+
+After using the above 4, we now test with the same members in different states of anon/role/guilded
+
+(1121902422)[Wed Jul 20 19:33:42 2005] [Anonymous] Goosage (Barbarian)
+(1121902422)[Wed Jul 20 19:33:42 2005] [Anonymous] Maskie (Barbarian) <The Knights of Dawn Fire
+(1121907805)[Wed Jul 20 21:03:25 2005] [47 Cleric] Mildew (Gnome) <The Knights of Dawn Fire> Zone: The Feerrott
+(1121907951)[Wed Jul 20 21:05:51 2005] [49 Monk] Greywind (Human) Zone: The Feerrott
+
+ */
+
+
+ if ($type_line == 1) {
+ print"Name: $name , Race: $race , Class: $class , Guild: $guildtag , Level: $level , Zone: $zone<br>";
+ }
+
+ if ($type_line == 2) {
+ print"Name: $name , Race: $race , Class: $class , Level: $level , Zone: $zone<br>";
+ }
+
+ if ($type_line == 3) {
+ print"Name: $name , Race: $race , Class_Guess: $class , Level_Guess: $level , Guild: $guildtag<br>";
+ }
+
+ if ($type_line == 4) {
+ print"Name: $name , Race: $race , Class_Guess: $class , Level_Guess: $level<br>";
+ }
+
+
+ // Looking for roleplaying folks? Is this valid for EQ2?
+ if ( !isset($_POST['findrole']) )
+ {
+ if ( (isset($class)) && ($class == 'Unknown') )
+ {
+ $role_check = false;
+ }
+ }
+
+ if ( (isset($name)) && ($name != '') )
+ {
+ $name_check = true;
+ }
+
+ // Check if we're including this member's rank
+ if ( isset($member_ranks[$name]) )
+ {
+ // If POST[r_<rank_name>] isn't set, we're ignoring this member
+ if ( !isset($_POST[ $member_ranks[$name] ]) )
+ {
+ $rank_check = false;
+ }
+ }
+
+ if ( ($name_check) && ($role_check) && ($rank_check) )
+ {
+ $_SESSION[$name] = array(
+ 'tag' => $guildtag,
+ 'name' => $name,
+ 'level' => $level,
+ 'class' => $class,
+ 'race' => $race);
+
+ return $name;
+ }
+ return false;
+ }
+
+ function M_to_n($m)
+ {
+ switch($m)
+ {
+ case 'Jan':
+ return '01';
+ break;
+ case 'Feb':
+ return '02';
+ break;
+ case 'Mar':
+ return '03';
+ break;
+ case 'Apr':
+ return '04';
+ break;
+ case 'May':
+ return '05';
+ break;
+ case 'Jun':
+ return '06';
+ break;
+ case 'Jul':
+ return '07';
+ break;
+ case 'Aug':
+ return '08';
+ break;
+ case 'Sep':
+ return '09';
+ break;
+ case 'Oct':
+ return '10';
+ break;
+ case 'Nov':
+ return '11';
+ break;
+ case 'Dec':
+ return '12';
+ break;
+ }
+ }
+
+ // ---------------------------------------------------------
+ // Display form
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $log_columns = ( preg_match("/Mozilla\/4\.[1-9]{1}.+/", $_SERVER['HTTP_USER_AGENT']) ) ? '50' : '90';
+
+ // Options to parse
+ $options = array(
+ 0 => array(
+ 'CBNAME' => 'findall',
+ 'CBVALUE' => '1',
+ 'CBCHECKED' => '',
+ 'OPTION' => $user->lang['log_find_all']),
+ 1 => array(
+ 'CBNAME' => 'findrole',
+ 'CBVALUE' => '1',
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => 'Include Roleplay')
+ );
+
+ // Guildtags to parse
+ if ( !empty($eqdkp->config['parsetags']) )
+ {
+ $parsetags = explode("\n", $eqdkp->config['parsetags']);
+ foreach ( $parsetags as $index => $guildtag )
+ {
+ $tagoptions[] = array(
+ 'CBNAME' => str_replace(' ', '_', trim($guildtag)),
+ 'CBVALUE' => '1',
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => '&lt;' . trim($guildtag) . '&gt;');
+ }
+ $options = array_merge($options, $tagoptions);
+ }
+
+ foreach ( $options as $row )
+ {
+ $tpl->assign_block_vars('options_row', $row);
+ }
+
+ // Member tags to parse
+ // Find out how many members have each rank
+ $rank_counts = array();
+ $sql = 'SELECT member_rank_id, count(member_rank_id) as count
+ FROM ' . MEMBERS_TABLE . '
+ GROUP BY member_rank_id';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $rank_counts[ $row['member_rank_id'] ] = $row['count'];
+ }
+ $db->free_result($result);
+
+ $ranks = array();
+ $sql = 'SELECT rank_id, rank_name, rank_prefix, rank_suffix
+ FROM ' . MEMBER_RANKS_TABLE . '
+ ORDER BY rank_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ // Make sure there's not a guildtag with the same name as the rank
+ if ( !in_array($row['rank_name'], $options) )
+ {
+ $rank_count = ( isset($rank_counts[ $row['rank_id'] ]) ) ? $rank_counts[ $row['rank_id'] ] : 0;
+ $format = ( $rank_count == 1 ) ? $user->lang['x_members_s'] : $user->lang['x_members_p'];
+
+ $ranks[] = array(
+ 'CBNAME' => 'r_' . str_replace(' ', '_', trim($row['rank_name'])),
+ 'CBVALUE' => intval($row['rank_id']),
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => $user->lang['rank'] . ': ' . (( empty($row['rank_name']) ) ? '(None)' : $row['rank_prefix'] . $row['rank_name'] . $row['rank_suffix'])
+ . ' <span class="small">(' . sprintf($format, $rank_count) . ')</span>');
+ }
+ }
+ $db->free_result($result);
+
+ foreach ( $ranks as $row )
+ {
+ $tpl->assign_block_vars('ranks_row', $row);
+ }
+
+ $tpl->assign_vars(array(
+ 'F_PARSE_LOG' => 'parse_Everquest2.php' . $SID,
+
+ 'S_STEP1' => true,
+ 'L_PASTE_LOG' => $user->lang['paste_log'],
+ 'L_OPTIONS' => $user->lang['options'],
+ 'L_PARSE_LOG' => $user->lang['parse_log'],
+ 'L_CLOSE_WINDOW' => $user->lang['close_window'],
+
+ 'LOG_COLS' => $log_columns)
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['parselog_title'],
+ 'gen_simple_header' => true,
+ 'template_file' => 'admin/parse_Everquest2.html',
+ 'display' => true)
+ );
+ }
+}
+
+$parse_log = new Parse_Log;
+$parse_log->process();
+?>
diff --git a/admin/parse_Vanguard-SoH.php b/admin/parse_Vanguard-SoH.php
new file mode 100644
index 0000000..b69be61
--- /dev/null
+++ b/admin/parse_Vanguard-SoH.php
@@ -0,0 +1,449 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * parse_Everquest2.php
+ * Began: Sun February 04 2007
+ *
+ * $Id: parse_Vanguard-SoH.php 8 2007-02-04 16:16:20 Dazza $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class Parse_Log extends EQdkp_Admin
+{
+ function parse_log()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ $this->assoc_buttons(array(
+ 'parse' => array(
+ 'name' => 'parse',
+ 'process' => 'process_parse',
+ 'check' => 'a_raid_'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_raid_'))
+ );
+ }
+
+ // ---------------------------------------------------------
+ // Process Parse
+ // ---------------------------------------------------------
+/*
+
+[10:42:54]Anaryon: Level 9 Ranger - Leth Nurae
+[10:42:54] Janaar: Level 8 Paladin - Leth Nurae
+[10:42:54] Carathien: Level 8 Cleric - Leth Nurae
+[10:42:54] Stonay: Level 11 Dread Knight (The Unholy Inquisition) - Leth Nurae
+[10:42:54] Traxs: Level 14 Ranger - Leth Nurae
+[10:42:54] Kellermann: Level 11 Cleric (The Unholy Inquisition) - Leth Nurae
+[10:42:54] Aerwrynn: Level 6 Psionicist - Leth Nurae
+[10:42:54] Nexiana: Level 8 Ranger - Leth Nurae
+[10:42:54] Metis: Level 10 Psionicist - Leth Nurae
+[10:42:54] Lancevent: Level 6 Psionicist (Alliance des Seigneurs) - Leth Nurae
+[10:42:54] Arteah: Level 5 Blood Mage - Leth Nurae
+[10:42:54] Ormung: Level 9 Shaman - Leth Nurae
+[10:42:54] Schnabbo: Level 6 Bard - Leth Nurae
+[10:42:54] Taung: Level 7 Cleric - Leth Nurae
+[10:42:54] Marsosis: Level 8 Paladin - Leth Nurae
+[10:42:54] Ariam: Level 7 Bard - Leth Nurae
+[10:42:54] Nagyon: Level 6 Ranger - Leth Nurae
+[10:42:54] Lillial: Level 7 Ranger - Leth Nurae
+[10:42:54] Prook: Level 7 Sorcerer - Leth Nurae
+[10:42:54] Maleek: Level 12 Paladin - Leth Nurae
+[10:42:54] Kaeia: Level 15 Ranger - Leth Nurae
+[10:42:54] Burro: Level 21 Druid (Knights of the Tribunal) - Leth Nurae
+[10:42:54] Liadora: Level 6 Bard - Leth Nurae
+[10:42:54] Maschelie: Level 4 Psionicist - Leth Nurae
+[10:42:54] Tiltwait: Level 9 Blood Mage - Leth Nurae
+[10:42:54] Mythera: Level 11 Psionicist - Leth Nurae
+[10:42:54] Tulanthas: Level 7 Ranger - Leth Nurae
+[10:42:54] Saelnir: Level 11 Sorcerer - Leth Nurae
+[10:42:54] Wizor: Level 4 Sorcerer - Leth Nurae
+[10:42:54] Tylara: Level 6 Sorcerer - Leth Nurae
+[10:42:54] Silverana: Level 5 Psionicist - Leth Nurae
+[10:42:54] Morowind: Level 11 Psionicist - Leth Nurae
+[10:42:54] Gaddinger: Level 5 Ranger - Leth Nurae
+[10:42:54] Domulus: Level 7 Blood Mage - Leth Nurae
+[10:42:54] Emperios: Level 8 Cleric - Leth Nurae
+[10:42:54] Silanis: Level 5 Ranger - Leth Nurae
+[10:42:54] Carnon: Level 5 Paladin - Leth Nurae
+[10:42:54] Edakor: Level 3 Sorcerer - Leth Nurae
+[10:42:54] Arkanidall: Level 4 Sorcerer - Leth Nurae
+[10:42:54] Sendaran: Level 9 Sorcerer - Leth Nurae
+[10:42:54] 40 player(s) found.
+
+*/
+ function process_parse()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $channel_members = '';
+ $line = '';
+ $valid_date_found = false;
+
+ $log_file = explode("\n", $_POST['log']);
+ $log_file = str_replace('&lt;', '<', str_replace('&gt;', '>', $log_file));
+ $line_count = sizeof($log_file);
+
+ // Go through each line and
+ // - Check for/get a valid member in the /who
+ // - Check if there's a valid date we can use
+ // - Check for/get valid members from /list <channel>
+ $log_date = array();
+ session_start(); // Hold our array of name => class/level/race
+ for ( $i = 0; $i < $line_count; $i++ )
+ {
+ $line = '';
+
+ //Each member parse starts here
+ $member_name = $this->line_parse($log_file[$i]);
+
+ // Make sure that each member's name is properly capitalized
+ $mname = strtolower(preg_replace('/[[:space:]]/i', ' ', $member_name));
+ $member_name = ucwords($mname);
+
+ if ( trim($member_name) != '')
+ {
+ $member_names[] = $member_name;
+ }
+ //End member parse
+
+ } // for ... log_file
+
+ // If there were channel members, join the two arrays
+ if ( !empty($channel_members) )
+ {
+ $channel_members = explode(', ', $channel_members);
+ $member_names = array_merge($member_names, $channel_members);
+ }
+
+ $date['mo'] = date('M');
+ $date['d'] = date('d');
+ $date['y'] = date('Y');
+ $date['h'] = date('h');
+ $date['mi'] = date('i');
+ $date['s'] = date('s');
+
+ // Process the member_names array: replaces spaces, make it unique, sort it and reset it
+ if ( (isset($member_names)) && (is_array($member_names)) )
+ {
+ $name_count = sizeof($member_names);
+ }
+ else
+ {
+ $name_count = 0;
+ $member_names = array();
+ }
+
+ for ( $i = 0; $i < $name_count; $i++ )
+ {
+ $member_names[$i] = str_replace(' ', '', $member_names[$i]);
+ }
+ $member_names = array_unique($member_names);
+ sort($member_names);
+ reset($member_names);
+
+ $tpl->assign_vars(array(
+ 'S_STEP1' => false,
+ 'L_FOUND_MEMBERS' => sprintf($user->lang['found_members'], $line_count, sizeof($member_names)),
+ 'L_LOG_DATE_TIME' => $user->lang['log_date_time'],
+ 'L_LOG_ADD_DATA' => $user->lang['log_add_data'],
+
+ 'FOUND_MEMBERS' => implode("\n", $member_names),
+ 'MO' => $this->M_to_n($date['mo']),
+ 'D' => $date['d'],
+ 'Y' => $date['y'],
+ 'H' => $date['h'],
+ 'MI' => $date['mi'],
+ 'S' => $date['s'])
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['parselog_title'],
+ 'gen_simple_header' => true,
+ 'template_file' => 'admin/parse_Everquest2.html',
+ 'display' => true)
+ );
+ }
+
+ // ---------------------------------------------------------
+ // Process helper methods
+ // ---------------------------------------------------------
+ function line_parse($log_line)
+ {
+ global $db, $eqdkp, $user;
+ static $member_ranks = array();
+
+ //$log_line = stripslashes($log_line);
+
+ // First off, we don't care about afk or lfg, so remove them
+ $log_line = str_replace(' (AFK)', '', $log_line);
+ $log_line = str_replace(' (LFG)', '', $log_line);
+
+ // Build a clean array of guildtags we might be looking for
+ $parsetags = explode("\n", $eqdkp->config['parsetags']);
+ foreach ( $parsetags as $k => $v )
+ {
+ $parsetags[$k] = trim(stripslashes($v));
+ }
+
+ // Cache the member name / member rank info
+ if ( @sizeof($member_ranks) == 0 )
+ {
+ $sql = 'SELECT r.rank_name, m.member_name
+ FROM ' . MEMBER_RANKS_TABLE . ' r, ' . MEMBERS_TABLE . ' m
+ WHERE (r.rank_id = m.member_rank_id)
+ ORDER BY m.member_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $member_ranks[ $row['member_name'] ] = 'r_' . str_replace(' ', '_', trim($row['rank_name']));
+ }
+ $db->free_result($result);
+ }
+
+ $name_check = false;
+ $role_check = true;
+ $rank_check = true;
+
+/* Sample SoH log file format ::
+
+[10:42:54]Anaryon: Level 9 Ranger - Leth Nurae
+[10:42:54] Janaar: Level 8 Paladin - Leth Nurae
+[10:42:54] Carathien: Level 8 Cleric - Leth Nurae
+[10:42:54] Stonay: Level 11 Dread Knight (The Unholy Inquisition) - Leth Nurae
+[10:42:54] Traxs: Level 14 Ranger - Leth Nurae
+[10:42:54] Kellermann: Level 11 Cleric (The Unholy Inquisition) - Leth Nurae
+[10:42:54] Aerwrynn: Level 6 Psionicist - Leth Nurae
+[10:42:54] Nexiana: Level 8 Ranger - Leth Nurae
+[10:42:54] Metis: Level 10 Psionicist - Leth Nurae
+[10:42:54] Lancevent: Level 6 Psionicist (Alliance des Seigneurs) - Leth Nurae
+[10:42:54] Arteah: Level 5 Blood Mage - Leth Nurae
+
+*/
+
+ // Date / Time
+ $pattern = "/^(?:\[[0-9]{1,2}\:[0-9]{2}\:[0-9]{2}\])";
+
+ // Name
+ $pattern .= "\s*?([A-Za-z]{1,}):";
+
+ // Level / Class
+ $pattern .= "\s*?Level ([0-9]{1,2}) ([^-\(]+)";
+
+ // Guild Tag
+ $pattern .= "\s*?(?:\((.*?)\))?";
+
+ // Zone:
+ $pattern .= "\s*?- (.*)";
+
+ // End pattern regexp
+ $pattern .= '/';
+
+
+ // unset a line match type identifier
+ unset($type_line);
+
+ // match things the hard way..one type of line at a time
+ // crappy way to do it, but VERY easy to read and alter
+
+ // Normal
+ if ( preg_match($pattern, $log_line, $log_parsed) )
+ {
+ $name = trim($log_parsed[1]);
+ $level = trim($log_parsed[2]);
+ $class = trim($log_parsed[3]);
+ $guildtag = ( isset($log_parsed[5]) ? trim($log_parsed[4]) : '' );
+ $zone = ( isset($log_parsed[5]) ? trim($log_parsed[5]) : trim($log_parsed[4]) );
+ $type_line = 1;
+ }
+
+
+ if ($type_line == 1) {
+ print"Name: $name , Level: $level , Class: $class , Guild: $guildtag , Zone: $zone<br>";
+ }
+
+
+ if ( (isset($name)) && ($name != '') )
+ {
+ $name_check = true;
+ }
+
+ // Check if we're including this member's rank
+ if ( isset($member_ranks[$name]) )
+ {
+ // If POST[r_<rank_name>] isn't set, we're ignoring this member
+ if ( !isset($_POST[ $member_ranks[$name] ]) )
+ {
+ $rank_check = false;
+ }
+ }
+
+ if ( ($name_check) && ($role_check) && ($rank_check) )
+ {
+ $_SESSION[$name] = array(
+ 'tag' => $guildtag,
+ 'name' => $name,
+ 'level' => $level,
+ 'class' => $class,
+ 'race' => $race);
+
+ return $name;
+ }
+ return false;
+ }
+
+
+ function M_to_n($m)
+ {
+ switch($m)
+ {
+ case 'Jan':
+ return '01';
+ break;
+ case 'Feb':
+ return '02';
+ break;
+ case 'Mar':
+ return '03';
+ break;
+ case 'Apr':
+ return '04';
+ break;
+ case 'May':
+ return '05';
+ break;
+ case 'Jun':
+ return '06';
+ break;
+ case 'Jul':
+ return '07';
+ break;
+ case 'Aug':
+ return '08';
+ break;
+ case 'Sep':
+ return '09';
+ break;
+ case 'Oct':
+ return '10';
+ break;
+ case 'Nov':
+ return '11';
+ break;
+ case 'Dec':
+ return '12';
+ break;
+ }
+ }
+
+ // ---------------------------------------------------------
+ // Display form
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $log_columns = ( preg_match("/Mozilla\/4\.[1-9]{1}.+/", $_SERVER['HTTP_USER_AGENT']) ) ? '50' : '90';
+
+ $options = array();
+
+ // Guildtags to parse
+ if ( !empty($eqdkp->config['parsetags']) )
+ {
+ $parsetags = explode("\n", $eqdkp->config['parsetags']);
+ foreach ( $parsetags as $index => $guildtag )
+ {
+ $tagoptions[] = array(
+ 'CBNAME' => str_replace(' ', '_', trim($guildtag)),
+ 'CBVALUE' => '1',
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => '&lt;' . trim($guildtag) . '&gt;');
+ }
+ $options = array_merge($options, $tagoptions);
+ }
+
+ foreach ( $options as $row )
+ {
+ $tpl->assign_block_vars('options_row', $row);
+ }
+
+ // Member tags to parse
+ // Find out how many members have each rank
+ $rank_counts = array();
+ $sql = 'SELECT member_rank_id, count(member_rank_id) as count
+ FROM ' . MEMBERS_TABLE . '
+ GROUP BY member_rank_id';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $rank_counts[ $row['member_rank_id'] ] = $row['count'];
+ }
+ $db->free_result($result);
+
+ $ranks = array();
+ $sql = 'SELECT rank_id, rank_name, rank_prefix, rank_suffix
+ FROM ' . MEMBER_RANKS_TABLE . '
+ ORDER BY rank_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ // Make sure there's not a guildtag with the same name as the rank
+ if ( !in_array($row['rank_name'], $options) )
+ {
+ $rank_count = ( isset($rank_counts[ $row['rank_id'] ]) ) ? $rank_counts[ $row['rank_id'] ] : 0;
+ $format = ( $rank_count == 1 ) ? $user->lang['x_members_s'] : $user->lang['x_members_p'];
+
+ $ranks[] = array(
+ 'CBNAME' => 'r_' . str_replace(' ', '_', trim($row['rank_name'])),
+ 'CBVALUE' => intval($row['rank_id']),
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => $user->lang['rank'] . ': ' . (( empty($row['rank_name']) ) ? '(None)' : $row['rank_prefix'] . $row['rank_name'] . $row['rank_suffix'])
+ . ' <span class="small">(' . sprintf($format, $rank_count) . ')</span>');
+ }
+ }
+ $db->free_result($result);
+
+ foreach ( $ranks as $row )
+ {
+ $tpl->assign_block_vars('ranks_row', $row);
+ }
+
+ $tpl->assign_vars(array(
+ 'F_PARSE_LOG' => 'parse_Vanguard-SoH.php' . $SID,
+
+ 'S_STEP1' => true,
+ 'L_PASTE_LOG' => $user->lang['paste_log'],
+ 'L_OPTIONS' => $user->lang['options'],
+ 'L_PARSE_LOG' => $user->lang['parse_log'],
+ 'L_CLOSE_WINDOW' => $user->lang['close_window'],
+
+ 'LOG_COLS' => $log_columns)
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['parselog_title'],
+ 'gen_simple_header' => true,
+ 'template_file' => 'admin/parse_Vanguard-SoH.html',
+ 'display' => true)
+ );
+ }
+}
+
+$parse_log = new Parse_Log;
+$parse_log->process();
+?>
diff --git a/admin/parse_WoW.php b/admin/parse_WoW.php
new file mode 100644
index 0000000..52b2637
--- /dev/null
+++ b/admin/parse_WoW.php
@@ -0,0 +1,484 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * parse_WoW.php
+ * Began: Sat March 05 2005
+ *
+ * $Id: parse_WoW.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class Parse_Log extends EQdkp_Admin
+{
+ function parse_log()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ $this->assoc_buttons(array(
+ 'parse' => array(
+ 'name' => 'parse',
+ 'process' => 'process_parse',
+ 'check' => 'a_raid_'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_raid_'))
+ );
+ }
+
+ // ---------------------------------------------------------
+ // Process Parse
+ // ---------------------------------------------------------
+ function process_parse()
+ {
+
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $channel_members = '';
+ $line = '';
+ $valid_date_found = false;
+
+ $log_file = explode("\n", $_POST['log']);
+ $log_file = str_replace('&lt;', '<', str_replace('&gt;', '>', $log_file));
+ $line_count = sizeof($log_file);
+
+ // Go through each line and
+ // - Check for/get a valid member in the /who
+ // - Check if there's a valid date we can use
+ // - Check for/get valid members from /list <channel>
+ $log_date = array();
+ session_start(); // Hold our array of name => class/level/race
+ for ( $i = 0; $i < $line_count; $i++ )
+ {
+ $line = '';
+ if ( (isset($_POST['findall'])) || (strpos($log_file[$i], '<')) )
+ {
+ $member_name = $this->line_parse($log_file[$i]);
+
+ // Make sure that each member's name is properly capitalized
+ $mname = strtolower(preg_replace('/[[:space:]]/i', ' ', $member_name));
+ $member_name = ucwords($mname);
+
+ if ( trim($member_name) != '')
+ {
+ $member_names[] = $member_name;
+ }
+ }
+
+ // Check if there's a usable date/time in this string
+ if ( preg_match("/([a-zA-Z]{3}) ([a-zA-Z]{3}) ([0-9]{2}) ([0-9]{2})\:([0-9]{2})\:([0-9]{2}) ([0-9]{4})/", $log_file[$i], $pre_log_date) )
+ {
+ if ( isset($pre_log_date[0]) )
+ {
+ $log_date = $pre_log_date;
+ }
+ $valid_date_found = true;
+ }
+
+ // Check if the log contains channel information we can use
+ if (preg_match("/Channel (.+)\(([0-9]{1,5})\) members\:/", $log_file[$i], $num_members))
+ {
+ $first_chan_line = ($i+1);
+ $channel_lines = (($num_members[2] % 10) == 0) ? $num_members[2] / 10 : floor($num_members[2] / 10) + 1;
+ $last_chan_line = ($i + $channel_lines + 1);
+ for ( $j = $first_chan_line; $j < $last_chan_line; $j++ )
+ {
+ $line = preg_replace("/\[[A-Za-z]{3} [A-Za-z]{3} [0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2} [0-9]{4}\]/", '', $log_file[$j]);
+ $line = preg_replace("/[^A-Za-z\,[:space:]]/", '', $line);
+ if ($j != $channel_lines)
+ {
+ $line = str_replace("\n", ', ', $line);
+ }
+ $channel_members .= $line;
+ }
+ }
+
+ if (isset ($log_file[$i]) ) {
+ $line_to_read = str_replace("\t", ' ', $log_file[$i]);
+ }
+ if (preg_match("/^[0-9]{1,2} (.+) ([0-9]{1,2}) ([a-z A-Z]+)/", $line_to_read, $raid_line))
+ {
+ // Current log tool doesn't get race information - so set it to Unknown.
+ $memberRace = "Unknown";
+ $memberName = $raid_line[1];
+ $memberLevel = $raid_line[2];
+ $memberClass = ( isset($raid_line[3]) ) ? trim(preg_replace('/Officer/', '', preg_replace('/Raid Leader/', '', $raid_line[3]))) : '';
+
+ //print"NAME $raid_line[1] ";
+ //print"LEVEL $raid_line[2] ";
+ //print"CLASS $raid_line[3]<br>";
+
+ $_SESSION[$memberName] = array(
+ 'name' => $memberName,
+ 'level' => $memberLevel,
+ 'race' => $memberRace,
+ 'class' => $memberClass,
+ );
+
+ // add member's name to the array
+ $member_names[] = $memberName;
+ }
+
+
+ } // for ... log_file
+
+
+ // If there were channel members, join the two arrays
+ if ( !empty($channel_members) )
+ {
+ $channel_members = explode(', ', $channel_members);
+ $member_names = array_merge($member_names, $channel_members);
+ }
+
+ if ( $valid_date_found )
+ {
+ $date['mo'] = $log_date[2];
+ $date['d'] = $log_date[3];
+ $date['y'] = $log_date[7];
+ $date['h'] = $log_date[4];
+ $date['mi'] = $log_date[5];
+ $date['s'] = $log_date[6];
+ }
+ else
+ {
+ $date['mo'] = date('M');
+ $date['d'] = date('d');
+ $date['y'] = date('Y');
+ $date['h'] = date('h');
+ $date['mi'] = date('i');
+ $date['s'] = date('s');
+ }
+
+ // Process the member_names array: replaces spaces, make it unique, sort it and reset it
+ if ( (isset($member_names)) && (is_array($member_names)) )
+ {
+ $name_count = sizeof($member_names);
+ }
+ else
+ {
+ $name_count = 0;
+ $member_names = array();
+ }
+
+ for ( $i = 0; $i < $name_count; $i++ )
+ {
+ $member_names[$i] = str_replace(' ', '', $member_names[$i]);
+ }
+ $member_names = array_unique($member_names);
+ sort($member_names);
+ reset($member_names);
+
+ $tpl->assign_vars(array(
+ 'S_STEP1' => false,
+ 'L_FOUND_MEMBERS' => sprintf($user->lang['found_members'], $line_count, sizeof($member_names)),
+ 'L_LOG_DATE_TIME' => $user->lang['log_date_time'],
+ 'L_LOG_ADD_DATA' => $user->lang['log_add_data'],
+
+ 'FOUND_MEMBERS' => implode("\n", $member_names),
+ 'MO' => $this->M_to_n($date['mo']),
+ 'D' => $date['d'],
+ 'Y' => $date['y'],
+ 'H' => $date['h'],
+ 'MI' => $date['mi'],
+ 'S' => $date['s'])
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['parselog_title'],
+ 'gen_simple_header' => true,
+ 'template_file' => 'admin/parse_WoW.html',
+ 'display' => true)
+ );
+ }
+
+ // ---------------------------------------------------------
+ // Process helper methods
+ // ---------------------------------------------------------
+ function line_parse($log_line)
+ {
+ global $db, $eqdkp, $user;
+ static $member_ranks = array();
+
+ $log_line = stripslashes($log_line);
+
+ // Build a clean array of guildtags we might be looking for
+ $parsetags = explode("\n", $eqdkp->config['parsetags']);
+ foreach ( $parsetags as $k => $v )
+ {
+ $parsetags[$k] = trim(stripslashes($v));
+ }
+
+ // Cache the member name / member rank info
+ if ( @sizeof($member_ranks) == 0 )
+ {
+ $sql = 'SELECT r.rank_name, m.member_name
+ FROM ' . MEMBER_RANKS_TABLE . ' r, ' . MEMBERS_TABLE . ' m
+ WHERE (r.rank_id = m.member_rank_id)
+ ORDER BY m.member_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $member_ranks[ $row['member_name'] ] = 'r_' . str_replace(' ', '_', trim($row['rank_name']));
+ }
+ $db->free_result($result);
+ }
+
+ $name_check = false;
+ $role_check = true;
+ $rank_check = true;
+
+ // Date
+ $pattern = "/\[[a-zA-Z]{3} [a-zA-Z]{3} [0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2} [0-9]{4}\]";
+ // AFK
+ $pattern .= ".*(AFK )?";
+ // Level / Class (if findall or findrole is set, we can check for ANONYMOUS people, too)
+ // $pattern .= ( (isset($_POST['findall'])) || (isset($_POST['findrole'])) ) ? "\[(ANONYMOUS|([0-9]{1,2})(.+))\]" : "\[([0-9]{1,2})(.+)\]";
+ $pattern .= ( (isset($_POST['findall'])) || (isset($_POST['findrole'])) ) ? "\[(ANONYMOUS|([0-9]{1,2})(.+) (.+))\]" : "\[([0-9]{1,2})(.+) (.+)\]";
+ // Name
+ $pattern .= " ([A-Za-z]{1,})";
+ // Race
+ $pattern .= "( \(.*\))?";
+ // Guild (ignored if we're finding EVERYONE in the log, regardless of tag)
+ if ( !isset($_POST['findall']) )
+ {
+ $guildtag_sep = '';
+ $pattern .= ".*\<(";
+ foreach ( $parsetags as $guildtag )
+ {
+ if ( isset($_POST[str_replace(' ', '_', $guildtag)]) )
+ {
+ $pattern .= $guildtag_sep . $guildtag;
+ $guildtag_sep = '|';
+ }
+ }
+ $pattern .= ")\>";
+ }
+ $pattern .= '/';
+
+ if ( preg_match($pattern, $log_line, $log_parsed) )
+ {
+ // 0 = full string
+ // 1 = AFK?
+ // 2 = ANONYMOUS | 'XX Class (archtype)'
+ // 3 = Level
+ // 4 = Class
+ // 5 = (Archtype)
+ // 6 = Name
+ // 7 = (Race)
+
+ $name = trim($log_parsed[6]);
+ $level = trim($log_parsed[3]);
+ $class = trim($log_parsed[4]);
+ $race = ( isset($log_parsed[7]) ) ? trim(str_replace(')', '', str_replace('(', '', $log_parsed[7]))) : '';
+ $archtype = ( isset($log_parsed[5]) ) ? trim(str_replace(')', '', str_replace('(', '', $log_parsed[5]))) : '';
+
+ /* Oops - left inthe debug code :-) */
+ //print "Ful String: $log_parsed[0]\n<br>";
+ //print "Level: $level\n<br>";
+ //print "Class: $class\n<br>";
+ //print "Archtype: $archtype\n<br>";
+ //print "Name: $name\n<br>";
+ //print "Race: $race\n<br>";
+
+
+ if ( !isset($_POST['findrole']) )
+ {
+ if ( (isset($log_parsed[2])) && ($log_parsed[2] == 'ANONYMOUS') )
+ {
+ $role_check = false;
+ }
+ }
+
+ if ( (isset($log_parsed[6])) && ($log_parsed[6] != '') )
+ {
+ $name_check = true;
+ }
+
+ // Check if we're including this member's rank
+ if ( isset($member_ranks[$name]) )
+ {
+ // If POST[r_<rank_name>] isn't set, we're ignoring this member
+ if ( !isset($_POST[ $member_ranks[$name] ]) )
+ {
+ $rank_check = false;
+ }
+ }
+
+ if ( ($name_check) && ($role_check) && ($rank_check) )
+ {
+ $_SESSION[$name] = array(
+ 'name' => $name,
+ 'level' => $level,
+ 'class' => $class,
+ 'race' => $race);
+
+ return $log_parsed[6];
+ }
+ }
+ return false;
+ }
+
+ function M_to_n($m)
+ {
+ switch($m)
+ {
+ case 'Jan':
+ return '01';
+ break;
+ case 'Feb':
+ return '02';
+ break;
+ case 'Mar':
+ return '03';
+ break;
+ case 'Apr':
+ return '04';
+ break;
+ case 'May':
+ return '05';
+ break;
+ case 'Jun':
+ return '06';
+ break;
+ case 'Jul':
+ return '07';
+ break;
+ case 'Aug':
+ return '08';
+ break;
+ case 'Sep':
+ return '09';
+ break;
+ case 'Oct':
+ return '10';
+ break;
+ case 'Nov':
+ return '11';
+ break;
+ case 'Dec':
+ return '12';
+ break;
+ }
+ }
+
+ // ---------------------------------------------------------
+ // Display form
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $log_columns = ( preg_match("/Mozilla\/4\.[1-9]{1}.+/", $_SERVER['HTTP_USER_AGENT']) ) ? '50' : '90';
+
+ // Options to parse
+ $options = array(
+ 0 => array(
+ 'CBNAME' => 'findall',
+ 'CBVALUE' => '1',
+ 'CBCHECKED' => '',
+ 'OPTION' => $user->lang['log_find_all']),
+ 1 => array(
+ 'CBNAME' => 'findrole',
+ 'CBVALUE' => '1',
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => 'Include Roleplay')
+ );
+
+ // Guildtags to parse
+ if ( !empty($eqdkp->config['parsetags']) )
+ {
+ $parsetags = explode("\n", $eqdkp->config['parsetags']);
+ foreach ( $parsetags as $index => $guildtag )
+ {
+ $tagoptions[] = array(
+ 'CBNAME' => str_replace(' ', '_', trim($guildtag)),
+ 'CBVALUE' => '1',
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => '&lt;' . trim($guildtag) . '&gt;');
+ }
+ $options = array_merge($options, $tagoptions);
+ }
+
+ foreach ( $options as $row )
+ {
+ $tpl->assign_block_vars('options_row', $row);
+ }
+
+ // Member tags to parse
+ // Find out how many members have each rank
+ $rank_counts = array();
+ $sql = 'SELECT member_rank_id, count(member_rank_id) as count
+ FROM ' . MEMBERS_TABLE . '
+ GROUP BY member_rank_id';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $rank_counts[ $row['member_rank_id'] ] = $row['count'];
+ }
+ $db->free_result($result);
+
+ $ranks = array();
+ $sql = 'SELECT rank_id, rank_name, rank_prefix, rank_suffix
+ FROM ' . MEMBER_RANKS_TABLE . '
+ ORDER BY rank_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ // Make sure there's not a guildtag with the same name as the rank
+ if ( !in_array($row['rank_name'], $options) )
+ {
+ $rank_count = ( isset($rank_counts[ $row['rank_id'] ]) ) ? $rank_counts[ $row['rank_id'] ] : 0;
+ $format = ( $rank_count == 1 ) ? $user->lang['x_members_s'] : $user->lang['x_members_p'];
+
+ $ranks[] = array(
+ 'CBNAME' => 'r_' . str_replace(' ', '_', trim($row['rank_name'])),
+ 'CBVALUE' => intval($row['rank_id']),
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => $user->lang['rank'] . ': ' . (( empty($row['rank_name']) ) ? '(None)' : $row['rank_prefix'] . $row['rank_name'] . $row['rank_suffix'])
+ . ' <span class="small">(' . sprintf($format, $rank_count) . ')</span>');
+ }
+ }
+ $db->free_result($result);
+
+ foreach ( $ranks as $row )
+ {
+ $tpl->assign_block_vars('ranks_row', $row);
+ }
+
+ $tpl->assign_vars(array(
+ 'F_PARSE_LOG' => 'parse_WoW.php' . $SID,
+
+ 'S_STEP1' => true,
+ 'L_PASTE_LOG' => $user->lang['paste_log'],
+ 'L_OPTIONS' => $user->lang['options'],
+ 'L_PARSE_LOG' => $user->lang['parse_log'],
+ 'L_CLOSE_WINDOW' => $user->lang['close_window'],
+
+ 'LOG_COLS' => $log_columns)
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['parselog_title'],
+ 'gen_simple_header' => true,
+ 'template_file' => 'admin/parse_WoW.html',
+ 'display' => true)
+ );
+ }
+}
+
+$parse_log = new Parse_Log;
+$parse_log->process();
+?>
diff --git a/admin/parse_log.php b/admin/parse_log.php
new file mode 100644
index 0000000..897122f
--- /dev/null
+++ b/admin/parse_log.php
@@ -0,0 +1,467 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * parse_log.php
+ * Began: Tue December 24 2002
+ *
+ * $Id: parse_log.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class Parse_Log extends EQdkp_Admin
+{
+ function parse_log()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ $this->assoc_buttons(array(
+ 'parse' => array(
+ 'name' => 'parse',
+ 'process' => 'process_parse',
+ 'check' => 'a_raid_'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_form',
+ 'check' => 'a_raid_'))
+ );
+ }
+
+ // ---------------------------------------------------------
+ // Process Parse
+ // ---------------------------------------------------------
+ function process_parse()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $channel_members = '';
+ $line = '';
+ $valid_date_found = false;
+
+ $log_file = explode("\n", $_POST['log']);
+ $log_file = str_replace('&lt;', '<', str_replace('&gt;', '>', $log_file));
+ $line_count = sizeof($log_file);
+
+ // Go through each line and
+ // - Check for/get a valid member in the /who
+ // - Check if there's a valid date we can use
+ // - Check for/get valid members from /list <channel>
+ $log_date = array();
+ session_start(); // Hold our array of name => class/level/race
+ for ( $i = 0; $i < $line_count; $i++ )
+ {
+ $line = '';
+ if ( (isset($_POST['findall'])) || (strpos($log_file[$i], '<')) )
+ {
+ $member_name = $this->line_parse($log_file[$i]);
+ if ( trim($member_name) != '')
+ {
+ $member_names[] = $member_name;
+ }
+ }
+
+ // Check if there's a usable date/time in this string
+ if ( preg_match("/([a-zA-Z]{3}) ([a-zA-Z]{3}) ([0-9]{2}) ([0-9]{2})\:([0-9]{2})\:([0-9]{2}) ([0-9]{4})/", $log_file[$i], $pre_log_date) )
+ {
+ if ( isset($pre_log_date[0]) )
+ {
+ $log_date = $pre_log_date;
+ }
+ $valid_date_found = true;
+ }
+
+ // Check if the log contains channel information we can use
+ if (preg_match("/Channel (.+)\(([0-9]{1,5})\) members\:/", $log_file[$i], $num_members))
+ {
+ $first_chan_line = ($i+1);
+ $channel_lines = (($num_members[2] % 10) == 0) ? $num_members[2] / 10 : floor($num_members[2] / 10) + 1;
+ $last_chan_line = ($i + $channel_lines + 1);
+ for ( $j = $first_chan_line; $j < $last_chan_line; $j++ )
+ {
+ $line = preg_replace("/\[[A-Za-z]{3} [A-Za-z]{3} [0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2} [0-9]{4}\]/", '', $log_file[$j]);
+ $line = preg_replace("/[^A-Za-z\,[:space:]]/", '', $line);
+ if ($j != $channel_lines)
+ {
+ $line = str_replace("\n", ', ', $line);
+ }
+ $channel_members .= $line;
+ }
+ }
+ } // for ... log_file
+
+ // If there were channel members, join the two arrays
+ if ( !empty($channel_members) )
+ {
+ $channel_members = explode(', ', $channel_members);
+ $member_names = array_merge($member_names, $channel_members);
+ }
+
+ if ( $valid_date_found )
+ {
+ $date['mo'] = $log_date[2];
+ $date['d'] = $log_date[3];
+ $date['y'] = $log_date[7];
+ $date['h'] = $log_date[4];
+ $date['mi'] = $log_date[5];
+ $date['s'] = $log_date[6];
+ }
+ else
+ {
+ $date['mo'] = date('M');
+ $date['d'] = date('d');
+ $date['y'] = date('Y');
+ $date['h'] = date('h');
+ $date['mi'] = date('i');
+ $date['s'] = date('s');
+ }
+
+ // Process the member_names array: replaces spaces, make it unique, sort it and reset it
+ if ( (isset($member_names)) && (is_array($member_names)) )
+ {
+ $name_count = sizeof($member_names);
+ }
+ else
+ {
+ $name_count = 0;
+ $member_names = array();
+ }
+
+ for ( $i = 0; $i < $name_count; $i++ )
+ {
+ $member_names[$i] = str_replace(' ', '', $member_names[$i]);
+ }
+ $member_names = array_unique($member_names);
+ sort($member_names);
+ reset($member_names);
+
+ $tpl->assign_vars(array(
+ 'S_STEP1' => false,
+ 'L_FOUND_MEMBERS' => sprintf($user->lang['found_members'], $line_count, sizeof($member_names)),
+ 'L_LOG_DATE_TIME' => $user->lang['log_date_time'],
+ 'L_LOG_ADD_DATA' => $user->lang['log_add_data'],
+
+ 'FOUND_MEMBERS' => implode("\n", $member_names),
+ 'MO' => $this->M_to_n($date['mo']),
+ 'D' => $date['d'],
+ 'Y' => $date['y'],
+ 'H' => $date['h'],
+ 'MI' => $date['mi'],
+ 'S' => $date['s'])
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['parselog_title'],
+ 'gen_simple_header' => true,
+ 'template_file' => 'admin/parse_log.html',
+ 'display' => true)
+ );
+ }
+
+ // ---------------------------------------------------------
+ // Process helper methods
+ // ---------------------------------------------------------
+ function line_parse($log_line)
+ {
+ global $db, $eqdkp, $user;
+ static $member_ranks = array();
+
+ // Build a clean array of guildtags we might be looking for
+ $parsetags = explode("\n", $eqdkp->config['parsetags']);
+ foreach ( $parsetags as $k => $v )
+ {
+ $parsetags[$k] = trim($v);
+ }
+
+ // Cache the member name / member rank info
+ if ( @sizeof($member_ranks) == 0 )
+ {
+ $sql = 'SELECT r.rank_name, m.member_name
+ FROM ' . MEMBER_RANKS_TABLE . ' r, ' . MEMBERS_TABLE . ' m
+ WHERE (r.rank_id = m.member_rank_id)
+ ORDER BY m.member_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $member_ranks[ $row['member_name'] ] = 'r_' . str_replace(' ', '_', trim($row['rank_name']));
+ }
+ $db->free_result($result);
+ }
+
+ $name_check = false;
+ $role_check = true;
+ $rank_check = true;
+
+ // Date
+ $pattern = "/\[[a-zA-Z]{3} [a-zA-Z]{3} [0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2} [0-9]{4}\]";
+ // AFK
+ $pattern .= ".*(AFK )?";
+ // Level / Class (if findall or findrole is set, we can check for ANONYMOUS people, too)
+ $pattern .= ( (isset($_POST['findall'])) || (isset($_POST['findrole'])) ) ? "\[(ANONYMOUS|([0-9]{1,2})(.+))\]" : "\[([0-9]{1,2})(.+)\]";
+ // Name
+ $pattern .= " ([A-Za-z]{1,})";
+ // Race
+ $pattern .= "( \(.*\))?";
+ // Guild (ignored if we're finding EVERYONE in the log, regardless of tag)
+ if ( !isset($_POST['findall']) )
+ {
+ $guildtag_sep = '';
+ $pattern .= ".*\<(";
+ foreach ( $parsetags as $guildtag )
+ {
+ if ( isset($_POST[str_replace(' ', '_', $guildtag)]) )
+ {
+ $pattern .= $guildtag_sep . $guildtag;
+ $guildtag_sep = '|';
+ }
+ }
+ $eqdkp->config['guildtag'].
+ $pattern .= ")\>";
+ }
+ $pattern .= '/';
+
+ if ( preg_match($pattern, $log_line, $log_parsed) )
+ {
+ // 0 = date
+ // 1 = AFK?
+ // 2 = ANONYMOUS | 'XX Class'
+ // 3 = Level
+ // 4 = Class
+ // 5 = Name
+ // 6 = (Race)
+
+ $name = trim($log_parsed[5]);
+ $level = trim($log_parsed[3]);
+ $class = trim($log_parsed[4]);
+ $race = ( isset($log_parsed[6]) ) ? trim(str_replace(')', '', str_replace('(', '', $log_parsed[6]))) : '';
+
+ if ( !isset($_POST['findrole']) )
+ {
+ if ( (isset($log_parsed[2])) && ($log_parsed[2] == 'ANONYMOUS') )
+ {
+ $role_check = false;
+ }
+ }
+
+ if ( (isset($log_parsed[5])) && ($log_parsed[5] != '') )
+ {
+ $name_check = true;
+ }
+
+ // Check if we're including this member's rank
+ if ( isset($member_ranks[$name]) )
+ {
+ // If POST[r_<rank_name>] isn't set, we're ignoring this member
+ if ( !isset($_POST[ $member_ranks[$name] ]) )
+ {
+ $rank_check = false;
+ }
+ }
+
+ if ( ($name_check) && ($role_check) && ($rank_check) )
+ {
+ $_SESSION[$name] = array(
+ 'name' => $name,
+ 'level' => $level,
+ 'class' => $this->original_class($class),
+ 'race' => $race);
+
+ return $log_parsed[5];
+ }
+ }
+ return false;
+ }
+
+ function M_to_n($m)
+ {
+ switch($m)
+ {
+ case 'Jan':
+ return '01';
+ break;
+ case 'Feb':
+ return '02';
+ break;
+ case 'Mar':
+ return '03';
+ break;
+ case 'Apr':
+ return '04';
+ break;
+ case 'May':
+ return '05';
+ break;
+ case 'Jun':
+ return '06';
+ break;
+ case 'Jul':
+ return '07';
+ break;
+ case 'Aug':
+ return '08';
+ break;
+ case 'Sep':
+ return '09';
+ break;
+ case 'Oct':
+ return '10';
+ break;
+ case 'Nov':
+ return '11';
+ break;
+ case 'Dec':
+ return '12';
+ break;
+ }
+ }
+
+ function original_class($class)
+ {
+ $classes = array(
+ 'Bard' => array('Bard','Minstrel','Troubadour','Virtuoso','Maestro'),
+ 'Beastlord' => array('Beastlord','Primalist','Animist','Savage Lord','Feral Lord'),
+ 'Cleric' => array('Cleric','Vicar','Templar','High Priest','Archon'),
+ 'Druid' => array('Druid','Wanderer','Preserver','Hierophant','Storm Warden'),
+ 'Enchanter' => array('Enchanter','Illusionist','Beguiler','Phantasmist','Coercer'),
+ 'Magician' => array('Magician','Elementalist','Conjurer','Arch Mage','Arch Convoker'),
+ 'Monk' => array('Monk','Disciple','Master','Grandmaster','Transcendent'),
+ 'Necromancer' => array('Necromancer','Heretic','Defiler','Warlock','Arch Lich'),
+ 'Paladin' => array('Paladin','Cavalier','Knight','Crusader','Lord Protector'),
+ 'Ranger' => array('Ranger','Pathfinder','Outrider','Warder','Hunter','Forest Stalker'),
+ 'Rogue' => array('Rogue','Rake','Blackguard','Assassin','Deceiver'),
+ 'Shadow Knight' => array('Shadow Knight','Reaver','Revenant','Grave Lord','Dread Lord'),
+ 'Shaman' => array('Shaman','Mystic','Luminary','Oracle','Prophet'),
+ 'Warrior' => array('Warrior','Champion','Myrmidon','Warlord','Overlord'),
+ 'Wizard' => array('Wizard','Channeler','Evoker','Sorcerer','Arcanist')
+ );
+
+ foreach ( $classes as $k => $v)
+ {
+ if ( in_array($class, $v) )
+ {
+ return $k;
+ }
+ }
+
+ return false;
+ }
+
+ // ---------------------------------------------------------
+ // Display form
+ // ---------------------------------------------------------
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $log_columns = ( preg_match("/Mozilla\/4\.[1-9]{1}.+/", $_SERVER['HTTP_USER_AGENT']) ) ? '50' : '90';
+
+ // Options to parse
+ $options = array(
+ 0 => array(
+ 'CBNAME' => 'findall',
+ 'CBVALUE' => '1',
+ 'CBCHECKED' => '',
+ 'OPTION' => $user->lang['log_find_all']),
+ 1 => array(
+ 'CBNAME' => 'findrole',
+ 'CBVALUE' => '1',
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => 'Include Roleplay')
+ );
+
+ // Guildtags to parse
+ if ( !empty($eqdkp->config['parsetags']) )
+ {
+ $parsetags = explode("\n", $eqdkp->config['parsetags']);
+ foreach ( $parsetags as $index => $guildtag )
+ {
+ $tagoptions[] = array(
+ 'CBNAME' => str_replace(' ', '_', trim($guildtag)),
+ 'CBVALUE' => '1',
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => '&lt;' . trim($guildtag) . '&gt;');
+ }
+ $options = array_merge($options, $tagoptions);
+ }
+
+ foreach ( $options as $row )
+ {
+ $tpl->assign_block_vars('options_row', $row);
+ }
+
+ // Member tags to parse
+ // Find out how many members have each rank
+ $rank_counts = array();
+ $sql = 'SELECT member_rank_id, count(member_rank_id) as count
+ FROM ' . MEMBERS_TABLE . '
+ GROUP BY member_rank_id';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $rank_counts[ $row['member_rank_id'] ] = $row['count'];
+ }
+ $db->free_result($result);
+
+ $ranks = array();
+ $sql = 'SELECT rank_id, rank_name, rank_prefix, rank_suffix
+ FROM ' . MEMBER_RANKS_TABLE . '
+ ORDER BY rank_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ // Make sure there's not a guildtag with the same name as the rank
+ if ( !in_array($row['rank_name'], $options) )
+ {
+ $rank_count = ( isset($rank_counts[ $row['rank_id'] ]) ) ? $rank_counts[ $row['rank_id'] ] : 0;
+ $format = ( $rank_count == 1 ) ? $user->lang['x_members_s'] : $user->lang['x_members_p'];
+
+ $ranks[] = array(
+ 'CBNAME' => 'r_' . str_replace(' ', '_', trim($row['rank_name'])),
+ 'CBVALUE' => intval($row['rank_id']),
+ 'CBCHECKED' => ' checked="checked"',
+ 'OPTION' => $user->lang['rank'] . ': ' . (( empty($row['rank_name']) ) ? '(None)' : $row['rank_prefix'] . $row['rank_name'] . $row['rank_suffix'])
+ . ' <span class="small">(' . sprintf($format, $rank_count) . ')</span>');
+ }
+ }
+ $db->free_result($result);
+
+ foreach ( $ranks as $row )
+ {
+ $tpl->assign_block_vars('ranks_row', $row);
+ }
+
+ $tpl->assign_vars(array(
+ 'F_PARSE_LOG' => 'parse_log.php' . $SID,
+
+ 'S_STEP1' => true,
+ 'L_PASTE_LOG' => $user->lang['paste_log'],
+ 'L_OPTIONS' => $user->lang['options'],
+ 'L_PARSE_LOG' => $user->lang['parse_log'],
+ 'L_CLOSE_WINDOW' => $user->lang['close_window'],
+
+ 'LOG_COLS' => $log_columns)
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['parselog_title'],
+ 'gen_simple_header' => true,
+ 'template_file' => 'admin/parse_log.html',
+ 'display' => true)
+ );
+ }
+}
+
+$parse_log = new Parse_Log;
+$parse_log->process();
+?> \ No newline at end of file
diff --git a/admin/plugins.php b/admin/plugins.php
new file mode 100644
index 0000000..81b4df8
--- /dev/null
+++ b/admin/plugins.php
@@ -0,0 +1,103 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * plugins.php
+ * Began: Mon January 13 2003
+ *
+ * $Id: plugins.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+$user->check_auth('a_plugins_man');
+
+$mode = ( isset($_GET['mode']) ) ? $_GET['mode'] : 'list';
+$code = ( isset($_GET['code']) ) ? $_GET['code'] : '';
+
+if ( (!empty($code)) && (!is_dir($eqdkp_root_path . 'plugins/' . $code)) )
+{
+ message_die($user->lang['error_invalid_plugin']);
+}
+
+switch ( $mode )
+{
+ case 'install':
+ $pm->install($code);
+ $pm->do_hooks('/admin/plugins.php?mode=install');
+
+ $plugin_object = $pm->get_plugin($code);
+ $plugin_object->message(SQL_INSTALL);
+
+ break;
+ case 'uninstall':
+ $pm->uninstall($code);
+ $pm->do_hooks('/admin/plugins.php?mode=uninstall');
+
+ $plugin_object = $pm->get_plugin($code);
+ $plugin_object->message(SQL_UNINSTALL);
+
+ break;
+ case 'list':
+ // Register any new plugins before we list the available ones
+ $pm->register();
+
+ $unset_array = array();
+ $plugins_array = $pm->get_plugins(PLUGIN_ALL);
+ foreach ( $plugins_array as $plugin_code => $plugin_object )
+ {
+ $installed = $pm->check(PLUGIN_INSTALLED, $plugin_code);
+
+ // Initialize the object if we need to
+ if ( !$pm->check(PLUGIN_INITIALIZED, $plugin_code) )
+ {
+ if ( $pm->initialize($plugin_code) )
+ {
+ $unset_array[] = $plugin_code;
+ }
+ }
+
+ $contact = $pm->get_data($plugin_code, 'contact');
+ $version = $pm->get_data($plugin_code, 'version');
+
+ $tpl->assign_block_vars('plugins_row', array(
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'NAME' => $pm->get_data($plugin_code, 'name'),
+ 'CODE' => $plugin_code,
+ 'VERSION' => ( !empty($version) ) ? $version : '&nbsp;',
+ 'U_ACTION' => 'plugins.php' . $SID . '&amp;mode=' . (( $installed ) ? 'uninstall' : 'install') . '&amp;code=' . $plugin_code,
+ 'ACTION' => ( $installed ) ? $user->lang['uninstall'] : $user->lang['install'],
+ 'CONTACT' => ( !is_null($contact) ) ? '<a href="mailto:' . $contact . '">' . $contact . '</a>' : '&nbsp;')
+ );
+ unset($contact, $installed, $version);
+ }
+
+ // Return uninitialized objects to their previous state
+ foreach ( $unset_array as $plugin_code )
+ {
+ unset($pm->plugins[$plugin_code]);
+ }
+
+ $tpl->assign_vars(array(
+ 'L_NAME' => $user->lang['name'],
+ 'L_CODE' => $user->lang['code'],
+ 'L_VERSION' => $user->lang['version'],
+ 'L_ACTION' => $user->lang['action'],
+ 'L_CONTACT' => $user->lang['contact'])
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['plugins_title'],
+ 'template_file' => 'admin/plugins.html',
+ 'display' => true)
+ );
+
+ break;
+}
+?> \ No newline at end of file
diff --git a/admin/soap/addraid.php b/admin/soap/addraid.php
new file mode 100644
index 0000000..85786b4
--- /dev/null
+++ b/admin/soap/addraid.php
@@ -0,0 +1,39 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2005
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * addraid.php
+ * begin: Tue April 19 2005
+ *
+ * $Id: addraid.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+$eqdkp_root_path = './../../';
+include_once($eqdkp_root_path . 'common.php');
+
+if (isset($_GET['raid']) ) {
+
+$event_name = $_GET['raid'];
+
+} else {
+die("Event name not defined<br>");
+}
+
+// Create the client instance
+$client = new soapclient( $ns . 'admin/soap/dkpsoap.php');
+
+// Call the SOAP method
+$output = $client->call('AddRaid', array('user' => $soap_user, 'password' => $soap_password, 'event_name' => $event_name));
+
+// Display the result
+print_r($output);
+
+echo '<h2>Request</h2>';
+echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
+echo '<h2>Response</h2>';
+echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
+?>
diff --git a/admin/soap/addraidattendee.php b/admin/soap/addraidattendee.php
new file mode 100644
index 0000000..f22fade
--- /dev/null
+++ b/admin/soap/addraidattendee.php
@@ -0,0 +1,52 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2005
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * addraidattendee.php
+ * begin: Tue April 19 2005
+ *
+ * $Id: addraidattendee.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+$eqdkp_root_path = './../../';
+include_once($eqdkp_root_path . 'common.php');
+
+if (isset($_GET['member']) ) {
+
+ $member_name = $_GET['member'];
+
+} else {
+
+ die("member not defined<br>");
+
+}
+
+if (isset($_GET['raid_id']) ) {
+
+ $raid_id = $_GET['raid_id'];
+
+} else {
+
+ die("raid_id not defined<br>");
+
+}
+
+
+// Create the client instance
+$client = new soapclient( $ns . 'admin/soap/dkpsoap.php');
+
+// Call the SOAP method
+$output = $client->call('AddRaidAttendee', array('user' => $soap_user, 'password' => $soap_password, 'raid_id' => $raid_id, 'member' => $member_name));
+
+// Display the result
+print_r($output);
+
+echo '<h2>Request</h2>';
+echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
+echo '<h2>Response</h2>';
+echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
+?>
diff --git a/admin/soap/delraidattendee.php b/admin/soap/delraidattendee.php
new file mode 100644
index 0000000..41ab92b
--- /dev/null
+++ b/admin/soap/delraidattendee.php
@@ -0,0 +1,52 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2005
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * delraidattendee.php
+ * begin: Tue April 19 2005
+ *
+ * $Id: delraidattendee.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+$eqdkp_root_path = './../../';
+include_once($eqdkp_root_path . 'common.php');
+
+if (isset($_GET['member']) ) {
+
+ $member_name = $_GET['member'];
+
+} else {
+
+ die("member not defined<br>");
+
+}
+
+if (isset($_GET['raid_id']) ) {
+
+ $raid_id = $_GET['raid_id'];
+
+} else {
+
+ die("raid_id not defined<br>");
+
+}
+
+
+// Create the client instance
+$client = new soapclient( $ns . 'admin/soap/dkpsoap.php');
+
+// Call the SOAP method
+$output = $client->call('DelRaidAttendee', array('user' => $soap_user, 'password' => $soap_password, 'raid_id' => $raid_id, 'member' => $member_name));
+
+// Display the result
+print_r($output);
+
+echo '<h2>Request</h2>';
+echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
+echo '<h2>Response</h2>';
+echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
+?>
diff --git a/admin/soap/dkpsoap.php b/admin/soap/dkpsoap.php
new file mode 100644
index 0000000..a142497
--- /dev/null
+++ b/admin/soap/dkpsoap.php
@@ -0,0 +1,665 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2005
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * dkpsoap.php
+ * begin: Tue April 19 2005
+ *
+ * $Id: dkpsoap.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+$eqdkp_root_path = './../../';
+include_once($eqdkp_root_path . 'common.php');
+
+//$debug = 1;
+
+$server = new soap_server();
+$server->configureWSDL('DKPService',$ns);
+$server->wsdl->schemaTargetNamespace=$ns;
+
+$server->register('GetMemberRP',
+ array('user' => 'xsd:string', 'password' => 'xsd:string', 'member' => 'xds:string'),
+ array('rp' => 'xsd:string'),
+ $ns);
+
+$server->register('FindEvent',
+ array('user' => 'xsd:string', 'password' => 'xsd:string', 'name_regexp' => 'xsd:string'),
+ array('match' => 'xsd:string'),
+ $ns);
+
+$server->register('GetLastRaid',
+ array('user' => 'xsd:string','password' => 'xsd:string'),
+ array('raid_id' => 'xsd:string'),
+ $ns);
+
+$server->register('AddMember',
+ array('user' => 'xsd:string','password' => 'xsd:string',
+ 'member' => 'xsd:string', 'class' => 'xsd:string', 'level' => 'xsd:string'),
+ array('return' => 'xsd:string'),
+ $ns);
+
+$server->register('AddRaid',
+ array('user' => 'xsd:string','password' => 'xsd:string', 'event_name' => 'xsd:string'),
+ array('return' => 'xsd:string'),
+ $ns);
+
+$server->register('AddRaidVal',
+ array('user' => 'xsd:string','password' => 'xsd:string', 'raid_id' => 'xsd:string', 'raid_value' => 'xds:string'),
+ array('return' => 'xsd:string'),
+ $ns);
+
+$server->register('ComputeRaidVal',
+ array('user' => 'xsd:string','password' => 'xsd:string', 'raid_id' => 'xsd:string'),
+ array('raidvalue' => 'xsd:string'),
+ $ns);
+
+$server->register('AddRaidAttendee',
+ array('user' => 'xsd:string','password' => 'xsd:string', 'raid_id' => 'xsd:string', 'member' => 'xsd:string'),
+ array('return' => 'xsd:string'),
+ $ns);
+
+$server->register('DelRaidAttendee',
+ array('user' => 'xsd:string','password' => 'xsd:string', 'raid_id' => 'xsd:string', 'member' => 'xsd:string'),
+ array('return' => 'xsd:string'),
+ $ns);
+
+$server->register('DoLoot',
+ array('user' => 'xsd:string',
+ 'password' => 'xsd:string',
+ 'item' => 'xsd:string',
+ 'value' => 'xsd:string',
+ 'member' => 'xsd:string',
+ 'raid_id' => 'xsd:string'),
+ array('return' => 'xsd:string'),
+ $ns);
+
+
+function GetMemberRP($user, $password, $member)
+{
+
+ global $db, $eqdkp;
+
+ $auth = soap_validate($user,$password);
+
+ // Valid member?
+ $sql = "SELECT count(*) FROM " . MEMBERS_TABLE . "
+ WHERE member_name = '$buyer'";
+ $isvalid = $db->query_first($sql);
+ if ( !( isset($isvalid) || $isvalid > 0 ) ) {
+ $status = "ENOMEMBER";
+ return($status);
+ }
+
+
+ if ( $auth == 'R' || $auth == 'W' ) {
+
+ $sql = "SELECT (member_earned + member_adjustment - member_spent) as member_current
+ FROM " . MEMBERS_TABLE ."
+ WHERE member_name = '$member'";
+ $dkp = $db->query_first($sql);
+
+ if ( isset($dkp) ) {
+ // if set, return value (we try to return $status always, so set it)
+ $status = $dkp;
+ return($status);
+ } else {
+ // otherwise, we didn't find them - error out
+ $status = "ENOTFOUND";
+ return($status);
+ } }
+
+ else {
+ // if auth isnt Read or Write, error out
+ $status = "ENOAUTH";
+ return($status);
+ }
+
+
+}
+
+function AddRaidVal($user, $password, $raid_id, $raid_value)
+{
+ global $db, $eqdkp;
+
+ $auth = soap_validate($user,$password);
+
+ if ($auth == 'W') {
+
+ if (isset($raid_value) && isset($raid_id) ) {
+
+ $sql = "SELECT raid_value FROM " . RAIDS_TABLE . " WHERE raid_id = '$raid_id'";
+ $old_val = $db->query_first($sql);
+
+ $sql = "UPDATE " . RAIDS_TABLE . " SET raid_value = '$raid_value'
+ WHERE raid_id = '$raid_id'";
+
+ if ( !( $result = $db->query($sql) )) {
+ $status = "ESQLERR";
+ } else {
+ $status = "OK";
+ }
+
+ // Add this value to everyone currently in attendance
+ $sql = "SELECT member_name FROM ". RAID_ATTENDEES_TABLE ." WHERE raid_id = '$raid_id'";
+ $result = $db->query($sql);
+
+ while ( $row = $db->fetch_record($result) ) {
+
+ $sql = "UPDATE ". MEMBERS_TABLE ."
+ SET member_earned = (member_earned + '$raid_value' - '$old_val')
+ WHERE member_name = '". $row['member_name'] ."'";
+ $db->query($sql);
+ }
+
+
+ } else {
+
+ $status = "EBADVALUES";
+
+ } // close of isset loop
+
+ } else {
+
+ $status = "ENOAUTH";
+
+ } // close auth loop
+
+
+ return($status);
+
+
+}
+
+function ComputeRaidVal($user, $password, $raid_id)
+{
+ global $db, $eqdkp;
+
+ $auth = soap_validate($user,$password);
+
+ if ( !(isset($raid_id)) ) {
+ $status = "EBADPARM";
+ return($status);
+ }
+
+ if ($auth == 'W') {
+
+ // count members
+ $sql = "SELECT count(*) FROM " . RAID_ATTENDEES_TABLE ."
+ WHERE raid_id = '$raid_id'";
+
+ if ( !($member_count = $db->query_first($sql) )) {
+ $status = "ESQLERR";
+ return($status);
+ }
+
+ if ( ($member_count < 1) || (!(isset($member_count))) ) {
+ $status = "EBADCOUNT";
+ return($status);
+ }
+
+ // sum value of all loot
+ $sql = "SELECT sum(item_value) FROM " . ITEMS_TABLE . "
+ WHERE raid_id = '$raid_id'";
+
+ if (!($item_value = $db->query_first($sql))) {
+ $status = "ESQLERR";
+ return($status);
+ }
+
+ // value divided by member count = value
+ // NOTICE!!!
+ //
+ // Raid value is a whole number only. Minimum value is 1.
+ // All raids will get assigned 1RP if there was loot.
+ // Otherwise, no loot = no RP.
+ // member_count = 1? return item_value
+
+ if ( ($item_value > 0) && ($member_count > 1) ) {
+
+ $raid_value = floor( round( .5 + ($item_value/$member_count) ) );
+
+ } elseif ($member_count = 1) {
+
+ $raid_value = $item_value;
+
+ } else {
+
+ $raid_value = 0;
+
+ }
+
+ // update raid_value
+
+ if ( (isset($raid_value)) && (isset($raid_id)) && (isset($member_count)) ) {
+
+ $sql = "SELECT raid_value FROM " . RAIDS_TABLE . " WHERE raid_id = '$raid_id'";
+ $old_val = $db->query_first($sql);
+
+ $sql = "UPDATE " . RAIDS_TABLE . " SET raid_value = '$raid_value'
+ WHERE raid_id = '$raid_id'";
+
+ if ( !( $result = $db->query($sql) )) {
+ $status = "ESQLERR";
+ return($status);
+ } else {
+ $status = $raid_value;
+ }
+
+ // Add this value to everyone currently in attendance
+ $sql = "SELECT member_name FROM ". RAID_ATTENDEES_TABLE ." WHERE raid_id = '$raid_id'";
+ $result = $db->query($sql);
+
+ while ( $row = $db->fetch_record($result) ) {
+
+ $sql = "UPDATE ". MEMBERS_TABLE ."
+ SET member_earned = (member_earned + '$raid_value' - '$old_val')
+ WHERE member_name = '". $row['member_name'] ."'";
+ $db->query($sql);
+ }
+
+
+
+ } else {
+
+ $status="ESQLFAIL";
+ return($status);
+
+ }
+
+ } else {
+
+ $status = "ENOAUTH";
+ return($status);
+
+ } // close auth loop
+
+ return($status);
+
+}
+
+
+function AddRaid($user, $password, $event_name)
+{
+ global $db, $eqdkp;
+
+ $current_time = time();
+ $clean_event_name = str_replace("'","", $event_name);
+
+ $auth = soap_validate($user,$password);
+
+ if ( $auth == 'W' ) {
+
+ // get event value
+ $raid_value = $db->query_first('SELECT event_value FROM ' . EVENTS_TABLE . "
+ WHERE event_name='" . addslashes($clean_event_name) . "'");
+
+
+ // If there was no event, create one with a zero value
+ if (( ! (isset($raid_value)) || empty($raid_value) )) {
+
+ $raid_value = '0.00';
+
+ $query = $db->build_query('INSERT', array(
+ 'event_name' => ($clean_event_name),
+ 'event_value' => $raid_value,
+ 'event_added_by' => $user)
+ );
+
+ if ( !($db->query('INSERT INTO ' . EVENTS_TABLE . $query)) ) {
+
+ die("SQL Error - Aborting on event insert - contact thundarr@gmail.com");
+
+ }
+
+ $this_event_id = $db->insert_id();
+
+
+ // Else, if there was a event, zero out its value
+ // since we never want a event value used
+ } else {
+
+ $raid_value = '0.00';
+
+ if ( !($db->query("UPDATE " . EVENTS_TABLE . " SET event_value = '0.00' WHERE event_name = '" . addslashes($clean_event_name) . "'")) ) {
+
+ die("SQL Error - Aborting on event zeroing - contact thundarr@gmail.com");
+
+ }
+
+ }
+
+ $query = $db->build_query('INSERT', array(
+ 'raid_name' => $clean_event_name,
+ 'raid_date' => $current_time,
+ 'raid_value' => $raid_value,
+ 'raid_added_by' => $user)
+ );
+
+ if ( ! ($db->query('INSERT INTO ' . RAIDS_TABLE . $query) )) {
+
+ die("SQL Error - Aborting on raid insert - contact thundarr@gmail.com");
+
+ }
+
+ $this_raid_id = $db->insert_id();
+
+ $status = $this_raid_id;
+ return($status);
+
+ } else {
+
+ $status = "EBADAUTH";
+ return($status);
+
+ }
+
+}
+
+function AddRaidAttendee($user, $password, $raid_id, $member)
+{
+
+ global $db, $eqdkp;
+ $current_time = time();
+
+ $auth = soap_validate($user,$password);
+
+ $inactive_time = mktime(0, 0, 0, date('m'), date('d')-$eqdkp->config['inactive_period'], date('Y'));
+
+ $sql = "SELECT member_id FROM " . MEMBERS_TABLE . "
+ WHERE member_name = '$member'";
+ $isvalid = $db->query_first($sql);
+
+ if ( (isset($isvalid) && ($isvalid > 0) ) ) {
+
+ if ( $auth == 'W' ) {
+
+ $sql = "SELECT count(*) FROM " . RAID_ATTENDEES_TABLE . "
+ WHERE raid_id = '$raid_id'
+ AND member_name = '$member'";
+ $duplicate = $db->query_first($sql);
+
+ if ( $duplicate > 0 ) {
+ $status = "EDUPLICATE";
+ return($status);
+ }
+
+ $sql = "INSERT INTO " . RAID_ATTENDEES_TABLE . " (raid_id, member_name)
+ VALUES ('$raid_id', '$member')";
+ $db->query($sql);
+
+ $sql = "UPDATE " . MEMBERS_TABLE . " m, " . RAIDS_TABLE . " r
+ SET m.member_lastraid = r.raid_date
+ WHERE m.member_name = '$member'
+ AND r.raid_id = '$raid_id'";
+ $db->query($sql);
+
+ $sql = "UPDATE " . MEMBERS_TABLE . " SET member_raidcount = (member_raidcount + 1) WHERE member_name = '$member'";
+ $db->query($sql);
+
+ // Active -> Inactive
+ $db->query('UPDATE ' . MEMBERS_TABLE . " SET member_status='0' WHERE (member_lastraid < " . $inactive_time . ") AND (member_status='1')");
+
+ // Inactive -> Active
+ $db->query('UPDATE ' . MEMBERS_TABLE . " SET member_status='1' WHERE (member_lastraid >= " . $inactive_time . ") AND (member_status='0')");
+
+ $status = "OK";
+ return($status);
+
+ } else {
+
+ $status = "EBADAUTH";
+ return($status);
+
+ }
+
+ } else {
+
+ $status = "ENOMEMBER";
+ return($status);
+
+ }
+
+
+
+}
+
+function AddMember($user, $password, $member, $class, $level)
+{
+ global $db, $eqdkp;
+
+ $auth = soap_validate($user, $password);
+
+ if ($auth == 'W') {
+
+ // first, insert the name and level :: race_id Unknown is always zero
+ $sql = "INSERT INTO " . MEMBERS_TABLE . " (member_name, member_level)
+ VALUES ('$member', '$level')";
+
+ if (!($db->query($sql))) {
+ $status = "ESQLFAIL1";
+ return($status);
+ }
+
+
+ // now update class_id
+ $sql = "UPDATE " . MEMBERS_TABLE . " m, " . CLASS_TABLE . " c
+ SET m.member_class_id = c.class_id
+ WHERE c.class_name = '$class'
+ AND m.member_name = '$member'
+ AND '$level' >= c.class_min_level
+ AND '$level' <= c.class_max_level";
+
+ if (!($db->query($sql))) {
+ $status = "ESQLFAIL2";
+ return($status);
+ }
+
+ $status = "OK";
+ return($status);
+
+ } else {
+
+ $status = "ENOAUTH";
+ return($status);
+ }
+
+
+
+}
+
+function GetLastRaid($user, $password)
+{
+
+ global $db, $eqdkp;
+
+ $auth = soap_validate($user,$password);
+
+ if ( $auth == 'R' || $auth == 'W' ) {
+
+ $sql = "SELECT raid_id, raid_name FROM " . RAIDS_TABLE . "
+ ORDER BY raid_id DESC LIMIT 1";
+ $last_raid_id = $db->query_first($sql);
+
+ $status = $last_raid_id;
+ return($status);
+
+ } else {
+
+ $status = "EBADAUTH";
+ return($status);
+
+ }
+}
+
+function DelRaidAttendee($user, $password, $raid_id, $member)
+{
+
+ global $db, $eqdkp;
+
+ $auth = soap_validate($user,$password);
+
+ // Valid member?
+ $sql = "SELECT count(*) FROM " . MEMBERS_TABLE . "
+ WHERE member_name = '$member'";
+ $isvalid = $db->query_first($sql);
+ if ( !( isset($isvalid) || $isvalid > 0 ) ) {
+ $status = "ENOMEMBER";
+ return($status);
+ }
+
+ // Valid raid id?
+ $sql = "SELECT count(*) FROM " . RAIDS_TABLE . "
+ WHERE raid_id = '$raid_id'";
+ $israid = $db->query_first($sql);
+ if ( !( isset($israid) || $israid > 0 ) ) {
+ $status = "ENORAID";
+ return($status);
+ }
+
+ if ( $auth == 'W' ) {
+
+ $sql = "SELECT count(*) FROM " . RAID_ATTENDEES_TABLE . "
+ WHERE raid_id = '$raid_id'
+ AND member_name = '$member'";
+ $duplicate = $db->query_first($sql);
+
+ if ( ($duplicate == 0) || (!(isset($duplicate))) ) {
+ $status = "ENOEXIST";
+ return($status);
+ }
+
+ $sql = "DELETE FROM " . RAID_ATTENDEES_TABLE . " WHERE raid_id = '$raid_id' AND member_name = '$member'";
+ $db->query($sql);
+
+ $sql = "SELECT max(raid_id) FROM " . RAID_ATTENDEES_TABLE . " WHERE member_name = '$member'";
+ $last_raid = $db->query_first($sql);
+
+ $sql = "UPDATE " . MEMBERS_TABLE . " m, " . RAIDS_TABLE . " r
+ SET m.member_lastraid = r.raid_date
+ WHERE raid_id = '$last_raid'
+ AND m.member_name = '$member'";
+ $db->query($sql);
+
+ $sql = "UPDATE " . MEMBERS_TABLE . " SET member_raidcount = (member_raidcount - 1)";
+ $db->query($sql);
+
+
+ $status = "OK";
+ return($status);
+
+
+ } else {
+
+ $status = "ENOMEMBER";
+ return($status);
+
+ }
+
+
+
+}
+
+function DoLoot($user, $password, $item, $value, $buyer, $raid_id)
+{
+
+ global $db, $eqdkp;
+
+ // Taken from includes/eqdkp.php
+ // Normalize data
+ $part1 = htmlspecialchars(stripslashes($item));
+ $part2 = htmlspecialchars(stripslashes($current_time));
+ $part3 = htmlspecialchars(stripslashes($raid_id));
+
+ // Get the first 10-11 digits of each md5 hash
+ $part1 = substr(md5($part1), 0, 10);
+ $part2 = substr(md5($part2), 0, 11);
+ $part3 = substr(md5($part3), 0, 11);
+
+ // Group the hashes together and create a new hash based on uniqid()
+ $group_key = $part1 . $part2 . $part3;
+ $group_key = md5(uniqid($group_key));
+
+
+ $current_time = time();
+ $itemss = stripslashes($item);
+
+ // auth
+ $auth = soap_validate($user,$password);
+
+ // Valid raid id?
+ $sql = "SELECT count(*) FROM " . RAIDS_TABLE . "
+ WHERE raid_id = '$raid_id'";
+ $israid = $db->query_first($sql);
+ if ( !( isset($israid) || $israid > 0 ) ) {
+ $status = "ENORAID";
+ return($status);
+ }
+
+ // Valid member?
+ $sql = "SELECT count(*) FROM " . MEMBERS_TABLE . "
+ WHERE member_name = '$buyer'";
+ $isvalid = $db->query_first($sql);
+ if ( !( isset($isvalid) || $isvalid > 0 ) ) {
+ $status = "ENOMEMBER";
+ return($status);
+ }
+
+
+ if ( $auth == 'W' ) {
+
+ // insert items
+ $sql = "INSERT INTO ". ITEMS_TABLE ."
+ (item_name, item_buyer, raid_id, item_value, item_date, item_group_key, item_added_by)
+ VALUES
+ ('$itemss', '$buyer', '$raid_id', '$value', '$current_time', '$group_key', '$user')";
+ $db->query($sql);
+
+ // fix their spent RP
+ $sql = "UPDATE " . MEMBERS_TABLE . "
+ SET member_spent = member_spent + " . $value . "
+ WHERE member_name = '$buyer'";
+ $db->query($sql);
+
+ $status = "OK";
+ return($status);
+
+ } else {
+ // I dont have write permission; error out
+ $status = "ENOAUTH";
+ return($status);
+ }
+
+
+
+}
+
+function FindEvent($user, $password, $name_regexp)
+{
+ global $db, $eqdkp;
+ $match = "";
+
+ $auth = soap_validate($user,$password);
+
+ if ( $auth == 'R' || $auth == 'W' ) {
+
+ $sql = "SELECT event_name FROM eqdkp_events WHERE (event_name REGEXP '$name_regexp')";
+ $result = $db->query($sql);
+
+ while ( $row = $db->fetch_record($result) ) {
+ $match .= $row['event_name'] ."::";
+ }
+ return($match);
+ } else {
+ // if auth isnt Read or Write, error out
+ $status = "ENOAUTH";
+ return($status);
+ }
+
+}
+
+$server->service($HTTP_RAW_POST_DATA);
+?>
diff --git a/admin/soap/doloot.php b/admin/soap/doloot.php
new file mode 100644
index 0000000..dc43a25
--- /dev/null
+++ b/admin/soap/doloot.php
@@ -0,0 +1,39 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2005
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * doloot.php
+ * begin: Tue April 19 2005
+ *
+ * $Id: doloot.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+$eqdkp_root_path = './../../';
+include_once($eqdkp_root_path . 'common.php');
+
+if (isset($_GET['item_name']) ) { $item_name = $_GET['item_name']; } else { die("item_name not defined<br>"); }
+if (isset($_GET['value']) ) { $value = $_GET['value']; } else { die("value not defined<br>"); }
+if (isset($_GET['buyer']) ) { $buyer = $_GET['buyer']; } else { die("buyer not defined<br>"); }
+if (isset($_GET['raid_id']) ) { $raid_id = $_GET['raid_id']; } else { die("raid_id not defined<br>"); }
+
+
+// Create the client instance
+$client = new soapclient( $ns . 'admin/soap/dkpsoap.php');
+
+// Call the SOAP method
+$output = $client->call('DoLoot', array('user' => $soap_user, 'password' => $soap_password,
+ 'item' => $item_name, 'value' => $value,
+ 'buyer' => $buyer, 'raid_id' => $raid_id));
+
+// Display the result
+print_r($output);
+
+echo '<h2>Request</h2>';
+echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
+echo '<h2>Response</h2>';
+echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
+?>
diff --git a/admin/soap/findevent.php b/admin/soap/findevent.php
new file mode 100644
index 0000000..4cb3cfb
--- /dev/null
+++ b/admin/soap/findevent.php
@@ -0,0 +1,39 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2005
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * getrp.php
+ * begin: Tue April 19 2005
+ *
+ * $Id: findevent.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+$eqdkp_root_path = './../../';
+include_once($eqdkp_root_path . 'common.php');
+
+if (isset($_GET['event']) ) {
+
+$event_name = $_GET['event'];
+
+} else {
+die("member not defined<br>");
+}
+
+// Create the client instance
+$client = new soapclient( $ns . 'admin/soap/dkpsoap.php');
+
+// Call the SOAP method
+$output = $client->call('FindEvent', array('user' => $soap_user, 'password' => $soap_password, 'name_regexp' => $event_name));
+
+// Display the result
+print_r($output);
+
+echo '<h2>Request</h2>';
+echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
+echo '<h2>Response</h2>';
+echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
+?>
diff --git a/admin/soap/getlastraid.php b/admin/soap/getlastraid.php
new file mode 100644
index 0000000..b4d9737
--- /dev/null
+++ b/admin/soap/getlastraid.php
@@ -0,0 +1,32 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2005
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * getlastraid.php
+ * begin: Tue April 19 2005
+ *
+ * $Id: getlastraid.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+$eqdkp_root_path = './../../';
+include_once($eqdkp_root_path . 'common.php');
+
+
+// Create the client instance
+$client = new soapclient($ns . 'admin/soap/dkpsoap.php');
+
+// Call the SOAP method
+$output = $client->call('GetLastRaid', array('user' => $soap_user, 'password' => $soap_password));
+
+// Display the result
+print_r($output);
+
+echo '<h2>Request</h2>';
+echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
+echo '<h2>Response</h2>';
+echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
+?>
diff --git a/admin/soap/getrp.php b/admin/soap/getrp.php
new file mode 100644
index 0000000..3f44dae
--- /dev/null
+++ b/admin/soap/getrp.php
@@ -0,0 +1,39 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2005
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * getrp.php
+ * begin: Tue April 19 2005
+ *
+ * $Id: getrp.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+$eqdkp_root_path = './../../';
+include_once($eqdkp_root_path . 'common.php');
+
+if (isset($_GET['member']) ) {
+
+$member_name = $_GET['member'];
+
+} else {
+die("member not defined<br>");
+}
+
+// Create the client instance
+$client = new soapclient( $ns . 'admin/soap/dkpsoap.php');
+
+// Call the SOAP method
+$output = $client->call('GetMemberRP', array('user' => $soap_user, 'password' => $soap_password, 'name' => $member_name));
+
+// Display the result
+print_r($output);
+
+echo '<h2>Request</h2>';
+echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
+echo '<h2>Response</h2>';
+echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
+?>
diff --git a/admin/styles.php b/admin/styles.php
new file mode 100644
index 0000000..71ceb41
--- /dev/null
+++ b/admin/styles.php
@@ -0,0 +1,561 @@
+<?php
+/******************************
+ * EQdkp
+ * Copyright 2002-2003
+ * Licensed under the GNU GPL. See COPYING for full terms.
+ * ------------------
+ * styles.php
+ * Began: Thu January 16 2003
+ *
+ * $Id: styles.php 46 2007-06-19 07:29:11Z tsigo $
+ *
+ ******************************/
+
+define('EQDKP_INC', true);
+define('IN_ADMIN', true);
+$eqdkp_root_path = './../';
+include_once($eqdkp_root_path . 'common.php');
+
+class Manage_Styles extends EQdkp_Admin
+{
+ var $style = array();
+
+ function manage_styles()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ parent::eqdkp_admin();
+
+ $defaults = array(
+ 'attendees_columns' => 8,
+ 'date_notime_long' => 'F j, Y',
+ 'date_notime_short' => 'm/d/y',
+ 'date_time' => 'm/d/y h:ia T',
+ 'logo_path' => 'logo.gif');
+
+ $this->style = array(
+ 'style_name' => post_or_db('style_name'),
+ 'template_path' => post_or_db('template_path'),
+ 'body_background' => post_or_db('body_background'),
+ 'body_link' => post_or_db('body_link'),
+ 'body_link_style' => post_or_db('body_link_style'),
+ 'body_hlink' => post_or_db('body_hlink'),
+ 'body_hlink_style' => post_or_db('body_hlink_style'),
+ 'header_link' => post_or_db('header_link'),
+ 'header_link_style' => post_or_db('header_link_style'),
+ 'header_hlink' => post_or_db('header_hlink'),
+ 'header_hlink_style' => post_or_db('header_hlink_style'),
+ 'tr_color1' => post_or_db('tr_color1'),
+ 'tr_color2' => post_or_db('tr_color2'),
+ 'th_color1' => post_or_db('th_color1'),
+ 'fontface1' => post_or_db('fontface1'),
+ 'fontface2' => post_or_db('fontface2'),
+ 'fontface3' => post_or_db('fontface3'),
+ 'fontsize1' => post_or_db('fontsize1'),
+ 'fontsize2' => post_or_db('fontsize2'),
+ 'fontsize3' => post_or_db('fontsize3'),
+ 'fontcolor1' => post_or_db('fontcolor1'),
+ 'fontcolor2' => post_or_db('fontcolor2'),
+ 'fontcolor3' => post_or_db('fontcolor3'),
+ 'fontcolor_neg' => post_or_db('fontcolor_neg'),
+ 'fontcolor_pos' => post_or_db('fontcolor_pos'),
+ 'table_border_width' => post_or_db('table_border_width'),
+ 'table_border_color' => post_or_db('table_border_color'),
+ 'table_border_style' => post_or_db('table_border_style'),
+ 'input_color' => post_or_db('input_color'),
+ 'input_border_width' => post_or_db('input_border_width'),
+ 'input_border_color' => post_or_db('input_border_color'),
+ 'input_border_style' => post_or_db('input_border_style'),
+ 'attendees_columns' => post_or_db('attendees_columns', $defaults),
+ 'date_notime_long' => post_or_db('date_notime_long', $defaults),
+ 'date_notime_short' => post_or_db('date_notime_short', $defaults),
+ 'date_time' => post_or_db('date_time', $defaults),
+ 'logo_path' => post_or_db('logo_path', $defaults)
+ );
+
+ // Vars used to confirm deletion
+ $this->set_vars(array(
+ 'confirm_text' => $user->lang['confirm_delete_style'],
+ 'uri_parameter' => 'styleid')
+ );
+
+ $this->assoc_buttons(array(
+ 'add' => array(
+ 'name' => 'add',
+ 'process' => 'process_add',
+ 'check' => 'a_styles_man'),
+ 'update' => array(
+ 'name' => 'update',
+ 'process' => 'process_update',
+ 'check' => 'a_styles_man'),
+ 'delete' => array(
+ 'name' => 'delete',
+ 'process' => 'process_delete',
+ 'check' => 'a_styles_man'),
+ 'form' => array(
+ 'name' => '',
+ 'process' => 'display_list',
+ 'check' => 'a_styles_man'))
+ );
+
+ $this->assoc_params(array(
+ 'create' => array(
+ 'name' => 'mode',
+ 'value' => 'create',
+ 'process' => 'display_form',
+ 'check' => 'a_styles_man'),
+ 'edit' => array(
+ 'name' => 'styleid',
+ 'process' => 'display_form',
+ 'check' => 'a_styles_man'))
+ );
+
+ // Build the style array
+ // ---------------------------------------------------------
+ if ( $this->url_id )
+ {
+ $sql = 'SELECT s.*, c.*
+ FROM ' . STYLES_TABLE . ' s, ' . STYLES_CONFIG_TABLE . " c
+ WHERE (s.style_id = c.style_id)
+ AND s.style_id='" . $this->url_id . "'";
+ $result = $db->query($sql);
+ if ( !$row = $db->fetch_record($result) )
+ {
+ message_die($user->lang['error_invalid_style']);
+ }
+ $db->free_result($result);
+
+ $this->style = array(
+ 'style_name' => post_or_db('style_name', $row),
+ 'template_path' => post_or_db('template_path', $row),
+ 'body_background' => post_or_db('body_background', $row),
+ 'body_link' => post_or_db('body_link', $row),
+ 'body_link_style' => post_or_db('body_link_style', $row),
+ 'body_hlink' => post_or_db('body_hlink', $row),
+ 'body_hlink_style' => post_or_db('body_hlink_style', $row),
+ 'header_link' => post_or_db('header_link', $row),
+ 'header_link_style' => post_or_db('header_link_style', $row),
+ 'header_hlink' => post_or_db('header_hlink', $row),
+ 'header_hlink_style' => post_or_db('header_hlink_style', $row),
+ 'tr_color1' => post_or_db('tr_color1', $row),
+ 'tr_color2' => post_or_db('tr_color2', $row),
+ 'th_color1' => post_or_db('th_color1', $row),
+ 'fontface1' => post_or_db('fontface1', $row),
+ 'fontface2' => post_or_db('fontface2', $row),
+ 'fontface3' => post_or_db('fontface3', $row),
+ 'fontsize1' => post_or_db('fontsize1', $row),
+ 'fontsize2' => post_or_db('fontsize2', $row),
+ 'fontsize3' => post_or_db('fontsize3', $row),
+ 'fontcolor1' => post_or_db('fontcolor1', $row),
+ 'fontcolor2' => post_or_db('fontcolor2', $row),
+ 'fontcolor3' => post_or_db('fontcolor3', $row),
+ 'fontcolor_neg' => post_or_db('fontcolor_neg', $row),
+ 'fontcolor_pos' => post_or_db('fontcolor_pos', $row),
+ 'table_border_width' => post_or_db('table_border_width', $row),
+ 'table_border_color' => post_or_db('table_border_color', $row),
+ 'table_border_style' => post_or_db('table_border_style', $row),
+ 'input_color' => post_or_db('input_color', $row),
+ 'input_border_width' => post_or_db('input_border_width', $row),
+ 'input_border_color' => post_or_db('input_border_color', $row),
+ 'input_border_style' => post_or_db('input_border_style', $row),
+ 'attendees_columns' => post_or_db('attendees_columns', $row),
+ 'date_notime_long' => post_or_db('date_notime_long', $row),
+ 'date_notime_short' => post_or_db('date_notime_short', $row),
+ 'date_time' => post_or_db('date_time', $row),
+ 'logo_path' => post_or_db('logo_path', $row)
+ );
+ }
+ }
+
+ function error_check()
+ {
+ return false;
+ }
+
+ // ---------------------------------------------------------
+ // Process Add
+ // ---------------------------------------------------------
+ function process_add()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ extract($_POST);
+ $query = $db->build_query('INSERT', array(
+ 'style_name' => $style_name,
+ 'template_path' => $template_path,
+ 'body_background' => $body_background,
+ 'body_link' => $body_link,
+ 'body_link_style' => $body_link_style,
+ 'body_hlink' => $body_hlink,
+ 'body_hlink_style' => $body_hlink_style,
+ 'header_link' => $header_link,
+ 'header_link_style' => $header_link_style,
+ 'header_hlink' => $header_hlink,
+ 'header_hlink_style' => $header_hlink_style,
+ 'tr_color1' => $tr_color1,
+ 'tr_color2' => $tr_color2,
+ 'th_color1' => $th_color1,
+ 'fontface1' => $fontface1,
+ 'fontface2' => $fontface2,
+ 'fontface3' => $fontface3,
+ 'fontsize1' => $fontsize1,
+ 'fontsize2' => $fontsize2,
+ 'fontsize3' => $fontsize3,
+ 'fontcolor1' => $fontcolor1,
+ 'fontcolor2' => $fontcolor2,
+ 'fontcolor3' => $fontcolor3,
+ 'fontcolor_neg' => $fontcolor_neg,
+ 'fontcolor_pos' => $fontcolor_pos,
+ 'table_border_width' => $table_border_width,
+ 'table_border_color' => $table_border_color,
+ 'table_border_style' => $table_border_style,
+ 'input_color' => $input_color,
+ 'input_border_width' => $input_border_width,
+ 'input_border_color' => $input_border_color,
+ 'input_border_style' => $input_border_style)
+ );
+ $db->query('INSERT INTO ' . STYLES_TABLE . $query);
+ $style_id = $db->insert_id();
+
+ $query = $db->build_query('INSERT', array(
+ 'style_id' => $style_id,
+ 'attendees_columns' => $attendees_columns,
+ 'date_notime_long' => $date_notime_long,
+ 'date_notime_short' => $date_notime_short,
+ 'date_time' => $date_time,
+ 'logo_path' => $logo_path)
+ );
+ $db->query('INSERT INTO ' . STYLES_CONFIG_TABLE . $query);
+
+ message_die($user->lang['admin_add_style_success']);
+ }
+
+ // ---------------------------------------------------------
+ // Process Update
+ // ---------------------------------------------------------
+ function process_update()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ extract($_POST);
+ $query = $db->build_query('UPDATE', array(
+ 'style_name' => $style_name,
+ 'template_path' => $template_path,
+ 'body_background' => $body_background,
+ 'body_link' => $body_link,
+ 'body_link_style' => $body_link_style,
+ 'body_hlink' => $body_hlink,
+ 'body_hlink_style' => $body_hlink_style,
+ 'header_link' => $header_link,
+ 'header_link_style' => $header_link_style,
+ 'header_hlink' => $header_hlink,
+ 'header_hlink_style' => $header_hlink_style,
+ 'tr_color1' => $tr_color1,
+ 'tr_color2' => $tr_color2,
+ 'th_color1' => $th_color1,
+ 'fontface1' => $fontface1,
+ 'fontface2' => $fontface2,
+ 'fontface3' => $fontface3,
+ 'fontsize1' => $fontsize1,
+ 'fontsize2' => $fontsize2,
+ 'fontsize3' => $fontsize3,
+ 'fontcolor1' => $fontcolor1,
+ 'fontcolor2' => $fontcolor2,
+ 'fontcolor3' => $fontcolor3,
+ 'fontcolor_neg' => $fontcolor_neg,
+ 'fontcolor_pos' => $fontcolor_pos,
+ 'table_border_width' => $table_border_width,
+ 'table_border_color' => $table_border_color,
+ 'table_border_style' => $table_border_style,
+ 'input_color' => $input_color,
+ 'input_border_width' => $input_border_width,
+ 'input_border_color' => $input_border_color,
+ 'input_border_style' => $input_border_style)
+ );
+ $db->query('UPDATE ' . STYLES_TABLE . ' SET ' . $query . " WHERE style_id='" . $this->url_id . "'");
+
+ $query = $db->build_query('UPDATE', array(
+ 'attendees_columns' => $attendees_columns,
+ 'date_notime_long' => $date_notime_long,
+ 'date_notime_short' => $date_notime_short,
+ 'date_time' => $date_time,
+ 'logo_path' => $logo_path)
+ );
+ $db->query('UPDATE ' . STYLES_CONFIG_TABLE . ' SET ' . $query . " WHERE style_id='" . $this->url_id . "'");
+
+ message_die($user->lang['admin_update_style_success']);
+ }
+
+ // ---------------------------------------------------------
+ // Process Delete (confirmed)
+ // ---------------------------------------------------------
+ function process_confirm()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $db->query('DELETE FROM ' . STYLES_TABLE . " WHERE style_id='" . $this->url_id . "'");
+ $db->query('DELETE FROM ' . STYLES_CONFIG_TABLE . " WHERE style_id='" . $this->url_id . "'");
+
+ message_die($user->lang['admin_delete_style_success']);
+ }
+
+ // ---------------------------------------------------------
+ // Process helper methods
+ // ---------------------------------------------------------
+
+ // ---------------------------------------------------------
+ // Display
+ // ---------------------------------------------------------
+ function display_list()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $sql = 'SELECT style_id, style_name, template_path, count(u.user_id) AS users
+ FROM (' . STYLES_TABLE . ' s
+ LEFT JOIN ' . USERS_TABLE . ' u
+ ON u.user_style = s.style_id)
+ GROUP BY s.style_id
+ ORDER BY s.style_name';
+ $result = $db->query($sql);
+ while ( $row = $db->fetch_record($result) )
+ {
+ $tpl->assign_block_vars('styles_row', array(
+ 'ROW_CLASS' => $eqdkp->switch_row_class(),
+ 'U_EDIT_STYLE' => 'styles.php' . $SID . '&amp;styleid=' . $row['style_id'],
+ 'NAME' => stripslashes($row['style_name']),
+ 'TEMPLATE' => $row['template_path'],
+ 'USERS' => $row['users'],
+ 'U_PREVIEW' => 'styles.php' . $SID . '&amp;style=' . $row['style_id'])
+ );
+ }
+ $db->free_result($result);
+
+ $tpl->assign_vars(array(
+ 'L_NAME' => $user->lang['name'],
+ 'L_TEMPLATE' => $user->lang['template'],
+ 'L_USERS' => $user->lang['users'],
+ 'L_PREVIEW' => $user->lang['preview'])
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['styles_title'],
+ 'template_file' => 'admin/styles.html',
+ 'display' => true)
+ );
+ }
+
+ function display_form()
+ {
+ global $db, $eqdkp, $user, $tpl, $pm;
+ global $SID;
+
+ $text_decoration = array(
+ 'none',
+ 'underline',
+ 'overline',
+ 'line-through',
+ 'blink');
+ $border_style = array(
+ 'none',
+ 'hidden',
+ 'dotted',
+ 'dashed',
+ 'solid',
+ 'double',
+ 'groove',
+ 'ridge',
+ 'inset',
+ 'outset');
+
+ //
+ // Available templates
+ //
+ if ( $dir = @opendir($eqdkp->root_path . 'templates/') )
+ {
+ while ( $file = @readdir($dir) )
+ {
+ if ( (!is_file($eqdkp->root_path . 'templates/' . $file)) && (!is_link($eqdkp->root_path . 'templates/' . $file)) && ($file != '.') && ($file != '..') && ($file != 'CVS') && ($file != 'cache') )
+ {
+ $tpl->assign_block_vars('template_row', array(
+ 'VALUE' => stripslashes($file),
+ 'SELECTED' => ( $this->style['template_path'] == stripslashes($file) ) ? ' selected="selected"' : '',
+ 'OPTION' => stripslashes($file))
+ );
+ }
+ }
+ }
+
+ //
+ // Text decorations
+ //
+ foreach ( $text_decoration as $k => $v )
+ {
+ $tpl->assign_block_vars('body_link_style_row', array(
+ 'VALUE' => $v,
+ 'SELECTED' => ( $this->style['body_link_style'] == $v ) ? ' selected="selected"' : '',
+ 'OPTION' => $v)
+ );
+ $tpl->assign_block_vars('body_hlink_style_row', array(
+ 'VALUE' => $v,
+ 'SELECTED' => ( $this->style['body_hlink_style'] == $v ) ? ' selected="selected"' : '',
+ 'OPTION' => $v)
+ );
+ $tpl->assign_block_vars('header_link_style_row', array(
+ 'VALUE' => $v,
+ 'SELECTED' => ( $this->style['header_link_style'] == $v ) ? ' selected="selected"' : '',
+ 'OPTION' => $v)
+ );
+ $tpl->assign_block_vars('header_hlink_style_row', array(
+ 'VALUE' => $v,
+ 'SELECTED' => ( $this->style['header_hlink_style'] == $v ) ? ' selected="selected"' : '',
+ 'OPTION' => $v)
+ );
+ }
+
+ //
+ // Border styles
+ //
+ foreach ( $border_style as $k => $v )
+ {
+ $tpl->assign_block_vars('table_border_style_row', array(
+ 'VALUE' => $v,
+ 'SELECTED' => ( $this->style['table_border_style'] == $v ) ? ' selected="selected"' : '',
+ 'OPTION' => $v)
+ );
+ $tpl->assign_block_vars('input_border_style_row', array(
+ 'VALUE' => $v,
+ 'SELECTED' => ( $this->style['input_border_style'] == $v ) ? ' selected="selected"' : '',
+ 'OPTION' => $v)
+ );
+ }
+
+ //
+ // Attendees columns
+ //
+ for ( $i = 1; $i < 11; $i++)
+ {
+ $tpl->assign_block_vars('attendees_columns_row', array(
+ 'VALUE' => $i,
+ 'SELECTED' => ( $this->style['attendees_columns'] == $i ) ? ' selected="selected"' : '',
+ 'OPTION' => $i)
+ );
+ }
+
+ $tpl->assign_vars(array(
+ // Form vars
+ 'F_ADD_STYLE' => 'styles.php' . $SID,
+ 'STYLE_ID' => $this->url_id,
+
+ // Form Values
+ 'STYLE_NAME' => $this->style['style_name'],
+ 'BODY_BACKGROUND' => $this->style['body_background'],
+ 'BODY_LINK' => $this->style['body_link'],
+ 'BODY_HLINK' => $this->style['body_hlink'],
+ 'HEADER_LINK' => $this->style['header_link'],
+ 'HEADER_HLINK' => $this->style['header_hlink'],
+ 'TR_COLOR1' => $this->style['tr_color1'],
+ 'TR_COLOR2' => $this->style['tr_color2'],
+ 'TH_COLOR1' => $this->style['th_color1'],
+ 'FONTFACE1' => $this->style['fontface1'],
+ 'FONTFACE2' => $this->style['fontface2'],
+ 'FONTFACE3' => $this->style['fontface3'],
+ 'FONTSIZE1' => $this->style['fontsize1'],
+ 'FONTSIZE2' => $this->style['fontsize2'],
+ 'FONTSIZE3' => $this->style['fontsize3'],
+ 'FONTCOLOR1' => $this->style['fontcolor1'],
+ 'FONTCOLOR2' => $this->style['fontcolor2'],
+ 'FONTCOLOR3' => $this->style['fontcolor3'],
+ 'FONTCOLOR_NEG' => $this->style['fontcolor_neg'],
+ 'FONTCOLOR_POS' => $this->style['fontcolor_pos'],
+ 'TABLE_BORDER_WIDTH' => $this->style['table_border_width'],
+ 'TABLE_BORDER_COLOR' => $this->style['table_border_color'],
+ 'TABLE_BORDER_STYLE' => $this->style['table_border_style'],
+ 'INPUT_COLOR' => $this->style['input_color'],
+ 'INPUT_BORDER_WIDTH' => $this->style['input_border_width'],
+ 'INPUT_BORDER_COLOR' => $this->style['input_border_color'],
+ 'INPUT_BORDER_STYLE' => $this->style['input_border_style'],
+ 'DATE_NOTIME_LONG' => $this->style['date_notime_long'],
+ 'DATE_NOTIME_SHORT' => $this->style['date_notime_short'],
+ 'DATE_TIME' => $this->style['date_time'],
+ 'STYLE_LOGO_PATH' => $this->style['logo_path'],
+
+ // Language
+ 'L_STYLE_SETTINGS' => $user->lang['style_settings'],
+ 'L_STYLE_NAME' => $user->lang['style_name'],
+ 'L_TEMPLATE' => $user->lang['template'],
+ 'L_ELEMENT' => $user->lang['element'],
+ 'L_VALUE' => $user->lang['value'],
+ 'L_BACKGROUND_COLOR' => $user->lang['background_color'],
+ 'L_FONTFACE1' => $user->lang['fontface1'],
+ 'L_FONTFACE1_NOTE' => $user->lang['fontface1_note'],
+ 'L_FONTFACE2' => $user->lang['fontface2'],
+ 'L_FONTFACE2_NOTE' => $user->lang['fontface2_note'],
+ 'L_FONTFACE3' => $user->lang['fontface3'],
+ 'L_FONTFACE3_NOTE' => $user->lang['fontface3_note'],
+ 'L_FONTSIZE1' => $user->lang['fontsize1'],
+ 'L_FONTSIZE1_NOTE' => $user->lang['fontsize1_note'],
+ 'L_FONTSIZE2' => $user->lang['fontsize2'],
+ 'L_FONTSIZE2_NOTE' => $user->lang['fontsize2_note'],
+ 'L_FONTSIZE3' => $user->lang['fontsize3'],
+ 'L_FONTSIZE3_NOTE' => $user->lang['fontsize3_note'],
+ 'L_FONTCOLOR1' => $user->lang['fontcolor1'],
+ 'L_FONTCOLOR1_NOTE' => $user->lang['fontcolor1_note'],
+ 'L_FONTCOLOR2' => $user->lang['fontcolor2'],
+ 'L_FONTCOLOR2_NOTE' => $user->lang['fontcolor2_note'],
+ 'L_FONTCOLOR3' => $user->lang['fontcolor3'],
+ 'L_FONTCOLOR3_NOTE' => $user->lang['fontcolor3_note'],
+ 'L_FONTCOLOR_NEG' => $user->lang['fontcolor_neg'],
+ 'L_FONTCOLOR_NEG_NOTE' => $user->lang['fontcolor_neg_note'],
+ 'L_FONTCOLOR_POS' => $user->lang['fontcolor_pos'],
+ 'L_FONTCOLOR_POS_NOTE' => $user->lang['fontcolor_pos_note'],
+ 'L_BODY_LINK' => $user->lang['body_link'],
+ 'L_BODY_LINK_STYLE' => $user->lang['body_link_style'],
+ 'L_BODY_HLINK' => $user->lang['body_hlink'],
+ 'L_BODY_HLINK_STYLE' => $user->lang['body_hlink_style'],
+ 'L_HEADER_LINK' => $user->lang['header_link'],
+ 'L_HEADER_LINK_STYLE' => $user->lang['header_link_style'],
+ 'L_HEADER_HLINK' => $user->lang['header_hlink'],
+ 'L_HEADER_HLINK_STYLE' => $user->lang['header_hlink_style'],
+ 'L_TR_COLOR1' => $user->lang['tr_color1'],
+ 'L_TR_COLOR2' => $user->lang['tr_color2'],
+ 'L_TH_COLOR1' => $user->lang['th_color1'],
+ 'L_TABLE_BORDER_WIDTH' => $user->lang['table_border_width'],
+ 'L_TABLE_BORDER_COLOR' => $user->lang['table_border_color'],
+ 'L_TABLE_BORDER_STYLE' => $user->lang['table_border_style'],
+ 'L_INPUT_COLOR' => $user->lang['input_color'],
+ 'L_INPUT_BORDER_WIDTH' => $user->lang['input_border_width'],
+ 'L_INPUT_BORDER_COLOR' => $user->lang['input_border_color'],
+ 'L_INPUT_BORDER_STYLE' => $user->lang['input_border_style'],
+ 'L_STYLE_CONFIGURATION' => $user->lang['style_configuration'],
+ 'L_STYLE_DATE_NOTE' => $user->lang['style_date_note'],
+ 'L_ATTENDEES_COLUMNS' => $user->lang['attendees_columns'],
+ 'L_ATTENDEES_COLUMNS_NOTE' => $user->lang['attendees_columns_note'],
+ 'L_DATE_NOTIME_LONG' => $user->lang['date_notime_long'],
+ 'L_DATE_NOTIME_SHORT' => $user->lang['date_notime_short'],
+ 'L_DATE_TIME' => $user->lang['date_time'],
+ 'L_LOGO_PATH' => $user->lang['logo_path'],
+ 'L_ADD_STYLE' => $user->lang['add_style'],
+ 'L_RESET' => $user->lang['reset'],
+ 'L_UPDATE_STYLE' => $user->lang['update_style'],
+ 'L_DELETE_STYLE' => $user->lang['delete_style'],
+
+ // Buttons
+ 'S_ADD' => ( !$this->url_id ) ? true : false)
+ );
+
+ $eqdkp->set_vars(array(
+ 'page_title' => sprintf($user->lang['admin_title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']).': '.$user->lang['styles_title'],
+ 'template_file' => 'admin/addstyle.html',
+ 'display' => true)
+ );
+ }
+}
+
+$manage_styles = new Manage_Styles;
+$manage_styles->process();
+?>
diff --git a/admin/vps-net-120x60-01.png b/admin/vps-net-120x60-01.png
new file mode 100644
index 0000000..861ef2b
--- /dev/null
+++ b/admin/vps-net-120x60-01.png
Binary files differ