Fixed a bug where missing data appears linked to previous successfully linked item. The resulting browser-parsed text looks like this. It kept wrapping items inside items until it found another good item. The outermost set of brackets is the real link to the first epic item. The rest are the offwhite colored brackets assigned to nonexistent items.[Epic Item] - [[Not a real Item]] - [[[Another fake Item]]]
Also added support for changing bad item names to grey item instead of appearing as a standard css formatted url without brackets.
Anyway, here is the patch for a previously patched item stats system.--- post_proc.inc.t.orig 2009-03-08 13:31:37.000000000 -0600
+++ post_proc.inc.t 2009-03-19 02:00:21.000000000 -0600
@@ -346,6 +346,10 @@
if (!empty($item_link) && $item_link != "") {
$ostr_tmp = "<a class='forumitemlink' target='_blank' href='" . $item_link . "'>";
$end_tag_tmp = "</a>";
+ } else {
+ $item_link = 'http://www.faevictus.org/itemstats/updateitem.php?item=' . urlencode(urlencode($item_name));
+ $ostr_tmp = "<a class='forumitemlink' href='$item_link'>";
+ $end_tag_tmp = "</a>";
}
$item_tooltip = $item_stats->getItemTooltipHtmlBB($item_info);
$item_color = $item_info['item_color'];
Here is the full patch to post_proc.php.t--- post_proc.inc.t.dist 2007-04-15 17:04:24.000000000 -0600
+++ post_proc.inc.t 2009-03-19 02:52:01.000000000 -0600
@@ -323,6 +328,42 @@
}
$ostr .= '<a href="http://'.$parms.'wikipedia.com/wiki/'.$url.'" target="_blank" name="WikiPediaLink">';
break;
+ /* Begin WoW loot link support */
+ case 'item':
+ include_once $GLOBALS['WWW_ROOT_DISK'].'../itemstats/itemstats.php';
+ $item_stats = new ItemStats();
+ $param = substr($str, $epos+1, ($cpos-$epos)-1);
+ if (is_numeric(trim($param))) {
+ $item_id = trim($param);
+ $item_info = $item_stats->getItemInfoById($item_id, 1);
+ } else {
+ $item_name = trim($param);
+ $item_info = $item_stats->getItemInfo($item_name, 1);
+ }
+ $item_name = (!empty($item_info['item_name']) && $item_info['item_name'] != "") ? $item_info['item_name'] : $item_name;
+ $item_id = (!empty($item_info['item_id']) && $item_info['item_id'] != "") ? $item_info['item_id'] : 0;
+ $item_link = $item_info['item_link'];
+ if (!empty($item_link) && $item_link != "") {
+ $ostr_tmp = "<a class='forumitemlink' target='_blank' href='" . $item_link . "'>";
+ $end_tag_tmp = "</a>";
+ } else {
+ $item_link = '/itemstats/updateitem.php?item=' . urlencode(urlencode($item_name));
+ $ostr_tmp = "<a class='forumitemlink' target='_blank' href='" . $item_link . "'>";
+ $end_tag_tmp = "</a>";
+ }
+ $item_tooltip = $item_stats->getItemTooltipHtmlBB($item_info);
+ $item_color = $item_info['item_color'];
+ if (!empty($item_color) && $item_color != "") {
+ $ostr_tmp = $ostr_tmp . "<span class='" . $item_color . "' " . $item_tooltip . ">[";
+ $end_tag_tmp = "]</span>" . $end_tag_tmp;
+ } else {
+ $ostr_tmp = $ostr_tmp . "<span class='greyname' " . $item_tooltip . ">[";
+ $end_tag_tmp = "]</span>" . $end_tag_tmp;
+ }
+ $ostr = $ostr . $ostr_tmp;
+ $end_tag[$cpos] = $end_tag_tmp;
+ break;
+ /* End WoW loot link support */
}
$str[$pos] = '<';
@@ -563,6 +611,25 @@
$fudml = preg_replace('!<(o|u)l type="(.+?)">(.*?)</\\1l>!is', '[list type=\2]\3[/list]', $fudml);
}
+ /* Begin WoW loot link support */
+ /* Change item links first to avoid </span> -> [/notag] problem */
+ while (preg_match('!(.+?)onmouseover="[^"]+"(.+?)!is', $fudml)) {
+ $fudml = preg_replace('!(.+?)onmouseover="[^"]+"(.+?)!is', '\1\2', $fudml);
+ }
+ while (preg_match('!(.+?)onmouseout="[^"]+"(.+?)!is', $fudml)) {
+ $fudml = preg_replace('!(.+?)onmouseout="[^"]+"(.+?)!is', '\1\2', $fudml);
+ }
+ while (preg_match('!<a class=\'forumitemlink\' target=\'_blank\' href=\'.+?\'>.+</a>!is', $fudml)) {
+ $fudml = preg_replace('!<a class=\'forumitemlink\' target=\'_blank\' href=\'.+?\'>(.+?)</a>!is', '[item]\1[/item]', $fudml);
+ }
+ while (preg_match('!<a class=\'forumitemlink\' target=\'_blank\' href=\'.+?\'>.+</a>!is', $fudml)) {
+ $fudml = preg_replace('!<a class=\'forumitemlink\' target=\'_blank\' href=\'.+?\'>(.+?)</a>!is', '[item]\1[/item]', $fudml);
+ }
+ while (preg_match('!<span class=\'.+?name\'[^>]*>\[.+?\]</span>!is', $fudml)) {
+ $fudml = preg_replace('!<span class=\'.+?name\'[^>]*>\[(.+?)\]</span>!is', '\1', $fudml);
+ }
+ /* End WoW loot link support */
+
$fudml = str_replace(
array(
'<b>', '</b>', '<i>', '</i>', '<u>', '</u>', '<s>', '</s>', '<sub>', '</sub>', '<sup>', '</sup>', '<del>', '</del>',
[Updated on: Thu, 19 March 2009 09:44]
Report message to a moderator