function address()
{
    switch ($_SERVER['REQUEST_METHOD']) {
        case 'GET':
            $r_data = get_consignee_list($_SESSION['user_id']);
            return $r_data;
            break;
        case 'DELETE':
            $consignee_id = intval($_GET['id']);
            if (drop_consignee($consignee_id)) {
                $r_data = 'Delete Address Success!';
            } else {
                $r_data = 'Delete Address Failed!';
            }
            return $r_data;
            break;
        case 'POST':
            $address = array('user_id' => $_SESSION['user_id'], 'address_id' => intval($_POST['address_id']), 'country' => isset($_POST['country']) ? intval($_POST['country']) : 0, 'province' => isset($_POST['province']) ? intval($_POST['province']) : 0, 'city' => isset($_POST['city']) ? intval($_POST['city']) : 0, 'district' => isset($_POST['district']) ? intval($_POST['district']) : 0, 'address' => isset($_POST['address']) ? compile_str(trim($_POST['address'])) : '', 'consignee' => isset($_POST['consignee']) ? compile_str(trim($_POST['consignee'])) : '', 'email' => isset($_POST['email']) ? compile_str(trim($_POST['email'])) : '', 'tel' => isset($_POST['tel']) ? compile_str(make_semiangle(trim($_POST['tel']))) : '', 'mobile' => isset($_POST['mobile']) ? compile_str(make_semiangle(trim($_POST['mobile']))) : '', 'best_time' => isset($_POST['best_time']) ? compile_str(trim($_POST['best_time'])) : '', 'sign_building' => isset($_POST['sign_building']) ? compile_str(trim($_POST['sign_building'])) : '', 'zipcode' => isset($_POST['zipcode']) ? compile_str(make_semiangle(trim($_POST['zipcode']))) : '');
            if (update_address($address)) {
                $r_data = 'Update Address Success!';
            } else {
                $r_data = 'Update Address Failed!';
            }
            return $r_data;
            break;
        default:
            return 'This API can not support ' . $_SERVER['REQUEST_METHOD'] . ' method';
            break;
    }
}
    $smarty->assign('currency_format', $_CFG['currency_format']);
    $smarty->assign('integral_scale', $_CFG['integral_scale']);
    $smarty->assign('name_of_region', array($_CFG['name_of_region_1'], $_CFG['name_of_region_2'], $_CFG['name_of_region_3'], $_CFG['name_of_region_4']));
    $smarty->display('user_transaction.dwt');
} elseif ($action == 'act_edit_address') {
    include_once ROOT_PATH . 'includes/lib_transaction.php';
    include_once ROOT_PATH . 'languages/' . $_CFG['lang'] . '/shopping_flow.php';
    $smarty->assign('lang', $_LANG);
    $address = array('user_id' => $user_id, 'address_id' => intval($_POST['address_id']), 'country' => isset($_POST['country']) ? intval($_POST['country']) : 0, 'province' => isset($_POST['province']) ? intval($_POST['province']) : 0, 'city' => isset($_POST['city']) ? intval($_POST['city']) : 0, 'district' => isset($_POST['district']) ? intval($_POST['district']) : 0, 'address' => isset($_POST['address']) ? trim($_POST['address']) : '', 'consignee' => isset($_POST['consignee']) ? trim($_POST['consignee']) : '', 'email' => isset($_POST['email']) ? trim($_POST['email']) : '', 'tel' => isset($_POST['tel']) ? make_semiangle(trim($_POST['tel'])) : '', 'mobile' => isset($_POST['mobile']) ? make_semiangle(trim($_POST['mobile'])) : '', 'best_time' => isset($_POST['best_time']) ? trim($_POST['best_time']) : '', 'sign_building' => isset($_POST['sign_building']) ? trim($_POST['sign_building']) : '', 'zipcode' => isset($_POST['zipcode']) ? make_semiangle(trim($_POST['zipcode'])) : '');
    if (update_address($address)) {
        show_message($_LANG['edit_address_success'], $_LANG['address_list_lnk'], 'user.php?act=address_list');
    }
} elseif ($action == 'drop_consignee') {
    include_once 'includes/lib_transaction.php';
    $consignee_id = intval($_GET['id']);
    if (drop_consignee($consignee_id)) {
        ecs_header("Location: user.php?act=address_list\n");
        exit;
    } else {
        show_message($_LANG['del_address_false']);
    }
} elseif ($action == 'collection_list') {
    include_once ROOT_PATH . 'includes/lib_clips.php';
    $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1;
    $record_count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('collect_goods') . " WHERE user_id='{$user_id}' ORDER BY add_time DESC");
    $pager = get_pager('user.php', array('act' => $action), $record_count, $page);
    $smarty->assign('pager', $pager);
    $smarty->assign('goods_list', get_collection_goods($user_id, $pager['size'], $pager['start']));
    $smarty->assign('url', $ecs->url());
    $lang_list = array('UTF8' => $_LANG['charset']['utf8'], 'GB2312' => $_LANG['charset']['zh_cn'], 'BIG5' => $_LANG['charset']['zh_tw']);
    $smarty->assign('lang_list', $lang_list);
Exemple #3
0
function action_drop_consignee()
{
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $_SESSION['user_id'];
    include_once 'includes/lib_transaction.php';
    $consignee_id = intval($_GET['id']);
    if (drop_consignee($consignee_id)) {
        ecs_header("Location: user.php?act=address_list\n");
        exit;
    } else {
        show_message($_LANG['del_address_false']);
    }
}
 *   _/  _/_/  _/_/_/_/  _/_/_/_/  _/_/          _/      _/    _/  _/    _/   
 *  _/    _/  _/        _/        _/  _/      _/        _/    _/  _/    _/    
 *   _/_/_/    _/_/_/    _/_/_/  _/    _/  _/_/_/_/_/    _/_/      _/_/       
 *                                                                          
 *
 *  Copyright 2013-2014, Geek Zoo Studio
 *  http://www.ecmobile.cn/license.html
 *
 *  HQ China:
 *    2319 Est.Tower Van Palace 
 *    No.2 Guandongdian South Street 
 *    Beijing , China
 *
 *  U.S. Office:
 *    One Park Place, Elmira College, NY, 14901, USA
 *
 *  QQ Group:   329673575
 *  BBS:        bbs.ecmobile.cn
 *  Fax:        +86-10-6561-5510
 *  Mail:       info@geek-zoo.com
 */
define('INIT_NO_USERS', true);
require EC_PATH . '/includes/init.php';
GZ_Api::authSession();
include_once EC_PATH . '/includes/lib_transaction.php';
$address_id = _POST('address_id', 0);
if (empty($address_id)) {
    GZ_Api::outPut(101);
}
drop_consignee($address_id);
GZ_Api::outPut(array());
Exemple #5
0
	public function drop_consignee () {
		checkLogin();
		include_once(RPC_ROOT . 'includes/lib_transaction_ec.php');
		$consignee_id = empty($_GET['address_id']) ? 0: intval($_GET['address_id']);
		if (drop_consignee($consignee_id))
		{
			$msg = rpcLang('user.php', 'address_delete_success');
			$code = '0';
		}else
		{
			$msg = rpcLang('user.php', 'address_delete_failure');
			$code = '1';
		}
		jsonExit("{\"status\":\"$msg\",\"code\":\"$code\"}");
		
	}