From abab89c39d2d53f4b52cce58ac0d85e181396e6c Mon Sep 17 00:00:00 2001 From: mcfly Date: Wed, 10 Dec 2008 15:29:31 +0000 Subject: [PATCH] Added ability to limit poll creation by userclass --- e107_plugins/forum/forum_admin_class.php | 22 +++++++++---------- e107_plugins/forum/forum_post.php | 14 ++++++------ e107_plugins/forum/forum_post_shortcodes.php | 2 +- .../languages/English/lan_forum_admin.php | 6 ++--- e107_plugins/forum/plugin.xml | 4 ++-- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/e107_plugins/forum/forum_admin_class.php b/e107_plugins/forum/forum_admin_class.php index 9e24394d1..57f260797 100755 --- a/e107_plugins/forum/forum_admin_class.php +++ b/e107_plugins/forum/forum_admin_class.php @@ -9,8 +9,8 @@ * Forum admin functions * * $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_admin_class.php,v $ -* $Revision: 1.8 $ -* $Date: 2008-12-08 02:33:34 $ +* $Revision: 1.9 $ +* $Date: 2008-12-10 15:29:31 $ * $Author: mcfly_e107 $ * */ @@ -617,17 +617,16 @@ class forumAdmin function show_prefs() { global $pref, $ns, $sql; + $e107 = e107::getInstance(); - if($sql->db_Count('plugin','(*)', "where plugin_path = 'poll' AND plugin_installflag = 1")) + $poll_installed = plugInstalled('poll'); + + + if(!$poll_installed) { - $poll_installed = true; - } - else - { - $poll_installed = false; if($pref['forum_poll'] == 1) { - $pref['forum_poll'] = 0; + $pref['forum_poll'] = e_UC_NOBODY; save_prefs(); } } @@ -660,7 +659,8 @@ class forumAdmin ".FORLAN_49."
".FORLAN_50.""; if($poll_installed) { - $text .= "".($pref['forum_poll'] ? "" : "").""; +// ".$e107->user_class->uc_dropdown("mods[{$f['forum_id']}]", $f['forum_moderators'], 'admin,classes')." + $text .= "".$e107->user_class->uc_dropdown('forum_poll', $pref['forum_poll'], 'admin,classes').''; } else { @@ -678,7 +678,7 @@ class forumAdmin } if(!is_writable(e_PLUGIN.'forum/attachments')) { - $text .= "
Attachment file is not writable!"; + $text .= "
Attachment dir (".e_PLUGIN_ABS.'forum/attachments'.") is not writable!"; } $text .= " diff --git a/e107_plugins/forum/forum_post.php b/e107_plugins/forum/forum_post.php index 43f138e36..7e6e315f9 100644 --- a/e107_plugins/forum/forum_post.php +++ b/e107_plugins/forum/forum_post.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_post.php,v $ -| $Revision: 1.27 $ -| $Date: 2008-12-09 21:46:14 $ +| $Revision: 1.28 $ +| $Date: 2008-12-10 15:29:31 $ | $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ @@ -120,19 +120,19 @@ if($pref['forum_attach']) if (isset($_POST['submitpoll'])) { - require_once(e_PLUGIN."poll/poll_class.php"); + require_once(e_PLUGIN.'poll/poll_class.php'); $poll = new poll; require_once(HEADERF); if (!$FORUMPOST) { - if (file_exists(THEME."forum_posted_template.php")) + if (file_exists(THEME.'forum_posted_template.php')) { - require_once(THEME."forum_posted_template.php"); + require_once(THEME.'forum_posted_template.php'); } else { - require_once(e_PLUGIN."forum/templates/forum_posted_template.php"); + require_once(e_PLUGIN.'forum/templates/forum_posted_template.php'); } } echo $FORUMPOLLPOSTED; @@ -156,7 +156,7 @@ if (isset($_POST['fpreview'])) $tsubject = $tp->post_toHTML($_POST['subject'], true); $tpost = $tp->post_toHTML($_POST['post'], true); - if ($_POST['poll_title'] != '' && $pref['forum_poll']) + if ($_POST['poll_title'] != '' && check_class($pref['forum_poll'])) { require_once(e_PLUGIN."poll/poll_class.php"); $poll = new poll; diff --git a/e107_plugins/forum/forum_post_shortcodes.php b/e107_plugins/forum/forum_post_shortcodes.php index baafc63db..048a8241a 100644 --- a/e107_plugins/forum/forum_post_shortcodes.php +++ b/e107_plugins/forum/forum_post_shortcodes.php @@ -146,7 +146,7 @@ SC_END SC_BEGIN POLL global $poll_form, $action, $pref; -if ($action == 'nt' && $pref['forum_poll'] && strpos(e_QUERY, 'edit') === false) +if ($action == 'nt' && check_class($pref['forum_poll']) && strpos(e_QUERY, 'edit') === false) { return $poll_form; } diff --git a/e107_plugins/forum/languages/English/lan_forum_admin.php b/e107_plugins/forum/languages/English/lan_forum_admin.php index d2941c50e..32f599232 100644 --- a/e107_plugins/forum/languages/English/lan_forum_admin.php +++ b/e107_plugins/forum/languages/English/lan_forum_admin.php @@ -4,8 +4,8 @@ | e107 website system - Language File. | | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/languages/English/lan_forum_admin.php,v $ -| $Revision: 1.4 $ -| $Date: 2008-12-05 20:28:05 $ +| $Revision: 1.5 $ +| $Date: 2008-12-10 15:29:31 $ | $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ @@ -58,7 +58,7 @@ define("FORLAN_46", "Title displayed in caption if enclose tables is ticked"); define("FORLAN_47", "Enable email notification"); define("FORLAN_48", "Tick this to allow your users to have the option of receiving an email when somebody replies to their post"); define("FORLAN_49", "Enable polls"); -define("FORLAN_50", "Tick this to allow your users to set polls in the forums - the Polls plugin must be installed to use this feature"); +define("FORLAN_50", "Select userclass allowed to create polls in the forums"); define("FORLAN_51", "Enable tracking"); define("FORLAN_52", "Tick this to allow your users to track threads and be emailed when the thread is replied to"); define("FORLAN_53", "Email prefix"); diff --git a/e107_plugins/forum/plugin.xml b/e107_plugins/forum/plugin.xml index 6306a570e..94da94951 100755 --- a/e107_plugins/forum/plugin.xml +++ b/e107_plugins/forum/plugin.xml @@ -1,5 +1,5 @@ - + This plugin is a fully featured Forum system @@ -15,7 +15,7 @@ - +