diff -r 18cb05f027a0 -r 954019f62866 web/event_process.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/event_process.php Sun Nov 24 03:13:33 2013 +0100 @@ -0,0 +1,155 @@ +open($zip_path, ZipArchive::CREATE) === FALSE) { + return FALSE; + } + $config_content = " $value) { + $config_content .= " '$key' => '$value',\n"; + } + $config_content .= ");\n"; + + $zip->addEmptyDir($event_title); + $zip->addFromString("$zip_folder/config.php", $config_content); + + $zip->addEmptyDir("$event_title/images"); + foreach ($files as $key => $file_desc) { + if($file_desc['size']>0) { + $zip->addFile($file_desc['tmp_name'], "$event_title/images/".$file_desc['name']); + } + } + + return $zip->close(); +} + +/** + * Modifies a string to remove all non ASCII characters and spaces. + */ +function slugify($text) +{ + // replace non letter or digits by - + $text = preg_replace('~[^\\pL\d]+~u', '-', $text); + + // trim + $text = trim($text, '-'); + + // transliterate + if (function_exists('iconv')) + { + $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text); + } + + // lowercase + $text = strtolower($text); + + // remove unwanted characters + $text = preg_replace('~[^-\w]+~', '', $text); + + if (empty($text)) + { + return 'n-a'; + } + + return $text; +} + +?> + + + + + + Polemic Tweet — event form + + + + ' rel='stylesheet' type='text/css'> + ' rel='stylesheet' type='text/css'> + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
+

".$user_data['error']."

"; + } + else { + + + $config_values = array_merge($_POST); + + foreach ($_FILES as $key => $value) { + $config_values[$key] = "images/".basename($value['name']); + } + + $event_title = slugify($config_values['title']); + + $zip_filename = "$C_event_props/$event_title.zip"; + + create_zip($zip_filename, $event_title, $config_values, $_FILES); + + print("
"); + print $translate->_("Event_recorded_message"); + print("
"); + } + ?> + + \ No newline at end of file