From d1fd694282e3ebaf2046e3aee6a0d5dd92cb6659 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Tue, 13 Nov 2001 16:09:10 +0000 Subject: [PATCH] Added global PM disable + modded emailer to allow lang select + re-added back box limits my dumbness removed recently git-svn-id: file:///svn/phpbb/trunk@1305 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/admin/admin_board.php | 33 +++++++++++++++++-- phpBB/db/mysql_basic.sql | 1 + phpBB/db/postgres_basic.sql | 3 +- phpBB/includes/emailer.php | 19 ++++++----- phpBB/language/lang_english/lang_main.php | 8 ++++- phpBB/privmsg.php | 15 +++++++-- .../subSilver/admin/board_config_body.tpl | 19 +++++++++++ 7 files changed, 83 insertions(+), 15 deletions(-) diff --git a/phpBB/admin/admin_board.php b/phpBB/admin/admin_board.php index 78291c789d..ab9764c962 100644 --- a/phpBB/admin/admin_board.php +++ b/phpBB/admin/admin_board.php @@ -62,36 +62,53 @@ else } $style_select = style_select($new['default_style'], 'default_style', "../templates"); + $admin_style_select = style_select($new['default_admin_style'], 'default_admin_style', "../templates"); + $lang_select = language_select($new['default_lang'], 'default_lang', "../language"); + $timezone_select = tz_select($new['board_timezone'], 'board_timezone'); + $html_tags = $new['allow_html_tags']; $override_user_style_yes = ( $new['override_user_style'] ) ? "checked=\"checked\"" : ""; $override_user_style_no = ( !$new['override_user_style'] ) ? "checked=\"checked\"" : ""; + $html_yes = ( $new['allow_html'] ) ? "checked=\"checked\"" : ""; $html_no = ( !$new['allow_html'] ) ? "checked=\"checked\"" : ""; + $bbcode_yes = ( $new['allow_bbcode'] ) ? "checked=\"checked\"" : ""; $bbcode_no = ( !$new['allow_bbcode'] ) ? "checked=\"checked\"" : ""; + $activation_none = ( $new['require_activation'] == USER_ACTIVATION_NONE ) ? "checked=\"checked\"" : ""; $activation_user = ( $new['require_activation'] == USER_ACTIVATION_SELF ) ? "checked=\"checked\"" : ""; $activation_admin = ( $new['require_activation'] == USER_ACTIVATION_ADMIN ) ? "checked=\"checked\"" : ""; + $gzip_yes = ( $new['gzip_compress'] ) ? "checked=\"checked\"" : ""; $gzip_no = ( !$new['gzip_compress'] ) ? "checked=\"checked\"" : ""; + +$privmsg_on = ( !$new['privmsg_disable'] ) ? "checked=\"checked\"" : ""; +$privmsg_off = ( $new['privmsg_disable'] ) ? "checked=\"checked\"" : ""; + $prune_yes = ( $new['prune_enable'] ) ? "checked=\"checked\"" : ""; $prune_no = ( !$new['prune_enable'] ) ? "checked=\"checked\"" : ""; + $smile_yes = ( $new['allow_smilies'] ) ? "checked=\"checked\"" : ""; $smile_no = ( !$new['allow_smilies'] ) ? "checked=\"checked\"" : ""; + $sig_yes = ( $new['allow_sig'] ) ? "checked=\"checked\"" : ""; $sig_no = ( !$new['allow_sig'] ) ? "checked=\"checked\"" : ""; + $namechange_yes = ( $new['allow_namechange'] ) ? "checked=\"checked\"" : ""; $namechange_no = ( !$new['allow_namechange'] ) ? "checked=\"checked\"" : ""; + $avatars_local_yes = ( $new['allow_avatar_local'] ) ? "checked=\"checked\"" : ""; $avatars_local_no = ( !$new['allow_avatar_local'] ) ? "checked=\"checked\"" : ""; $avatars_remote_yes = ( $new['allow_avatar_remote'] ) ? "checked=\"checked\"" : ""; $avatars_remote_no = ( !$new['allow_avatar_remote'] ) ? "checked=\"checked\"" : ""; $avatars_upload_yes = ( $new['allow_avatar_upload'] ) ? "checked=\"checked\"" : ""; $avatars_upload_no = ( !$new['allow_avatar_upload'] ) ? "checked=\"checked\"" : ""; + $smtp_yes = ( $new['smtp_delivery'] ) ? "checked=\"checked\"" : ""; $smtp_no = ( !$new['smtp_delivery'] ) ? "checked=\"checked\"" : ""; @@ -109,7 +126,14 @@ $template->assign_vars(array( "L_GENERAL_SETTINGS" => $lang['General_settings'], "L_SITE_NAME" => $lang['Site_name'], "L_SITE_DESCRIPTION" => $lang['Site_desc'], - "L_ACCT_ACTIVATION" => $lang['Acct_activation'], + "L_ACCT_ACTIVATION" => $lang['Acct_activation'], + "L_PRIVATE_MESSAGING" => $lang['Private_Messaging'], + "L_INBOX_LIMIT" => $lang['Inbox_limits'], + "L_SENTBOX_LIMIT" => $lang['Sentbox_limits'], + "L_SAVEBOX_LIMIT" => $lang['Savebox_limits'], + "L_DISABLE_PRIVATE_MESSAGING" => $lang['Disable_privmsg'], + "L_ENABLED" => $lang['Enabled'], + "L_DISABLED" => $lang['Disabled'], "SITENAME" => $new['sitename'], "SITE_DESCRIPTION" => $new['site_desc'], @@ -118,7 +142,7 @@ $template->assign_vars(array( "ACTIVATION_USER" => USER_ACTIVATION_SELF, "ACTIVATION_USER_CHECKED" => $activation_user, "ACTIVATION_ADMIN" => USER_ACTIVATION_ADMIN, - "ACTIVATION_ADMIN_CHECKED" => $activation_admin, + "ACTIVATION_ADMIN_CHECKED" => $activation_admin, "FLOOD_INTERVAL" => $new['flood_interval'], "TOPICS_PER_PAGE" => $new['topics_per_page'], "POSTS_PER_PAGE" => $new['posts_per_page'], @@ -130,6 +154,11 @@ $template->assign_vars(array( "L_DATE_FORMAT_EXPLAIN" => $lang['Date_format_explain'], "DEFAULT_DATEFORMAT" => $new['default_dateformat'], "TIMEZONE_SELECT" => $timezone_select, + "S_PRIVMSG_ENABLED" => $privmsg_on, + "S_PRIVMSG_DISABLED" => $privmsg_off, + "INBOX_LIMIT" => $new['max_inbox_privmsgs'], + "SENTBOX_LIMIT" => $new['max_sentbox_privmsgs'], + "SAVEBOX_LIMIT" => $new['max_savebox_privmsgs'], "GZIP_YES" => $gzip_yes, "GZIP_NO" => $gzip_no, "PRUNE_YES" => $prune_yes, diff --git a/phpBB/db/mysql_basic.sql b/phpBB/db/mysql_basic.sql index 85fe7e853b..0cd95709b8 100644 --- a/phpBB/db/mysql_basic.sql +++ b/phpBB/db/mysql_basic.sql @@ -51,6 +51,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_admin_styl INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_dateformat','D M d, Y g:i a'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_timezone','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('prune_enable','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('privmsg_disable','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('gzip_compress','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_fax', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_mail', ''); diff --git a/phpBB/db/postgres_basic.sql b/phpBB/db/postgres_basic.sql index 85e650c91c..9c35528b0d 100755 --- a/phpBB/db/postgres_basic.sql +++ b/phpBB/db/postgres_basic.sql @@ -50,7 +50,8 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_style','1' INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_admin_style','1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_dateformat','D M d, Y g:i a'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_timezone','0'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('prune_enable','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('prune_enable','1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('privmsg_disable','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('gzip_compress','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_fax', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_mail', ''); diff --git a/phpBB/includes/emailer.php b/phpBB/includes/emailer.php index b258f3ad8a..85fe1428c3 100755 --- a/phpBB/includes/emailer.php +++ b/phpBB/includes/emailer.php @@ -84,23 +84,24 @@ class emailer $this->extra_headers = $headers; } - function use_template($template_file) + function use_template($template_file, $template_lang = "") { - global $board_config; + global $board_config, $phpbb_root_path; - $phpbb_root_path = "./"; - $template_file = $phpbb_root_path . "language/lang_" . $board_config['default_lang'] . "/email/" . $template_file . ".tpl"; - if (!file_exists($template_file)) + if( $template_lang == "" ) + { + $template_lang = $board_config['default_lang']; + } + + $template_file = $phpbb_root_path . "language/lang_" . $template_lang . "/email/" . $template_file . ".tpl"; + if( !file_exists($template_file) ) { message_die(GENERAL_ERROR, "Couldn't find template file: $template_file", "", __LINE__, __FILE__); } else { $this->tpl_file = $template_file; - // - // Load the email text into the $this->msg variable - // - if(!$this->load_msg()) + if( !$this->load_msg() ) { message_die(GENERAL_ERROR, "Couldn't load template file: $template_file", "", __LINE__, __FILE__); } diff --git a/phpBB/language/lang_english/lang_main.php b/phpBB/language/lang_english/lang_main.php index 702e58ef37..47ab5b13c7 100644 --- a/phpBB/language/lang_english/lang_main.php +++ b/phpBB/language/lang_english/lang_main.php @@ -87,6 +87,7 @@ $lang['Year'] = "Year"; $lang['Years'] = "Years"; $lang['Enabled'] = "Enabled"; +$lang['Disabled'] = "Disabled"; $lang['Next'] = "Next"; $lang['Previous'] = "Previous"; $lang['Goto_page'] = "Goto page"; @@ -121,7 +122,6 @@ $lang['Jump_to'] = "Jump to"; $lang['Select_forum'] = "Select a forum"; $lang['Success'] = "Success"; -$lang['Private_messaging'] = "Send a Private Message"; // @@ -358,6 +358,7 @@ $lang['Topic_reply_notification'] = "Topic Reply Notification"; // Private Messaging // $lang['Private_Messaging'] = "Private Messaging"; +$lang['PM_disabled'] = "Private messaging has been disabled on this board"; $lang['Login_check_pm'] = "Login to check your private messages"; $lang['New_pms'] = "You have %d new messages"; // You have 2 new messages @@ -944,6 +945,11 @@ $lang['Site_name'] = "Site name"; $lang['Site_desc'] = "Site description"; $lang['Acct_activation'] = "Enable account activation"; +$lang['Disable_privmsg'] = "Disable Private Messaging"; +$lang['Inbox_limits'] = "Max posts in Inbox"; +$lang['Sentbox_limits'] = "Max posts in Sentbox"; +$lang['Savebox_limits'] = "Max posts in Savebox"; + // // Forum Management diff --git a/phpBB/privmsg.php b/phpBB/privmsg.php index 17f2636bdb..1b0ff74c66 100644 --- a/phpBB/privmsg.php +++ b/phpBB/privmsg.php @@ -26,6 +26,14 @@ include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'includes/post.'.$phpEx); include($phpbb_root_path . 'includes/bbcode.'.$phpEx); +// +// Is PM disabled? +// +if( !empty($board_config['privmsg_disable']) ) +{ + message_die(GENERAL_MESSAGE, 'PM_disabled'); +} + // // Var definitions // @@ -817,7 +825,7 @@ else if( $submit || $refresh || $mode != "" ) { $to_username = $HTTP_POST_VARS['username']; - $sql = "SELECT user_id, user_notify_pm, user_email + $sql = "SELECT user_id, user_notify_pm, user_email, user_lang FROM " . USERS_TABLE . " WHERE username = '" . $to_username . "' AND user_id <> " . ANONYMOUS; @@ -977,7 +985,10 @@ else if( $submit || $refresh || $mode != "" ) include($phpbb_root_path . 'includes/emailer.'.$phpEx); $emailer = new emailer($board_config['smtp_delivery']); - $emailer->use_template("privmsg_notify"); + // + // Attempt to use language setting for recipient + // + $emailer->use_template("privmsg_notify", $to_userdata['user_lang']); $emailer->extra_headers($email_headers); $emailer->email_address($to_userdata['user_email']); diff --git a/phpBB/templates/subSilver/admin/board_config_body.tpl b/phpBB/templates/subSilver/admin/board_config_body.tpl index 2116e46aa2..7757264bb9 100644 --- a/phpBB/templates/subSilver/admin/board_config_body.tpl +++ b/phpBB/templates/subSilver/admin/board_config_body.tpl @@ -63,6 +63,25 @@ Enable Forum Pruning: {L_YES}   {L_NO} + + {L_PRIVATE_MESSAGING} + + + {L_DISABLE_PRIVATE_MESSAGING}: + {L_ENABLED}   {L_DISABLED} + + + {L_INBOX_LIMIT} + + + + {L_SENTBOX_LIMIT} + + + + {L_SAVEBOX_LIMIT} + + User/Forum Ability Settings