Exemplo n.º 1
0
/**
 * Init function of API.
 */
function init()
{
    if (($paramArr = getParam()) && validateParam($paramArr[0]) && validateParam($paramArr[1])) {
        execute($paramArr[0], $paramArr[1], $paramArr[2]);
    } else {
        printParamErr();
    }
}
Exemplo n.º 2
0
/**
 * Init function of API.
 */
function init()
{
    if (($idArr = parseParam()) && validateParam($idArr)) {
        execute($idArr);
    } else {
        printParamErr();
    }
}
Exemplo n.º 3
0
/**
 * Init function of API.
 */
function init()
{
    if (($idArrGroup = parseParam()) && validateParam($idArrGroup[0]) && validateParam($idArrGroup[1])) {
        execute($idArrGroup);
    } else {
        printParamErr();
    }
}
Exemplo n.º 4
0
/**
 * Init function of API.
 */
function init()
{
    if (($paramArr = getParam()) && validateParam($paramArr[0]) && validateParam($paramArr[1])) {
        echo json_encode($paramArr[0]);
        echo '<br>';
        echo json_encode($paramArr[1]);
        echo '<br>';
        execute($paramArr[0], $paramArr[1], $paramArr[2]);
        echo '----1<br>';
        execute($paramArr[0], $paramArr[1], $paramArr[3]);
        echo '----1/2<br>';
    } else {
        printParamErr();
    }
}
Exemplo n.º 5
0
 /**
  * @api {post} /user/verify-email Verify Email with the number received by Email
  * @apiVersion 1.0.0
  * @apiName Verify Email
  * @apiGroup User
  * 
  * @apiHeader {String} Authorization Users unique access-key.
  * @apiParam {String} code Verification code given by SMS
  */
 function verify_email()
 {
     $params = ['code'];
     $result = validateParam($params);
     if ($result === true) {
         $token = $_SERVER['Authorization'];
         $user = __get_user_from_token($token);
         extract($_POST);
         if ($user == NULL) {
             $result = array('success' => 'false', 'message' => 'Invalid token');
         } else {
             $r = __verify_user($user->id, 'email', $code);
             if ($r == 1) {
                 $result = array('success' => 'true', 'message' => 'Successfully verified email.');
             } else {
                 $result = array('success' => 'false');
                 if ($r == -2) {
                     $result['message'] = "You haven't requested verification.";
                 } else {
                     if ($r == -1) {
                         $result['message'] = "This code is expired. please request another one.";
                     } else {
                         $result['message'] = "This code is wrong.";
                     }
                 }
             }
         }
     }
     echo json_encode($result);
 }
Exemplo n.º 6
0
 function cipher_contact_form_submit()
 {
     global $wpdb;
     $table_name = $wpdb->prefix . 'cipher_contact_request_master';
     $response = array();
     cipher_create_contact_form_table();
     header('Content-type: application/json');
     $post = $_POST;
     $response['status'] = 200;
     $response['message'] = 'Request has been submited.! We will reach you shortlly';
     $requvired = array(array('name', 'text'), array('skype', 'text'), array('message', 'text'));
     if (!validateParam($requvired, $post)) {
         $response['status'] = 400;
         $response['message'] = 'Please check your information fields.';
         header('HTTP/1.1 400 Please check your information fields.');
         die(json_encode($response));
     }
     $post['name'] = esc_sql($post['name']);
     $post['email'] = isset($post['email']) ? $post['email'] : '';
     $post['phone'] = isset($post['phone']) && is_numeric($post['phone']) ? $post['phone'] : '';
     $post['message'] = esc_sql($post['message']);
     $query = "INSERT INTO " . $table_name . " (contact_id,name,email,skype,phone,message,request_date) VALUES\n\t\t\t\t(DEFAULT,'" . $post['name'] . "','" . $post['email'] . "','" . $post['skype'] . "','" . $post['phone'] . "','" . $post['message'] . "',DEFAULT)";
     if (!$wpdb->query($query)) {
         $response['status'] = 420;
         $response['message'] = 'Please Resubmit data.';
         header('HTTP/1.1 400 Please Resubmit data.');
         die(json_encode($response));
     }
     //$response['payload'] = $post;
     die(json_encode($response));
 }
Exemplo n.º 7
0
 public function commentChangeRequest($changeId, $userId, $comment)
 {
     $this->user_id = validateParam($userId, True, 'Invalid or Missing change id');
     $this->change_id = validateParam($changeId, True, 'Invalid or Missing change id');
     $approver = 'f';
     $change_data = $this->getChangeFromDB($this->change_id);
     if (!$change_data) {
         return returnError(70, 'Invalid change id');
     }
     $user_data = $this->getUserDataFromDB($userId);
     if (!$user_data) {
         return returnError(70, 'Invalid user id');
     }
     if ($user_data['is_approver']) {
         $approver = 't';
     }
     return $this->commentChangeRequestOnDB($this->change_id, $this->user_id, $approver, $comment);
 }