Skip to content

Commit

Permalink
[15] Add function for get date().
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan <Dfyztimy@list.ru>
  • Loading branch information
Hantet committed Jul 6, 2010
1 parent d1663e3 commit b14ad30
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
6 changes: 2 additions & 4 deletions config.php
Expand Up @@ -41,12 +41,10 @@ function get($id)
## CheckVersion: Check new version in git page of project (boolean).
## version: Current version of bug-tracker. Do not change!
## checkdiff: Different in days for recheck updates.
## defaultdate: Current php time-zone of server.
##################################################################################################*/
"CheckVersion" => false,
"version" => 14,
"checkdiff" => 2,
"defaultdate" => date_default_timezone_set('Europe/Moscow'));
"version" => 15,
"checkdiff" => 2

if(in_array($id,array_keys($arr)))
return $arr[$id];
Expand Down
1 change: 1 addition & 0 deletions lib/classes.php
Expand Up @@ -18,6 +18,7 @@ public function GetSections();
public function GetPercent($id,$one=false);
public function GetPriority($id,$one=false);
public function GetStatus($id,$one=false);
public function GetDate($format);

public function SetStatus($statusid=-1,$id=-1);

Expand Down
13 changes: 11 additions & 2 deletions lib/create.php
Expand Up @@ -76,7 +76,7 @@ public function GetPriority($all,$one=false)
$prior = $sql->fetch($sql->exe($cfg->get("realmd"),"SELECT `name`,`color` FROM `bt_priority` WHERE `id` = '".$id."' LIMIT 1"));
return '<font color="'.$prior['color'].'">'.$prior['name'].'</font>';
}

public function GetStatus($all,$one=false)
{
$cfg = new config;
Expand All @@ -86,7 +86,16 @@ public function GetStatus($all,$one=false)
return $status;
return $sql->res($cfg->get("realmd"),"SELECT `name` FROM `bt_status` WHERE `id` = '".$status."' LIMIT 1");
}


public function GetDate($format)
{
if(isset($format))
{
date_default_timezone_set('Europe/Moscow');
return date($format);
}
}

public function SetStatus($statusid=-1,$id=-1)
{
$cfg = new config;
Expand Down
9 changes: 4 additions & 5 deletions lib/html.php
Expand Up @@ -499,11 +499,10 @@ public function admin()
}
public function CheckVersion()
{
$main = new main;
$cfg = new config;
if(!$cfg->get("CheckVersion"))
return;

$cfg->get("defaultdate");

$created = true;
$fp = @fopen("lib/lastupdate", 'r');
Expand All @@ -512,10 +511,10 @@ public function CheckVersion()
$str = @fgets($fp, 1024);
@fclose($fp);

if($str == date("d"))
if($str == $main->GetDate("d"))
return;

if(date("d") % $cfg->get("checkdiff") != 0 || !$created)
if($main->GetDate("d") % $cfg->get("checkdiff") != 0 || !$created)
{
$current = $cfg->get("version");
$fp = fopen("http://github.com/Hantet/BugTracker/", "r");
Expand Down Expand Up @@ -555,7 +554,7 @@ public function CheckVersion()
{
fclose($fp);
$fp = fopen("lib/lastupdate", 'w');
fwrite($fp,date("d"));
fwrite($fp,$main->GetDate("d"));
}
}
fclose($fp);
Expand Down
3 changes: 1 addition & 2 deletions send.php
Expand Up @@ -26,8 +26,7 @@
$t1 = true;
$t2 = true;
$query = "";
$cfg->get("defaultdate");
$date = date("Y-m-d H:i:s");
$date = $main->GetDate("Y-m-d H:i:s");

do
{
Expand Down

0 comments on commit b14ad30

Please sign in to comment.