Exemplo n.º 1
0
function handleMessage($msg)
{
    if (!$msg) {
        return;
    }
    $Opt = $msg['operation'];
    $data = $msg;
    $Response = array();
    switch ($Opt) {
        case 'count':
            $Response = handleCount($data);
            break;
        case 'regist':
            $Response = handleRegist($data);
            break;
        case 'login':
            $Response = handleLogin($data);
            break;
        case 'updatePW':
            $Response = handleUpdatePW($data);
            break;
        case 'userdata':
            $Response = handleUserData($data);
            break;
        case 'updateUserData':
            $Response = handleUpdateUserData($data);
            break;
        case 'logout':
            $Response = handleLogout($data);
            break;
        case 'search':
            $Response = handleSearch($data, false);
            break;
        case 'searchAll':
            $Response = handleSearch($data, true);
            break;
        case 'uploadHeadImage':
            $Response = handleUploadHeadImage($data);
        default:
            break;
    }
    echo json_encode($Response);
}
Exemplo n.º 2
0
define('STATUS_ALL_PARTIAL', _('Started, but Incomplete'));
define('STATUS_SOME_PARTIAL', _('Some Finished, some Incomplete'));
define('STATUS_FINISHED', _('Finished'));
// miscellaneous
define('FORMAT_OUTPUT_DATE', isset($ESPCONFIG['date_format']) ? $ESPCONFIG['date_format'] : '%Y-%m-%d');
// }}}
// ensure we are configured to want this page
if (!$GLOBALS['ESPCONFIG']['dashboard_enable']) {
    paint_header();
    echo mkerror(_('Feature disabled; set dashboard_enable = true in your configuration to engage.'));
    paint_footer();
    exit;
}
// handle any button press events
handleLogin();
handleLogout();
handleChangeProfile();
handleChangePassword();
handleHelp();
// dispatch to the right painter
if (is_session_authenticated()) {
    paint_authenticated();
} else {
    paint_non_authenticated();
}
/* button handlers */
// {{{ handleLogin()                   Handle a log in button press
function handleLogin()
{
    $handleLogin = !is_session_authenticated() && isset($_REQUEST['doLogin']) && !empty($_REQUEST['username']) && !empty($_REQUEST['password']) ? true : false;
    if ($handleLogin) {