diff --git a/functions.php b/functions.php index e65716b..cd6f182 100644 --- a/functions.php +++ b/functions.php @@ -14,6 +14,16 @@ function ymd2sec($d) if (!strlen($d)) $purchasedate2="NULL"; + elseif ($settings['dateformat']=="ymd"){ + $x=explode("-",$d); + if ((count($x)==1) && strlen(trim($d))==4) { //only year + $d2= mktime(0, 0, 0, 1, 1, $d); + } + else { + $d2= mktime(0, 0, 0, $x[1], $x[2], $x[0]); + } + return $d2; + } elseif ($settings['dateformat']=="dmy"){ $x=explode("/",$d); if ((count($x)==1) && strlen(trim($d))==4) { //only year diff --git a/init.php b/init.php index 49f9e21..e7dc240 100644 --- a/init.php +++ b/init.php @@ -150,7 +150,13 @@ $settings=$settings[0]; -if ($settings['dateformat']=="dmy") { +if($settings['dateformat']=="ymd") { + $datetitle="y-m-d or yyyy"; + $datecalparam="yy-mm-dd"; + $dateparam="Y-m-d"; + $maskdateparam="y999-m9-d9"; +} +elseif ($settings['dateformat']=="dmy") { $datetitle="d/m/y or yyyy"; $datecalparam="dd/mm/yy"; $dateparam="d/m/Y"; diff --git a/model.php b/model.php index 03aae4c..e61249a 100644 --- a/model.php +++ b/model.php @@ -417,12 +417,12 @@ function read_trans($lang) { if ($lang=="en") return; $fn="$scriptdir/translations/$lang.txt"; if (is_readable($fn) && (($handle = fopen($fn, "r")) !== FALSE)) { - while (($data = fgetcsv($handle, 1000, "#")) !== FALSE) { - $num = count($data); - $row++; - if ($num<2) continue; - if ($num>2) echo "

Error in $fn, row $row: ($num fields found, 2 expected)

\n"; - $trans_tbl[$lang][$data[0]]=$data[1]; + while ($line=trim(fgets($handle))) { + if($pos=strpos($line,'#')){ + $key=substr($line,0,$pos); + $value=substr($line, $pos+1); + $trans_tbl[$lang][$key]=$value; + } } fclose($handle); } diff --git a/php/editactions.php b/php/editactions.php index 19a68dd..b783002 100644 --- a/php/editactions.php +++ b/php/editactions.php @@ -23,7 +23,9 @@ function filltoday() var x=document.getElementById('newdate').value; if (x.length==0) { - + + document.getElementById('newdate').value=theyear+"-"+themonth+"-"+thetoday; + document.getElementById('newdate').value=thetoday+"/"+themonth+"/"+theyear; document.getElementById('newdate').value=themonth+"/"+thetoday+"/"+theyear; diff --git a/php/editfile.php b/php/editfile.php index 6c3d8dd..76daa11 100644 --- a/php/editfile.php +++ b/php/editfile.php @@ -384,16 +384,18 @@ class="tdt">: while keeping its associations."); echo t("Replace File"); + $file_validate_required='false'; } ?> - File: + File: diff --git a/php/settings.php b/php/settings.php index 5a24bbb..390c39e 100644 --- a/php/settings.php +++ b/php/settings.php @@ -60,6 +60,8 @@ + + diff --git a/php/translations.php b/php/translations.php index 401797f..eeec7a1 100644 --- a/php/translations.php +++ b/php/translations.php @@ -119,14 +119,12 @@ if (strlen($lang) && ($lang !="en")) { if (is_readable($fn) && (($handle = fopen($fn, "r")) !== FALSE)) { - while (($data = fgetcsv($handle, 1000, "#")) !== FALSE) { - $num = count($data); - $row++; - if ($num<2) continue; - if ($num>2) echo "

Error in $fn, row $row: ($num fields found, 2 expected)

\n"; - $tt1[]=$data[0]; - $tt2[]=$data[1]; - } + while ($line=trim(fgets($handle))) { + if($pos=strpos($line,'#')){ + $tt1[]=substr($line,0,$pos); + $tt2[]=substr($line, $pos+1); + } + } fclose($handle); } else { @@ -150,9 +148,11 @@ $nfn="translations/new.txt"; if (is_readable($nfn) && (($handle = fopen($nfn, "r")) !== FALSE)) { $eng=array(); - while (($data = fgetcsv($handle, 1000, "#")) !== FALSE) { - $eng[]=$data[0]; - } + while ($line=trim(fgets($handle))) { + if($pos=strpos($line,'#')){ + $eng[]=substr($line,0,$pos); + } + } } //find which english words are missing from current translation file diff --git a/translations/cn.txt b/translations/cn.txt index b256e80..fa693be 100644 --- a/translations/cn.txt +++ b/translations/cn.txt @@ -197,7 +197,7 @@ Invoices#单据 INVOICES#单据 IPv4#IPv4 IPv6#IPv6 -Is Part#属于 +Is Part#从属部件 Issue Date#签署日期 ITDB Settings#ITDB 设置 Item Associations#硬件关联 @@ -387,7 +387,7 @@ Upload a File#上传文件 Upload a Floor Plan#上传楼层平面图 Upload Files#上传文件 Uploaded by#上传人 -Usage#用法 +Usage#使用 Use the string 'service' on the description to display this url on the item edit page#在硬件修改页面使用描述中的“service”字段显示此链接 use when the top labels have already been printed#当顶部标签已经被打印过时使用 User Description#用户描述