[Fwd: Bug#564557: mlmmj-php-web-admin: class.FastTemplate.php is
Hi,
A bug has been sent against MLMMJ, because the mlmmj-php-web-admin is non-free. Would there be a way to remove the class.FastTemplate.php file from the MLMMJ, as otherwise, there will be no way to have mlmmj-php-web-admin included in Debian?
Thomas
-------- Original Message --------
Subject: Bug#564557: mlmmj-php-web-admin: class.FastTemplate.php is non-free
Resent-Date: Sun, 10 Jan 2010 08:12:01 +0000, Sun, 10 Jan 2010 08:12:04
+0000
Resent-From: Ansgar Burchardt <[email protected]>
Resent-To: [email protected]
Resent-CC: Daniel Walrond <[email protected]>
Date: Sun, 10 Jan 2010 17:05:32 +0900
From: Ansgar Burchardt <[email protected]>
Reply-To: Ansgar Burchardt <[email protected]>, [email protected]
To: Debian Bug Tracking System <[email protected]>
Package: mlmmj-php-web-admin
Version: 1.2.15-1.1
Severity: serious
Justification: non-free content in main
Hi,
the file class.FastTemplate.php contains the following license statement:
This program is released under the General Artistic License.
This program is free software; you can redistribute it and/or modify it under the GNU General Artistic License, with the following stipulations;
Changes or modifications must retain these Copyright statements.
Changes or
modifications must be submitted to all AUTHORS.
The requirement to send changes to the authors makes it non-free.
Regards,
Ansgar
Re: [Fwd: Bug#564557: mlmmj-php-web-admin: class.FastTemplate.php
Hi,
in openSUSE we use a patch to replace class.FastTemplate.php with class.rFastTemplate.php. Feel free to use attached patch to fix this issue.
Best,
Christoph
Quoted 36 lines · Thomas Goirand
Hi,
A bug has been sent against MLMMJ, because the mlmmj-php-web-admin is non-free. Would there be a way to remove the class.FastTemplate.php file from the MLMMJ, as otherwise, there will be no way to have mlmmj-php-web-admin included in Debian?
Thomas
-------- Original Message --------
Subject: Bug#564557: mlmmj-php-web-admin: class.FastTemplate.php is non-free
Resent-Date: Sun, 10 Jan 2010 08:12:01 +0000, Sun, 10 Jan 2010 08:12:04
+0000
Resent-From: Ansgar Burchardt <[email protected]>
Resent-To: [email protected]
Resent-CC: Daniel Walrond <[email protected]>
Date: Sun, 10 Jan 2010 17:05:32 +0900
From: Ansgar Burchardt <[email protected]>
Reply-To: Ansgar Burchardt <[email protected]>, [email protected]
To: Debian Bug Tracking System <[email protected]>Package: mlmmj-php-web-admin
Version: 1.2.15-1.1
Severity: serious
Justification: non-free content in mainHi,
the file class.FastTemplate.php contains the following license statement:
This program is released under the General Artistic License.
This program is free software; you can redistribute it and/or modify it under the GNU General Artistic License, with the following stipulations;
Quoted 8 lines
Changes or modifications must retain these Copyright statements.
Changes or
modifications must be submitted to all AUTHORS.The requirement to send changes to the authors makes it non-free.
Regards,
Ansgar
contrib/web/php-admin/htdocs/class.FastTemplate.php +0 -737
@@ -1,737 +0,0 @@ -<?php - -/* class.FastTemplate.php - * - * Original Perl module CGI::FastTemplate by Jason Moore - * Copyright (c) 1998, Jason Moore <jmoore at sober dot com> - * - * PHP3 port by CDI - * Copyright (c) 1999 CDI <cdi at thewebmasters dot net> - * - * PHP4 support added by Christoph Thiel for mlmmj's php-admin - * Copyright (c) 2004 Christoph Thiel <ct at kki dot org> - * - * This program is released under the General Artistic License. - * - * This program is free software; you can redistribute it and/or modify it - * under the GNU General Artistic License, with the following stipulations; - * - * Changes or modifications must retain these Copyright statements. Changes or - * modifications must be submitted to all AUTHORS. - * - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the Artistic License for more - * details. This software is distributed AS-IS. - */ - -class FastTemplate { - - var $FILELIST = array(); /* Holds the array of filehandles - * FILELIST[HANDLE] == "fileName" - */ - - var $DYNAMIC = array(); /* Holds the array of dynamic - * blocks, and the fileHandles they - * live in. - */ - - var $PARSEVARS = array(); /* Holds the array of Variable - * handles. - * PARSEVARS[HANDLE] == "value" - */ - - var $LOADED = array(); /* We only want to load a template - * once - when it's used. - * LOADED[FILEHANDLE] == 1 if loaded - * undefined if not loaded yet. - */ - - var $HANDLE = array(); /* Holds the handle names assigned - * by a call to parse() - */ - - var $ROOT = ""; /* Holds path-to-templates */ - - var $ERROR = ""; /* Holds the last error message */ - - var $LAST = ""; /* Holds the HANDLE to the last - * template parsed by parse() - */ - - var $STRICT = true; /* Strict template checking. - * Unresolved vars in templates will - * generate a warning when found. - */ - -/******************************************************************************/ - - function FastTemplate($pathToTemplates = "") - { - global $php_errormsg; - - if(!empty($pathToTemplates)) - { - $this->set_root($pathToTemplates); - } - - } - - /* - * All templates will be loaded from this "root" directory - * Can be changed in mid-process by re-calling with a new - * value. - */ - - function set_root($root) - { - $trailer = substr($root,-1); - - if( (ord($trailer)) != 47 ) - { - $root = "$root". chr(47); - } - - if(is_dir($root)) - { - $this->ROOT = $root; - } - else - { - $this->ROOT = ""; - $this->error("Specified ROOT dir [$root] is not a directory"); - } - } - - - /* Calculates current microtime - * I throw this into all my classes for benchmarking purposes - * It's not used by anything in this class and can be removed - * if you don't need it. - */ - - function utime() - { - $time = explode( " ", microtime()); - $usec = (double)$time[0]; - $sec = (double)$time[1]; - return $sec + $usec; - } - - - /* Strict template checking, if true sends warnings to STDOUT when - * parsing a template with undefined variable references - * Used for tracking down bugs-n-such. Use no_strict() to disable. - */ - - function strict() - { - $this->STRICT = true; - } - - - /* Silently discards (removes) undefined variable references - * found in templates - */ - - function no_strict() - { - $this->STRICT = false; - } - - - /* A quick check of the template file before reading it. - * This is -not- a reliable check, mostly due to inconsistencies - * in the way PHP determines if a file is readable. - */ - - function is_safe($filename) - { - if(!file_exists($filename)) - { - $this->error("[$filename] does not exist",0); - return false; - } - return true; - } - - - /* Grabs a template from the root dir and - * reads it into a (potentially REALLY) big string - */ - - function get_template($template) - { - if(empty($this->ROOT)) - { - $this->error("Cannot open template. Root not valid.",1); - return false; - } - - $filename = "$this->ROOT"."$template"; - - $contents = implode("",(@file($filename))); - if( (!$contents) or (empty($contents)) ) - { - $this->error("get_template() failure: [$filename] $php_errormsg",1); - } - - return $contents; - - } - - - /* Prints the warnings for unresolved variable references - * in template files. Used if STRICT is true - */ - - function show_unknowns($Line) - { - $unknown = array(); - if (ereg("(\{[A-Z0-9_]+\})",$Line,$unknown)) - { - $UnkVar = $unknown[1]; - if(!(empty($UnkVar))) - { - @error_log("[FastTemplate] Warning: no value found for variable: $UnkVar ",0); - } - } - } - - - /* This routine get's called by parse() and does the actual - * {VAR} to VALUE conversion within the template. - */ - - function parse_template($template, $tpl_array) - { - while ( list ($key,$val) = each ($tpl_array) ) - { - if (!(empty($key))) - { - if(gettype($val) != "string") - { - settype($val,"string"); - } - - $template = ereg_replace("\{$key\}","$val","$template"); - //$template = str_replace("{$key}","$val","$template"); - } - } - - if(!$this->STRICT) - { - // Silently remove anything not already found - - $template = ereg_replace("\{([A-Z0-9_]+)\}","",$template); - } - else - { - // Warn about unresolved template variables - if (ereg("({[A-Z0-9_]+})",$template)) - { - $unknown = split("\n",$template); - while (list ($Element,$Line) = each($unknown) ) - { - $UnkVar = $Line; - if(!(empty($UnkVar))) - { - $this->show_unknowns($UnkVar); - } - } - } - } - return $template; - - } - - - /* The meat of the whole class. The magic happens here. */ - - function parse($ReturnVar, $FileTags) - { - $append = false; - $this->LAST = $ReturnVar; - $this->HANDLE[$ReturnVar] = 1; - - if (gettype($FileTags) == "array") - { - unset($this->$ReturnVar); // Clear any previous data - - while ( list ( $key , $val ) = each ( $FileTags ) ) - { - if ( (!isset($this->$val)) || (empty($this->$val)) ) - { - $this->LOADED["$val"] = 1; - if(isset($this->DYNAMIC["$val"])) - { - $this->parse_dynamic($val,$ReturnVar); - } - else - { - $fileName = $this->FILELIST["$val"]; - $this->$val = $this->get_template($fileName); - } - } - - // Array context implies overwrite - - $this->$ReturnVar = $this->parse_template($this->$val,$this->PARSEVARS); - - // For recursive calls. - - $this->assign( array( $ReturnVar => $this->$ReturnVar ) ); - - } - } // end if FileTags is array() - else - { - // FileTags is not an array - - $val = $FileTags; - - if( (substr($val,0,1)) == '.' ) - { - // Append this template to a previous ReturnVar - - $append = true; - $val = substr($val,1); - } - - if ( (!isset($this->$val)) || (empty($this->$val)) ) - { - $this->LOADED["$val"] = 1; - if(isset($this->DYNAMIC["$val"])) - { - $this->parse_dynamic($val,$ReturnVar); - } - else - { - $fileName = $this->FILELIST["$val"]; - $this->$val = $this->get_template($fileName); - } - } - - if($append) - { - $this->$ReturnVar .= $this->parse_template($this->$val,$this->PARSEVARS); - } - else - { - $this->$ReturnVar = $this->parse_template($this->$val,$this->PARSEVARS); - } - - // For recursive calls. - - $this->assign(array( $ReturnVar => $this->$ReturnVar) ); - - } - return; - } - - - function FastPrint($template = "") - { - if(empty($template)) - { - $template = $this->LAST; - } - - if( (!(isset($this->$template))) || (empty($this->$template)) ) - { - $this->error("Nothing parsed, nothing printed",0); - return; - } - else - { - print $this->$template; - } - return; - } - - - function fetch($template = "") - { - if(empty($template)) - { - $template = $this->LAST; - } - if( (!(isset($this->$template))) || (empty($this->$template)) ) - { - $this->error("Nothing parsed, nothing printed",0); - return ""; - } - - return($this->$template); - } - - - function define_dynamic($Macro, $ParentName) - { - // A dynamic block lives inside another template file. - // It will be stripped from the template when parsed - // and replaced with the {$Tag}. - - $this->DYNAMIC["$Macro"] = $ParentName; - return true; - } - - - function parse_dynamic($Macro,$MacroName) - { - // The file must already be in memory. - - $ParentTag = $this->DYNAMIC["$Macro"]; - if( (!$this->$ParentTag) or (empty($this->$ParentTag)) ) - { - $fileName = $this->FILELIST[$ParentTag]; - $this->$ParentTag = $this->get_template($fileName); - $this->LOADED[$ParentTag] = 1; - } - if($this->$ParentTag) - { - $template = $this->$ParentTag; - $DataArray = split("\n",$template); - $newMacro = ""; - $newParent = ""; - $outside = true; - $start = false; - $end = false; - while ( list ($lineNum,$lineData) = each ($DataArray) ) - { - $lineTest = trim($lineData); - if("<!-- BEGIN DYNAMIC BLOCK: $Macro -->" == "$lineTest" ) - { - $start = true; - $end = false; - $outside = false; - } - if("<!-- END DYNAMIC BLOCK: $Macro -->" == "$lineTest" ) - { - $start = false; - $end = true; - $outside = true; - } - if( (!$outside) and (!$start) and (!$end) ) - { - $newMacro .= "$lineData\n"; // Restore linebreaks - } - if( ($outside) and (!$start) and (!$end) ) - { - $newParent .= "$lineData\n"; // Restore linebreaks - } - if($end) - { - $newParent .= "{$MacroName}\n"; - } - // Next line please - if($end) { $end = false; } - if($start) { $start = false; } - } // end While - - $this->$Macro = $newMacro; - $this->$ParentTag = $newParent; - return true; - - } // $ParentTag NOT loaded - MAJOR oopsie - else - { - @error_log("ParentTag: [$ParentTag] not loaded!",0); - $this->error("ParentTag: [$ParentTag] not loaded!",0); - } - return false; - } - - - /* Strips a DYNAMIC BLOCK from a template. */ - - function clear_dynamic($Macro="") - { - if(empty($Macro)) { return false; } - - // The file must already be in memory. - - $ParentTag = $this->DYNAMIC["$Macro"]; - - if( (!$this->$ParentTag) or (empty($this->$ParentTag)) ) - { - $fileName = $this->FILELIST[$ParentTag]; - $this->$ParentTag = $this->get_template($fileName); - $this->LOADED[$ParentTag] = 1; - } - - if($this->$ParentTag) - { - $template = $this->$ParentTag; - $DataArray = split("\n",$template); - $newParent = ""; - $outside = true; - $start = false; - $end = false; - while ( list ($lineNum,$lineData) = each ($DataArray) ) - { - $lineTest = trim($lineData); - if("<!-- BEGIN DYNAMIC BLOCK: $Macro -->" == "$lineTest" ) - { - $start = true; - $end = false; - $outside = false; - } - if("<!-- END DYNAMIC BLOCK: $Macro -->" == "$lineTest" ) - { - $start = false; - $end = true; - $outside = true; - } - if( ($outside) and (!$start) and (!$end) ) - { - $newParent .= "$lineData\n"; // Restore linebreaks - } - // Next line please - if($end) { $end = false; } - if($start) { $start = false; } - } // end While - - $this->$ParentTag = $newParent; - return true; - - } // $ParentTag NOT loaded - MAJOR oopsie - else - { - @error_log("ParentTag: [$ParentTag] not loaded!",0); - $this->error("ParentTag: [$ParentTag] not loaded!",0); - } - return false; - } - - - function define($fileList) - { - while ( list ($FileTag,$FileName) = each ($fileList) ) - { - $this->FILELIST["$FileTag"] = $FileName; - } - return true; - } - - - function clear_parse($ReturnVar = "") - { - $this->clear($ReturnVar); - } - - - function clear($ReturnVar="") - { - // Clears out hash created by call to parse() - - if(!empty($ReturnVar)) - { - if( (gettype($ReturnVar)) != "array") - { - unset($this->$ReturnVar); - return; - } - else - { - while ( list ($key,$val) = each ($ReturnVar) ) - { - unset($this->$val); - } - return; - } - } - - // Empty - clear all of them - - while ( list ( $key,$val) = each ($this->HANDLE) ) - { - $KEY = $key; - unset($this->$KEY); - } - return; - - } - - - function clear_all () - { - $this->clear(); - $this->clear_assign(); - $this->clear_define(); - $this->clear_tpl(); - - return; - - } - - - function clear_tpl ($fileHandle = "") - { - if(empty($this->LOADED)) - { - // Nothing loaded, nothing to clear - - return true; - } - if(empty($fileHandle)) - { - // Clear ALL fileHandles - - while ( list ($key, $val) = each ($this->LOADED) ) - { - unset($this->$key); - } - unset($this->LOADED); - - return true; - } - else - { - if( (gettype($fileHandle)) != "array") - { - if( (isset($this->$fileHandle)) || (!empty($this->$fileHandle)) ) - { - unset($this->LOADED[$fileHandle]); - unset($this->$fileHandle); - return true; - } - } - else - { - while ( list ($Key, $Val) = each ($fileHandle) ) - { - unset($this->LOADED[$Key]); - unset($this->$Key); - } - return true; - } - } - - return false; - - } - - - function clear_define ( $FileTag = "" ) - { - if(empty($FileTag)) - { - unset($this->FILELIST); - return; - } - - if( (gettype($Files)) != "array") - { - unset($this->FILELIST[$FileTag]); - return; - } - else - { - while ( list ( $Tag, $Val) = each ($FileTag) ) - { - unset($this->FILELIST[$Tag]); - } - return; - } - } - - /* Clears all variables set by assign() */ - - function clear_assign () - { - if(!(empty($this->PARSEVARS))) - { - while(list($Ref,$Val) = each ($this->PARSEVARS) ) - { - unset($this->PARSEVARS["$Ref"]); - } - } - } - - - function clear_href ($href) - { - if(!empty($href)) - { - if( (gettype($href)) != "array") - { - unset($this->PARSEVARS[$href]); - return; - } - else - { - while (list ($Ref,$val) = each ($href) ) - { - unset($this->PARSEVARS[$Ref]); - } - return; - } - } - else - { - // Empty - clear them all - - $this->clear_assign(); - } - return; - } - - - function assign ($tpl_array, $trailer="") - { - if(gettype($tpl_array) == "array") - { - while ( list ($key,$val) = each ($tpl_array) ) - { - if (!(empty($key))) - { - // Empty values are allowed - // Empty Keys are NOT - - $this->PARSEVARS["$key"] = $val; - } - } - } - else - { - // Empty values are allowed in non-array context now. - if (!empty($tpl_array)) - { - $this->PARSEVARS["$tpl_array"] = $trailer; - } - } - } - - /* Return the value of an assigned variable. - * Christian Brandel [email protected] - */ - - function get_assigned($tpl_name = "") - { - - if(empty($tpl_name)) { return false; } - if(isset($this->PARSEVARS["$tpl_name"])) - { - return ($this->PARSEVARS["$tpl_name"]); - } - else - { - return false; - } - } - - - function error ($errorMsg, $die = 0) - { - $this->ERROR = $errorMsg; - - if($die == 1) - die("ERROR: $this->ERROR <BR> \n"); - else - echo "ERROR: ".$this->ERROR."<BR>\n"; - } -} - -?>
contrib/web/php-admin/htdocs/class.rFastTemplate.php +1087 -0
1,087 lines not on this page · raw message
contrib/web/php-admin/htdocs/edit.php +2 -2
@@ -27,7 +27,7 @@ */ require("../conf/config.php"); -require("class.FastTemplate.php"); +require("class.rFastTemplate.php"); function mlmmj_boolean($name, $nicename, $text) {
@@ -97,7 +97,7 @@ function encode_entities($str) { return htmlentities($str); } -$tpl = new FastTemplate($templatedir); +$tpl = new rFastTemplate($templatedir); $list = $HTTP_GET_VARS["list"];
contrib/web/php-admin/htdocs/index.php +2 -2
@@ -26,10 +26,10 @@ * IN THE SOFTWARE. */ -require("class.FastTemplate.php"); +require("class.rFastTemplate.php"); require("../conf/config.php"); -$tpl = new FastTemplate($templatedir); +$tpl = new rFastTemplate($templatedir); $tpl->define(array("main" => "index.html"));
contrib/web/php-admin/htdocs/save.php +2 -2
@@ -27,7 +27,7 @@ */ require("../conf/config.php"); -require("class.FastTemplate.php"); +require("class.rFastTemplate.php"); function mlmmj_boolean($name, $nicename, $text) {
@@ -72,7 +72,7 @@ function encode_entities($str) { return htmlentities($str); } -$tpl = new FastTemplate($templatedir); +$tpl = new rFastTemplate($templatedir); $list = $HTTP_POST_VARS["list"];
Re: [Fwd: Bug#564557: mlmmj-php-web-admin: class.FastTemplate.php
In reply to Thomas GoirandQuoted 9 lines
Hi,
in openSUSE we use a patch to replace class.FastTemplate.php with class.rFastTemplate.php. Feel free to use attached patch to fix this issue.
Best,
Christoph
It would be very nice if the upstream version could be changed so that MLMMJ v1.17 was released totaly free, and both Debian and suse wouldn't have to modify the upstraem sources! Can someone commit it?
Thomas
Re: [Fwd: Bug#564557: mlmmj-php-web-admin: class.FastTemplate.php
In reply to Thomas GoirandQuoted 3 lines · On Sun, 2010-01-10 at 12:15 +0000, [email protected] wrote:
Quoted 3 lines
in openSUSE we use a patch to replace class.FastTemplate.php with class.rFastTemplate.php. Feel free to use attached patch to fix this issue.
Thanks Christoph, I've committed it.
Quoted 2 lines
It would be very nice if the upstream version could be changed so that MLMMJ v1.17 was released totaly free
Just for the record: mlmmj itself is released under The MIT License, which is considered a "free license" by most people. The various contributed projects are licensed under whatever license their authors chose.
Quoted 2 lines
and both Debian and suse wouldn't have to modify the upstraem sources! Can someone commit it?
I've committed it, and rolled a new RC. It is available for download here:
http://mlmmj.mmj.dk/files/mlmmj-1.2.17-RC2.tar.bz24dd7b6c12675d21478b88b515e70ef5c
http://mlmmj.mmj.dk/files/mlmmj-1.2.17-RC2.tar.gzdcffd02b98d563409bd404bfbcd33d99
I don't like to roll a new RC when there are no known bugs in the old one, so I expect one thing in return: testing. Please test it. Please, please test it. Does it build on all platforms? Does it work as advertised?
Happy testing,
Morten
Signature · 3 lines
Morten Shearman Kirkegaard <[email protected]> CTO, FableTech http://fabletech.com/