diff --git a/include/appData.php b/include/appData.php index c790213..58bd46f 100644 --- a/include/appData.php +++ b/include/appData.php @@ -153,7 +153,7 @@ class appData $sLink, $oRow->type, $oRow->description, - print_date(mysqltimestamp_to_unixtimestamp($oRow->submitTime))), + print_date(mysqldatetime_to_unixtimestamp($oRow->submitTime))), ($i % 2) ? "color0" : "color1"); } @@ -500,7 +500,7 @@ class appData $oUser = new User($this->iSubmitterId); $oTableRow = new TableRow(); - $oTableRow->AddTextCell(print_date(mysqltimestamp_to_unixtimestamp($this->sSubmitTime))); + $oTableRow->AddTextCell(print_date(mysqldatetime_to_unixtimestamp($this->sSubmitTime))); $oTableRow->AddTextCell($oUser->objectMakeLink()); $oTableRow->AddTextCell($oApp->objectMakeLink()); $oTableRow->AddTextCell($this->iVersionId ? $oVersion->objectMakeLink() : "N/A"); diff --git a/include/application.php b/include/application.php index 083d040..04c7d6e 100644 --- a/include/application.php +++ b/include/application.php @@ -121,12 +121,14 @@ class Application { if(!$_SESSION['current']->canCreateApplication()) return; - $hResult = query_parameters("INSERT INTO appFamily (appName, description, keywords, ". - "webPage, vendorId, catId, submitterId, queued) VALUES (". - "'?', '?', '?', '?', '?', '?', '?', '?')", + $hResult = query_parameters("INSERT INTO appFamily (appName, description, ". + "keywords, webPage, vendorId, catId, ". + "submitTime, submitterId, ". + "queued) VALUES (". + "'?', '?', '?', '?', '?', '?', ?, '?', '?')", $this->sName, $this->sDescription, $this->sKeywords, $this->sWebpage, $this->iVendorId, $this->iCatId, - $_SESSION['current']->iUserId, + "NOW()", $_SESSION['current']->iUserId, $this->mustBeQueued() ? "true" : "false"); if($hResult) { @@ -804,7 +806,7 @@ class Application { $oTableRow->AddTextCell($oApp->objectMakeLink()); $oTableRow->AddTextCell($oRow->description); $oTableRow->AddTextCell($oVendor->objectMakeLink()); - $oTableRow->AddTextCell(print_date(mysqltimestamp_to_unixtimestamp($oRow->submitTime))); + $oTableRow->AddTextCell(print_date(mysqldatetime_to_unixtimestamp($oRow->submitTime))); $oTableRow->SetClass(($i % 2) ? "color0" : "color1"); $oTable->AddRow($oTableRow); @@ -902,7 +904,7 @@ class Application { $sVendor = $oVendor->objectMakeLink(); $oTableRow = new TableRow(); - $oTableRow->AddTextCell(print_date(mysqltimestamp_to_unixtimestamp($this->sSubmitTime))); + $oTableRow->AddTextCell(print_date(mysqldatetime_to_unixtimestamp($this->sSubmitTime))); $oTableRow->AddTextCell($oUser->objectMakeLink()); $oTableRow->AddTextCell($sVendor); $oTableRow->AddTextCell($this->sName); diff --git a/include/browse_newest_apps.php b/include/browse_newest_apps.php index 733c169..65ea853 100644 --- a/include/browse_newest_apps.php +++ b/include/browse_newest_apps.php @@ -77,7 +77,7 @@ class browse_newest_apps $oTableRow = new TableRow(); - $oTableCell = new TableCell(print_short_date(mysqltimestamp_to_unixtimestamp($oApp->sSubmitTime))); + $oTableCell = new TableCell(print_short_date(mysqldatetime_to_unixtimestamp($oApp->sSubmitTime))); $oTableCell->SetWidth("20%"); $oTableRow->AddCell($oTableCell); $oTableRow->AddTextCell($oApp->objectMakeLink()); diff --git a/include/bugs.php b/include/bugs.php index 213e589..ce26712 100644 --- a/include/bugs.php +++ b/include/bugs.php @@ -120,11 +120,13 @@ class Bug { /* passed the checks so lets insert the puppy! */ - $hResult = query_parameters("INSERT INTO buglinks (versionId, bug_id, queued, submitterId) ". - "VALUES('?', '?', '?', '?')", + $hResult = query_parameters("INSERT INTO buglinks (versionId, bug_id, ". + "submitTime, submitterId, queued) ". + "VALUES('?', '?', ?, '?', '?')", $this->iVersionId, $this->iBug_id, - $this->bQueued ? "true":"false", - $_SESSION['current']->iUserId); + "NOW()", + $_SESSION['current']->iUserId, + $this->bQueued ? "true":"false"); if($hResult) { $this->iLinkId = mysql_insert_id(); @@ -279,7 +281,7 @@ class Bug { $oBug->sBug_status, $oBug->sResolution, $oBug->sShort_desc, - print_date(mysqltimestamp_to_unixtimestamp($oRow->submitTime))), + print_date(mysqldatetime_to_unixtimestamp($oRow->submitTime))), ($i % 2) ? "color0" : "color1"); } diff --git a/include/distribution.php b/include/distribution.php index bcc868d..4f92dcc 100644 --- a/include/distribution.php +++ b/include/distribution.php @@ -99,9 +99,11 @@ class distribution { } } - $hResult = query_parameters("INSERT INTO distributions (name, url, submitterId, queued) ". - "VALUES ('?', '?', '?', '?')", + $hResult = query_parameters("INSERT INTO distributions (name, url, submitTime, ". + "submitterId, queued) ". + "VALUES ('?', '?', ?, '?', '?')", $this->sName, $this->sUrl, + "NOW()", $_SESSION['current']->iUserId, $this->mustBeQueued() ? "true" : "false"); if($hResult) @@ -570,7 +572,7 @@ class distribution { else echo $oSubmitter->sRealname; echo '',"\n"; - echo ''.date("M d Y", mysqltimestamp_to_unixtimestamp($oTest->sSubmitTime)).'',"\n"; + echo ''.date("M d Y", mysqldatetime_to_unixtimestamp($oTest->sSubmitTime)).'',"\n"; echo ''.$oTest->sTestedRelease.' ',"\n"; echo ''.$oTest->sInstalls.' ',"\n"; echo ''.$oTest->sRuns.' ',"\n"; diff --git a/include/downloadurl.php b/include/downloadurl.php index 76df896..5bcb37b 100644 --- a/include/downloadurl.php +++ b/include/downloadurl.php @@ -297,11 +297,13 @@ class downloadurl return FALSE; $hResult = query_parameters("INSERT INTO appData (versionId, type, - description, url, queued, submitterId) - VALUES('?','?','?','?','?','?')", + description, url, queued, submitTime, submitterId) + VALUES('?', '?', '?', '?', '?', ?, '?')", $this->iVersionId, "downloadurl", $this->sDescription, - $this->sUrl, downloadurl::canEdit($this->iVersionId) ? - "false" : "true", $_SESSION['current']->iUserId); + $this->sUrl, + downloadurl::canEdit($this->iVersionId) ? "false" : "true", + "NOW()", + $_SESSION['current']->iUserId); $this->iId = mysql_insert_id(); if(!$hResult) diff --git a/include/monitor.php b/include/monitor.php index 222d1ac..d9779d9 100644 --- a/include/monitor.php +++ b/include/monitor.php @@ -75,9 +75,11 @@ class Monitor { return FALSE; // create the new monitor entry - $hResult = query_parameters("INSERT INTO appMonitors (versionId, appId, userId) ". - "VALUES ('?', '?', '?')", - $this->iVersionId, $this->iAppId, $this->iUserId); + $hResult = query_parameters("INSERT INTO appMonitors (versionId, appId,". + "submitTime, userId) ". + "VALUES ('?', '?', ?, '?')", + $this->iVersionId, $this->iAppId, + "NOW()", $this->iUserId); if($hResult) { diff --git a/include/note.php b/include/note.php index 64de96f..9f7ceb4 100644 --- a/include/note.php +++ b/include/note.php @@ -53,11 +53,14 @@ class Note { */ function create() { - $hResult = query_parameters("INSERT INTO appNotes (versionId, noteTitle, noteDesc, submitterId) ". - "VALUES('?', '?', '?', '?')", + $hResult = query_parameters("INSERT INTO appNotes (versionId, ". + "noteTitle, noteDesc, submitterId, ". + "submitTime) ". + "VALUES('?', '?', '?', '?', ?)", $this->iVersionId, $this->sTitle, $this->shDescription, - $_SESSION['current']->iUserId); + $_SESSION['current']->iUserId, + "NOW()"); if($hResult) { @@ -154,7 +157,8 @@ class Note { $oSubmitter = new User($this->iSubmitterId); $sSubject = "Note $this->sTitle for $sAppName has been deleted by ". $_SESSION['current']->sRealname; - $sMsg .= "This note was made on ".print_date(mysqltimestamp_to_unixtimestamp($this->sSubmitTime))." by ".$oSubmitter->sRealname."\n"; + $sMsg .= "This note was made on ".print_date(mysqldatetime_to_unixtimestamp($this->sSubmitTime)). + " by ".$oSubmitter->sRealname."\n"; $sMsg .= "\n"; $sMsg .= "Subject: ".$this->sTitle."\n"; $sMsg .= "\n"; diff --git a/include/screenshot.php b/include/screenshot.php index e708465..0897e74 100644 --- a/include/screenshot.php +++ b/include/screenshot.php @@ -71,11 +71,12 @@ class screenshot function create() { $hResult = query_parameters("INSERT INTO appData - (versionId, type, description, queued, submitterId) - VALUES('?', '?', '?', '?', '?')", + (versionId, type, description, queued, submitTime, submitterId) + VALUES('?', '?', '?', '?', ?, '?')", $this->iVersionId, "screenshot", $this->sDescription, $this->mustBeQueued() ? "true" : "false", + "NOW()", $_SESSION['current']->iUserId); if($hResult) { diff --git a/include/testData.php b/include/testData.php index ff9e790..4ff90d3 100644 --- a/include/testData.php +++ b/include/testData.php @@ -65,9 +65,11 @@ class testData{ { $hResult = query_parameters("INSERT INTO testResults (versionId, whatWorks, whatDoesnt,". "whatNotTested, testedDate, distributionId, testedRelease,". - "installs, runs, testedRating, comments, submitterId, queued)". - " VALUES('?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?',". - "'?', '?')", + "installs, runs, testedRating, comments,". + "submitTime, submitterId, queued)". + "VALUES('?', '?', '?', '?', '?', '?', '?',". + "'?', '?', '?', '?',". + "?, '?', '?')", $this->iVersionId, $this->shWhatWorks, $this->shWhatDoesnt, $this->shWhatNotTested, $this->sTestedDate, @@ -75,6 +77,7 @@ class testData{ $this->sTestedRelease, $this->sInstalls, $this->sRuns, $this->sTestedRating, $this->sComments, + "NOW()", $_SESSION['current']->iUserId, $this->mustBeQueued() ? "true" : "false"); @@ -812,7 +815,7 @@ class testData{ version::fullNameLink($oRow->versionId), $oRow->testedRating, $oRow->testedRelease, - print_date(mysqltimestamp_to_unixtimestamp($oRow->submitTime))), + print_date(mysqldatetime_to_unixtimestamp($oRow->submitTime))), $oRow->testedRating); $sReturn .= html_table_end(); @@ -1014,7 +1017,7 @@ class testData{ $bHasMaintainer = (mysql_num_rows($hMaintainers) == 0) ? false : true; $oTableRow = new TableRow(); - $oTableRow->AddCell(new TableCell(print_date(mysqltimestamp_to_unixtimestamp($this->sSubmitTime)))); + $oTableRow->AddCell(new TableCell(print_date(mysqldatetime_to_unixtimestamp($this->sSubmitTime)))); $oTableRow->AddCell(new TableCell($oUser->objectMakeLink())); $oTableRow->AddCell(new TableCell($oApp->objectMakeLink())); $oTableRow->AddCell(new TableCell($oVersion->objectMakeLink())); diff --git a/include/url.php b/include/url.php index d9178f1..8e142f0 100644 --- a/include/url.php +++ b/include/url.php @@ -54,7 +54,8 @@ class Url { /** * Creates a new url. */ - function create($sDescription = null, $sUrl = null, $iVersionId = null, $iAppId = null, $bSilent = false) + function create($sDescription = null, $sUrl = null, $iVersionId = null, + $iAppId = null, $bSilent = false) { global $aClean; @@ -64,11 +65,11 @@ class Url { $this->bQueued = true; $hResult = query_parameters("INSERT INTO appData (appId, versionId, type, - description, queued, submitterId, url) - VALUES ('?', '?', '?', '?', '?', '?', '?')", + description, queued, submitTime, submitterId, url) + VALUES ('?', '?', '?', '?', '?', ?, '?', '?')", $iAppId, $iVersionId, "url", $sDescription, $this->bQueued ? "true" : "false", - $_SESSION['current']->iUserId, $sUrl); + "NOW()", $_SESSION['current']->iUserId, $sUrl); if(!$hResult) { diff --git a/include/util.php b/include/util.php index 822ff28..aa2122b 100644 --- a/include/util.php +++ b/include/util.php @@ -44,7 +44,6 @@ function build_urlarg($vars) return implode("&", $arr); } - /* * return all values of a mapping as an array */ @@ -56,7 +55,6 @@ function values($arr) return $res; } - // print the month, day, year, hour, minute, second function print_date($sTimestamp) { @@ -99,10 +97,7 @@ function mysqltimestamp_to_unixtimestamp($sTimestamp) function mysqldatetime_to_unixtimestamp($sDatetime) { - sscanf($sDatetime, "%4s-%2s-%2s %2s:%2s:%2s", - &$y, &$m, &$d, - &$hours, &$minutes, &$seconds); - return mktime($hours,$minutes,$seconds,$m, $d, $y); + return strtotime($sDatetime); } function get_remote() diff --git a/include/version.php b/include/version.php index 9def8f4..cc6115b 100644 --- a/include/version.php +++ b/include/version.php @@ -86,10 +86,11 @@ class version { $hResult = query_parameters("INSERT INTO appVersion (versionName, description, maintainer_release, - maintainer_rating, appId, submitterId, queued, license) - VALUES ('?', '?', '?', '?', '?', '?', '?', '?')", + maintainer_rating, appId, submitTime, submitterId, + queued, license) + VALUES ('?', '?', '?', '?', '?', ?, '?', '?', '?')", $this->sName, $this->sDescription, $this->sTestedRelease, - $this->sTestedRating, $this->iAppId, + $this->sTestedRating, $this->iAppId, "NOW()", $_SESSION['current']->iUserId, $this->sQueued, $this->sLicense); @@ -1216,7 +1217,7 @@ class version { $oTableRow = new TableRow(); $oTableRow->AddTextCell(version::fullNameLink($oRow->versionId)); $oTableRow->AddTextCell($oRow->description); - $oTableRow->AddTextCell(print_date(mysqltimestamp_to_unixtimestamp($oRow->submitTime))); + $oTableRow->AddTextCell(print_date(mysqldatetime_to_unixtimestamp($oRow->submitTime))); $oTableRow->SetClass(($i % 2) ? "color0" : "color1"); $oTable->AddRow($oTableRow); @@ -1515,7 +1516,7 @@ class version { $oVendor = new vendor($oApp->iVendorId); $oTableRow = new TableRow(); - $oTableRow->AddTextCell(print_date(mysqltimestamp_to_unixtimestamp($this->sSubmitTime))); + $oTableRow->AddTextCell(print_date(mysqldatetime_to_unixtimestamp($this->sSubmitTime))); $oTableRow->AddTextCell($oUser->objectMakeLink()); $oTableRow->AddTextCell($oVendor->objectMakeLink()); $oTableRow->AddTextCell($oApp->objectMakeLink()); diff --git a/include/vote.php b/include/vote.php index ebed971..506cbd1 100644 --- a/include/vote.php +++ b/include/vote.php @@ -68,7 +68,7 @@ function vote_add($iVersionId, $iSlot, $iUserId = null) vote_remove($iSlot, $iUserId); query_parameters("INSERT INTO appVotes (id, time, versionId, userId, slot) - VALUES (?, ?, '?', '?', '?')", "null", "null", + VALUES (?, ?, '?', '?', '?')", "null", "NOW()", $iVersionId, $iUserId, $iSlot); } diff --git a/tables/appdb_tables.sql b/tables/appdb_tables.sql index a527ebc..b112f03 100644 --- a/tables/appdb_tables.sql +++ b/tables/appdb_tables.sql @@ -39,7 +39,7 @@ create table appFamily ( description text, webPage varchar(100), catId int, - submitTime timestamp(14) NOT NULL, + submitTime datetime NOT NULL, submitterId int(11) NOT NULL default '0', queued enum('true','false','rejected') NOT NULL default 'false', key(appId) @@ -56,7 +56,7 @@ create table appVersion ( description text, maintainer_rating text, maintainer_release text, - submitTime timestamp(14) NOT NULL, + submitTime datetime NOT NULL, submitterId int(11) NOT NULL default '0', queued enum('true','false','rejected') NOT NULL default 'false', license enum('Retail','Open Source','Freeware','Demo','Shareware'), @@ -93,7 +93,7 @@ create table appBundle ( */ create table appHitStats ( appHitId int not null auto_increment, - time timestamp, + time datetime, ip varchar(16), appId int not null, count int, @@ -102,7 +102,7 @@ create table appHitStats ( create table catHitStats ( catHitId int not null auto_increment, - time timestamp, + time datetime, ip varchar(16), catId int not null, count int, @@ -132,15 +132,15 @@ create table appComments ( * links to screenshots and other stuff */ create table appData ( - id int not null auto_increment, - appId int not null, - versionId int default 0, - type enum('screenshot', 'url', 'bug','downloadurl'), - description text, - url varchar(255) default NULL, - submitTime timestamp(14) NOT NULL, - submitterId int(11) NOT NULL default '0', - queued enum('true','false','rejected') NOT NULL default 'false', + id int not null auto_increment, + appId int not null, + versionId int default 0, + type enum('screenshot', 'url', 'bug','downloadurl'), + description text, + url varchar(255) default NULL, + submitTime datetime NOT NULL, + submitterId int(11) NOT NULL default '0', + queued enum('true','false','rejected') NOT NULL default 'false', KEY id (id), KEY versionId (versionId) ); @@ -152,7 +152,7 @@ create table appData ( */ create table appVotes ( id int not null auto_increment, - time timestamp, + time datetime, versionId int not null, userId int not null, slot int not null, @@ -171,7 +171,7 @@ create table appNotes ( noteDesc text, versionId int not null, submitterId int not null, - submitTime timestamp not null, + submitTime datetime not null, key(noteId) ); @@ -181,7 +181,7 @@ create table appNotes ( */ create table sessionMessages ( id int not null auto_increment, - time timestamp, + time datetime, sessionId varchar(32), message text, key(id), diff --git a/tables/banner.sql b/tables/banner.sql index 08b824f..1089909 100644 --- a/tables/banner.sql +++ b/tables/banner.sql @@ -6,7 +6,7 @@ CREATE TABLE banner ( alt varchar(255), imp int not null, clk int not null, - lastmod timestamp, + lastmod datetime, primary key(id) ) diff --git a/tables/buglinks.sql b/tables/buglinks.sql index a5741b9..f00738d 100644 --- a/tables/buglinks.sql +++ b/tables/buglinks.sql @@ -9,7 +9,7 @@ create table buglinks ( linkId int not null auto_increment, bug_id int not null, versionId int not null, - submitTime timestamp(14) NOT NULL, + submitTime datetime NOT NULL, submitterId int(11) NOT NULL default '0', queued enum('true','false') NOT NULL default 'false', key(linkId), diff --git a/tables/distributions.sql b/tables/distributions.sql index f21453a..ab0ef31 100644 --- a/tables/distributions.sql +++ b/tables/distributions.sql @@ -6,13 +6,13 @@ drop table if exists distributions; * Distributions table. */ create table distributions ( - distributionId int not null auto_increment, - name varchar(255) default NULL, - url varchar(255) default NULL, - submitTime timestamp(14) NOT NULL, - submitterId int(11) NOT NULL default '0', - queued enum('true','false','rejected') NOT NULL default 'false', + distributionId int not null auto_increment, + name varchar(255) default NULL, + url varchar(255) default NULL, + submitTime datetime NOT NULL, + submitterId int(11) NOT NULL default '0', + queued enum('true','false','rejected') NOT NULL default 'false', key(distributionId), - index(name) + index(name) ); diff --git a/tables/monitors.sql b/tables/monitors.sql index fd87ab8..048a6e1 100644 --- a/tables/monitors.sql +++ b/tables/monitors.sql @@ -9,7 +9,7 @@ create table appMonitors ( monitorId int not null auto_increment, appId int not null, versionId int not null, - submitTime timestamp(14) NOT NULL, + submitTime datetime NOT NULL, userId int(11) NOT NULL default '0', key(monitorId), index(appid), diff --git a/tables/session_list.sql b/tables/session_list.sql index ab6d164..2878f75 100644 --- a/tables/session_list.sql +++ b/tables/session_list.sql @@ -8,6 +8,6 @@ CREATE TABLE session_list ( ip varchar(64) default NULL, data text, messages text, - stamp timestamp(14) NOT NULL, + stamp datetime NOT NULL, PRIMARY KEY (session_id) ) TYPE=MyISAM; diff --git a/tables/testResults.sql b/tables/testResults.sql index cff28ae..2b1da31 100644 --- a/tables/testResults.sql +++ b/tables/testResults.sql @@ -18,7 +18,7 @@ create table testResults ( runs enum('Yes','No','Not Installable') NOT NULL default 'Yes', testedRating enum('Platinum','Gold','Silver','Bronze','Garbage') NOT NULL, comments text, - submitTime timestamp(14) NOT NULL, + submitTime datetime NOT NULL, submitterId int(11) NOT NULL default '0', queued enum('true','false','rejected') NOT NULL default 'false', key(testingId) diff --git a/tables/user_list.sql b/tables/user_list.sql index 5c9c571..d7cb197 100644 --- a/tables/user_list.sql +++ b/tables/user_list.sql @@ -3,13 +3,13 @@ use apidb; drop table if exists user_list; create table user_list ( - stamp timestamp not null, + stamp datetime not null, userid int not null auto_increment, password text not null, realname text not null, email varchar(255) not null, created datetime not null, - inactivity_warn_stamp timestamp not null, /* the time we warned the user */ + inactivity_warn_stamp datetime not null, /* the time we warned the user */ inactivity_warned enum('true','false') NOT NULL default 'false', /* if true, we warned the user */ CVSrelease text, unique key(userid),