CryptHome


Where The Dead Will Rise
It is currently December 10th, 2019, 9:46 am

All times are UTC - 5 hours [ DST ]





Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Aion Amory BBCode for phpbb 3.x
PostPosted: December 7th, 2011, 4:03 pm 
Offline
Site Admin
Site Admin
User avatar
 Personal album  WWW  ICQ  YIM  Profile

Joined: April 19th, 2006, 8:45 am
Posts: 727
Location: Indiana
Highscores: 173
Gender: Male
Aion Amory BBCode for phpbb 3.x
Hello

this time i will share a small aion amory bbcode for your phpbb3.x forums

ok let´s go

Open: styles//template/overall_header.php

Find

Tip : This may be a partial find and not the whole line.

Code:
/head>


Add before
Tip: Add these lines on a new blank line before the preceding line(s) to find.

Code:
script src="http://www.aionarmory.com/js/extooltips.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" media="all" href="/aionarmory/armory.css"/>


Open: includes/message_parser.php

Find
Tip: This may be a partial find and not the whole line.

Code:
'flash'         => array('bbcode_id' => 11,   'regexp' => array('#\[flash=([0-9]+),([0-9]+)\](.*?)\[/flash\]#ie' => "\$this->bbcode_flash('\$1', '\$2', '\$3')")


Replace With
Tip: Replace the preceding line(s) to find with the following lines.

Code:
'flash'         => array('bbcode_id' => 11,   'regexp' => array('#\[flash=([0-9]+),([0-9]+)\](.*?)\[/flash\]#ie' => "\$this->bbcode_flash('\$1', '\$2', '\$3')")),
 
         // Aion-Armory
 
         'item'         => array('bbcode_id' => 13,   'regexp' => array('#\[item=?(.*?)?\](.*?)\[/item\]#ie' => "\$this->bbcode_item('\$1', '\$2')")),
         'spell'         => array('bbcode_id' => 14,   'regexp' => array('#\[spell=?(.*?)?\](.*?)\[/spell\]#ie' => "\$this->bbcode_spell('\$1', '\$2')")),
         'recipe'      => array('bbcode_id' => 15,   'regexp' => array('#\[recipe=?(.*?)?\](.*?)\[/recipe\]#ie' => "\$this->bbcode_recipe('\$1', '\$2')"))


Find
Tip: This may be a partial find and not the whole line.

Code:
return '[i:' . $this->bbcode_uid . ']' . $in . '[/i:' . $this->bbcode_uid . ']';
   }


Add after
Tip: Add these lines on a new blank line after the preceding line(s) to find.

Code:
/**
   * Parse Aion-Armory tags
   */
   function bbcode_item($modifier, $in)
   {
      if (!$this->check_bbcode('item', $in))
         return $in;
 
      if ($modifier)
         return '[item=' . $modifier . ':' . $this->bbcode_uid . ']' . $in . '[/item:' . $this->bbcode_uid . ']';
      else
         return '[item:' . $this->bbcode_uid . ']' . $in . '[/item:' . $this->bbcode_uid . ']';
   }
 
   function bbcode_spell($modifier, $in)
   {
      if (!$this->check_bbcode('spell', $in))
         return $in;
 
      if ($modifier)
         return '[spell=' . $modifier . ':' . $this->bbcode_uid . ']' . $in . '[/spell:' . $this->bbcode_uid . ']';
      else
         return '[spell:' . $this->bbcode_uid . ']' . $in . '[/spell:' . $this->bbcode_uid . ']';
   }
 
   function bbcode_recipe($modifier, $in)
   {
      if (!$this->check_bbcode('recipe', $in))
         return $in;
 
      if ($modifier)
         return '[recipe=' . $modifier . ':' . $this->bbcode_uid . ']' . $in . '[/recipe:' . $this->bbcode_uid . ']';
      else
         return '[recipe:' . $this->bbcode_uid . ']' . $in . '[/recipe:' . $this->bbcode_uid . ']';
   }


Open: includes/bbcode.php

Find
Tip: This may be a partial find and not the whole line.

Code:
case 12:
               $this->bbcode_cache[$bbcode_id] = array(
                  'str'   => array(
                     '[/attachment:$uid]'   => $this->bbcode_tpl('inline_attachment_close', $bbcode_id)
                  ),
                  'preg'   => array(
                     '#\[attachment=([0-9]+):$uid\]#'   => $this->bbcode_tpl('inline_attachment_open', $bbcode_id)
                  )
               );
            break;



Add after
Tip: Add these lines on a new blank line after the preceding line(s) to find.

Code:
// Aion-Armory
 
            case 13:
               $this->bbcode_cache[$bbcode_id] = array(
                  'preg' => array(
                     '#\[item:$uid\]((.*?))\[/item:$uid\]#ise'            => "aionarmory_item(NULL, '\$1');",
                     '#\[item=([^\[]+):$uid\](.*?)\[/item:$uid\]#ise'      => "aionarmory_item('\$1', '\$2');"
                  )
               );
            break;
 
            case 14:
               $this->bbcode_cache[$bbcode_id] = array(
                  'preg' => array(
                     '#\[spell:$uid\]((.*?))\[/spell:$uid\]#ise'            => "aionarmory_spell(NULL, '\$1');",
                     '#\[spell=([^\[]+):$uid\](.*?)\[/spell:$uid\]#ise'      => "aionarmory_spell('\$1', '\$2');"
                  )
               );
            break;
 
            case 15:
               $this->bbcode_cache[$bbcode_id] = array(
                  'preg' => array(
                     '#\[recipe:$uid\]((.*?))\[/recipe:$uid\]#ise'            => "aionarmory_recipe(NULL, '\$1');",
                     '#\[recipe=([^\[]+):$uid\](.*?)\[/recipe:$uid\]#ise'      => "aionarmory_recipe('\$1', '\$2');"
                  )
               );
            break;


Open: includes/functions.php

Find
Tip: This may be a partial find and not the whole line.

Code:
?>


Add before
Tip: Add these lines on a new blank line before the preceding line(s) to find.

Code:
// Kryptyx - fetching function to get data
$fetch_method = 1; // 0 = file_get_contents; 1 = cURL (default)
function aionarmory_fetch($url, $use_curl)
{
   if ($use_curl)
   {
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);   
      $result = curl_exec($ch);   
      curl_close($ch);
      return $result;
   }
   else
   {
      return file_get_contents($url);
   }
}
 
 
// Aion-Armory
function aionarmory_getNameFromId($database, $type, $id)
{
   global $db;
   $result = $db->sql_query("SELECT * FROM `".$database."` WHERE `id` = '".$id."'");
   if ($row = $db->sql_fetchrow($result)) {
      if ($type == 1 || $type == 131) {
         return array("name" => $row['name'], "icon" => $row['icon'], "rarity" => $row['rarity']);
      } else {
         return array("name" => $row['name'], "icon" => $row['icon']);
      }
   } else {
      $name = aionarmory_fetch("http://www.aionarmory.com/ajaxIDLookup.aspx?type=".$type."&id=".$id, $fetch_method);
      if ($name)
      {
         $rarity = 0;
         $icon = 0;
         $result = aionarmory_fetch("http://www.aionarmory.com/ExTooltips.aspx?type=".$type."&id=".$id, $fetch_method);
         if ($result)
         {
            $result = preg_replace('/[^A-Z0-9\{\}\[\]\<\>\(\)\.\"\'\/\-\+\$\^\*&:_,=;%!@# ]/i', '', $result);
            preg_match('/,rarity:([0-9]+?),/i', $result, $rarity);
            $rarity = $rarity[1];
            preg_match('/,icon:([0-9]+?)[\}|,]/i', $result, $icon);
            $icon = $icon[1];
         }
         if ($type == 1 || $type== 131)   {
            $db->sql_query("INSERT INTO `".$database."` SET `name` = '".str_replace("'", "\'", $name)."', id = ".$id.", rarity = ".$rarity.", icon = ".$icon);
            return array("name" => $name, "icon" => $icon, "rarity" => $rarity);
         } else {
            $db->sql_query("INSERT INTO `".$database."` SET `name` = '".str_replace("'", "\'", $name)."', id = ".$id.", icon = ".$icon);
            return array("name" => $name, "icon" => $icon);
         }
      } else {
         return '';
      }
   }
   $db->sql_freeresult($result);
}
 
function aionarmory_getIdFromName($database, $type, $name)
{
   global $db;
   $result = $db->sql_query("SELECT * FROM `".$database."` WHERE `name` = '".str_replace("'", "\'", $name)."'");
   if ($row = $db->sql_fetchrow($result)) {
      if ($type == 1 || $type == 131) {
         return array("id" => $row['id'], "icon" => $row['icon'], "rarity" => $row['rarity']);
      } else {
         return array("id" => $row['id'], "icon" => $row['icon']);
      }
   } else {
      $rname = urlencode($name);
      $rname = str_replace('%26quot%3B','%22', $rname);
      $rname = str_replace('%26%23039%3B', '%27', $rname);
      $rname = str_replace('+','%20', $rname);
      $id = aionarmory_fetch("http://www.aionarmory.com/ajaxIDLookup.aspx?type=".$type."&name=".$rname, $fetch_method);
      if ($id)
      {         
         $rarity = 0;
         $icon = 0;
         $result = aionarmory_fetch("http://www.aionarmory.com/ExTooltips.aspx?type=".$type."&id=".$id, $fetch_method);
         if ($result)
         {
            $result = preg_replace('/[^A-Z0-9\{\}\[\]\<\>\(\)\.\"\'\/\-\+\$\^\*&:_,=;%!@# ]/i', '', $result);
            preg_match('/,rarity:([0-9]+?),/i', $result, $rarity);
            $rarity = $rarity[1];
            preg_match('/,icon:([0-9]+?)[\}|,]/i', $result, $icon);
            $icon = $icon[1];
         }
         if ($type == 1 || $type == 131) {
            $db->sql_query("INSERT INTO `".$database."` SET `name` = '".str_replace("'", "\'", $name)."', id = ".$id.", rarity = ".$rarity.", icon = ".$icon);
            return array("id" => $id, "icon" => $icon, "rarity" => $rarity);
         } else {
            $db->sql_query("INSERT INTO `".$database."` SET `name` = '".str_replace("'", "\'", $name)."', id = ".$id.", icon = ".$icon);
            return array("id" => $id, "icon" => $icon);
         }            
      } else {
         return 0;
      }
   }
   $db->sql_freeresult($result);
}
 
function aionarmory_item($modifier, $data)
{
   $modifier = strtolower($modifier);
   if ($modifier == NULL || ($modifier != 'text' && $modifier != 'icon' && $modifier != 'small' && $modifier != 'medium' && $modifier != 'large')) {
      $modifier = 'normal';
   }
 
   if ($data == '') {
      return '';
   }
 
   if (is_numeric($data)) {
      $id = $data;
      $fetch = aionarmory_getNameFromId('aionarmory_itemcache', 1, $id);
      $name = $fetch["name"];
      $rarity = $fetch["rarity"];
      $icon = $fetch["icon"];
   } else {
      $name = $data;
      $fetch = aionarmory_getIdFromName('aionarmory_itemcache', 1, $name);
      $id = $fetch["id"];
      $rarity = $fetch["rarity"];
      $icon = $fetch["icon"];
   }
 
   if ($id != 0 && $name != '') {
      switch ($modifier)
      {
         case "text":
            return '<a class="r'.$rarity.'" href="http://www.aionarmory.com/item.aspx?id='.$id.'" target="_blank">['.$name.']</a>';
         break;
 
         case "icon":
            return '<a class="r'.$rarity.'" href="http://www.aionarmory.com/item.aspx?id='.$id.'" target="_blank"><img src="http://www.aionarmory.com/icons/m/'.$icon.'.gif" class="aion_icon_only" alt="'.$name.'"></a>';
         break;
 
         case "small":
         case "medium":
         case "large":
            return '<a class="r'.$rarity.'" href="http://www.aionarmory.com/item.aspx?id='.$id.'" target="_blank"><img src="http://www.aionarmory.com/icons/'.substr(strtolower($modifier), 0, 1).'/'.$icon.'.gif" class="aion_icon_'.$modifier.'" alt="'.$name.'"> ['.$name.']</a>';
         break;
 
         default:
            return '<a class="r'.$rarity.'" href="http://www.aionarmory.com/item.aspx?id='.$id.'" target="_blank"><img src="http://www.aionarmory.com/icons/s/'.$icon.'.gif" class="aion_icon_normal" alt="'.$name.'"> ['.$name.']</a>';
         break;
      }
   }
   return $data;
}
 
function aionarmory_spell($modifier, $data)
{
   $modifier = strtolower($modifier);
   if ($modifier == NULL || ($modifier != 'text' && $modifier != 'icon' && $modifier != 'small' && $modifier != 'medium' && $modifier != 'large')) {
      $modifier = 'normal';
   }
 
   if ($data == '') {
      return '';
   }
 
   if (is_numeric($data)) {
      $id = $data;
      $fetch = aionarmory_getNameFromId('aionarmory_spellcache', 6, $id);
      $name = $fetch["name"];
      $icon = $fetch["icon"];      
   } else {
      $name = $data;
      $fetch = aionarmory_getIdFromName('aionarmory_spellcache', 6, $name);
      $id = $fetch["id"];
      $icon = $fetch["icon"];
   }
 
   if ($id != 0 && $name != '') {
      switch ($modifier) {
         case "text":
            return '<a class="aion_spell" href="http://www.aionarmory.com/spell.aspx?id='.$id.'" target="_blank">['.$name.']</a>';
         break;
 
         case "icon":
            return '<a class="aion_spell" href="http://www.aionarmory.com/spell.aspx?id='.$id.'" target="_blank"><img src="http://www.aionarmory.com/icons/m/'.$icon.'.gif" class="aion_icon_only" alt="'.$name.'"> ['.$name.']</a>';
         break;
 
         case "small":
         case "medium":
         case "large":
            return '<a class="aion_spell" href="http://www.aionarmory.com/spell.aspx?id='.$id.'" target="_blank"><img src="http://www.aionarmory.com/icons/'.substr(strtolower($modifier), 0, 1).'/'.$icon.'.gif" class="aion_icon_'.$modifier.'" alt="'.$name.'"> ['.$name.']</a>';
         break;
 
         default:
            return '<a class="aion_spell" href="http://www.aionarmory.com/spell.aspx?id='.$id.'" target="_blank"><img src="http://www.aionarmory.com/icons/s/'.$icon.'.gif" class="aion_icon_normal" alt="'.$name.'"> ['.$name.']</a>';
         break;
      }
   }
   return $data;
}
 
function aionarmory_recipe($modifier, $data)
{
   $modifier = strtolower($modifier);
   if ($modifier == NULL || ($modifier != 'text' && $modifier != 'icon' && $modifier != 'small' && $modifier != 'medium' && $modifier != 'large')) {
      $modifier = 'normal';
   }
 
   if ($data == '') {
      return '';
   }
 
   if (is_numeric($data)) {
      $id = $data;
      $fetch = aionarmory_getNameFromId('aionarmory_recipecache', 131, $id);
      $name = $fetch["name"];
      $rarity = $fetch["rarity"];
      $icon = $fetch["icon"];
   } else {
      $name = $data;
      $fetch = aionarmory_getIdFromName('aionarmory_recipecache', 131, $name);
      $id = $fetch["id"];
      $rarity = $fetch["rarity"];
      $icon = $fetch["icon"];
   }
 
   if ($id != 0 && $name != '') {
      switch ($modifier)
      {
         case "text":
            return '<a class="r'.$rarity.'" href="http://www.aionarmory.com/recipe.aspx?id='.$id.'" target="_blank">['.$name.']</a>';
         break;
 
         case "icon":
            return '<a class="r'.$rarity.'" href="http://www.aionarmory.com/recipe.aspx?id='.$id.'" target="_blank"><img src="http://www.aionarmory.com/icons/m/'.$icon.'.gif" class="aion_icon_only" alt="'.$name.'"></a>';
         break;
 
         case "small":
         case "medium":
         case "large":
            return '<a class="r'.$rarity.'" href="http://www.aionarmory.com/recipe.aspx?id='.$id.'" target="_blank"><img src="http://www.aionarmory.com/icons/'.substr(strtolower($modifier), 0, 1).'/'.$icon.'.gif" class="aion_icon_'.$modifier.'" alt="'.$name.'"> ['.$name.']</a>';
         break;
 
         default:
            return '<a class="r'.$rarity.'" href="http://www.aionarmory.com/recipe.aspx?id='.$id.'" target="_blank"><img src="http://www.aionarmory.com/icons/s/'.$icon.'.gif" class="aion_icon_normal" alt="'.$name.'"> ['.$name.']</a>';
         break;
      }
   }
   return $data;


DIY Instructions

These are manual instructions that cannot be performed automatically. You should follow these instructions carefully.

Code:
Add the following BBCode in your admin panel:

Usage:
[Item]{TEXT}[/Item]
 
HTML Replacement:
{TEXT}
 
Help Line:
Aion-Armory Item: [item]id or name[/item], [item=text]id or name[/item], [item=icon]id or name], [item=size]id or name[/item] (Valid sizes are small, medium and large).
 
Display on posting page:
YES

----------------------------------------------------------------------------

Usage:
[Spell]{TEXT}[/Spell]
 
HTML Replacement:
{TEXT}
 
Help Line:
Aion-Armory Spell: [spell]id or name[/spell], [spell=text]id or name[/spell], [spell=icon]id or name[/spell], [spell=size]id or name[/spell] (Valid sizes are small, medium and large).
 
Display on posting page:
YES

----------------------------------------------------------------------------

Usage:
[Recipe]{TEXT}[/Recipe]
 
HTML Replacement:
{TEXT}
 
Help Line:
Aion-Armory Recipe: [recipe]id or name[/recipe], [recipe=text]id or name[/recipe], [recipe=icon]id or name[/recipe], [recipe=size]id or name[/recipe] (Valid sizes are small, medium and large).
 
Display on posting page:
YES

----------------------------------------------------------------------------

Add the following SQL code to your database:
      
DROP TABLE IF EXISTS `aionarmory_itemcache`;
CREATE TABLE `aionarmory_itemcache` (
  `id` int(32) NOT NULL,
  `name` varchar(255) NOT NULL,
  `icon` int(32) NOT NULL,   
  `rarity` int(1) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
DROP TABLE IF EXISTS `aionarmory_spellcache`;
CREATE TABLE `aionarmory_spellcache` (
  `id` int(32) NOT NULL,
  `name` varchar(255) NOT NULL,
  `icon` int(32) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `aionarmory_recipecache`;
CREATE TABLE `aionarmory_recipecache` (
  `id` int(32) NOT NULL,
  `name` varchar(255) NOT NULL,
  `icon` int(32) NOT NULL,   
  `rarity` int(1) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


Save all files. End of MOD.

You have finished the installation for this MOD. Upload all changed files to your website. If the installation went bad, simply restore your backed up files.

_________________
Image


Top
Reply with quote  

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours [ DST ]



Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2006, 2007, 2008 phpbb group  
Design By phpBB