Add Expires field support
This commit is contained in:
parent
19903ea3c1
commit
c165894ce9
@ -112,7 +112,7 @@ abstract class photo_driver {
|
|||||||
public function saveImage($path) {
|
public function saveImage($path) {
|
||||||
if(!$this->is_valid())
|
if(!$this->is_valid())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
file_put_contents($path, $this->imageString());
|
return (file_put_contents($path, $this->imageString()) ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -344,6 +344,7 @@ abstract class photo_driver {
|
|||||||
$p['xchan'] = (($arr['xchan']) ? $arr['xchan'] : '');
|
$p['xchan'] = (($arr['xchan']) ? $arr['xchan'] : '');
|
||||||
$p['resource_id'] = (($arr['resource_id']) ? $arr['resource_id'] : '');
|
$p['resource_id'] = (($arr['resource_id']) ? $arr['resource_id'] : '');
|
||||||
$p['filename'] = (($arr['filename']) ? $arr['filename'] : '');
|
$p['filename'] = (($arr['filename']) ? $arr['filename'] : '');
|
||||||
|
$p['mimetype'] = (($arr['mimetype']) ? $arr['mimetype'] : $this->getType());
|
||||||
$p['album'] = (($arr['album']) ? $arr['album'] : '');
|
$p['album'] = (($arr['album']) ? $arr['album'] : '');
|
||||||
$p['imgscale'] = ((intval($arr['imgscale'])) ? intval($arr['imgscale']) : 0);
|
$p['imgscale'] = ((intval($arr['imgscale'])) ? intval($arr['imgscale']) : 0);
|
||||||
$p['allow_cid'] = (($arr['allow_cid']) ? $arr['allow_cid'] : '');
|
$p['allow_cid'] = (($arr['allow_cid']) ? $arr['allow_cid'] : '');
|
||||||
@ -360,6 +361,7 @@ abstract class photo_driver {
|
|||||||
$p['display_path'] = (($arr['display_path']) ? $arr['display_path'] : '');
|
$p['display_path'] = (($arr['display_path']) ? $arr['display_path'] : '');
|
||||||
$p['width'] = (($arr['width']) ? $arr['width'] : $this->getWidth());
|
$p['width'] = (($arr['width']) ? $arr['width'] : $this->getWidth());
|
||||||
$p['height'] = (($arr['height']) ? $arr['height'] : $this->getHeight());
|
$p['height'] = (($arr['height']) ? $arr['height'] : $this->getHeight());
|
||||||
|
$p['expires'] = (($arr['expires']) ? $arr['expires'] : gmdate('Y-m-d H:i:s', time() + get_config('system','photo_cache_time', 86400)));
|
||||||
|
|
||||||
if(! intval($p['imgscale']))
|
if(! intval($p['imgscale']))
|
||||||
logger('save: ' . print_r($arr,true), LOGGER_DATA);
|
logger('save: ' . print_r($arr,true), LOGGER_DATA);
|
||||||
@ -397,17 +399,18 @@ abstract class photo_driver {
|
|||||||
allow_cid = '%s',
|
allow_cid = '%s',
|
||||||
allow_gid = '%s',
|
allow_gid = '%s',
|
||||||
deny_cid = '%s',
|
deny_cid = '%s',
|
||||||
deny_gid = '%s'
|
deny_gid = '%s',
|
||||||
|
expires = '%s'
|
||||||
where id = %d",
|
where id = %d",
|
||||||
|
|
||||||
intval($p['aid']),
|
intval($p['aid']),
|
||||||
intval($p['uid']),
|
intval($p['uid']),
|
||||||
dbesc($p['xchan']),
|
dbesc($p['xchan']),
|
||||||
dbesc($p['resource_id']),
|
dbesc($p['resource_id']),
|
||||||
dbesc($p['created']),
|
dbescdate($p['created']),
|
||||||
dbesc($p['edited']),
|
dbescdate($p['edited']),
|
||||||
dbesc(basename($p['filename'])),
|
dbesc(basename($p['filename'])),
|
||||||
dbesc($this->getType()),
|
dbesc($p['mimetype']),
|
||||||
dbesc($p['album']),
|
dbesc($p['album']),
|
||||||
intval($p['height']),
|
intval($p['height']),
|
||||||
intval($p['width']),
|
intval($p['width']),
|
||||||
@ -424,22 +427,23 @@ abstract class photo_driver {
|
|||||||
dbesc($p['allow_gid']),
|
dbesc($p['allow_gid']),
|
||||||
dbesc($p['deny_cid']),
|
dbesc($p['deny_cid']),
|
||||||
dbesc($p['deny_gid']),
|
dbesc($p['deny_gid']),
|
||||||
|
dbescdate($p['expires']),
|
||||||
intval($x[0]['id'])
|
intval($x[0]['id'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$p['created'] = (($arr['created']) ? $arr['created'] : $p['edited']);
|
$p['created'] = (($arr['created']) ? $arr['created'] : $p['edited']);
|
||||||
$r = q("INSERT INTO photo
|
$r = q("INSERT INTO photo
|
||||||
( aid, uid, xchan, resource_id, created, edited, filename, mimetype, album, height, width, content, os_storage, filesize, imgscale, photo_usage, title, description, os_path, display_path, allow_cid, allow_gid, deny_cid, deny_gid )
|
( aid, uid, xchan, resource_id, created, edited, filename, mimetype, album, height, width, content, os_storage, filesize, imgscale, photo_usage, title, description, os_path, display_path, allow_cid, allow_gid, deny_cid, deny_gid, expires )
|
||||||
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
|
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
|
||||||
intval($p['aid']),
|
intval($p['aid']),
|
||||||
intval($p['uid']),
|
intval($p['uid']),
|
||||||
dbesc($p['xchan']),
|
dbesc($p['xchan']),
|
||||||
dbesc($p['resource_id']),
|
dbesc($p['resource_id']),
|
||||||
dbesc($p['created']),
|
dbescdate($p['created']),
|
||||||
dbesc($p['edited']),
|
dbescdate($p['edited']),
|
||||||
dbesc(basename($p['filename'])),
|
dbesc(basename($p['filename'])),
|
||||||
dbesc($this->getType()),
|
dbesc($p['mimetype']),
|
||||||
dbesc($p['album']),
|
dbesc($p['album']),
|
||||||
intval($p['height']),
|
intval($p['height']),
|
||||||
intval($p['width']),
|
intval($p['width']),
|
||||||
@ -455,7 +459,8 @@ abstract class photo_driver {
|
|||||||
dbesc($p['allow_cid']),
|
dbesc($p['allow_cid']),
|
||||||
dbesc($p['allow_gid']),
|
dbesc($p['allow_gid']),
|
||||||
dbesc($p['deny_cid']),
|
dbesc($p['deny_cid']),
|
||||||
dbesc($p['deny_gid'])
|
dbesc($p['deny_gid']),
|
||||||
|
dbescdate($p['expires'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
logger('photo save ' . $p['imgscale'] . ' returned ' . intval($r));
|
logger('photo save ' . $p['imgscale'] . ' returned ' . intval($r));
|
||||||
|
Reference in New Issue
Block a user