From eb45fac1a5c72d4d5248bb7df0325c86835f03d4 Mon Sep 17 00:00:00 2001 From: PaulBender Date: Thu, 5 Jun 2014 13:29:47 -0400 Subject: [PATCH] Feature #449 User option to disable images/videos --- admin/modules/user/users.php | 4 ++++ inc/datahandlers/user.php | 4 ++++ inc/functions_post.php | 15 ++++++++++++++ .../english/admin/user_users.lang.php | 2 ++ inc/languages/english/usercp.lang.php | 2 ++ install/index.php | 2 ++ install/resources/mybb_theme.xml | 10 +++++++++- install/resources/mysql_db_tables.php | 2 ++ install/resources/pgsql_db_tables.php | 2 ++ install/resources/sqlite_db_tables.php | 2 ++ install/resources/upgrade29.php | 14 +++++++++++++ usercp.php | 20 +++++++++++++++++++ 12 files changed, 78 insertions(+), 1 deletion(-) diff --git a/admin/modules/user/users.php b/admin/modules/user/users.php index 6586cb8367..712b673c48 100644 --- a/admin/modules/user/users.php +++ b/admin/modules/user/users.php @@ -546,6 +546,8 @@ "dstcorrection" => $mybb->input['dstcorrection'], "threadmode" => $mybb->input['threadmode'], "classicpostbit" => $mybb->input['classicpostbit'], + "showimages" => $mybb->input['showimages'], + "showvideos" => $mybb->input['showvideos'], "showsigs" => $mybb->input['showsigs'], "showavatars" => $mybb->input['showavatars'], "showquickreply" => $mybb->input['showquickreply'], @@ -1281,6 +1283,8 @@ $thread_options = array( $form->generate_check_box("classicpostbit", 1, $lang->show_classic_postbit, array("checked" => $mybb->input['classicpostbit'])), + $form->generate_check_box("showimages", 1, $lang->display_images, array("checked" => $mybb->input['showimages'])), + $form->generate_check_box("showvideos", 1, $lang->display_videos, array("checked" => $mybb->input['showvideos'])), $form->generate_check_box("showsigs", 1, $lang->display_users_sigs, array("checked" => $mybb->input['showsigs'])), $form->generate_check_box("showavatars", 1, $lang->display_users_avatars, array("checked" => $mybb->input['showavatars'])), $form->generate_check_box("showquickreply", 1, $lang->show_quick_reply, array("checked" => $mybb->input['showquickreply'])), diff --git a/inc/datahandlers/user.php b/inc/datahandlers/user.php index f9ae64aadc..2d74f4725d 100644 --- a/inc/datahandlers/user.php +++ b/inc/datahandlers/user.php @@ -616,6 +616,8 @@ function verify_options() $this->verify_yesno_option($options, 'pmnotice', 1); $this->verify_yesno_option($options, 'pmnotify', 1); $this->verify_yesno_option($options, 'invisible', 0); + $this->verify_yesno_option($options, 'showimages', 1); + $this->verify_yesno_option($options, 'showvideos', 1); $this->verify_yesno_option($options, 'showsigs', 1); $this->verify_yesno_option($options, 'showavatars', 1); $this->verify_yesno_option($options, 'showquickreply', 1); @@ -1045,6 +1047,8 @@ function insert_user() "receivefrombuddy" => $user['options']['receivefrombuddy'], "pmnotice" => $user['options']['pmnotice'], "pmnotify" => $user['options']['pmnotify'], + "showimages" => $user['options']['showimages'], + "showvideos" => $user['options']['showvideos'], "showsigs" => $user['options']['showsigs'], "showavatars" => $user['options']['showavatars'], "showquickreply" => $user['options']['showquickreply'], diff --git a/inc/functions_post.php b/inc/functions_post.php index 32ea14d8a6..8a48048c0b 100644 --- a/inc/functions_post.php +++ b/inc/functions_post.php @@ -617,6 +617,16 @@ function build_postbit($post, $post_type=0) $parser_options['allow_smilies'] = 0; } + if($mybb->user['showimages'] != 1) + { + $parser_options['allow_imgcode'] = 0; + } + + if($mybb->user['showvideos'] != 1) + { + $parser_options['allow_videocode'] = 0; + } + // If we have incoming search terms to highlight - get it done. if(!empty($mybb->input['highlight'])) { @@ -648,6 +658,11 @@ function build_postbit($post, $post_type=0) $sig_parser['nofollow_on'] = 1; } + if($mybb->user['showimages'] != 1) + { + $sig_parser['allow_imgcode'] = 0; + } + $post['signature'] = $parser->parse_message($post['signature'], $sig_parser); eval("\$post['signature'] = \"".$templates->get("postbit_signature")."\";"); } diff --git a/inc/languages/english/admin/user_users.lang.php b/inc/languages/english/admin/user_users.lang.php index e419c2990a..533bb4b7b8 100644 --- a/inc/languages/english/admin/user_users.lang.php +++ b/inc/languages/english/admin/user_users.lang.php @@ -210,6 +210,8 @@ $l['default_thread_age_view'] = "Default Thread Age View"; $l['forum_display_options'] = "Forum Display Options"; $l['show_classic_postbit'] = "Display posts in classic mode"; +$l['display_images'] = "Display images in posts"; +$l['display_videos'] = "Display videos in posts"; $l['display_users_sigs'] = "Display users' signatures in their posts"; $l['display_users_avatars'] = "Display users' avatars in their posts"; $l['show_quick_reply'] = "Show the quick reply box at the bottom of the thread view"; diff --git a/inc/languages/english/usercp.lang.php b/inc/languages/english/usercp.lang.php index 5a721f7a8c..b6316c6835 100644 --- a/inc/languages/english/usercp.lang.php +++ b/inc/languages/english/usercp.lang.php @@ -151,6 +151,8 @@ $l['threaded'] = "Threaded"; $l['linear'] = "Linear"; $l['show_classic_postbit'] = "Display posts in classic mode."; +$l['show_images'] = "Display images in posts."; +$l['show_videos'] = "Display videos in posts."; $l['show_sigs'] = "Display users' signatures in their posts."; $l['show_sigs_desc'] = "Do you want to view user's signatures in their posts?"; $l['show_avatars'] = "Display users' avatars in their posts."; diff --git a/install/index.php b/install/index.php index 7b12f67561..b1ab8296c5 100644 --- a/install/index.php +++ b/install/index.php @@ -2168,6 +2168,8 @@ function install_done() 'receivepms' => 1, 'pmnotice' => 1, 'pmnotify' => 1, + 'showimages' => 1, + 'showvideos' => 1, 'showsigs' => 1, 'showavatars' => 1, 'showquickreply' => 1, diff --git a/install/resources/mybb_theme.xml b/install/resources/mybb_theme.xml index 82644d4d16..cee89023ab 100644 --- a/install/resources/mybb_theme.xml +++ b/install/resources/mybb_theme.xml @@ -11601,7 +11601,7 @@ if(use_xmlhttprequest == "1") ]]> -