fixed mentioned bugs, updates #206
This commit is contained in:
@@ -553,22 +553,18 @@ class cache
|
||||
}
|
||||
|
||||
|
||||
function logTypeAllowed($logType)
|
||||
function logTypeAllowed($logType, $oldLogType = 0)
|
||||
{
|
||||
// check if given logType is valid for this cache type
|
||||
return (sql_value(" SELECT COUNT(*)
|
||||
FROM cache_logtype
|
||||
WHERE cache_type_id='&1'
|
||||
AND log_type_id='&2'",
|
||||
0,
|
||||
$this->getType(), $logType) > 0);
|
||||
return logtype_ok($this->getCacheId(), $logType, $oldLogType);
|
||||
}
|
||||
|
||||
|
||||
function updateCacheStatus($logType)
|
||||
{
|
||||
// get cache status
|
||||
$cacheStatus = sql_value(" SELECT `cache_status`
|
||||
$cacheStatus = sql_value("
|
||||
SELECT `cache_status`
|
||||
FROM `log_types`
|
||||
WHERE `id`='&1'",
|
||||
0,
|
||||
@@ -579,7 +575,7 @@ class cache
|
||||
}
|
||||
|
||||
|
||||
function getUserLogTypes($userId, $userLogType)
|
||||
function getUserLogTypes($userLogType, $oldLogType = 0)
|
||||
{
|
||||
global $translate, $login;
|
||||
|
||||
@@ -588,7 +584,7 @@ class cache
|
||||
$logtypeNames = get_logtype_names();
|
||||
$allowedLogtypes = get_cache_log_types($this->getCacheId(), 0);
|
||||
$defaultLogType = $userLogType;
|
||||
if (!logtype_ok($this->getCacheId(), $defaultLogType, 0))
|
||||
if (!logtype_ok($this->getCacheId(), $defaultLogType, $oldLogType))
|
||||
$defaultLogType = $allowedLogtypes[0];
|
||||
|
||||
// prepare array
|
||||
@@ -605,10 +601,10 @@ class cache
|
||||
return $logTypes;
|
||||
}
|
||||
|
||||
function teamcommentAllowed($logType)
|
||||
function teamcommentAllowed($logType, $oldTeamComment = false)
|
||||
{
|
||||
// checks if teamcomment is allowed
|
||||
return teamcomment_allowed($this->getCacheId(),$logType);
|
||||
return teamcomment_allowed($this->getCacheId(), $logType, $oldTeamComment);
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -64,6 +64,8 @@ class cachelog
|
||||
|
||||
static function createNewFromCache($oCache, $nUserId)
|
||||
{
|
||||
global $opt;
|
||||
|
||||
// check if user is allowed to log this cache!
|
||||
if ($oCache->exist() == false)
|
||||
return false;
|
||||
@@ -73,6 +75,7 @@ class cachelog
|
||||
$oCacheLog = new cachelog(ID_NEW);
|
||||
$oCacheLog->setUserId($nUserId);
|
||||
$oCacheLog->setCacheId($oCache->getCacheId());
|
||||
$oCacheLog->setNode($opt['logic']['node']['id']);
|
||||
return $oCacheLog;
|
||||
}
|
||||
|
||||
@@ -278,7 +281,8 @@ class cachelog
|
||||
static function isDuplicate($cacheId, $userId, $logType, $logDate, $logText)
|
||||
{
|
||||
// get info if exact the same values are already in database
|
||||
return (sql_value(" SELECT COUNT(`id`)
|
||||
return (sql_value("
|
||||
SELECT COUNT(`id`)
|
||||
FROM `cache_logs`
|
||||
WHERE `cache_id`='&1'
|
||||
AND `user_id`='&2'
|
||||
|
||||
@@ -1254,7 +1254,8 @@ class user
|
||||
function getGivenRatings()
|
||||
{
|
||||
// get number of cache ratings for this user
|
||||
return sql_value(" SELECT COUNT(`user_id`)
|
||||
return sql_value("
|
||||
SELECT COUNT(`user_id`)
|
||||
FROM `cache_rating`
|
||||
WHERE `user_id`='&1'",
|
||||
0,
|
||||
|
||||
Reference in New Issue
Block a user