- Fehler bei Doppelbewertungen gefixed

- Deaktivieren von Bewertungen gefixed
- JavaScript-Fehler im Safari gefixed
This commit is contained in:
Carsten Götzinger 2015-02-24 07:34:22 +01:00
parent e2a1ac4dbf
commit 0bcf4fbed4
5 changed files with 56 additions and 13 deletions

View File

@ -90,7 +90,7 @@ class DcaHelper extends \Backend
}
} else {
$this->Database->prepare("UPDATE tl_rateit_items SET active='' WHERE rkey=? and typ=?")
->execute($dc->activeRecord->id, $typ)
->execute($dc->activeRecord->id, $type)
->updatedId;
}

View File

@ -634,8 +634,8 @@ class rateitBackendModule extends \BackendModule
$cntSql = str_replace('%s', $where, $cntSql);
$count = $this->Database->prepare($cntSql)
->execute()
->fetchRow();
->execute()
->fetchRow();
$arrRatingItems = $this->Database->prepare($sql)
->execute()

View File

@ -312,9 +312,10 @@ function doRateIt() {
el.data('selected', el.find('.rateItRating-selected'));
el.data('hover', el.find('.rateItRating-hover'));
var backgroundImage = self.getBackgroundImage(el.data('wrapper'));
self.options.starwidth = backgroundImage.width;
self.options.starheight = backgroundImage.height / 3; // da immer drei Sterne "übereinander" gebraucht werden
jQuery.when(self.getBackgroundImage(el.data('wrapper'))).done(function(backgroundImageSize) {
self.options.starwidth = backgroundImageSize[0];
self.options.starheight = backgroundImageSize[1] / 3; // da immer drei Sterne "übereinander" gebraucht werden
});
if (self.options.starwidth === undefined || self.options.starwidth < 16) {
self.options.starwidth = 16;
}
@ -498,13 +499,21 @@ function doRateIt() {
},
getBackgroundImage: function(el) {
var dfd = jQuery.Deferred();
var backgroundImageSize = new Array();
var reg_imgFile = /url\s*\(["']?(.*)["']?\)/i;
var dummy = document.createElement('img');
var string = this.getBackgroundImagePath(el);
string = string.match(reg_imgFile)[1];
string = string.replace('\"', '');
dummy.src = string;
return dummy;
jQuery('<img/>')
.attr('src', string)
.load(function() {
backgroundImageSize.push(this.width);
backgroundImageSize.push(this.height);
dfd.resolve(backgroundImageSize);
});
return dfd.promise();
},
updateText: function(el, text) {

File diff suppressed because one or more lines are too long

View File

@ -133,8 +133,19 @@ class RateIt extends \Frontend {
->count();
// Die with an error if the insert fails (duplicate IP or duplicate member id for a vote).
if (((!$this->allowDuplicates && $countIp == 0) || $this->allowDuplicates) ||
((!$this->allowDuplicatesForMembers && (isset($countUser) ? $countUser == 0 : false)) || ($this->allowDuplicatesForMembers && isset($userId)))) {
if ((!$this->allowDuplicatesForMembers && (isset($countUser) ? $countUser == 0 : false)) || ($this->allowDuplicatesForMembers && isset($userId))) {
// Insert the data.
$arrSet = array('pid' => $ratableKeyId['id'],
'tstamp' => time(),
'ip_address' => $ip,
'memberid' => isset($userId) ? $userId : null,
'rating' => $rating,
'createdat'=> time()
);
$this->Database->prepare('INSERT INTO tl_rateit_ratings %s')
->set($arrSet)
->execute();
} elseif (!isset($countUser) && ((!$this->allowDuplicates && $countIp == 0) || $this->allowDuplicates)) {
// Insert the data.
$arrSet = array('pid' => $ratableKeyId['id'],
'tstamp' => time(),
@ -147,7 +158,7 @@ class RateIt extends \Frontend {
->set($arrSet)
->execute();
} else {
header(RETURN_AJAX_HEADER);
header(RETURN_AJAX_HEADER);
echo $GLOBALS['TL_LANG']['rateit']['error']['duplicate_vote'];
exit;
}