summaryrefslogtreecommitdiff
path: root/modules/poll.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/poll.module')
-rw-r--r--modules/poll.module13
1 files changed, 5 insertions, 8 deletions
diff --git a/modules/poll.module b/modules/poll.module
index af7f918f7..7d6be5461 100644
--- a/modules/poll.module
+++ b/modules/poll.module
@@ -75,10 +75,10 @@ function poll_status() {
}
function poll_search($keys) {
- global $status, $user;
+ global $status;
$result = db_query("SELECT n.*, p.* FROM poll p LEFT JOIN node n ON n.nid = p.nid AND n.lid = p.lid WHERE n.status = '$status[posted]' AND (n.title LIKE '%$keys%') LIMIT 20");
while ($poll = db_fetch_object($result)) {
- $find[$i++] = array("title" => check_output($poll->title), "link" => (user_access($user, "add and edit nodes") ? "admin.php?mod=poll&op=edit&id=$poll->nid" : "node.php?id=$poll->nid"), "user" => $poll->userid, "date" => $poll->timestamp);
+ $find[$i++] = array("title" => check_output($poll->title), "link" => (user_access("administer nodes") ? "admin.php?mod=poll&op=edit&id=$poll->nid" : "node.php?id=$poll->nid"), "user" => $poll->userid, "date" => $poll->timestamp);
}
return $find;
}
@@ -170,13 +170,10 @@ function poll_view($node, $main = 0, $block = 0) {
function poll_form($edit = array(), $nocheck = 0) {
global $REQUEST_URI, $user;
- $duration = array(0 => t("Unlimited"), 86400 => t("1 day"), 172800 => t("2 days"), 345600 => t("4 days"),
- 604800 => t("1 week"), 1209600 => t("2 weeks"), 2678400 => t("1 month"), 5356800 => t("2 months"),
- 10713600 => t("4 months"), 31536000 => t("1 year"));
-
+ $duration = array(0 => t("Unlimited"), 86400 => t("1 day"), 172800 => t("2 days"), 345600 => t("4 days"), 604800 => t("1 week"), 1209600 => t("2 weeks"), 2678400 => t("1 month"), 5356800 => t("2 months"), 10713600 => t("4 months"), 31536000 => t("1 year"));
$active = array(0 => "Closed", 1 => "Active");
- $admin = ($edit[nid] && user_access($user, "add and edit nodes")) ? 1 : 0;
+ $admin = ($edit[nid] && user_access("administer nodes")) ? 1 : 0;
if ($edit[title]) {
$form .= poll_view(new Poll(node_preview($edit)));
@@ -234,7 +231,7 @@ function poll_save($edit) {
if (!$edit[nid]) {
$nid = node_save($edit, array(active => 1, attributes => node_attributes_save("poll", $edit), author => $user->id, comment => variable_get("poll_comment", 0), moderate => variable_get("poll_moderate", ""), promote => variable_get("poll_promote", 0), runtime, score => 0, status => variable_get("poll_status", $status[queued]), timestamp => time(), title, type => "poll", votes => 0, voters => ""));
}
- else if (user_access($user, "add and edit nodes")) {
+ else if (user_access("administer nodes")) {
$nid = node_save($edit, array(active, attributes => node_attributes_save("poll", $edit), runtime, title, type => "poll"));
db_query("DELETE FROM poll_choices WHERE nid='" . $nid . "'");
}