# along with wfpl; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-require_once('code/wfpl/misc.php');
+require_once('code/wfpl/file.php');
function dwt_reset() {
$GLOBALS['_dwt_keys'] = array('<!-- TemplateEndEditable -->');
}
function format_yesno($str) {
- if($str) {
- return "Yes";
+ if($str && $str != 'No') {
+ return 'Yes';
} else {
- return "No";
+ return 'No';
}
}
# along with wfpl; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-# This exists because file_get_contents() is not documented well. (It says that
-# the second parameter is optional, but does not specify what happens when you
-# do not pass anything.) And because it's nice to work in PHP4.2
-function read_whole_file($name) {
- $fd = fopen($name, 'r');
- if($fd === false) {
- die("Failed to read file: '$name'");
- }
- $file_data = fread($fd, filesize($name));
- fclose($fd);
- return $file_data;
-}
-
function unix_newlines($str) {
$str = str_replace("\r\n", "\n", $str);
return str_replace("\r", "\n", $str);
}
mkdir("$tmpdir/$dirname");
foreach($files as $filename => $file_data) {
+ if(substr($filename, -3) == ' ->') {
+ $filename = substr($filename, 0, -3);
+ $link = true;
+ } else {
+ $link = false;
+ }
$filename_fixed = ereg_replace('[^a-zA-Z0-9_.-]', '', $filename);
if($filename != $filename_fixed) {
die("Invalid filename for tar archive");
}
- write_file("$tmpdir/$dirname/$filename", $file_data);
+ if($link) {
+ $target = ereg_replace('[^a-zA-Z0-9_./-]', '', $file_data);
+ system("/bin/ln -s $file_data \"$tmpdir/$dirname/$filename\"");
+ } else {
+ write_file("$tmpdir/$dirname/$filename", $file_data);
+ }
}
if(function_exists($extra)) {
function add_wfpl_dir($dir) {
mkdir("$dir/code");
- system("/bin/cp -HRp 'code/wfpl' '$dir/code/'", $return_code);
+ system("rsync -plr --exclude=\".git\" --exclude=\"*.swp\" 'code/wfpl/' '$dir/code/wfpl/'", $return_code);
if($return_code != 0) {
- die("ERROR: while trying to copy wfpl into archive: cp returned $return_code");
+ die("ERROR: while trying to copy wfpl into archive: rsync returned $return_code");
}
- system("/bin/rm -rf '$dir/code/wfpl/.git'");
}
# them is run
require_once('code/wfpl/encode.php');
-require_once('code/wfpl/misc.php'); # to get read_whole_file()
+require_once('code/wfpl/misc.php');
+require_once('code/wfpl/file.php');
class tem {
var $keyval; # an array containing key/value pairs