Ejemplo n.º 1
0
function LoadVote()
{
    global $user_ID, $user_login;
    $postID = get_the_ID();
    $votes = GetVotes($postID);
    $barvotes = GetBarVotes($postID);
    if (function_exists('VoteItUp_options')) {
        ?>
<span class="barcontainer"><span class="barfill" id="votecount<?php 
        echo $postID;
        ?>
" style="width:<?php 
        echo round($barvotes[0] * 2.5);
        ?>
%;">&nbsp;</span></span>
<?php 
        if ($user_ID != '') {
            if (!($user_login == get_the_author_login() && !get_option('voteiu_allowownvote'))) {
                ?>
	<?php 
                if (!UserVoted($postID, $user_ID)) {
                    ?>
<span class="bartext" id="voteid<?php 
                    the_ID();
                    ?>
">
			<a href="javascript:vote('votecount<?php 
                    the_ID();
                    ?>
','voteid<?php 
                    the_ID();
                    ?>
','<?php 
                    echo get_option('voteiu_aftervotetext');
                    ?>
',<?php 
                    the_ID();
                    ?>
,<?php 
                    echo $user_ID;
                    ?>
,'<?php 
                    echo VoteItUp_ExtPath();
                    ?>
');"><?php 
                    echo get_option('voteiu_votetext');
                    ?>
</a><?php 
                    if (get_option('voteiu_sinktext') != '') {
                        ?>
<a href="javascript:sink('votecount<?php 
                        the_ID();
                        ?>
','voteid<?php 
                        the_ID();
                        ?>
','<?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
',<?php 
                        the_ID();
                        ?>
,<?php 
                        echo $user_ID;
                        ?>
,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');"><?php 
                        echo get_option('voteiu_sinktext');
                        ?>
</a><?php 
                    }
                    ?>

		</span>
	<?php 
                } else {
                    ?>
		<?php 
                    if (get_option('voteiu_aftervotetext') != '') {
                        ?>
<span class="bartext" id="voteid<?php 
                        the_ID();
                        ?>
"><?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
</span><?php 
                    }
                    ?>
	<?php 
                }
            } else {
                ?>
		<?php 
                if (get_option('voteiu_aftervotetext') != '') {
                    ?>
<span class="bartext" id="voteid<?php 
                    the_ID();
                    ?>
"><?php 
                    echo get_option('voteiu_aftervotetext');
                    ?>
</span><?php 
                }
            }
        } else {
            if (get_option('voteiu_allowguests') == 'true') {
                ?>
	<?php 
                if (!GuestVoted($postID, md5($_SERVER['REMOTE_ADDR']))) {
                    ?>
<span class="bartext" id="voteid<?php 
                    the_ID();
                    ?>
">
			<a href="javascript:vote('votecount<?php 
                    the_ID();
                    ?>
','voteid<?php 
                    the_ID();
                    ?>
','<?php 
                    echo get_option('voteiu_aftervotetext');
                    ?>
',<?php 
                    the_ID();
                    ?>
,0,'<?php 
                    echo VoteItUp_ExtPath();
                    ?>
');"><?php 
                    echo get_option('voteiu_votetext');
                    ?>
</a><?php 
                    if (get_option('voteiu_sinktext') != '') {
                        ?>
<a href="javascript:sink('votecount<?php 
                        the_ID();
                        ?>
','voteid<?php 
                        the_ID();
                        ?>
','<?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
',<?php 
                        the_ID();
                        ?>
,0,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');"><?php 
                        echo get_option('voteiu_sinktext');
                        ?>
</a><?php 
                    }
                    ?>

		</span>
	<?php 
                } else {
                    ?>
	<?php 
                    if (get_option('voteiu_aftervotetext') != '') {
                        ?>
<span class="bartext" id="voteid<?php 
                        the_ID();
                        ?>
"><?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
</span><?php 
                    }
                    ?>
	<?php 
                }
                ?>
	<?php 
            } else {
                /*Guest voting disabled*/
                ?>
	<span class="bartext" id="voteid<?php 
                the_ID();
                ?>
">
			<a href="javascript:regboxopen();"><?php 
                echo get_option('voteiu_votetext');
                ?>
</a><?php 
                if (get_option('voteiu_sinktext') != '') {
                    ?>
<a href="javascript:regboxopen();"><?php 
                    echo get_option('voteiu_sinktext');
                    ?>
</a><?php 
                }
                ?>
	</span>
<?php 
            }
        }
    }
}
Ejemplo n.º 2
0
function DisplayVotes($postID, $type = '')
{
    global $user_ID, $guest_votes, $vote_text, $use_votetext, $allow_sinks, $voteiu_skin;
    $postID = wp_kses($postID, array());
    // Sanitize, just in case
    $voteiu_skin = get_option('voteiu_skin');
    $votes = GetVotes($postID);
    $barvotes = GetBarVotes($postID);
    switch ($type) {
        case '':
            // In the event no theme selected, use the current theme
            if ($voteiu_skin == '') {
                return DisplayVotes($postID, 'bar');
            } else {
                if (!LoadSkin($voteiu_skin)) {
                    return DisplayVotes($postID, 'bar');
                }
            }
            break;
            // The following themes below are pre-defined themes in the event there are no other themes found
        // The following themes below are pre-defined themes in the event there are no other themes found
        case 'bar':
            ?>
<span class="barcontainer"><span class="barfill" id="votecount<?php 
            echo $postID;
            ?>
" style="width:<?php 
            echo round($barvotes[0] * 2.5);
            ?>
%;">&nbsp;</span></span><?php 
            if ($user_ID != '') {
                if (!($user_login == get_the_author_login() && !get_option('voteiu_allowownvote'))) {
                    ?>
<span><?php 
                    if (!UserVoted($postID, $user_ID)) {
                        ?>
<span class="bartext" id="voteid<?php 
                        the_ID();
                        ?>
">
						<a href="javascript:vote('votecount<?php 
                        the_ID();
                        ?>
','voteid<?php 
                        the_ID();
                        ?>
','<?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
',<?php 
                        the_ID();
                        ?>
,<?php 
                        echo $user_ID;
                        ?>
,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');"><?php 
                        echo get_option('voteiu_votetext');
                        ?>
</a><?php 
                        if (get_option('voteiu_sinktext') != '') {
                            ?>
<a href="javascript:sink('votecount<?php 
                            the_ID();
                            ?>
','voteid<?php 
                            the_ID();
                            ?>
','<?php 
                            echo get_option('voteiu_aftervotetext');
                            ?>
',<?php 
                            the_ID();
                            ?>
,<?php 
                            echo $user_ID;
                            ?>
,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');"><?php 
                            echo get_option('voteiu_sinktext');
                            ?>
</a><?php 
                        }
                        ?>
</span><?php 
                    } else {
                        if (get_option('voteiu_aftervotetext') != '') {
                            ?>
<span class="bartext" id="voteid<?php 
                            the_ID();
                            ?>
"><?php 
                            echo get_option('voteiu_aftervotetext');
                            ?>
</span><?php 
                        }
                    }
                    ?>
</span><?php 
                }
            } else {
                if (get_option('voteiu_allowguests') == 'true') {
                    ?>
<span><?php 
                    if (!GuestVoted($postID, md5($_SERVER['REMOTE_ADDR']))) {
                        ?>
<span class="bartext" id="voteid<?php 
                        the_ID();
                        ?>
">
						<a href="javascript:vote('votecount<?php 
                        the_ID();
                        ?>
','voteid<?php 
                        the_ID();
                        ?>
','<?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
',<?php 
                        the_ID();
                        ?>
,0,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');"><?php 
                        echo get_option('voteiu_votetext');
                        ?>
</a><?php 
                        if (get_option('voteiu_sinktext') != '') {
                            ?>
<a href="javascript:sink('votecount<?php 
                            the_ID();
                            ?>
','voteid<?php 
                            the_ID();
                            ?>
','<?php 
                            echo get_option('voteiu_aftervotetext');
                            ?>
',<?php 
                            the_ID();
                            ?>
,0,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');"><?php 
                            echo get_option('voteiu_sinktext');
                            ?>
</a><?php 
                        }
                        ?>
</span><?php 
                    }
                    ?>
</span><?php 
                }
            }
            break;
        case 'ticker':
            ?>
<span class="tickercontainer" id="votes<?php 
            the_ID();
            ?>
"><?php 
            echo $votes;
            ?>
</span><?php 
            if ($user_ID != '') {
                ?>
<span id="voteid<?php 
                the_ID();
                ?>
"><?php 
                if (!UserVoted($postID, $user_ID)) {
                    ?>
<span class="tickertext"><?php 
                    if ($use_votetext == 'true') {
                        ?>
<a class="votelink" href="javascript:vote_ticker(<?php 
                        echo $postID;
                        ?>
,<?php 
                        echo $postID;
                        ?>
,<?php 
                        echo $user_ID;
                        ?>
,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');"><?php 
                        echo $vote_text;
                        ?>
</a><?php 
                    } else {
                        ?>
<span class="imagecontainer"><?php 
                        if ($allow_sinks == 'true') {
                            ?>
<a href="javascript:sink_ticker(<?php 
                            echo $postID;
                            ?>
,<?php 
                            echo $postID;
                            ?>
,<?php 
                            echo $user_ID;
                            ?>
,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');">
							<img class="votedown" src="<?php 
                            echo VoteItUp_ExtPath();
                            ?>
/votedown.png" alt="Vote down" border="0" />
							</a><?php 
                        }
                        ?>
<a href="javascript:vote_ticker(<?php 
                        echo $postID;
                        ?>
,<?php 
                        echo $postID;
                        ?>
,<?php 
                        echo $user_ID;
                        ?>
,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');">
						<img class="voteup" src="<?php 
                        echo VoteItUp_ExtPath();
                        ?>
/voteup.png" alt="Vote up" border="0" />
						</a>
						</span><?php 
                    }
                    ?>
</span><?php 
                }
                ?>
</span><?php 
            } else {
                if ($guest_votes == 'true') {
                    ?>
<span id="voteid<?php 
                    the_ID();
                    ?>
"><?php 
                    if (!GuestVoted($postID, md5($_SERVER['REMOTE_ADDR']))) {
                        ?>
<span class="tickertext"><?php 
                        if ($use_votetext == 'true') {
                            ?>
<a class="votelink" href="javascript:vote_ticker(<?php 
                            echo $postID;
                            ?>
,<?php 
                            echo $postID;
                            ?>
,0,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');"><?php 
                            echo $vote_text;
                            ?>
</a></span><?php 
                        } else {
                            ?>
<span class="imagecontainer"><?php 
                            if ($allow_sinks == 'true') {
                                ?>
<a href="javascript:sink_ticker(<?php 
                                echo $postID;
                                ?>
,<?php 
                                echo $postID;
                                ?>
,0,'<?php 
                                echo VoteItUp_ExtPath();
                                ?>
');">
								<img class="votedown" src="<?php 
                                echo VoteItUp_ExtPath();
                                ?>
/votedown.png" alt="Vote down" border="0" />
								</a><?php 
                            }
                            ?>
<a href="javascript:vote_ticker(<?php 
                            echo $postID;
                            ?>
,<?php 
                            echo $postID;
                            ?>
,0,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');">
							<img class="voteup" src="<?php 
                            echo VoteItUp_ExtPath();
                            ?>
/voteup.png" alt="Vote up" border="0" />
							</a>
							</span><?php 
                        }
                        ?>
</span><?php 
                    }
                    ?>
</span><?php 
                }
            }
            break;
    }
}
Ejemplo n.º 3
0
function LoadVote()
{
    global $user_ID, $user_login;
    $postID = get_the_ID();
    $votes = GetVotes($postID, true);
    if (function_exists('VoteItUp_options')) {
        ?>
<span class="vote-it-up">
<span class="tickercontainer" id="votecount<?php 
        the_ID();
        ?>
"><?php 
        echo $votes == false ? "Vote" : $votes;
        ?>
</span>
<?php 
        if ($user_ID != '') {
            if (!($user_login == get_the_author_login() && !get_option('voteiu_allowownvote'))) {
                ?>
	<span>
	<?php 
                if (!UserVoted($postID, $user_ID)) {
                    ?>
<span class="tickertext">
			<span class="votelink" id="voteid<?php 
                    the_ID();
                    ?>
"><a href="javascript:vote('votecount<?php 
                    the_ID();
                    ?>
','voteid<?php 
                    the_ID();
                    ?>
','<?php 
                    echo get_option('voteiu_aftervotetext');
                    ?>
',<?php 
                    the_ID();
                    ?>
,<?php 
                    echo $user_ID;
                    ?>
,'<?php 
                    echo VoteItUp_ExtPath();
                    ?>
');" class="voteuplink"><?php 
                    echo get_option('voteiu_votetext');
                    ?>
</a><?php 
                    if (get_option('voteiu_sinktext') != '') {
                        ?>
<a href="javascript:sink('votecount<?php 
                        the_ID();
                        ?>
','voteid<?php 
                        the_ID();
                        ?>
','<?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
',<?php 
                        the_ID();
                        ?>
,<?php 
                        echo $user_ID;
                        ?>
,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');" class="votedownlink"><?php 
                        echo get_option('voteiu_sinktext');
                        ?>
</a></span>
			<?php 
                    }
                    ?>

		</span>
	<?php 
                } else {
                    ?>
	<?php 
                    if (get_option('voteiu_aftervotetext') != '') {
                        ?>
<span class="tickertext" id="voteid<?php 
                        the_ID();
                        ?>
"><span class="votelink"><?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
</span></span><?php 
                    }
                    ?>
	<?php 
                }
                ?>
	</span>
<?php 
            } else {
                ?>
	<?php 
                if (get_option('voteiu_aftervotetext') != '') {
                    ?>
<span class="tickertext" id="voteid<?php 
                    the_ID();
                    ?>
"><span class="votelink"><?php 
                    echo get_option('voteiu_aftervotetext');
                    ?>
</span></span><?php 
                }
            }
        } else {
            if (get_option('voteiu_allowguests') == 'true') {
                ?>
	<span id="voteid<?php 
                the_ID();
                ?>
">
	<?php 
                if (!GuestVoted($postID, md5($_SERVER['REMOTE_ADDR']))) {
                    ?>
<span class="tickertext">
			<span class="votelink" id="voteid<?php 
                    the_ID();
                    ?>
"><a href="javascript:vote('votecount<?php 
                    the_ID();
                    ?>
','voteid<?php 
                    the_ID();
                    ?>
','<?php 
                    echo get_option('voteiu_aftervotetext');
                    ?>
',<?php 
                    the_ID();
                    ?>
,0,'<?php 
                    echo VoteItUp_ExtPath();
                    ?>
');" class="voteuplink"><?php 
                    echo get_option('voteiu_votetext');
                    ?>
</a><?php 
                    if (get_option('voteiu_sinktext') != '') {
                        ?>
<a href="javascript:sink('votecount<?php 
                        the_ID();
                        ?>
','voteid<?php 
                        the_ID();
                        ?>
','<?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
',<?php 
                        the_ID();
                        ?>
,0,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');" class="votedownlink"><?php 
                        echo get_option('voteiu_sinktext');
                        ?>
</a></span><?php 
                    }
                    ?>
			</span>
	<?php 
                } else {
                    ?>
		<?php 
                    if (get_option('voteiu_aftervotetext') != '') {
                        ?>
<span class="tickertext" id="voteid<?php 
                        the_ID();
                        ?>
"><span class="votelink"><?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
</span></span><?php 
                    }
                    ?>
		<?php 
                }
            } else {
                /*Guest voting disabled*/
                ?>
<span class="tickertext">
			<span class="votelink" id="voteid<?php 
                the_ID();
                ?>
"><a href="javascript:regboxopen();"><?php 
                echo get_option('voteiu_votetext');
                ?>
</a><?php 
                if (get_option('voteiu_sinktext') != '') {
                    ?>
<a href="javascript:regboxopen();"><?php 
                    echo get_option('voteiu_sinktext');
                    ?>
</a></span><?php 
                }
                ?>


	</span>
</span>
<?php 
            }
            ?>
	<?php 
        }
    }
}
Ejemplo n.º 4
0
function DisplayVotes($postID, $type = '')
{
    global $user_ID, $guest_votes, $vote_text, $use_votetext, $allow_sinks, $voteiu_skin, $user_login;
    $voteiu_skin = get_option('voteiu_skin');
    $votes = GetVotes($postID);
    $barvotes = GetBarVotes($postID);
    switch ($type) {
        case '':
            if ($voteiu_skin == '') {
                DisplayVotes($postID, 'bar');
                //Use default bar
            } else {
                if (!LoadSkin($voteiu_skin)) {
                    DisplayVotes($postID, 'bar');
                    //Use default bar
                }
            }
            break;
        case 'bar':
            ?>
<span class="barcontainer"><span class="barfill" id="votecount<?php 
            echo $postID;
            ?>
" style="width:<?php 
            echo round($barvotes[0] * 2.5);
            ?>
%;">&nbsp;</span></span>
<?php 
            if ($user_ID != '') {
                if (!($user_login == get_the_author_meta('login') && !get_option('voteiu_allowownvote'))) {
                    ?>
	<span>
	<?php 
                    if (!UserVoted($postID, $user_ID)) {
                        ?>
<span class="bartext" id="voteid<?php 
                        the_ID();
                        ?>
">
			<a href="javascript:vote('votecount<?php 
                        the_ID();
                        ?>
','voteid<?php 
                        the_ID();
                        ?>
','<?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
',<?php 
                        the_ID();
                        ?>
,<?php 
                        echo $user_ID;
                        ?>
,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');"><?php 
                        echo get_option('voteiu_votetext');
                        ?>
</a><?php 
                        if (get_option('voteiu_sinktext') != '') {
                            ?>
<a href="javascript:sink('votecount<?php 
                            the_ID();
                            ?>
','voteid<?php 
                            the_ID();
                            ?>
','<?php 
                            echo get_option('voteiu_aftervotetext');
                            ?>
',<?php 
                            the_ID();
                            ?>
,<?php 
                            echo $user_ID;
                            ?>
,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');"><?php 
                            echo get_option('voteiu_sinktext');
                            ?>
</a>
			<?php 
                        }
                        ?>

		</span>
	<?php 
                    } else {
                        ?>
	<?php 
                        if (get_option('voteiu_aftervotetext') != '') {
                            ?>
<span class="bartext" id="voteid<?php 
                            the_ID();
                            ?>
"><?php 
                            echo get_option('voteiu_aftervotetext');
                            ?>
</span><?php 
                        }
                        ?>
	<?php 
                    }
                    ?>
	</span>
<?php 
                }
            } else {
                if (get_option('voteiu_allowguests') == 'true') {
                    ?>
	<span>
	<?php 
                    if (!GuestVoted($postID, md5($_SERVER['REMOTE_ADDR']))) {
                        ?>
<span class="bartext" id="voteid<?php 
                        the_ID();
                        ?>
">
			<a href="javascript:vote('votecount<?php 
                        the_ID();
                        ?>
','voteid<?php 
                        the_ID();
                        ?>
','<?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
',<?php 
                        the_ID();
                        ?>
,0,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');"><?php 
                        echo get_option('voteiu_votetext');
                        ?>
</a><?php 
                        if (get_option('voteiu_sinktext') != '') {
                            ?>
<a href="javascript:sink('votecount<?php 
                            the_ID();
                            ?>
','voteid<?php 
                            the_ID();
                            ?>
','<?php 
                            echo get_option('voteiu_aftervotetext');
                            ?>
',<?php 
                            the_ID();
                            ?>
,0,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');"><?php 
                            echo get_option('voteiu_sinktext');
                            ?>
</a>
			<?php 
                        }
                        ?>

		</span>
	<?php 
                    }
                    ?>
	</span>
	<?php 
                }
            }
            break;
        case 'ticker':
            ?>
<span class="tickercontainer" id="votes<?php 
            the_ID();
            ?>
"><?php 
            echo $votes;
            ?>
</span>
<?php 
            if ($user_ID != '') {
                ?>
<span id="voteid<?php 
                the_ID();
                ?>
">
	<?php 
                if (!UserVoted($postID, $user_ID)) {
                    ?>
<span class="tickertext">
		<?php 
                    if ($use_votetext == 'true') {
                        ?>
		<a class="votelink" href="javascript:vote_ticker(<?php 
                        echo $postID;
                        ?>
,<?php 
                        echo $postID;
                        ?>
,<?php 
                        echo $user_ID;
                        ?>
,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');"><?php 
                        echo $vote_text;
                        ?>
</a>
		<?php 
                    } else {
                        ?>
			<span class="imagecontainer">
			<?php 
                        if ($allow_sinks == 'true') {
                            ?>
			<a href="javascript:sink_ticker(<?php 
                            echo $postID;
                            ?>
,<?php 
                            echo $postID;
                            ?>
,<?php 
                            echo $user_ID;
                            ?>
,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');">
			<img class="votedown" src="<?php 
                            echo VoteItUp_ExtPath();
                            ?>
/votedown.png" alt="Vote down" border="0" />
			</a>
			<?php 
                        }
                        ?>
			<a href="javascript:vote_ticker(<?php 
                        echo $postID;
                        ?>
,<?php 
                        echo $postID;
                        ?>
,<?php 
                        echo $user_ID;
                        ?>
,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');">
			<img class="voteup" src="<?php 
                        echo VoteItUp_ExtPath();
                        ?>
/voteup.png" alt="Vote up" border="0" />
			</a>
			</span>
		<?php 
                    }
                    ?>
		</span>
	<?php 
                }
                ?>
</span>
<?php 
            } else {
                if ($guest_votes == 'true') {
                    ?>
	<span id="voteid<?php 
                    the_ID();
                    ?>
">
	<?php 
                    if (!GuestVoted($postID, md5($_SERVER['REMOTE_ADDR']))) {
                        ?>
		<span class="tickertext">
		<?php 
                        if ($use_votetext == 'true') {
                            ?>
			<a class="votelink" href="javascript:vote_ticker(<?php 
                            echo $postID;
                            ?>
,<?php 
                            echo $postID;
                            ?>
,0,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');"><?php 
                            echo $vote_text;
                            ?>
</a></span>
		<?php 
                        } else {
                            ?>
			<span class="imagecontainer">
			<?php 
                            if ($allow_sinks == 'true') {
                                ?>
			<a href="javascript:sink_ticker(<?php 
                                echo $postID;
                                ?>
,<?php 
                                echo $postID;
                                ?>
,0,'<?php 
                                echo VoteItUp_ExtPath();
                                ?>
');">
			<img class="votedown" src="<?php 
                                echo VoteItUp_ExtPath();
                                ?>
/votedown.png" alt="Vote down" border="0" />
			</a>
			<?php 
                            }
                            ?>
			<a href="javascript:vote_ticker(<?php 
                            echo $postID;
                            ?>
,<?php 
                            echo $postID;
                            ?>
,0,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');">
			<img class="voteup" src="<?php 
                            echo VoteItUp_ExtPath();
                            ?>
/voteup.png" alt="Vote up" border="0" />
			</a>
			</span>
		<?php 
                        }
                        ?>
		</span>
	<?php 
                    }
                    ?>
</span>

<?php 
                }
            }
            break;
    }
}
Ejemplo n.º 5
0
function GuestVote($post_ID, $type)
{
    global $wpdb;
    //Guest's vote is stored permanently. May implement votes that will expire.
    //Use user IP
    $iphash = md5($_SERVER['REMOTE_ADDR']);
    //Set a cookie if there isn't any. This is to reduce the problem of users using proxies and voting multiple times on the same stories.
    /*
    	if(isset($_COOKIE['tevinevotes'])) {
    		$iphash = $_COOKIE['tevinevotes']; 
    	} else {
    		$cookielife = 14 * 60 * 24 * 60 + time(); //Set to expire in a year from now
    		setcookie('tevinevotes', $iphash, $cookielife);
    	}
    */
    //Prevents SQL injection
    $u_ID = $wpdb->escape($iphash);
    $p_ID = $wpdb->escape($post_ID);
    //Create entries if not existant
    SetPost($p_ID);
    //Gets the info
    $votes_raw = $wpdb->get_var("SELECT guests FROM " . $wpdb->prefix . "votes WHERE post='" . $p_ID . "'");
    $sinks_raw = $wpdb->get_var("SELECT guestsinks FROM " . $wpdb->prefix . "votes WHERE post='" . $p_ID . "'");
    //Gets the votes in array form
    $votes = explode(",", $votes_raw);
    $sinks = explode(",", $sinks_raw);
    //Check if user voted
    if (!GuestVoted($post_ID, $user_ID)) {
        //user hasn't vote, so the script allows the user to vote
        if ($type != 'sink') {
            //Add vote to array
            $user_var[0] = $u_ID;
            $post_var[0] = $p_ID;
            $votes_result = array_merge($votes, $user_var);
            $votes_result_raw = implode(",", $votes_result);
            $sinks_result_raw = $sinks_raw;
        } else {
            //Add sink to array
            $user_var[0] = $u_ID;
            $post_var[0] = $p_ID;
            $sinks_result = array_merge($sinks, $user_var);
            $sinks_result_raw = implode(",", $sinks_result);
            $votes_result_raw = $votes_raw;
        }
        //Prevents SQL injection
        $votes_result_sql = $wpdb->escape($votes_result_raw);
        $sinks_result_sql = $wpdb->escape($sinks_result_raw);
        //Update votes
        $wpdb->query("UPDATE " . $wpdb->prefix . "votes SET guests='" . $votes_result_sql . "' WHERE post='" . $p_ID . "'");
        $wpdb->query("UPDATE " . $wpdb->prefix . "votes SET guestsinks='" . $sinks_result_sql . "' WHERE post='" . $p_ID . "'");
        $result = 'true';
    } else {
        //The user voted, thus the script will not update the votes in the article
        $result = 'false';
    }
    return $result;
    //returns '' on failure, returns 'true' if votes were casted, returns 'false' if user already casted a vote
}
Ejemplo n.º 6
0
function LoadVote()
{
    global $user_ID, $user_login;
    $postID = get_the_ID();
    $votes = GetVotes($postID);
    if (function_exists('VoteItUp_options')) {
        if ($user_ID != '') {
            if (!($user_login == get_the_author_login() && !get_option('voteiu_allowownvote'))) {
                /* Post author can vote own post */
                if (!UserVoted($postID, $user_ID)) {
                    /* User has not voted */
                    ?>
				<div class="post_postvote"><div class="post_votewidget" id="votewidget<?php 
                    the_ID();
                    ?>
">
					<div class="post_votecount" id="votecount<?php 
                    the_ID();
                    ?>
"><?php 
                    echo $votes;
                    ?>
</div>
				<div class="post_votebuttoncontainer"><span class="post_votebutton" id="voteid<?php 
                    the_ID();
                    ?>
"><a href="javascript:vote('votecount<?php 
                    the_ID();
                    ?>
','voteid<?php 
                    the_ID();
                    ?>
','<?php 
                    echo get_option('voteiu_aftervotetext');
                    ?>
',<?php 
                    the_ID();
                    ?>
,<?php 
                    echo $user_ID;
                    ?>
,'<?php 
                    echo VoteItUp_ExtPath();
                    ?>
');"><?php 
                    echo get_option('voteiu_votetext');
                    ?>
</a><?php 
                    if (get_option('voteiu_sinktext') != '') {
                        ?>
<a href="javascript:sink('votecount<?php 
                        the_ID();
                        ?>
','voteid<?php 
                        the_ID();
                        ?>
','<?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
',<?php 
                        the_ID();
                        ?>
,<?php 
                        echo $user_ID;
                        ?>
,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');"><?php 
                        echo get_option('voteiu_sinktext');
                        ?>
</a><?php 
                    }
                    ?>
					</span></div>
				</div></div>
			<?php 
                } else {
                    /* User has voted */
                    if (get_option('voteiu_aftervotetext') != '') {
                        /* After-vote text was set */
                        ?>
					<div class="post_postvote"><div class="post_votewidget" id="votewidget<?php 
                        the_ID();
                        ?>
">
						<div class="post_votecount" id="votecount<?php 
                        the_ID();
                        ?>
"><?php 
                        echo $votes;
                        ?>
</div>
					<div id="voteid<?php 
                        the_ID();
                        ?>
" class="post_votebuttoncontainer"><span class="post_votebutton"><?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
</span></div>
					</div></div>
				<?php 
                    } else {
                        /* After-vote text not set */
                        ?>
					<div class="post_postvote"><div class="post_votewidget_closed" id="votewidget<?php 
                        the_ID();
                        ?>
">
						<div class="post_votecount" id="votecount<?php 
                        the_ID();
                        ?>
"><?php 
                        echo $votes;
                        ?>
</div>
					</div></div>
					<?php 
                    }
                }
            } else {
                /* Post author cannot vote own post */
                if (get_option('voteiu_aftervotetext') != '') {
                    /* After-vote text was set */
                    ?>
				<div class="post_postvote"><div class="post_votewidget" id="votewidget<?php 
                    the_ID();
                    ?>
">
					<div class="post_votecount" id="votecount<?php 
                    the_ID();
                    ?>
"><?php 
                    echo $votes;
                    ?>
</div>
				<div class="post_votebuttoncontainer"><span class="post_votebutton" id="voteid<?php 
                    the_ID();
                    ?>
"><?php 
                    echo get_option('voteiu_aftervotetext');
                    ?>
</span></div>
				</div></div>
				<?php 
                } else {
                    /* After-vote text not set */
                    ?>
				<div class="post_postvote"><div class="post_votewidget_closed" id="votewidget<?php 
                    the_ID();
                    ?>
">
					<div class="post_votecount" id="votecount<?php 
                    the_ID();
                    ?>
"><?php 
                    echo $votes;
                    ?>
</div>
				</div></div>
				<?php 
                }
            }
        } else {
            /* Guest is attempting to vote */
            if (get_option('voteiu_allowguests') == 'true') {
                /* Guest voting allowed */
                if (!GuestVoted($postID, md5($_SERVER['REMOTE_ADDR']))) {
                    /* Guest has not voted */
                    ?>
				<div class="post_postvote"><div class="post_votewidget" id="votewidget<?php 
                    the_ID();
                    ?>
">
					<div class="post_votecount" id="votecount<?php 
                    the_ID();
                    ?>
"><?php 
                    echo $votes;
                    ?>
</div>
					<div class="post_votebuttoncontainer">
							<span class="post_votebutton" id="voteid<?php 
                    the_ID();
                    ?>
"><a href="javascript:vote('votecount<?php 
                    the_ID();
                    ?>
','voteid<?php 
                    the_ID();
                    ?>
','<?php 
                    echo get_option('voteiu_aftervotetext');
                    ?>
',<?php 
                    the_ID();
                    ?>
,0,'<?php 
                    echo VoteItUp_ExtPath();
                    ?>
');"><?php 
                    echo get_option('voteiu_votetext');
                    ?>
</a><?php 
                    if (get_option('voteiu_sinktext') != '') {
                        ?>
<a href="javascript:sink('votecount<?php 
                        the_ID();
                        ?>
','voteid<?php 
                        the_ID();
                        ?>
','<?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
',<?php 
                        the_ID();
                        ?>
,0,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');"><?php 
                        echo get_option('voteiu_sinktext');
                        ?>
</a><?php 
                    }
                    ?>
							</span>
					</div></div></div>
					<?php 
                } else {
                    /* Guest has voted */
                    if (get_option('voteiu_aftervotetext') != '') {
                        /* After vote text was set */
                        ?>
<div class="post_postvote"><div class="post_votewidget" id="votewidget<?php 
                        the_ID();
                        ?>
">
					<div class="post_votecount" id="votecount<?php 
                        the_ID();
                        ?>
"><?php 
                        echo $votes;
                        ?>
</div>
					<div class="post_votebuttoncontainer">
					<span class="post_votebutton" id="voteid<?php 
                        the_ID();
                        ?>
"><?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
</span>
					</div></div></div>
				<?php 
                    } else {
                        /* After vote text was not set */
                        ?>
					<div class="post_postvote"><div class="post_votewidget_closed" id="votewidget<?php 
                        the_ID();
                        ?>
">
						<div class="post_votecount" id="votecount<?php 
                        the_ID();
                        ?>
"><?php 
                        echo $votes;
                        ?>
</div>
					</div></div>
					<?php 
                    }
                }
            } else {
                /* Guest voting disabled */
                ?>
				<div class="post_postvote"><div class="post_votewidget" id="votewidget<?php 
                the_ID();
                ?>
">
					<div class="post_votecount" id="votecount<?php 
                the_ID();
                ?>
"><?php 
                echo $votes;
                ?>
</div>
					<div class="post_votebuttoncontainer">
							<span class="post_votebutton" id="voteid<?php 
                the_ID();
                ?>
"><a href="javascript:regboxopen();"><?php 
                echo get_option('voteiu_votetext');
                ?>
</a><?php 
                if (get_option('voteiu_sinktext') != '') {
                    ?>
<a href="javascript:regboxopen();"><?php 
                    echo get_option('voteiu_sinktext');
                    ?>
</a><?php 
                }
                ?>
							</span>
					</div></div></div>
				
				
					<?php 
            }
        }
    }
}