Code:
<?php
/*=======================================================================
| UberCMS - Advanced Website and Content Management System for uberEmu
| #######################################################################
| Copyright (c) 2010, Roy 'Meth0d' and updates by Matthew 'MDK'
| http://www.meth0d.org & http://www.sulake.biz
| #######################################################################
| This program is free software: you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation, either version 3 of the License, or
| (at your option) any later version.
| #######################################################################
| This program is distributed in the hope that it will be useful,
| but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
| GNU General Public License for more details.
\======================================================================*/
if (!defined('IN_HK') || !IN_HK)
{
exit;
}
if (!HK_LOGGED_IN || !$users->hasFuse(HK_USER_ID, 'fuse_housekeeping_catalog'))
{
exit;
}
require_once "top.php";
echo '<h1>Add new furni</h1>';
echo '<p>This tool you can add new furnis..</p><br />';
echo '<p><input type="button" value="Add new furni" onclick="window.location = \'index.php?_cmd=newfurni&add=true\';"></p><br />';
if (isset($_GET['add']))
{
$whatWeKnow = Array();
$getWhatWeKnow = dbquery("SELECT item_name FROM items_base");
$counterid = mysql_result(dbquery("SELECT max(item_id) FROM items_base"), 0) + 1;
while ($g = mysql_fetch_assoc($getWhatWeKnow))
{
$whatWeKnow[] = $g['item_name'];
}
$data = file_get_contents("http://www.habbo.fi/gamedata/furnidata?hash=x");
$data = str_replace("\n", "", $data);
$data = str_replace("[[", "[", $data);
$data = str_replace("]]", "]", $data);
$data = str_replace("][", "],[", $data);
$ij = 0;
$stuffWeDontKnow = Array();
$catsql = "";
$itemsql = "";
foreach (explode('],[', $data) as $val)
{
$val = str_replace('[', '', $val);
$val = str_replace(']', '', $val);
$bits = explode(',', $val);
$name = str_replace('"', '', $bits[2]);
$revision = str_replace('"', '', $bits[3]);
$spriteid = str_replace('"', '', $bits[1]);
$length = str_replace('"', '', $bits[6]);
$interactor = "default";
$height = "1.00";
$astack = "0";
$asit = "0";
$awalk = "0";
$modes = "0";
$width = str_replace('"', '', $bits[5]);
$pname = str_replace('"', '', $bits[8]);
$type = str_replace('"', '', $bits[0]);
if (in_array($name, $whatWeKnow))
{
continue;
}
if (strpos($name, 'prizetrophy') !== false)
{
continue;
}
else if (strpos($name, 'noob_') !== false)
{
continue;
}
else if (strpos($name, 'greektrophy') !== false)
{
continue;
}
else if (strpos($name, 'present_wrap') !== false)
{
continue;
}
else if (strpos($name, 'floortile') !== false)
{
continue;
}
else if (strpos($name, 'wallpaper') !== false)
{
continue;
}
else if (strpos($name, 'post_it') !== false)
{
continue;
}
else if ($name == 'camera')
{
continue;
}
else if ($name == 'prize1')
{
continue;
}
else if ($name == 'prize2')
{
continue;
}
else if ($name == 'prize3')
{
continue;
}
else if ($name == 'bolly_palm')
{
continue;
}
else if ($name == 'footylamp_campaign')
{
continue;
}
else if ($name == 'rare_parasol')
{
continue;
}
else if ($name == 'hw08_xray')
{
continue;
}
else if ($name == 'CFC_10_coin_bronze')
{
continue;
}
else if ($name == 'soft_jaggara_norja')
{
continue;
}
else if (strpos($name, 'plasto') !== false)
{
continue;
}
else if ($name == 'kinkysofa')
{
continue;
}
else if ($name == 'ticket')
{
continue;
}
else if ($name == 'photo')
{
continue;
}
else if ($name == 'Chess')
{
continue;
}
else if ($name == 'TicTacToe')
{
continue;
}
else if ($name == 'BattleShip')
{
continue;
}
else if ($name == 'Poker')
{
continue;
}
else if ($name == 'floor')
{
continue;
}
else if ($name == 'poster')
{
continue;
}
else if ($name == 'landscape')
{
continue;
}
else if ($name == 'xmas_icewall')
{
continue;
}
else if ($name == 'sf_wall')
{
continue;
}
else if ($name == 'xm09_frplc')
{
continue;
}
else if ($name == 'ads_idol_chmpgn')
{
continue;
}
else if ($name == 'md_sofa')
{
continue;
}
else if ($name == '')
{
continue;
}
if (strpos($name,"gate") == true)
{
$interactor = "gate";
$height = "0.01";
}
else if (strpos($name,"dice") == true)
{
$interactor = "dice";
}
else if (strpos($name,"hopper") == true)
{
$interactor = "teleport";
$height = "0.01";
}
else if (strpos($name,"tele") == true)
{
$interactor = "teleport";
$height = "0.01";
}
else if (strpos($name,"table") == true)
{
$interactor = "default";
$height = "1.00";
$astack = "1";
}
else if (strpos($name,"bed") == true)
{
$interactor = "bed";
$height = "1.25";
}
else if (strpos($name,"chair") == true)
{
$asit = "1";
}
else if (strpos($name,"mat") == true)
{
$awalk = "1";
$height = "0.01";
}
else if (strpos($name,"rug") == true)
{
$awalk = "1";
$height = "0.01";
}
else if (strpos($name,"floor") == true)
{
$awalk = "1";
$height = "0.01";
}
else if (strpos($name,"throne") == true)
{
$asit = "1";
}
else if (strpos($name,"patch") == true)
{
$awalk = "1";
$astack = "1";
$height = "0.01";
}
else if (strpos($name,"lamp") == true)
{
$modes = "2";
}
else if (strpos($name,"sofa") == true)
{
$asit = "1";
}
$stuffWeDontKnow[] = '[' . $val . ']';
$ij++;
$itemsql = $itemsql . "INSERT INTO `items_base` (`item_id`, `sprite_id`, `public_name`, `item_name`, `type`, `width`, `length`, `height`, `allow_stack`, `allow_walk`, `allow_sit`, `allow_recycle`, `allow_trade`, `allow_marketplace_sell`, `allow_gift`, `allow_inventory_stack`, `interaction_type`, `cycle_count`, `vending_ids`) VALUES ('" . $counterid ."', '" . $spriteid . "', '" . $name . "', '" . $name . "', '" . $type . "', '" . $width . "', '" . $length . "', '" . $height . "', '" . $astack . "', '" . $awalk . "', '" . $asit . "', '1', '1', '1', '1', '1', '" . $interactor . "', '" . $modes . "', '0');\n";
$catsql = $catsql . "INSERT INTO `catalog_items` (`page_id`, `item_ids`, `catalog_name`, `cost_credits`, `cost_pixels`, `amount`, `cost_crystal`, `cost_oude_belcredits`, `song_id`) VALUES ('926', '" . $counterid . "', '" . $name . "', '3', '0', '1', '0', '0', '0');\r";
$counterid++;
}
echo '<h2>Uusia tavaroita (' . $ij . ')</h2><br />';
// if ($ij >= 1)
// {
foreach ($stuffWeDontKnow as $stuff)
{
}
// }
// else
// {
// echo '<Br /><br /><center style="font-size: 120%;"><i><b>Good news!</b><br />I have no new furni for you today.</i></center>';
// }
echo '<textarea rows="10" cols="120">' . $itemsql . '</textarea><br><br>';
echo '<textarea rows="10" cols="120">' . $catsql . '</textarea>';
}
require_once "bottom.php";
?>
Change $data = file_get_contents("URL TO FURNIDATA");