On it's own http://x672.net/the-forgotten/modules/raid_tracker.php is working just fine but it's then I try to put it in a module on my front page on the kinship page www.x672.net/the-forgotten/ that I get the error (Database error in vBulletin 3.6.8:).
X672net_eqdkp, that's the database for our EQdkp page.
mst_thread is a table in our vbulletine database.
PHP Code:
<?php /****************************** * EQDKP HomepageTools 1.1.0 * (c) 2006 - 2007 by kompsoft media * Licensed under the GNU GPL. * See COPYING for full terms. * ------------------ * $Id: hptools.class.php 303 2007-06-17 23:18:43Z wallenium $ ******************************/
class HomepageTools{ function HomepageTools($et_host, $et_user, $et_pass, $et_database, $et_prefix, $config, $etlanguage){ $this->config = $config; $this->dbhost = $et_host; $this->dbuser = $et_user; $this->dbpass = $et_pass; $this->database = $et_database; $this->dbprefix = $et_prefix; $this->htlanguage = $etlanguage; }
/************************************ * Raidplan Event Tracker ************************************/
function event_tracker(){ setlocale (LC_TIME, $time['local']); $htdb = @mysql_pconnect($this->dbhost, $this->dbuser, $this->dbpass); if(!$htdb){ die($this->htlanguage['ht_no_data']); }
mysql_select_db($this->database); $etsql = "SELECT * FROM `".$this->dbprefix."raidplan_raids` WHERE raid_date > ".time()." ORDER BY `raid_date` ".$this->config['sort']." LIMIT ".$this->config['limit']; $results = mysql_query($etsql); $num_results = mysql_affected_rows(); if ($num_results == 0 || !$num_results){ return $this->htlanguage['ht_noraids']; } // stylesheet: $overlibpath = str_replace("/", "\/", $this->config['is_path']); $output = '<script> if(typeof(window.overlib) == "undefined") { document.write("<scr" + "ipt language=\'JavaScript\' type=\'text\/javascript\' src=\''.$overlibpath.'\/overlib\/overlib.js\'><\/scr" + "ipt>"); } </script>'; $output .= ("<link REL=StyleSheet HREF='".$this->config['ht_path']."/css/hptools.css' TYPE='text/css' MEDIA=screen />"); $output .= "<div id='raidtable'>"; $windowthingy = ($this->config['newwindow'] == 1) ? "target='blank'" : ""; for($i =0; $i<$num_results; $i++){ $row = mysql_fetch_array($results); // count the signed in members $sql_count = "SELECT count(*) FROM ".$this->dbprefix."raidplan_raid_attendees WHERE attendees_subscribed=1 AND raid_id=" . $row['raid_id']; if (!($count_result = mysql_query($sql_count))) { die($this->htlanguage['ht_error_noraid']); } $count_signin = mysql_fetch_array($count_result); // count the confirmed members $sql_count = "SELECT count(*) FROM ".$this->dbprefix."raidplan_raid_attendees WHERE attendees_subscribed=0 AND raid_id=" . $row['raid_id']; if (!($count_result = mysql_query($sql_count))) { die($this->htlanguage['ht_error_noraid']); } $count_confirmed = mysql_fetch_array($count_result); // count the signedout members $sql_count = "SELECT count(*) FROM ".$this->dbprefix."raidplan_raid_attendees WHERE attendees_subscribed=2 AND raid_id=" . $row['raid_id']; if (!($count_result = mysql_query($sql_count))) { die($this->htlanguage['ht_error_noraid']); } $count_signedout = mysql_fetch_array($count_result); // count the not shure members $sql_count = "SELECT count(*) FROM ".$this->dbprefix."raidplan_raid_attendees WHERE attendees_subscribed=3 AND raid_id=" . $row['raid_id']; if (!($count_result = mysql_query($sql_count))) { die($this->htlanguage['ht_error_noraid']); } $count_notshure = mysql_fetch_array($count_result); // count the total sum $tssql = "SELECT raid_attendees FROM `".$this->dbprefix."raidplan_raids` WHERE raid_id='".$row['raid_id']."'"; if (!($count_result = mysql_query($tssql))) { die($this->htlanguage['ht_error_noraid']); } $count_total = mysql_fetch_array($count_result); $count_summ = $count_confirmed[0] + $count_signin[0]; // overlib if($this->config['show_tooltip'] == 1){ $ht_overlib = "onmouseover=\"return overlib('<div class=\'httooltiphead\'>".$this->htlanguage['ht_information']."</div><div class=\'httooltipdiv\'>".$this->htlanguage['ht_note'].": ".$row['raid_note']."<br/>".$this->htlanguage['ht_raidleader'].": ".$row['raid_leader']."</div>',VAUTO,HAUTO,FULLHTML);\" onmouseout='return nd();'"; }else{ $ht_overlib = ""; } // Output $output .= " <a ".$windowthingy." href='".$this->config['url']."/plugins/raidplan/viewraid.php?r=". stripslashes($row['raid_id'])."' ".$ht_overlib." class='htlink_vr'>". stripslashes($row['raid_name']) ."</a> (<font class='summ'>".$count_summ."</font>/<font class='signedout'>".$count_signedout[0]."</font>/<font class='notshure'>".$count_notshure[0]."</font>/<font class='total'>".$count_total[0]."</font>)<br>"; $output .= "<div class='ht_time'>".strftime($this->config['strftime'], $row['raid_date'])."</div><br/>"; } if($this->config['other_table'] == 1){ mysql_close($htdb); } if($this->config['link_calendar'] == 1){ $output .= "<br/><center><a ".$windowthingy." href='".$this->config['url']."/plugins/raidplan/listraids.php' class='htlink_lr'>". $this->htlanguage['ht_raidsummery']."</a></center>"; } $output .= "</div>"; return $output; } /************************************ * Item Tracker ************************************/ function item_tracker(){ // debug thing to fetch all the stupid SQL Errors because of the EQDKP Plus globals if (!$dbhost or !$dbname or !$dbuser or !$dbpass){ $dbhost = $this->dbhost; $dbname = $this->database; $dbuser = $this->dbuser; $dbpass = $this->dbpass; $table_prefix = $this->dbprefix; $debug = 1; } // connect to database $htdb = @mysql_pconnect($this->dbhost, $this->dbuser, $this->dbpass); if(!$htdb){ die($this->htlanguage['ht_no_data']); } mysql_select_db($this->database); // if PLUS, get the image path if($this->config['is_plus'] == 1){ // Read the PLUS config $csql = 'SELECT * FROM '.$this->dbprefix.'plus_config'; if (!($settings_result = mysql_query($csql))) { die('Could not obtain configuration data'); } while($roww = mysql_fetch_array($settings_result)) { $conf_plus[$roww['config_name']] = $roww['config_value']; } define('ICON_STORE_LOCATION', $conf_plus['pk_is_icon_loc']); define('ICON_EXTENSION', $conf_plus['pk_is_icon_ext']); }
// after that, include the itemstats thing... // LOad Itemstats $ht_itemstats_file = $this->config['is_path']."/eqdkp_itemstats.php"; if (@file_exists($ht_itemstats_file)) { include_once($ht_itemstats_file); }else{ die($this->htlanguage['ht_no_itemstats']); } $content = ""; // init the content var setlocale (LC_TIME, $this->config['local']);
$isql = "SELECT MAX(item_date) as item_date, MAX(raid_id) as raid_id FROM ".$this->dbprefix."items"; $results = mysql_query($isql); $maxdate = @mysql_fetch_array($results); if (!$maxdate['item_date']){ return $this->htlanguage['ht_noitems']; } $startdate = ((floor($maxdate['item_date']/86400))*86400)-(($this->config['item_number']-1)*86400); $ssql = "SELECT i.*, r.raid_name, r.raid_date FROM ".$this->dbprefix."items i, ".$this->dbprefix."raids r WHERE i.raid_id = r.raid_id"; if ($this->config['limit_by'] == "days"){ $ssql .= " AND i.item_date >= ".$startdate; $ssql .= " AND i.item_date > 1"; $ssql .= " ORDER BY i.item_date ".$this->config['sort']; $ssql .= " LIMIT ".$this->config['item_number']; }elseif ($this->config['limit_by'] == "raid") { $ssql .= " AND i.raid_id >= ".floor(($maxdate['raid_id']-$this->config['item_number'])+1); $ssql .= " AND i.item_date > 1"; $ssql .= " ORDER BY i.item_date ".$this->config['sort']; } elseif ($this->config['limit_by'] == "items"){ $ssql .= " ORDER BY i.item_date ".$this->config['sort']; //$ssql .= " LIMIT ".$this->config['item_number']; } elseif ($this->config['limit_by'] == "dkp"){ $ssql .= " ORDER BY i.item_value ".$this->config['sort']; $ssql .= " LIMIT ".$this->config['item_number']; } $ssql .= ";";
$result = mysql_query($ssql); $currentraid = 0; $content .= "<link REL=StyleSheet HREF='".$this->config['is_path']."/templates/itemstats.css' TYPE='text/css' MEDIA=screen />"; $overlibpath = str_replace("/", "\/", $this->config['is_path']); $content .= '<script> if(typeof(window.overlib) == "undefined") { document.write("<scr" + "ipt language=\'JavaScript\' type=\'text\/javascript\' src=\''.$overlibpath.'\/overlib\/overlib.js\'><\/scr" + "ipt>"); } </script>'; $content .= ("<link REL=StyleSheet HREF='".$this->config['ht_path']."/css/hptools.css' TYPE='text/css' MEDIA=screen />"); $content .= "<div id='itemtable'>"; // Start the content layout in the block if($this->config['showDKP'] == 1){ // get the name of the points saved in eqdkp database $dkpsql = "SELECT config_value FROM ".$this->dbprefix."config WHERE config_name='dkp_name'"; $dkp_results = mysql_query($dkpsql); $dkppname = @mysql_fetch_array($dkp_results); } //Check for Item Color and only displays based on variable above $item_stats = new ItemStats(); if (!$item_stats){ echo "Error with Itemstats"; break; } $itemarray = array(); $ii = 1; while($ii <= $this->config['item_number']){ $row = mysql_fetch_array($result); $item_color = $item_stats->getItemColor($row['item_name']); switch ($item_color) { case "greyname": $itemlevel=0; break; case "whitename": $itemlevel=0; break; case "greenname": $itemlevel=1; break; case "bluename": $itemlevel=2; break; default: $itemlevel=3; } if ($itemlevel > $this->config['uberloot'] && isset($row['item_name'])) { $itemarray[$row['item_id']] = array( 'item_name' => $row['item_name'], 'raid_id' => $row['raid_id'], 'raid_date' => $row['raid_date'], 'raid_name' => $row['raid_name'], 'item_value' => $row['item_value'], 'item_buyer' => $row['item_buyer'], 'item_level' => $itemlevel, 'item_color' => $item_color, ); $ii++; } } // end while foreach ($itemarray as $itemid => $itembody) { $content .= "<div class='itemrow'>"; // Print the Raid Name if new raid If ($currentraid <> $itembody['raid_id']){ if ($this->config['showheader'] == 1 and $itembody['raid_date'] > 1){ If ($this->config['showdays'] == 0) { $content .= "<div class='itemraid'><a href='".$this->config['url']."/viewraid.php?s=&r=".$itembody['raid_id']."' target=blank ><img src='".$this->config['is_img_path']."img/lastpost.gif' /></a>".$itembody['raid_name']."</div>"; } else { $content .= "<div class='itemraid'><a href='".$this->config['url']."/viewraid.php?s=&r=".$itembody['raid_id']."' target=blank ><img src='".$this->config['is_img_path']."img/lastpost.gif' /></a>".$itembody['raid_name']." ".strftime($this->config['strftime'],$itembody['raid_date'])."</div>"; } } $currentraid = $itembody['raid_id']; } if($this->config['showDKP'] == 1){ // get the name of the points saved in eqdkp database $dkpvalue = "(".round($itembody['item_value'])." ".$dkppname['config_value'].")"; } else { $dkpvalue = ""; }
// Passes the item name to the itemstats file for parsing and formatting if ($this->config['linkitem'] == 1) { $windowthingy = ($this->config['newwindow'] == 1) ? "target='blank'" : ""; if ($this->config['textcolor'] == 1){ $itemcontentthingy = "<span class='".$itembody['item_color']."'>".$itembody['item_name']."</span>"; }else{ $itemcontentthingy = itemstats_decorate_name($itembody['item_name']); } $content .= "<a ".$windowthingy." href='".$this->config['url']."/viewitem.php?i=".$itemid."'>".$itemcontentthingy."</a>"; } else { $content .= itemstats_decorate_name($itembody['item_name']); } // Displays the winner of the item if ($this->config['showwinner'] == 1) { $content .="<div class='itemwinner'>".$this->htlanguage['ht_wonby'].": <a href='".$this->config['url']."/viewmember.php?s=&name=".$itembody['item_buyer']."' target=blank >".$itembody['item_buyer']."</a> ".$dkpvalue."</div>"; }else { $content .= "<div class='itemwinner'>".$dkpvalue."</div>"; } $content .= "</div>"; }//end foreach
$content .= "</div>"; if($this->config['other_table'] == 1){ mysql_close($htdb); }; return $content; } /************************************ * Boss Tracker (written by Bigdaddy) ************************************/
function boss_tracker(){ $htdb = @mysql_connect($this->dbhost, $this->dbuser, $this->dbpass); if(!$htdb){ die($this->htlanguage['ht_no_data']); } mysql_select_db($this->database); $bsql = "SELECT config_name FROM ".$this->dbprefix."bc_config WHERE config_value=1"; $result = mysql_query($bsql); $progress = "<div id='bosstable'>"; //init Progress while($row = mysql_fetch_array($result)){ $zone = split('[_]', $row[0]);; $pz_search = "pz_".$zone[1]; $pz_sql = "SELECT config_value FROM ".$this->dbprefix."bb_config WHERE config_name='$pz_search'"; $pz_result = mysql_query($pz_sql); while($pz_row = mysql_fetch_array($pz_result)){ $pz_name1 = explode(", ", $pz_row[0]); $pz_name = substr($pz_name1[0],1,(strlen($pz_name1[0])-2)); $progress .= "<div class='ht_pz_name'>".$pz_name."</div>"; Switch($zone[1]){ Default: $pb_search = array();break; Case "kara": $pb_search = array("pb_attumen","pb_moroes","pb_maiden","pb_opera","pb_curator","pb_illhoof","pb_aran","pb_chess","pb_netherspite","pb_malchezaar","pb_nightbane");break; Case "maglair": $pb_search = array("pb_magtheridon");break; Case "gruuls": $pb_search = array("pb_maulgar","pb_gruul");break; Case "serpent": $pb_search = array("pb_hydross","pb_karathress","pb_morogrim","pb_leotheras","pb_lurker","pb_vashj");break; Case "eye": $pb_search = array("pb_alar","pb_vreaver","pb_solarian","pb_kaelthas");break; Case "hyjal": $pb_search = array("pb_winterchill","pb_anetheron","pb_kazrogal","pb_azgalor","pb_archimonde");break; Case "temple": $pb_search = array("pb_najentus","pb_supremus","pb_akama","pb_gorefiend","pb_essence","pb_bloodboil","pb_shahraz","pb_council","pb_illidan");break; } for($i = 0; $i < count($pb_search); $i++) { $pb_sql = "SELECT config_value FROM ".$this->dbprefix."bb_config WHERE config_name='$pb_search[$i]'"; $pb_result = mysql_query($pb_sql); while($pb_row = mysql_fetch_array($pb_result)){ $pb_name1 = explode(", ", $pb_row[0]); $pb_name = substr($pb_name1[0],1,(strlen($pb_name1[0])-2)); $progress .= "<div class='ht_ps_name'>".$pb_name." "; $count = 0; // Count init for($_i = 0; $_i < count($pb_name1); $_i++) { // Hier muss dann gez?hlt werden..... $_sql = "SELECT * FROM ".$this->dbprefix."raids WHERE raid_note=$pb_name1[$_i]"; $_result = mysql_query($_sql); $count += @mysql_num_rows($_result); } if($this->config['view_kill_times'] == 1) { $progress .= $count."x</div>"; }else{ if($count > 0) { $progress .= "<div class='ht_progress_down'>".$this->htlanguage['ht_bt_down']."</div>"; }else{ $progress .= "<div class='ht_progress_waiting'>".$this->htlanguage['ht_bt_waiting']."</div>"; } } } } } } if($this->config['other_table'] == 1){ mysql_close($htdb); } $progress .= "</div>"; return $progress; } } ?>
|