文件列表入库增加多语言支持

This commit is contained in:
wlx 2015-09-14 15:58:52 +08:00
parent cb0935bdc6
commit 3518c011da
1 changed files with 6 additions and 3 deletions

View File

@ -18,6 +18,8 @@
//文件生成 //文件生成
$uuid=$_GET['uuid']; $uuid=$_GET['uuid'];
$filelist=$_GET['filelist']; $filelist=$_GET['filelist'];
$lang=$_GET['lang'];
if(empty($uuid) || !preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid)) if(empty($uuid) || !preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid))
{ {
die("uuid error! Error in parameter.".$uuid); die("uuid error! Error in parameter.".$uuid);
@ -35,16 +37,17 @@
//todo... //todo...
//保留path值 //保留path值
$sql="select * from dataset where uuid='$uuid'"; if (empty($lang)) $lang='';
$sql="select * from dataset where uuid='$uuid' and lang='$lang'";
$result=pg_query($link,$sql); $result=pg_query($link,$sql);
$row=pg_fetch_assoc($result); $row=pg_fetch_assoc($result);
if ($row) $homedir=$row['path']; if ($row) $homedir=$row['path'];
//delete dataset & datafile records //delete dataset & datafile records
$sql="delete from dataset where uuid='$uuid'"; $sql="delete from dataset where uuid='$uuid' and lang='$lang'";
pg_query($link,$sql); pg_query($link,$sql);
$sql = "INSERT INTO dataset (host,uuid,path) VALUES ('ftp2.westgis.ac.cn','$uuid','$homedir') RETURNING id"; $sql = "INSERT INTO dataset (host,uuid,path,lang) VALUES ('ftp2.westgis.ac.cn','$uuid','$homedir','$lang') RETURNING id";
$result=pg_query($link,$sql); $result=pg_query($link,$sql);
$row=pg_fetch_assoc($result); $row=pg_fetch_assoc($result);
$dsid=$row['id']; $dsid=$row['id'];