Пример #1
0
<?php

if (get_theme_option('use_evaluation') && consulta_get_number_alternatives() > 0) {
    $postId = get_the_ID();
    $evaluationOptions = get_theme_option('evaluation_labels');
    $userVote = str_replace('_label_', 'label_', get_user_vote($postId));
    $votes = get_votes($postId);
    $evaluation_type = get_theme_option('evaluation_type');
    ?>

    <div class="evaluation clearfix">
        <?php 
    if (is_single()) {
        ?>
            <h3 class="subtitulo"><?php 
        _e('Avaliação', 'consulta');
        ?>
</h3>
        <?php 
    }
    ?>

        <p><?php 
    echo get_theme_option('evaluation_text');
    ?>
</p>

        <?php 
    if (get_theme_option('evaluation_public_results') || current_user_can('manage_options')) {
        ?>
            <?php 
/**
 * Return layout optimized for sidebar at main web page, with the best items voted with a limit
 *
 * @param int $num number of items
 */
function echo_best_rated($num = 5)
{
    if (osc_get_preference('item_voting', 'voting') == 1) {
        $filter = array('order' => 'desc', 'num_items' => $num);
        $results = get_votes($filter);
        if (count($results) > 0) {
            $locale = osc_current_user_locale();
            require 'set_results.php';
        }
    }
}
Пример #3
0
												<span class="masalah-box"><?php 
    echo $post->post_content;
    ?>
</span>
											</p>
											<ul class="meta-box">
												<li><span class="meta-text priority <?php 
    echo hackgov_get_priority($post->ID);
    ?>
"></span></li>
												<li><span class="icon-<?php 
    echo hackgov_get_category($post->ID);
    ?>
"></span></li>
												<?php 
    get_votes($post->ID);
    ?>
												<!-- <li><span class="icon-thumb-up"></span><span class="vote-text">15</span></li>
												<li><span class="icon-thumb-down"></span><span class="vote-text">3</span></li> -->
												<li class="pull-right"><span class="shared-text"><?php 
    echo get_share_count($post->ID);
    ?>
 Shared</span></li>
											</ul>
										</div>
									</div>
								</div>
							</div>
							<!-- report item -->
							<?php 
}
Пример #4
0
$now_f = round(microtime(true), 2);
if (!($time_f = floatval($_REQUEST['time'])) > 0 || $now - $time_f > 1200) {
    $time_f = $now - 1200;
}
$time = intval($time_f);
$dbtime = date("YmdHis", intval($time));
$last_timestamp = $time_f;
if (!empty($_REQUEST['items']) && intval($_REQUEST['items']) > 0) {
    $max_items = intval($_REQUEST['items']);
}
if ($max_items < 1 || $max_items > 100) {
    $max_items = 100;
    // Avoid abuse
}
if (empty($_REQUEST['novote']) || empty($_REQUEST['noproblem'])) {
    get_votes($dbtime);
}
// Get the logs
if ($current_user->admin) {
    $site_filter = '';
} else {
    $site_filter = 'and log_sub = ' . SitesMgr::my_parent();
}
$logs = $db->get_results("select UNIX_TIMESTAMP(log_date) as time, log_type, log_ref_id, log_user_id from logs where log_type != 'login_failed' and log_date > {$dbtime} {$site_filter} order by log_date desc limit {$max_items}");
if ($logs) {
    foreach ($logs as $log) {
        if ($current_user->user_id > 0) {
            if (!empty($_REQUEST['friends']) && $log->log_user_id != $current_user->user_id) {
                // Check the user is a friend
                if (User::friend_exists($current_user->user_id, $log->log_user_id) <= 0) {
                    continue;
Пример #5
0
									<li>
										<div class="row">
											<div class="img-box col-md-4">
												<?php 
            echo get_the_post_thumbnail($popular->ID, 'medium');
            ?>
											</div>
											<div class="list-content col-md-8">
												<a href=""><?php 
            echo get_the_title($popular->ID);
            ?>
</a>
												<ul class="meta-box">
													<li><span class="icon-traffic"></span></li>
													<?php 
            get_votes($popular->ID);
            ?>
													<li class="pull-right"><span class="shared-text"><?php 
            echo get_share_count($popular->ID);
            ?>
 Shared</span></li>
												</ul>
											</div>
										</div>
									</li>
									<?php 
        }
    }
    ?>
								</ul>
							</div>
Пример #6
0
} else {
    $dbtime = date("YmdHis", $time);
}
$last_timestamp = $time;
if (!empty($_GET['items']) && intval($_GET['items']) > 0) {
    $max_items = intval($_GET['items']);
} else {
    $max_items = 10;
}
header('Content-Type: text/html; charset=utf-8');
$client_version = $_GET['v'];
if (empty($client_version) || $client_version != -1 && $client_version != $sneak_version) {
    echo "window.location.reload(true);";
    exit;
}
get_votes($dbtime, $link_id);
get_comment($dbtime, $link_id);
if ($last_timestamp == 0) {
    $last_timestamp = $now;
}
echo "ts={$last_timestamp};\n";
if (count($events) < 1) {
    exit;
}
echo "link_votes=" . ($linkdb->link_votes + $linkdb->link_anonymous) . ";link_negatives=" . $linkdb->link_negatives . ";link_karma=" . intval($linkdb->link_karma) . ";\n";
krsort($events);
$counter = 0;
echo "new_data = ([";
foreach ($events as $key => $val) {
    if ($counter > 0) {
        echo ",";
Пример #7
0
                $sel = "";
            }
            $list .= <<<HTML
<div class="pollanswer"><input id="vote{$row['id']}{$v}" name="dle_poll_votes" type="radio" {$sel} value="{$v}" /><label for="vote{$row['id']}{$v}"> {$body[$v]}</label></div>
HTML;
        }
    } else {
        for ($v = 0; $v < sizeof($body); $v++) {
            $list .= <<<HTML
<div class="pollanswer"><input id="vote{$row['id']}{$v}" name="dle_poll_votes[]" type="checkbox" value="{$v}" /><label for="vote{$row['id']}{$v}">  {$body[$v]}</label></div>
HTML;
        }
    }
    $allcount = 0;
} else {
    $answer = get_votes($poll['answer']);
    $allcount = $poll['votes'];
    $pn = 0;
    for ($v = 0; $v < sizeof($body); $v++) {
        $num = $answer[$v];
        ++$pn;
        if ($pn > 5) {
            $pn = 1;
        }
        if (!$num) {
            $num = 0;
        }
        if ($allcount != 0) {
            $proc = 100 * $num / $allcount;
        } else {
            $proc = 0;
Пример #8
0
$last_timestamp = 0;
// always check groups (to hide private groups)
$from = " LEFT JOIN " . table_groups . " ON " . table_links . ".link_group_id = " . table_groups . ".group_id ";
$groups = $db->get_results("SELECT * FROM " . table_group_member . " WHERE member_user_id = {$current_user->user_id} and member_status = 'active'");
if ($groups) {
    $group_ids = array();
    foreach ($groups as $group) {
        $group_ids[] = $group->member_group_id;
    }
    $group_list = join(",", $group_ids);
    $where = " AND (" . table_groups . ".group_privacy!='private' OR ISNULL(" . table_groups . ".group_privacy) OR " . table_groups . ".group_id IN({$group_list})) ";
} else {
    $group_list = '';
    $where = " AND (" . table_groups . ".group_privacy!='private' OR ISNULL(" . table_groups . ".group_privacy))";
}
get_votes($time);
get_new_stories($time);
get_new_published($time);
get_comments($time);
if ($last_timestamp == 0) {
    $last_timestamp = time();
}
echo "timestamp={$last_timestamp};\n";
if (count($events) < 1) {
    exit;
}
ksort($events);
$keys = array_reverse(array_keys($events));
$lines = min(count($keys), $max_items);
$counter = 0;
echo "new_items={$lines};\n";
Пример #9
0
}
$votes = "";
if ($_REQUEST['action'] == "vote") {
    $votes = votes($poll['answer'], $answers);
    $db->query("UPDATE  " . PREFIX . "_poll set answer='{$votes}', votes=votes+" . count($answers) . " WHERE news_id = '{$news_id}'");
    $db->query("INSERT INTO " . PREFIX . "_poll_log (news_id, member) VALUES('{$news_id}', '{$log_id}')");
    $_REQUEST['action'] = "results";
}
if ($_REQUEST['action'] == "results") {
    if ($votes == "") {
        $votes = $poll['answer'];
        $allcount = $poll['votes'];
    } else {
        $allcount = count($answers) + $poll['votes'];
    }
    $answer = get_votes($votes);
    $body = explode("<br />", stripslashes($poll['body']));
    $pn = 0;
    for ($i = 0; $i < sizeof($body); $i++) {
        $num = $answer[$i];
        if (!$num) {
            $num = 0;
        }
        ++$pn;
        if ($pn > 5) {
            $pn = 1;
        }
        if ($allcount != 0) {
            $proc = 100 * $num / $allcount;
        } else {
            $proc = 0;
Пример #10
0
if (empty($client_version) || $client_version != $sneak_version) {
	echo "window.location.reload(true);";
	exit();
}
$now = time();

$last_timestamp = $time;

if (empty($_GET['nochat'])) {
	check_chat();
	get_chat($time);
}

if($_GET['r'] % 5 == 0) update_sneakers();

if (empty($_GET['novote']) || empty($_GET['noproblem'])) get_votes($time);
if (empty($_GET['nonew'])) get_new_stories($time);
if (empty($_GET['nopublished'])) get_new_published($time);
if (empty($_GET['nocomment'])) get_comments($time);

if($last_timestamp == 0) $last_timestamp = $now;

$ccnt = $db->get_var("select count(*) from sneakers");
echo "ts=$last_timestamp;ccnt=$ccnt;\n";
if(count($events) < 1) exit;
ksort($events);
$keys = array_reverse(array_keys($events));
$lines = min(count($keys), $max_items);

$counter=0;
echo "new_data = ([";
Пример #11
0
													<span class="masalah-box"><?php 
        echo $laporan->post_content;
        ?>
</span>
												</p>
												<ul class="meta-box">
													<li><span class="meta-text priority <?php 
        echo hackgov_get_priority($laporan->ID);
        ?>
"></span></li>
													<li><span class="icon-<?php 
        echo hackgov_get_category($laporan->ID);
        ?>
"></span></li>
													<?php 
        get_votes($laporan->ID);
        ?>
													<!-- <li><span class="icon-thumb-up"></span><span class="vote-text">15</span></li>
													<li><span class="icon-thumb-down"></span><span class="vote-text">3</span></li> -->
													<li class="pull-right"><span class="shared-text"><?php 
        echo get_share_count($laporan->ID);
        ?>
 Shared</span></li>
												</ul>
											</div>
										</div>
									</div>
								</a>
							</div>
							
							<?php 
Пример #12
0
		<?php 
    if (count($users) > 0) {
        ?>
			<table border="1">
			<tr>
			<th></th>
			<?php 
        for ($i = 0; $i < count($schedules); $i++) {
            $schedules[$i]["count"] = 0;
            echo "<td>" . date("n/j/Y g:i A", strtotime($schedules[$i]["range_start"])) . "-" . (date("n/j/Y", strtotime($schedules[$i]["range_start"])) == date("n/j/Y", strtotime($schedules[$i]["range_end"])) ? date("g:i A", strtotime($schedules[$i]["range_end"])) : date("n/j/Y g:i A", strtotime($schedules[$i]["range_end"]))) . "</td>";
        }
        ?>
			</tr>
			<?php 
        foreach ($users as $u) {
            $votes = get_votes($u["id"]);
            echo "<tr>";
            if ($u["account"] != 0) {
                $a = get_account_info($u["account"]);
                echo "<td>" . $a["first_name"] . " " . $a["last_name"] . "</td>";
            } else {
                echo "<td>" . $u["name"] . "</td>";
            }
            for ($i = 0; $i < count($schedules); $i++) {
                if ($votes[$schedules[$i]["id"]] == "2") {
                    $schedules[$i]["count"]++;
                    echo "<td style=\"background-color: SpringGreen\">Preferred</td>";
                } else {
                    if ($votes[$schedules[$i]["id"]] == "1") {
                        $schedules[$i]["count"]++;
                        echo "<td style=\"background-color: LightGreen\">Available</td>";
function showratings($rtype, $id, $dummy1 = "3rd/4th/5th parameters are needed in oldstyle rating sys", $dummy2 = 0, $dummy3 = 0)
{
    global $show5, $showPerc, $showVotes, $static, $user, $userdata, $locale, $settings;
    if ($settings['ratings_enabled'] == "1" && $rtype != "F" || $settings['forum_ratings'] == "1" && $rtype == "F") {
        $show5 = false;
        $showPerc = false;
        $showVotes = false;
        $static = NULL;
        $boardrate = $rtype == "F" ? true : false;
        add_to_head("<link href='" . INCLUDES_RATING . "css/rating_style.css' rel='stylesheet' type='text/css' media='all' />");
        add_to_head("<script type='text/javascript' src='" . INCLUDES_RATING . "js/rating_update.js'></script>");
        if (!$boardrate) {
            opentable($locale['r100']);
        }
        // Check if they have already voted...
        $text = '';
        if (iMEMBER) {
            $user = $userdata['user_id'];
        } else {
            $user = "******";
        }
        $sel = dbquery("SELECT rating_item_id FROM " . DB_RATINGS . "\r\n\t\t\tWHERE rating_ip=" . _db(USER_IP) . " AND rating_item_id='" . (int) $id . "' AND rating_type=" . _db($rtype));
        $rating = get_rating($id, $rtype);
        $rating_perc = round($rating * 20, 2) . "%";
        $rating_average = round($rating, 2);
        if (dbrows($sel) != 0 || $static == 'novote' || !iMEMBER) {
            echo "<table class='tbl2' cellspacing='0' border='0' width='100%' style='margin: 0.7em 0em 0.7em 0em;'>\n";
            echo "<tr><td width='50%' align='right' valign='middle'>\n";
            echo '<div class="rated_text">';
            echo '<strong>' . $locale['r130'] . '</strong>';
            echo ' (' . $locale['r131'] . ' <span id="showvotes_' . $id . '" class="votesClass">' . get_votes($id, $rtype) . '</span>)';
            echo '<span>&nbsp;&nbsp;</span></div>';
            echo "</td><td width='50%' align='left'>\n";
            echo '<ul class="star-rating2" id="rater_' . $id . '">';
            echo '<li class="current-rating" style="width:' . $rating_perc . ';" id="ul_' . $id . '"></li>';
            echo "<li><a onclick='return true;' href='#' title='" . $locale['r136'] . "' class='one-star' >1</a></li>";
            echo "<li><a onclick='return true;' href='#' title='" . $locale['r137'] . "' class='two-stars'>2</a></li>";
            echo "<li><a onclick='return true;' href='#' title='" . $locale['r138'] . "' class='three-stars'>3</a></li>";
            echo "<li><a onclick='return true;' href='#' title='" . $locale['r139'] . "' class='four-stars'>4</a></li>";
            echo "<li><a onclick='return true;' href='#' title='" . $locale['r140'] . "' class='five-stars'>5</a></li>";
            echo "</ul>";
            echo "</td></tr>\n";
            echo "</table>\n";
            echo "<div align='center' id='loading_" . $id . "'></div>";
            if (!$boardrate) {
                echo "<table cellpadding='0' width='100%' cellspacing='1' class='tbl2 center'>\n";
                echo "\t<tr>\n";
                echo "\t\t<td class='tbl2'><center><strong>" . $locale['r150'] . "</strong>" . $rating_average . " " . $locale['r151'] . "</center></td>\n";
                echo "\t</tr>\n";
                echo "</table>\n";
            }
        } else {
            echo "<table class='tbl2' cellspacing='0' border='0' width='100%' style='margin: 0.7em 0em 0.7em 0em;'>\n";
            echo "<tr><td width='50%' align='right'>\n";
            echo '<div class="rated_text">';
            $show5bool = 'false';
            $showPercbool = 'false';
            $showVotesbool = 'false';
            echo '<strong>' . $locale['r130'] . '</strong><span>&nbsp;&nbsp;</span>';
            echo '</div>';
            echo "</td><td width='50%' align='left'>\n";
            echo '<ul class="star-rating" id="rater_' . $id . '">';
            echo '<li class="current-rating" style="width:' . $rating_perc . ';" id="ul_' . $id . '"></li>';
            $base = INCLUDES . 'ratings/';
            echo '<li><a onclick="rate(\'1\',\'' . $id . '\',' . $show5bool . ',' . $showPercbool . ',' . $showVotesbool . ',\'' . $rtype . '\', \'' . $base . '\'); return false;" href="' . INCLUDES . 'ratings/ratings_type_stars_process.php?id=' . $id . '&rating=1&rtype=' . $rtype . '" title="' . $locale['r136'] . '" class="one-star" >1</a></li>';
            echo '<li><a onclick="rate(\'2\',\'' . $id . '\',' . $show5bool . ',' . $showPercbool . ',' . $showVotesbool . ',\'' . $rtype . '\', \'' . $base . '\'); return false;" href="' . INCLUDES . 'ratings/ratings_type_stars_process.php?id=' . $id . '&rating=2&rtype=' . $rtype . '" title="' . $locale['r137'] . '" class="two-stars">2</a></li>';
            echo '<li><a onclick="rate(\'3\',\'' . $id . '\',' . $show5bool . ',' . $showPercbool . ',' . $showVotesbool . ',\'' . $rtype . '\', \'' . $base . '\'); return false;" href="' . INCLUDES . 'ratings/ratings_type_stars_process.php?id=' . $id . '&rating=3&rtype=' . $rtype . '" title="' . $locale['r138'] . '" class="three-stars">3</a></li>';
            echo '<li><a onclick="rate(\'4\',\'' . $id . '\',' . $show5bool . ',' . $showPercbool . ',' . $showVotesbool . ',\'' . $rtype . '\', \'' . $base . '\'); return false;" href="' . INCLUDES . 'ratings/ratings_type_stars_process.php?id=' . $id . '&rating=4&rtype=' . $rtype . '" title="' . $locale['r139'] . '" class="four-stars">4</a></li>';
            echo '<li><a onclick="rate(\'5\',\'' . $id . '\',' . $show5bool . ',' . $showPercbool . ',' . $showVotesbool . ',\'' . $rtype . '\', \'' . $base . '\'); return false;" href="' . INCLUDES . 'ratings/ratings_type_stars_process.php?id=' . $id . '&rating=5&rtype=' . $rtype . '" title="' . $locale['r140'] . '" class="five-stars">5</a></li>';
            echo '</ul>';
            echo "</td></tr>\n";
            echo "</table>\n";
            echo "<div align='center' id='loading_" . $id . "'></div>";
            if (!$boardrate) {
                echo "<table cellpadding='0' width='100%' cellspacing='1' class='tbl2 center'>\n";
                echo "\t<tr>\n";
                echo "\t\t<td class='tbl2'><center><strong>" . $locale['r150'] . "</strong>" . $rating_average . " " . $locale['r151'] . "</center></td>\n";
                echo "\t</tr>\n";
                echo "</table>\n";
            }
        }
        if (!$boardrate) {
            closetable();
        }
    }
}