From 48b3a229d85d4736c3683dfa61d4202126e18214 Mon Sep 17 00:00:00 2001 From: pherum83 Date: Tue, 16 Aug 2011 23:02:39 +0000 Subject: [PATCH] r223 git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@223 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293 --- upload/ajax/edit_user_profile.php | 3 ++- upload/config.php | 6 +++--- upload/config_mods.php | 3 +++ upload/includes/datastore/build_stats.php | 22 ++++++++++++-------- upload/includes/init_bb.php | 4 ++++ upload/includes/ucp/usercp_viewprofile.php | 6 +++--- upload/index.php | 10 ++++----- upload/language/lang_english/lang_main.php | 1 + upload/language/lang_russian/lang_main.php | 1 + upload/templates/default/index.tpl | 3 +++ upload/templates/default/usercp_register.tpl | 2 ++ 11 files changed, 40 insertions(+), 21 deletions(-) diff --git a/upload/ajax/edit_user_profile.php b/upload/ajax/edit_user_profile.php index 580f6aeb1..86793eee6 100644 --- a/upload/ajax/edit_user_profile.php +++ b/upload/ajax/edit_user_profile.php @@ -47,7 +47,8 @@ switch ($field) break; case 'user_gender': - if (!isset($lang['GENDER_SELECT'][$value])) + if(!$bb_cfg['gender']) $this->ajax_die($lang['MODULE_OFF']); + if (!isset($lang['GENDER_SELECT'][$value])) { $this->ajax_die($lang['ERROR']); } diff --git a/upload/config.php b/upload/config.php index db5d9f6f9..9b8f3755c 100644 --- a/upload/config.php +++ b/upload/config.php @@ -57,7 +57,7 @@ $bb_cfg['css_ver'] = 1; // Increase number of revision after update $bb_cfg['tp_version'] = '2.1 Beta'; -$bb_cfg['tp_release_state'] = 'R219'; +$bb_cfg['tp_release_state'] = 'R223'; $bb_cfg['tp_release_date'] = '17-08-2011'; $bb_cfg['board_disabled_msg'] = 'форум временно отключен'; // 'forums temporarily disabled'; // show this msg if board has been disabled via ON/OFF trigger @@ -110,7 +110,7 @@ $bb_cfg['datastore_type'] = 'filecache'; $bb_cfg['server_name'] = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : 'torrentpier.me'; // The domain name from which this board runs $bb_cfg['server_port'] = (!empty($_SERVER['SERVER_PORT'])) ? $_SERVER['SERVER_PORT'] : 80; // The port your server is running on $bb_cfg['script_path'] = '/'; // The path where FORUM is located relative to the domain name -$bb_cfg['sitename'] = 'TorrentPier II - Torrent Tracker (see $bb_cfg[\'sitename\'] in config.php)'; // Name of your site +$bb_cfg['sitename'] = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : 'TorrentPier II - Torrent Tracker (see $bb_cfg[\'sitename\'] in config.php)'; // Name of your site // Server load $bb_cfg['max_srv_load'] = 0; // 0 - disable @@ -259,7 +259,7 @@ $bb_cfg['topic_tpl']['overall_header'] = TEMPLATES_DIR .'topic_tpl_overall_heade $bb_cfg['topic_tpl']['rules_video'] = TEMPLATES_DIR .'topic_tpl_rules_video.html'; // Cookie -$bb_cfg['cookie_domain'] = ''; # '.yourdomain.com' +$bb_cfg['cookie_domain'] = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : ''; # '.yourdomain.com' $bb_cfg['cookie_path'] = '/'; # '/forum/' $bb_cfg['cookie_secure'] = (!empty($_SERVER['HTTPS']) ? 1 : 0); # 0 $bb_cfg['cookie_prefix'] = 'bb_'; # 'bb_' diff --git a/upload/config_mods.php b/upload/config_mods.php index 3eef84594..08f086810 100644 --- a/upload/config_mods.php +++ b/upload/config_mods.php @@ -37,5 +37,8 @@ $bb_cfg['birthday']['max_user_age'] = 100; $bb_cfg['birthday']['min_user_age'] = 10; $bb_cfg['birthday']['check_day'] = 7; +// Gender +$bb_cfg['gender'] = true; + // CallSeed $bb_cfg['callseed'] = false; \ No newline at end of file diff --git a/upload/includes/datastore/build_stats.php b/upload/includes/datastore/build_stats.php index b9fbd7a8f..72dcfd1a3 100644 --- a/upload/includes/datastore/build_stats.php +++ b/upload/includes/datastore/build_stats.php @@ -29,16 +29,20 @@ $data['leechers'] = number_format($row['leechers']); $data['peers'] = number_format($row['seeders'] + $row['leechers']); $data['speed'] = $row['speed']; -global $bb_cfg, $lang; +global $bb_cfg; // gender stat -$sql = DB()->fetch_rowset("SELECT user_gender FROM ". BB_USERS ." WHERE user_id NOT IN(". EXCLUDED_USERS_CSV .")"); -$data['male'] = $data['female'] = $data['unselect'] = 0; -foreach($sql as $row) +if ($bb_cfg['gender']) { - if($row['user_gender'] == 1) $data['male']++; - if($row['user_gender'] == 2) $data['female']++; - if(!$row['user_gender']) $data['unselect']++; + $sql = DB()->fetch_rowset("SELECT user_gender FROM ". BB_USERS ." WHERE user_id NOT IN(". EXCLUDED_USERS_CSV .")"); + $data['male'] = $data['female'] = $data['unselect'] = 0; + + foreach($sql as $row) + { + if($row['user_gender'] == MALE) $data['male']++; + if($row['user_gender'] == FEMALE) $data['female']++; + if(!$row['user_gender']) $data['unselect']++; + } } // birthday stat @@ -70,8 +74,8 @@ if($bb_cfg['birthday']['check_day'] && $bb_cfg['birthday']['enabled']) } } - $data['birthday_today_list'] = ($birthday_today_list) ? $lang['BIRTHDAY_TODAY'] . join(', ', $birthday_today_list) : $lang['NOBIRTHDAY_TODAY']; - $data['birthday_week_list'] = ($birthday_week_list) ? sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day'], join(', ', $birthday_week_list)) : sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day']); + $data['birthday_today_list'] = $birthday_today_list; + $data['birthday_week_list'] = $birthday_week_list; } $this->store('stats', $data); diff --git a/upload/includes/init_bb.php b/upload/includes/init_bb.php index 886e21fbf..1d67974f2 100644 --- a/upload/includes/init_bb.php +++ b/upload/includes/init_bb.php @@ -271,6 +271,10 @@ define('POST_REPORT_URL', 'r'); define('POST_REPORT_REASON_URL', 'r'); // Report [END] +// Gender +define('MALE', 1); +define('FEMALE', 2); + // Torrents (reserved: -1) define('TOR_NOT_APPROVED', 0); // не проверено define('TOR_CLOSED', 1); // закрыто diff --git a/upload/includes/ucp/usercp_viewprofile.php b/upload/includes/ucp/usercp_viewprofile.php index 83ec36506..d27f01af0 100644 --- a/upload/includes/ucp/usercp_viewprofile.php +++ b/upload/includes/ucp/usercp_viewprofile.php @@ -103,8 +103,8 @@ $template->assign_vars(array( 'EMAIL' => $email, 'WWW' => $profiledata['user_website'], 'ICQ' => $profiledata['user_icq'], - 'LAST_VISIT_TIME' => ($profiledata['user_lastvisit']) ? (bf($profiledata['user_opt'], 'user_opt', 'allow_viewonline') && !IS_ADMIN) ? '---' : bb_date($profiledata['user_lastvisit'], 'Y-m-d H:i') : $lang['NEVER'], - 'LAST_ACTIVITY_TIME' => ($profiledata['user_session_time']) ? (bf($profiledata['user_opt'], 'user_opt', 'allow_viewonline') && !IS_ADMIN) ? '---' : bb_date($profiledata['user_session_time'], 'Y-m-d H:i') : $lang['NEVER'], + 'LAST_VISIT_TIME' => ($profiledata['user_lastvisit']) ? (bf($profiledata['user_opt'], 'user_opt', 'allow_viewonline') && !IS_ADMIN) ? $lang['HIDDEN_USER'] : bb_date($profiledata['user_lastvisit'], 'Y-m-d H:i') : $lang['NEVER'], + 'LAST_ACTIVITY_TIME' => ($profiledata['user_session_time']) ? (bf($profiledata['user_opt'], 'user_opt', 'allow_viewonline') && !IS_ADMIN) ? $lang['HIDDEN_USER'] : bb_date($profiledata['user_session_time'], 'Y-m-d H:i') : $lang['NEVER'], 'LOCATION' => ($profiledata['user_from']) ? $profiledata['user_from'] : '', 'USER_ACTIVE' => $profiledata['user_active'], @@ -112,7 +112,7 @@ $template->assign_vars(array( 'OCCUPATION' => $profiledata['user_occ'], 'INTERESTS' => $profiledata['user_interests'], 'SKYPE' => $profiledata['user_skype'], - 'GENDER' => ($profiledata['user_gender']) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '', + 'GENDER' => ($bb_cfg['gender'] && $profiledata['user_gender']) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '', 'BIRTHDAY' => ($bb_cfg['birthday']['enabled'] && $profiledata['user_birthday']) ? realdate($profiledata['user_birthday'], 'Y-m-d') : '', 'AGE' => ($bb_cfg['birthday']['enabled'] && $profiledata['user_birthday']) ? birthday_age($profiledata['user_birthday']) : '', 'AVATAR_IMG' => $avatar_img, diff --git a/upload/index.php b/upload/index.php index 693ad984f..06a840291 100644 --- a/upload/index.php +++ b/upload/index.php @@ -204,7 +204,7 @@ $template->assign_vars(array( 'TOTAL_TOPICS' => sprintf($lang['POSTED_TOPICS_TOTAL'], $stats['topiccount']), 'TOTAL_POSTS' => sprintf($lang['POSTED_ARTICLES_TOTAL'], $stats['postcount']), 'TOTAL_USERS' => sprintf($lang['REGISTERED_USERS_TOTAL'], $stats['usercount']), - 'TOTAL_GENDER' => sprintf($lang['USERS_TOTAL_GENDER'], $stats['male'], $stats['female'], $stats['unselect']), + 'TOTAL_GENDER' => ($bb_cfg['gender']) ? sprintf($lang['USERS_TOTAL_GENDER'], $stats['male'], $stats['female'], $stats['unselect']) : '', 'NEWEST_USER' => sprintf($lang['NEWEST_USER'], '', $stats['newestuser']['username'], ''), // Tracker stats @@ -339,10 +339,10 @@ if ($bb_cfg['show_latest_news']) if($bb_cfg['birthday']['check_day'] && $bb_cfg['birthday']['enabled']) { - $template->assign_vars(array( - 'WHOSBIRTHDAY_WEEK' => $stats['birthday_week_list'], - 'WHOSBIRTHDAY_TODAY' => $stats['birthday_today_list'], - )); + $template->assign_vars(array( + 'WHOSBIRTHDAY_WEEK' => ($stats['birthday_week_list']) ? sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day'], join(', ', $stats['birthday_week_list'])) : sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday']['check_day']), + 'WHOSBIRTHDAY_TODAY' => ($stats['birthday_today_list']) ? $lang['BIRTHDAY_TODAY'] . join(', ', $stats['birthday_today_list']) : $lang['NOBIRTHDAY_TODAY'], + )); } // Allow cron diff --git a/upload/language/lang_english/lang_main.php b/upload/language/lang_english/lang_main.php index cffb3fe32..49ed8ed73 100644 --- a/upload/language/lang_english/lang_main.php +++ b/upload/language/lang_english/lang_main.php @@ -633,6 +633,7 @@ $lang['CURRENT_IMAGE'] = 'Current Image'; $lang['NOTIFY_ON_PRIVMSG'] = 'Notify on new Private Message'; $lang['HIDE_USER'] = 'Hide your online status'; +$lang['HIDDEN_USER'] = 'Hidden user'; $lang['PROFILE_UPDATED'] = 'Your profile has been updated'; $lang['PROFILE_UPDATED_INACTIVE'] = 'Your profile has been updated. However, you have changed vital details, thus your account is now inactive. Check your e-mail to find out how to reactivate your account, or if admin activation is required, wait for the administrator to reactivate it.'; diff --git a/upload/language/lang_russian/lang_main.php b/upload/language/lang_russian/lang_main.php index 0ffe4d85f..a559f4647 100644 --- a/upload/language/lang_russian/lang_main.php +++ b/upload/language/lang_russian/lang_main.php @@ -640,6 +640,7 @@ $lang['CURRENT_IMAGE'] = 'Текущее изображение'; $lang['NOTIFY_ON_PRIVMSG'] = 'Уведомлять о новых личных сообщениях'; $lang['HIDE_USER'] = 'Скрывать ваше пребывание на форуме'; +$lang['HIDDEN_USER'] = 'Скрыто пользователем'; $lang['PROFILE_UPDATED'] = 'Ваш профиль был изменён'; $lang['PROFILE_UPDATED_INACTIVE'] = 'Ваш профиль был изменён, но вы изменили важные данные, так что теперь ваша учётная запись неактивна. Проверьте ваш почтовый ящик, чтобы узнать как вновь активировать учётную запись или, если требуется одобрение администратора, подождите, пока это сделает администратор.'; diff --git a/upload/templates/default/index.tpl b/upload/templates/default/index.tpl index eb2cb8719..24bbaab20 100644 --- a/upload/templates/default/index.tpl +++ b/upload/templates/default/index.tpl @@ -181,9 +181,12 @@

{PEERS_STAT}

{SPEED_STAT}

+

{WHOSBIRTHDAY_TODAY}

{WHOSBIRTHDAY_WEEK}

+ +

{TOTAL_USERS_ONLINE}  {USERS_ONLINE_COUNTS}

diff --git a/upload/templates/default/usercp_register.tpl b/upload/templates/default/usercp_register.tpl index a3ca24727..b18537dd4 100644 --- a/upload/templates/default/usercp_register.tpl +++ b/upload/templates/default/usercp_register.tpl @@ -85,10 +85,12 @@ ajax.callback.gen_passkey = function(data){ {L_PROFILE_INFO} + {L_GENDER}: {USER_GENDER} + {L_BIRTHDAY}: