Skip to content

Commit

Permalink
Feature #449 User option to disable images/videos
Browse files Browse the repository at this point in the history
  • Loading branch information
Starpaul20 committed Jun 5, 2014
1 parent 05f2016 commit eb45fac
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 1 deletion.
4 changes: 4 additions & 0 deletions admin/modules/user/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down Expand Up @@ -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'])),
Expand Down
4 changes: 4 additions & 0 deletions inc/datahandlers/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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'],
Expand Down
15 changes: 15 additions & 0 deletions inc/functions_post.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']))
{
Expand Down Expand Up @@ -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")."\";");
}
Expand Down
2 changes: 2 additions & 0 deletions inc/languages/english/admin/user_users.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 2 additions & 0 deletions inc/languages/english/usercp.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.";
Expand Down
2 changes: 2 additions & 0 deletions install/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2168,6 +2168,8 @@ function install_done()
'receivepms' => 1,
'pmnotice' => 1,
'pmnotify' => 1,
'showimages' => 1,
'showvideos' => 1,
'showsigs' => 1,
'showavatars' => 1,
'showquickreply' => 1,
Expand Down
10 changes: 9 additions & 1 deletion install/resources/mybb_theme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11601,7 +11601,7 @@ if(use_xmlhttprequest == "1")
<input type="submit" class="button" name="submit" value="{$lang->update_notepad}" />
</div>
</form>]]></template>
<template name="usercp_options" version="1600"><![CDATA[<html>
<template name="usercp_options" version="1800"><![CDATA[<html>
<head>
<title>{$mybb->settings['bbname']} - {$lang->edit_options}</title>
{$headerinclude}
Expand Down Expand Up @@ -11750,6 +11750,14 @@ if(use_xmlhttprequest == "1")
<td><span class="smalltext"><label for="classicpostbit">{$lang->show_classic_postbit}</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="showimages" id="showimages" value="1" {$showimagescheck} /></td>
<td><span class="smalltext"><label for="showimages">{$lang->show_images}</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="showvideos" id="showvideos" value="1" {$showvideoscheck} /></td>
<td><span class="smalltext"><label for="showvideos">{$lang->show_videos}</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="showsigs" id="showsigs" value="1" {$showsigscheck} /></td>
<td><span class="smalltext"><label for="showsigs">{$lang->show_sigs}</label></span></td>
</tr>
Expand Down
2 changes: 2 additions & 0 deletions install/resources/mysql_db_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,8 @@
pmnotice int(1) NOT NULL default '0',
pmnotify int(1) NOT NULL default '0',
threadmode varchar(8) NOT NULL default '',
showimages int(1) NOT NULL default '0',
showvideos int(1) NOT NULL default '0',
showsigs int(1) NOT NULL default '0',
showavatars int(1) NOT NULL default '0',
showquickreply int(1) NOT NULL default '0',
Expand Down
2 changes: 2 additions & 0 deletions install/resources/pgsql_db_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,8 @@
pmnotice int NOT NULL default '0',
pmnotify int NOT NULL default '0',
threadmode varchar(8) NOT NULL default '',
showimages int NOT NULL default '0',
showvideos int NOT NULL default '0',
showsigs int NOT NULL default '0',
showavatars int NOT NULL default '0',
showquickreply int NOT NULL default '0',
Expand Down
2 changes: 2 additions & 0 deletions install/resources/sqlite_db_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,8 @@
pmnotice int(1) NOT NULL default '0',
pmnotify int(1) NOT NULL default '0',
threadmode varchar(8) NOT NULL default '',
showimages int(1) NOT NULL default '0',
showvideos int(1) NOT NULL default '0',
showsigs int(1) NOT NULL default '0',
showavatars int(1) NOT NULL default '0',
showquickreply int(1) NOT NULL default '0',
Expand Down
14 changes: 14 additions & 0 deletions install/resources/upgrade29.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,16 @@ function upgrade29_dbchanges3()
$db->drop_column("adminoptions", "cplanguage");
}

if($db->field_exists('showimages', 'users'))
{
$db->drop_column("users", "showimages");
}

if($db->field_exists('showvideos', 'users'))
{
$db->drop_column("users", "showvideos");
}

switch($db->type)
{
case "pgsql":
Expand All @@ -283,12 +293,16 @@ function upgrade29_dbchanges3()
$db->add_column("users", "skype", "varchar(75) NOT NULL default '' AFTER yahoo");
$db->add_column("users", "google", "varchar(75) NOT NULL default '' AFTER skype");
$db->add_column("adminoptions", "cplanguage", "varchar(50) NOT NULL default '' AFTER cpstyle");
$db->add_column("users", "showimages", "int NOT NULL default '1' AFTER threadmode");
$db->add_column("users", "showvideos", "int NOT NULL default '1' AFTER showimages");
break;
default:
$db->add_column("profilefields", "postbit", "int(1) NOT NULL default '0' AFTER hidden");
$db->add_column("users", "skype", "varchar(75) NOT NULL default '' AFTER yahoo");
$db->add_column("users", "google", "varchar(75) NOT NULL default '' AFTER skype");
$db->add_column("adminoptions", "cplanguage", "varchar(50) NOT NULL default '' AFTER cpstyle");
$db->add_column("users", "showimages", "int(1) NOT NULL default '1' AFTER threadmode");
$db->add_column("users", "showvideos", "int(1) NOT NULL default '1' AFTER showimages");
break;
}

Expand Down
20 changes: 20 additions & 0 deletions usercp.php
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,8 @@
"invisible" => $mybb->get_input('invisible', 1),
"dstcorrection" => $mybb->get_input('dstcorrection', 1),
"threadmode" => $mybb->get_input('threadmode'),
"showimages" => $mybb->get_input('showimages', 1),
"showvideos" => $mybb->get_input('showvideos', 1),
"showsigs" => $mybb->get_input('showsigs', 1),
"showavatars" => $mybb->get_input('showavatars', 1),
"showquickreply" => $mybb->get_input('showquickreply', 1),
Expand Down Expand Up @@ -810,6 +812,24 @@
$no_subscribe_selected = "selected=\"selected\"";
}

if(isset($user['showimages']) && $user['showimages'] == 1)
{
$showimagescheck = "checked=\"checked\"";
}
else
{
$showimagescheck = "";
}

if(isset($user['showvideos']) && $user['showvideos'] == 1)
{
$showvideoscheck = "checked=\"checked\"";
}
else
{
$showvideoscheck = "";
}

if(isset($user['showsigs']) && $user['showsigs'] == 1)
{
$showsigscheck = "checked=\"checked\"";
Expand Down

0 comments on commit eb45fac

Please sign in to comment.