EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Tools (https://www.eqemulator.org/forums/forumdisplay.php?f=593)
-   -   PHP Simple Item Editor (https://www.eqemulator.org/forums/showthread.php?t=23403)

inkubus 08-06-2007 02:48 PM

PHP Simple Item Editor
 
Hi all,

http://www.ageofkunark.com/itemeditor.zip

http://www.ageofkunark.com/eqie.jpg

I thought I'd post this as I made it for use on my server and find it's a great help for fast production of items. It's dirty (oh so dirty) so don't get mad if it doesn't do what you want!

Couple of things to note before you start using it:
* I use autonumber on my items table - you will need to do the same to use this tool (make sure you don't go over your server item limit!
* For the sake of all that is good make sure you password protect your eqie folder using something like .htaccess. I didn't waste time building a login system.

Enjoy, I hope it's more understandable for you php coders out there (but like I say it's slightly messy)

Have fun

Bolly

TheLieka 08-30-2007 05:30 AM

Nice tool. Thanks for the hard work.

sdabbs65 08-30-2007 11:18 PM

Item Editor..
 
Good job.
been waiting a few months for something like this.
I been getting a lot of request for custom items and this does the trick.
you made quite a few people happy.

gernblan 08-31-2007 11:39 PM

Yes, very nice! Thank you!

gernblan 09-01-2007 08:02 PM

This is great!

One thing I may report? You need to escape out single quotes, as some items have a ' in their name.

The way the editor is now, it breaks if you try to edit any item (or lore) with an apostrophe.

sdabbs65 09-09-2007 12:34 PM

Item Editor..
 
Quote:

Originally Posted by gernblan (Post 137825)
This is great!

One thing I may report? You need to escape out single quotes, as some items have a ' in their name.

The way the editor is now, it breaks if you try to edit any item (or lore) with an apostrophe.


Treid it last night...seems it inserts above max_id and crashes the server
so you wantto watch what you duplacate for now.

gernblan 09-18-2007 11:41 AM

I'm referring to the fact that anything with an apostrophe needs an "escape" a \ before the ' to be read correctly.

The code is stripping them out (no logic to handle the escapes), which is cutting off anything in a name past the '

It's a show stopping bug because it can corrupt item names with an apostrophe in them.

sdabbs65 09-18-2007 12:00 PM

ok
 
Quote:

Originally Posted by gernblan (Post 138674)
I'm referring to the fact that anything with an apostrophe needs an "escape" a \ before the ' to be read correctly.

The code is stripping them out (no logic to handle the escapes), which is cutting off anything in a name past the '

It's a show stopping bug because it can corrupt item names with an apostrophe in them.

Thats also a bug but it also inserts the new item above max_item_id 's limit.

gernblan 09-18-2007 12:26 PM

See:

http://www.tizag.com/phpT/strings.php

gernblan 09-18-2007 12:26 PM

Quote:

Originally Posted by sdabbs65 (Post 138675)
Thats also a bug but it also inserts the new item above max_item_id 's limit.

Ok, but since you quoted me I thought you were commenting on what I said specifically. :)

Theeper 09-20-2007 12:10 PM

This can be confusing sometimes if magic_quotes_gpc are enabled in PHP. This setting automagically escapes single and double quotes on POSTed data, but doesn't actually insert the escape characters into the DB. So, the data will post properly, but will need escaped when echoing into the form HTML.

On the other hand, if magic_quotes_gpc is off on your system, the single quotes might be breaking your insert query string, so the data isn't making it to the DB properly.

Either way, using double quotes to delimit your string values in the HTML form is an easy way to deal with single quotes. This is, of course if you don't plan on ever having strings that have double quotes in them. If you do, you could always do some str_replace()'s with ascii values for quotes.

gernblan 09-26-2007 06:55 AM

So yeah, until that is addressed and fixed I cannot recommend this excellent script to anyone.

...and that sucks.

I'd fix it, honest I would, if I only had time. I'm so buried in the upkeep of my own server and the other projects I've already taken on. :(

Lalolyen 09-29-2007 10:29 PM

Does your server happen to be down.. I've been getting ping timeouts for the past 2 hours =S

Ueguvil 09-30-2007 11:05 AM

Anyone mind hosting this?

gernblan 10-02-2007 08:42 AM

Here:

http://stash.buttwrenching.com/itemeditor.zip

...but like I said in its current form it can corrupt the db, due to improper string handling so I don't recommend you actually use it as it is now.

IF someone fixes it, e-mail the fix to gernblanATgmailDOTcom and I will host that version for everyone instead.

Lalolyen 10-03-2007 12:33 PM

spsst!

Code:

function edititem
        (
        $id,
        $name,
        $lore,
        $idfile,
        $ac,
        $hp,
        $mana,
        $endur,
        $str,
        $sta,
        $agi,
        $dex,
        $cha,
        $int,
        $wis,
        $cr,
        $dr,
        $fr,
        $mr,
        $pr,
        $damage,
        $delay,
        $range,
        $reqlevel,
        $reclevel,
        $price,
        $clicktype,
        $clickeffect,
        $clicklevel,
        $clicklevel2,
        $stackable,
        $stacksize,
        $loregroup,
        $classes,
        $deity,
        $races,
        $nodrop,
        $bookid,
        $bookfilename,
        $proctype,
        $proceffect,
        $proclevel,
        $proclevel2,
        $worntype,
        $worneffect,
        $wornlevel,
        $wornlevel2,
        $regen,
        $manaregen,
        $focustype,
        $focuseffect,
        $focuslevel,
        $focuslevel2,
        $haste,
        $itemtype,
        $casttime,
        $icon,
        $slotcharm,
        $slotear1,
        $slothead,
        $slotface,
        $slotear2,
        $slotneck,
        $slotshoulder,
        $slotarms,
        $slotback,
        $slotbracer1,
        $slotbracer2,
        $slotrange,
        $slothands,
        $slotprimary,
        $slotsecondary,
        $slotring1,
        $slotring2,
        $slotchest,
        $slotlegs,
        $slotfeet,
        $slotwaist,
        $slotammo,
        $warrior,
        $cleric,
        $paladin,
        $ranger,
        $shadowknight,
        $druid,
        $monk,
        $bard,
        $rogue,
        $shaman,
        $necromancer,
        $wizard,
        $magician,
        $enchanter,
        $beastlord,
        $berserker,
        $human,
        $barbarian,
        $erudite,
        $woodelf,
        $highelf,
        $darkelf,
        $halfelf,
        $dwarf,
        $troll,
        $ogre,
        $halfling,
        $gnome,
        $iksar,
        $vahshir,
        $froglok,
        $deity1,
        $deity2,
        $deity3,
        $deity4,
        $deity5,
        $deity6,
        $deity7,
        $deity8,
        $deity9,
        $deity10,
        $deity11,
        $deity12,
        $deity13,
        $deity14,
        $deity15,
        $deity16,
        $deity17,
        $magic,
        $artifactflag,
        $norent,
        $procrate
        )

{

        if ($slotcharm == "on") { $slotcharm = 1; } else { $slotcharm = 0; };
        if ($slotear1 == "on") { $slotear1 = 1; } else { $slotear1 = 0; };
        if ($slothead == "on") { $slothead = 1; } else { $slothead = 0; };
        if ($slotface == "on") { $slotface = 1; } else { $slotface = 0; };
        if ($slotear2 == "on") { $slotear2 = 1; } else { $slotear2 = 0; };
        if ($slotneck == "on") { $slotneck = 1; } else { $slotneck = 0; };
        if ($slotshoulder == "on") { $slotshoulder = 1; } else { $slotshoulder = 0; };
        if ($slotarms == "on") { $slotarms = 1; } else { $slotarms = 0; };
        if ($slotback == "on") { $slotback = 1; } else { $slotback = 0; };
        if ($slotbracer1 == "on") { $slotbracer1 = 1; } else { $slotbracer1 = 0; };
        if ($slotbracer2 == "on") { $slotbracer2 = 1; } else { $slotbracer2 = 0; };
        if ($slotrange == "on") { $slotrange = 1; } else { $slotrange = 0; };
        if ($slothands == "on") { $slothands = 1; } else { $slothands = 0; };
        if ($slotprimary == "on") { $slotprimary = 1; } else { $slotprimary = 0; };
        if ($slotsecondary == "on") { $slotsecondary = 1; } else { $slotsecondary = 0; };
        if ($slotring1 == "on") { $slotring1 = 1; } else { $slotring1 = 0; };
        if ($slotring2 == "on") { $slotring2 = 1; } else { $slotring2 = 0; };
        if ($slotchest == "on") { $slotchest = 1; } else { $slotchest = 0; };
        if ($slotlegs == "on") { $slotlegs = 1; } else { $slotlegs = 0; };
        if ($slotfeet == "on") { $slotfeet = 1; } else { $slotfeet = 0; };
        if ($slotwaist == "on") { $slotwaist = 1; } else { $slotwaist = 0; };
        if ($slotammo == "on") { $slotammo = 1; } else { $slotammo = 0; };

Can be trimmed down to:

Code:

function edititem($postitem,$value)
{
if ($value == "on")
  {
  $ret_val = 1;
  } else {
  $ret_val = 0;
  }
$postitem = $ret_val;
return $postitem;
}


Lalolyen 10-03-2007 12:42 PM

BTW, this is why I would like to create an EQEMU mirror =)

Also to call that function while the array results with that function in it... such as...

Code:

while ($somearray['ID'] > 0)
 {
 $convert = edititem($thisItem,$andItsValue);
 echo ($convert);
 }


gernblan 10-03-2007 09:51 PM

Still need a fix for apostrophes though... they must be escaped or item names, etc. can get truncated which would be bad.

Great work on the optimizations, however!!

Lalolyen 10-03-2007 10:29 PM

can do a streplace for ' to ' But you'll have to do the sting replace in quotes instead of apostrophies =).

Something like str_replace("'","'") there should be some other perameters, yes but thats the gist of it.

To make it safe, I'd also do another thats str_replace('"','&quote;') to get rid of any escaping quotes =)

gernblan 10-06-2007 01:04 PM

Yeah but I'm too bad with PHP still to actually do it.

If anyone out there can fix this script up and then post it I know it would help a lot of people.

It's VERY good. It just needs to not destroy item names if they contain an apostrophe.

AndMetal 10-16-2007 08:51 PM

Quote:

Originally Posted by Lalolyen (Post 139103)
can do a streplace for ' to ' But you'll have to do the sting replace in quotes instead of apostrophies =).

Something like str_replace("'","'") there should be some other perameters, yes but thats the gist of it.

To make it safe, I'd also do another thats str_replace('"','&quote;') to get rid of any escaping quotes =)

If magic-quotes-gpc is turned on in your php.ini, you shouldn't have to worry about it. You can turn it on for an individual page by using ini_set("magic-quotes-gpc","On").

This can also be done with the PHP command addslashes() on a per-command basis.

inkubus 08-31-2008 02:45 PM

hi guys, long time no speak. I just noticed loads of you had responded but i didn't even realise!

i'll take your notes and make some changes and release an update next weekend for the latest version

take care

inky

inkubus 09-20-2008 04:38 PM

hey all, went to work on this but was unable to find my backup. Can anyone paste a mirror?

Cheers

Koshoji 11-25-2008 11:39 AM

Anyone have a current link to this file? Thanks!

derekj54 12-01-2008 01:08 PM

I can host it too if someone would send it to me, would like to try it out myself


All times are GMT -4. The time now is 12:36 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.