Seite 2 von 4

Verfasst: 06.06.2005 09:53
von Latinoportal
Markus67 hat geschrieben:Hi ...

Kennst du den Beitrag schon?
http://smartor.is-root.com/viewtopic.php?t=12090

Markus
Das sieht vielversprechend aus ... Danke!!!

Verfasst: 13.06.2005 01:40
von Latinoportal
Vielleicht hier nochmal kurz die Lösung:

Code: Alles auswählen

BEGINNING OF HACK -----------------------------------------------------

HACK NAME: BJB1
HACK VERSION: 1.0
PHPBB2 VERSION: 2.0.11
PHOTO ALBUM VERSION: 2.0.53

OPEN

includes/bbcode.php

FIND

   // [img]image_url_here[/img] code..
   $text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text);

AFTER, ADD

   //*****************************************************
   // HACK: Allow embedded images from this server's photo album
   // [img]http://www.example.com/forum_image_url[/img] code.

   // Option 1:
   $text = preg_replace("#\[img\](http://www\.example\.com/[^?[\]]*album_(pic|thumbnail)\.php\?pic_id=\d+)\[\/img\]#sie", "'[img:$uid]' . str_replace(' ', '%20', '\\1') . '[/img:$uid]'", $text);

   //*****************************************************


IN THE ADDED LINE, FIND

example\.com

IN THE ADDED LINE, REPLACE WITH

<your_server_name>\.<your_server_domain>

(For example, to use "www.myserver.com", replace "example\.com" with
"myserver\.com".)

SAVE AND CLOSE ALL FILES

END OF HACK -----------------------------------------------------
Bei mir läuft es!

Gruss
Matthias

Super

Verfasst: 13.06.2005 07:21
von gloriosa
Hallo,
ich habe es soeben eingebaut ! :D Funktioniert ebenfalls Super ! :grin: :grin: :grin:

Re: Super

Verfasst: 15.06.2005 15:36
von Latinoportal
gloriosa hat geschrieben:Hallo,
ich habe es soeben eingebaut ! :D Funktioniert ebenfalls Super ! :grin: :grin: :grin:
Bei mir auch
:D

übrigens:

Code: Alles auswählen

$text = preg_replace("#\[img\](http://www\.example\.com/[^?[\]]*album_(pic|thumbnail)\.php\?pic_id=\d+)\[\/img\]#sie", "'[img:$uid]' . str_replace(' ', '%20', '\\1') . '[/img:$uid]'", $text);
Du kannst das auch modifizieren:

Du kannst das "www\." weglassen oder das "com" ersetzen durch andere domainendungen. => Falls Dein Forum unter mehreren URL's erreichbar ist ...

Gruß
M.

Verfasst: 15.06.2005 20:00
von SchaTTen
hi leute ich finde die idee super nur was ist wenn ich bilder von andern und von meiner seite verwenden will

das mit dem

Code: Alles auswählen

$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png|php|php?pic_id=*)))\[/img\]#sie", "'[img:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text);
kalpt nicht ka warum ich denke das man woanderst noch was ändern muss

hat jemand noch ne andere alternatve

Verfasst: 15.06.2005 20:02
von Latinoportal
SchaTTen hat geschrieben:hi leute ich finde die idee super nur was ist wenn ich bilder von andern und von meiner seite verwenden will

das mit dem

Code: Alles auswählen

$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#"\n\r\t<]*?(\.(jpg|jpeg|gif|png|php|php?pic_id=*)))\[/img\]#sie", "'[img:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text);
kalpt nicht ka warum ich denke das man woanderst noch was ändern muss

hat jemand noch ne andere alternatve

http://smartor.is-root.com/viewtopic.php?t=12090

Verfasst: 15.06.2005 21:43
von SchaTTen
Latinoportal hat geschrieben:Vielleicht hier nochmal kurz die Lösung:

Code: Alles auswählen

BEGINNING OF HACK -----------------------------------------------------

HACK NAME: BJB1
HACK VERSION: 1.0
PHPBB2 VERSION: 2.0.11
PHOTO ALBUM VERSION: 2.0.53

OPEN

includes/bbcode.php

FIND

   // [img]image_url_here[/img] code..
   $text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text);

AFTER, ADD

   //*****************************************************
   // HACK: Allow embedded images from this server's photo album
   // [img]http://www.example.com/forum_image_url[/img] code.

   // Option 1:
   $text = preg_replace("#\[img\](http://www\.example\.com/[^?[\]]*album_(pic|thumbnail)\.php\?pic_id=\d+)\[\/img\]#sie", "'[img:$uid]' . str_replace(' ', '%20', '\\1') . '[/img:$uid]'", $text);

   //*****************************************************


IN THE ADDED LINE, FIND

example\.com

IN THE ADDED LINE, REPLACE WITH

<your_server_name>\.<your_server_domain>

(For example, to use "www.myserver.com", replace "example\.com" with
"myserver\.com".)

SAVE AND CLOSE ALL FILES

END OF HACK -----------------------------------------------------
Bei mir läuft es!

Gruss
Matthias
ich glaube ich bin zu doof für den scheiß ich habe auch schon auf http://smartor.is-root.com/viewtopic.php?t=12090 gesucht aber da habe ich auch schon 10 verschiedene möglichkeiten durch aber es klapt einfach nicht oder muss ich was ändern wenn ich will die URL einbinden:

Code: Alles auswählen

http://www.sttweb.de/mx/modules/mx_smartor/album.php?smartor_mode=album_picm&pic_id=1 
der BBCODE müsste ja wie folgt aussehen

Code: Alles auswählen

[img]http://www.sttweb.de/mx/modules/mx_smartor/album.php?smartor_mode=album_picm&pic_id=1[/img] 
was muss ich denn noch zusätzlich in der bbcode.php ändern damit das klapt mir räuichert schon der kopf

Verfasst: 15.06.2005 22:14
von Latinoportal
Theory of Operation, Part One: The original phpBB2 code looks at the URL in between [img]and[/img] tags and checks to see whether it matches a certain pattern. Specifically the pattern says the URL must end in ".gif", ".jpg", ".jpeg", or ".png". Because Photo Album image URLs don't match this pattern, they don't get converted into inline images. phpBB2 does this because embedding PHP web pages is a security risk.

Theory of Operation, Part Two: The hack doesn't change the original phpBB2 code or its matching behavior. Instead, it works by adding a second check, matching URLs that look like Photo Album image URLs. To minimize the security risk, it tries to allow only those URLs from a certain web server.

Limitations of the hack include:
1. Only works with albums on www.example.com, not other servers.
2. Must use http; can't use ftp, https, ftps.
3. Must use www.example.com; can't use example.com.
4. Might not work with nonstandard-but-valid URL variations, like http://www.example.com/////forum///albu ... &&pic_id=3 (The 99.5% of people who use normal URLs should be fine.)

To get around Limitation 1, for every server you want to allow, just add an additional line of code. The line will be a duplicate of the hack code with the server name replaced. For example, to add "www.another.net", replace "example\.com" with "another\.net". To reduce the security risk, you should only add servers that are trusted.

To get around Limitation 2, you can replace the Option 1 code with the following Option 2 code. It more closely resembles the original phpBB2 code. This has not been tested.

Code:

// Option 2:

Code: Alles auswählen

$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)(www\.example\.com/[^?[\]]*album_(pic|thumbnail)\.php\?pic_id=\d+)\[/img\]#sie", "'[img:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text); 



To get around Limitation 3, you can replace the text "www\." with "(www\.)?". This has not been tested. Theory of operation: the replacement code makes "www." optional.

Option: To limit embedded images to thumbnail images (full-size images not allowed), you can replace the text "album_(pic|thumbnail)" with "album_thumbnail". This has not been tested. Theory of operation: the replacement code only allows "album_thumbnail" instead the two variations.

Option: You can replace "[^?[\]]*" with ".*?". This should also work, though it hasn't been tested. Theory of operation: To avoid matching multiple sets of image tags, the first solution's match omits certain characters that should be at the end of the URL, "?", "[", and "]". The second solution's match includes all characters, but the terminating "?" character causes the match to be as small as possible-- only one set of image tags.

Verfasst: 16.06.2005 00:09
von SchaTTen
das ist ja ganz schön und gut aber es funzt nicht
eigendlich war das auch zu erwarten da ja in fast jeder 2ten zeile zu lesen war "This has not been tested"
kann mir noch jemand weiter helfen von der theorie sind die codes ja einleuchtend aber leider funzen sie in der praxis nicht

Verfasst: 16.06.2005 07:58
von Latinoportal
SchaTTen hat geschrieben:das ist ja ganz schön und gut aber es funzt nicht
eigendlich war das auch zu erwarten da ja in fast jeder 2ten zeile zu lesen war "This has not been tested"
kann mir noch jemand weiter helfen von der theorie sind die codes ja einleuchtend aber leider funzen sie in der praxis nicht
"http://www\.example\.com"

diesen Schnipsel des Codes musst Du ersetzen durch die Domain, die Du zulassen möchtest. Du kannst den Absatz, indem sich dieser Schnipsel befindet, auch mehrfach mit verschiedenen Domains einfügen ...

Gruß
Matthias