Cheetah
modules
cheetah
photos
classes
ChPhotosDb.php
Go to the documentation of this file.
1
<?
php
2
8
require_once(CH_DIRECTORY_PATH_CLASSES .
'ChWsbFilesDb.php'
);
9
10
class
ChPhotosDb
extends
ChWsbFilesDb
11
{
12
/*
13
* Constructor.
14
*/
15
function
__construct
(&$oConfig)
16
{
17
parent::__construct($oConfig);
18
$this->sFileTable =
'ch_photos_main'
;
19
$this->sFavoriteTable =
'ch_photos_favorites'
;
20
$this->aFileFields[
'medDesc'
] =
'Desc'
;
21
$this->aFileFields[
'medExt'
] =
'Ext'
;
22
$this->aFileFields[
'medSize'
] =
'Size'
;
23
$this->aFileFields[
'Hash'
] =
'Hash'
;
24
}
25
26
function
getSettingsCategory
()
27
{
28
return
(
int
)$this->
getOne
(
"SELECT `ID` FROM `sys_options_cats` WHERE `name` = 'Photos' LIMIT 1"
);
29
}
30
31
function
getIdByHash
($sHash)
32
{
33
$sHash =
process_db_input
($sHash,
CH_TAGS_STRIP
);
34
return
(
int
)$this->
fromMemory
(
'ch_photos_'
. $sHash,
'getOne'
,
"
35
SELECT `{$this->aFileFields['medID']}`
36
FROM `{$this->sFileTable}`
37
WHERE `{$this->aFileFields['Hash']}` = '$sHash'"
);
38
}
39
40
function
setAvatar
(
$iFileId
, $iAlbumId)
41
{
42
$this->
query
(
"UPDATE `sys_albums_objects` SET `obj_order` = `obj_order` + 1 WHERE `id_album` = "
. (
int
)$iAlbumId);
43
return
$this->
query
(
"UPDATE `sys_albums_objects` SET `obj_order` = 0 WHERE `id_object` = "
. (
int
)
$iFileId
.
" AND `id_album` = "
. (
int
)$iAlbumId);
44
}
45
}
process_db_input
process_db_input($sText, $iStripTags=0)
Definition:
utils.inc.php:256
ChPhotosDb\__construct
__construct(&$oConfig)
Definition:
ChPhotosDb.php:15
ChPhotosDb
Definition:
ChPhotosDb.php:11
ChPhotosDb\setAvatar
setAvatar($iFileId, $iAlbumId)
Definition:
ChPhotosDb.php:40
php
ChWsbDb\query
query($sQuery, $aBindings=[])
Definition:
ChWsbDb.php:386
ChPhotosDb\getIdByHash
getIdByHash($sHash)
Definition:
ChPhotosDb.php:31
ChWsbDb\getOne
getOne($sQuery, $aBindings=[], $iIndex=0)
Definition:
ChWsbDb.php:263
CH_TAGS_STRIP
const CH_TAGS_STRIP
Definition:
utils.inc.php:22
$iFileId
$iFileId
Definition:
embed.php:12
ChWsbDb\fromMemory
& fromMemory($sName, $sFunc)
Definition:
ChWsbDb.php:574
ChPhotosDb\getSettingsCategory
getSettingsCategory()
Definition:
ChPhotosDb.php:26
ChWsbFilesDb
Definition:
ChWsbFilesDb.php:11
Generated by
1.8.20