All pastes #126231 Raw Edit

dth

public php v1 · immutable
·published 2006-08-11 08:08 UTC
rendered paste body
<?  if (!defined('IN_DMDB')) exit;    include_once(dirname(__FILE__).'/../localisation/'.$config['localisation'].'/loc.dmparser.php');    define("DMPARSER_STATE_DEFAULT",1);  define("DMPARSER_STATE_INPLAYER",2);  define("DMPARSER_STATE_INTYPE",3);    class class_dmparser {    var $preg_match_playerstart;    var $preg_match_typestart;        function class_dmparser() {      $this->preg_match_playerstart = '/^\s*\d+: (\w+):\s*$/';      $this->preg_match_typestart = '/^\s*(\w[^=]+) = \d+ \(\d+\.\d%\) #\d+\s*$/U';    }        function parse_dm_to_dmdb($str_dmdata, $str_raidtitle, $int_raidstart, $int_raidstop) {      $int_state = DMPARSER_STATE_DEFAULT;      $str_currentplayer = '';      $int_currenttype = '';      $arr_dmdata = @explode("\n",$str_dmdata);                  while ( list($int_idx,$str_dmdataline) = @each($arr_dmdata) ) {        $str_dmdataline = trim($str_dmdataline);        switch ($int_state) {          case DMPARSER_STATE_DEFAULT:            if ( preg_match($this->preg_match_playerstart,$str_dmdataline,$arr_pregmatch) ) {              $int_state = DMPARSER_STATE_INPLAYER;              $str_currentplayer = $arr_pregmatch[1];            }          break;          case DMPARSER_STATE_INPLAYER:            if ( preg_match($this->preg_match_typestart,$str_dmdataline,$arr_pregmatch) ) {               $int_state = DMPARSER_STATE_INTYPE;              switch ( strtolower($arr_pregmatch[1]) ) {                case DMDB_TYPE_DAMAGE_DONE:				  $int_currenttype = DMDB_TYPE_DAMAGE_DONE;                case DMDB_TYPE_HEALING_DONE:v				  $int_currenttype = DMDB_TYPE_HEALING_DONE;                case DMDB_TYPE_DAMAGE_RECV:				  $int_currenttype = DMDB_TYPE_DAMAGE_RECV;                case DMDB_TYPE_HEALING_RECV:				  $int_currenttype = DMDB_TYPE_HEALING_RECV;                case DMDB_TYPE_DECURSE_DONE:				  $int_currenttype = DMDB_TYPE_DECURSE_DONE;                case DMDB_TYPE_OVERHEAL:				  $int_currenttype = DMDB_TYPE_OVERHEAL;                case DMDB_TYPE_ABS_HEALING:				  $int_currenttype = DMDB_TYPE_ABS_HEALING;				default:				  dmdb_error_exit("type did not match any localisation-data.",__CLASS__,__FILE__,__LINE__,__FUNCTION__);			  }            }          break;        }      }        }  }?>