Beispiel #1
0
     global $check_token_exists;
     global $decode_body;
     $app->get('', $check_token_exists, function ($calendar_id) {
         get_members($calendar_id);
     });
     $app->post('', $check_token_exists, $decode_body, function ($calendar_id) {
         add_member($calendar_id);
     });
     $app->group('/:username', function () use($app) {
         global $check_token_exists;
         global $decode_body;
         $app->get('', $check_token_exists, function ($calendar_id, $username) {
             get_member($username, $calendar_id);
         });
         $app->put('', $check_token_exists, $decode_body, function ($calendar_id, $username) {
             edit_member($username, $calendar_id);
         });
         $app->delete('', $check_token_exists, function ($calendar_id, $username) {
             delete_member($username, $calendar_id);
         });
     });
 });
 $app->group('/events', function () use($app) {
     global $check_token_exists;
     global $decode_body;
     $app->get('', $check_token_exists, function ($calendar_id) {
         get_events($calendar_id);
     });
     $app->post('', $check_token_exists, $decode_body, function ($calendar_id) {
         create_event($calendar_id);
     });
function handle_submit()
{
    //    function safe($value){
    //       return mysql_real_escape_string($value);
    //    }
    //    function safe($value){
    //       return stripslashes_deep($value);
    //    }
    //Note: This is done by the ternary statement underneath.
    if (!array_key_exists('pv_phylum', $_POST)) {
        $_POST['pv_phylum'] = 'creativus';
    }
    $id = $_POST['member_id'];
    $submit = array('membername' => stripslashes_deep($_POST['pv_name']), 'title' => stripslashes_deep($_POST['pv_title']), 'dogname' => stripslashes_deep($_POST['dog_name']), 'dogbreed' => stripslashes_deep($_POST['dog_breed']), 'mainimage' => $_POST["mainImg"], 'hoverimage' => $_POST["hoverImg"], 'polaroid1' => $_POST["polaroid1"], 'polaroid2' => $_POST["polaroid2"], 'signature' => $_POST['pv_signature'], 'kingdom' => stripslashes_deep($_POST['pv_kingdom']), 'species' => stripslashes_deep($_POST['pv_species']), 'phylum' => array_key_exists('pv_phylum', $_POST) ? $_POST['pv_phylum'] : 'creativus', 'stimulant' => $_POST['pv_stimulant'], 'response' => stripslashes_deep($_POST['pv_response']), 'lefttopic' => $_POST['pv_leftcat'], 'righttopic' => $_POST['pv_rightcat'], 'stimulus' => stripslashes_deep($_POST['pv_stimulus']), 'location' => stripslashes_deep($_POST['pv_location']), 'fear' => stripslashes_deep($_POST['pv_fear']), 'threewords' => stripslashes_deep($_POST['pv_threewords']), 'ionce' => stripslashes_deep($_POST['pv_ionce']), 'couldntlive' => stripslashes_deep($_POST['pv_couldntlive']), 'turnonthe' => stripslashes_deep($_POST['pv_turnonthe']), 'beaker' => stripslashes_deep($_POST['pv_beaker']));
    if (empty($_POST['member_id'])) {
        if (!($_POST['mainImg'] and $_POST['hoverImg'])) {
            /*Go forth and*/
            die("New selections must include a main image and hover image.");
        } else {
            add_new_member($submit);
            echo "<h3> Update successful. New results will appear on refresh.</h3>";
        }
    } else {
        if ($_POST['mainImg'] == NULL) {
            unset($submit['mainImg']);
        }
        if ($_POST['hoverImg'] == NULL) {
            unset($submit['hoverImg']);
        }
        if ($_POST['polaroid1'] == NULL) {
            unset($submit['polaroid1']);
        }
        if ($_POST['polaroid2'] == NULL) {
            unset($submit['polaroid2']);
        }
        if ($_POST['pv_signature'] == NULL) {
            unset($submit['signature']);
        }
        if ($_POST['pv_stimulant'] == NULL) {
            unset($submit['stimulant']);
        }
        $submit['id'] = $id;
        edit_member($submit, $id);
        echo "<h3> Edit successful. New results will appear on refresh.</h3>";
    }
    /* Handle the details from the table earlier */
    if (array_key_exists('deets', $_POST)) {
        $deets = $_POST['deets'];
        $ranking = $_POST['ranking'];
        global $wpdb;
        global $data_table_name;
        //delete the previous entries and rewrite
        $wpdb->delete($data_table_name, array('id' => $id), array('%d'));
        /*
        It actually comes out faster to delete the entries from the table and
        re-enter them all, than to search through the array of both entries
        to see what's been altered.  Our only shot would be if we can find an 
        efficient way to pass an array to PHP from JavaScript.  So far hidden
        forms have worked well enough for normal values, but they often go
        unnoticed when people edit code.
        */
        $count = 0;
        foreach ($deets as $index => $deet) {
            $test = $ranking[$index];
            echo "<p>deet {$index} : {$test}</p>";
            if ($deet !== "") {
                $submit = array('id' => $id, 'information' => $deet, 'hierarchy' => $count, 'side' => 0, 'ranking' => $ranking[$index]);
                $wpdb->insert($data_table_name, $submit);
            }
            $count++;
        }
    }
}
 public function process_post($action)
 {
     switch ($action) {
         case "login":
             $status = login_member($this);
             return $status;
             break;
         case "autologin":
             $status = autologin_member($this);
             return $status;
             break;
         case "reset-password-link":
             $status = get_reset_password_code($this);
             if ($status["status_code"] == 200) {
                 $this->first_name = get_team_member_name_by_email($this->email);
                 $this->reset_code = $status["reset_code"];
                 $this->reset_password_link = json_decode(file_get_contents("env.json"))->website_host . "/reset-password.php?code=" . $this->reset_code . "&email=" . $this->email;
                 send_password_reset_code($this);
             }
             return $status;
             break;
         case "reset-password":
             $status = reset_password($this);
             return $status;
             break;
         case "register":
             $status = register_new_member($this);
             if ($status["status_code"] == 200) {
                 if ($this->team_id != "" && $this->team_name == get_team_name_by_team_id($this->team_id)) {
                     $this->member_id = get_team_member_id_by_email($this->email);
                     join_team($this);
                 }
                 send_registration_success_email($this);
             }
             return $status;
             break;
         case "funds":
             $this->email = get_team_member_email_by_id($this->member_id);
             $status = post_add_fund($this);
             send_add_fund_email($this);
             return $status;
             break;
         case "join-team":
             $this->first_name = get_team_member_name_by_team_member_id($this->member_id);
             $this->team_name = get_team_name_by_team_id($this->team_id);
             $this->email = get_team_member_email_by_id($this->member_id);
             $status = join_team($this);
             send_join_team_email($this);
             return $status;
             break;
         case "leave-team":
             $status = leave_team($this);
             send_leave_team_email($this);
             return $status;
             break;
         case "invite":
             $this->team_name = get_team_name_by_team_id($this->team_id);
             if ($this->team_name != "") {
                 $this->invite_team_link = json_decode(file_get_contents("env.json"))->website_host . "/index.php?team-id=" . $this->team_id . "&team-name=" . urlencode($this->team_name);
                 $status = invite_to_team($this);
                 return $status["status_code"];
             } else {
                 return 400;
             }
             break;
         case "edit-member":
             $status = edit_member($this);
             return $status == true ? 200 : 400;
             break;
         default:
             break;
     }
 }
            }
            if (no_symbol_pass($_POST['member_profile_password'])) {
            	$member_profile_errors[] = translate_error('no_symbol_pass');
            }
            */
            if (not_match_pass($_POST['member_profile_password'], $_POST['member_profile_repeat_password'])) {
                $member_profile_errors[] = translate_error('not_match_pass');
            }
        }
    }
    if (!count($member_profile_errors)) {
        if ($_POST['member_profile_password']) {
            edit_member($_POST['member_profile_email'], $_POST['member_profile_fullname'], $_POST['member_profile_password'], $_POST['member_profile_dob'], $lang_code);
            email_edit_member($_POST['member_profile_email'], $_POST['member_profile_fullname'], $_POST['member_profile_password'], $_POST['member_profile_dob']);
        } else {
            edit_member($_POST['member_profile_email'], $_POST['member_profile_fullname'], load_member()['password'], $_POST['member_profile_dob'], $lang_code);
            email_edit_member($_POST['member_profile_email'], $_POST['member_profile_fullname'], $email_interfaces['not_changed'][$lang_code], $_POST['member_profile_dob']);
        }
        header('Location: ' . $_SERVER['HTTP_REFERER'] . '');
    }
}
?>
<form id="profile_form" method="POST" action="">
	<div class="m-input-prepend">
		<span class="add-on"><?php 
echo translate_span('email');
?>
</span>
		<input type="hidden" name="member_profile_email" value="<?php 
echo $inputted_email;
?>
<?php

require_once 'include.php';
$act = $_REQUEST['act'];
if ($act === 'login') {
    $msg = login();
} elseif ($act === 'logout') {
    $msg = logout();
} elseif ($act === 'add_member') {
    $msg = add_member();
} elseif ($act === 'edit_member') {
    $msg = edit_member();
} elseif ($act === 'add_member_fee') {
    $msg = add_member_fee();
} elseif ($act === 'add_member_fen') {
    $msg = add_member_fen();
} elseif ($act === 'add_member_score') {
    $msg = add_member_score();
} elseif ($act === 'delete_member') {
    $msg = delete_member();
} elseif ($act === 'add_grade') {
    $msg = change_grade(1);
} elseif ($act === 'minus_grade') {
    $msg = change_grade(2);
} elseif ($act === 'update_month_fee') {
    $msg = update_month_fee();
}
?>
 <!DOCTYPE HTML>
 <html>
 <head>