예제 #1
0
파일: twigmo.php 프로젝트: askzap/ultimate
                if (empty($image['pair_id'])) {
                    $response->addError('ERROR_WRONG_OBJECT_DATA', str_replace('[object]', 'images', __('twgadmin_wrong_api_object_data')));
                    continue;
                }
                fn_delete_image_pair($image['pair_id'], 'product');
            }
        }
        $response->returnResponse();
    }
}
if ($mode == 'post') {
    if ($action == 'auth.svc') {
        $connector = new TwigmoConnector();
        $request = $connector->parseResponse($_REQUEST['data']);
        if (!$connector->responseIsOk($request) || empty($request['data']['user_login']) || empty($request['data']['password'])) {
            $connector->onError();
        }
        $_POST = $_REQUEST = array_merge($_REQUEST, $request['data']);
        list($status, $user_data, $user_login, $password, $salt) = fn_auth_routines($_REQUEST, $auth);
        $redirect_to_mv_url = fn_twg_check_for_vendor_url($status, $user_data);
        if ($redirect_to_mv_url) {
            $status = true;
        }
        $is_ok = !empty($user_data) && !empty($password) && fn_generate_salted_password($password, $salt) == $user_data['password'];
        if ($status === false || !$is_ok) {
            $connector->onError();
        }
        $response_data = array('redirect_to_mv_url' => $redirect_to_mv_url, 'company_id' => $user_data['company_id'], 'can_view_orders' => fn_check_user_access($user_data['user_id'], 'view_orders'));
        $connector->respond($response_data);
    } elseif ($action == 'auth.app') {
        $_POST['password'] = $_REQUEST['password'];
예제 #2
0
    }
    $request = $connector->parseResponse($_REQUEST['data']);
    if (empty($request['data']) or empty($request['data']['url'])) {
        $connector->onError();
    }
    // Request is ok - check url
    if ($action == 'check.admin') {
        if ($request['data']['url'] != $connector->getAdminUrl()) {
            $connector->onError('Wrong admin url');
        }
    } else {
        $stores = fn_twg_get_stores();
        $store = reset($stores);
        $my_url = $connector->getCustomerUrl($store);
        if ($request['data']['url'] != $my_url) {
            $connector->onError('Wrong customer url');
        }
    }
    $connector->respond(array('result' => 'ok'));
} elseif ($action == 'repo.updated') {
    $connector = new TwigmoConnector();
    $stores = fn_twg_get_stores();
    $store = reset($stores);
    $all_stores = TwigmoSettings::get('customer_connections');
    if (empty($store) || empty($all_stores) || !isset($all_stores[$store['company_id']])) {
        $connector->onError('store_not_found');
    }
    $all_stores[$store['company_id']]['repo_revision'] = TIME;
    TwigmoSettings::set(array('customer_connections' => $all_stores));
    $connector->respond(array('result' => 'ok'));
}