You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							247 lines
						
					
					
						
							9.6 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							247 lines
						
					
					
						
							9.6 KiB
						
					
					
				| <?php | |
| 
 | |
|     session_start(); | |
| 
 | |
|     @include 'cgi-bin/conn.conn'; | |
|     @include 'cgi-bin/functions.inc'; | |
|     @include 'cgi-bin/params.inc'; | |
| 
 | |
|     $conn=@mysqli_connect($DATAhst,$DATAusr,$DATApwd,$DATAdtb)or die("CONNECTION ERROR"); | |
|     mysqli_set_charset($conn, "utf8"); | |
| 
 | |
| ?> | |
|  | |
|  | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
|  | |
|     <title>COZe</title> | |
|  | |
|     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
|     <meta name="description" content="COZe"> | |
|     <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'> | |
|  | |
|     <base href="<?php echo $BASE_URL;?>/"> | |
|     <?php | |
|     @include 'cssvendors.php'; | |
|     ?> | |
|  | |
| </head> | |
| <body> | |
|  | |
|     <div id="MainContent" class="container"> | |
|         <form method="post" enctype="multipart/form-data" class="add_message_form"> | |
|  | |
|         <?php | |
|  | |
|             if($_POST['title']) { | |
|                 $image=0; | |
|                 $imagePath=""; | |
|                 $text = explode("%break%", $_POST['text']); | |
|                 if(is_uploaded_file($_FILES['image']['tmp_name'])){ | |
|                     $image = date("YmdHis"); | |
|                     save_photo($_FILES['image']['tmp_name'],"images/upload/",$image); | |
|                     $imagePath = "/images/upload/$image.jpg"; | |
|                 } | |
|  | |
|                 $actions = array(); | |
|  | |
|                 if($_POST['action_title'][0] != ""){ | |
|                     foreach ($_POST['action_title'] as $index => $message) { | |
|                         $action_title = $_POST['action_title'][$index]; | |
|                         $action_description = $_POST['action_description'][$index]; | |
|                         $action_message = $_POST['action_message'][$index]; | |
|                         mysqli_query($conn, "INSERT INTO actions VALUES(null, '".$action_title."', '".$action_description."',".$action_message.")"); | |
|                         $actions[$index] = mysqli_insert_id($conn); | |
|                     } | |
|                 } | |
|  | |
|                 $q = mysqli_query($conn, "INSERT INTO messages VALUES(null, '".$_POST['session']."', '".convert($_POST['title'])."', | |
|                                             '".convert_mce($text[0])."', '".convert_mce($text[1])."', '$imagePath', | |
|                                             '".implode(",", $actions)."', '".$_POST['hours'].":".$_POST['minutes'].":".$_POST['seconds']."', | |
|                                             ".$_POST['progress'].")"); | |
|  | |
|  | |
|                 echo "<script>parent.window.location=parent.window.location</script>"; | |
|  | |
|             } else { | |
|         ?> | |
|  | |
|             <div class="row"> | |
|                 <div class="col-12"> | |
|                     <span class="font-12 text-grey">Session</span> | |
|                     <div class="row"> | |
|                         <div class="col"> | |
|                             <select name="session"> | |
|                             <?php | |
|                                 $qs = mysqli_query($conn, "SELECT * FROM `session` ORDER BY name"); | |
|  | |
|                                 while($rs = mysqli_fetch_array($qs)){ | |
|                                     echo "<option value=\"".$rs['id']."\">".$rs['name']."</option>\n"; | |
|                                 } | |
|                             ?> | |
|                             </select> | |
|                         </div> | |
|                     </div> | |
|                 </div> | |
|                 <div class="col-12"> | |
|                     <span class="font-12 text-grey">Message title</span> | |
|                     <input type="text" name="title"> | |
|                 </div> | |
|                 <div class="col-12"> | |
|                     <span class="font-12 text-grey">Message text</span> | |
|                     <textarea class="mce" name="text"></textarea> | |
|                 </div> | |
|                 <div class="col-12 mt-3"> | |
|                     <span class="font-12 text-grey">Image<br></span> | |
|                     <input type="file" name="image"> | |
|                 </div> | |
|  | |
|                 <div class="col-12"> | |
|                     <span class="font-12 text-grey">Actions</span> | |
|                     <div class="row item"> | |
|                             <div class="col-3 font-10 text-grey"> | |
|                                 Label | |
|                             </div> | |
|                             <div class="col-4 font-10 text-grey"> | |
|                                 Description | |
|                             </div> | |
|                             <div class="col-4 font-10 text-grey"> | |
|                                 Link to | |
|                             </div> | |
|                             <div class="col-1"></div> | |
|                         </div> | |
|                     </div> | |
|                     <div class="actions col-12"> | |
|                         <div class="row item"> | |
|                             <div class="col-3"> | |
|                                 <input type="text" name="action_title[]" placeholder="No action"> | |
|                             </div> | |
|                             <div class="col-4"> | |
|                                 <input type="text" name="action_description[]"> | |
|                             </div> | |
|                             <div class="col-4"> | |
|                                 <select name="action_message[]"> | |
|                                 <?php | |
|                                  $qm = mysqli_query($conn, "SELECT * FROM messages ORDER BY title"); | |
|                                     while($rm = mysqli_fetch_array($qm)){ | |
|                                         echo "<option value=\"".$rm['id']."\">".$rm['title']."</option>\n"; | |
|                                     } | |
|                                 ?> | |
|                                 </select> | |
|                             </div> | |
|                             <div class="col-1"> | |
|                                 <button class="button grey del-row mx-0" disabled><i class="fa fa-minus"></i></button> | |
|                             </div> | |
|                         </div> | |
|                     </div> | |
|                 </div> | |
|                 <div class="col-12"> | |
|                     <div class="row"> | |
|                         <div class="col-12 text-left p-0"> | |
|                             <button class="button grey add-row mx-0"><i class="fa fa-plus"></i></button> | |
|                         </div> | |
|                     </div> | |
|                 </div> | |
|  | |
|  | |
|  | |
|                 <div class="col-12 px-0"> | |
|                     <hr> | |
|                     <span class="font-12 text-grey">Schedule</span> | |
|                     <div class="row"> | |
|                         <div class="col"> | |
|                             <button class="button discard big full mx-0" id="btn_none">Not scheduled</button> | |
|                         </div> | |
|                         <div class="col"> | |
|                             <button class="button grey big full mx-0" id="btn_progress">Schedule</button> | |
|                         </div> | |
|                         <div class="col"> | |
|                             <button class="button grey big full mx-0" id="btn_timer">Start after</button> | |
|                         </div> | |
|                     </div> | |
|                 </div> | |
|  | |
|  | |
|                 <div class="col-6 mx-auto my-5 d-none" id="div_timer"> | |
|                     <span class="font-12 text-grey">Start after (HH:MM:SS)</span> | |
|                     <div class="row"> | |
|                         <div class="col"> | |
|                             <select name="hours" class="text-center hours"> | |
|                             <?php | |
|                                 for($i=0;$i<24;$i++){ | |
|                                     echo "<option value=\"".sprintf("%02d", $i)."\">".sprintf("%02d", $i)."</option>\n"; | |
|                                 } | |
|                             ?> | |
|                             </select> | |
|                         </div> | |
|                         <div class="col hseparator"> | |
|                             <select name="minutes" class="text-center minutes"> | |
|                             <?php | |
|                                 for($i=0;$i<60;$i++){ | |
|                                     echo "<option value=\"".sprintf("%02d", $i)."\">".sprintf("%02d", $i)."</option>\n"; | |
|                                 } | |
|                             ?> | |
|                             </select> | |
|                         </div> | |
|                         <div class="col hseparator"> | |
|                             <select name="seconds" class="text-center seconds"> | |
|                             <?php | |
|                                 for($i=0;$i<60;$i++){ | |
|                                     echo "<option value=\"".sprintf("%02d", $i)."\">".sprintf("%02d", $i)."</option>\n"; | |
|                                 } | |
|                             ?> | |
|                             </select> | |
|                         </div> | |
|                     </div> | |
|                 </div> | |
|  | |
|                 <div class="col-6 mx-auto my-5 d-none" id="div_progress"> | |
|                     <span class="font-12 text-grey">Progress</span> | |
|                     <div class="row"> | |
|                         <div class="col"> | |
|                             <select name="progress" class="text-center schedule"> | |
|                             <option value="0" style="display: none; opacity:0">0</option> | |
|                             <?php | |
|                                 for($i=1;$i<60;$i++){ | |
|                                     echo "<option value=\"$i\">$i</option>\n"; | |
|                                 } | |
|                             ?> | |
|                             </select> | |
|                         </div> | |
|                     </div> | |
|                 </div> | |
|  | |
|                 <div class="col-6 mx-auto my-5 text-center" id="div_none"> | |
|                     <span class="font-12 text-grey">Not scheduled</span> | |
|                 </div> | |
|  | |
|  | |
|  | |
|                 <div class="col-12 text-center p4 px-0"> | |
|                     <button type="submit" class="button big full confirm mx-0">Add message</button> | |
|                 </div> | |
|             </div> | |
|  | |
|         <?php | |
|             } | |
|         ?> | |
|  | |
|         </form> | |
|     </div> | |
|  | |
|     <?php | |
|         @include 'jsvendors.php'; | |
|         @include 'scripts/'.$getQ[0].'.php'; | |
|     ?> | |
|  | |
|  | |
| </body> | |
| </html> | |
|  | |
|  | |
|  | |
| <?php | |
| mysqli_close($conn); | |
| ?>
 |