Imperia-Users

Home -> Imperia-Users -> 2002 -> August

 I5.0219 - Probleme mit CODEINCLUDE 
 Date  08/01/02 17:11:20 GMT
 From  Christian Lackas
 Subject  I5.0219 - Probleme mit CODEINCLUDE
 Previous Thread
 Next Thread
 Start of Thread
 Reference
 Previous Reply
 This Message
 Reply
 Next Reply
* Sebastian Schalipp <> [020801 18:35]:

Hallo Sebastian,

> Ja, dann geht es sofort wieder. Ein CODEINCLUDE, der _keine_ Datei findet,
> macht übrigens auch keinen Fehler (er bleibt einfach als Kommentar im
> Template stehen). Aber ein CODEINCLUDE, _der_ eine Datei findet, produziert
> den Server Error. Very strange.

Ja, offenbar gibt es in i5 auch schon dieses CODEINCLUDE, aber die
Implementierung ist fehlerhaft (und schlecht). Ich habe da mal einen
Patch angehängt, der das Problem beseitigt.

Danach funktioniert <!--CODEINCLUDE:xxx--> auch in i5. Dateien, die auf
».pl« oder ».perl« enden werden auch hier wieder evaluiert (und der
Inhalt von »$new« zurückgeliefert).

Die technischen Details:
  Die Anweisungen für das Feature stehen in site_createlib.pm, jedoch
  wird dort eine Funktion open_file aufgerufen, die es nicht gibt. Daher
  kommt es zu einem Fehler. Aber eigentlich solltest du dann auch eine
  Perl-Fehlermeldung in deinem ErrorLog finden.

Gruß
 Christian


--
Archiv der Mailingliste  : http://www.lackas.net/imp/ma/
Imperia-Resource-Page    : http://www.lackas.net/imp/
Wie zitiere ich richtig? : http://learn.to/quote/
Abmelden                 : mailto:?body=unsubscribe
Attachments
 1  +-[no description] multipart/signed  
 2    |-[no description] multipart/mixed  
 3    | |-index.html message/rfc822  
 4    | +-codeinclude_i5.patch.txt text/plain made from text/plain  
 5    +-mail.pgp application/pgp-signature  

 Download codeinclude_i5.patch.txt

Index: site/modules/core/site_createlib.pm
===================================================================
RCS file: /home/cvsroot/master/i5/site/modules/core/Attic/site_createlib.pm,v
retrieving revision 1.26.2.41.4.14
diff -u -r1.26.2.41.4.14 site_createlib.pm
--- site/modules/core/site_createlib.pm	2002/02/19 07:56:03	1.26.2.41.4.14
+++ site/modules/core/site_createlib.pm	2002/08/01 17:05:35
@@ -179,17 +179,24 @@
 		}


-		if ($temp =~ /<!--CODEINCLUDE:([^>]*)-->/) {
-			$file  = $SYSTEM_CONF{'SITE-DIR'} . "/include/$1";
-			if (-e $file) {
-				@newcode = open_file($file);
-				$new = join (@newcode);
-				if (($file =~ /\.pl$/) || ($file =~ /\.perl$/)) {
-					eval(@newcode);
-				}
-				$temp =~ s/<!--CODEINCLUDE:([^>]*)-->/$new/g;
+		###############################################
+		# CODEINCLUDE bugfix
+		# (c) 2002 Christian Lackas, 
+		# http://www.lackas.net/imp/
+		#
+		$temp =~ s°<!--CODEINCLUDE:(.*?)-->°
+			$file  = "$SYSTEM_CONF{'SITE-DIR'}/include/$1";
+			if (open FILE, $file) {
+				local $/;
+				$new = <FILE>;
+				eval $new if $file =~ /\.p(?:er)?l$/;
+				$new
+			} else {
+				"open($file) failed: $!";
 			}
-		}
+		°exg;
+		#
+		###############################################

 		# TCOUNTER SECTION -----------------------------------
 		while ($temp =~ /(<!--TCOUNTER:(\w+)\+(\d+)-->)/) {

 Download mail.pgp

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9SWu1vfdv1KxkntkRArVlAKCf3PNrumsbJ1A5hTaMrvpHLDEZ8wCffMzH
wVZhyvAnxVCJU5KhpXcofaQ=
=ytnR
-----END PGP SIGNATURE-----

ATTENTION: HTML attachments to this mail have been converted to plain text to prevent you from possibly malicious HTML files. Other attachments are included here without any checking. Choose your own poison! The maintainers of this site cannot be held responsible for any damage caused by these attachments.

 I5.0219 - Probleme mit CODEINCLUDE
 Previous Thread
 Next Thread
 Start of Thread
 Reference
 Previous Reply
 This Message
 Reply
 Next Reply
 
 08/01/02 14:19:01 GMT  Sebastian Schalipp
 08/01/02 15:36:44 GMT  +--Christian Lackas
 08/01/02 16:13:52 GMT    +--Sebastian Schalipp
 08/01/02 16:25:41 GMT      +--Christian Lackas
 08/01/02 16:34:46 GMT        +--Sebastian Schalipp
 08/01/02 17:11:20 GMT          +--Christian Lackas
 08/01/02 18:42:54 GMT            +--Sebastian Schalipp

Powered by Imperia
Home | Top | Imprint