+### add_user_vote () ###########################################################
+#
+# Increase number of user votes (only in thread file)
+#
+# Params: $forum Path and filename of forum
+# $tpath Path to thread files
+# \%info Hash reference: 'thread', 'posting', 'percent'
+# Return: Status code (Bool)
+#
+# Todo:
+# * Lock files before modification
+#
+sub add_user_vote()
+{
+ my ($forum, $tpath, $info) = @_;
+ my ($tid, $mid, $percent) = ($info->{'thread'},
+ $info->{'posting'},
+ $info->{'percent'});
+
+ # Thread
+ my $tfile = $tpath . '/t' . $tid . '.xml';
+
+ my $parser = new XML::DOM::Parser;
+ my $xml = $parser->parsefile($tfile);
+
+ my $mnode = get_message_node($xml, $tid, $mid);
+ my $votes = $mnode->getAttribute('votingUser') + 1;
+ $mnode->setAttribute('votingUser', $votes);
+
+ return save_file($tfile, \$xml->toString);
+}
+
+### level_vote () ##############################################################
+#
+# Set 1st or 2nd level voting (only in thread file)
+#
+# Params: $forum Path and filename of forum
+# $tpath Path to thread files
+# \%info Hash reference: 'thread', 'posting', 'level', 'value'
+# Return: Status code (Bool)
+#
+# Todo:
+# * Lock files before modification
+#
+sub level_vote
+{
+ my ($forum, $tpath, $info´) = @_;
+ my ($tid, $mid, $level, $value) = ($info->{'thread'},
+ $info->{'posting'},
+ $info->{'level'},
+ $info->{'value'});
+
+ # Thread
+ my $tfile = $tpath . '/t' . $tid . '.xml';
+
+ my $parser = new XML::DOM::Parser;
+ my $xml = $parser->parsefile($tfile);
+
+ my $mnode = get_message_node($xml, $tid, $mid);
+
+ if ($value == undef)
+ {
+ removeAttribute($level);
+ }
+ else
+ {
+ $mnode->setAttribute($level, $value);
+ }
+
+ return save_file($tfile, \$xml->toString);
+}
+