Page 4 of 6

Posted: Thu Aug 24, 2006 22:36
by Graf Zahl
just fyi: i had a serious cycling accident today and won't be able to do any real computer work for several weeks. so please don't complain if my site won't get updated for at least a month, possibly even more. even typing this message is quite awkward right now because i can use only my right hand (and i am left-handed...)

Posted: Fri Aug 25, 2006 9:07
by grubber
No problem. I hope you'll be ok soon.

Posted: Fri Aug 25, 2006 9:24
by Paul
Yeah, recover soon Graf. Cycling accidents are a real PITA.

Grub, I've updated the front-page table to save you some trouble.

Tormentor is the only endangered species now.

Posted: Fri Aug 25, 2006 11:08
by Tormentor667
Paul wrote:Tormentor is the only endangered species now.
This has something do do with the size of my page yes? I mean, I do update my page almost every week :)

Posted: Fri Aug 25, 2006 12:03
by Paul
Yes, the size is the issue (not the number of files)

Posted: Fri Aug 25, 2006 12:11
by Graf Zahl
one way to save space: Link to /idgames instead of hostinh your large files yourself.

Posted: Mon Aug 28, 2006 9:00
by Tormentor667
Graf Zahl wrote:one way to save space: Link to /idgames instead of hostinh your large files yourself.
Would make sense if /idgames would have the latest updates of my files but Ty never seems to update them when I reupload them :(
Conc. the files, still no internet at home so I can't remove that stuff yet, will take a few more days, so don't worry. BTW, I already aksed for that but maybe Grubber can help me to optimize my Joomla, remove unused stuff and files therefore so I can save some more space. Would this be possible?

Posted: Mon Aug 28, 2006 9:05
by grubber
I'm afraid I'm lazy (and don't have time) to learn something completely new.

Posted: Mon Aug 28, 2006 9:55
by Tormentor667
That was what I thought. Well, I will try this on my own as good as possible, I even have the possibility to ask in the communities for help, so that will work somehow! :)

Posted: Mon Aug 28, 2006 12:11
by grubber
I hope so.

Posted: Mon Aug 28, 2006 15:03
by Graf Zahl
Tormentor667 wrote:
Graf Zahl wrote:one way to save space: Link to /idgames instead of hostinh your large files yourself.
Would make sense if /idgames would have the latest updates of my files but Ty never seems to update them when I reupload them :(

Put a line in 'archive maintainer' at the top. Otherwise he might not notice that it's an update and think it's just a duplicate upload. He never accidentally lost a file of mine.

Posted: Mon Aug 28, 2006 15:33
by grubber
@BioHazard: This is what I've just created - generates perfect XHTML from all the bbcodes:

Code: Select all

function ParseBBCode (&$text)
{
	$patterns[] = '/\[b\](.*?)\[\/b\]/s';
	$replacements[] = '<b>\1</b>';

	$patterns[] = '/\[i\](.*?)\[\/i\]/s';
	$replacements[] = '<i>\1</i>';

	$patterns[] = '/\[u\](.*?)\[\/u\]/s';
	$replacements[] = '<u>\1</u>';

	$patterns[] = '/\[s\](.*?)\[\/s\]/s';
	$replacements[] = '<s>\1</s>';

	$patterns[] = '/\[color=(.+?)\](.*?)\[\/color\]/s';
	$replacements[] = '<span style="color: \1">\2</span>';

	$patterns[] = '/\[size=([0-9]+)\](.*?)\[\/size\]/s';
	$replacements[] = '<span style="font-size: \1pt">\2</span>';

	$patterns[] = '/\[quote\](.*?)\[\/quote\]/s';
	$replacements[] = '<div class="postbody"><b>citát:</b><br /><div class="bbquote">\1</div></div>';

	$patterns[] = '/\[quote="(.+?)"\](.*?)\[\/quote\]/s';
	$replacements[] = '<div class="postbody"><b>\1 napsal:</b><br /><div class="bbquote">\2</div></div>';

	$patterns[] = '/\[code\](.*?)\[\/code\]/s';
	$replacements[] = '<div class="postbody"><b>kód:</b><br /><div class="bbcode">\1</div></div>';

	$patterns[] = '/\[list\].*?\[\*\](.*?)\[\/list\]/s';
	$replacements[] = '<ul><li>\1</li></ul>';

	$patterns[] = '/\[list=(.)\].*?\[\*\](.*?)\[\/list\]/s';
	$replacements[] = '<ol type="\1"><li>\2</li></ol>';

	$patterns[] = '/\[\*\]/';
	$replacements[] = '</li><li>';

	$patterns[] = '/\[img\](.*?)\[\/img\]/s';
	$replacements[] = '<img src="\1" alt="image" />';

	$patterns[] = '/\[url\](.*?)\[\/url\]/s';
	$replacements[] = '<a href="\1">\1</a>';

	$patterns[] = '/\[url=(.+?)\](.*?)\[\/url\]/s';
	$replacements[] = '<a href="\1">\2</a>';

	$patterns[] = '/\[email\](.*?)\[\/email\]/s';
	$replacements[] = '<a href="mailto:\1">\1</a>';

	$patterns[] = '/\[spoiler\](.*?)\[\/spoiler\]/s';
	$replacements[] = '<div class="postbody"><input type="button" class="button" style="width: 50px" value="Show" onclick="node = this.parentNode.getElementsByTagName(\'div\')[0]; if (node.style.display != \'\') { node.style.display = \'\'; this.innerText = \'\'; this.value = \'Hide\';} else { node.style.display = \'none\'; this.innerText = \'\'; this.value = \'Show\'; }" /><br /><div class="bbspoiler" style="display: none">\1</div></div>';

	$patterns[] = '/\[spoiler=(.+?)\](.*?)\[\/spoiler\]/s';
	$replacements[] = '<div class="postbody"><input type="button" class="button" style="width: 50px" value="Show" onclick="node = this.parentNode.getElementsByTagName(\'div\')[0]; if (node.style.display != \'\') { node.style.display = \'\'; this.innerText = \'\'; this.value = \'Hide\';} else { node.style.display = \'none\'; this.innerText = \'\'; this.value = \'Show\'; }" />&nbsp;\1<br /><div class="bbspoiler" style="display: none">\2</div></div>';

	$patterns[] = '/\[table\].*?\[(m?)row color=(.+?)\](.*?)\[\/table\]/s';
	$replacements[] = '<table><tr><td class="bb\1col" style="background-color: \2">\3</td></tr></table>';

	$patterns[] = '/\[table\].*?\[(m?)row\](.*?)\[\/table\]/s';
	$replacements[] = '<table><tr><td class="bb\1col">\2</td></tr></table>';

	$patterns[] = '/\[(m?)row color=(.+?)\]/';
	$replacements[] = '</td></tr><tr><td class="bb\1col" style="background-color: \2">';

	$patterns[] = '/\[(m?)row\]/';
	$replacements[] = '</td></tr><tr><td class="bb\1col">';

	$patterns[] = '/\[(m?)col color=(.+?)\]/';
	$replacements[] = '</td><td class="bb\1col" style="background-color: \2">';

	$patterns[] = '/\[(m?)col\]/';
	$replacements[] = '</td><td class="bb\1col">';

	$patterns[] = '/\[hidden\](.*?)\[\/hidden\]/s';
	$replacements[] = '';	// This needs special handling

	$text = preg_replace ($patterns, $replacements, $text);
}
EDIT: (very) minor improvements.
EDIT: critical bugfix.

Posted: Mon Aug 28, 2006 17:28
by Alter
Wow grubber you're really experienced programmer at that :)

Posted: Mon Aug 28, 2006 18:24
by BioHazard
Excellent! I'll have to fiddle with it a bit but that will work great! Thanks Grubber.

Aren't regexes great? :)

Posted: Mon Aug 28, 2006 18:47
by grubber
You are welcome and indeed they are ;)

@alterworldruler: not as much as I want, but thx.