Welcome to Geeklog, Anonymous Sunday, November 24 2024 @ 08:50 am EST
Geeklog Forums
Make Polls List Privs aware..
Anonymous
Anonymous
Currently, all polls show up in the polls list, regardless of the group/s they're intended for. Following a link from the list to a privilleged poll simply yields an empty page.
Aside from hiding the polls ppl aren't meant to see, I've also included the hack provided recently by 'amckay', that tags a vote link on the end of each item in the list.
You'll need to modify three files for this to work..
---------
FILE: english.php
Add:
6 => "Please ensure you are logged in to view all polls applicable to you, or click <a href=\"".$_CONF[site_url]."/users.php?mode=new\">here</a> to register.<br>"
After:
5 => "Votes",
-----------
FILE: Pollbooth.php
REPLACE the polllist function with the following:
function polllist()
{
global $_TABLES, $_CONF, $LANG07;
$result = DB_query("SELECT * FROM "
$nrows = DB_numRows($result);
$retval = '';
$pollcnt=0;
$retval .= COM_startBlock($LANG07[4]).$LANG07[6];
$pollitem = new Template($_CONF['path_layout'] . 'pollbooth');
$pollitem->set_file('pollitem', 'polllist.thtml');
for ($i = 1; $i <= $nrows; $i++) {
$Q = DB_fetchArray($result);
/// DONT SHOW ITEMS THAT CURRENT USER IS NOT PERMITTED TO VIEW
if (SEC_hasAccess($Q['owner_id'],$Q['group_id'],$Q['perm_owner'],$Q['perm_group'],$Q['perm_members'],$Q['perm_anon'])>0) {
$pollcnt++;
$pollitem->set_var('item_num', $pollcnt);
$pollitem->set_var('poll_url', $_CONF['site_url'].'/pollbooth.php?qid=' . $Q['qid'] . '&aid=-1');
$pollitem->set_var('poll_question', stripslashes($Q['question']));
$pollitem->set_var('poll_votes', $Q['voters']);
$pollitem->set_var('lang_votes', $LANG07[5]);
$pollitem->set_var('vote_url', $_CONF['site_url'].'/pollbooth.php?qid=' . $Q['qid']);
$pollitem->set_var('vote_text', $LANG07[3]);
if ($i == $nrows) {
$pollitem->set_var('ending_br', '<br><br>');
} else {
$pollitem->set_var('ending_br', '');
}
$pollitem->parse('output', 'pollitem');
$retval .= $pollitem->finish($pollitem->get_var('output'));
}else{
if ($i == $nrows) {
$retval .='<br><br>';
}
}
}
$retval .= COM_endBlock();
return $retval;
}
--------------
FILE: Polllist.thtml
Include the vote_text and vote_URL vars and you're done.
----------------
Well, that's it.
Hope it's not too drawn out - but it should keep your poll list - privs based and voteable.
8
7
Quote
Anonymous
Anonymous
Story submission issue - any valid vars enclosed in curly braces are
stripped when submitting a story, so the code in this article needs a
tweek... replace (open_curly_braces) and (close_curly_braces)
accordingly as below..
Where you see the line:
$result = DB_query("SELECT * FROM "
Insert after the word FROM:
(open_curly_braces)$_TABLES['pollquestions'](close_curly_braces)
That fixes it..
Yes, I tested it this time
11
6
Quote
Anonymous
Anonymous
I'll see what I can do
Cheers.
9
10
Quote
All times are EST. The time is now 08:50 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content