correct event form bugs (add slashes, treat boolean values differently) V02.48
authorYves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
Wed, 27 Nov 2013 13:21:24 +0100
changeset 1004 1eff91564807
parent 1003 366c873e2e29
child 1005 8aca18c0da85
correct event form bugs (add slashes, treat boolean values differently)
web/event_form.php
web/event_process.php
web/rsln/index.php
--- a/web/event_form.php	Wed Nov 27 13:03:08 2013 +0100
+++ b/web/event_form.php	Wed Nov 27 13:21:24 2013 +0100
@@ -111,7 +111,8 @@
 				</div>
 				<div class="event-field">
 					<label for="islive"><?php print $translate->_("islive");?></label>
-					<input type="checkbox" name="islive" id="islive"/>
+					<input type="hidden" name="islive" value="__FALSE__"/>
+					<input type="checkbox" name="islive" id="islive" value="__TRUE__"/>
 					<div class="event-field-help"><?php print $translate->_("islive_help"); ?></div>
 				</div>
 				<div class="event-field">
--- a/web/event_process.php	Wed Nov 27 13:03:08 2013 +0100
+++ b/web/event_process.php	Wed Nov 27 13:21:24 2013 +0100
@@ -15,12 +15,21 @@
     }
     $config_content = "<?php\n\$config = array(\n";
     foreach ($config_values as $key => $value) {
-        $config_content .= "    '$key' => '$value',\n";
+    	if($value === "__TRUE__") {
+    		$config_content .= "    '$key' => true,\n";
+    	}
+    	elseif ($value === "__FALSE__") {
+    		$config_content .= "    '$key' => false,\n";
+    	}
+    	else {
+    		$config_content .= "    '$key' => \"".addslashes($value)."\",\n";
+    	}
     }
     $config_content .= ");\n";
     
     $zip->addEmptyDir($event_title);
-    $zip->addFromString("$zip_folder/config.php", $config_content);
+    $zip->addFromString("$event_title/config.php", $config_content);
+    $zip->addFromString("$event_title/index.php", "<?php\n// Permanent redirection\n\nheader(\"HTTP/1.1 301 Moved Permanently\");\nheader(\"Location: client.php\");\nexit();");
     
     $zip->addEmptyDir("$event_title/images");
     foreach ($files as $key => $file_desc) {
--- a/web/rsln/index.php	Wed Nov 27 13:03:08 2013 +0100
+++ b/web/rsln/index.php	Wed Nov 27 13:21:24 2013 +0100
@@ -3,4 +3,3 @@
 header("HTTP/1.1 301 Moved Permanently");
 header("Location: polemicaltimeline.php");
 exit();
-?>
\ No newline at end of file