diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1539c31..14b4342 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -15,7 +15,9 @@ I:updated jstree version DB UPGRADE 1.6 -> 1.7 ----------------------------- alter table settings add column timezone; +alter table settings add column dbversion; update settings set timezone="GMT"; +update settings set dbversion=1; diff --git a/data/pure.db b/data/pure.db index 537e28c..a53558b 100644 Binary files a/data/pure.db and b/data/pure.db differ diff --git a/doc/aes/aes.html b/doc/aes/aes.html index 01b8829..a3be47d 100644 --- a/doc/aes/aes.html +++ b/doc/aes/aes.html @@ -1,4 +1,4 @@ - + JavaScript Implementation of AES Advanced Encryption Standard in Counter Mode diff --git a/doc/sqlite-1.2.txt b/doc/sqlite.txt similarity index 91% rename from doc/sqlite-1.2.txt rename to doc/sqlite.txt index 7be89be..5fb06e5 100644 --- a/doc/sqlite-1.2.txt +++ b/doc/sqlite.txt @@ -17,12 +17,13 @@ CREATE TABLE item2file(itemid INTEGER,fileid INTEGER); CREATE TABLE "item2inv" (itemid integer,invid integer); CREATE TABLE item2soft (itemid INTEGER, softid INTEGER, instdate INTEGER); CREATE TABLE itemlink (itemid1, itemid2); -CREATE TABLE items (id INTEGER primary key autoincrement,itemtypeid integer, function, manufacturerid integer,model,sn,sn2,sn3,origin,warrantymonths integer,purchasedate integer,purchprice,dnsname,maintenanceinfo,comments,ispart integer,hd,cpu,ram,locationid integer,userid integer,ipv4,ipv6,usize integer,rackmountable integer,macs,remadmip,panelport,ports integer,switchport,switchid integer,rackid integer,rackposition integer,label,status integer, cpuno INTEGER, corespercpu INTEGER, rackposdepth integer, warrinfo); +CREATE TABLE items (id INTEGER primary key autoincrement,itemtypeid integer, function, manufacturerid integer,model,sn,sn2,sn3,origin,warrantymonths integer,purchasedate integer,purchprice,dnsname,maintenanceinfo,comments,ispart integer,hd,cpu,ram,locationid integer,userid integer,ipv4,ipv6,usize integer,rackmountable integer,macs,remadmip,panelport,ports integer,switchport,switchid integer,rackid integer,rackposition integer,label,status integer, cpuno INTEGER, corespercpu INTEGER, rackposdepth integer, warrinfo, locareaid number); CREATE TABLE itemtypes (id INTEGER PRIMARY KEY AUTOINCREMENT, typeid, typedesc, hassoftware integer); -CREATE TABLE labelpapers (id INTEGER PRIMARY KEY AUTOINCREMENT,rows integer, cols integer, lwidth real, lheight real, vpitch real, hpitch real, tmargin real, bmargin real, lmargin real, rmargin real, name); +CREATE TABLE labelpapers (id INTEGER PRIMARY KEY AUTOINCREMENT,rows integer, cols integer, lwidth real, lheight real, vpitch real, hpitch real, tmargin real, bmargin real, lmargin real, rmargin real, name, border, padding, headerfontsize, idfontsize, wantheadertext, wantheaderimage, headertext, fontsize, wantbarcode, barcodesize, image, imagewidth, imageheight, papersize); CREATE TABLE locareas(id INTEGER PRIMARY KEY AUTOINCREMENT,locationid number,areaname,x1 number,y1 number,x2 number,y2 number); CREATE TABLE locations (id INTEGER PRIMARY KEY AUTOINCREMENT, name, floor, floorplanfn); -CREATE TABLE racks (id INTEGER PRIMARY KEY AUTOINCREMENT, locationid integer, usize integer, depth integer, comments,model,label, revnums integer); +CREATE TABLE racks (id INTEGER PRIMARY KEY AUTOINCREMENT, locationid integer, usize integer, depth integer, comments,model,label, revnums integer, locareaid number); +CREATE TABLE settings(companytitle, dateformat, currency, lang, version, timezone); CREATE TABLE soft2inv(invid integer,softid integer); CREATE TABLE software (id INTEGER PRIMARY KEY autoincrement, invoiceid integer,slicenseinfo ,stype ,manufacturerid integer ,stitle ,sversion ,sinfo ,purchdate integer,licqty integer, lictype integer); CREATE TABLE software2file(softwareid INTEGER,fileid INTEGER); diff --git a/index.php b/index.php deleted file mode 120000 index 0bd42b9..0000000 --- a/index.php +++ /dev/null @@ -1 +0,0 @@ -itdb.php \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..301768a --- /dev/null +++ b/index.php @@ -0,0 +1,405 @@ +\n"; + break; + case "listagents": + $title="List Agents"; + break; + case "editagent": + $title="Edit Agent"; + break; + case "edititem": + $title="Edit Item"; + $stitle="Item"; + $head.="\n". + "\n". + "\n". + "\n". + "\n"; + break; + case "editsoftware": + $title="Edit Software"; + $stitle="Software"; + $head.="\n". + "\n". + "\n". + "\n". + "\n"; + break; + case "listsoftware": + $title="List Software"; + $head.="\n"; + break; + case "listcontracts": + $title="List Contracts"; + break; + case "listinvoices": + $title="List Invoices"; + break; + case "editinvoice": + $title="Edit Invoice"; + $stitle="Invoice"; + $head.="\n". + "\n". + "\n"; + break; + case "listfiles": + $title="List Files"; + break; + case "editfile": + $title="Edit File"; + $stitle="File"; + $head.="\n". + "\n". + "\n"; + break; + case "listracks": + $title="List Racks"; + break; + case "translations": + $title="Translations"; + break; + case "settings": + $title="Settings"; + break; + case "editrack": + $stitle="Rack"; + $title="Edit Rack"; + $head.="\n". + "\n". + "\n"; + break; + case "edititypes": + $title="Edit Item Types"; + break; + case "editcontract": + $title="Edit Contract"; + $stitle="Contract"; + $head.="\n". + "\n". + "\n"; + break; + case "editcontracttypes": + $title="Edit Contract Types"; + break; + case "edittags": + $title="Edit Tags"; + break; + case "editusers": + $title="Edit Users"; + break; + case "listlocations": + $title="List Locations"; + break; + case "editlocation": + $title="Edit Location"; + break; + case "editstatustypes": + $title="Edit Item Status Types"; + break; + case "editfiletypes": + $title="Edit File Types"; + break; + case "printlabels": + $title="Print Labels "; + break; + case "reports": + $title="Reports"; + $head.="\n". + "\n". + "\n". + "\n". + ""; + break; + case "showhist": + $title="History"; + break; + case "browse": + $title="Browse Data"; + $head.=""; + break; + case "viewrack": + $title="Rack"; + $stitle="Rack"; + break; + case "about": + $title="About"; + $stitle="About"; + $req="php/about.php"; + break; + default: + $title=""; + $stitle=""; + $req="php/home.php"; + break; +} +if (isset($_GET['id'])) + $id=$_GET['id']; +else + $id=""; + +if (strlen($stitle)) $stitle.=":".$id; + +$x="style_".$_GET['action']; +$$x="color:#BAFF04 "; + + +require('php/header.php'); + +if (0 && $authstatus && (dbversion() != $dbversion)) { + echo ""; + require ("php/itdbupdate.php"); + echo "\n\n"; + exit; +} + +if ($dlg && $authstatus) { + echo ""; + require($req); + echo "\n\n"; + exit; +} + +?> + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+
+
+
+
+
+
+
+



DB Log
+". + "\n
". + "\n". + "

"; + "\n"; +} + +if ($authstatus) { + echo "\n
". + "
". + "\n
"; + + + if (strlen($stitle)) { + $url="$fscriptname?action=$action&id=$id"; + + $sql="SELECT * FROM viewhist order by id DESC limit 1"; + $sth=db_execute($dbh,$sql); + $viewhist=$sth->fetchAll(PDO::FETCH_ASSOC); + if (!$demomode) { + if ($viewhist[0]['url']!=$url) { + $sql="INSERT into viewhist (url,description)". + " VALUEs ('$url','$stitle')"; + db_exec($dbh,$sql,1,1,$lastid); + + $lastkeep=(int)($lastid)-40; + $sql="DELETE from viewhist where id<$lastkeep"; + db_exec($dbh,$sql,1,1); + $sth=$dbh->exec($sql); + } + } + } + + $sql="SELECT * FROM viewhist order by id DESC"; + $sth=db_execute($dbh,$sql); + $viewhist=$sth->fetchAll(PDO::FETCH_ASSOC); + + ?> +
+ ".$viewhist[$i]['description']."
\n"; + } + + ?> +
+ +$authmsg
"; +elseif (!strstr($authmsg,"elcome")) + echo "
$authmsg
"; + + +if ($authstatus) { +?> + DB (SQLite)
+ Full Backup
+ ". + "Version $version
sivann
\n"; +?> +
+ + + + + +
+Please log in"; + require("php/about.php"); +} + +$itdb_end=getmicrotime(); + +echo "
";// + +echo "server time = ".number_format(($itdb_end - $itdb_start),3)." secs"; + +?> + + + diff --git a/init.php b/init.php index 3b1f852..f25621a 100644 --- a/init.php +++ b/init.php @@ -801,4 +801,15 @@ function getagenturlbytag($agenturl,$tagstr) { return ""; } +function dbversion() { + global $dbh; + + $sql="SELECT * from settings"; + $sth=db_execute($dbh,$sql); + $r=$sth->fetch(PDO::FETCH_ASSOC); + $sth->closeCursor(); + $ver=$r['dbversion']; + return $ver; +} + ?> diff --git a/itdb.php b/itdb.php deleted file mode 100644 index a6078f5..0000000 --- a/itdb.php +++ /dev/null @@ -1,396 +0,0 @@ -\n"; - break; - case "listagents": - $title="List Agents"; - break; - case "editagent": - $title="Edit Agent"; - break; - case "edititem": - $title="Edit Item"; - $stitle="Item"; - $head.="\n". - "\n". - "\n". - "\n". - "\n"; - break; - case "editsoftware": - $title="Edit Software"; - $stitle="Software"; - $head.="\n". - "\n". - "\n". - "\n". - "\n"; - break; - case "listsoftware": - $title="List Software"; - $head.="\n"; - break; - case "listcontracts": - $title="List Contracts"; - break; - case "listinvoices": - $title="List Invoices"; - break; - case "editinvoice": - $title="Edit Invoice"; - $stitle="Invoice"; - $head.="\n". - "\n". - "\n"; - break; - case "listfiles": - $title="List Files"; - break; - case "editfile": - $title="Edit File"; - $stitle="File"; - $head.="\n". - "\n". - "\n"; - break; - case "listracks": - $title="List Racks"; - break; - case "translations": - $title="Translations"; - break; - case "settings": - $title="Settings"; - break; - case "editrack": - $stitle="Rack"; - $title="Edit Rack"; - $head.="\n". - "\n". - "\n"; - break; - case "edititypes": - $title="Edit Item Types"; - break; - case "editcontract": - $title="Edit Contract"; - $stitle="Contract"; - $head.="\n". - "\n". - "\n"; - break; - case "editcontracttypes": - $title="Edit Contract Types"; - break; - case "edittags": - $title="Edit Tags"; - break; - case "editusers": - $title="Edit Users"; - break; - case "listlocations": - $title="List Locations"; - break; - case "editlocation": - $title="Edit Location"; - break; - case "editstatustypes": - $title="Edit Item Status Types"; - break; - case "editfiletypes": - $title="Edit File Types"; - break; - case "printlabels": - $title="Print Labels "; - break; - case "reports": - $title="Reports"; - $head.="\n". - "\n". - "\n". - "\n". - ""; - break; - case "showhist": - $title="History"; - break; - case "browse": - $title="Browse Data"; - $head.=""; - break; - case "viewrack": - $title="Rack"; - $stitle="Rack"; - break; - case "about": - $title="About"; - $stitle="About"; - $req="php/about.php"; - break; - default: - $title=""; - $stitle=""; - $req="php/home.php"; - break; -} -if (isset($_GET['id'])) - $id=$_GET['id']; -else - $id=""; - -if (strlen($stitle)) $stitle.=":".$id; - -$x="style_".$_GET['action']; -$$x="color:#BAFF04 "; - - -require('php/header.php'); - -if ($dlg && $authstatus) { - echo ""; - require($req); - echo "\n\n"; - exit; -} - -?> - - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

+
+
+
+
+
+
+
+



DB Log
-". - "\n
". - "\n". - "

"; - "\n"; -} - -if ($authstatus) { - echo "\n
". - "
". - "\n
"; - - - if (strlen($stitle)) { - $url="$fscriptname?action=$action&id=$id"; - - $sql="SELECT * FROM viewhist order by id DESC limit 1"; - $sth=db_execute($dbh,$sql); - $viewhist=$sth->fetchAll(PDO::FETCH_ASSOC); - if (!$demomode) { - if ($viewhist[0]['url']!=$url) { - $sql="INSERT into viewhist (url,description)". - " VALUEs ('$url','$stitle')"; - db_exec($dbh,$sql,1,1,$lastid); - - $lastkeep=(int)($lastid)-40; - $sql="DELETE from viewhist where id<$lastkeep"; - db_exec($dbh,$sql,1,1); - $sth=$dbh->exec($sql); - } - } - } - - $sql="SELECT * FROM viewhist order by id DESC"; - $sth=db_execute($dbh,$sql); - $viewhist=$sth->fetchAll(PDO::FETCH_ASSOC); - - ?> -
- ".$viewhist[$i]['description']."
\n"; - } - - ?> -
- -$authmsg
"; -elseif (!strstr($authmsg,"elcome")) - echo "
$authmsg
"; - - -if ($authstatus) { -?> - DB (SQLite)
- Full Backup
- ". - "Version $version
sivann
\n"; -?> -
- - - - - -
-Please log in"; - require("php/about.php"); -} - -$itdb_end=getmicrotime(); - -echo "
";// - -echo "server time = ".number_format(($itdb_end - $itdb_start),3)." secs"; - -?> - - - diff --git a/php/datatables_listitems_ajax.php b/php/datatables_listitems_ajax.php index 4f6b1d6..831b71a 100644 --- a/php/datatables_listitems_ajax.php +++ b/php/datatables_listitems_ajax.php @@ -213,7 +213,7 @@ $x=attrofstatus($statusid,$dbh); $attr=$x[0]; $statustxt=$x[1]; $r="
 ". - "". + "". $aRow['itemid']."
"; $row[] = $r; } diff --git a/php/edititypes.php b/php/edititypes.php index ca01e72..3f77de4 100644 --- a/php/edititypes.php +++ b/php/edititypes.php @@ -73,7 +73,7 @@ $fixtypes=$sth->fetchAll(PDO::FETCH_ASSOC); -echo "
"; +echo ""; echo ""; ?> diff --git a/php/edittags.php b/php/edittags.php index 3e95eeb..749d144 100644 --- a/php/edittags.php +++ b/php/edittags.php @@ -123,12 +123,12 @@ $(document).ready(function(){ $(".showitems" ).click(function() { - $("#itemresults").html('
').load('/itdb/php/tag2item_ajaxlist.php?tagid='+ $(this).attr('href')); + $("#itemresults").html('
').load('php/tag2item_ajaxlist.php?tagid='+ $(this).attr('href')); return false; }); $(".showsoftware" ).click(function() { - $("#softwareresults").html('
').load('/itdb/php/tag2software_ajaxlist.php?tagid='+ $(this).attr('href')); + $("#softwareresults").html('
').load('php/tag2software_ajaxlist.php?tagid='+ $(this).attr('href')); return false; }); diff --git a/php/itemform.php b/php/itemform.php index 82e175a..c0637b4 100644 --- a/php/itemform.php +++ b/php/itemform.php @@ -40,35 +40,6 @@ }); - -/* - function mdl() { - dialog1=$('
') - .html('
') - .load('/itdb/itdb.php?action=edititypes&dlg=1') - .dialog({ - autoOpen: false, - title: 'Basic Dialog', - modal:true, - height:500, - width:300, - close: function (e, ui) { $(this).remove(); }, - }); - } - - $('#eit').click(function() { - mdl(); - - dialog1.dialog('open'); - return false; - }); - - -*/ - - - - }); diff --git a/php/printlabels.php b/php/printlabels.php index e194c19..ccd8898 100644 --- a/php/printlabels.php +++ b/php/printlabels.php @@ -26,8 +26,8 @@ " '$headertext', '$image', '$imagewidth', '$imageheight', '$papersize' )"; $sth=db_execute($dbh,$sql); } - echo "\n"; - echo "Go here\n"; + echo "\n"; + echo "Go here\n"; exit; } diff --git a/php/tag2item_ajaxlist.php b/php/tag2item_ajaxlist.php index b748907..460971b 100644 --- a/php/tag2item_ajaxlist.php +++ b/php/tag2item_ajaxlist.php @@ -22,7 +22,7 @@ $x=($i+1).": ".$ri[$i]['txt']; if ($i%2) $bcolor="#D9E3F6"; else $bcolor="#ffffff"; $institems.="\t
". - "$x
\n"; + "$x\n"; } echo "

".t('Associated Items')." (".tagid2name($tagid).")

"; diff --git a/php/tag2software_ajaxlist.php b/php/tag2software_ajaxlist.php index fbfea04..a5ff235 100644 --- a/php/tag2software_ajaxlist.php +++ b/php/tag2software_ajaxlist.php @@ -20,7 +20,7 @@ $x=($i+1).": ".$ri[$i]['txt']; if ($i%2) $bcolor="#D9E3F6"; else $bcolor="#ffffff"; $instsoftware.="\t
". - "$x
\n"; + "$x\n"; } echo "

".t('Associated Software')." (".tagid2name($tagid).")

"; echo $instsoftware;