Skip to content
This repository has been archived by the owner on May 27, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'fs' of https://github.com/fengyqf/itdb into fengyqf-fs
  • Loading branch information
Spiros Ioannou committed Jul 2, 2015
2 parents 78a66d9 + 2558b2e commit 9fec2d6
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 22 deletions.
10 changes: 10 additions & 0 deletions functions.php
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion init.php
Expand Up @@ -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";
Expand Down
12 changes: 6 additions & 6 deletions model.php
Expand Up @@ -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 "<p style='display:inline;background-color:white;color:red'> Error in $fn, row $row: ($num fields found, 2 expected) <br /></p>\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);
}
Expand Down
4 changes: 3 additions & 1 deletion php/editactions.php
Expand Up @@ -23,7 +23,9 @@ function filltoday()
var x=document.getElementById('newdate').value;

if (x.length==0) {
<?php if ($settings['dateformat']=="dmy") {?>
<?php if ($settings['dateformat']=="ymd") {?>
document.getElementById('newdate').value=theyear+"-"+themonth+"-"+thetoday;
<?php } elseif ($settings['dateformat']=="dmy") {?>
document.getElementById('newdate').value=thetoday+"/"+themonth+"/"+theyear;
<?php } else {?>
document.getElementById('newdate').value=themonth+"/"+thetoday+"/"+theyear;
Expand Down
4 changes: 3 additions & 1 deletion php/editfile.php
Expand Up @@ -384,16 +384,18 @@ class="tdt"><?php te("Associations");?>:</td> <td><b><?php if ($_GET['id']!="ne
if ($id=="new") {
$tip="";
echo t("Upload a File");
$file_validate_required='true';
}
else{
$tip=t("If you select a new file, it will replace the current one, <br>while keeping its associations.");
echo t("Replace File");
$file_validate_required='false';
}
?>
</h3></td></tr>
<!-- file upload -->
<tr>
<td class="tdt">File:</td> <td><input validate='required:true' name="file" id="file" size="25" type="file"></td>
<td class="tdt">File:</td> <td><input validate='required:<?php echo $file_validate_required;?>' name="file" id="file" size="25" type="file"></td>
</tr>
</table>
<?php echo $tip?>
Expand Down
2 changes: 2 additions & 0 deletions php/settings.php
Expand Up @@ -60,6 +60,8 @@
<option <?php echo $s?> value='dmy'>Day/Month/Year</option>
<?php if ($settings['dateformat']=="mdy") $s="SELECTED"; else $s="" ?>
<option <?php echo $s?> value='mdy'>Month/Day/Year</option>
<?php if ($settings['dateformat']=="ymd") $s="SELECTED"; else $s="" ?>
<option <?php echo $s?> value='ymd'>Year-Month-Day</option>
</select>
</td>
</tr>
Expand Down
22 changes: 11 additions & 11 deletions php/translations.php
Expand Up @@ -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 "<p style='display:inline;background-color:white;color:red'> Error in $fn, row $row: ($num fields found, 2 expected) <br /></p>\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 {
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions translations/cn.txt
Expand Up @@ -197,7 +197,7 @@ Invoices#单据
INVOICES#单据
IPv4#IPv4
IPv6#IPv6
Is Part#属于
Is Part#从属部件
Issue Date#签署日期
ITDB Settings#ITDB 设置
Item Associations#硬件关联
Expand Down Expand Up @@ -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#用户描述
Expand Down

0 comments on commit 9fec2d6

Please sign in to comment.