Initial Commit
This commit is contained in:
32
user_actions.php
Normal file
32
user_actions.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
if (!defined('__ROOT__')) {
|
||||
define('__ROOT__', dirname(__FILE__));
|
||||
}
|
||||
require_once(__ROOT__.'/chatterbox.php');
|
||||
|
||||
if(session_status()!=PHP_SESSION_ACTIVE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
if (!isset($_SESSION['chatterbox'])) {
|
||||
// Database initialization
|
||||
error_log("creating new session" . PHP_EOL);
|
||||
$_SESSION['chatterbox'] = new ChatterBox();
|
||||
}
|
||||
$chatterbox = $_SESSION['chatterbox'];
|
||||
|
||||
if(isset($_POST['action'])) {
|
||||
if($_POST['action'] == 'refresh_chat_list') {
|
||||
$chatterbox->display_chat_list();
|
||||
} else if ($_POST['action'] == 'set_selected_chat') {
|
||||
$chatterbox->selected_chat = intval($_POST['chat_id']);
|
||||
} else if ($_POST['action'] == 'refresh_messages') {
|
||||
$chatterbox->display_chat_history();
|
||||
} else if ($_POST['action'] == 'check_for_changes') {
|
||||
$chatterbox->check_for_changes();
|
||||
} else if ($_POST['action'] == 'send_message') {
|
||||
// TODO Figure out how to send iMessages via command line
|
||||
}
|
||||
$_SESSION['chatterbox'] = $chatterbox;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user