From 721a52867f7f79130ecb3448ba17d364c53a69e6 Mon Sep 17 00:00:00 2001 From: "rigaer@hotmail.es" Date: Sun, 18 May 2014 20:28:11 +0200 Subject: [PATCH 1/2] Guild logo upload --- config.php | 187 +++++++++++++++++++++---------- engine/function/general.php | 99 ++++++++++++++++ engine/guildimg/default@logo.gif | Bin 0 -> 1883 bytes guilds.php | 27 ++++- 4 files changed, 250 insertions(+), 63 deletions(-) create mode 100644 engine/guildimg/default@logo.gif diff --git a/config.php b/config.php index d2556b5..92c9cf1 100644 --- a/config.php +++ b/config.php @@ -5,30 +5,30 @@ // TFS 0.4 = TFS_03 // TFS 1.0 = TFS_10 (Under developement) $config['TFSVersion'] = 'TFS_10'; - + $config['site_title'] = 'Znote AAC'; $config['site_title_context'] = 'Because open communities are good communities. :3'; - + // Path to server folder without / Example: C:\Users\Alvaro\Documents\GitHub\forgottenserver $config['server_path'] = ''; - - + + // ------------------------ \\ // MYSQL CONNECTION DETAILS \\ // ------------------------ \\ - + // phpmyadmin username for OT server: (DONT USE "root" if ur hosting to public.). $config['sqlUser'] = 'tfs10'; - + // phpmyadmin password for OT server: $config['sqlPassword'] = 'tfs10'; - + // The database name to connect to. (This is usually same as username). $config['sqlDatabase'] = 'tfs10'; - + // Hostname is usually localhost or 127.0.0.1. $config['sqlHost'] = 'localhost'; - + /* CLOCK FUNCTION - getClock() = returns current time in numbers. - getClock(time(), true) = returns current time in formatted date @@ -49,7 +49,69 @@ // ------------------- \\ // CUSTOM SERVER STUFF \\ // ------------------- \\ - + // Enable / disable Questlog function (true / false) + $config['EnableQuests'] = false; + + // array for filling questlog (Questid, max value, name, end of the quest fill 1 for the last part 0 for all others) + $config['Quests'] = array( + array(1501,100,'Killing in the Name of',0), + array(1502,150,'Killing in the Name of',0), + array(65001,100,'Killing in the Name of',0), + array(65002,150,'Killing in the Name of',0), + array(65003,300,'Killing in the Name of',0), + array(65004,3,'Killing in the Name of',0), + array(65005,300,'Killing in the Name of',0), + array(65006,150,'Killing in the Name of',0), + array(65007,200,'Killing in the Name of',0), + array(65008,300,'Killing in the Name of',0), + array(65009,300,'Killing in the Name of',0), + array(65010,300,'Killing in the Name of',0), + array(65011,300,'Killing in the Name of',0), + array(65012,300,'Killing in the Name of',0), + array(65013,300,'Killing in the Name of',0), + array(65014,300,'Killing in the Name of',1), + array(12110,2,'The Inquisition',0), + array(12111,7,'The Inquisition',0), + array(12112,3,'The Inquisition',0), + array(12113,6,'The Inquisition',0), + array(12114,3,'The Inquisition',0), + array(12115,3,'The Inquisition',0), + array(12116,3,'The Inquisition',0), + array(12117,5,'The Inquisition',1), + array(330,3,'Sam\'s Old Backpack',1), + array(12121,3,'The Ape City',0), + array(12122,5,'The Ape City',0), + array(12123,3,'The Ape City',0), + array(12124,3,'The Ape City',0), + array(12125,3,'The Ape City',0), + array(12126,3,'The Ape City',0), + array(12127,4,'The Ape City',0), + array(12128,3,'The Ape City',0), + array(12129,3,'The Ape City',1), + array(12101,1,'The Ancient Tombs',0), + array(12102,1,'The Ancient Tombs',0), + array(12103,1,'The Ancient Tombs',0), + array(12104,1,'The Ancient Tombs',0), + array(12105,1,'The Ancient Tombs',0), + array(12106,1,'The Ancient Tombs',0), + array(12107,1,'The Ancient Tombs',1), + array(12022,3,'Barbarian Test Quest',0), + array(12022,3,'Barbarian Test Quest',0), + array(12022,3,'Barbarian Test Quest',1), + array(12025,3,'The Ice Islands Quest',0), + array(12026,5,'The Ice Islands Quest',0), + array(12027,3,'The Ice Islands Quest',0), + array(12028,2,'The Ice Islands Quest',0), + array(12029,6,'The Ice Islands Quest',0), + array(12030,8,'The Ice Islands Quest',0), + array(12031,3,'The Ice Islands Quest',0), + array(12032,4,'The Ice Islands Quest',0), + array(12033,2,'The Ice Islands Quest',0), + array(12034,2,'The Ice Islands Quest',0), + array(12035,2,'The Ice Islands Quest',0), + array(12036,6,'The Ice Islands Quest',1), + ); + // Vocation ids and names. $config['vocations'] = array( 0 => 'No vocation', @@ -62,7 +124,7 @@ 7 => 'Royal Paladin', 8 => 'Elite Knight', ); - + /* Vocation stat gains per level - Ordered by vocation ID - Currently used for admin_skills page. */ @@ -129,7 +191,7 @@ 'requirePremium' => false, 'levelToBuyHouse' => 8, ); - + // Leave on black square in map and player should get teleported to their selected town. // If chars get buggy set this position to a beginner location to force players there. $config['default_pos'] = array( @@ -137,7 +199,7 @@ 'y' => 5, 'z' => 2, ); - + $config['war_status'] = array( 0 => 'Pending..', 1 => 'Accepted', @@ -146,57 +208,57 @@ 4 => '???', 5 => 'Ended', ); - + /* -- SUB PAGES -- Some custom layouts/templates have custom pages, they can use this sub page functionality for that. */ $config['allowSubPages'] = true; - + // ---------------- \\ // Create Character \\ // ---------------- \\ - + // Max characters on each account: $config['max_characters'] = 7; - + // Available character vocation users can create. $config['available_vocations'] = array(1, 2, 3, 4); - + // Available towns (specify town ids, etc: (0, 1, 2); to display 3 town options (town id 0, 1 and 2). $config['available_towns'] = array(2); - + $config['level'] = 8; $config['health'] = 185; $config['mana'] = 40; $config['cap'] = 435; $config['soul'] = 100; - + $config['maleOutfitId'] = 128; $config['femaleOutfitId'] = 136; $config['lookHead'] = 78; $config['lookBody'] = 68; $config['lookLegs'] = 58; $config['lookFeet'] = 76; - + // No vocation info (if user select vocation id 0, we force thees configurations on him $config['nvlevel'] = 1; $config['nvHealth'] = 150; $config['nvMana'] = 5; $config['nvCap'] = 400; $config['nvSoul'] = 100; - + $config['nvForceTown'] = 0; // Force a town to no vocation even though he selected something else? 0 = no, 1 = yes. $config['nvTown'] = 0; // Town id to force no vocations to get to, if nvForceTown is 1. - + // Minimum allowed character name letters. Etc 4 letters: "Kåre". $config['minL'] = 4; // Maximum allowed character name letters. Etc 20 letters: "Bobkåreolesofiesberg" $config['maxL'] = 20; - + // Maximum allowed character name words. Etc 2 words = "Bob Kåre", 3 words: "Bob Arne Kåre" as max char name words. $config['maxW'] = 2; - + // -------------- \\ // WEBSITE STUFF \\ // -------------- \\ @@ -206,7 +268,7 @@ // Enable or disable changelog ticker in news page. $config['UseChangelogTicker'] = true; - + // Highscore configuration $config['highscore'] = array( 'rows' => 100, @@ -230,47 +292,50 @@ $config['validate_IP'] = true; // Only allow legal IP addresses to register and create character. $config['salt'] = false; // Some noob 0.3.6 servers don't support salt. - + // Restricted names $config['invalidNameTags'] = array("god", "gm", "cm", "gamemaster", "hoster", "admin", "admim", "adm", "owner", "staff"); - + + // Use guild logo system + $config['use_guild_logos'] = 4; + // Level requirement to create guild? (Just set it to 1 to allow all levels). $config['create_guild_level'] = 8; - + // Change Gender can be purchased in shop, or perhaps you want to allow everyone to change gender for free? $config['free_sex_change'] = false; - + // Do you need to have premium account to create a guild? $config['guild_require_premium'] = false; - + $config['guildwar_enabled'] = true; - + // Use htaccess rewrite? (basically this makes website.com/username work instead of website.com/characterprofile.php?name=username // Linux users needs to enable mod_rewrite php extention to make it work properly, so set it to false if your lost and using Linux. $config['htwrite'] = true; - + // What client version and server port are you using on this OT? // Used for the Downloads page. $config['client'] = 1037; // 954 = tibia 9.54 - + // Download link to client. Recommended: // Select download link from remere map editor website! // See list of clients: http://remeresmapeditor.com/marklar.php?clients $config['client_download'] = 'http://clients.tibiaking.com/client/windows/'. $config['client'] .''; $config['client_download_linux'] = 'http://clients.tibiaking.com/client/linux/'. $config['client'] .''; - + $config['port'] = 7171; // Port number to connect to your OT. - + // How often do you want highscores to update? $config['cache_lifespan'] = 5;//60 * 15; // 15 minutes. - + // WARNING! Account names written here will have admin access to web page! $config['page_admin_access'] = array( //'otland0', //'otland1', 'znote' ); - + // Built-in FORUM // Enable forum, enable guildboards, level to create threads/post in them // How long do they have to wait to create thread or post? @@ -293,12 +358,12 @@ 'guilds' => false, 'guildwars' => false, ); - + // IMPORTANT! Write a character name(that exist) that will represent website bans! // Or remember to create character "God Website" character exist. // If you don't do this, bann from admin panel won't work properly. $config['website_char'] = 'Luxitur'; - + //----------------\\ // ADVANCED STUFF \\ //----------------\\ @@ -316,17 +381,17 @@ 5 => 'Community Manager', 6 => 'God', ); - + // Enable OS advanced feautures? false = no, true = yes $config['os_enabled'] = false; - + // What kind of computer are you hosting this website on? // Available options: LINUX or WINDOWS $config['os'] = 'WINDOWS'; - + // Measure how much players are lagging in-game. (Not completed). $config['ping'] = false; - + // BAN STUFF - Don't touch this unless you know what you are doing. // You can order the lines the way you want, from top to bot, in which order you // wish for them to be displayed in admin panel. Just make sure key[#] represent your describtion. @@ -337,7 +402,7 @@ 5 => 'DELETE_ACCOUNT', 1 => 'BAN_IPADDRESS', ); - + // BAN STUFF - Don't touch this unless you know what you are doing. // You can order the lines the way you want, from top to bot, in which order you // wish for them to be displayed in admin panel. Just make sure key[#] represent your describtion. @@ -350,7 +415,7 @@ 5 => 'NR + Ban + FW', 6 => 'Statement Report', ); - + // Ban reasons, for changes beside default values to work with client, // you also need to edit sources (tools.cpp line 1096) $config['ban_reason'] = array( @@ -377,7 +442,7 @@ 20 => 'Excessive Unjustified Player Killing', 21 => 'Spoiling Auction', ); - + // BAN STUFF // Ban time duration selection in admin panel // seconds => describtion @@ -391,14 +456,14 @@ 1209600 => '2 weeks', 2592000 => '1 month', ); - - + + // --------------- \\ // SECURITY STUFF \\ // --------------- \\ $config['use_token'] = false; $config['use_captcha'] = false; - + /* Store visitor data Store visitor data in the database, logging every IP visitng site, and how many times they have visited the site. And sometimes what @@ -411,14 +476,14 @@ if table never gets flushed once in a while. So I highly recommend you to configure flush_ip_logs if IPs are logged. */ - + $config['log_ip'] = false; - + // Flush IP logs each configured seconds, 60 * 15 = 15 minutes. // Set to false to entirely disable ip log flush. // It is important to flush for optimal performance. $config['flush_ip_logs'] = 59 * 27; - + /* IP SECURTY REQUIRE: $config['log_ip'] = true; Configure how tight this security shall be. Etc: You can max click on anything/refresh page @@ -434,7 +499,7 @@ 'max_character' => 1, // create char 'max_forum_post' => 1, // Create threads and post in forum ); - + ////////////// /// PAYPAL /// ////////////// @@ -462,7 +527,7 @@ 25 => 325, // +30% bonus 30 => 420, // +40% bonus ); - + ////////////////// /// PAYGOL SMS /// ////////////////// @@ -479,7 +544,7 @@ 'returnURL' => "http://".$_SERVER['HTTP_HOST']."/success.php", 'cancelURL' => "http://".$_SERVER['HTTP_HOST']."/failed.php" ); - + //////////// /// SHOP /// //////////// @@ -504,7 +569,7 @@ // leastTime = Lowest duration of time an auctioned player has to be // sellable before auctioneer can claim character back. ); - + // If useDB is false, this array list will be used for shop offers. $config['shop_offers'] = array( // offer 1 @@ -515,7 +580,7 @@ 'describtion' => "Crystal coin.", // Describtion shown on website 'points' => 100, // How many points this offer costs ), - + // offer 2 2 => array( 'type' => 1, @@ -524,7 +589,7 @@ 'describtion' => "Fire sword.", 'points' => 10, ), - + // offer 3 3 => array( 'type' => 2, @@ -533,7 +598,7 @@ 'describtion' => "Premium membership.", 'points' => 25, ), - + // offer 4 4 => array( 'type' => 3, @@ -557,4 +622,4 @@ 'points' => 20, ), ); -?> +?> \ No newline at end of file diff --git a/engine/function/general.php b/engine/function/general.php index 728455e..5de0446 100644 --- a/engine/function/general.php +++ b/engine/function/general.php @@ -407,4 +407,103 @@ function sanitize($data) { function output_errors($errors) { return ''; } + +// Resize images + +function resize_imagex($file, $width, $height) { + + list($w, $h) = getimagesize($file['tmp']); + + $ratio = max($width/$w, $height/$h); + $h = ceil($height / $ratio); + $x = ($w - $width / $ratio) / 2; + $w = ceil($width / $ratio); + + $path = 'engine/guildimg/'.$file['new_name']; + + $imgString = file_get_contents($file['tmp']); + + $image = imagecreatefromstring($imgString); + $tmp = imagecreatetruecolor($width, $height); + imagecopyresampled($tmp, $image, + 0, 0, + $x, 0, + $width, $height, + $w, $h); + + imagegif($tmp, $path); + imagedestroy($image); + imagedestroy($tmp); + + return true; +} + +// Guild logo upload security +function check_image($image) { + + $image_data = array('new_name' => $_GET['name'].'.gif', 'name' => $image['name'], 'tmp' => $image['tmp_name'], 'error' => $image['error'], 'size' => $image['size'], 'type' => $image['type']); + + // First security check, quite useless but still do its job + if ($image_data['type'] === 'image/gif') { + + // Second security check, lets go + $check = getimagesize($image_data['tmp']); + + if ($check) { + + // Third + if ($check['mime'] === 'image/gif') { + + $path_info = pathinfo($image_data['name']); + + // Last one + if ($path_info['extension'] === 'gif') { + + // Resize image + $img = resize_imagex($image_data, 150, 150); + + if ($img) { + + header('Location: guilds.php?name='. $_GET['name']); + exit(); + } + + } else { + + header('Location: guilds.php?name='. $_GET['name']); + exit(); + } + + } else { + + header('Location: guilds.php?name='. $_GET['name']); + exit(); + } + + } else { + + header('Location: guilds.php?name='. $_GET['name']); + exit(); + } + + } else { + + header('Location: guilds.php?name='. $_GET['name']); + exit(); + } +} + +// Check guild logo +function logo_exists($guild) { + + if (file_exists('engine/guildimg/'.$guild.'.gif')) { + + echo'engine/guildimg/'.$guild.'.gif'; + + } else { + + echo'engine/guildimg/default@logo.gif'; + } +} + ?> \ No newline at end of file diff --git a/engine/guildimg/default@logo.gif b/engine/guildimg/default@logo.gif new file mode 100644 index 0000000000000000000000000000000000000000..11b1585a2b26bee0f97b305f47ce45e9811322e8 GIT binary patch literal 1883 zcmV-h2c-B%Nk%w1VU_@v0K@83y2;jS49@}xUy;x_ zRoCKc4!$A;PGJz3-!om+Gz_5H3tnC zsB-pf#y><23^HuN36ZBA`Vf)Y7(-MZ200M_?h-_DhO1FFF7AS0pe2nzh*-u5x$D6~ zn==L+LR8a*%48o=2spq%BhV3s5P3@>Qw;=oa#RdRFqGfZ6P2Vo9l=vssyus86fk*Z z(Dg|7zZX{g`Cc^V3uJb zfb~jJ5o_~2NHBJ?2*m&vX!CNiVt@jV!!*s;H%tST1Q0O517Wu500JODNPzD!m|lQI zgk1wmgyTGsf%A>?IWS<%p7o9x41i_mIHSo7P!M~K*WUqH$5DMkK;^{&rtkC4Aer0A z%a0RBF`%|*V&#Dm-BO)Bf&hAVf#HDvb|pj=M}6Rt7QlD`V(|!rZ!y503i%;(8)y)& z5uSs9NQU4E3S2Yb0R;l^;Rp^%W#Wmag=h%^;*kg4j2)6w8hWS!(m+uK*r<$zDWvET zjU; zQV9cgE-v)WfxiX$0GAZ*C<9%xJ@cKLK)Ny{h@z?af^k@w6Q6%m1%?hj0<`I3VRyc# zhGrsgB~Nm{ah36KGQ!ac6N;%)dO%Kfs2?jg@0mxsK zo!YocQSBEB_$s(HL#PqGrm$Buck3g%P8QYDRJfhTo0{edw@m~rZi3Id5Dc7{JR?n2 z*9KS($&3P2qqpUByA5pr-B^re2;rcgCU>#~$K}yjcf;HSFSh=T2ui8Da6p9}vtW2z zxwG)ERct>_@7uwvz$Iz#*fl=#DK7ydB%spLN50(rP8|$DK;z0r6BB|9 zg2`wA$wnYBIXDn#7}Ov#%E77v6zBm83|m>(JW&q?Br6vtV;+Ez7S4+oJ7hUokK%S z;w(s!1da%k@qjxTgkN<@WyppSM$n+}8V-;b0mSqGRwC_m20*|I5mCY?#sQTqI3RC) zW10bU(i+|=kON{V9WmWZeF=FZ8nKWy39cY&Q$kROs)@L!f{V#Ek_Upm=e# ziZf5cB5`ck6la1206lZ&r7Z>!biyj9S~NAH^aVHX7!|&t==Q}nOPK&krz1ata2=&P07wuKXetXU?Qek8oXp- VtsRsOQybgb+V-}%9YF{H06Q?@D#HK( literal 0 HcmV?d00001 diff --git a/guilds.php b/guilds.php index 7dbe7db..e050091 100644 --- a/guilds.php +++ b/guilds.php @@ -167,7 +167,7 @@ if (user_logged_in() === true) { // Display the specific guild page ?> -

Guild: Guild:

@@ -534,8 +534,31 @@ if ($highest_access >= 2) { - + + + +
    +
  • Upload guild logo:
    + + +
  • +
+ + +
'; + } + + } ?>
    From ef3f8ce91b1fe31acbd431e8d3dc72054cab0bdd Mon Sep 17 00:00:00 2001 From: "rigaer@hotmail.es" Date: Sun, 18 May 2014 20:44:55 +0200 Subject: [PATCH 2/2] Show item name at market --- market.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/market.php b/market.php index cd2dd48..524395f 100644 --- a/market.php +++ b/market.php @@ -25,6 +25,7 @@ if (!$compare) {

    WTS: Want to sell

+ @@ -36,6 +37,7 @@ if (!$compare) { foreach (($offers['wts'] ? $offers['wts'] : array()) as $o) { ?> + @@ -50,6 +52,7 @@ if (!$compare) {

WTB: Want to buy

Item name Item Count Price for 1
" alt="Item Image">
+ @@ -61,6 +64,7 @@ if (!$compare) { foreach (($offers['wtb'] ? $offers['wtb'] : array()) as $o) { ?> + @@ -88,6 +92,7 @@ if (!$compare) {

Active offers

Item name Item Count Price for 1
" alt="Item Image">
+ @@ -104,6 +109,7 @@ if (!$compare) { } else { ?> + @@ -121,6 +127,7 @@ if (!$compare) {

Want to buy:

Item name Item Count Price for 1
" alt="Item Image">
+ @@ -131,6 +138,7 @@ if (!$compare) { foreach ($buylist as $o) { ?> + @@ -147,6 +155,7 @@ if (!$compare) {

Old purchased offers

Item name Item Count Price for 1
" alt="Item Image">
+ @@ -156,6 +165,7 @@ if (!$compare) { foreach (($historyOffers ? $historyOffers : array()) as $o) { ?> +
Item name Item Count Price for 1
" alt="Item Image">