add addTimestampToFilePath function
This commit is contained in:
15
inc/main.php
15
inc/main.php
@@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* Main Class
|
* Main Class
|
||||||
* @author franzz
|
* @author franzz
|
||||||
* @version 2.2
|
* @version 2.3
|
||||||
*/
|
*/
|
||||||
abstract class Main extends PhpObject
|
abstract class Main extends PhpObject
|
||||||
{
|
{
|
||||||
@@ -90,6 +90,17 @@ abstract class Main extends PhpObject
|
|||||||
$this->setMasks();
|
$this->setMasks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function addTimestampToFilePath($sFile)
|
||||||
|
{
|
||||||
|
//Remove timestamp
|
||||||
|
$sFilePath = preg_replace('/(.*)\?[\d]{14}$/', '$1', $sFile);
|
||||||
|
|
||||||
|
//Remove base URL
|
||||||
|
$sLocalPath = str_replace($this->asContext['serv_name'], '', $sFilePath);
|
||||||
|
|
||||||
|
return file_exists($sLocalPath)?$sFilePath.'?'.date("YmdHis", filemtime($sLocalPath)):$sFile;
|
||||||
|
}
|
||||||
|
|
||||||
public function addUncaughtError($sError)
|
public function addUncaughtError($sError)
|
||||||
{
|
{
|
||||||
$this->addError('Uncaught errors:'."\n".$sError);
|
$this->addError('Uncaught errors:'."\n".$sError);
|
||||||
@@ -155,7 +166,7 @@ abstract class Main extends PhpObject
|
|||||||
public static function getJsonResult($bSuccess, $sDesc, $asVars=array())
|
public static function getJsonResult($bSuccess, $sDesc, $asVars=array())
|
||||||
{
|
{
|
||||||
header('Content-type: application/json');
|
header('Content-type: application/json');
|
||||||
return json_encode(array('result'=>$bSuccess?self::SUCCESS:self::ERROR, 'desc'=>ToolBox::mb_ucwords($sDesc), 'data'=>$asVars));
|
return json_encode(array('result'=>$bSuccess?self::SUCCESS:self::ERROR, 'desc'=>$sDesc, 'data'=>$asVars));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user