Commits

Shrikant Sharat Kandula committed e194a9d

Added more comments as short descriptions of actions

  • Participants
  • Parent commits ef453cd

Comments (0)

Files changed (1)

File pollfresh.php

 /********************************************************************************/
 /* CONTENT ACTIONS                                                              */
 /********************************************************************************/
+// Get the action requested
 $action = null;
 if(isset($_SERVER['PATH_INFO'])) {
     $action = trim($_SERVER['PATH_INFO'], '/');
 }
 
+// If no action given, show the welcome page
 if($action == null) {
     header('Content-Type: text/html');
     die($_html);
 }
 
+// Application javascript file
 if($action == 'js') {
     header('Content-Type: application/javascript');
     die($_js);
 }
 
+// Greasemonkey script action
 if($action == 'gm.user.js') {
     header('Content-Type: application/javascript');
     header('Content-Disposition: filename="pollfresh.user.js"');
     die($_gm);
 }
 
+// Prepare for application actions
 $response = array();
 session_name('pollfresh');
 session_start();
 /********************************************************************************/
 /* APPLICATION ACTIONS                                                          */
 /********************************************************************************/
+// Start a watch session
 if($action == 'start') {
 
     $response['sid'] = session_id();
 
 }
 
+// Poll action to check if there are any changes among watched files
 else if($action == 'poll') {
     list($response['changes'], $response['deletes']) = checkFiles();
 }
 
+// Comet based poll. Experimental
 else if($action == 'comet-poll') {
     while(empty($response['changes']) and empty($response['deletes'])) {
         sleep(1);
     }
 }
 
+// An action to send the user a notification. Experimental
 else if($action == 'notify') {
     notify($_GET['message']);
 }
 
+// End a session, and hence watching
 else if($action == 'end') {
     session_destroy();
     $response['ended'] = true;