function explode_assoc_r2($string = null, $inner_glue = INNER_GLUE, $outer_glue = OUTER_GLUE, $recusion_level = 0) { $output = array(); $array = explode($outer_glue . $recusion_level . $outer_glue, $string); foreach ($array as $value) { $row = explode($inner_glue . $recusion_level . $inner_glue, $value); $output[$row[0]] = $row[1]; $level = $recusion_level + 1; if (strpos($output[$row[0]], $inner_glue . $level . $inner_glue)) { $output[$row[0]] = explode_assoc_r2($output[$row[0]], $inner_glue, $outer_glue, $level); } } return $output; }
} // Grab all events from the post and shove them into the players array if (isset($_POST['eventsarray'])) { $events = urldecode($_POST['eventsarray']); $events = explode_assoc_r2($events); foreach ($events as $playerkey => $event) { foreach ($event as $playereventkey => $playerevent) { $players[$playerkey]['events'][$playereventkey] = $playerevent; } } } // Grab all looted items and look for changed DKP value. // Also if a player was charged for the item looted, make an event in the players array if (isset($_POST['lootarray'])) { $loot = urldecode($_POST['lootarray']); $loot = explode_assoc_r2($loot); } // Get DKP and player info, and insert that into the item array. // Make a box for the output $output .= border("spurple", 'start', "<span style=\"color: lightgreen; font-size: 10pt; font-weight: bold;\">Inserting Looted Items</span>"); $output .= "<table><tr><td class=\"membersHeader\">DB Item ID</td><td class=\"membersHeader\">Item</td><td class=\"membersHeader\">Looted From</td><td class=\"membersHeader\">Looter</td><td class=\"membersHeader\">DKP Value</td></tr>\n"; $row = 1; foreach ($loot as $lootkey => $lootval) { // DKP Info if (isset($_POST['loot'][$lootkey])) { $loot[$lootkey]['dkp_value'] = $_POST['loot'][$lootkey]['dkp_realvalue']; $loot[$lootkey]['type'] = $_POST['loot'][$lootkey]['charge']; } else { $loot[$lootkey]['dkp_value'] = ''; $loot[$lootkey]['type'] = 'bank'; }