/** * 创建一个JSON格式的错误信息 * * @access public * @param string $msg * @return void */ function make_json_error($msg) { make_json_response('', 1, $msg); }
} $sql = 'UPDATE ' . $GLOBALS['ecs']->table('order_info') . " SET pay_note='{$no}' WHERE order_id = '{$order_id}'"; if ($GLOBALS['db']->query($sql)) { if (empty($no)) { make_json_result('N/A'); } else { make_json_result(stripcslashes($no)); } } else { make_json_error($GLOBALS['db']->errorMsg()); } } elseif ($_REQUEST['act'] == 'get_goods_info') { /* 取得订单商品 */ $order_id = isset($_REQUEST['order_id']) ? intval($_REQUEST['order_id']) : 0; if (empty($order_id)) { make_json_response('', 1, $_LANG['error_get_goods_info']); } $goods_list = array(); $goods_attr = array(); $sql = "SELECT o.*, g.goods_thumb, g.goods_number AS storage, o.goods_attr, IFNULL(b.brand_name, '') AS brand_name " . "FROM " . $ecs->table('order_goods') . " AS o " . "LEFT JOIN " . $ecs->table('goods') . " AS g ON o.goods_id = g.goods_id " . "LEFT JOIN " . $ecs->table('brand') . " AS b ON g.brand_id = b.brand_id " . "WHERE o.order_id = '{$order_id}' "; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { /* 虚拟商品支持 */ if ($row['is_real'] == 0) { /* 取得语言项 */ $filename = ROOT_PATH . 'plugins/' . $row['extension_code'] . '/languages/common_' . $_CFG['lang'] . '.php'; if (file_exists($filename)) { include_once $filename; if (!empty($_LANG[$row['extension_code'] . '_link'])) { $row['goods_name'] = $row['goods_name'] . sprintf($_LANG[$row['extension_code'] . '_link'], $row['goods_id'], $order['order_sn']); }
/** * 创建一个JSON格式的错误信息 * * @access public * @param string $msg * @return void */ function make_json_error($msg, $code = 1) { make_json_response('', $code, $msg); }
/* 安装所有插件 */ install_plugins(); } /* ------------------------------------------------------ */ // - 异步 - 插件安装 /* ------------------------------------------------------ */ if ($_REQUEST['act'] == 'uninstall') { /* 卸载所有插件 */ uninstall_plugins(); } /* ------------------------------------------------------ */ // - 异步 - 插件列表 /* ------------------------------------------------------ */ $tpl['list'] = list_plugin(); /* 加载视图 */ make_json_response(empty($tpl['list']['data']) ? -1 : 0, '', tpl_fetch('sysplugin.html', $tpl)); ?> <?php /** * 获取所有插件 * 过滤没有配置文件或者无效配置信息的插件 */ function all_plugin() { global $_CFG; /* 初始化 */ $plugins = array(); $fdgroups = array('php', 'javascript'); // 插件的父文件夹组 /* 遍历父文件夹 */
function make_json_result($content, $message = '', $append = array()) { make_json_response($content, 0, $message, $append); }
$_LANG['ok_dbbackup_importing'] = sprintf($_LANG['spr_dbbackup_import_part'], $_POST['vol'] + 1, $_POST['total']); /* 返回消息 */ make_json_response(-1, $_LANG['ok_dbbackup_importing'], $params); } elseif ($_REQUEST['act'] == 'importinit') { /* 根据索引文件获取所有文件 */ $fnames = all_sqlfile(array('findex' => $_POST['findex'])); /* 文件总卷 */ $total = count($fnames); /* 构建返回参数 */ $params = 'fname=' . $fnames[0] . '&vol=1&total=' . $total; /* 构建返回消息 */ if ($total > 1) { $_LANG['ok_dbbackup_importing'] = sprintf($_LANG['spr_dbbackup_import_part'], 1, $total); } /* 返回消息 */ make_json_response(-1, $_LANG['ok_dbbackup_importing'], $params); } elseif ($_REQUEST['act'] == 'upload') { /* 权限检查 */ admin_privilege_valid('db_backup.php', 'backup'); /* 检查上传是否成功 */ if (isset($_FILES['file']['error']) && $_FILES['file']['error'] != 0) { make_json_fail($_LANG['fill_dbbackup_sqlfile']); } /* 检查文件格式 */ if (substr($_FILES['file']['name'], -4) != '.sql') { make_json_fail($_LANG['file_ext_error']); } /* 设置文件路径 */ $fname = 'upload_sqlfile_temp.sql.php'; $fpath = $_CFG['DIR_ADMIN_DUMPSQL'] . $fname; /* 将文件移动到备份文件夹下 */
function make_json_fail($message = '') { make_json_response('1', $message); }