karma plugin update
This commit is contained in:
parent
21ff71abd2
commit
40116e3802
@ -3,6 +3,9 @@
|
|||||||
Version 1.6 ()
|
Version 1.6 ()
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
* Karma plugin: Added option to only track votings when users are
|
||||||
|
logged in.
|
||||||
|
|
||||||
* Bugfix: Adjust /admin permalink detection so that it does not listen
|
* Bugfix: Adjust /admin permalink detection so that it does not listen
|
||||||
on /adminbook for example. Thanks to Lux!
|
on /adminbook for example. Thanks to Lux!
|
||||||
|
|
||||||
|
@ -119,6 +119,9 @@ class Serendipity_Import_Serendipity extends Serendipity_Import {
|
|||||||
if (is_array($primary_keys)) {
|
if (is_array($primary_keys)) {
|
||||||
foreach($primary_keys AS $primary_key) {
|
foreach($primary_keys AS $primary_key) {
|
||||||
$primary_vals[$primary_key] = $row[$primary_key];
|
$primary_vals[$primary_key] = $row[$primary_key];
|
||||||
|
if ($table == 'comments') {
|
||||||
|
$primary_vals['entry_id'] = $row['entry_id'];
|
||||||
|
}
|
||||||
unset($row[$primary_key]);
|
unset($row[$primary_key]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -129,10 +132,13 @@ class Serendipity_Import_Serendipity extends Serendipity_Import {
|
|||||||
if (is_array($fix_relations)) {
|
if (is_array($fix_relations)) {
|
||||||
foreach($fix_relations AS $primary_key => $fix_relation) {
|
foreach($fix_relations AS $primary_key => $fix_relation) {
|
||||||
foreach($fix_relation AS $fix_relation_table => $fix_relation_primary_key) {
|
foreach($fix_relation AS $fix_relation_table => $fix_relation_primary_key) {
|
||||||
if (isset($primary_vals[$fix_relation_primary_key])) {
|
|
||||||
|
if ($table == 'comments' && $fix_relation_table == 'entries') {
|
||||||
|
$assoc_val = $primary_vals['entry_id'];
|
||||||
|
} elseif (isset($primary_vals[$fix_relation_primary_key])) {
|
||||||
$assoc_val = $primary_vals[$fix_relation_primary_key];
|
$assoc_val = $primary_vals[$fix_relation_primary_key];
|
||||||
} else {
|
} else {
|
||||||
$assoc_val = $row[$primary_key];
|
$assoc_val = $row[$primary_key];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->execute && empty($assoc_val)) {
|
if (!$this->execute && empty($assoc_val)) {
|
||||||
@ -185,6 +191,12 @@ class Serendipity_Import_Serendipity extends Serendipity_Import {
|
|||||||
$this->storage[$table][$primary_key][$primary_val] = $this->counter;
|
$this->storage[$table][$primary_key][$primary_val] = $this->counter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach($this->storage[$table] AS $primary_key => $primary_data) {
|
||||||
|
foreach($primary_data AS $primary_val => $replace_val) {
|
||||||
|
serendipity_set_config_var('import_s9y_' . $table . '_' . $primary_key . '_' . $primary_val, $replace_val, 99);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($this->debug && !$this->execute) {
|
if ($this->debug && !$this->execute) {
|
||||||
echo "Ignoring Duplicate.<br />\n";
|
echo "Ignoring Duplicate.<br />\n";
|
||||||
|
@ -116,3 +116,4 @@
|
|||||||
@define('PLUGIN_KARMA_INVALID_INPUT', 'Invalid input!');
|
@define('PLUGIN_KARMA_INVALID_INPUT', 'Invalid input!');
|
||||||
@define('PLUGIN_KARMA_DELETE_VOTES', 'Delete selected votes');
|
@define('PLUGIN_KARMA_DELETE_VOTES', 'Delete selected votes');
|
||||||
@define('PLUGIN_KARMA_APPROVE_VOTES', 'Approve selected votes');
|
@define('PLUGIN_KARMA_APPROVE_VOTES', 'Approve selected votes');
|
||||||
|
@define('PLUGIN_KARMA_ACTIVE_REGISTERED', 'Only logged-in authors can vote');
|
||||||
|
@ -43,7 +43,7 @@ class serendipity_event_karma extends serendipity_event
|
|||||||
$propbag->add('description', PLUGIN_KARMA_BLAHBLAH);
|
$propbag->add('description', PLUGIN_KARMA_BLAHBLAH);
|
||||||
$propbag->add('stackable', false);
|
$propbag->add('stackable', false);
|
||||||
$propbag->add('author', 'Garvin Hicking, Grischa Brockhaus, Gregor Völtz, Judebert');
|
$propbag->add('author', 'Garvin Hicking, Grischa Brockhaus, Gregor Völtz, Judebert');
|
||||||
$propbag->add('version', '2.4');
|
$propbag->add('version', '2.5');
|
||||||
$propbag->add('requirements', array(
|
$propbag->add('requirements', array(
|
||||||
'serendipity' => '0.8',
|
'serendipity' => '0.8',
|
||||||
'smarty' => '2.6.7',
|
'smarty' => '2.6.7',
|
||||||
@ -63,6 +63,7 @@ class serendipity_event_karma extends serendipity_event
|
|||||||
// Functionality options
|
// Functionality options
|
||||||
'options_tab',
|
'options_tab',
|
||||||
'karma_active',
|
'karma_active',
|
||||||
|
'karma_active_registered',
|
||||||
'extended_only',
|
'extended_only',
|
||||||
'max_karmatime',
|
'max_karmatime',
|
||||||
'max_votetime',
|
'max_votetime',
|
||||||
@ -173,6 +174,14 @@ class serendipity_event_karma extends serendipity_event
|
|||||||
$propbag->add('default', 'true');
|
$propbag->add('default', 'true');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Is karma voting allowed only for registered authors?
|
||||||
|
case 'karma_active_registered':
|
||||||
|
$propbag->add('type', 'boolean');
|
||||||
|
$propbag->add('name', PLUGIN_KARMA_ACTIVE_REGISTERED);
|
||||||
|
$propbag->add('description', '');
|
||||||
|
$propbag->add('default', 'false');
|
||||||
|
break;
|
||||||
|
|
||||||
// Min votes to display
|
// Min votes to display
|
||||||
case 'min_disp_votes':
|
case 'min_disp_votes':
|
||||||
$propbag->add('type', 'string');
|
$propbag->add('type', 'string');
|
||||||
@ -1039,6 +1048,10 @@ END_IMG_CSS;
|
|||||||
// Find out what the admin wants
|
// Find out what the admin wants
|
||||||
$track_clicks = serendipity_db_bool($this->get_config('visits_active', true));
|
$track_clicks = serendipity_db_bool($this->get_config('visits_active', true));
|
||||||
$track_karma = serendipity_db_bool($this->get_config('karma_active', true));
|
$track_karma = serendipity_db_bool($this->get_config('karma_active', true));
|
||||||
|
|
||||||
|
if (serendipity_db_bool($this->get_config('karma_active_registered', false))) {
|
||||||
|
if (!serendipity_userLoggedIn()) $track_karma = false;
|
||||||
|
}
|
||||||
$track_exits = serendipity_db_bool($this->get_config('exits_active', true));
|
$track_exits = serendipity_db_bool($this->get_config('exits_active', true));
|
||||||
|
|
||||||
// Get the limits
|
// Get the limits
|
||||||
|
Loading…
x
Reference in New Issue
Block a user