PDA

View Full Version : Arena linking?


fatbob51
04-18-2007, 09:38 AM
Hi!
I would need some help by a pro coder :P

Well..here is the problem, the thing is that I want to make it possible to actually "click" the names in the raid list...and since I have some code tans myself I found this little intresstin line

$name = '<input type="text" name="name" class="post" value="' . $name . '" style="width:100px">';

The thin is that I want to some how change the code so it looks more like this:


$name = '<input type="text" name="name" class="post" value="<a href="<url to the chars arena profile>' . $name . '</a>" style="width:100px">';

Btw I found this code in the profile.php file...

The problem is that I have forgotten how to add a link into php :-[.

So this line I typed above doesnt work, so please help me!

alohastone
04-18-2007, 02:11 PM
Well, first of all, I'm not a pro coder, so please don't punch me if my code messes up anything ;)

I did some searching and copy&paste, and actually found a way to link the names to the according arena profile. I didn't want to change the profile.php, b/c that way all the character names in the DB would be saved as "<a href xyz". That would probably fuck up the edit profile function and other stuff.

So I tried to edit the output rather than the input. So I edited my view.php (which includes all the functions for the view raid page):

In order to get linked names, I inserted the link into the ?name variable at all those spots, where it is displayed on the page:

In view.php find:

switch($data['class'])
{
case $phprlang['druid']:
$druid_count++;
array_push($druid,
array('id'=>$data['char_id'],'arcane'=>$arcane,'fire'=>$fire,'nature'=>$nature,'frost'=>$frost,'shadow'=>$shadow,
'race'=>$race,'name'=>$data['name'],'comments'=>$comments,'lvl'=>$data['lvl'],'actions'=>$actions,
'date'=>$date,'time'=>$time));
break;

Should be somewhere around line 270. In this codeblock, all the displayed data for signed up druids is fetched, including player's names:

'name'=>$data['name']

So I replaced $data['name'] with the following:

'<a href="http://armory.wow-europe.com/character-sheet.xml?r=' . $phpraid_config['guild_server'] .'&n=' . $data['name'] . '">' . $data['name'] . '</a>'

Depending on your server (US / EU), you might need to change the armory link. wow-europe.com for EU, worldofwarcraft.com for US servers. Now phpRaid shows the player's name, linked to his armory page - at least for signed up druids ;)

Now you need to repeat this step for the other classes (hunter, mage, paladin, etc.), which you'll find below the druids.

After that, you need to repeat this step for players currently queued and cancelled. The code for queued members is somewhere around line 504:

array_push($raid_queue, array('id'=>$data['char_id'],'race'=>$race,'class'=>$class,'name'=>$data['name'],'lvl'=>$data['lvl'],'actions'=>$actions,'date'=>$date,'time'=>$time,'comments'=>$comments));

The cancelled members output is somewhere around line 665:

array_push($raid_cancel, array('id'=>$data['char_id'],'race'=>$race,'class'=>$class,'name'=>$data['name'],'lvl'=>$data['lvl'],'actions'=>$actions,'date'=>$date,'time'=>$time,'comments'=>$comments));

Just replace $data['name'] with the link code.

And that's it, members names are going to be linked to the arena profiles. You might want to edit your roster.php to get linked names in there, too. The procedure is the same.

As I said I'm not really a coder, and this fix is pretty ugly, but it seems to be working for me. Only thing that bothers me are umlauts and other special characters in player's names. For those names, the arena links won't work. Dunno how this could be fixed.

Maybe someone can think of a nicer way to accomplish this. But as phpRaid is one big security hole, there are quite a lot of other things that need to be but are not going to be fixed, because phpRaider is on it's way. Maybe they can include some nice Arena features in phpRaider, as I think theres more potential in it than just linking the member names.

We'll see what happens. I hope my small tut was helpful for you in some way. Oh, and sorry for my bad english, I don't use it a lot - Germany represent ;)

fatbob51
04-18-2007, 02:52 PM
Great!
I will try this tomorrow :) !

ty very much dude ;D!

DarkestTiger
04-20-2007, 08:06 AM
As I said I'm not really a coder, and this fix is pretty ugly, but it seems to be working for me. Only thing that bothers me are umlauts and other special characters in player's names. For those names, the arena links won't work. Dunno how this could be fixed.


Just use urlencode(utf8_encode($data['name'])) wherever you use $data['name'] in a link. That should work.

alohastone
04-20-2007, 03:31 PM
Jep, that works. Inside the a href, just replace $data['name'] with (utf8_encode($data['name'])).

That way the link code looks like this:

'<a href="http://armory.wow-europe.com/character-sheet.xml?r=' . $phpraid_config['guild_server'] .'&n=' . urlencode(utf8_encode($data['name'])) . '">' . $data['name'] . '</a>'

Works with umlauts, works with special characters. Thanks dude!