| 
									
										
										
										
											2017-04-24 17:13:08 -06:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Make things happen when buttons are pressed and forms submitted. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | require_once __DIR__ . "/required.php"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-10 12:34:36 -06:00
										 |  |  | if ($VARS['action'] !== "signout") { | 
					
						
							|  |  |  |     dieifnotloggedin(); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-04-24 17:13:08 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-07 00:30:25 -06:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Redirects back to the page ID in $_POST/$_GET['source'] with the given message ID. | 
					
						
							|  |  |  |  * The message will be displayed by the app. | 
					
						
							|  |  |  |  * @param string $msg message ID (see lang/messages.php) | 
					
						
							|  |  |  |  * @param string $arg If set, replaces "{arg}" in the message string when displayed to the user. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-04-24 17:13:08 -06:00
										 |  |  | function returnToSender($msg, $arg = "") { | 
					
						
							|  |  |  |     global $VARS; | 
					
						
							|  |  |  |     if ($arg == "") { | 
					
						
							|  |  |  |         header("Location: app.php?page=" . urlencode($VARS['source']) . "&msg=" . $msg); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         header("Location: app.php?page=" . urlencode($VARS['source']) . "&msg=$msg&arg=$arg"); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     die(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | switch ($VARS['action']) { | 
					
						
							|  |  |  |     case "signout": | 
					
						
							|  |  |  |         session_destroy(); | 
					
						
							|  |  |  |         header('Location: index.php'); | 
					
						
							|  |  |  |         die("Logged out."); | 
					
						
							|  |  |  | } |